854 lines
32 KiB
Java
854 lines
32 KiB
Java
package cn.shangyu.gdxzExpert.fragment;
|
||
|
||
import android.Manifest;
|
||
import android.annotation.SuppressLint;
|
||
import android.app.Activity;
|
||
import android.app.AlertDialog;
|
||
import android.app.Dialog;
|
||
import android.content.Intent;
|
||
import android.graphics.drawable.Drawable;
|
||
import android.os.Build;
|
||
import android.os.Bundle;
|
||
import android.view.LayoutInflater;
|
||
import android.view.View;
|
||
import android.view.View.OnClickListener;
|
||
import android.view.ViewGroup;
|
||
import android.widget.ImageView;
|
||
import android.widget.LinearLayout;
|
||
import android.widget.RelativeLayout;
|
||
import android.widget.TextView;
|
||
|
||
import com.github.dfqin.grantor.PermissionListener;
|
||
import com.github.dfqin.grantor.PermissionsUtil;
|
||
import com.google.gson.Gson;
|
||
import com.lidroid.xutils.exception.HttpException;
|
||
import com.lidroid.xutils.http.RequestParams;
|
||
import com.lidroid.xutils.http.ResponseInfo;
|
||
import com.lidroid.xutils.http.callback.RequestCallBack;
|
||
import com.lidroid.xutils.http.client.HttpRequest.HttpMethod;
|
||
import com.lidroid.xutils.util.LogUtils;
|
||
import com.nostra13.universalimageloader.core.ImageLoader;
|
||
import com.zbar.lib.CaptureActivity;
|
||
|
||
import org.json.JSONArray;
|
||
import org.json.JSONException;
|
||
import org.json.JSONObject;
|
||
|
||
import java.util.HashMap;
|
||
import java.util.List;
|
||
import java.util.Map;
|
||
|
||
import androidx.annotation.NonNull;
|
||
import cn.shangyu.gdxzExpert.R;
|
||
import cn.shangyu.gdxzExpert.activity.AccumulatePointsActivity;
|
||
import cn.shangyu.gdxzExpert.activity.BindWeChatActivity;
|
||
import cn.shangyu.gdxzExpert.activity.FaPiaoActivity;
|
||
import cn.shangyu.gdxzExpert.activity.LoveActivity;
|
||
import cn.shangyu.gdxzExpert.activity.MyAccount2Activity;
|
||
import cn.shangyu.gdxzExpert.activity.MyBankCardActivity;
|
||
import cn.shangyu.gdxzExpert.activity.MyBillActivity;
|
||
import cn.shangyu.gdxzExpert.activity.MyCoursewareActivity;
|
||
import cn.shangyu.gdxzExpert.activity.MyDetailInfoActivity;
|
||
import cn.shangyu.gdxzExpert.activity.MyDownLoadsActivity;
|
||
import cn.shangyu.gdxzExpert.activity.MyFlowerActivity;
|
||
import cn.shangyu.gdxzExpert.activity.MyFuliCardActivity;
|
||
import cn.shangyu.gdxzExpert.activity.MyMindActivity;
|
||
import cn.shangyu.gdxzExpert.activity.MyQrCodeActivity;
|
||
import cn.shangyu.gdxzExpert.activity.MyWelfAreActivity;
|
||
import cn.shangyu.gdxzExpert.activity.NavigationActivity;
|
||
import cn.shangyu.gdxzExpert.activity.OutofPatientNoticeActivity;
|
||
import cn.shangyu.gdxzExpert.activity.PoMessageActivity;
|
||
import cn.shangyu.gdxzExpert.activity.SendMindActivity;
|
||
import cn.shangyu.gdxzExpert.activity.SettingAndHelpActivity;
|
||
import cn.shangyu.gdxzExpert.base.BaseFragment;
|
||
import cn.shangyu.gdxzExpert.bean.ChangeMyInfoBean;
|
||
import cn.shangyu.gdxzExpert.bean.ChangeMyInfoBean.InfoData;
|
||
import cn.shangyu.gdxzExpert.bean.ChangeMyInfoBean.SpecialData;
|
||
import cn.shangyu.gdxzExpert.bean.ExpertHonorBean;
|
||
import cn.shangyu.gdxzExpert.bean.GethonorDetailBean;
|
||
import cn.shangyu.gdxzExpert.bean.MyPointsBean;
|
||
import cn.shangyu.gdxzExpert.http.HttpHelper;
|
||
import cn.shangyu.gdxzExpert.http.OnCallBackFromNet;
|
||
import cn.shangyu.gdxzExpert.polyvplayer.MyDownLoadVideoActivity;
|
||
import cn.shangyu.gdxzExpert.utils.Constant;
|
||
import cn.shangyu.gdxzExpert.utils.GsonTools;
|
||
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
||
import cn.shangyu.gdxzExpert.utils.LogUtil;
|
||
import cn.shangyu.gdxzExpert.utils.MyUserIconUtil;
|
||
import cn.shangyu.gdxzExpert.utils.SharePrefUtil;
|
||
import cn.shangyu.gdxzExpert.utils.StringUtil;
|
||
import cn.shangyu.gdxzExpert.utils.ToastUtil;
|
||
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
||
import cn.shangyu.gdxzExpert.utils.UniappUtil;
|
||
import cn.shangyu.gdxzExpert.utils.UpdateVersionUtils;
|
||
import cn.shangyu.gdxzExpert.utils.Url;
|
||
import cn.shangyu.gdxzExpert.utils.ValidateUtils;
|
||
import cn.shangyu.gdxzExpert.widget.CircleImageView;
|
||
import cn.shangyu.gdxzExpert.widget.LoadingPage.ResultState;
|
||
|
||
//import cn.shangyu.gdxzExpert.ecdemo.ui.huawei.PustDemoActivity;
|
||
|
||
/**
|
||
*
|
||
* 功能说明:我的fragment 类名称:MyFragment 类描述: 创建人:苏三元 时间:2015-9-24 下午1:44:07
|
||
* 版权:河南商宇科技有限公司--版权所有 (c) 2015
|
||
*
|
||
*/
|
||
public class MyFragment extends BaseFragment implements OnClickListener,OnCallBackFromNet {
|
||
private CircleImageView pic;
|
||
private TextView name, tv_hospital;
|
||
|
||
private Drawable rightDrawable;
|
||
private Drawable my_head_bg;
|
||
private TextView tv_position;
|
||
private TextView tv_office;
|
||
public static String getExpertByUuid = Url.getExpertByUuid;// 查看个人资料
|
||
private TextView mTv_new_version;
|
||
private TextView mIv_flowerNum, mIv_patientNum,mTv_consultNum;;
|
||
private static final int EXPERTHONOR = 201;
|
||
private List<ExpertHonorBean.HonorListBean> honorList;
|
||
private TextView tv_rongyu1,tv_rongyu2,tv_rongyu3,tv_rongyu4,tv_rongyu5;
|
||
private LinearLayout ll_rongyu,ll_rongyu1;
|
||
private static final int GETHONORDETAIL = 202;
|
||
private static final int ISBOUNDWECHATBYUUID = 207;
|
||
private Dialog dialog;
|
||
private ImageView bt_wechat;
|
||
@SuppressLint("NewApi")
|
||
@Override
|
||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||
Bundle savedInstanceState) {
|
||
View view = UIUtils.inflate(R.layout.fragment_my);
|
||
bt_wechat=view.findViewById(R.id.bt_wechat);//微信
|
||
RelativeLayout rl_myhead = (RelativeLayout) view
|
||
.findViewById(R.id.myhead);// 顶部
|
||
RelativeLayout myhead = (RelativeLayout) view
|
||
.findViewById(R.id.rl_myhead);// 顶部头像
|
||
pic = (CircleImageView) view.findViewById(R.id.pic);// 我的头像
|
||
name = (TextView) view.findViewById(R.id.name);// 我的姓名
|
||
tv_hospital = (TextView) view.findViewById(R.id.tv_hospital);// 我的医院
|
||
ll_rongyu = (LinearLayout) view.findViewById(R.id.ll_rongyu);// 我的荣誉
|
||
ll_rongyu1 = (LinearLayout) view.findViewById(R.id.ll_rongyu1);// 我的荣誉
|
||
tv_rongyu1 = (TextView) view.findViewById(R.id.tv_rongyu1);// 我的荣誉
|
||
tv_rongyu2 = (TextView) view.findViewById(R.id.tv_rongyu2);// 我的荣誉
|
||
tv_rongyu3 = (TextView) view.findViewById(R.id.tv_rongyu3);// 我的荣誉
|
||
tv_rongyu4 = (TextView) view.findViewById(R.id.tv_rongyu4);// 我的荣誉
|
||
tv_rongyu5 = (TextView) view.findViewById(R.id.tv_rongyu5);// 我的荣誉
|
||
tv_position = (TextView) view.findViewById(R.id.tv_position);// 我的职称
|
||
mTv_new_version = (TextView) view.findViewById(R.id.tv_new_version);
|
||
tv_office = (TextView) view.findViewById(R.id.tv_office);// 我的科室
|
||
TextView mydata = (TextView) view.findViewById(R.id.mydata);// 我的账户
|
||
TextView myservice = (TextView) view.findViewById(R.id.myservice);// 服务设置
|
||
RelativeLayout myorders = (RelativeLayout) view
|
||
.findViewById(R.id.myorders);// 我的服务记录
|
||
RelativeLayout myflowers = (RelativeLayout) view
|
||
.findViewById(R.id.myflowers);// 我收到的鲜花
|
||
RelativeLayout myinformation = (RelativeLayout) view
|
||
.findViewById(R.id.myinformation);// 我发布的消息
|
||
|
||
RelativeLayout mycollection = (RelativeLayout) view
|
||
.findViewById(R.id.mycollection);// 我的收藏
|
||
RelativeLayout myvideo = (RelativeLayout) view
|
||
.findViewById(R.id.myvideo);// 我的收藏
|
||
RelativeLayout mydownload = (RelativeLayout) view
|
||
.findViewById(R.id.mydownload);// 我的下载
|
||
|
||
RelativeLayout mycard = (RelativeLayout) view.findViewById(R.id.mycard);// 常用银行卡
|
||
// RelativeLayout mybill = (RelativeLayout)
|
||
// view.findViewById(R.id.mybill);//收益结算
|
||
RelativeLayout my_qr_code = (RelativeLayout) view.findViewById(R.id.my_qr_code);// 我的二维码
|
||
RelativeLayout rl_my_qr_sao = (RelativeLayout) view.findViewById(R.id.rl_my_qr_sao);// 扫一扫
|
||
|
||
RelativeLayout my_qr_love = (RelativeLayout) view
|
||
.findViewById(R.id.my_qr_love);// 爱心捐助
|
||
RelativeLayout mysetting = (RelativeLayout) view
|
||
.findViewById(R.id.mysetting);// 设置与帮助
|
||
|
||
TextView mywork = (TextView) view.findViewById(R.id.mywork);// 我的工作表
|
||
RelativeLayout mymind = (RelativeLayout) view
|
||
.findViewById(R.id.myminds);// 我的心意
|
||
RelativeLayout myfapiao=view.findViewById(R.id.myfapiao);//我的发票
|
||
RelativeLayout mywelfare = (RelativeLayout) view
|
||
.findViewById(R.id.mywelfare);// 我的福利
|
||
RelativeLayout my_course = (RelativeLayout) view
|
||
.findViewById(R.id.my_courseware);// 我的课件
|
||
RelativeLayout sendMind = (RelativeLayout) view
|
||
.findViewById(R.id.send_mind);// 送心意
|
||
if (my_head_bg == null) {
|
||
my_head_bg = UIUtils.getDrawable(R.drawable.my_head_bg);
|
||
}
|
||
mTv_consultNum=(TextView) view.findViewById(R.id.tv_consultnum);
|
||
mIv_flowerNum = (TextView) view.findViewById(R.id.tv_flowernum);
|
||
mIv_patientNum = (TextView) view.findViewById(R.id.tv_patientnum);
|
||
int consultTotalNum = SharePrefUtil.getInt(mActivity, "ConsultTotalNum", 0);
|
||
int pingFlowewrnum = SharePrefUtil.getInt(mActivity, "pingFlowewrnum", 0);
|
||
int expertApplyNum = SharePrefUtil.getInt(mActivity, "expertApplyNum", 0);
|
||
mTv_consultNum.setText(":" + consultTotalNum);
|
||
mIv_flowerNum.setText(":" + pingFlowewrnum);
|
||
mIv_patientNum.setText(":" + expertApplyNum);
|
||
/****************************** 注意setBackground不支持4.0.4以下 ***************************************/
|
||
// rl_myhead.setBackground(my_head_bg);
|
||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||
rl_myhead.setBackground(my_head_bg);
|
||
} else {
|
||
rl_myhead.setBackgroundDrawable(my_head_bg);
|
||
}
|
||
|
||
// 从sp文件里取出资料
|
||
String realName = SharePrefUtil.getString(mActivity, "realName", null);
|
||
String mobile = SharePrefUtil.getString(mActivity, "mobile", null);
|
||
String photo = SharePrefUtil.getString(mActivity, "photo", null);
|
||
String hospitalName = SharePrefUtil.getString(mActivity,
|
||
"hospitalName", null);
|
||
String officeName = SharePrefUtil.getString(mActivity, "officeName",
|
||
null);
|
||
String positionName = SharePrefUtil.getString(mActivity,
|
||
"positionName", null);
|
||
int sex = SharePrefUtil.getInt(mActivity, "sex", 0);
|
||
LogUtil.i("realName==" + realName + " photo==" + photo + " mobile=="
|
||
+ mobile);
|
||
// 回显到控件上
|
||
if (realName != null && !"null".equals(realName)) {
|
||
name.setText(realName);
|
||
}
|
||
if (rightDrawable == null) {
|
||
rightDrawable = UIUtils.getDrawable(R.drawable.new_man);
|
||
}
|
||
if (1 == sex) {// 0男,1女
|
||
rightDrawable = UIUtils.getDrawable(R.drawable.new_woman);
|
||
}
|
||
rightDrawable.setBounds(0, 0, rightDrawable.getMinimumWidth(),
|
||
rightDrawable.getMinimumHeight());
|
||
name.setCompoundDrawables(null, null, rightDrawable, null);
|
||
|
||
if (hospitalName != null && !"null".equals(hospitalName)) {
|
||
tv_hospital.setText(hospitalName);
|
||
}
|
||
if (positionName != null && !"null".equals(positionName)) {
|
||
tv_position.setText(positionName);
|
||
}
|
||
if (officeName != null && !"null".equals(officeName)) {
|
||
tv_office.setText(officeName);
|
||
}
|
||
if (photo != null && !"null".equals(photo)) {
|
||
ImageLoader
|
||
.getInstance()
|
||
.displayImage(
|
||
Url.urlHtml + photo,
|
||
pic,
|
||
ImageOptions
|
||
.getImageOptions(R.drawable.icon_touxiang_persion_gray));
|
||
}
|
||
|
||
int getisaccount = SharePrefUtil.getInt(mActivity, "GETISACCOUNT", 1);
|
||
if (0==getisaccount){
|
||
mydata.setVisibility(View.GONE);
|
||
mymind.setVisibility(View.GONE);
|
||
my_course.setVisibility(View.GONE);
|
||
myflowers.setVisibility(View.GONE);
|
||
mycard.setVisibility(View.GONE);
|
||
}
|
||
|
||
bt_wechat.setOnClickListener(this);
|
||
my_course.setOnClickListener(this);
|
||
mymind.setOnClickListener(this);
|
||
myfapiao.setOnClickListener(this);
|
||
myhead.setOnClickListener(this);
|
||
mydata.setOnClickListener(this);
|
||
myservice.setOnClickListener(this);
|
||
myorders.setOnClickListener(this);
|
||
myflowers.setOnClickListener(this);
|
||
myinformation.setOnClickListener(this);
|
||
mycollection.setOnClickListener(this);
|
||
mydownload.setOnClickListener(this);
|
||
mycard.setOnClickListener(this);
|
||
// mybill.setOnClickListener(this);
|
||
my_qr_code.setOnClickListener(this);
|
||
my_qr_love.setOnClickListener(this);
|
||
mysetting.setOnClickListener(this);
|
||
mywork.setOnClickListener(this);
|
||
sendMind.setOnClickListener(this);
|
||
myvideo.setOnClickListener(this);
|
||
mywelfare.setOnClickListener(this);
|
||
tv_rongyu1.setOnClickListener(this);
|
||
tv_rongyu2.setOnClickListener(this);
|
||
tv_rongyu3.setOnClickListener(this);
|
||
tv_rongyu4.setOnClickListener(this);
|
||
tv_rongyu5.setOnClickListener(this);
|
||
rl_my_qr_sao.setOnClickListener(this);
|
||
getList(getExpertByUuid);
|
||
getGroup();
|
||
expertHonor();//专家荣誉
|
||
return view;
|
||
}
|
||
|
||
private void expertHonor() {
|
||
Map<String, String> param = new HashMap<>();
|
||
param.put("expert_uuid",SharePrefUtil.getString(mActivity, "uuid", ""));
|
||
sendJsonPostParamtoNetSignMD5(Url.expertHonor, param, EXPERTHONOR, this);
|
||
}
|
||
|
||
@Override
|
||
public void onDestroy() {
|
||
// TODO Auto-generated method stub
|
||
super.onDestroy();
|
||
my_head_bg.setCallback(null);
|
||
rightDrawable.setCallback(null);
|
||
}
|
||
|
||
@Override
|
||
public View onCreateSuccessedView() {
|
||
return null;
|
||
}
|
||
|
||
@Override
|
||
public ResultState onLoad() {
|
||
return null;
|
||
}
|
||
|
||
@Override
|
||
public void onClick(View v) {
|
||
// AGP 8.0+ R.id 不再是 final 常量,不能用于 switch,改用 if-else
|
||
int id = v.getId();
|
||
if (id == R.id.bt_wechat) {//微信
|
||
startActivity(new Intent(mActivity, BindWeChatActivity.class));
|
||
} else if (id == R.id.rl_myhead) {// 我
|
||
// startActivity(new Intent(mActivity, LoginSetInfoActivity.class));
|
||
if (!UIUtils.isNetWorkConnected(getActivity())) {
|
||
ToastUtil.showToast("网络不可用,请连接网络再试");
|
||
return;
|
||
}
|
||
startActivityForResult(new Intent(mActivity,
|
||
MyDetailInfoActivity.class), Constant.INFO_CODE);
|
||
} else if (id == R.id.mydata) {// 我的账户
|
||
// startActivity(new Intent(mActivity, MyAccountActivity.class));
|
||
startActivity(new Intent(mActivity, MyAccount2Activity.class));
|
||
} else if (id == R.id.myservice) {// 出诊计划
|
||
startActivity(new Intent(mActivity, OutofPatientNoticeActivity.class));
|
||
} else if (id == R.id.myorders) {// 交易记录
|
||
startActivity(new Intent(mActivity, MyBillActivity.class));
|
||
} else if (id == R.id.myflowers) {// 我的鲜花
|
||
startActivity(new Intent(mActivity, MyFlowerActivity.class));
|
||
} else if (id == R.id.myinformation) {// 我发布的消息
|
||
startActivity(new Intent(mActivity, PoMessageActivity.class));
|
||
} else if (id == R.id.mycollection) {// 我的收藏
|
||
Intent intent = new Intent(mActivity, MyDownLoadsActivity.class);
|
||
intent.setType("collection");
|
||
startActivity(intent);
|
||
} else if (id == R.id.myvideo) {// 我的视频
|
||
Intent intentVideo = new Intent(mActivity, MyDownLoadVideoActivity.class);
|
||
startActivity(intentVideo);
|
||
} else if (id == R.id.mydownload) {// 我的下载
|
||
Intent intent1 = new Intent(mActivity, MyDownLoadsActivity.class);
|
||
intent1.setType("download");
|
||
startActivity(intent1);
|
||
} else if (id == R.id.mycard) {// 我的银行卡
|
||
startActivity(new Intent(mActivity, MyBankCardActivity.class));
|
||
// case R.id.mybill://收益结算
|
||
//
|
||
// break;
|
||
} else if (id == R.id.my_qr_code) {// 我的二维码
|
||
// startActivity(new Intent(mActivity, MyQrCodeActivity.class));
|
||
|
||
UniappUtil.showUniMp(mActivity, "/pages_app/myCode/myCode", null);
|
||
} else if (id == R.id.rl_my_qr_sao) {// 扫一扫
|
||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||
|
||
if (PermissionsUtil.hasPermission(mActivity, Manifest.permission.CAMERA)) {
|
||
//有访问摄像头的权限,读写内存,网络定位,打电话,读取短信,录音,通讯录
|
||
startToCapture();
|
||
} else {
|
||
PermissionsUtil.requestPermission(mActivity, new PermissionListener() {
|
||
@Override
|
||
public void permissionGranted(@NonNull String[] permissions) {
|
||
//用户授予了访问读取短信的权限
|
||
startToCapture();
|
||
}
|
||
@Override
|
||
public void permissionDenied(@NonNull String[] permissions) {
|
||
//用户拒绝了访问读取短信的申请
|
||
|
||
}
|
||
|
||
}, new String[]{Manifest.permission.CAMERA});
|
||
}
|
||
|
||
}else {
|
||
startToCapture();
|
||
}
|
||
} else if (id == R.id.my_qr_love) {// 爱心捐助
|
||
startActivity(new Intent(mActivity, LoveActivity.class));
|
||
} else if (id == R.id.mysetting) {// 设置与帮助
|
||
startActivity(new Intent(mActivity, SettingAndHelpActivity.class));
|
||
} else if (id == R.id.mywork) {// 我的优惠券
|
||
// startActivity(new Intent(mActivity, SendMindActivity.class));
|
||
// startActivity(new Intent(mActivity, MyWorkTableActivity.class));
|
||
// ToastUtil.showMessage("暂无优惠券");
|
||
// Intent intentpoints = new Intent(mActivity, AccumulatePointsActivity.class);
|
||
// startActivity(intentpoints);
|
||
|
||
UniappUtil.showUniMp(mActivity, "/pages_app/myPoint/myPoint", null);
|
||
} else if (id == R.id.myminds) {// 我的心意
|
||
startActivity(new Intent(mActivity, MyMindActivity.class));
|
||
} else if (id == R.id.myfapiao) {
|
||
startActivity(new Intent(mActivity, FaPiaoActivity.class));
|
||
} else if (id == R.id.send_mind) {// 送心意
|
||
startActivity(new Intent(mActivity, SendMindActivity.class));
|
||
// startActivity(new Intent(mActivity, MyWorkTableActivity.class));
|
||
} else if (id == R.id.my_courseware) {
|
||
startActivity(new Intent(mActivity, MyCoursewareActivity.class));
|
||
} else if (id == R.id.mywelfare) {//我的福利
|
||
// startActivity(new Intent(mActivity ,MyWelfAreActivity.class));
|
||
|
||
UniappUtil.showUniMp(mActivity, "/pages_app/myWelfare/myWelfare", null);
|
||
} else if (id == R.id.tv_rongyu1) {//我的荣誉
|
||
gethonorDetail(honorList.get(0).getId());
|
||
} else if (id == R.id.tv_rongyu2) {
|
||
gethonorDetail(honorList.get(1).getId());
|
||
} else if (id == R.id.tv_rongyu3) {
|
||
gethonorDetail(honorList.get(2).getId());
|
||
} else if (id == R.id.tv_rongyu4) {
|
||
gethonorDetail(honorList.get(0).getId());
|
||
} else if (id == R.id.tv_rongyu5) {
|
||
gethonorDetail(honorList.get(1).getId());
|
||
}
|
||
}
|
||
//判断用户是否绑定过微信
|
||
private void isBoundWechatByUuid() {
|
||
Map<String,String> map = new HashMap<>();
|
||
|
||
sendJsonPostParamtoNetSignMD5(Url.isBoundWechatByUuid,map,ISBOUNDWECHATBYUUID,this);
|
||
}
|
||
|
||
private void startToCapture() {
|
||
startActivity(new Intent(mActivity, CaptureActivity.class));
|
||
}
|
||
|
||
private void gethonorDetail(int id) {
|
||
Map<String,String> map = new HashMap<>();
|
||
map.put("expert_uuid",SharePrefUtil.getString(mActivity, "uuid", ""));
|
||
map.put("id",id+"");
|
||
sendJsonPostParamtoNetSignMD5(Url.gethonorDetail,map,GETHONORDETAIL,this);
|
||
}
|
||
@Override
|
||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||
if (resultCode == Activity.RESULT_OK
|
||
&& requestCode == Constant.INFO_CODE) {
|
||
// 头像
|
||
if (data != null) {
|
||
LogUtil.i("data=" + data + "p==" + data.getStringExtra("photo"));
|
||
ImageLoader
|
||
.getInstance()
|
||
.displayImage(
|
||
data.getStringExtra("photo"),
|
||
pic,
|
||
ImageOptions
|
||
.getImageOptions(R.drawable.icon_touxiang_persion_gray));
|
||
}
|
||
}
|
||
super.onActivityResult(requestCode, resultCode, data);
|
||
}
|
||
|
||
@Override
|
||
public void onResume() {
|
||
super.onResume();
|
||
String officeName = SharePrefUtil.getString(mActivity, "officeName",
|
||
null);
|
||
String positionName = SharePrefUtil.getString(mActivity,
|
||
"positionName", null);
|
||
tv_position.setText(positionName);
|
||
tv_office.setText(officeName);
|
||
String photo = SharePrefUtil.getString(mActivity, "MyChangePhoto", "");
|
||
if (!StringUtil.isBland(photo) && pic != null) {
|
||
ImageLoader
|
||
.getInstance()
|
||
.displayImage(
|
||
photo,
|
||
pic,
|
||
ImageOptions
|
||
.getImageOptions(R.drawable.icon_touxiang_persion_gray));
|
||
SharePrefUtil.saveString(mActivity, "MyChangePhoto", null);
|
||
}
|
||
String isbound_wechat = SharePrefUtil.getString(mActivity, "isbound_wechat", "");
|
||
if(!StringUtil.isEmpty(isbound_wechat))
|
||
{
|
||
if(isbound_wechat.equals("yes"))
|
||
{
|
||
bt_wechat.setVisibility(View.GONE);
|
||
}
|
||
else
|
||
{
|
||
bt_wechat.setVisibility(View.VISIBLE);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
isBoundWechatByUuid();
|
||
}
|
||
}
|
||
|
||
|
||
|
||
// 获取数据
|
||
private void getList(final String loadUrl) {
|
||
String uuid = SharePrefUtil.getString(mActivity, "uuid", "");
|
||
RequestParams params = new RequestParams();// 封装参数
|
||
// disease = tv_disease.getText().toString().trim();
|
||
|
||
params.addBodyParameter("uuid", uuid);// 唯一标识 必填
|
||
|
||
HttpHelper.loadData(HttpMethod.POST, loadUrl, params,
|
||
new RequestCallBack<String>() {
|
||
|
||
@Override
|
||
public void onSuccess(ResponseInfo<String> info) {
|
||
|
||
processData(info.result);
|
||
}
|
||
|
||
@Override
|
||
public void onFailure(HttpException arg0, String arg1) {
|
||
closeProgressDialog();
|
||
LogUtil.i("数据请求失败了: " + arg1);
|
||
}
|
||
});
|
||
}
|
||
|
||
// 获取数据
|
||
String versionName;
|
||
private MyPointsBean fromJson;
|
||
|
||
private void getGroup() {
|
||
versionName = UpdateVersionUtils.getVersionName();
|
||
String uuid = SharePrefUtil.getString(mActivity, "uuid", "");
|
||
RequestParams params = new RequestParams();// 封装参数
|
||
// disease = tv_disease.getText().toString().trim();
|
||
|
||
params.addBodyParameter("currVer", "1");// 唯一标识 必填
|
||
params.addBodyParameter("appType", String.valueOf(1));// 唯一标识 必填
|
||
HttpHelper.loadData(HttpMethod.POST, Url.getUpdateApk, params,
|
||
new RequestCallBack<String>() {
|
||
|
||
@Override
|
||
public void onSuccess(ResponseInfo<String> info) {
|
||
|
||
processDataGrup(info.result);
|
||
}
|
||
|
||
@Override
|
||
public void onFailure(HttpException arg0, String arg1) {
|
||
closeProgressDialog();
|
||
LogUtil.i("数据请求失败了: " + arg1);
|
||
}
|
||
});
|
||
}
|
||
|
||
private void processDataGrup(String result) {
|
||
// TODO Auto-generated method stub
|
||
if (result == null) {
|
||
return;
|
||
}
|
||
String code = null;
|
||
JSONObject jsonObject = null;
|
||
JSONArray jsonArray = null;
|
||
|
||
try {
|
||
jsonObject = new JSONObject(result);
|
||
code = jsonObject.getString("code");
|
||
String newVersion = jsonObject.getString("newVersion");
|
||
if ("1".equals(code)&&!newVersion.equals(versionName)) {
|
||
if (UpdateVersionUtils.isUpdataInfo(versionName,newVersion)){
|
||
mTv_new_version.setVisibility(View.VISIBLE);
|
||
}else {
|
||
mTv_new_version.setVisibility(View.GONE);
|
||
}
|
||
|
||
} else {
|
||
mTv_new_version.setVisibility(View.GONE);
|
||
}
|
||
|
||
} catch (JSONException e) {
|
||
// TODO Auto-generated catch block
|
||
e.printStackTrace();
|
||
|
||
}
|
||
}
|
||
|
||
public void processData(String result) {
|
||
// TODO Auto-generated method stub
|
||
LogUtil.i("个人资料 = "+result);
|
||
ChangeMyInfoBean bean = GsonTools.fromGsonToBean(result,
|
||
ChangeMyInfoBean.class);
|
||
if ("1".equals(bean.code)) {
|
||
InfoData data = bean.expert;
|
||
if (data != null) {
|
||
String realName = data.realName;
|
||
int sex = data.sex;
|
||
String birthDate = data.birthDate;
|
||
String mobile = data.mobile;
|
||
String userName = data.userName;
|
||
String photo = data.photo;
|
||
String email = data.email;
|
||
String hospitalUuid = data.hospitalUuid;
|
||
String hospitalName = data.hospitalName;
|
||
String officeName = data.officeName;
|
||
String officePhone = data.officePhone;
|
||
String officeUuid = data.officeUuid;
|
||
String positionUuid = data.positionUuid;
|
||
String positionName = data.positionName;
|
||
String certificate = data.certificate;
|
||
String certificateImg = data.certificateImg;
|
||
String qrcode = data.qrcode;
|
||
String intro = data.intro;
|
||
String isStar = data.isStar;
|
||
// int countyId = data.countyId;
|
||
// int provId = data.provId;
|
||
// int cityId = data.cityId;
|
||
|
||
// 保存个人资料到SP文件
|
||
SharePrefUtil.saveString(mActivity, "qrcode", qrcode);
|
||
// SharePrefUtil.saveInt(ct, "cityId", cityId);
|
||
// SharePrefUtil.saveInt(ct, "countyId", countyId);
|
||
// SharePrefUtil.saveInt(ct, "provId", provId);
|
||
SharePrefUtil.saveInt(mActivity, "sex", sex);
|
||
SharePrefUtil.saveString(mActivity, "isStar", isStar);
|
||
|
||
LogUtil.i("data==" + data.toString());
|
||
|
||
// 回显头像
|
||
if (!StringUtil.isEmpty(photo)) {
|
||
ImageLoader
|
||
.getInstance()
|
||
.displayImage(
|
||
Url.urlHtml + photo,
|
||
pic,
|
||
ImageOptions
|
||
.getImageOptions(R.drawable.icon_touxiang_persion_gray));
|
||
SharePrefUtil.saveString(mActivity, Constant.photo, photo);
|
||
}
|
||
// 回显姓名
|
||
if (!StringUtil.isEmpty(realName)) {
|
||
name.setText(realName);
|
||
SharePrefUtil.saveString(mActivity, Constant.realName,realName);
|
||
}
|
||
// 手机号
|
||
if (!StringUtil.isEmpty(userName)
|
||
&& ValidateUtils.isMobileNum(userName)) {
|
||
SharePrefUtil.saveString(mActivity,
|
||
Constant.SP_IS_FIRST_NAME, Constant.mobile,
|
||
userName);// 手机号
|
||
SharePrefUtil.saveString(mActivity, Constant.mobile,
|
||
userName);
|
||
}
|
||
// 性别
|
||
if (0 == sex) {
|
||
rightDrawable = UIUtils.getDrawable(R.drawable.new_man);
|
||
} else {
|
||
rightDrawable = UIUtils.getDrawable(R.drawable.new_woman);
|
||
}
|
||
rightDrawable.setBounds(0, 0, rightDrawable.getMinimumWidth(),
|
||
rightDrawable.getMinimumHeight());
|
||
name.setCompoundDrawables(null, null, rightDrawable, null);
|
||
|
||
// 出生日期
|
||
if (!StringUtil.isEmpty(birthDate)) {
|
||
SharePrefUtil.saveString(mActivity, "birthDate", birthDate);
|
||
}
|
||
// 邮箱
|
||
if (!StringUtil.isEmpty(email)) {
|
||
SharePrefUtil.saveString(mActivity, "email", email);
|
||
}
|
||
// 医院名称
|
||
if (!StringUtil.isEmpty(hospitalName)) {
|
||
tv_hospital.setText(hospitalName);
|
||
SharePrefUtil.saveString(mActivity, "hospitalUuid",
|
||
hospitalUuid);
|
||
SharePrefUtil.saveString(mActivity, "hospitalName",
|
||
hospitalName);
|
||
}
|
||
// 科室
|
||
if (!StringUtil.isEmpty(officeName)) {
|
||
tv_office.setText(officeName);
|
||
SharePrefUtil.saveString(mActivity, "officeUuid",
|
||
officeUuid);
|
||
SharePrefUtil.saveString(mActivity, "officeName",
|
||
officeName);
|
||
}
|
||
// 科室电话
|
||
if (!StringUtil.isEmpty(officePhone)) {
|
||
SharePrefUtil.saveString(mActivity, "officePhone",
|
||
officePhone);
|
||
}
|
||
// 职称
|
||
if (!StringUtil.isEmpty(positionName)) {
|
||
tv_position.setText(positionName);
|
||
SharePrefUtil.saveString(mActivity, "positionUuid",
|
||
positionUuid);
|
||
SharePrefUtil.saveString(mActivity, "positionName",
|
||
positionName);
|
||
}
|
||
// 资格证书编号
|
||
if (!StringUtil.isEmpty(certificate)) {
|
||
SharePrefUtil.saveString(mActivity, "certificate",
|
||
certificate);
|
||
}
|
||
// 证书图片
|
||
if (!StringUtil.isEmpty(certificateImg)) {
|
||
SharePrefUtil.saveString(mActivity, "certificateImg",
|
||
certificateImg);
|
||
}
|
||
// 简介
|
||
if (!StringUtil.isEmpty(intro)) {
|
||
SharePrefUtil.saveString(mActivity, "intro", intro);
|
||
}
|
||
|
||
List<SpecialData> special = bean.specialy;// 专长
|
||
// 根据专长uuid进行查询专长名称
|
||
if (special != null && special.size() > 0) {
|
||
String disease = "";
|
||
String diseaseNames = "";
|
||
for (int j = 0; j < special.size(); j++) {
|
||
disease += special.get(j).diseaseUuid + ",";
|
||
diseaseNames += special.get(j).diseaseName + "、";
|
||
}
|
||
if (diseaseNames.length() > 0) {
|
||
// 去掉最后一个“、”
|
||
diseaseNames = diseaseNames.substring(0,
|
||
diseaseNames.length() - 1);
|
||
}
|
||
// 专长
|
||
SharePrefUtil.saveString(mActivity, "disease", disease);
|
||
SharePrefUtil.saveString(mActivity, "diseaseName",
|
||
diseaseNames);
|
||
LogUtil.i("disease==" + disease + "diseaseNames=="
|
||
+ diseaseNames);
|
||
}
|
||
|
||
}
|
||
closeProgressDialog();
|
||
} else {
|
||
closeProgressDialog();
|
||
ToastUtil.showToast("资料加载失败,请重试");
|
||
}
|
||
}
|
||
|
||
|
||
@Override
|
||
public void onCallbackFromThread(String resultJson) {
|
||
|
||
}
|
||
|
||
@Override
|
||
public void onCallBackFromThread(String resultJson, int resultCode) {
|
||
switch (resultCode){
|
||
case ISBOUNDWECHATBYUUID:
|
||
try {
|
||
JSONObject jsonObject1 = new JSONObject(resultJson);
|
||
String code1 = jsonObject1.getString("code");
|
||
if ("200".equals(code1)){
|
||
int isBound = jsonObject1.getInt("isBound");
|
||
if (isBound==0){
|
||
bt_wechat.setVisibility(View.VISIBLE);
|
||
|
||
}else {
|
||
bt_wechat.setVisibility(View.GONE);
|
||
}
|
||
}else {
|
||
ToastUtil.showMessage(jsonObject1.getString("message"));
|
||
}
|
||
|
||
|
||
} catch (JSONException e) {
|
||
// TODO Auto-generated catch block
|
||
e.printStackTrace();
|
||
|
||
}
|
||
break;
|
||
case EXPERTHONOR:
|
||
LogUtils.i("EXPERTHONOR = "+resultJson);
|
||
Gson gson1 = new Gson();
|
||
ExpertHonorBean fromJsonBean1= gson1.fromJson(resultJson, ExpertHonorBean.class);
|
||
if (fromJsonBean1!=null&&"1".equals(fromJsonBean1.getCode())){
|
||
honorList = fromJsonBean1.getHonorList();
|
||
if (honorList.size()>2){
|
||
ll_rongyu.setVisibility(View.VISIBLE);
|
||
|
||
tv_rongyu1.setVisibility(View.VISIBLE);
|
||
tv_rongyu1.setText(honorList.get(0).getNick_name());
|
||
tv_rongyu2.setVisibility(View.VISIBLE);
|
||
tv_rongyu2.setText(honorList.get(1).getNick_name());
|
||
tv_rongyu3.setVisibility(View.VISIBLE);
|
||
tv_rongyu3.setText(honorList.get(2).getNick_name());
|
||
}else {
|
||
ll_rongyu1.setVisibility(View.VISIBLE);
|
||
if (honorList.size()>0){
|
||
tv_rongyu4.setVisibility(View.VISIBLE);
|
||
tv_rongyu4.setText(honorList.get(0).getNick_name());
|
||
}
|
||
if (honorList.size()>1){
|
||
tv_rongyu5.setVisibility(View.VISIBLE);
|
||
tv_rongyu5.setText(honorList.get(1).getNick_name());
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
}
|
||
break;
|
||
case GETHONORDETAIL:
|
||
LogUtils.i("GETHONORDETAIL = "+resultJson);
|
||
Gson gson2 = new Gson();
|
||
GethonorDetailBean fromJsonBean2= gson2.fromJson(resultJson, GethonorDetailBean.class);
|
||
if (fromJsonBean2!=null&&"1".equals(fromJsonBean2.getCode())){
|
||
LayoutInflater inflater = LayoutInflater.from(getActivity());
|
||
RelativeLayout layout = (RelativeLayout) inflater.inflate(R.layout.layout_yingxiongbang, null);
|
||
if (dialog==null){
|
||
dialog = new AlertDialog.Builder(getActivity()).create();
|
||
}
|
||
RelativeLayout rl_nickname = (RelativeLayout) layout.findViewById(R.id.rl_nickname);
|
||
TextView tv_context = (TextView) layout.findViewById(R.id.tv_context);
|
||
TextView tv_nick_name1 = (TextView) layout.findViewById(R.id.tv_nick_name1);
|
||
TextView tv_nick_name2 = (TextView) layout.findViewById(R.id.tv_nick_name2);
|
||
TextView tv_nick_name3 = (TextView) layout.findViewById(R.id.tv_nick_name3);
|
||
TextView tv_nick_name4 = (TextView) layout.findViewById(R.id.tv_nick_name4);
|
||
ImageView iv_img = (ImageView) layout.findViewById(R.id.iv_img);
|
||
View v_close = layout.findViewById(R.id.v_close);
|
||
TextView tv_title = (TextView) layout.findViewById(R.id.tv_title);
|
||
tv_context.setText(fromJsonBean2.getData().getNote());
|
||
tv_title.setText(fromJsonBean2.getData().getTitle());
|
||
ImageLoader.getInstance().displayImage(Url.urlHtml + fromJsonBean2.getData().getImg(), iv_img);
|
||
if (fromJsonBean2.getData().getHonorlist()!=null){
|
||
rl_nickname.setVisibility(View.VISIBLE);
|
||
if (fromJsonBean2.getData().getHonorlist().size()>0){
|
||
tv_nick_name1.setVisibility(View.VISIBLE);
|
||
tv_nick_name1.setText(fromJsonBean2.getData().getHonorlist().get(0).getNick_name());
|
||
}
|
||
if (fromJsonBean2.getData().getHonorlist().size()>1){
|
||
tv_nick_name2.setVisibility(View.VISIBLE);
|
||
tv_nick_name2.setText(fromJsonBean2.getData().getHonorlist().get(1).getNick_name());
|
||
}
|
||
if (fromJsonBean2.getData().getHonorlist().size()>2){
|
||
tv_nick_name3.setVisibility(View.VISIBLE);
|
||
tv_nick_name3.setText(fromJsonBean2.getData().getHonorlist().get(2).getNick_name());
|
||
}
|
||
if (fromJsonBean2.getData().getHonorlist().size()>3){
|
||
tv_nick_name4.setVisibility(View.VISIBLE);
|
||
tv_nick_name4.setText(fromJsonBean2.getData().getHonorlist().get(3).getNick_name());
|
||
}
|
||
}
|
||
|
||
dialog.show();
|
||
dialog.getWindow().setContentView(layout);
|
||
v_close.setOnClickListener(new OnClickListener() {
|
||
@Override
|
||
public void onClick(View v) {
|
||
dialog.dismiss();
|
||
}
|
||
});
|
||
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
}
|