@@ -22,6 +22,8 @@
//
//
# import "XJHealthArchiveDetailViewController.h"
# import "XJHealthArchiveDetailViewController.h"
# import "XJOnePersonCaseModel.h"
# import "XJPNetAPI.h"
// 颜色(Figma 设计稿规范)
// 颜色(Figma 设计稿规范)
# define kGreenColor UIColorHex(0x2EB8B2)
# define kGreenColor UIColorHex(0x2EB8B2)
@@ -46,6 +48,7 @@ static const CGFloat kContentLR = 16;
@property ( nonatomic , strong ) UIScrollView * scrollView ;
@property ( nonatomic , strong ) UIScrollView * scrollView ;
@property ( nonatomic , assign ) CGFloat contentBottom ;
@property ( nonatomic , assign ) CGFloat contentBottom ;
@property ( nonatomic , strong ) XJOnePersonCaseModel * onePersonCaseModel ;
@end
@end
@@ -76,17 +79,14 @@ static const CGFloat kContentLR = 16;
self . navigationItem . leftBarButtonItem = [ [ UIBarButtonItem alloc ] initWithCustomView : backBtn ] ;
self . navigationItem . leftBarButtonItem = [ [ UIBarButtonItem alloc ] initWithCustomView : backBtn ] ;
[ self setupScrollView ] ;
[ self setupScrollView ] ;
[ self buildHeader ] ;
[ self requestOnePersonCase ] ;
self . contentBottom = [ self buildCareInfo : self . contentBottom ] ;
}
self . contentBottom = [ self buildArchive : self . contentBottom ] ;
self . contentBottom = [ self buildCardiovascular : self . contentBottom ] ;
self . contentBottom = [ self buildGlucose : self . contentBottom ] ;
self . contentBottom = [ self buildLipid : self . contentBottom ] ;
self . contentBottom = [ self buildKidney : self . contentBottom ] ;
self . contentBottom = [ self buildSpecial : self . contentBottom ] ;
self . contentBottom = [ self buildMedical : self . contentBottom ] ;
[ self updateContentSize ] ;
- ( void ) requestOnePersonCase {
NSMutableDictionary * params = [ NSMutableDictionary dictionary ] ;
params [ @" idCard " ] = self . idCard ;
XJPNetAPI * api = [ [ XJPNetAPI alloc ] init : self tag : @" OnePersonCase " NeedToken : @" 1 " ] ;
[ api getOnePersonCase : params ] ;
}
}
- ( void ) viewDidLayoutSubviews {
- ( void ) viewDidLayoutSubviews {
@@ -114,6 +114,122 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 +
[ self . navigationController popViewControllerAnimated : YES ] ;
[ self . navigationController popViewControllerAnimated : YES ] ;
}
}
# pragma mark - ————— 负面清单弹窗 —————
- ( void ) showNegativeListPopup {
NSString * fullText = self . onePersonCaseModel . negativeList ;
if ( fullText . length = = 0 ) return ;
// 半透明遮罩
UIView * mask = [ [ UIView alloc ] initWithFrame : self . view . bounds ] ;
mask . backgroundColor = [ UIColor colorWithWhite : 0 alpha : 0.4 ] ;
mask . alpha = 0 ;
mask . tag = 999 ;
[ self . view addSubview : mask ] ;
// 白色圆角弹窗
CGFloat popupW = kScreenWidth - 48 ;
CGFloat popupMaxH = kScreenHeight * 0.7 ;
UIView * popup = [ [ UIView alloc ] init ] ;
popup . backgroundColor = KWhiteColor ;
popup . layer . cornerRadius = 16 ;
popup . layer . masksToBounds = YES ;
[ mask addSubview : popup ] ;
// 标题
UILabel * titleLbl = [ [ UILabel alloc ] initWithFrame : CGRectMake ( 20 , 20 , popupW - 40 , 22 ) ] ;
titleLbl . text = @" 负面清单 " ;
titleLbl . textColor = kDarkTextColor ;
titleLbl . font = [ UIFont systemFontOfSize : 17 weight : UIFontWeightBold ] ;
[ popup addSubview : titleLbl ] ;
// 滚动文本
CGFloat textY = 56 ;
CGFloat textMaxH = popupMaxH - textY - 64 ;
UIScrollView * textSv = [ [ UIScrollView alloc ] initWithFrame : CGRectMake ( 20 , textY , popupW - 40 , textMaxH ) ] ;
textSv . showsVerticalScrollIndicator = YES ;
[ popup addSubview : textSv ] ;
CGFloat textH = [ fullText boundingRectWithSize : CGSizeMake ( popupW - 40 , CGFLOAT_MAX )
options : NSStringDrawingUsesLineFragmentOrigin
attributes : @{ NSFontAttributeName : [ UIFont systemFontOfSize : 14 ] }
context : nil ] . size . height ;
UILabel * contentLbl = [ [ UILabel alloc ] initWithFrame : CGRectMake ( 0 , 0 , popupW - 40 , MAX ( textH , textMaxH ) ) ] ;
contentLbl . text = fullText ;
contentLbl . textColor = UIColorHex ( 0x555555 ) ;
contentLbl . font = [ UIFont systemFontOfSize : 14 ] ;
contentLbl . numberOfLines = 0 ;
[ textSv addSubview : contentLbl ] ;
textSv . contentSize = CGSizeMake ( popupW - 40 , textH ) ;
// 关闭按钮
CGFloat btnY = textY + textMaxH + 16 ;
UIButton * closeBtn = [ UIButton buttonWithType : UIButtonTypeCustom ] ;
closeBtn . frame = CGRectMake ( ( popupW - 80 ) / 2.0 , btnY , 80 , 36 ) ;
[ closeBtn setTitle : @" 关闭 " forState : UIControlStateNormal ] ;
[ closeBtn setTitleColor : KWhiteColor forState : UIControlStateNormal ] ;
closeBtn . titleLabel . font = [ UIFont systemFontOfSize : 14 weight : UIFontWeightMedium ] ;
closeBtn . backgroundColor = kGreenColor ;
closeBtn . layer . cornerRadius = 18 ;
[ closeBtn addTarget : self action : @selector ( dismissNegativeListPopup ) forControlEvents : UIControlEventTouchUpInside ] ;
[ popup addSubview : closeBtn ] ;
CGFloat popupH = btnY + 52 ;
popup . frame = CGRectMake ( 24 , ( kScreenHeight - popupH ) / 2.0 - 40 , popupW , popupH ) ;
// 动画弹出
popup . transform = CGAffineTransformMakeScale ( 0.9 , 0.9 ) ;
popup . alpha = 0 ;
[ UIView animateWithDuration : 0.25 animations : ^ {
mask . alpha = 1 ;
popup . alpha = 1 ;
popup . transform = CGAffineTransformIdentity ;
} ] ;
}
- ( void ) dismissNegativeListPopup {
UIView * mask = [ self . view viewWithTag : 999 ] ;
[ UIView animateWithDuration : 0.2 animations : ^ {
mask . alpha = 0 ;
} completion : ^ ( BOOL finished ) {
[ mask removeFromSuperview ] ;
} ] ;
}
# pragma mark - ————— Network —————
- ( void ) Sucess: ( id ) response tag: ( NSString * ) tag {
if ( [ tag isEqualToString : @" OnePersonCase " ] ) {
if ( [ response isKindOfClass : [ NSDictionary class ] ] ) {
self . onePersonCaseModel = [ XJOnePersonCaseModel modelWithDictionary : response ] ;
}
dispatch_async ( dispatch_get_main_queue ( ) , ^ {
[ self buildContent ] ;
} ) ;
}
}
- ( void ) Failed: ( NSString * ) message tag: ( NSString * ) tag {
if ( [ tag isEqualToString : @" OnePersonCase " ] ) {
dispatch_async ( dispatch_get_main_queue ( ) , ^ {
[ self buildContent ] ;
} ) ;
}
}
- ( void ) buildContent {
[ self buildHeader ] ;
self . contentBottom = [ self buildCareInfo : self . contentBottom ] ;
self . contentBottom = [ self buildArchive : self . contentBottom ] ;
self . contentBottom = [ self buildCardiovascular : self . contentBottom ] ;
self . contentBottom = [ self buildGlucose : self . contentBottom ] ;
self . contentBottom = [ self buildLipid : self . contentBottom ] ;
self . contentBottom = [ self buildKidney : self . contentBottom ] ;
self . contentBottom = [ self buildSpecial : self . contentBottom ] ;
self . contentBottom = [ self buildMedical : self . contentBottom ] ;
[ self updateContentSize ] ;
}
# pragma mark - ————— 通用组件 —————
# pragma mark - ————— 通用组件 —————
/// 白色圆角卡片
/// 白色圆角卡片
@@ -323,8 +439,8 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 +
dc . frame = CGRectMake ( col1w - 0.5 , ry , col234w , rh ) ;
dc . frame = CGRectMake ( col1w - 0.5 , ry , col234w , rh ) ;
[ container addSubview : dc ] ;
[ container addSubview : dc ] ;
// 控制目标
// 控制目标(接口返回值已含单位,直接展示)
NSString * tvs = [ NSString stringWithFormat : @" %@%@ " , d [ @" targetVal " ] , d [ @" unit " ] ] ;
NSString * tvs = d [ @" targetVal " ] ;
UIView * tc = [ self tableCell : tvs color : kNormalColor bg : KWhiteColor width : col234w height : rh isFirst : NO isLast : NO ] ;
UIView * tc = [ self tableCell : tvs color : kNormalColor bg : KWhiteColor width : col234w height : rh isFirst : NO isLast : NO ] ;
tc . frame = CGRectMake ( col1w + col234w - 1 , ry , col234w , rh ) ;
tc . frame = CGRectMake ( col1w + col234w - 1 , ry , col234w , rh ) ;
[ container addSubview : tc ] ;
[ container addSubview : tc ] ;
@@ -400,37 +516,47 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 +
cy + = 6 ;
cy + = 6 ;
// 姓名 —— 距左边20,距顶部22
// 姓名 —— 距左边20,距顶部22
NSString * nameText = self . onePersonCaseModel . name . length > 0 ? self . onePersonCaseModel . name : @" -- " ;
UILabel * nameLbl = [ [ UILabel alloc ] initWithFrame : CGRectMake ( 20 , 22 , 160 , 24 ) ] ;
UILabel * nameLbl = [ [ UILabel alloc ] initWithFrame : CGRectMake ( 20 , 22 , 160 , 24 ) ] ;
nameLbl . text = @" 艾比拜·牙库甫 " ;
nameLbl . text = nameText ;
nameLbl . textColor = kDarkTextColor ;
nameLbl . textColor = kDarkTextColor ;
nameLbl . font = [ UIFont systemFontOfSize : 18 weight : UIFontWeightHeavy ] ;
nameLbl . font = [ UIFont systemFontOfSize : 18 weight : UIFontWeightHeavy ] ;
[ card addSubview : nameLbl ] ;
[ card addSubview : nameLbl ] ;
// 性别年龄 —— 相对姓名lab上下居中
// 性别年龄
NSString * sexStr = @" -- " ;
if ( [ self . onePersonCaseModel . sexCode isEqualToString : @" 1 " ] ) {
sexStr = @" 男性 " ;
} else if ( [ self . onePersonCaseModel . sexCode isEqualToString : @" 2 " ] ) {
sexStr = @" 女性 " ;
}
NSString * ageStr = self . onePersonCaseModel . age > 0 ? [ NSString stringWithFormat : @" %ld岁 " , ( long ) self . onePersonCaseModel . age ] : @" --岁 " ;
CGFloat gaH = 18 ;
CGFloat gaH = 18 ;
CGFloat gaY = nameLbl . frame . origin . y + ( nameLbl . frame . size . height - gaH ) / 2.0 ;
CGFloat gaY = nameLbl . frame . origin . y + ( nameLbl . frame . size . height - gaH ) / 2.0 ;
UILabel * gaLbl = [ [ UILabel alloc ] initWithFrame : CGRectMake ( kCardW - kContentLR - 100 , gaY , 100 , gaH ) ] ;
UILabel * gaLbl = [ [ UILabel alloc ] initWithFrame : CGRectMake ( kCardW - kContentLR - 140 , gaY , 140 , gaH ) ] ;
gaLbl . text = @" 男性 · 52岁 " ;
gaLbl . text = [ NSString stringWithFormat : @" %@ · %@ " , sexStr , ageStr ] ;
gaLbl . textColor = kDarkTextColor ;
gaLbl . textColor = kDarkTextColor ;
gaLbl . font = [ UIFont systemFontOfSize : 14 weight : UIFontWeightHeavy ] ;
gaLbl . font = [ UIFont systemFontOfSize : 14 weight : UIFontWeightHeavy ] ;
gaLbl . textAlignment = NSTextAlignmentRight ;
gaLbl . textAlignment = NSTextAlignmentRight ;
[ card addSubview : gaLbl ] ;
[ card addSubview : gaLbl ] ;
// 档案已建立标签 —— 在姓名底部+8处
// 档案状态标签
BOOL hasArchive = self . onePersonCaseModel . archiveId . length > 0 ;
UILabel * badge = [ [ UILabel alloc ] initWithFrame : CGRectMake ( kCardW - kContentLR - 84 , nameLbl . frame . origin . y + nameLbl . frame . size . height + 8 , 84 , 24 ) ] ;
UILabel * badge = [ [ UILabel alloc ] initWithFrame : CGRectMake ( kCardW - kContentLR - 84 , nameLbl . frame . origin . y + nameLbl . frame . size . height + 8 , 84 , 24 ) ] ;
badge . text = @" 档案已建立 " ;
badge . text = hasArchive ? @" 档案已建立 " : @" 暂无档案 " ;
badge . textColor = KWhiteColor ;
badge . textColor = KWhiteColor ;
badge . font = [ UIFont systemFontOfSize : 13 weight : UIFontWeightBold ] ;
badge . font = [ UIFont systemFontOfSize : 13 weight : UIFontWeightBold ] ;
badge . backgroundColor = kGreenColor ;
badge . backgroundColor = hasArchive ? kGreenColor : UIColorHex ( 0xBBBBBB ) ;
badge . layer . cornerRadius = 4 ;
badge . layer . cornerRadius = 4 ;
badge . layer . masksToBounds = YES ;
badge . layer . masksToBounds = YES ;
badge . textAlignment = NSTextAlignmentCenter ;
badge . textAlignment = NSTextAlignmentCenter ;
[ card addSubview : badge ] ;
[ card addSubview : badge ] ;
// 公司 —— 距姓名lab底部+16
// 公司
NSString * workUnitText = self . onePersonCaseModel . workUnit . length > 0 ? self . onePersonCaseModel . workUnit : @" -- " ;
CGFloat compY = nameLbl . frame . origin . y + nameLbl . frame . size . height + 16 ;
CGFloat compY = nameLbl . frame . origin . y + nameLbl . frame . size . height + 16 ;
UILabel * compLbl = [ [ UILabel alloc ] initWithFrame : CGRectMake ( kContentLR , compY , kCardW - kContentLR * 2 , 16 ) ] ;
UILabel * compLbl = [ [ UILabel alloc ] initWithFrame : CGRectMake ( kContentLR , compY , kCardW - kContentLR * 2 , 16 ) ] ;
compLbl . text = @" 新疆油田分公司采油一厂 " ;
compLbl . text = workUnitText ;
compLbl . textColor = kDarkTextColor ;
compLbl . textColor = kDarkTextColor ;
compLbl . font = [ UIFont systemFontOfSize : 14 weight : UIFontWeightBold ] ;
compLbl . font = [ UIFont systemFontOfSize : 14 weight : UIFontWeightBold ] ;
[ card addSubview : compLbl ] ;
[ card addSubview : compLbl ] ;
@@ -457,7 +583,7 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 +
[ infoBg addSubview : idTitle ] ;
[ infoBg addSubview : idTitle ] ;
UILabel * idVal = [ [ UILabel alloc ] initWithFrame : CGRectMake ( infoW - 12 - 200 , 14 , 200 , 20 ) ] ;
UILabel * idVal = [ [ UILabel alloc ] initWithFrame : CGRectMake ( infoW - 12 - 200 , 14 , 200 , 20 ) ] ;
idVal . text = @" 650202197403151234 " ;
idVal . text = self . onePersonCaseModel . idNo . length > 0 ? self . onePersonCaseModel . idNo : @" -- " ;
idVal . textColor = kInfoValueColor ;
idVal . textColor = kInfoValueColor ;
idVal . font = [ UIFont systemFontOfSize : 13 weight : UIFontWeightMedium ] ;
idVal . font = [ UIFont systemFontOfSize : 13 weight : UIFontWeightMedium ] ;
idVal . textAlignment = NSTextAlignmentRight ;
idVal . textAlignment = NSTextAlignmentRight ;
@@ -470,8 +596,17 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 +
phTitle . font = [ UIFont systemFontOfSize : 13 weight : UIFontWeightMedium ] ;
phTitle . font = [ UIFont systemFontOfSize : 13 weight : UIFontWeightMedium ] ;
[ infoBg addSubview : phTitle ] ;
[ infoBg addSubview : phTitle ] ;
// 手机号脱敏显示
NSString * phoneText = @" -- " ;
if ( self . onePersonCaseModel . phone . length > = 11 ) {
phoneText = [ NSString stringWithFormat : @" %@****%@ " ,
[ self . onePersonCaseModel . phone substringToIndex : 3 ] ,
[ self . onePersonCaseModel . phone substringFromIndex : self . onePersonCaseModel . phone . length - 4 ] ] ;
} else if ( self . onePersonCaseModel . phone . length > 0 ) {
phoneText = self . onePersonCaseModel . phone ;
}
UILabel * phVal = [ [ UILabel alloc ] initWithFrame : CGRectMake ( infoW - 12 - 200 , 44 , 200 , 20 ) ] ;
UILabel * phVal = [ [ UILabel alloc ] initWithFrame : CGRectMake ( infoW - 12 - 200 , 44 , 200 , 20 ) ] ;
phVal . text = @" 157****5522 " ;
phVal . text = phoneText ;
phVal . textColor = kInfoValueColor ;
phVal . textColor = kInfoValueColor ;
phVal . font = [ UIFont systemFontOfSize : 13 weight : UIFontWeightMedium ] ;
phVal . font = [ UIFont systemFontOfSize : 13 weight : UIFontWeightMedium ] ;
phVal . textAlignment = NSTextAlignmentRight ;
phVal . textAlignment = NSTextAlignmentRight ;
@@ -488,8 +623,9 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 +
UIView * card = [ self makeCard : y ] ;
UIView * card = [ self makeCard : y ] ;
CGFloat inner = 0 ;
CGFloat inner = 0 ;
// 标题行(含"重点关爱"右上角 标签)
// 标题行(关爱状态 标签)
[ self addCardTitle : @" 关爱管理信息 " tagText : @" 重点关爱 " inCard : card ] ;
NSString * careTag = [ self . onePersonCaseModel . careStatus isEqualToString : @" 1 " ] ? @" 重点关爱 " : @" " ;
[ self addCardTitle : @" 关爱管理信息 " tagText : careTag inCard : card ] ;
inner = 48 ;
inner = 48 ;
// 关爱联络员
// 关爱联络员
@@ -501,7 +637,7 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 +
[ contactRow addSubview : cl ] ;
[ contactRow addSubview : cl ] ;
UILabel * cv = [ [ UILabel alloc ] initWithFrame : CGRectMake ( kCardW - kContentLR - 200 , 0 , 200 , 48 ) ] ;
UILabel * cv = [ [ UILabel alloc ] initWithFrame : CGRectMake ( kCardW - kContentLR - 200 , 0 , 200 , 48 ) ] ;
cv . text = @" 陈沐辰 " ;
cv . text = self . onePersonCaseModel . careLiaisonName . length > 0 ? self . onePersonCaseModel . careLiaisonName : @" -- " ;
cv . textColor = kDarkTextColor ;
cv . textColor = kDarkTextColor ;
cv . font = [ UIFont systemFontOfSize : 13 weight : UIFontWeightMedium ] ;
cv . font = [ UIFont systemFontOfSize : 13 weight : UIFontWeightMedium ] ;
cv . textAlignment = NSTextAlignmentRight ;
cv . textAlignment = NSTextAlignmentRight ;
@@ -513,7 +649,7 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 +
div . backgroundColor = kDividerColor ;
div . backgroundColor = kDividerColor ;
[ self placeView : div at : & inner in : card ] ;
[ self placeView : div at : & inner in : card ] ;
// 负面清单
// 负面清单(单行截断,点击弹窗查看全文)
UIView * negRow = [ [ UIView alloc ] initWithFrame : CGRectMake ( 0 , 0 , kCardW , 48 ) ] ;
UIView * negRow = [ [ UIView alloc ] initWithFrame : CGRectMake ( 0 , 0 , kCardW , 48 ) ] ;
UILabel * nl = [ [ UILabel alloc ] initWithFrame : CGRectMake ( kContentLR , 0 , 80 , 48 ) ] ;
UILabel * nl = [ [ UILabel alloc ] initWithFrame : CGRectMake ( kContentLR , 0 , 80 , 48 ) ] ;
nl . text = @" 负面清单 " ;
nl . text = @" 负面清单 " ;
@@ -521,11 +657,21 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 +
nl . font = [ UIFont systemFontOfSize : 14 weight : UIFontWeightMedium ] ;
nl . font = [ UIFont systemFontOfSize : 14 weight : UIFontWeightMedium ] ;
[ negRow addSubview : nl ] ;
[ negRow addSubview : nl ] ;
NSString * rawNeg = self . onePersonCaseModel . negativeList . length > 0 ? self . onePersonCaseModel . negativeList : @" -- " ;
// 单行展示:把换行替换为空格,避免 \n 处直接截断只显示两个字
NSString * negText = [ rawNeg stringByReplacingOccurrencesOfString : @" \n " withString : @" " ] ;
UILabel * nv = [ [ UILabel alloc ] initWithFrame : CGRectMake ( kCardW - kContentLR - 200 , 0 , 200 , 48 ) ] ;
UILabel * nv = [ [ UILabel alloc ] initWithFrame : CGRectMake ( kCardW - kContentLR - 200 , 0 , 200 , 48 ) ] ;
nv . text = @" 胃炎、高尿酸、负重关节炎 " ;
nv . text = negText ;
nv . textColor = UIColorHex ( 0x77849E ) ;
nv . textColor = UIColorHex ( 0x77849E ) ;
nv . font = [ UIFont systemFontOfSize : 13 weight : UIFontWeightMedium ] ;
nv . font = [ UIFont systemFontOfSize : 13 weight : UIFontWeightMedium ] ;
nv . textAlignment = NSTextAlignmentRight ;
nv . textAlignment = NSTextAlignmentRight ;
nv . numberOfLines = 1 ;
nv . lineBreakMode = NSLineBreakByTruncatingTail ;
nv . userInteractionEnabled = YES ;
if ( negText . length > 0 & & ! [ negText isEqualToString : @" -- " ] ) {
UITapGestureRecognizer * tap = [ [ UITapGestureRecognizer alloc ] initWithTarget : self action : @selector ( showNegativeListPopup ) ] ;
[ nv addGestureRecognizer : tap ] ;
}
[ negRow addSubview : nv ] ;
[ negRow addSubview : nv ] ;
[ self placeView : negRow at : & inner in : card ] ;
[ self placeView : negRow at : & inner in : card ] ;
@@ -561,9 +707,10 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 +
CGFloat weightAreaH = 48 ;
CGFloat weightAreaH = 48 ;
UIView * weightRow = [ [ UIView alloc ] initWithFrame : CGRectMake ( 0 , inner , kCardW , weightAreaH ) ] ;
UIView * weightRow = [ [ UIView alloc ] initWithFrame : CGRectMake ( 0 , inner , kCardW , weightAreaH ) ] ;
// 左侧:体重数值 + 单位(自适应宽度)
// 左侧:体重数值 + 单位
NSString * weightText = self . onePersonCaseModel . weight . length > 0 ? self . onePersonCaseModel . weight : @" -- " ;
UILabel * wgt = [ [ UILabel alloc ] init ] ;
UILabel * wgt = [ [ UILabel alloc ] init ] ;
wgt . text = @" 68.20 " ;
wgt . text = weightText ;
wgt . textColor = kDarkTextColor ;
wgt . textColor = kDarkTextColor ;
wgt . font = [ UIFont systemFontOfSize : 40 weight : UIFontWeightHeavy ] ;
wgt . font = [ UIFont systemFontOfSize : 40 weight : UIFontWeightHeavy ] ;
[ wgt sizeToFit ] ;
[ wgt sizeToFit ] ;
@@ -578,24 +725,24 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 +
wUnit . frame = CGRectMake ( CGRectGetMaxX ( wgt . frame ) + 4 , 26 , wUnit . frame . size . width , wUnit . frame . size . height ) ;
wUnit . frame = CGRectMake ( CGRectGetMaxX ( wgt . frame ) + 4 , 26 , wUnit . frame . size . width , wUnit . frame . size . height ) ;
[ weightRow addSubview : wUnit ] ;
[ weightRow addSubview : wUnit ] ;
// 右侧:体重变化区 —— 整体在卡片右半边居中
// 右侧:体重风险类型
NSString * riskText = self . onePersonCaseModel . weightRiskType . length > 0 ? self . onePersonCaseModel . weightRiskType : @" -- " ;
UILabel * wChange = [ [ UILabel alloc ] init ] ;
UILabel * wChange = [ [ UILabel alloc ] init ] ;
wChange . text = @" 2.6 " ;
wChange . text = riskText ;
wChange . textColor = kGreenColor ;
wChange . textColor = kGreenColor ;
wChange . font = [ UIFont systemFontOfSize : 24 weight : UIFontWeightHeavy ] ;
wChange . font = [ UIFont systemFontOfSize : 24 weight : UIFontWeightHeavy ] ;
[ wChange sizeToFit ] ;
[ wChange sizeToFit ] ;
UILabel * wChangeUnit = [ [ UILabel alloc ] init ] ;
UILabel * wChangeUnit = [ [ UILabel alloc ] init ] ;
wChangeUnit . text = @" kg " ;
wChangeUnit . text = @" " ;
wChangeUnit . textColor = kGreenColor ;
wChangeUnit . textColor = kGreenColor ;
wChangeUnit . font = [ UIFont systemFontOfSize : 14 weight : UIFontWeightMedium ] ;
wChangeUnit . font = [ UIFont systemFontOfSize : 14 weight : UIFontWeightMedium ] ;
[ wChangeUnit sizeToFit ] ;
[ wChangeUnit sizeToFit ] ;
// 上半行总宽:2.6 + kg
CGFloat topRowW = wChange . frame . size . width + wChangeUnit . frame . size . width ;
CGFloat topRowW = wChange . frame . size . width + wChangeUnit . frame . size . width ;
UILabel * wTip = [ [ UILabel alloc ] init ] ;
UILabel * wTip = [ [ UILabel alloc ] init ] ;
wTip . text = @" 体重较上次减轻 " ;
wTip . text = @" 体重风险类型 " ;
wTip . textColor = kGrayTextColor ;
wTip . textColor = kGrayTextColor ;
wTip . font = [ UIFont systemFontOfSize : 12 weight : UIFontWeightMedium ] ;
wTip . font = [ UIFont systemFontOfSize : 12 weight : UIFontWeightMedium ] ;
[ wTip sizeToFit ] ;
[ wTip sizeToFit ] ;
@@ -605,35 +752,25 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 +
CGFloat rightHalfCenterX = kCardW / 2.0 + ( kCardW - kContentLR - kCardW / 2.0 ) / 2.0 ;
CGFloat rightHalfCenterX = kCardW / 2.0 + ( kCardW - kContentLR - kCardW / 2.0 ) / 2.0 ;
CGFloat blockX = rightHalfCenterX - blockW / 2.0 ;
CGFloat blockX = rightHalfCenterX - blockW / 2.0 ;
// 2.6
// 风险类型数值
wChange . frame = CGRectMake ( blockX , 2 , wChange . frame . size . width , 24 ) ;
wChange . frame = CGRectMake ( blockX , 2 , wChange . frame . size . width , 24 ) ;
[ weightRow addSubview : wChange ] ;
[ weightRow addSubview : wChange ] ;
// kg(紧跟2.6)
// 箭头去掉——体重风险类型不加单位
wChangeUnit . frame = CGRectMake ( CGRectGetMaxX ( wChange . frame ) , 10 , wChangeUnit . frame . size . width , wChangeUnit . frame . size . height ) ;
wChangeUnit . frame = CGRectMake ( CGRectGetMaxX ( wChange . frame ) , 10 , wChangeUnit . frame . size . width , wChangeUnit . frame . size . height ) ;
[ weightRow addSubview : wChangeUnit ] ;
[ weightRow addSubview : wChangeUnit ] ;
// 箭头在 kg 上方居中
// 体重风险类型说明
UILabel * arrowLbl = [ [ UILabel alloc ] initWithFrame : CGRectMake ( 0 , 0 , 14 , 12 ) ] ;
arrowLbl . text = @" ↑ " ;
arrowLbl . textColor = kGreenColor ;
arrowLbl . font = [ UIFont systemFontOfSize : 12 weight : UIFontWeightBold ] ;
arrowLbl . textAlignment = NSTextAlignmentCenter ;
CGFloat kgCenterX = wChangeUnit . frame . origin . x + wChangeUnit . frame . size . width / 2.0 ;
arrowLbl . frame = CGRectMake ( kgCenterX - 7 , 0 , 14 , 12 ) ;
[ weightRow addSubview : arrowLbl ] ;
// 体重较上次减轻(居中于block)
wTip . frame = CGRectMake ( blockX , 28 , blockW , wTip . frame . size . height ) ;
wTip . frame = CGRectMake ( blockX , 28 , blockW , wTip . frame . size . height ) ;
wTip . textAlignment = NSTextAlignmentCenter ;
wTip . textAlignment = NSTextAlignmentCenter ;
[ weightRow addSubview : wTip ] ;
[ weightRow addSubview : wTip ] ;
[ self placeView : weightRow at : & inner in : card ] ;
[ self placeView : weightRow at : & inner in : card ] ;
// 日期 —— 体重区域底部+8
// 日期
inner + = 8 ;
inner + = 8 ;
UILabel * wDate = [ [ UILabel alloc ] initWithFrame : CGRectMake ( kContentLR , inner , 120 , 14 ) ] ;
UILabel * wDate = [ [ UILabel alloc ] initWithFrame : CGRectMake ( kContentLR , inner , 120 , 14 ) ] ;
wDate . text = @" 06-25 09:30 " ;
wDate . text = @" -- " ;
wDate . textColor = kGrayTextColor ;
wDate . textColor = kGrayTextColor ;
wDate . font = [ UIFont systemFontOfSize : 12 weight : UIFontWeightMedium ] ;
wDate . font = [ UIFont systemFontOfSize : 12 weight : UIFontWeightMedium ] ;
[ card addSubview : wDate ] ;
[ card addSubview : wDate ] ;
@@ -652,7 +789,8 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 +
CGFloat colH = 60 ;
CGFloat colH = 60 ;
// 判断 BMI 是否标准(18.5~24 为标准)
// 判断 BMI 是否标准(18.5~24 为标准)
CGFloat bmiVal = 22.4 ;
NSString * bmiStr = self . onePersonCaseModel . bmiCurrent . length > 0 ? self . onePersonCaseModel . bmiCurrent : self . onePersonCaseModel . bmi ;
CGFloat bmiVal = [ bmiStr floatValue ] ;
BOOL bmiIsStandard = ( bmiVal > = 18.5 & & bmiVal < 24.0 ) ;
BOOL bmiIsStandard = ( bmiVal > = 18.5 & & bmiVal < 24.0 ) ;
// 卡片1:身高(值+单位居中)
// 卡片1:身高(值+单位居中)
@@ -668,9 +806,10 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 +
t1 . textAlignment = NSTextAlignmentCenter ;
t1 . textAlignment = NSTextAlignmentCenter ;
[ col1 addSubview : t1 ] ;
[ col1 addSubview : t1 ] ;
// "172" + "cm" 整体居中
// 身高数值 + "cm" 整体居中
NSString * heightText = self . onePersonCaseModel . height . length > 0 ? self . onePersonCaseModel . height : @" -- " ;
UILabel * v1 = [ [ UILabel alloc ] init ] ;
UILabel * v1 = [ [ UILabel alloc ] init ] ;
v1 . text = @" 172 " ;
v1 . text = heightText ;
v1 . textColor = kDarkTextColor ;
v1 . textColor = kDarkTextColor ;
v1 . font = [ UIFont systemFontOfSize : 22 weight : UIFontWeightHeavy ] ;
v1 . font = [ UIFont systemFontOfSize : 22 weight : UIFontWeightHeavy ] ;
[ v1 sizeToFit ] ;
[ v1 sizeToFit ] ;
@@ -713,8 +852,9 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 +
[ col2 addSubview : bmiStatus ] ;
[ col2 addSubview : bmiStatus ] ;
// BMI 数值居中
// BMI 数值居中
NSString * bmiDisplay = bmiStr . length > 0 ? bmiStr : @" -- " ;
UILabel * v2 = [ [ UILabel alloc ] initWithFrame : CGRectMake ( 0 , 26 , colW , 26 ) ] ;
UILabel * v2 = [ [ UILabel alloc ] initWithFrame : CGRectMake ( 0 , 26 , colW , 26 ) ] ;
v2 . text = @" 22.4 " ;
v2 . text = bmiDisplay ;
v2 . textColor = kDarkTextColor ;
v2 . textColor = kDarkTextColor ;
v2 . font = [ UIFont systemFontOfSize : 22 weight : UIFontWeightHeavy ] ;
v2 . font = [ UIFont systemFontOfSize : 22 weight : UIFontWeightHeavy ] ;
v2 . textAlignment = NSTextAlignmentCenter ;
v2 . textAlignment = NSTextAlignmentCenter ;
@@ -733,9 +873,10 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 +
t3 . textAlignment = NSTextAlignmentCenter ;
t3 . textAlignment = NSTextAlignmentCenter ;
[ col3 addSubview : t3 ] ;
[ col3 addSubview : t3 ] ;
// "52.6" + "kg" 整体居中
// 目标体重值 + "kg" 整体居中
NSString * targetW = self . onePersonCaseModel . targetWeight . length > 0 ? self . onePersonCaseModel . targetWeight : @" -- " ;
UILabel * v3 = [ [ UILabel alloc ] init ] ;
UILabel * v3 = [ [ UILabel alloc ] init ] ;
v3 . text = @" 52.6 " ;
v3 . text = targetW ;
v3 . textColor = kDarkTextColor ;
v3 . textColor = kDarkTextColor ;
v3 . font = [ UIFont systemFontOfSize : 22 weight : UIFontWeightHeavy ] ;
v3 . font = [ UIFont systemFontOfSize : 22 weight : UIFontWeightHeavy ] ;
[ v3 sizeToFit ] ;
[ v3 sizeToFit ] ;
@@ -785,8 +926,8 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 +
inner + = 10 ;
inner + = 10 ;
CGFloat iconBottom = [ self addHealthIconRow : @" health_icon_bp " label : @" 血压 " iconSize : CGSizeMake ( 23 , 26 ) atY : inner inCard : card ] ;
CGFloat iconBottom = [ self addHealthIconRow : @" health_icon_bp " label : @" 血压 " iconSize : CGSizeMake ( 23 , 26 ) atY : inner inCard : card ] ;
// 右侧血压状态lab —— 距右边-16,距分割线底部16
// 右侧血压状态lab
NSString * statusText = @" 高血压 " ;
NSString * statusText = self . onePersonCaseModel . hypertension = = 1 ? @" 高血压 " : @" " ;
UIFont * statusFont = [ UIFont systemFontOfSize : 12 weight : UIFontWeightMedium ] ;
UIFont * statusFont = [ UIFont systemFontOfSize : 12 weight : UIFontWeightMedium ] ;
CGFloat statusW = [ statusText sizeWithAttributes : @{ NSFontAttributeName : statusFont } ] . width + 8 ;
CGFloat statusW = [ statusText sizeWithAttributes : @{ NSFontAttributeName : statusFont } ] . width + 8 ;
CGFloat statusY = 48 + 16 ;
CGFloat statusY = 48 + 16 ;
@@ -806,11 +947,17 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 +
// 表格 —— 图标底部+8
// 表格 —— 图标底部+8
inner = iconBottom + 8 ;
inner = iconBottom + 8 ;
NSString * spAvg = self . onePersonCaseModel . systolicPressureAvg . length > 0 ? self . onePersonCaseModel . systolicPressureAvg : @" -- " ;
NSString * spTarget = self . onePersonCaseModel . systolicPressureTarget . length > 0 ? self . onePersonCaseModel . systolicPressureTarget : @" -- " ;
NSString * spCurrent = self . onePersonCaseModel . systolicPressureCurrent . length > 0 ? self . onePersonCaseModel . systolicPressureCurrent : @" -- " ;
NSString * dpAvg = self . onePersonCaseModel . diastolicPressureAvg . length > 0 ? self . onePersonCaseModel . diastolicPressureAvg : @" -- " ;
NSString * dpTarget = self . onePersonCaseModel . diastolicPressureTarget . length > 0 ? self . onePersonCaseModel . diastolicPressureTarget : @" -- " ;
NSString * dpCurrent = self . onePersonCaseModel . diastolicPressureCurrent . length > 0 ? self . onePersonCaseModel . diastolicPressureCurrent : @" -- " ;
NSArray * rows = @[
NSArray * rows = @[
@{ @" name " : @" 收缩压 " , @" detectVal " : @" 76 " , @" detectColor " : kWarningColor ,
@{ @" name " : @" 收缩压 " , @" detectVal " : spAvg , @" detectColor " : UIColorHex ( 0x77849E ) ,
@" targetVal " : @" <70 " , @" monitorVal " : @" 78 " , @" monitorColor " : kDangerColor , @" unit " : @" mmHg " } ,
@" targetVal " : spTarget , @" monitorVal " : spCurrent , @" monitorColor " : UIColorHex ( 0x77849E ) , @" unit " : @" mmHg " } ,
@{ @" name " : @" 舒张压 " , @" detectVal " : @" 145 " , @" detectColor " : kWarningColor ,
@{ @" name " : @" 舒张压 " , @" detectVal " : dpAvg , @" detectColor " : UIColorHex ( 0x77849E ) ,
@" targetVal " : @" <145 " , @" monitorVal " : @" 148 " , @" monitorColor " : UIColorHex ( 0x77849E ) , @" unit " : @" mmHg " } ,
@" targetVal " : dpTarget , @" monitorVal " : dpCurrent , @" monitorColor " : UIColorHex ( 0x77849E ) , @" unit " : @" mmHg " } ,
] ;
] ;
UIView * table = [ self makeFigmaTable : rows col1Header : @" 项目 " col2Header : @" 平均值 " col3Header : @" 控制目标 " col4Header : @" 监测值 " ] ;
UIView * table = [ self makeFigmaTable : rows col1Header : @" 项目 " col2Header : @" 平均值 " col3Header : @" 控制目标 " col4Header : @" 监测值 " ] ;
table . frame = CGRectMake ( kContentLR , inner , kInnerW , table . frame . size . height ) ;
table . frame = CGRectMake ( kContentLR , inner , kInnerW , table . frame . size . height ) ;
@@ -834,30 +981,35 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 +
inner + = 10 ;
inner + = 10 ;
CGFloat iconBottom = [ self addHealthIconRow : @" health_icon_glu " label : @" 血糖 " iconSize : CGSizeMake ( 23 , 26 ) atY : inner inCard : card ] ;
CGFloat iconBottom = [ self addHealthIconRow : @" health_icon_glu " label : @" 血糖 " iconSize : CGSizeMake ( 23 , 26 ) atY : inner inCard : card ] ;
// 右侧状态lab
// 右侧状态lab(代谢指标 - 糖尿病)
NSString * statusText = @" 糖尿病 " ;
NSString * gluStatusText = self . onePersonCaseModel . diabetes = = 1 ? @" 糖尿病 " : @" " ;
UIFont * statusFont = [ UIFont systemFontOfSize : 12 weight : UIFontWeightMedium ] ;
UIFont * gluStatusFont = [ UIFont systemFontOfSize : 12 weight : UIFontWeightMedium ] ;
CGFloat statusW = [ statusText sizeWithAttributes : @{ NSFontAttributeName : statusFont } ] . width + 8 ;
CGFloat gluStatusW = gluStatusText . length > 0 ? ( [ gluStatusText sizeWithAttributes : @{ NSFontAttributeName : gluStatusFont } ] . width + 8 ) : 0 ;
CGFloat statusY = 48 + 16 ;
CGFloat statusY = 48 + 16 ;
CGFloat statusH = 20 ;
CGFloat statusH = 20 ;
UILabel * statusLbl = [ [ UILabel alloc ] initWithFrame : CGRectMake ( kCardW - kContentLR - statusW , statusY , statusW , statusH ) ] ;
UILabel * statusLbl = [ [ UILabel alloc ] initWithFrame : CGRectMake ( kCardW - kContentLR - MAX ( gluStatusW , 1 ) , statusY , MAX ( gluStatusW , 1 ) , statusH ) ] ;
statusLbl . text = statusText ;
statusLbl . text = gluStatusText ;
statusLbl . textColor = kDarkTextColor ;
statusLbl . textColor = kDarkTextColor ;
statusLbl . font = statusFont ;
statusLbl . font = gluStatusFont ;
[ card addSubview : statusLbl ] ;
[ card addSubview : statusLbl ] ;
// 状态图标 —— 8x8
// 状态图标 —— 仅在有关联状态时显示
if ( gluStatusText . length > 0 ) {
CGFloat dotW = 8 ;
CGFloat dotW = 8 ;
UIImageView * statusDot = [ [ UIImageView alloc ] initWithFrame : CGRectMake ( statusLbl . frame . origin . x - dotW - 4 , statusY + ( statusH - dotW ) / 2.0 , dotW , dotW ) ] ;
UIImageView * statusDot = [ [ UIImageView alloc ] initWithFrame : CGRectMake ( statusLbl . frame . origin . x - dotW - 4 , statusY + ( statusH - dotW ) / 2.0 , dotW , dotW ) ] ;
statusDot . image = [ UIImage imageNamed : @" health_status_dot " ] ;
statusDot . image = [ UIImage imageNamed : @" health_status_dot " ] ;
statusDot . contentMode = UIViewContentModeScaleAspectFit ;
statusDot . contentMode = UIViewContentModeScaleAspectFit ;
[ card addSubview : statusDot ] ;
[ card addSubview : statusDot ] ;
}
// 表格 —— 图标底部+8
// 表格 —— 图标底部+8
inner = iconBottom + 8 ;
inner = iconBottom + 8 ;
NSString * gluVal = self . onePersonCaseModel . glu . length > 0 ? self . onePersonCaseModel . glu : @" -- " ;
NSString * bsTarget = self . onePersonCaseModel . bloodSugarTarget . length > 0 ? self . onePersonCaseModel . bloodSugarTarget : @" -- " ;
NSString * bsCurrent = self . onePersonCaseModel . bloodSugarCurrent . length > 0 ? self . onePersonCaseModel . bloodSugarCurrent : @" -- " ;
NSArray * rows = @[
NSArray * rows = @[
@{ @" name " : @" 空腹血糖 " , @" detectVal " : @" 76 " , @" detectColor " : UIColorHex ( 0x77849E ) ,
@{ @" name " : @" 空腹血糖 " , @" detectVal " : gluVal , @" detectColor " : UIColorHex ( 0x77849E ) ,
@" targetVal " : @" <70 " , @" monitorVal " : @" 78 " , @" monitorColor " : UIColorHex ( 0x77849E ) , @" unit " : @" mmol/L " } ,
@" targetVal " : bsTarget , @" monitorVal " : bsCurrent , @" monitorColor " : UIColorHex ( 0x77849E ) , @" unit " : @" mmol/L " } ,
] ;
] ;
UIView * table = [ self makeFigmaTable : rows col1Header : @" 项目 " col2Header : @" GLU检测值 " col3Header : @" 控制目标 " col4Header : @" 监测值 " ] ;
UIView * table = [ self makeFigmaTable : rows col1Header : @" 项目 " col2Header : @" GLU检测值 " col3Header : @" 控制目标 " col4Header : @" 监测值 " ] ;
table . frame = CGRectMake ( kContentLR , inner , kInnerW , table . frame . size . height ) ;
table . frame = CGRectMake ( kContentLR , inner , kInnerW , table . frame . size . height ) ;
@@ -883,15 +1035,22 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 +
// 表格 —— 图标底部+8
// 表格 —— 图标底部+8
inner = iconBottom + 8 ;
inner = iconBottom + 8 ;
NSString * ldlVal = self . onePersonCaseModel . ldl . length > 0 ? self . onePersonCaseModel . ldl : @" -- " ;
NSString * ldlTar = self . onePersonCaseModel . ldlTarget . length > 0 ? self . onePersonCaseModel . ldlTarget : @" -- " ;
NSString * ldlCur = self . onePersonCaseModel . ldlCurrent . length > 0 ? self . onePersonCaseModel . ldlCurrent : @" -- " ;
NSString * tcVal = self . onePersonCaseModel . tc . length > 0 ? self . onePersonCaseModel . tc : @" -- " ;
NSString * tcTar = self . onePersonCaseModel . tcTarget . length > 0 ? self . onePersonCaseModel . tcTarget : @" -- " ;
NSString * tcCur = self . onePersonCaseModel . tcCurrent . length > 0 ? self . onePersonCaseModel . tcCurrent : @" -- " ;
NSString * tgVal = self . onePersonCaseModel . tg . length > 0 ? self . onePersonCaseModel . tg : @" -- " ;
NSString * tgTar = self . onePersonCaseModel . tgTarget . length > 0 ? self . onePersonCaseModel . tgTarget : @" -- " ;
NSString * tgCur = self . onePersonCaseModel . tgCurrent . length > 0 ? self . onePersonCaseModel . tgCurrent : @" -- " ;
NSArray * rows = @[
NSArray * rows = @[
@{ @" name " : @" 低密度脂蛋白 \n 胆固醇 " , @" detectVal " : @" 3.8 " , @" detectColor " : UIColorHex ( 0x77849E ) ,
@{ @" name " : @" 低密度脂蛋白 \n 胆固醇 " , @" detectVal " : ldlVal , @" detectColor " : UIColorHex ( 0x77849E ) ,
@" targetVal " : @" <3.8 " , @" monitorVal " : @" 3.8 " , @" monitorColor " : UIColorHex ( 0x77849E ) , @" unit " : @" mmol/L " } ,
@" targetVal " : ldlTar , @" monitorVal " : ldlCur , @" monitorColor " : UIColorHex ( 0x77849E ) , @" unit " : @" mmol/L " } ,
@{ @" name " : @" 高密度脂蛋白 \n 胆固醇 " , @" detectVal " : @" 3.8 " , @" detectColor " : UIColorHex ( 0x77849E ) ,
@{ @" name " : @" 甘油三酯 " , @" detectVal " : tgVal , @" detectColor " : UIColorHex ( 0x77849E ) ,
@" targetVal " : @" <3.8 " , @" monitorVal " : @" 3.8 " , @" monitorColor " : UIColorHex ( 0x77849E ) , @" unit " : @" mmol/L " } ,
@" targetVal " : tgTar , @" monitorVal " : tgCur , @" monitorColor " : UIColorHex ( 0x77849E ) , @" unit " : @" mmol/L " } ,
@{ @" name " : @" 甘油三酯 " , @" detectVal " : @" 3.8 " , @" detectColor " : UIColorHex ( 0x77849E ) ,
@{ @" name " : @" 总胆固醇 " , @" detectVal " : tcVal , @" detectColor " : UIColorHex ( 0x77849E ) ,
@" targetVal " : @" <3.8 " , @" monitorVal " : @" 3.8 " , @" monitorColor " : UIColorHex ( 0x77849E ) , @" unit " : @" mmol/L " } ,
@" targetVal " : tcTar , @" monitorVal " : tcCur , @" monitorColor " : UIColorHex ( 0x77849E ) , @" unit " : @" mmol/L " } ,
@{ @" name " : @" 总胆固醇 " , @" detectVal " : @" 3.8 " , @" detectColor " : UIColorHex ( 0x77849E ) ,
@" targetVal " : @" <3.8 " , @" monitorVal " : @" 3.8 " , @" monitorColor " : UIColorHex ( 0x77849E ) , @" unit " : @" mmol/L " } ,
] ;
] ;
UIView * table = [ self makeFigmaTable : rows col1Header : @" 项目 " col2Header : @" 检测值 " col3Header : @" 控制目标 " col4Header : @" 监测值 " ] ;
UIView * table = [ self makeFigmaTable : rows col1Header : @" 项目 " col2Header : @" 检测值 " col3Header : @" 控制目标 " col4Header : @" 监测值 " ] ;
table . frame = CGRectMake ( kContentLR , inner , kInnerW , table . frame . size . height ) ;
table . frame = CGRectMake ( kContentLR , inner , kInnerW , table . frame . size . height ) ;
@@ -917,11 +1076,14 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 +
// 表格 —— 图标底部+8
// 表格 —— 图标底部+8
inner = iconBottom + 8 ;
inner = iconBottom + 8 ;
NSString * uaVal = self . onePersonCaseModel . uricAcid . length > 0 ? self . onePersonCaseModel . uricAcid : @" -- " ;
NSString * uaTar = self . onePersonCaseModel . uricAcidTarget . length > 0 ? self . onePersonCaseModel . uricAcidTarget : @" -- " ;
NSString * uaCur = self . onePersonCaseModel . uricAcidCurrent . length > 0 ? self . onePersonCaseModel . uricAcidCurrent : @" -- " ;
NSArray * rows = @[
NSArray * rows = @[
@{ @" name " : @" UA " , @" detectVal " : @" 486 " , @" detectColor " : UIColorHex ( 0x77849E ) ,
@{ @" name " : @" UA " , @" detectVal " : uaVal , @" detectColor " : UIColorHex ( 0x77849E ) ,
@" targetVal " : @" <420 " , @" monitorVal " : @" 468 " , @" monitorColor " : UIColorHex ( 0x77849E ) , @" unit " : @" μmol/L " } ,
@" targetVal " : uaTar , @" monitorVal " : uaCur , @" monitorColor " : UIColorHex ( 0x77849E ) , @" unit " : @" μmol/L " } ,
] ;
] ;
UIView * table = [ self makeFigmaTable : rows col1Header : @" 项目 " col2Header : @" GLU 检测值" col3Header : @" 控制目标 " col4Header : @" 监测值 " ] ;
UIView * table = [ self makeFigmaTable : rows col1Header : @" 项目 " col2Header : @" 检测值 " col3Header : @" 控制目标 " col4Header : @" 监测值 " ] ;
table . frame = CGRectMake ( kContentLR , inner , kInnerW , table . frame . size . height ) ;
table . frame = CGRectMake ( kContentLR , inner , kInnerW , table . frame . size . height ) ;
[ card addSubview : table ] ;
[ card addSubview : table ] ;
inner + = table . frame . size . height + 16 ;
inner + = table . frame . size . height + 16 ;
@@ -941,9 +1103,12 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 +
// 直接放表格 —— 分割线底部+10
// 直接放表格 —— 分割线底部+10
inner + = 10 ;
inner + = 10 ;
NSString * hcyVal = self . onePersonCaseModel . homocysteine . length > 0 ? self . onePersonCaseModel . homocysteine : @" -- " ;
NSString * hcyTar = self . onePersonCaseModel . homocysteineTarget . length > 0 ? self . onePersonCaseModel . homocysteineTarget : @" -- " ;
NSString * hcyCur = self . onePersonCaseModel . homocysteineCurrent . length > 0 ? self . onePersonCaseModel . homocysteineCurrent : @" -- " ;
NSArray * rows = @[
NSArray * rows = @[
@{ @" name " : @" 同型半胱氨酸 " , @" detectVal " : @" 3.8 " , @" detectColor " : UIColorHex ( 0x77849E ) ,
@{ @" name " : @" 同型半胱氨酸 " , @" detectVal " : hcyVal , @" detectColor " : UIColorHex ( 0x77849E ) ,
@" targetVal " : @" <3.8 " , @" monitorVal " : @" 3.8 " , @" monitorColor " : UIColorHex ( 0x77849E ) , @" unit " : @" m mol/L" } ,
@" targetVal " : hcyTar , @" monitorVal " : hcyCur , @" monitorColor " : UIColorHex ( 0x77849E ) , @" unit " : @" μ mol/L" } ,
] ;
] ;
UIView * table = [ self makeFigmaTable : rows col1Header : @" 项目 " col2Header : @" 检测值 " col3Header : @" 控制目标 " col4Header : @" 监测值 " ] ;
UIView * table = [ self makeFigmaTable : rows col1Header : @" 项目 " col2Header : @" 检测值 " col3Header : @" 控制目标 " col4Header : @" 监测值 " ] ;
table . frame = CGRectMake ( kContentLR , inner , kInnerW , table . frame . size . height ) ;
table . frame = CGRectMake ( kContentLR , inner , kInnerW , table . frame . size . height ) ;
@@ -1016,14 +1181,15 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 +
// 填报人 + 时间
// 填报人 + 时间
inner = t1 . frame . origin . y + t1 . frame . size . height + 12 ;
inner = t1 . frame . origin . y + t1 . frame . size . height + 12 ;
NSString * cabinAuthor = self . onePersonCaseModel . cabinOpinionUserName . length > 0 ? [ NSString stringWithFormat : @" 填报人:%@ " , self . onePersonCaseModel . cabinOpinionUserName ] : @" " ;
UILabel * a1 = [ [ UILabel alloc ] initWithFrame : CGRectMake ( kContentLR , inner , wh - 120 , 16 ) ] ;
UILabel * a1 = [ [ UILabel alloc ] initWithFrame : CGRectMake ( kContentLR , inner , wh - 120 , 16 ) ] ;
a1 . text = @" 填报人:李秀芳(健康管理师) " ;
a1 . text = cabinAuthor ;
a1 . textColor = kGrayTextColor ;
a1 . textColor = kGrayTextColor ;
a1 . font = [ UIFont systemFontOfSize : 11 weight : UIFontWeightMedium ] ;
a1 . font = [ UIFont systemFontOfSize : 11 weight : UIFontWeightMedium ] ;
[ card addSubview : a1 ] ;
[ card addSubview : a1 ] ;
UILabel * tm1 = [ [ UILabel alloc ] initWithFrame : CGRectMake ( wh - kContentLR - 160 , inner , 160 , 16 ) ] ;
UILabel * tm1 = [ [ UILabel alloc ] initWithFrame : CGRectMake ( wh - kContentLR - 160 , inner , 160 , 16 ) ] ;
tm1 . text = @" 2026-05-15 14:30 " ;
tm1 . text = self . onePersonCaseModel . cabinOpinionTime . length > 0 ? self . onePersonCaseModel . cabinOpinionTime : @" " ;
tm1 . textColor = kGrayTextColor ;
tm1 . textColor = kGrayTextColor ;
tm1 . font = [ UIFont systemFontOfSize : 11 weight : UIFontWeightMedium ] ;
tm1 . font = [ UIFont systemFontOfSize : 11 weight : UIFontWeightMedium ] ;
tm1 . textAlignment = NSTextAlignmentRight ;
tm1 . textAlignment = NSTextAlignmentRight ;
@@ -1043,7 +1209,7 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 +
// 小屋意见内容view —— 卡片底部+12(独立view,不在卡片内)
// 小屋意见内容view —— 卡片底部+12(独立view,不在卡片内)
CGFloat contentY = card . frame . origin . y + card . frame . size . height + 12 ;
CGFloat contentY = card . frame . origin . y + card . frame . size . height + 12 ;
NSString * c1 = @" 【健康综述】 \n 患者张建国,男,52岁,高血压病史5年,目前血压控制不理想(收缩压持续偏高)。BMI 28.5,属于肥胖。空腹血糖偏高(6.8mmol/L),处于糖尿病前期。血脂三项均超标,甘油三酯明显偏高。血尿酸持续偏高,存在痛风风险。同型半胱氨酸偏高,心血管风险增加。 \n \n 【降控目标】 \n 1. 血压:收缩压控制在140mmHg以下,舒张压控制在90mmHg以下 \n 2. 体重:目标减至75kg, BMI降至25.3 \n 3. 血糖:空腹血糖控制在6.1mmol/L以下 \n 4. 血脂:LDL-C降至3.4以下,TG降至1.7以下 \n 5. 尿酸:控制在420μmol/L以下 \n \n 【生活干预建议】 \n 1. 饮食:低盐低脂低嘌呤饮食,减少动物内脏和海鲜摄入,每日盐摄入不超过5g \n 2. 运动:每周至少150分钟中等强度有氧运动(快走、游泳),逐步增加运动量 \n 3. 戒烟限酒:建议完全戒烟,严格限制酒精摄入 \n 4. 体重管理:每月减重1-2kg为宜,避免节食减肥 \n \n 【服药情况】 \n 1. 氨氯地平片 5mg 每日一次(降压) \n 2. 阿托伐他汀钙片 20mg 每晚一次(调脂) \n 3. 别嘌醇片 100mg 每日一次(降尿酸) \n 4. 叶酸片 0.8mg 每日一次(降低同型半胱氨酸) " ;
NSString * c1 = self . onePersonCaseModel . cabinOpinion . length > 0 ? self . onePersonCaseModel . cabinOpinion : @" 暂无小屋意见 " ;
UIView * ct1 = [ self makeOpinionContent : c1 ] ;
UIView * ct1 = [ self makeOpinionContent : c1 ] ;
ct1 . frame = CGRectMake ( kCardLR , contentY , kCardW , ct1 . frame . size . height ) ;
ct1 . frame = CGRectMake ( kCardLR , contentY , kCardW , ct1 . frame . size . height ) ;
[ self . scrollView addSubview : ct1 ] ;
[ self . scrollView addSubview : ct1 ] ;
@@ -1087,14 +1253,15 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 +
// 填报人 + 时间
// 填报人 + 时间
ei = t2 . frame . origin . y + t2 . frame . size . height + 12 ;
ei = t2 . frame . origin . y + t2 . frame . size . height + 12 ;
NSString * expertAuthor = self . onePersonCaseModel . expertOpinionUserName . length > 0 ? [ NSString stringWithFormat : @" 填报人:%@ " , self . onePersonCaseModel . expertOpinionUserName ] : @" " ;
UILabel * a2 = [ [ UILabel alloc ] initWithFrame : CGRectMake ( kContentLR , ei , kCardW - 120 , 16 ) ] ;
UILabel * a2 = [ [ UILabel alloc ] initWithFrame : CGRectMake ( kContentLR , ei , kCardW - 120 , 16 ) ] ;
a2 . text = @" 填报人:陈明远(主任医师) " ;
a2 . text = expertAuthor ;
a2 . textColor = kGrayTextColor ;
a2 . textColor = kGrayTextColor ;
a2 . font = [ UIFont systemFontOfSize : 11 weight : UIFontWeightMedium ] ;
a2 . font = [ UIFont systemFontOfSize : 11 weight : UIFontWeightMedium ] ;
[ expertCard addSubview : a2 ] ;
[ expertCard addSubview : a2 ] ;
UILabel * tm2 = [ [ UILabel alloc ] initWithFrame : CGRectMake ( kCardW - kContentLR - 160 , ei , 160 , 16 ) ] ;
UILabel * tm2 = [ [ UILabel alloc ] initWithFrame : CGRectMake ( kCardW - kContentLR - 160 , ei , 160 , 16 ) ] ;
tm2 . text = @" 2026-05-18 10:15 " ;
tm2 . text = self . onePersonCaseModel . expertOpinionTime . length > 0 ? self . onePersonCaseModel . expertOpinionTime : @" " ;
tm2 . textColor = kGrayTextColor ;
tm2 . textColor = kGrayTextColor ;
tm2 . font = [ UIFont systemFontOfSize : 11 weight : UIFontWeightMedium ] ;
tm2 . font = [ UIFont systemFontOfSize : 11 weight : UIFontWeightMedium ] ;
tm2 . textAlignment = NSTextAlignmentRight ;
tm2 . textAlignment = NSTextAlignmentRight ;
@@ -1112,7 +1279,7 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 +
// 专家意见内容view —— 卡片底部+12
// 专家意见内容view —— 卡片底部+12
CGFloat eContentY = expertY + expertHdrBottom + 12 ;
CGFloat eContentY = expertY + expertHdrBottom + 12 ;
NSString * c2 = @" 【综合评估】 \n 患者为代谢综合征高危人群,同时合并高血压、肥胖、高尿酸血症、高同型半胱氨酸血症,心血管事件风险较高。目前空腹血糖6.8mmol/L,建议完善口服葡萄糖耐量试验(OGTT)以明确是否存在糖耐量异常。 \n \n 【诊疗建议】 \n 1. 降压方案调整:目前氨氯地平单药控制欠佳,建议联合缬沙坦80mg每日一次,两药联合降压,目标血压130/85mmHg \n 2. 调脂治疗:甘油三酯明显偏高(2.9mmol/L),在阿托伐他汀基础上加用非诺贝特200mg每日一次,注意监测肝功能 \n 3. 高尿酸:继续别嘌醇治疗,建议加用碳酸氢钠片碱化尿液,多饮水(每日>2000ml) \n 4. 同型半胱氨酸:继续叶酸补充,建议加用维生素B6和B12联合治疗 \n 5. 建议3个月后复查全套生化指标,评估治疗效果 \n \n 【注意事项】 \n 患者需高度重视生活方式改善,这是所有药物治疗的基础。建议定期(每月一次)到健康小屋随访,监测血压和体重变化。 " ;
NSString * c2 = self . onePersonCaseModel . expertOpinion . length > 0 ? self . onePersonCaseModel . expertOpinion : @" 暂无专家意见 " ;
UIView * ct2 = [ self makeOpinionContent : c2 ] ;
UIView * ct2 = [ self makeOpinionContent : c2 ] ;
ct2 . frame = CGRectMake ( kCardLR , eContentY , kCardW , ct2 . frame . size . height ) ;
ct2 . frame = CGRectMake ( kCardLR , eContentY , kCardW , ct2 . frame . size . height ) ;
[ self . scrollView addSubview : ct2 ] ;
[ self . scrollView addSubview : ct2 ] ;