From 8a8a914a8ced29bbb3e9dc079b17cd6f5c6e3aca Mon Sep 17 00:00:00 2001 From: jiayangyang <534955398@qq.com> Date: Mon, 20 Jul 2026 17:56:10 +0800 Subject: [PATCH] =?UTF-8?q?feat(sos):=20=E5=BA=94=E6=80=A5=E5=B0=B1?= =?UTF-8?q?=E5=8C=BB=E7=BE=A4=E8=A7=86=E9=A2=91=E9=80=9A=E8=AF=9D=E5=8A=A0?= =?UTF-8?q?=E5=8F=B7=E9=82=80=E8=AF=B7=E5=8F=8A=E5=81=A5=E5=BA=B7=E6=A1=A3?= =?UTF-8?q?=E6=A1=88=E8=AF=A6=E6=83=85=E9=A1=B5=E6=8E=A5=E5=8F=A3=E5=AF=B9?= =?UTF-8?q?=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 多人视频页面恢复右上角加号按钮,接入自有半屏群成员面板 - 选人后自动发起视频通话邀请并即时显示受邀成员 - IM 登录同步 setSelfInfo,解决通话成员显示 ID 问题 - 健康档案详情页接入一人一案接口,移除硬编码数据 - 新增 Pods 修改记录文档 Co-Authored-By: Claude Opus 4.7 --- .../Manager/NetworkHelpManager/XJPNetAPI.h | 3 +- .../Manager/NetworkHelpManager/XJPNetAPI.m | 5 + .../Manager/TUIManager/ESCTUIManager.m | 7 +- .../XJHealthArchiveDetailViewController.h | 2 + .../XJHealthArchiveDetailViewController.m | 359 +++++++++++++----- .../HomeV2/Model/XJOnePersonCaseModel.h | 106 ++++++ .../HomeV2/Model/XJOnePersonCaseModel.m | 16 + .../XJSelectContactViewController.m | 30 +- .../Project/TUIChat/ChatViewController.h | 3 +- .../Project/TUIChat/ChatViewController.m | 15 +- im修改记录.md | 86 +++++ 11 files changed, 528 insertions(+), 104 deletions(-) create mode 100644 XinjiangProject/XinjiangProject/Project/HomeV2/Model/XJOnePersonCaseModel.h create mode 100644 XinjiangProject/XinjiangProject/Project/HomeV2/Model/XJOnePersonCaseModel.m create mode 100644 im修改记录.md diff --git a/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/XJPNetAPI.h b/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/XJPNetAPI.h index deeb2ec..92df199 100755 --- a/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/XJPNetAPI.h +++ b/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/XJPNetAPI.h @@ -43,7 +43,8 @@ - (void)getActualGroupMemberList:(NSMutableDictionary *)parmDic; // 急救员 - 宣教资源详情 - (void)getFirstAidResourceDetail:(NSMutableDictionary *)parmDic; - +// 一人一案 - 健康档案详情 +- (void)getOnePersonCase:(NSMutableDictionary *)parmDic; //首页接口 - (void)GetQuetsionRecordsList:(NSMutableDictionary *)parmDic; diff --git a/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/XJPNetAPI.m b/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/XJPNetAPI.m index a424423..e1efd10 100755 --- a/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/XJPNetAPI.m +++ b/XinjiangProject/XinjiangProject/Manager/NetworkHelpManager/XJPNetAPI.m @@ -109,6 +109,11 @@ [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-emergency/api/emergency/firstAid/resource/resource/queryById",Http] params:parmDic]; } +// 一人一案 - 健康档案详情 +- (void)getOnePersonCase:(NSMutableDictionary *)parmDic { + [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/health-emergency/emergency/LargeScreenNew/onePersonCase",Http] params:parmDic]; +} + - (void)getNearbyHomePageHospitalPoint:(NSMutableDictionary *)parmDic { [httpRequest httpGetRequest:[NSString stringWithFormat:@"%@/medical-center/api/resource/nearbyResource",Http] params:parmDic]; diff --git a/XinjiangProject/XinjiangProject/Manager/TUIManager/ESCTUIManager.m b/XinjiangProject/XinjiangProject/Manager/TUIManager/ESCTUIManager.m index b082862..0a44e8b 100644 --- a/XinjiangProject/XinjiangProject/Manager/TUIManager/ESCTUIManager.m +++ b/XinjiangProject/XinjiangProject/Manager/TUIManager/ESCTUIManager.m @@ -28,9 +28,11 @@ [TUILogin login:sdkAppid userID:userID userSig:userSig succ:^{ - + // KPostNotification(KNotificationLoginIMResult, @YES); - + HQUserInfo *user = [HQCommonUtils keyedUnarchiverWithKey:LoginUserInfo]; + [[TUICallKit createInstance] setSelfInfo:user.realname avatar:user.avatar succ:nil fail:nil]; + } fail:^(int code, NSString *msg) { [EasyTextView showErrorText:@"IM登录失败"]; @@ -103,7 +105,6 @@ } + (void)sendGroupVideo:(NSString *)groupID withUserIdList:(NSArray *)userList { - [[TUICallKit createInstance] groupCall:groupID userIdList:userList callMediaType:TUICallMediaTypeVideo]; } diff --git a/XinjiangProject/XinjiangProject/Project/HomeV2/Controllview/XJHealthArchiveDetailViewController.h b/XinjiangProject/XinjiangProject/Project/HomeV2/Controllview/XJHealthArchiveDetailViewController.h index 24cb3af..10a3df9 100644 --- a/XinjiangProject/XinjiangProject/Project/HomeV2/Controllview/XJHealthArchiveDetailViewController.h +++ b/XinjiangProject/XinjiangProject/Project/HomeV2/Controllview/XJHealthArchiveDetailViewController.h @@ -11,6 +11,8 @@ NS_ASSUME_NONNULL_BEGIN @interface XJHealthArchiveDetailViewController : XJBaseViewController +@property (nonatomic, copy) NSString *idCard; + @end NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/HomeV2/Controllview/XJHealthArchiveDetailViewController.m b/XinjiangProject/XinjiangProject/Project/HomeV2/Controllview/XJHealthArchiveDetailViewController.m index e6e440f..85a63f2 100644 --- a/XinjiangProject/XinjiangProject/Project/HomeV2/Controllview/XJHealthArchiveDetailViewController.m +++ b/XinjiangProject/XinjiangProject/Project/HomeV2/Controllview/XJHealthArchiveDetailViewController.m @@ -22,6 +22,8 @@ // #import "XJHealthArchiveDetailViewController.h" +#import "XJOnePersonCaseModel.h" +#import "XJPNetAPI.h" // 颜色(Figma 设计稿规范) #define kGreenColor UIColorHex(0x2EB8B2) @@ -46,6 +48,7 @@ static const CGFloat kContentLR = 16; @property (nonatomic, strong) UIScrollView *scrollView; @property (nonatomic, assign) CGFloat contentBottom; +@property (nonatomic, strong) XJOnePersonCaseModel *onePersonCaseModel; @end @@ -76,17 +79,14 @@ static const CGFloat kContentLR = 16; self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backBtn]; [self setupScrollView]; - [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 requestOnePersonCase]; +} - [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 { @@ -114,6 +114,122 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 + [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 - ————— 通用组件 ————— /// 白色圆角卡片 @@ -323,8 +439,8 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 + dc.frame = CGRectMake(col1w - 0.5, ry, col234w, rh); [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]; tc.frame = CGRectMake(col1w + col234w - 1, ry, col234w, rh); [container addSubview:tc]; @@ -400,37 +516,47 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 + cy += 6; // 姓名 —— 距左边20,距顶部22 + NSString *nameText = self.onePersonCaseModel.name.length > 0 ? self.onePersonCaseModel.name : @"--"; UILabel *nameLbl = [[UILabel alloc] initWithFrame:CGRectMake(20, 22, 160, 24)]; - nameLbl.text = @"艾比拜·牙库甫"; + nameLbl.text = nameText; nameLbl.textColor = kDarkTextColor; nameLbl.font = [UIFont systemFontOfSize:18 weight:UIFontWeightHeavy]; [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 gaY = nameLbl.frame.origin.y + (nameLbl.frame.size.height - gaH) / 2.0; - UILabel *gaLbl = [[UILabel alloc] initWithFrame:CGRectMake(kCardW - kContentLR - 100, gaY, 100, gaH)]; - gaLbl.text = @"男性 · 52岁"; + UILabel *gaLbl = [[UILabel alloc] initWithFrame:CGRectMake(kCardW - kContentLR - 140, gaY, 140, gaH)]; + gaLbl.text = [NSString stringWithFormat:@"%@ · %@", sexStr, ageStr]; gaLbl.textColor = kDarkTextColor; gaLbl.font = [UIFont systemFontOfSize:14 weight:UIFontWeightHeavy]; gaLbl.textAlignment = NSTextAlignmentRight; [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)]; - badge.text = @"档案已建立"; + badge.text = hasArchive ? @"档案已建立" : @"暂无档案"; badge.textColor = KWhiteColor; badge.font = [UIFont systemFontOfSize:13 weight:UIFontWeightBold]; - badge.backgroundColor = kGreenColor; + badge.backgroundColor = hasArchive ? kGreenColor : UIColorHex(0xBBBBBB); badge.layer.cornerRadius = 4; badge.layer.masksToBounds = YES; badge.textAlignment = NSTextAlignmentCenter; [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; UILabel *compLbl = [[UILabel alloc] initWithFrame:CGRectMake(kContentLR, compY, kCardW - kContentLR * 2, 16)]; - compLbl.text = @"新疆油田分公司采油一厂"; + compLbl.text = workUnitText; compLbl.textColor = kDarkTextColor; compLbl.font = [UIFont systemFontOfSize:14 weight:UIFontWeightBold]; [card addSubview:compLbl]; @@ -457,7 +583,7 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 + [infoBg addSubview:idTitle]; 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.font = [UIFont systemFontOfSize:13 weight:UIFontWeightMedium]; idVal.textAlignment = NSTextAlignmentRight; @@ -470,8 +596,17 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 + phTitle.font = [UIFont systemFontOfSize:13 weight:UIFontWeightMedium]; [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)]; - phVal.text = @"157****5522"; + phVal.text = phoneText; phVal.textColor = kInfoValueColor; phVal.font = [UIFont systemFontOfSize:13 weight:UIFontWeightMedium]; phVal.textAlignment = NSTextAlignmentRight; @@ -488,8 +623,9 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 + UIView *card = [self makeCard:y]; CGFloat inner = 0; - // 标题行(含"重点关爱"右上角标签) - [self addCardTitle:@"关爱管理信息" tagText:@"重点关爱" inCard:card]; + // 标题行(关爱状态标签) + NSString *careTag = [self.onePersonCaseModel.careStatus isEqualToString:@"1"] ? @"重点关爱" : @""; + [self addCardTitle:@"关爱管理信息" tagText:careTag inCard:card]; inner = 48; // 关爱联络员 @@ -501,7 +637,7 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 + [contactRow addSubview:cl]; 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.font = [UIFont systemFontOfSize:13 weight:UIFontWeightMedium]; cv.textAlignment = NSTextAlignmentRight; @@ -513,7 +649,7 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 + div.backgroundColor = kDividerColor; [self placeView:div at:&inner in:card]; - // 负面清单 + // 负面清单(单行截断,点击弹窗查看全文) UIView *negRow = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kCardW, 48)]; UILabel *nl = [[UILabel alloc] initWithFrame:CGRectMake(kContentLR, 0, 80, 48)]; nl.text = @"负面清单"; @@ -521,11 +657,21 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 + nl.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium]; [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)]; - nv.text = @"胃炎、高尿酸、负重关节炎"; + nv.text = negText; nv.textColor = UIColorHex(0x77849E); nv.font = [UIFont systemFontOfSize:13 weight:UIFontWeightMedium]; 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]; [self placeView:negRow at:&inner in:card]; @@ -561,9 +707,10 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 + CGFloat weightAreaH = 48; 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]; - wgt.text = @"68.20"; + wgt.text = weightText; wgt.textColor = kDarkTextColor; wgt.font = [UIFont systemFontOfSize:40 weight:UIFontWeightHeavy]; [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); [weightRow addSubview:wUnit]; - // 右侧:体重变化区 —— 整体在卡片右半边居中 + // 右侧:体重风险类型 + NSString *riskText = self.onePersonCaseModel.weightRiskType.length > 0 ? self.onePersonCaseModel.weightRiskType : @"--"; UILabel *wChange = [[UILabel alloc] init]; - wChange.text = @"2.6"; + wChange.text = riskText; wChange.textColor = kGreenColor; wChange.font = [UIFont systemFontOfSize:24 weight:UIFontWeightHeavy]; [wChange sizeToFit]; UILabel *wChangeUnit = [[UILabel alloc] init]; - wChangeUnit.text = @"kg"; + wChangeUnit.text = @""; wChangeUnit.textColor = kGreenColor; wChangeUnit.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium]; [wChangeUnit sizeToFit]; - // 上半行总宽:2.6 + kg CGFloat topRowW = wChange.frame.size.width + wChangeUnit.frame.size.width; UILabel *wTip = [[UILabel alloc] init]; - wTip.text = @"体重较上次减轻"; + wTip.text = @"体重风险类型"; wTip.textColor = kGrayTextColor; wTip.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium]; [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 blockX = rightHalfCenterX - blockW / 2.0; - // 2.6 + // 风险类型数值 wChange.frame = CGRectMake(blockX, 2, wChange.frame.size.width, 24); [weightRow addSubview:wChange]; - // kg(紧跟2.6) + // 箭头去掉——体重风险类型不加单位 wChangeUnit.frame = CGRectMake(CGRectGetMaxX(wChange.frame), 10, wChangeUnit.frame.size.width, wChangeUnit.frame.size.height); [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.textAlignment = NSTextAlignmentCenter; [weightRow addSubview:wTip]; [self placeView:weightRow at:&inner in:card]; - // 日期 —— 体重区域底部+8 + // 日期 inner += 8; UILabel *wDate = [[UILabel alloc] initWithFrame:CGRectMake(kContentLR, inner, 120, 14)]; - wDate.text = @"06-25 09:30"; + wDate.text = @"--"; wDate.textColor = kGrayTextColor; wDate.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium]; [card addSubview:wDate]; @@ -652,7 +789,8 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 + CGFloat colH = 60; // 判断 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); // 卡片1:身高(值+单位居中) @@ -668,9 +806,10 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 + t1.textAlignment = NSTextAlignmentCenter; [col1 addSubview:t1]; - // "172" + "cm" 整体居中 + // 身高数值 + "cm" 整体居中 + NSString *heightText = self.onePersonCaseModel.height.length > 0 ? self.onePersonCaseModel.height : @"--"; UILabel *v1 = [[UILabel alloc] init]; - v1.text = @"172"; + v1.text = heightText; v1.textColor = kDarkTextColor; v1.font = [UIFont systemFontOfSize:22 weight:UIFontWeightHeavy]; [v1 sizeToFit]; @@ -713,8 +852,9 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 + [col2 addSubview:bmiStatus]; // BMI 数值居中 + NSString *bmiDisplay = bmiStr.length > 0 ? bmiStr : @"--"; UILabel *v2 = [[UILabel alloc] initWithFrame:CGRectMake(0, 26, colW, 26)]; - v2.text = @"22.4"; + v2.text = bmiDisplay; v2.textColor = kDarkTextColor; v2.font = [UIFont systemFontOfSize:22 weight:UIFontWeightHeavy]; v2.textAlignment = NSTextAlignmentCenter; @@ -733,9 +873,10 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 + t3.textAlignment = NSTextAlignmentCenter; [col3 addSubview:t3]; - // "52.6" + "kg" 整体居中 + // 目标体重值 + "kg" 整体居中 + NSString *targetW = self.onePersonCaseModel.targetWeight.length > 0 ? self.onePersonCaseModel.targetWeight : @"--"; UILabel *v3 = [[UILabel alloc] init]; - v3.text = @"52.6"; + v3.text = targetW; v3.textColor = kDarkTextColor; v3.font = [UIFont systemFontOfSize:22 weight:UIFontWeightHeavy]; [v3 sizeToFit]; @@ -785,8 +926,8 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 + inner += 10; CGFloat iconBottom = [self addHealthIconRow:@"health_icon_bp" label:@"血压" iconSize:CGSizeMake(23, 26) atY:inner inCard:card]; - // 右侧血压状态lab —— 距右边-16,距分割线底部16 - NSString *statusText = @"高血压"; + // 右侧血压状态lab + NSString *statusText = self.onePersonCaseModel.hypertension == 1 ? @"高血压" : @""; UIFont *statusFont = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium]; CGFloat statusW = [statusText sizeWithAttributes:@{NSFontAttributeName: statusFont}].width + 8; CGFloat statusY = 48 + 16; @@ -806,11 +947,17 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 + // 表格 —— 图标底部+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 = @[ - @{@"name": @"收缩压", @"detectVal": @"76", @"detectColor": kWarningColor, - @"targetVal": @"<70", @"monitorVal": @"78", @"monitorColor": kDangerColor, @"unit": @"mmHg"}, - @{@"name": @"舒张压", @"detectVal": @"145", @"detectColor": kWarningColor, - @"targetVal": @"<145", @"monitorVal": @"148", @"monitorColor": UIColorHex(0x77849E), @"unit": @"mmHg"}, + @{@"name": @"收缩压", @"detectVal": spAvg, @"detectColor": UIColorHex(0x77849E), + @"targetVal": spTarget, @"monitorVal": spCurrent, @"monitorColor": UIColorHex(0x77849E), @"unit": @"mmHg"}, + @{@"name": @"舒张压", @"detectVal": dpAvg, @"detectColor": UIColorHex(0x77849E), + @"targetVal": dpTarget, @"monitorVal": dpCurrent, @"monitorColor": UIColorHex(0x77849E), @"unit": @"mmHg"}, ]; UIView *table = [self makeFigmaTable:rows col1Header:@"项目" col2Header:@"平均值" col3Header:@"控制目标" col4Header:@"监测值"]; table.frame = CGRectMake(kContentLR, inner, kInnerW, table.frame.size.height); @@ -834,30 +981,35 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 + inner += 10; CGFloat iconBottom = [self addHealthIconRow:@"health_icon_glu" label:@"血糖" iconSize:CGSizeMake(23, 26) atY:inner inCard:card]; - // 右侧状态lab - NSString *statusText = @"糖尿病"; - UIFont *statusFont = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium]; - CGFloat statusW = [statusText sizeWithAttributes:@{NSFontAttributeName: statusFont}].width + 8; + // 右侧状态lab(代谢指标 - 糖尿病) + NSString *gluStatusText = self.onePersonCaseModel.diabetes == 1 ? @"糖尿病" : @""; + UIFont *gluStatusFont = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium]; + CGFloat gluStatusW = gluStatusText.length > 0 ? ([gluStatusText sizeWithAttributes:@{NSFontAttributeName: gluStatusFont}].width + 8) : 0; CGFloat statusY = 48 + 16; CGFloat statusH = 20; - UILabel *statusLbl = [[UILabel alloc] initWithFrame:CGRectMake(kCardW - kContentLR - statusW, statusY, statusW, statusH)]; - statusLbl.text = statusText; + UILabel *statusLbl = [[UILabel alloc] initWithFrame:CGRectMake(kCardW - kContentLR - MAX(gluStatusW, 1), statusY, MAX(gluStatusW, 1), statusH)]; + statusLbl.text = gluStatusText; statusLbl.textColor = kDarkTextColor; - statusLbl.font = statusFont; + statusLbl.font = gluStatusFont; [card addSubview:statusLbl]; - // 状态图标 —— 8x8 - CGFloat dotW = 8; - 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.contentMode = UIViewContentModeScaleAspectFit; - [card addSubview:statusDot]; + // 状态图标 —— 仅在有关联状态时显示 + if (gluStatusText.length > 0) { + CGFloat dotW = 8; + 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.contentMode = UIViewContentModeScaleAspectFit; + [card addSubview:statusDot]; + } // 表格 —— 图标底部+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 = @[ - @{@"name": @"空腹血糖", @"detectVal": @"76", @"detectColor": UIColorHex(0x77849E), - @"targetVal": @"<70", @"monitorVal": @"78", @"monitorColor": UIColorHex(0x77849E), @"unit": @"mmol/L"}, + @{@"name": @"空腹血糖", @"detectVal": gluVal, @"detectColor": UIColorHex(0x77849E), + @"targetVal": bsTarget, @"monitorVal": bsCurrent, @"monitorColor": UIColorHex(0x77849E), @"unit": @"mmol/L"}, ]; UIView *table = [self makeFigmaTable:rows col1Header:@"项目" col2Header:@"GLU检测值" col3Header:@"控制目标" col4Header:@"监测值"]; table.frame = CGRectMake(kContentLR, inner, kInnerW, table.frame.size.height); @@ -883,15 +1035,22 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 + // 表格 —— 图标底部+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 = @[ - @{@"name": @"低密度脂蛋白\n胆固醇", @"detectVal": @"3.8", @"detectColor": UIColorHex(0x77849E), - @"targetVal": @"<3.8", @"monitorVal": @"3.8", @"monitorColor": UIColorHex(0x77849E), @"unit": @"mmol/L"}, - @{@"name": @"高密度脂蛋白\n胆固醇", @"detectVal": @"3.8", @"detectColor": UIColorHex(0x77849E), - @"targetVal": @"<3.8", @"monitorVal": @"3.8", @"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"}, - @{@"name": @"总胆固醇", @"detectVal": @"3.8", @"detectColor": UIColorHex(0x77849E), - @"targetVal": @"<3.8", @"monitorVal": @"3.8", @"monitorColor": UIColorHex(0x77849E), @"unit": @"mmol/L"}, + @{@"name": @"低密度脂蛋白\n胆固醇", @"detectVal": ldlVal, @"detectColor": UIColorHex(0x77849E), + @"targetVal": ldlTar, @"monitorVal": ldlCur, @"monitorColor": UIColorHex(0x77849E), @"unit": @"mmol/L"}, + @{@"name": @"甘油三酯", @"detectVal": tgVal, @"detectColor": UIColorHex(0x77849E), + @"targetVal": tgTar, @"monitorVal": tgCur, @"monitorColor": UIColorHex(0x77849E), @"unit": @"mmol/L"}, + @{@"name": @"总胆固醇", @"detectVal": tcVal, @"detectColor": UIColorHex(0x77849E), + @"targetVal": tcTar, @"monitorVal": tcCur, @"monitorColor": UIColorHex(0x77849E), @"unit": @"mmol/L"}, ]; UIView *table = [self makeFigmaTable:rows col1Header:@"项目" col2Header:@"检测值" col3Header:@"控制目标" col4Header:@"监测值"]; table.frame = CGRectMake(kContentLR, inner, kInnerW, table.frame.size.height); @@ -917,11 +1076,14 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 + // 表格 —— 图标底部+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 = @[ - @{@"name": @"UA", @"detectVal": @"486", @"detectColor": UIColorHex(0x77849E), - @"targetVal": @"<420", @"monitorVal": @"468", @"monitorColor": UIColorHex(0x77849E), @"unit": @"μmol/L"}, + @{@"name": @"UA", @"detectVal": uaVal, @"detectColor": UIColorHex(0x77849E), + @"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); [card addSubview:table]; inner += table.frame.size.height + 16; @@ -941,9 +1103,12 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 + // 直接放表格 —— 分割线底部+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 = @[ - @{@"name": @"同型半胱氨酸", @"detectVal": @"3.8", @"detectColor": UIColorHex(0x77849E), - @"targetVal": @"<3.8", @"monitorVal": @"3.8", @"monitorColor": UIColorHex(0x77849E), @"unit": @"mmol/L"}, + @{@"name": @"同型半胱氨酸", @"detectVal": hcyVal, @"detectColor": UIColorHex(0x77849E), + @"targetVal": hcyTar, @"monitorVal": hcyCur, @"monitorColor": UIColorHex(0x77849E), @"unit": @"μmol/L"}, ]; UIView *table = [self makeFigmaTable:rows col1Header:@"项目" col2Header:@"检测值" col3Header:@"控制目标" col4Header:@"监测值"]; 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; + NSString *cabinAuthor = self.onePersonCaseModel.cabinOpinionUserName.length > 0 ? [NSString stringWithFormat:@"填报人:%@", self.onePersonCaseModel.cabinOpinionUserName] : @""; UILabel *a1 = [[UILabel alloc] initWithFrame:CGRectMake(kContentLR, inner, wh - 120, 16)]; - a1.text = @"填报人:李秀芳(健康管理师)"; + a1.text = cabinAuthor; a1.textColor = kGrayTextColor; a1.font = [UIFont systemFontOfSize:11 weight:UIFontWeightMedium]; [card addSubview:a1]; 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.font = [UIFont systemFontOfSize:11 weight:UIFontWeightMedium]; tm1.textAlignment = NSTextAlignmentRight; @@ -1043,7 +1209,7 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 + // 小屋意见内容view —— 卡片底部+12(独立view,不在卡片内) CGFloat contentY = card.frame.origin.y + card.frame.size.height + 12; - NSString *c1 = @"【健康综述】\n患者张建国,男,52岁,高血压病史5年,目前血压控制不理想(收缩压持续偏高)。BMI 28.5,属于肥胖。空腹血糖偏高(6.8mmol/L),处于糖尿病前期。血脂三项均超标,甘油三酯明显偏高。血尿酸持续偏高,存在痛风风险。同型半胱氨酸偏高,心血管风险增加。\n\n【降控目标】\n1. 血压:收缩压控制在140mmHg以下,舒张压控制在90mmHg以下\n2. 体重:目标减至75kg,BMI降至25.3\n3. 血糖:空腹血糖控制在6.1mmol/L以下\n4. 血脂:LDL-C降至3.4以下,TG降至1.7以下\n5. 尿酸:控制在420μmol/L以下\n\n【生活干预建议】\n1. 饮食:低盐低脂低嘌呤饮食,减少动物内脏和海鲜摄入,每日盐摄入不超过5g\n2. 运动:每周至少150分钟中等强度有氧运动(快走、游泳),逐步增加运动量\n3. 戒烟限酒:建议完全戒烟,严格限制酒精摄入\n4. 体重管理:每月减重1-2kg为宜,避免节食减肥\n\n【服药情况】\n1. 氨氯地平片 5mg 每日一次(降压)\n2. 阿托伐他汀钙片 20mg 每晚一次(调脂)\n3. 别嘌醇片 100mg 每日一次(降尿酸)\n4. 叶酸片 0.8mg 每日一次(降低同型半胱氨酸)"; + NSString *c1 = self.onePersonCaseModel.cabinOpinion.length > 0 ? self.onePersonCaseModel.cabinOpinion : @"暂无小屋意见"; UIView *ct1 = [self makeOpinionContent:c1]; ct1.frame = CGRectMake(kCardLR, contentY, kCardW, ct1.frame.size.height); [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; + NSString *expertAuthor = self.onePersonCaseModel.expertOpinionUserName.length > 0 ? [NSString stringWithFormat:@"填报人:%@", self.onePersonCaseModel.expertOpinionUserName] : @""; UILabel *a2 = [[UILabel alloc] initWithFrame:CGRectMake(kContentLR, ei, kCardW - 120, 16)]; - a2.text = @"填报人:陈明远(主任医师)"; + a2.text = expertAuthor; a2.textColor = kGrayTextColor; a2.font = [UIFont systemFontOfSize:11 weight:UIFontWeightMedium]; [expertCard addSubview:a2]; 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.font = [UIFont systemFontOfSize:11 weight:UIFontWeightMedium]; tm2.textAlignment = NSTextAlignmentRight; @@ -1112,7 +1279,7 @@ self.scrollView.contentSize = CGSizeMake(kScreenWidth, self.contentBottom + 20 + // 专家意见内容view —— 卡片底部+12 CGFloat eContentY = expertY + expertHdrBottom + 12; - NSString *c2 = @"【综合评估】\n患者为代谢综合征高危人群,同时合并高血压、肥胖、高尿酸血症、高同型半胱氨酸血症,心血管事件风险较高。目前空腹血糖6.8mmol/L,建议完善口服葡萄糖耐量试验(OGTT)以明确是否存在糖耐量异常。\n\n【诊疗建议】\n1. 降压方案调整:目前氨氯地平单药控制欠佳,建议联合缬沙坦80mg每日一次,两药联合降压,目标血压130/85mmHg\n2. 调脂治疗:甘油三酯明显偏高(2.9mmol/L),在阿托伐他汀基础上加用非诺贝特200mg每日一次,注意监测肝功能\n3. 高尿酸:继续别嘌醇治疗,建议加用碳酸氢钠片碱化尿液,多饮水(每日>2000ml)\n4. 同型半胱氨酸:继续叶酸补充,建议加用维生素B6和B12联合治疗\n5. 建议3个月后复查全套生化指标,评估治疗效果\n\n【注意事项】\n患者需高度重视生活方式改善,这是所有药物治疗的基础。建议定期(每月一次)到健康小屋随访,监测血压和体重变化。"; + NSString *c2 = self.onePersonCaseModel.expertOpinion.length > 0 ? self.onePersonCaseModel.expertOpinion : @"暂无专家意见"; UIView *ct2 = [self makeOpinionContent:c2]; ct2.frame = CGRectMake(kCardLR, eContentY, kCardW, ct2.frame.size.height); [self.scrollView addSubview:ct2]; diff --git a/XinjiangProject/XinjiangProject/Project/HomeV2/Model/XJOnePersonCaseModel.h b/XinjiangProject/XinjiangProject/Project/HomeV2/Model/XJOnePersonCaseModel.h new file mode 100644 index 0000000..5c6940a --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/HomeV2/Model/XJOnePersonCaseModel.h @@ -0,0 +1,106 @@ +// +// XJOnePersonCaseModel.h +// XinjiangProject +// +// 一人一案 - 健康档案数据模型 +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface XJOnePersonCaseModel : NSObject + +#pragma mark - 基本信息 +@property (nonatomic, strong) NSString *archiveId; // 档案ID(JSON: id) +@property (nonatomic, strong) NSString *empId; // 员工ID +@property (nonatomic, strong) NSString *name; // 员工姓名 +@property (nonatomic, assign) NSInteger age; // 年龄 +@property (nonatomic, strong) NSString *sexCode; // 性别 +@property (nonatomic, strong) NSString *idNo; // 身份证号 +@property (nonatomic, strong) NSString *phone; // 手机号 +@property (nonatomic, strong) NSString *careStatus; // 关爱状态 +@property (nonatomic, strong) NSString *workUnit; // 工作单位 +@property (nonatomic, strong) NSString *workUnitId; // 单位ID +@property (nonatomic, assign) NSInteger dataLevel; // 数据级别 +@property (nonatomic, strong) NSString *negativeList; // 负面清单 +@property (nonatomic, strong) NSString *caseInfo; // 一人一案 +@property (nonatomic, strong) NSString *riskLevel; // 风险等级 +@property (nonatomic, strong) NSString *year; // 年度 +@property (nonatomic, strong) NSString *careLiaisonName; // 关爱联络员姓名 + +#pragma mark - 体重 / BMI +@property (nonatomic, assign) NSInteger flagFat; // 肥胖人员标识(1-是,2-否) +@property (nonatomic, strong) NSString *bmi; // 体检BMI +@property (nonatomic, strong) NSString *height; // 身高(cm) +@property (nonatomic, strong) NSString *weight; // 体重(kg) +@property (nonatomic, strong) NSString *targetWeight; // 体重管理目标 +@property (nonatomic, strong) NSString *targetBmi; // 目标BMI +@property (nonatomic, strong) NSString *bmiCurrent; // 目前BMI监测值 +@property (nonatomic, strong) NSString *waistNew; // 最新腰围 +@property (nonatomic, strong) NSString *bodyFatPercentNew; // 最新体脂率 +@property (nonatomic, strong) NSString *weightRiskType; // 体重风险类型 + +#pragma mark - 高血压 +@property (nonatomic, assign) NSInteger hypertension; // 高血压标识(0-否,1-是) +@property (nonatomic, strong) NSString *systolicPressureAvg; // 收缩压均值 +@property (nonatomic, strong) NSString *systolicPressureTarget; // 收缩压控制目标 +@property (nonatomic, strong) NSString *systolicPressureCurrent; // 收缩压当前检测值 +@property (nonatomic, strong) NSString *diastolicPressureAvg; // 舒张压平均值 +@property (nonatomic, strong) NSString *diastolicPressureTarget; // 舒张压控制目标值 +@property (nonatomic, strong) NSString *diastolicPressureCurrent; // 舒张压当前检测值 + +#pragma mark - 糖尿病 / 血糖 +@property (nonatomic, assign) NSInteger diabetes; // 糖尿病标识(0-否,1-是) +@property (nonatomic, strong) NSString *glu; // 空腹葡萄糖(GLU) +@property (nonatomic, strong) NSString *bloodSugarTarget; // 血糖控制目标值 +@property (nonatomic, strong) NSString *bloodSugarCurrent; // 目前血糖监测值 + +#pragma mark - 血脂 +@property (nonatomic, strong) NSString *ldl; // 低密度脂蛋白 +@property (nonatomic, strong) NSString *ldlTarget; // 低密度脂蛋白目标控制值 +@property (nonatomic, strong) NSString *ldlCurrent; // 低密度脂蛋白当前检测值 +@property (nonatomic, strong) NSString *tc; // 总胆固醇 +@property (nonatomic, strong) NSString *tcTarget; // 总胆固醇目标控制值 +@property (nonatomic, strong) NSString *tcCurrent; // 总胆固醇目前监测值 +@property (nonatomic, strong) NSString *tg; // 甘油三酯 +@property (nonatomic, strong) NSString *tgTarget; // 甘油三酯目标控制值 +@property (nonatomic, strong) NSString *tgCurrent; // 甘油三酯当前监测值 + +#pragma mark - 尿酸 / 同型半胱氨酸 / 其他指标 +@property (nonatomic, strong) NSString *uricAcid; // 尿酸 +@property (nonatomic, strong) NSString *uricAcidTarget; // 尿酸目标控制值 +@property (nonatomic, strong) NSString *uricAcidCurrent; // 尿酸当前监测值 +@property (nonatomic, strong) NSString *homocysteine; // 同型半胱氨酸 +@property (nonatomic, strong) NSString *homocysteineTarget; // 同型半胱氨酸目标控制值 +@property (nonatomic, strong) NSString *homocysteineCurrent; // 同型半胱氨酸当前监测值 +@property (nonatomic, strong) NSString *bloodK; // 血钾 +@property (nonatomic, strong) NSString *chd; // 冠心病 +@property (nonatomic, strong) NSString *cvd; // 脑血管 +@property (nonatomic, strong) NSString *af; // 心房颤动 +@property (nonatomic, strong) NSString *ca; // 恶性肿瘤 +@property (nonatomic, strong) NSString *indicatorListStr; // 检测指标列表 +@property (nonatomic, strong) NSString *indicatorListStrOrigin; // 导入指标列表 +@property (nonatomic, strong) NSString *screeningProjects; // 筛查项目汇总 + +#pragma mark - 方案与反馈 +@property (nonatomic, strong) NSString *treatPlan; // 治疗方案 +@property (nonatomic, strong) NSString *treatPlanResponse; // 治疗方案反馈 +@property (nonatomic, strong) NSString *dietSuggestion; // 饮食建议 +@property (nonatomic, strong) NSString *dietSuggestionResponse; // 饮食建议反馈 +@property (nonatomic, strong) NSString *sportGuide; // 运动指导 +@property (nonatomic, strong) NSString *sportGuideResponse; // 运动指导反馈 +@property (nonatomic, strong) NSString *lifeManage; // 日常生活管理 +@property (nonatomic, strong) NSString *lifeManageResponse; // 日常生活管理反馈 + +#pragma mark - 小屋 / 专家意见 +@property (nonatomic, strong) NSString *cabinOpinion; // 小屋意见内容 +@property (nonatomic, strong) NSString *cabinOpinionTime; // 小屋意见时间 +@property (nonatomic, strong) NSString *cabinOpinionUserName; // 小屋意见员工姓名 +@property (nonatomic, strong) NSString *expertOpinion; // 专家意见内容 +@property (nonatomic, strong) NSString *expertOpinionTime; // 专家意见时间 +@property (nonatomic, strong) NSString *expertOpinionUserName; // 专家意见员工姓名 + +@end + +NS_ASSUME_NONNULL_END diff --git a/XinjiangProject/XinjiangProject/Project/HomeV2/Model/XJOnePersonCaseModel.m b/XinjiangProject/XinjiangProject/Project/HomeV2/Model/XJOnePersonCaseModel.m new file mode 100644 index 0000000..da14dd0 --- /dev/null +++ b/XinjiangProject/XinjiangProject/Project/HomeV2/Model/XJOnePersonCaseModel.m @@ -0,0 +1,16 @@ +// +// XJOnePersonCaseModel.m +// XinjiangProject +// +// 一人一案 - 健康档案数据模型 +// + +#import "XJOnePersonCaseModel.h" + +@implementation XJOnePersonCaseModel + ++ (NSDictionary *)modelCustomPropertyMapper { + return @{@"archiveId" : @"id"}; +} + +@end diff --git a/XinjiangProject/XinjiangProject/Project/SOS/Controller/XJSelectContactViewController.m b/XinjiangProject/XinjiangProject/Project/SOS/Controller/XJSelectContactViewController.m index a16b3b2..8ca79f8 100644 --- a/XinjiangProject/XinjiangProject/Project/SOS/Controller/XJSelectContactViewController.m +++ b/XinjiangProject/XinjiangProject/Project/SOS/Controller/XJSelectContactViewController.m @@ -5,6 +5,12 @@ #import "XJSelectContactViewController.h" #import "XJPNetAPI.h" +#import "TUICallingCommon.h" +#import "TUICallingUserManager.h" +#import "TUICallingUserModel.h" +#import "TUICallKit.h" +#import +#import typedef NS_ENUM(NSUInteger, XJContactTab) { XJContactTabEmployee = 0, @@ -378,7 +384,29 @@ typedef NS_ENUM(NSUInteger, XJContactTab) { } if ([tag isEqualToString:@"ADDGROUPUSER"]) { [EasyTextView showSuccessText:@"邀请成功"]; - [self.navigationController popViewControllerAnimated:YES]; + NSArray *userIds = [self.selectedIds allObjects]; + if (userIds.count > 0) { + [[TUICallEngine createInstance] inviteUser:userIds params:nil succ:^(NSArray *userIdList) { + [[V2TIMManager sharedInstance] getUsersInfo:userIdList succ:^(NSArray *infoList) { + dispatch_async(dispatch_get_main_queue(), ^{ + TUICallingViewManager *mgr = [[TUICallKit createInstance] valueForKey:@"callingViewManager"]; + id bgView = [mgr valueForKey:@"backgroundView"]; + for (V2TIMUserFullInfo *info in infoList) { + CallingUserModel *model = [TUICallingCommon covertUser:info]; + [TUICallingUserManager cacheUser:model]; + if (bgView && [bgView respondsToSelector:@selector(userAdd:)]) { + [bgView performSelector:@selector(userAdd:) withObject:model]; + } + } + }); + } fail:nil]; + } fail:nil]; + } + if (self.presentingViewController) { + [self dismissViewControllerAnimated:YES completion:nil]; + } else { + [self.navigationController popViewControllerAnimated:YES]; + } } } diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/ChatViewController.h b/XinjiangProject/XinjiangProject/Project/TUIChat/ChatViewController.h index 71ab4d9..d36d2ea 100644 --- a/XinjiangProject/XinjiangProject/Project/TUIChat/ChatViewController.h +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/ChatViewController.h @@ -7,11 +7,12 @@ #import "XJBaseViewController.h" #import "QuestionDiseaseInfoModel.h" +#import "TUICallingViewManager.h" //#import "TUIBaseChatViewController.h" NS_ASSUME_NONNULL_BEGIN -@interface ChatViewController : XJBaseViewController +@interface ChatViewController : XJBaseViewController @property (nonatomic, strong) NSString * chatID; diff --git a/XinjiangProject/XinjiangProject/Project/TUIChat/ChatViewController.m b/XinjiangProject/XinjiangProject/Project/TUIChat/ChatViewController.m index ba7cc43..52759ca 100644 --- a/XinjiangProject/XinjiangProject/Project/TUIChat/ChatViewController.m +++ b/XinjiangProject/XinjiangProject/Project/TUIChat/ChatViewController.m @@ -212,8 +212,9 @@ } // self.view.backgroundColor = UIColorHex(#EEEEEE); if ([self.tfNew integerValue] == 1) { - [ESCTUIManager sendGroupVideo:self.chatID withUserIdList:self.member]; + TUICallingViewManager *manager = [[TUICallKit createInstance] valueForKey:@"callingViewManager"]; + manager.addUserDelegate = self; } //主动发送一条消息 //如果点击跳过进入 不操作 非跳过 发送健康档案 2=非跳过 @@ -307,6 +308,13 @@ [self.navigationController popViewControllerAnimated:YES]; } +#pragma mark - TUICallingViewManagerDelegate + +- (BOOL)callingViewManagerDidTapAddUser:(TUICallingViewManager *)manager { + [self moreAction]; + return YES; +} + #pragma mark: 右上角更多(群成员侧滑面板) - (void)moreAction { if (!self.isGroupID) return; @@ -437,7 +445,10 @@ XJSelectContactViewController *selectVC = [[XJSelectContactViewController alloc] init]; selectVC.chatID = self.chatID; selectVC.groupId = self.chatID; - [self.navigationController pushViewController:selectVC animated:YES]; + UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:selectVC]; + nav.modalPresentationStyle = UIModalPresentationFullScreen; + UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow; + [keyWindow.rootViewController presentViewController:nav animated:YES completion:nil]; } #pragma mark - 群成员列表 diff --git a/im修改记录.md b/im修改记录.md new file mode 100644 index 0000000..579e168 --- /dev/null +++ b/im修改记录.md @@ -0,0 +1,86 @@ +# IM(TUICallKit)Pods 修改记录 + +> pod update 后需按本文档重新应用修改。共 2 个文件。 + +--- + +## 1. TUICallingViewManager.h + +**路径:** `Pods/TUICallKit/TUICallKit/TUICallKit/UI/TUICallingViewManager.h` + +**改动:** 在 `@interface` 前加代理协议 + 声明 delegate 属性 + +```objc +// 在 @class CallingUserModel; 和 @interface 之间插入: + +@protocol TUICallingViewManagerDelegate + +/// 点击加号按钮,返回 YES 表示已自行处理(不再弹出系统选人页) +- (BOOL)callingViewManagerDidTapAddUser:(TUICallingViewManager *)manager; + +@end + +// 在 @interface 内部加: + +@property (nonatomic, weak) id addUserDelegate; +``` + +--- + +## 2. TUICallingViewManager.m + +**路径:** `Pods/TUICallKit/TUICallKit/TUICallKit/UI/TUICallingViewManager.m` + +### 改动 A:加号按钮恢复(取消注释) + +**位置:** `addOtherUserBtn` 懒加载方法(约 804 行) + +```objc +// 这两行取消注释: +[_addOtherUserBtn setBackgroundImage:[TUICallingCommon getBundleImageWithName:@"ic_add_user"] forState:UIControlStateNormal]; +[_addOtherUserBtn addTarget:self action:@selector(addOtherUserTouchEvent:) forControlEvents:UIControlEventTouchUpInside]; +``` + +### 改动 B:加号点击先走代理 + +**位置:** `addOtherUserTouchEvent:` 方法(约 565 行) + +方法开头插入代理判断: + +```objc +- (void)addOtherUserTouchEvent:(UIButton *)sender { + // ↓↓↓ 插入这 4 行 ↓↓↓ + if ([self.addUserDelegate respondsToSelector:@selector(callingViewManagerDidTapAddUser:)] + && [self.addUserDelegate callingViewManagerDidTapAddUser:self]) { + return; + } + // ↑↑↑ 插入结束 ↑↑↑ + TUICallKitSelectGroupMeberViewController *vc = [[TUICallKitSelectGroupMeberViewController alloc] init]; + // ... 原有代码不变 +} +``` + +--- + +## 业务层使用方式 + +```objc +#import "TUICallingViewManager.h" + +TUICallingViewManager *manager = [[TUICallKit createInstance] valueForKey:@"callingViewManager"]; +manager.addUserDelegate = self; + +// 实现代理: +- (BOOL)callingViewManagerDidTapAddUser:(TUICallingViewManager *)manager { + // 弹出自己的半屏选人 view + [self showMemberTableView]; + return YES; // 返回 YES 表示已自行处理 +} +``` + +--- + +## 注意事项 + +- 删除 `TUICallingViewManager+XJAddUser.h/.m` 两个文件(Swizzle 方案已废弃,改用代理) +- pod update 后需重新应用上述 2 个文件的改动