1897 lines
67 KiB
Java
1897 lines
67 KiB
Java
package cn.shangyu.gdxzExpert.activity;
|
||
|
||
import android.app.Activity;
|
||
import android.content.Context;
|
||
import android.content.DialogInterface;
|
||
import android.content.Intent;
|
||
import android.database.Cursor;
|
||
import android.database.sqlite.SQLiteDatabase;
|
||
import android.graphics.Bitmap;
|
||
import android.graphics.drawable.ColorDrawable;
|
||
import android.os.AsyncTask;
|
||
import android.text.InputType;
|
||
import android.text.TextUtils;
|
||
import android.util.Log;
|
||
import android.view.Gravity;
|
||
import android.view.View;
|
||
import android.view.View.OnClickListener;
|
||
import android.view.ViewGroup;
|
||
import android.view.ViewGroup.LayoutParams;
|
||
import android.view.inputmethod.InputMethodManager;
|
||
import android.widget.AdapterView;
|
||
import android.widget.AdapterView.OnItemClickListener;
|
||
import android.widget.BaseAdapter;
|
||
import android.widget.Button;
|
||
import android.widget.CheckBox;
|
||
import android.widget.EditText;
|
||
import android.widget.GridView;
|
||
import android.widget.ImageView;
|
||
import android.widget.LinearLayout;
|
||
import android.widget.PopupWindow;
|
||
import android.widget.TextView;
|
||
|
||
import com.gyf.immersionbar.ImmersionBar;
|
||
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.nostra13.universalimageloader.core.ImageLoader;
|
||
import com.nostra13.universalimageloader.core.download.ImageDownloader.Scheme;
|
||
import com.nostra13.universalimageloader.core.listener.SimpleImageLoadingListener;
|
||
|
||
import java.util.ArrayList;
|
||
import java.util.HashMap;
|
||
import java.util.List;
|
||
|
||
import cn.shangyu.gdxzExpert.R;
|
||
import cn.shangyu.gdxzExpert.base.BaseActivity;
|
||
import cn.shangyu.gdxzExpert.bean.BaseBean;
|
||
import cn.shangyu.gdxzExpert.bean.City;
|
||
import cn.shangyu.gdxzExpert.bean.GetHospitalListBean;
|
||
import cn.shangyu.gdxzExpert.bean.GetListBean;
|
||
import cn.shangyu.gdxzExpert.bean.GetListBean.ListData;
|
||
import cn.shangyu.gdxzExpert.bean.SettingInfoBean;
|
||
import cn.shangyu.gdxzExpert.bean.SettingInfoBean.SpecialData;
|
||
import cn.shangyu.gdxzExpert.http.HttpHelper;
|
||
import cn.shangyu.gdxzExpert.utils.Base64Util;
|
||
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.SQLdm;
|
||
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.Url;
|
||
import cn.shangyu.gdxzExpert.widge.pickerview.EditPopupWindow;
|
||
import cn.shangyu.gdxzExpert.widge.pickerview.EditPopupWindow.SubmitListener;
|
||
import cn.shangyu.gdxzExpert.widge.pickerview.OptionsPopupWindow;
|
||
import cn.shangyu.gdxzExpert.widge.pickerview.lib.OnWheelChangedListener;
|
||
import cn.shangyu.gdxzExpert.widge.pickerview.lib.WheelView;
|
||
import cn.shangyu.gdxzExpert.widget.ECAlertDialog;
|
||
import cn.shangyu.gdxzExpert.widget.LoadingPage.ResultState;
|
||
|
||
/**
|
||
*
|
||
* @author ssy
|
||
* @date 2015-8-31 下午2:47:47 Copyright (C) 2015 河南商宇科技有限公司
|
||
*
|
||
* 功能说明:登陆后需要完善资料审核页面
|
||
*/
|
||
public class LoginSetInfoActivity extends BaseActivity implements
|
||
OnItemClickListener {
|
||
|
||
private Button submit_myinfo;
|
||
private Button btn_skip_info;
|
||
private TextView tv_showCheckInfo;
|
||
private ImageView upload_certificateImg;
|
||
private static final int TO_SELECT_PHOTO = 3;
|
||
private static final int TO_SELECT_PHOTO1 = 1;
|
||
private static final String NEXT_PAGE = "-99";
|
||
private String picBase64 = "";
|
||
public static String hospitalListUrl = Url.gethospitalList;// 医院列表
|
||
public static String getHospitalByCountyID = Url.getHospitalByCountyID;// 医院列表
|
||
public static String officeListUrl = Url.getofficeList;// 科室列表
|
||
public static String positionListUrl = Url.getpositionList;// 职称列表
|
||
public static String diseaseUrl = Url.getdisease;// 专长列表
|
||
public static String modifyUrl = Url.getmodify;// 修改个人资料
|
||
// public static String modifyUrl = "http://192.168.100.20:8080/app/expert/modify";// 修改个人资料
|
||
private String hospitalUuid = "";
|
||
private String officeUuid = "";
|
||
private String positionUuid = "";
|
||
private String uuid;
|
||
private int state = 0;
|
||
private String name = "";
|
||
private int sex = 0;
|
||
private String hospitalName = "";
|
||
private String officeName = "";
|
||
private String positionName = "";
|
||
private String zgnumber = "";
|
||
private String content = "正在加载";
|
||
private GridView gv_disease;
|
||
private MyAdapter adapter;
|
||
private String disease = "";
|
||
private String etHospitalName;
|
||
private String etOfficeName;
|
||
private String etProfessionalName;
|
||
private String officePhone;
|
||
private ImageView my_photo;
|
||
private String picBase641 = "";
|
||
private ArrayList<City> provinceList;
|
||
private SQLiteDatabase db;
|
||
private String provinceId = "";// 省ID
|
||
private String cityId = "";
|
||
private String disctictId = "";
|
||
private boolean choosehos =false;
|
||
private TextView my_hospital;
|
||
private EditText my_office_phone;
|
||
private TextView my_professional;
|
||
private EditText my_zgzs_number;
|
||
private TextView my_disease;
|
||
private EditText my_name;
|
||
private TextView my_sex;
|
||
private TextView my_office_name;
|
||
private int checkNum = 0; // 记录选中的条目数量
|
||
private ECAlertDialog buildAlert;
|
||
private String[] specialPosintions;
|
||
private OptionsPopupWindow pwSexOptions;
|
||
private ArrayList<String> optionsSexItems = new ArrayList<String>();
|
||
private ArrayList<String> officeListItems = new ArrayList<String>();
|
||
private ArrayList<String> professionalListItems = new ArrayList<String>();
|
||
private ArrayList<String> hospitalListItems = new ArrayList<String>();
|
||
private ArrayList<String> officeListUuidItems = new ArrayList<String>();
|
||
private ArrayList<String> professionalUuidListItems = new ArrayList<String>();
|
||
private ArrayList<String> hospitalListUuidItems = new ArrayList<String>();
|
||
private List<ListData> diseaseList = new ArrayList<ListData>();
|
||
private EditPopupWindow editPw;
|
||
private OptionsPopupWindow pwOptions;
|
||
private PopupWindow popGridView;
|
||
private String lon = "116.3";
|
||
private String lat = "39.9";
|
||
private int page = 1;
|
||
private String userName;
|
||
|
||
private LinearLayout ll_my_name, ll_my_sex, ll_my_hospital,
|
||
ll_my_office_name, ll_my_office_phone, ll_my_professional,
|
||
ll_my_zgzs_number, ll_upload_certificateImg, ll_my_disease,ll_my_photo;
|
||
private String mobile;
|
||
|
||
@Override
|
||
public void setTitle() {
|
||
top_title.setText("完善个人资料");
|
||
top_right_text.setText("保存");
|
||
top_right_text.setOnClickListener(this);
|
||
top_right_text.setVisibility(View.VISIBLE);
|
||
top_back_layout.setVisibility(View.VISIBLE);
|
||
}
|
||
|
||
@Override
|
||
public View onCreateSuccessedView() {
|
||
ImmersionBar.with(this).keyboardEnable(true).statusBarDarkFont(true).titleBar(mToolbar).init();
|
||
View view = UIUtils.inflate(R.layout.activity_setting_information);
|
||
|
||
my_photo = view.findViewById(R.id.my_photo);// 头像
|
||
|
||
ll_my_name = (LinearLayout) view.findViewById(R.id.ll_my_name);// 姓名
|
||
my_name = (EditText) view.findViewById(R.id.my_name);// 姓名
|
||
|
||
ll_my_sex = (LinearLayout) view.findViewById(R.id.ll_my_sex);// sex
|
||
my_sex = (TextView) view.findViewById(R.id.my_sex);// sex
|
||
|
||
ll_my_hospital = (LinearLayout) view.findViewById(R.id.ll_my_hospital);// 医院
|
||
my_hospital = (TextView) view.findViewById(R.id.my_hospital);// 医院名称
|
||
ll_my_photo=(LinearLayout) view.findViewById(R.id.ll_my_photo);
|
||
ll_my_office_name = (LinearLayout) view
|
||
.findViewById(R.id.ll_my_office_name);// 工作室
|
||
my_office_name = (TextView) view.findViewById(R.id.my_office_name);// 工作室名称
|
||
|
||
ll_my_office_phone = (LinearLayout) view
|
||
.findViewById(R.id.ll_my_office_phone);// 工作室电话
|
||
my_office_phone = (EditText) view.findViewById(R.id.my_office_phone);// 工作室
|
||
|
||
ll_my_professional = (LinearLayout) view
|
||
.findViewById(R.id.ll_my_professional);// 职业职称
|
||
my_professional = (TextView) view.findViewById(R.id.my_professional);// 职业职称
|
||
|
||
ll_my_zgzs_number = (LinearLayout) view
|
||
.findViewById(R.id.ll_my_zgzs_number);// 医师资格证号码
|
||
my_zgzs_number = (EditText) view.findViewById(R.id.my_zgzs_number);// 医师资格证号码
|
||
|
||
ll_upload_certificateImg = (LinearLayout) view
|
||
.findViewById(R.id.ll_upload_certificateImg);// 医师资格证图片
|
||
upload_certificateImg = (ImageView) view
|
||
.findViewById(R.id.upload_certificateImg);// 医师资格证图片
|
||
|
||
ll_my_disease = (LinearLayout) view.findViewById(R.id.ll_my_disease);// 专长
|
||
my_disease = (TextView) view.findViewById(R.id.my_disease);// 专长
|
||
|
||
submit_myinfo = (Button) view.findViewById(R.id.submit_myinfo);// 提交
|
||
btn_skip_info = (Button) view.findViewById(R.id.btn_skip_info);// 跳过
|
||
if (btn_skip_info != null) {
|
||
btn_skip_info.setOnClickListener(this);
|
||
}
|
||
tv_showCheckInfo = (TextView) view.findViewById(R.id.tv_showCheckInfo);// 回显审核状态
|
||
|
||
// my_photo.setOnClickListener(this);
|
||
ll_my_name.setOnClickListener(this);
|
||
ll_my_sex.setOnClickListener(this);
|
||
ll_my_hospital.setOnClickListener(this);
|
||
ll_my_office_name.setOnClickListener(this);
|
||
ll_my_office_phone.setOnClickListener(this);
|
||
ll_my_professional.setOnClickListener(this);
|
||
ll_my_zgzs_number.setOnClickListener(this);
|
||
ll_upload_certificateImg.setOnClickListener(this);
|
||
ll_my_disease.setOnClickListener(this);
|
||
submit_myinfo.setOnClickListener(this);
|
||
ll_my_photo.setOnClickListener(this);
|
||
// initListView();
|
||
|
||
showProgressDialog("正在加载");
|
||
|
||
initView();
|
||
|
||
initData();
|
||
Log.e("LoginTAG", "photo "+Url.urlHtml + photo);
|
||
return view;
|
||
}
|
||
|
||
String certificateImg;
|
||
String photo;
|
||
|
||
private void initData() {
|
||
|
||
uuid = SharePrefUtil.getString(ct, Constant.uuid, "");
|
||
|
||
// 取出我的uuid
|
||
uuid = SharePrefUtil.getString(ct, Constant.uuid, "");
|
||
// 取出上一次提交后,后台返回的信息
|
||
mobile = SharePrefUtil.getString(ct, Constant.mobile, "");
|
||
name = SharePrefUtil.getString(ct, Constant.realName, "");
|
||
sex = SharePrefUtil.getInt(ct, "sex", 0);
|
||
hospitalUuid = SharePrefUtil.getString(ct, "hospitalUuid", "");
|
||
hospitalName = SharePrefUtil.getString(ct, "hospitalName", "");
|
||
officeUuid = SharePrefUtil.getString(ct, "officeUuid", "");
|
||
officeName = SharePrefUtil.getString(ct, "officeName", "");
|
||
officePhone = SharePrefUtil.getString(ct, "officePhone", "");
|
||
positionUuid = SharePrefUtil.getString(ct, "positionUuid", "");
|
||
positionName = SharePrefUtil.getString(ct, "positionName", "");
|
||
zgnumber = SharePrefUtil.getString(ct, "certificate", "");
|
||
|
||
cityId = SharePrefUtil.getString(ct, "cityId", "");
|
||
disctictId = SharePrefUtil.getString(ct, "countyId", "");
|
||
provinceId = SharePrefUtil.getString(ct, "provId", "");
|
||
|
||
certificateImg = SharePrefUtil.getString(ct, "certificateImg", "");
|
||
photo = SharePrefUtil.getString(ct, "photo", null);
|
||
|
||
// 回显数据
|
||
if (!TextUtils.isEmpty(name) && !"null".equals(name)) {
|
||
my_name.setText(name);
|
||
}
|
||
if (0 == sex) {
|
||
my_sex.setText(getResources().getString(R.string.man));
|
||
} else if (1 == sex) {
|
||
my_sex.setText(getResources().getString(R.string.women));
|
||
}
|
||
pwSexOptions.setSelectOptions(sex);
|
||
if (!TextUtils.isEmpty(photo) && !"null".equals(photo)) {
|
||
// ImageLoader.getInstance().displayImage(Url.urlHtml +
|
||
// photo,my_photo);
|
||
// bm转换为base64位编码
|
||
ImageLoader.getInstance().loadImage(Url.urlHtml + photo,
|
||
new SimpleImageLoadingListener() {
|
||
|
||
@Override
|
||
public void onLoadingComplete(String imageUri,
|
||
View view, Bitmap loadedImage) {
|
||
super.onLoadingComplete(imageUri, view, loadedImage);
|
||
ImageLoader.getInstance().displayImage(imageUri,
|
||
my_photo);
|
||
picBase641 = Base64Util.BitmaptoBase64(loadedImage);
|
||
LogUtil.i("picBase64touxiang====" + picBase641);
|
||
}
|
||
});
|
||
|
||
}
|
||
else
|
||
{
|
||
//去掉默认头像
|
||
|
||
// ImageLoader.getInstance().loadImage(Url.urlHtml + "images/default_photo.png",
|
||
// new SimpleImageLoadingListener() {
|
||
//
|
||
// @Override
|
||
// public void onLoadingComplete(String imageUri,
|
||
// View view, Bitmap loadedImage) {
|
||
// super.onLoadingComplete(imageUri, view, loadedImage);
|
||
// ImageLoader.getInstance().displayImage(imageUri,
|
||
// my_photo);
|
||
// picBase641 = Base64Util.BitmaptoBase64(loadedImage);
|
||
// LogUtil.i("picBase64touxiang====" + picBase641);
|
||
// }
|
||
// });
|
||
// Log.e("LoginTAG", "photo "+Url.urlHtml + photo);
|
||
}
|
||
if (!TextUtils.isEmpty(hospitalName) && !"null".equals(hospitalName)) {
|
||
|
||
my_hospital.setText(hospitalName);
|
||
}
|
||
if (!TextUtils.isEmpty(officeName) && !"null".equals(officeName)) {
|
||
|
||
my_office_name.setText(officeName);
|
||
}
|
||
if (!TextUtils.isEmpty(officePhone) && !"null".equals(officePhone)) {
|
||
|
||
my_office_phone.setText(officePhone);
|
||
}
|
||
if (!TextUtils.isEmpty(positionName) && !"null".equals(positionName)) {
|
||
|
||
my_professional.setText(positionName);
|
||
}
|
||
if (!TextUtils.isEmpty(zgnumber) && !"null".equals(zgnumber)) {
|
||
|
||
my_zgzs_number.setText(zgnumber);
|
||
}
|
||
if (!TextUtils.isEmpty(certificateImg)
|
||
&& !"null".equals(certificateImg)) {
|
||
// ImageLoader.getInstance().displayImage(Url.urlHtml +
|
||
// certificateImg, upload_certificateImg);
|
||
|
||
// bm转换为base64位编码
|
||
ImageLoader.getInstance().loadImage(Url.urlHtml + certificateImg,
|
||
new SimpleImageLoadingListener() {
|
||
|
||
@Override
|
||
public void onLoadingComplete(String imageUri,
|
||
View view, Bitmap loadedImage) {
|
||
super.onLoadingComplete(imageUri, view, loadedImage);
|
||
ImageLoader.getInstance().displayImage(imageUri,
|
||
upload_certificateImg);
|
||
picBase64 = Base64Util.BitmaptoBase64(loadedImage);
|
||
}
|
||
});
|
||
}
|
||
// 取出缓存中保存的专长
|
||
String r = SharePrefUtil.getString(ct, modifyUrl, "");
|
||
if (!TextUtils.isEmpty(r)) {
|
||
SettingInfoBean bean = GsonTools.fromGsonToBean(r,
|
||
SettingInfoBean.class);
|
||
// InfoData data = bean.data;
|
||
List<SpecialData> special = bean.special;// 专长
|
||
if (special != null && special.size() > 0) {
|
||
specialPosintions = new String[special.size()];
|
||
String diseaseName = "";
|
||
for (int i = 0; i < special.size(); i++) {
|
||
String diseaseUuid = special.get(i).diseaseUuid;
|
||
specialPosintions[i] = diseaseUuid;
|
||
disease += special.get(i).diseaseUuid + ",";// 专长uuid
|
||
diseaseName += special.get(i).diseaseName + "、";// 专长名字
|
||
LogUtil.i("diseaseUuid===" + diseaseUuid + "diseaseName==="+ diseaseName);
|
||
checkNum = special.size();
|
||
}
|
||
// 去掉最后一个“、”
|
||
if (!TextUtils.isEmpty(diseaseName) && diseaseName.length() > 0) {
|
||
diseaseName = diseaseName.substring(0,diseaseName.length() - 1).replace("(甲、乙、丙、丁、戊肝)","");
|
||
my_disease.setText(diseaseName);
|
||
}
|
||
}
|
||
}
|
||
|
||
// 获取审核状态值
|
||
Intent intent = getIntent();
|
||
// ( 1.待审核 2.审核中 3.需要补充修改资料 4.再次提交审核 5.拒绝
|
||
// 6.已通过)//修改,0,1,3,4,5需要提交资料,6是通过,2其他不允许提交
|
||
state = intent.getIntExtra("state", SharePrefUtil.getInt(ct, "state", 0));
|
||
String checkInfo = intent.getStringExtra("checkInfo");
|
||
if (TextUtils.isEmpty(checkInfo)) {
|
||
checkInfo = SharePrefUtil.getString(ct, "checkInfo", "");
|
||
}
|
||
userName = intent.getStringExtra("phone");
|
||
LogUtil.i("审核信息==" + state);
|
||
applyStateUI(state, checkInfo);
|
||
|
||
// 向服务端同步最新审核状态(防止用户在已登录状态下后台已完成审核但本地 state 未更新)
|
||
UIUtils.refreshDoctorStateIfNeeded(ct, new UIUtils.OnDoctorStateRefreshListener() {
|
||
@Override
|
||
public void onStateRefreshed(int newState, String newCheckInfo) {
|
||
if (isFinishing() || newState <= 0 || newState == state) {
|
||
return;
|
||
}
|
||
state = newState;
|
||
applyStateUI(newState, newCheckInfo);
|
||
}
|
||
});
|
||
|
||
// showAlertTips(tv_showCheckInfo.getText().toString());
|
||
|
||
// 下面是获取列表
|
||
// getList(hospitalListUrl);// 获取医院列表
|
||
getList(officeListUrl);// 获取科室列表
|
||
getList(positionListUrl);// 获取职称列表
|
||
getList(diseaseUrl);// 获取专长
|
||
|
||
// 取出定位的数据
|
||
lon = SharePrefUtil.getString(ct, Constant.LON, "116.3");
|
||
lat = SharePrefUtil.getString(ct, Constant.LAT, "39.9");
|
||
String province = SharePrefUtil.getString(ct, Constant.PROVINCE, "北京市");
|
||
String city = SharePrefUtil.getString(ct, Constant.CITY, "北京市");
|
||
String district = SharePrefUtil.getString(ct, Constant.DISTRICT, "东城区");
|
||
LogUtil.i("lon=" + lon + "lat=" + lat + "province=" + province
|
||
+ "city=" + city + "district=" + district);
|
||
// 设置默认选中城市
|
||
setSelectedCity(province, city, district);
|
||
// 执行检出城市
|
||
new InitAreaTask().execute();
|
||
|
||
}
|
||
|
||
/**
|
||
* 根据审核状态更新界面展示与可编辑状态
|
||
*/
|
||
private void applyStateUI(int currentState, String checkInfo) {
|
||
if (11 == currentState || 10 == currentState || 9 == currentState) {// hcp登陆可编辑
|
||
tv_showCheckInfo.setVisibility(View.GONE);
|
||
tv_showCheckInfo.setText("请完善资料");
|
||
submit_myinfo.setVisibility(View.VISIBLE);
|
||
setInfoClick(true);
|
||
submit_myinfo.setVisibility(View.VISIBLE);
|
||
submit_myinfo.setEnabled(true);
|
||
} else if (0 == currentState || 1 == currentState) {// 0,3,5需要提交资料
|
||
tv_showCheckInfo.setVisibility(View.GONE);
|
||
tv_showCheckInfo.setText("请完善资料");
|
||
submit_myinfo.setVisibility(View.VISIBLE);
|
||
setInfoClick(true);
|
||
submit_myinfo.setVisibility(View.VISIBLE);
|
||
submit_myinfo.setEnabled(true);
|
||
// 根据不同用户名获取相应的资料
|
||
String mobile = SharePrefUtil.getString(ct,
|
||
Constant.SP_IS_FIRST_NAME, Constant.mobile, "");// 登录的手机号
|
||
get(mobile);
|
||
} else if (3 == currentState || 4 == currentState || 5 == currentState) {// 3,5需要提交资料//7
|
||
tv_showCheckInfo.setVisibility(View.VISIBLE);
|
||
String text = "您的资料未通过审核,请修改完善后重新提交。";
|
||
if (!TextUtils.isEmpty(checkInfo)) {
|
||
text = checkInfo;
|
||
}
|
||
tv_showCheckInfo.setText(text);
|
||
showAlertTips(text);
|
||
setInfoClick(true);
|
||
submit_myinfo.setVisibility(View.VISIBLE);
|
||
submit_myinfo.setEnabled(true);
|
||
} else if (6 == currentState) {// 通过
|
||
tv_showCheckInfo.setVisibility(View.VISIBLE);
|
||
tv_showCheckInfo.setText("您的资料已经通过了审核,将会自动进入应用");
|
||
setInfoClick(false);
|
||
submit_myinfo.setVisibility(View.GONE);
|
||
submit_myinfo.setEnabled(false);
|
||
SharePrefUtil.saveBoolean(ct, Constant.IS_LOGIN, true);
|
||
SharePrefUtil.saveInt(ct, "state", 6);
|
||
ToastUtil.showToast("您的资料已经通过了审核");
|
||
Intent i = new Intent(this, MainActivity.class);
|
||
i.putExtra("launcher_from", 1);
|
||
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
|
||
startActivity(i);
|
||
finish();
|
||
} else if (7 == currentState) {// 2018.12.21改,checkInfo = undefind继续追踪,暂不出现弹窗处理
|
||
setInfoClick(true);
|
||
submit_myinfo.setVisibility(View.VISIBLE);
|
||
submit_myinfo.setEnabled(true);
|
||
} else {
|
||
tv_showCheckInfo.setVisibility(View.VISIBLE);
|
||
tv_showCheckInfo.setText("肝胆相照将尽快对您的资料进行审核,请耐心等待。");
|
||
setInfoClick(false);
|
||
submit_myinfo.setVisibility(View.GONE);
|
||
submit_myinfo.setEnabled(false);
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 设置资料各项点击事件
|
||
*/
|
||
private void setInfoClick(boolean b) {
|
||
ll_my_photo.setEnabled(b);
|
||
ll_my_name.setEnabled(b);
|
||
if (my_name != null) {
|
||
my_name.setEnabled(b);
|
||
my_name.setFocusable(b);
|
||
my_name.setFocusableInTouchMode(b);
|
||
}
|
||
ll_my_sex.setEnabled(b);
|
||
ll_my_hospital.setEnabled(b);
|
||
ll_my_office_name.setEnabled(b);
|
||
ll_my_office_phone.setEnabled(b);
|
||
if (my_office_phone != null) {
|
||
my_office_phone.setEnabled(b);
|
||
my_office_phone.setFocusable(b);
|
||
my_office_phone.setFocusableInTouchMode(b);
|
||
}
|
||
ll_my_professional.setEnabled(b);
|
||
ll_my_zgzs_number.setEnabled(b);
|
||
if (my_zgzs_number != null) {
|
||
my_zgzs_number.setEnabled(b);
|
||
my_zgzs_number.setFocusable(b);
|
||
my_zgzs_number.setFocusableInTouchMode(b);
|
||
}
|
||
ll_upload_certificateImg.setEnabled(b);
|
||
ll_my_disease.setEnabled(b);
|
||
}
|
||
|
||
private void focusInlineEdit(EditText editText) {
|
||
if (editText == null || !editText.isEnabled()) {
|
||
return;
|
||
}
|
||
editText.requestFocus();
|
||
CharSequence text = editText.getText();
|
||
if (text != null) {
|
||
editText.setSelection(text.length());
|
||
}
|
||
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||
if (imm != null) {
|
||
imm.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT);
|
||
}
|
||
}
|
||
|
||
// 弹出对话框
|
||
private void showAlertTips(String message) {
|
||
buildAlert = ECAlertDialog.buildAlert(ct, message,
|
||
R.string.dialog_btn_confim,
|
||
new DialogInterface.OnClickListener() {
|
||
@Override
|
||
public void onClick(DialogInterface dialog, int which) {
|
||
if (buildAlert.isShowing()) {
|
||
buildAlert.dismiss();
|
||
}
|
||
|
||
}
|
||
});
|
||
buildAlert.setTitle(R.string.app_tip);
|
||
buildAlert.setCanceledOnTouchOutside(false);
|
||
buildAlert.show();
|
||
}
|
||
|
||
@Override
|
||
public ResultState onLoad() {
|
||
return ResultState.STATE_SUCCESSED;
|
||
|
||
}
|
||
|
||
private void initView() {
|
||
// 初始化性别弹出框
|
||
showSexPwOptions();
|
||
|
||
}
|
||
|
||
/*
|
||
* private void initListView() { listView = new ListView(this);
|
||
* listView.setBackgroundResource(R.drawable.listview_background); Drawable
|
||
* drawable = getResources().getDrawable(R.drawable.news_list_line);
|
||
* listView.setDivider(drawable); listView.setCacheColorHint(0);
|
||
* listView.setVerticalScrollBarEnabled(false); // 关闭 }
|
||
*/
|
||
|
||
// 定义 popupWindow
|
||
/*
|
||
* public void setPopupWindow(View et) { popWin = new PopupWindow(ct);
|
||
* popWin.setWidth(LayoutParams.MATCH_PARENT);// 设置宽度
|
||
* popWin.setHeight(getWindowManager().getDefaultDisplay().getHeight()/3);//
|
||
* 设置popWin 高度 popWin.setContentView(listView);// 为popWindow填充内容
|
||
* popWin.setOutsideTouchable(true);// 点击popWin 以处的区域,自动关闭 popWin //
|
||
* popWin.showAsDropDown(et, 0, -5);//设置 弹出窗口,显示的位置
|
||
* popWin.showAtLocation(et, Gravity.BOTTOM, 0, 0);//从底部弹出 }
|
||
*/
|
||
|
||
@Override
|
||
protected void processClick(View v) {
|
||
// 为了验证是不是上一个用户
|
||
String mobile = SharePrefUtil.getString(ct, Constant.SP_IS_FIRST_NAME,
|
||
Constant.mobile, "");// 手机号
|
||
switch (v.getId()) {
|
||
case R.id.ll_my_name:// 姓名
|
||
focusInlineEdit(my_name);
|
||
break;
|
||
case R.id.ll_my_sex:// 性别
|
||
hideSoftKeyboard();
|
||
pwSexOptions.showAtLocation(my_sex, Gravity.BOTTOM, 0, 0);
|
||
break;
|
||
case R.id.ll_my_hospital:// 医院
|
||
hideSoftKeyboard();
|
||
// 设置适配器
|
||
// listView.setAdapter(new MyListAdapter(my_hospital,
|
||
// hospitalList));
|
||
// // 弹出popuwindow框
|
||
// setPopupWindow(my_hospital);
|
||
// 先选择者城市再选择医院
|
||
startActivityForResult(new Intent(LoginSetInfoActivity.this,ChoosehospitalActivity.class),333);
|
||
// pwCityOptions.showAtLocation(my_hospital, Gravity.BOTTOM, 0, 0);
|
||
// showPwOptions("请选择医院", hospitalListItems, hospitalListUuidItems,
|
||
// my_hospital, 1);
|
||
break;
|
||
case R.id.ll_my_office_name:// 科室
|
||
hideSoftKeyboard();
|
||
showPwOptions("请选择科室", officeListItems, officeListUuidItems,
|
||
my_office_name, 2);
|
||
break;
|
||
case R.id.ll_my_office_phone:// 科室电话
|
||
focusInlineEdit(my_office_phone);
|
||
break;
|
||
case R.id.ll_my_professional:// 职称
|
||
hideSoftKeyboard();
|
||
showPwOptions("请选择职称", professionalListItems,
|
||
professionalUuidListItems, my_professional, 3);
|
||
break;
|
||
case R.id.ll_my_zgzs_number:// 资格证号
|
||
focusInlineEdit(my_zgzs_number);
|
||
break;
|
||
case R.id.ll_upload_certificateImg:// 资格证图片
|
||
hideSoftKeyboard();
|
||
save(mobile);
|
||
Intent intent = new Intent(ct, SelectedPhotoActivity.class);
|
||
intent.putExtra("isConstraint", true);// 是否等比例裁剪
|
||
startActivityForResult(intent, TO_SELECT_PHOTO);
|
||
// 进入退出动画
|
||
overridePendingTransition(R.anim.timepicker_anim_enter_bottom,
|
||
R.anim.timepicker_anim_exit_bottom);
|
||
break;
|
||
case R.id.ll_my_disease:// 专长
|
||
hideSoftKeyboard();
|
||
showDiseasePop(my_disease);
|
||
break;
|
||
case R.id.btn_skip_info:// 跳过
|
||
handleSkipOrBack(mobile);
|
||
break;
|
||
case R.id.submit_myinfo:// 提交
|
||
submitInfo();
|
||
break;
|
||
case R.id.ll_my_photo:// 头像
|
||
save(mobile);
|
||
Intent intent1 = new Intent(ct, SelectedPhotoActivity.class);
|
||
startActivityForResult(intent1, TO_SELECT_PHOTO1);
|
||
// 进入退出动画
|
||
overridePendingTransition(R.anim.timepicker_anim_enter_bottom,
|
||
R.anim.timepicker_anim_exit_bottom);
|
||
break;
|
||
case R.id.top_back_layout:// 返回
|
||
handleSkipOrBack(SharePrefUtil.getString(ct, Constant.SP_IS_FIRST_NAME, Constant.mobile, ""));
|
||
if (ct != null) return;
|
||
Intent Login = new Intent(ct, LoginNewActivity.class);
|
||
// 注册后跳转到登录页面
|
||
|
||
Login.putExtra("phone", userName);
|
||
Login.putExtra("flag", true);
|
||
startActivity(Login);
|
||
// android.os.Process.killProcess(android.os.Process.myPid());
|
||
this.finish();
|
||
break;
|
||
// 保存当前编辑的个人资料
|
||
case R.id.top_right_text:
|
||
save(mobile);
|
||
ToastUtil.showMessage("您输入的个人资料已经保存,请完善所有信息后提交审核");
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
private void handleSkipOrBack(String mobile) {
|
||
if (submit_myinfo != null && submit_myinfo.getVisibility() == View.VISIBLE && !StringUtil.isEmpty(mobile)) {
|
||
save(mobile);
|
||
}
|
||
cn.shangyu.gdxzExpert.base.AppManager.getAppManager().finishActivity(LoginNewActivity.class);
|
||
cn.shangyu.gdxzExpert.base.AppManager.getAppManager().finishActivity(BindNumberActivity.class);
|
||
if (MainActivity.mMainActivity == null || MainActivity.mMainActivity.isFinishing() || MainActivity.mMainActivity.isDestroyed()) {
|
||
Intent intent = new Intent(ct, MainActivity.class);
|
||
startActivity(intent);
|
||
}
|
||
this.finish();
|
||
}
|
||
|
||
// 返回键监听
|
||
@Override
|
||
public void onBackPressed() {
|
||
// TODO Auto-generated method stub
|
||
// android.os.Process.killProcess(android.os.Process.myPid());
|
||
// finish();
|
||
super.onBackPressed();
|
||
// finish();
|
||
// AppManager.getAppManager().finishAllActivity();
|
||
// android.os.Process.killProcess(android.os.Process.myPid());
|
||
handleSkipOrBack(SharePrefUtil.getString(ct, Constant.SP_IS_FIRST_NAME, Constant.mobile, ""));
|
||
if (ct != null) return;
|
||
Intent Login = new Intent(ct, LoginNewActivity.class);
|
||
// 注册后跳转到登录页面
|
||
|
||
Login.putExtra("phone", userName);
|
||
Login.putExtra("flag", true);
|
||
startActivity(Login);
|
||
// android.os.Process.killProcess(android.os.Process.myPid());
|
||
this.finish();
|
||
|
||
}
|
||
|
||
/**
|
||
* 弹出输入框 showEditPopuWindows
|
||
*
|
||
* @param parent
|
||
* @param flag
|
||
* void
|
||
*/
|
||
private void showEditPopuWindows(final View parent, final int flag) {
|
||
// if (editPw == null) {
|
||
// 选项选择器
|
||
editPw = new EditPopupWindow(ct);
|
||
// }
|
||
String text = "";
|
||
if (flag == 1) {
|
||
editPw.setInputType(InputType.TYPE_TEXT_VARIATION_PERSON_NAME);
|
||
editPw.setPopupTitle("请输入姓名");
|
||
editPw.setMaxLength(20);
|
||
if (!StringUtil.isBland(name)) {
|
||
text = name;
|
||
}
|
||
} else if (flag == 2) {
|
||
// editPw.setInputType(InputType.TYPE_CLASS_PHONE);
|
||
editPw.setPopupTitle("请输入科室电话");
|
||
if (!StringUtil.isBland(officePhone)) {
|
||
text = officePhone;
|
||
}
|
||
} else if (flag == 3) {
|
||
editPw.setInputType(InputType.TYPE_CLASS_NUMBER);
|
||
editPw.setPopupTitle("请输入职业医师资格证号码");
|
||
editPw.setMaxLength(30);
|
||
if (!StringUtil.isBland(zgnumber)) {
|
||
text = zgnumber;
|
||
}
|
||
}
|
||
editPw.showAtLocation(parent, Gravity.BOTTOM, 0, 0, text);
|
||
// 监听确定选择按钮
|
||
editPw.setSubmitListener(new SubmitListener() {
|
||
|
||
@Override
|
||
public void onSubmit(String inputText) {
|
||
if (flag == 1) {
|
||
my_name.setText(inputText);
|
||
name = inputText;
|
||
} else if (flag == 2) {
|
||
if (inputText.length() < 10) {
|
||
ToastUtil.showToast("请输入正确的科室电话");
|
||
return;
|
||
}
|
||
my_office_phone.setText(inputText);
|
||
officePhone = inputText;
|
||
} else if (flag == 3) {
|
||
my_zgzs_number.setText(inputText);
|
||
zgnumber = inputText;
|
||
}
|
||
// 得到InputMethodManager的实例
|
||
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
||
imm.hideSoftInputFromWindow(
|
||
editPw.getEtName().getWindowToken(), 0);
|
||
// ((InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE))
|
||
// .hideSoftInputFromWindow(editPw.getEtName().getWindowToken(),
|
||
// InputMethodManager.HIDE_NOT_ALWAYS);
|
||
editPw.dismiss();
|
||
}
|
||
});
|
||
}
|
||
|
||
/**
|
||
* 弹出性别pop showSexPwOptions
|
||
*
|
||
* void
|
||
*/
|
||
private void showSexPwOptions() {
|
||
if (pwSexOptions == null) {
|
||
// 选项选择器
|
||
pwSexOptions = new OptionsPopupWindow(ct);
|
||
optionsSexItems.clear();
|
||
// 选项1
|
||
optionsSexItems.add("男");
|
||
optionsSexItems.add("女");
|
||
pwSexOptions.setPopupTitle("请选择性别");
|
||
// 一级联动效果
|
||
pwSexOptions.setPicker(optionsSexItems);
|
||
// 设置选择的一级单位
|
||
// pwSexOptions.setLabels("性别");
|
||
// 设置默认选中的项目
|
||
pwSexOptions.setSelectOptions(sex);
|
||
// 监听确定选择按钮
|
||
pwSexOptions
|
||
.setOnoptionsSelectListener(new OptionsPopupWindow.OnOptionsSelectListener() {
|
||
|
||
@Override
|
||
public void onOptionsSelect(int options1, int option2,
|
||
int options3) {
|
||
String tx = optionsSexItems.get(options1);
|
||
my_sex.setText(tx);
|
||
sex = options1;
|
||
}
|
||
});
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 弹出单项选择框 void
|
||
*/
|
||
private void showPwOptions(String title,
|
||
final ArrayList<String> optionsItems,
|
||
final ArrayList<String> optionsUuidItems, final TextView tv,
|
||
final int flag) {
|
||
// 选项选择器
|
||
pwOptions = new OptionsPopupWindow(ct);
|
||
pwOptions.setPopupTitle(title);
|
||
// 一级联动
|
||
pwOptions.setPicker(optionsItems);
|
||
// 设置选择的一级单位
|
||
// pwSexOptions.setLabels("医院");
|
||
// 设置默认选中的项目
|
||
int position = 0;
|
||
if (flag == 1) {
|
||
// 医院单选
|
||
if (!StringUtil.isBland(hospitalName)) {
|
||
if (optionsItems != null && !optionsItems.isEmpty()) {
|
||
for (int i = 0, size = optionsItems.size(); i < size; i++) {
|
||
if (optionsItems.get(i).equals(hospitalName)) {
|
||
position = i;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
} else if (flag == 2) {
|
||
// 科室单选
|
||
if (!StringUtil.isBland(officeName)) {
|
||
if (optionsItems != null && !optionsItems.isEmpty()) {
|
||
for (int i = 0, size = optionsItems.size(); i < size; i++) {
|
||
if (optionsItems.get(i).equals(officeName)) {
|
||
position = i;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
} else if (flag == 3) {
|
||
// 职称单选
|
||
if (!StringUtil.isBland(positionName)) {
|
||
if (optionsItems != null && !optionsItems.isEmpty()) {
|
||
for (int i = 0, size = optionsItems.size(); i < size; i++) {
|
||
if (optionsItems.get(i).equals(positionName)) {
|
||
position = i;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
pwOptions.setSelectOptions(position);
|
||
OnWheelChangedListener changedListener = new OnWheelChangedListener() {
|
||
|
||
@Override
|
||
public void onChanged(WheelView wheel, int oldValue, int newValue) {
|
||
// TODO Auto-generated method stub
|
||
String uuid = optionsUuidItems.get(newValue);
|
||
if (NEXT_PAGE.equals(uuid)) {
|
||
content = "获取医院列表中...";
|
||
page = page + 1;
|
||
getList(getHospitalByCountyID);// 获取医院列表
|
||
pwOptions.dismiss();
|
||
}
|
||
}
|
||
};
|
||
pwOptions.setOption1ChangingListener(true, changedListener);
|
||
pwOptions.showAtLocation(tv, Gravity.BOTTOM, 0, 0);
|
||
// 监听确定选择按钮
|
||
pwOptions
|
||
.setOnoptionsSelectListener(new OptionsPopupWindow.OnOptionsSelectListener() {
|
||
|
||
@Override
|
||
public void onOptionsSelect(int options1, int option2,
|
||
int options3) {
|
||
String tx = optionsItems.get(options1);
|
||
String uuid = optionsUuidItems.get(options1);
|
||
// 判断是否是下一页
|
||
if (NEXT_PAGE.equals(uuid)) {
|
||
content = "获取医院列表中...";
|
||
page = page + 1;
|
||
getList(getHospitalByCountyID);// 获取医院列表
|
||
} else {
|
||
// 回显数据
|
||
tv.setText(tx);
|
||
if (flag == 1) {
|
||
hospitalUuid = uuid;
|
||
hospitalName = tx;
|
||
choosehos=true;
|
||
SharePrefUtil.saveString(ct, "provId", provinceId);// 省id
|
||
SharePrefUtil.saveString(ct, "cityId", cityId);// 市id
|
||
SharePrefUtil.saveString(ct, "countyId", disctictId);// 区县id
|
||
|
||
} else if (flag == 2) {
|
||
officeUuid = uuid;
|
||
officeName = tx;
|
||
} else if (flag == 3) {
|
||
positionUuid = uuid;
|
||
positionName = tx;
|
||
}
|
||
LogUtil.i("tx==" + tx + "uuid=" + uuid);
|
||
}
|
||
}
|
||
});
|
||
}
|
||
|
||
// 省市区list
|
||
private ArrayList<String> province = new ArrayList<String>();
|
||
private ArrayList<ArrayList<String>> city = new ArrayList<ArrayList<String>>();
|
||
private ArrayList<ArrayList<ArrayList<String>>> county = new ArrayList<ArrayList<ArrayList<String>>>();
|
||
private ArrayList<ArrayList<City>> cityIdList = new ArrayList<ArrayList<City>>();
|
||
private ArrayList<ArrayList<ArrayList<City>>> countyIdList = new ArrayList<ArrayList<ArrayList<City>>>();
|
||
private OptionsPopupWindow pwCityOptions;
|
||
|
||
/**
|
||
* 弹出城市三级联动选择框 void
|
||
*/
|
||
private void showCityPwOptions() {
|
||
|
||
// 选项选择器
|
||
pwCityOptions = new OptionsPopupWindow(ct);
|
||
// 设置标题
|
||
pwCityOptions.setPopupTitle("请选择城市");
|
||
// 设置确定按钮为下一步
|
||
pwCityOptions.setSubmitTitle("下一步");
|
||
// 一级联动
|
||
pwCityOptions.setPicker(province, city, county, true);
|
||
// 设置选择的三级单位
|
||
// pwCityOptions.setLabels("省", "市", "区");
|
||
// 设置弹出方式为底部
|
||
// View parent = getWindow().getDecorView();
|
||
// pwCityOptions.showAtLocation(parent, Gravity.BOTTOM, 0, 0);
|
||
|
||
// 根据定位的数据取出相应位置
|
||
int currentProvinceIndex = 0, currentCityIndex = 0, currentCountyIndex = 0;
|
||
if (!TextUtils.isEmpty(currentProvince)
|
||
&& !TextUtils.isEmpty(currentCity)
|
||
&& !TextUtils.isEmpty(currentCounty)) {
|
||
for (int i = 0; i < province.size(); i++) {
|
||
if (province.get(i).contains(currentProvince)) {
|
||
currentProvinceIndex = i;
|
||
ArrayList<String> iCity = city.get(i);
|
||
for (int j = 0; j < iCity.size(); j++) {
|
||
if (iCity.get(j).contains(currentCity)) {
|
||
currentCityIndex = j;
|
||
ArrayList<String> jCounty = county.get(i).get(j);
|
||
for (int k = 0; k < jCounty.size(); k++) {
|
||
if (jCounty.get(k).contains(currentCounty)) {
|
||
currentCountyIndex = k;
|
||
break;
|
||
}
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
// 设置默认选中的项目
|
||
pwCityOptions.setSelectOptions(currentProvinceIndex, currentCityIndex,
|
||
currentCountyIndex);
|
||
// 监听确定选择按钮
|
||
pwCityOptions.setOnoptionsSelectListener(new OptionsPopupWindow.OnOptionsSelectListener() {
|
||
|
||
@Override
|
||
public void onOptionsSelect(int options1, int option2,
|
||
int options3) {
|
||
|
||
// 返回的分别是三个级别的选中位置
|
||
String tx1 = province.get(options1);
|
||
String tx2 = city.get(options1).get(option2);
|
||
String tx3 = county.get(options1).get(option2)
|
||
.get(options3);
|
||
String tx = tx1;
|
||
if (!TextUtils.isEmpty(tx2)) {
|
||
tx = tx + tx2;
|
||
}
|
||
if (!TextUtils.isEmpty(tx3)) {
|
||
tx = tx + tx3;
|
||
}
|
||
choosehos=false;
|
||
// 选择 的省市区id
|
||
provinceId = provinceList.get(options1).get_id();
|
||
cityId = cityIdList.get(options1).get(option2).get_id();
|
||
disctictId = countyIdList.get(options1).get(option2)
|
||
.get(options3).get_id();
|
||
|
||
LogUtil.i("选择的为。。" + tx + "provinceId=" + provinceId
|
||
+ "cityId=" + cityId + "disctictId="
|
||
+ disctictId);
|
||
|
||
content = "获取医院中...";
|
||
page = 1;
|
||
getList(getHospitalByCountyID);// 获取医院列表
|
||
}
|
||
});
|
||
|
||
}
|
||
|
||
private String currentProvince, currentCity, currentCounty;
|
||
private String my_imageUrl;
|
||
private String my_imageUrl2;
|
||
|
||
/**
|
||
* 设置默认选中的位置,这个为定位的地方,如果定位失败就选中0位置 setSelectedCity
|
||
*
|
||
* @param province
|
||
* @param city
|
||
* @param county
|
||
* void
|
||
*/
|
||
public void setSelectedCity(String province, String city, String county) {
|
||
this.currentProvince = province;
|
||
this.currentCity = city;
|
||
this.currentCounty = county;
|
||
}
|
||
|
||
/** 显示进度框 **/
|
||
private void showProDialog(String content) {
|
||
showProgressDialog(content);
|
||
}
|
||
|
||
/**
|
||
* 提交 submitInfo
|
||
*
|
||
* void
|
||
*/
|
||
private void submitInfo() {
|
||
name = my_name.getText().toString().trim();
|
||
String sextv = my_sex.getText().toString().trim();
|
||
etHospitalName = my_hospital.getText().toString().trim();
|
||
etOfficeName = my_office_name.getText().toString().trim();
|
||
officePhone = my_office_phone.getText().toString().trim();
|
||
etProfessionalName = my_professional.getText().toString().trim();
|
||
zgnumber = my_zgzs_number.getText().toString().trim();
|
||
|
||
// getCheck();
|
||
// 验证数据
|
||
if (TextUtils.isEmpty(picBase641)) {
|
||
ToastUtil.showToast("请选择头像");
|
||
return;
|
||
}
|
||
if (TextUtils.isEmpty(name)) {
|
||
ToastUtil.showToast("姓名不为空");
|
||
return;
|
||
}
|
||
if (TextUtils.isEmpty(sextv)) {
|
||
ToastUtil.showToast("请选择性别");
|
||
return;
|
||
}
|
||
if (TextUtils.isEmpty(etHospitalName)) {
|
||
ToastUtil.showToast("医院不为空");
|
||
return;
|
||
}
|
||
if (TextUtils.isEmpty(hospitalUuid)) {
|
||
ToastUtil.showToast("医院不为空");
|
||
return;
|
||
}
|
||
if (TextUtils.isEmpty(etOfficeName)) {
|
||
ToastUtil.showToast("科室不为空");
|
||
return;
|
||
}
|
||
if (TextUtils.isEmpty(officeUuid)) {
|
||
ToastUtil.showToast("科室不为空");
|
||
return;
|
||
}
|
||
if (TextUtils.isEmpty(officePhone)) {
|
||
ToastUtil.showToast("科室电话不为空");
|
||
return;
|
||
}
|
||
if (officePhone.equals("请输入科室电话") || officePhone.length() < 10) {
|
||
ToastUtil.showToast("请输入正确的科室电话");
|
||
return;
|
||
}
|
||
if (TextUtils.isEmpty(etProfessionalName)) {
|
||
ToastUtil.showToast("职称不为空");
|
||
return;
|
||
}
|
||
if (TextUtils.isEmpty(positionUuid)) {
|
||
ToastUtil.showToast("职称不为空");
|
||
return;
|
||
}
|
||
if (TextUtils.isEmpty(zgnumber)) {
|
||
ToastUtil.showToast("执业医师资格证号码不为空");
|
||
return;
|
||
}
|
||
if (TextUtils.isEmpty(picBase64)) {
|
||
ToastUtil.showToast("请选择执业医师资格证照片");
|
||
return;
|
||
}
|
||
if (TextUtils.isEmpty(disease)) {
|
||
ToastUtil.showToast("请选择专长");
|
||
return;
|
||
}
|
||
hospitalName = etHospitalName;
|
||
officeName = etOfficeName;
|
||
positionName = etProfessionalName;
|
||
// 下面是验证是否是手输入的还是选择的,手输入的uuid都为1
|
||
/*
|
||
* if (!etHospitalName.equals(hospitalName)) { hospitalName =
|
||
* etHospitalName; hospitalUuid = "1"; } if
|
||
* (!etOfficeName.equals(officeName)) { officeName = etOfficeName;
|
||
* officeUuid = "1"; } if (!etProfessionalName.equals(positionName)) {
|
||
* positionName = etProfessionalName; positionUuid = "1"; }
|
||
*/
|
||
content = "提交资料中...";
|
||
getList(modifyUrl);
|
||
}
|
||
|
||
private void save(String username) {
|
||
// TODO Auto-generated method stub
|
||
SharePrefUtil.saveString(ct, username + "my_name", my_name.getText()
|
||
.toString().trim()); // 姓名
|
||
SharePrefUtil.saveString(ct, username + "my_sex", my_sex.getText()
|
||
.toString().trim()); // 性别名字
|
||
SharePrefUtil.saveInt(ct, username + "my_sex_int", sex);// 性别
|
||
// SharePrefUtil.saveString(ct, username + "my_hospital", my_hospital
|
||
// .getText().toString().trim()); // 医院
|
||
SharePrefUtil
|
||
.saveString(ct, username + "my_hospitalUuid", hospitalUuid); // 医院uuid
|
||
SharePrefUtil.saveString(ct, username + "my_office_name",
|
||
my_office_name.getText().toString().trim()); // 工作室
|
||
SharePrefUtil.saveString(ct, username + "my_officeUuid", officeUuid); // 工作室uuid
|
||
SharePrefUtil.saveString(ct, username + "my_office_phone",
|
||
my_office_phone.getText().toString().trim());// 工作室电话
|
||
SharePrefUtil.saveString(ct, username + "my_professional",
|
||
my_professional.getText().toString().trim());// 职业职称
|
||
SharePrefUtil
|
||
.saveString(ct, username + "my_positionUuid", positionUuid);// 职业职称uuid
|
||
SharePrefUtil.saveString(ct, username + "my_zgzs_number",
|
||
my_zgzs_number.getText().toString().trim()); // //医师资格证号码
|
||
SharePrefUtil.saveString(ct, username + "my_diseaseName", my_disease
|
||
.getText().toString().trim()); // 专长名字
|
||
SharePrefUtil.saveString(ct, username + "disease", disease);// 专长uuid
|
||
// if(!choosehos)
|
||
// {
|
||
// cityId = SharePrefUtil.getString(ct, "cityId", "");
|
||
// disctictId = SharePrefUtil.getString(ct, "countyId", "");
|
||
// provinceId = SharePrefUtil.getString(ct, "provId", "");
|
||
// }
|
||
|
||
// SharePrefUtil.saveString(ct, username + "my_provinceId", provinceId);// 省id
|
||
// SharePrefUtil.saveString(ct, username + "my_cityId", cityId);// 市id
|
||
// SharePrefUtil.saveString(ct, username + "my_disctictId", disctictId);// 区县id
|
||
|
||
|
||
SharePrefUtil.saveString(ct, username + "my_picBase64", picBase64);// 证书64位
|
||
SharePrefUtil.saveString(ct, username + "my_picBase641", picBase641);// 头像64位
|
||
SharePrefUtil.saveString(ct, username + "my_imageUrl", my_imageUrl);// 证书
|
||
SharePrefUtil.saveString(ct, username + "my_imageUrl2", my_imageUrl2);// 头像
|
||
}
|
||
|
||
private void get(String username) {
|
||
// TODO Auto-generated method stub
|
||
name = SharePrefUtil.getString(ct, username + "my_name", ""); // 姓名
|
||
SharePrefUtil.getString(ct, username + "my_sex", ""); // 性别名字
|
||
sex = SharePrefUtil.getInt(ct, username + "my_sex_int", 0);// 性别
|
||
// hospitalName = SharePrefUtil
|
||
// .getString(ct, username + "my_hospital", ""); // 医院
|
||
hospitalUuid = SharePrefUtil.getString(ct,
|
||
username + "my_hospitalUuid", ""); // 医院uuid
|
||
officeName = SharePrefUtil.getString(ct, username + "my_office_name",
|
||
""); // 工作室
|
||
officeUuid = SharePrefUtil
|
||
.getString(ct, username + "my_officeUuid", ""); // 工作室uuid
|
||
officePhone = SharePrefUtil.getString(ct, username + "my_office_phone",
|
||
"");// 工作室电话
|
||
positionName = SharePrefUtil.getString(ct,
|
||
username + "my_professional", "");// 职业职称
|
||
positionUuid = SharePrefUtil.getString(ct,
|
||
username + "my_positionUuid", "");// 职业职称uuid
|
||
zgnumber = SharePrefUtil.getString(ct, username + "my_zgzs_number", ""); // //医师资格证号码
|
||
String diseaseName = SharePrefUtil.getString(ct, username
|
||
+ "my_diseaseName", ""); // 专长名字
|
||
disease = SharePrefUtil.getString(ct, username + "disease", "");// 专长uuid
|
||
|
||
// provinceId = SharePrefUtil
|
||
// .getString(ct, username + "my_provinceId", "");// 省id
|
||
// cityId = SharePrefUtil.getString(ct, username + "my_cityId", "");// 市id
|
||
// disctictId = SharePrefUtil
|
||
// .getString(ct, username + "my_disctictId", "");// 区县id
|
||
|
||
picBase64 = SharePrefUtil.getString(ct, username + "my_picBase64", "");// 证书64位
|
||
picBase641 = SharePrefUtil
|
||
.getString(ct, username + "my_picBase641", "");// 头像64位
|
||
|
||
my_imageUrl = SharePrefUtil.getString(ct, username + "my_imageUrl", "");// 证书
|
||
my_imageUrl2 = SharePrefUtil.getString(ct, username + "my_imageUrl2",
|
||
"");// 头像
|
||
|
||
// 回显数据
|
||
if (!TextUtils.isEmpty(name) && !"null".equals(name)) {
|
||
my_name.setText(name);
|
||
}
|
||
if (0 == sex) {
|
||
my_sex.setText(getResources().getString(R.string.man));
|
||
} else if (1 == sex) {
|
||
my_sex.setText(getResources().getString(R.string.women));
|
||
}
|
||
pwSexOptions.setSelectOptions(sex);
|
||
if (!TextUtils.isEmpty(my_imageUrl)) {
|
||
ImageLoader.getInstance().displayImage(my_imageUrl,
|
||
upload_certificateImg,
|
||
ImageOptions.getImageOptions(R.drawable.add_photo_normal));
|
||
}
|
||
if (!TextUtils.isEmpty(my_imageUrl2)) {
|
||
ImageLoader.getInstance().displayImage(my_imageUrl2, my_photo);
|
||
}
|
||
if (!TextUtils.isEmpty(hospitalName) && !"null".equals(hospitalName)) {
|
||
my_hospital.setText(hospitalName);
|
||
}
|
||
if (!TextUtils.isEmpty(officeName) && !"null".equals(officeName)) {
|
||
my_office_name.setText(officeName);
|
||
}
|
||
if (!TextUtils.isEmpty(officePhone) && !"null".equals(officePhone)) {
|
||
my_office_phone.setText(officePhone);
|
||
}
|
||
if (!TextUtils.isEmpty(positionName) && !"null".equals(positionName)) {
|
||
my_professional.setText(positionName);
|
||
}
|
||
if (!TextUtils.isEmpty(zgnumber) && !"null".equals(zgnumber)) {
|
||
my_zgzs_number.setText(zgnumber);
|
||
}
|
||
if (!TextUtils.isEmpty(diseaseName) && !"null".equals(diseaseName)) {
|
||
my_disease.setText(diseaseName);
|
||
}
|
||
|
||
}
|
||
|
||
/** 提交资料 **/
|
||
private void getList(final String loadUrl) {
|
||
showProDialog(content);
|
||
RequestParams params = new RequestParams();// 封装参数
|
||
if (modifyUrl.equals(loadUrl)) {
|
||
params.addBodyParameter("uuid", uuid);// 唯一标识 必填
|
||
params.addBodyParameter("realName", name);// 真实姓名
|
||
params.addBodyParameter("userName", mobile);// 用户名必填
|
||
params.addBodyParameter("diseaseUuids", disease);// 专家专长(多个专长以逗号隔开)
|
||
params.addBodyParameter("type", String.valueOf(1));// 第一次修改资料填1
|
||
// 在我的模块修改填2
|
||
params.addBodyParameter("sex", String.valueOf(sex));// 性别(0男 1女)
|
||
params.addBodyParameter("photo", picBase641);// 头像(base64)
|
||
// params.addBodyParameter("email", uuid);//邮箱
|
||
// params.addBodyParameter("mobile", uuid);//手机号
|
||
// params.addBodyParameter("birthDate", uuid);//出生日期
|
||
// params.addBodyParameter("intro", uuid);//简介
|
||
// if(!choosehos)
|
||
// {
|
||
// cityId = SharePrefUtil.getString(ct, "cityId", "");
|
||
// disctictId = SharePrefUtil.getString(ct, "countyId", "");
|
||
// provinceId = SharePrefUtil.getString(ct, "provId", "");
|
||
// }
|
||
params.addBodyParameter("provId", provinceId);// 省id
|
||
params.addBodyParameter("cityId", cityId);// 市id
|
||
params.addBodyParameter("countyId", disctictId);// 区县id
|
||
params.addBodyParameter("hospitalUuid", hospitalUuid);// 坐诊医院uuid
|
||
params.addBodyParameter("hospitalName", hospitalName);// 坐诊医院名称
|
||
params.addBodyParameter("officeUuid", officeUuid);// 科室uuid
|
||
params.addBodyParameter("officeName", officeName);// 科室名称
|
||
params.addBodyParameter("officePhone", officePhone);// 科室电话
|
||
params.addBodyParameter("positionUuid", positionUuid);// 职称uuid
|
||
params.addBodyParameter("certificate", zgnumber);// 资格证书
|
||
params.addBodyParameter("certificateImg", picBase64);// 资格证书图片
|
||
|
||
|
||
|
||
} else if (getHospitalByCountyID.equals(loadUrl)) {
|
||
|
||
params.addBodyParameter("countyID", disctictId);// 区县ID必填
|
||
params.addBodyParameter("page", String.valueOf(page));// 分页参数必填
|
||
params.addBodyParameter("searchType", String.valueOf(2));// 查询类型---1根据经纬度查询经纬度必填区县ID可以为空2查询区县ID必填经纬度可以为空
|
||
// params.addBodyParameter("lat", "");// 经度
|
||
// params.addBodyParameter("lng", "");// 纬度
|
||
|
||
LogUtil.i("countyID=" + disctictId + "lat=" + lat + "lng=" + lon
|
||
+ "searchType=" + String.valueOf(2));
|
||
} else {
|
||
params = null;
|
||
}
|
||
LogUtil.i("loadUrl = " + loadUrl);
|
||
HttpHelper.loadData(HttpMethod.POST, loadUrl, params,
|
||
new RequestCallBack<String>() {
|
||
|
||
@Override
|
||
public void onSuccess(ResponseInfo<String> info) {
|
||
if (!modifyUrl.equals(loadUrl)) {
|
||
SharePrefUtil.saveString(ct, loadUrl, info.result);
|
||
}
|
||
processData(loadUrl, info.result);
|
||
}
|
||
|
||
@Override
|
||
public void onFailure(HttpException arg0, String arg1) {
|
||
closeProgressDialog();
|
||
LogUtil.i("数据请求失败了: " + arg1);
|
||
ToastUtil.showToast("请求失败,请稍候再试。");
|
||
}
|
||
});
|
||
}
|
||
|
||
/**
|
||
* 解析并处理数据
|
||
*
|
||
* @param result
|
||
*/
|
||
private void processData(String url, String result) {
|
||
closeProgressDialog();
|
||
if (modifyUrl.equals(url)) {
|
||
BaseBean bean = GsonTools.fromGsonToBean(result, BaseBean.class);
|
||
if ("1".equals(bean.code)) {
|
||
ToastUtil.showToast("提交成功,请等待审核");
|
||
tv_showCheckInfo.setVisibility(View.VISIBLE);
|
||
tv_showCheckInfo.setText("肝胆相照将尽快对您的资料进行审核,请耐心等待。");
|
||
submit_myinfo.setEnabled(false);
|
||
submit_myinfo.setVisibility(View.GONE);
|
||
setInfoClick(false);
|
||
SharePrefUtil.saveString(ct, Constant.realName, name);// 真实姓名
|
||
SharePrefUtil.saveInt(ct, "state", 2);// 审核中
|
||
} else {
|
||
ToastUtil.showToast("提交失败,请重试" + bean.message);
|
||
}
|
||
return;
|
||
} else if (getHospitalByCountyID.equals(url)) {// 根据区id查询的医院列表
|
||
GetHospitalListBean bean = GsonTools.fromGsonToBean(result,
|
||
GetHospitalListBean.class);
|
||
hospitalListItems.clear();
|
||
hospitalListUuidItems.clear();
|
||
if (StringUtil.isOneToCode(bean.code)) {
|
||
ToastUtil.showToast("该地区暂无医院列表");
|
||
return;
|
||
}
|
||
// 数据为空
|
||
if (bean.data != null && bean.data.list.size() > 0) {
|
||
for (int i = 0; i < bean.data.list.size(); i++) {
|
||
hospitalListUuidItems.add(bean.data.list.get(i).uuid);
|
||
hospitalListItems.add(bean.data.list.get(i).name);
|
||
}
|
||
// 得到总页码数
|
||
int totalPage = bean.data.totalPage;
|
||
// 是否有下一页
|
||
if (totalPage <= 0 || totalPage <= page) {
|
||
hospitalListItems.add("其他医院");
|
||
hospitalListUuidItems.add("1");
|
||
showPwOptions("请选择医院", hospitalListItems,
|
||
hospitalListUuidItems, my_hospital, 1);
|
||
} else {
|
||
hospitalListItems.add("下一页");
|
||
hospitalListUuidItems.add(NEXT_PAGE);
|
||
showPwOptions("请选择医院", hospitalListItems,
|
||
hospitalListUuidItems, my_hospital, 1);
|
||
}
|
||
} else {
|
||
hospitalListItems.add("其他医院");
|
||
hospitalListUuidItems.add("1");
|
||
showPwOptions("请选择医院", hospitalListItems,
|
||
hospitalListUuidItems, my_hospital, 1);
|
||
// ToastUtil.showToast("该地区暂无医院列表");
|
||
}
|
||
} else {
|
||
LogUtil.i("result = "+result);
|
||
GetListBean bean = GsonTools.fromGsonToBean(result,
|
||
GetListBean.class);
|
||
|
||
// 数据为空
|
||
if (bean.data != null && bean.data.size() > 0) {
|
||
if (hospitalListUrl.equals(url)) {
|
||
// hospitalList.clear();
|
||
// hospitalList.addAll(bean.data);// 添加医院列表
|
||
hospitalListUuidItems.clear();
|
||
hospitalListItems.clear();
|
||
for (int i = 0; i < bean.data.size(); i++) {
|
||
hospitalListUuidItems.add(bean.data.get(i).uuid);
|
||
hospitalListItems.add(bean.data.get(i).name);
|
||
}
|
||
} else if (officeListUrl.equals(url)) {
|
||
officeListUuidItems.clear();
|
||
officeListItems.clear();
|
||
for (int i = 0; i < bean.data.size(); i++) {
|
||
officeListUuidItems.add(bean.data.get(i).officeUuid);
|
||
officeListItems.add(bean.data.get(i).officeName);
|
||
}
|
||
} else if (positionListUrl.equals(url)) {
|
||
professionalUuidListItems.clear();
|
||
professionalListItems.clear();
|
||
for (int i = 0; i < bean.data.size(); i++) {
|
||
professionalUuidListItems.add(bean.data.get(i).uuid);
|
||
professionalListItems.add(bean.data.get(i).name);
|
||
}
|
||
} else if (diseaseUrl.equals(url)) {
|
||
bean.data.get(0).des = "肝炎";//去除甲乙丙丁"肝炎(甲、乙、丙、丁、戊肝)",
|
||
bean.data.get(0).name = "肝炎";
|
||
diseaseList.clear();
|
||
diseaseList.addAll(bean.data);// 肝胆病标签列表
|
||
// adapter = new MyAdapter(diseaseList);
|
||
// gv_disease.setAdapter(adapter);
|
||
}
|
||
} else {
|
||
ToastUtil.showToast("获取失败,请重试");
|
||
}
|
||
}
|
||
}
|
||
|
||
// 加载城市数据,耗时操作
|
||
private class InitAreaTask extends AsyncTask<Void, Void, Boolean> {
|
||
|
||
public InitAreaTask() {
|
||
// showProgressDialog("加载中...");
|
||
}
|
||
|
||
@Override
|
||
protected synchronized Boolean doInBackground(Void... params) {
|
||
return areaData();
|
||
}
|
||
|
||
@Override
|
||
protected void onPostExecute(Boolean result) {
|
||
// closeProgressDialog();
|
||
if (result) {
|
||
// 初始化联动划框
|
||
showCityPwOptions();
|
||
} else {
|
||
ToastUtil.showToast("城市数据初始化失败");
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
/*
|
||
* 实例化城市,从数据库检出城市列表
|
||
*/
|
||
private boolean areaData() {
|
||
SQLdm s = new SQLdm();
|
||
db = s.openDatabase(this);
|
||
provinceList = new ArrayList<City>();
|
||
if (db != null) {
|
||
db.beginTransaction();
|
||
// 查询数据库中的数据
|
||
Cursor cursor = db
|
||
.rawQuery(
|
||
"select * from cn_shangyu_gdxzExpert_bean_City where parent=?",
|
||
new String[] { "0" });
|
||
|
||
while (cursor.moveToNext()) {
|
||
City cityProvince = new City();
|
||
cityProvince.set_id(cursor.getString(cursor
|
||
.getColumnIndex("_id")));
|
||
cityProvince.setName(cursor.getString(cursor
|
||
.getColumnIndex("name")));
|
||
// cityProvince.setFullName(cursor.getString(cursor.getColumnIndex("fullName")));
|
||
// cityProvince.setParent(cursor.getString(cursor.getColumnIndex("parent")));
|
||
// cityProvince.setTreePath(cursor.getString(cursor.getColumnIndex("treePath")));
|
||
provinceList.add(cityProvince);
|
||
// 省名称
|
||
this.province.add(cityProvince.getName());
|
||
// LogUtil.i("省id="+cityProvince.get_id()+"FullName="+cityProvince.getFullName());
|
||
|
||
// 市
|
||
String provinceId = cursor.getString(cursor
|
||
.getColumnIndex("_id"));
|
||
Cursor cursorCity = db
|
||
.rawQuery(
|
||
"select * from cn_shangyu_gdxzExpert_bean_City where parent=?",
|
||
new String[] { provinceId });
|
||
|
||
ArrayList<City> cityList = new ArrayList<City>();
|
||
// 储存该省的所有城市名称
|
||
ArrayList<String> cityName = new ArrayList<String>();
|
||
// 该省该市所有区名称
|
||
ArrayList<ArrayList<String>> cityDisctict = new ArrayList<ArrayList<String>>();
|
||
ArrayList<ArrayList<City>> cityDisctictId = new ArrayList<ArrayList<City>>();
|
||
while (cursorCity.moveToNext()) {
|
||
City city = new City();
|
||
city.set_id(cursorCity.getString(cursorCity
|
||
.getColumnIndex("_id")));
|
||
city.setName(cursorCity.getString(cursorCity
|
||
.getColumnIndex("name")));
|
||
// city.setFullName(cursorCity.getString(cursorCity.getColumnIndex("fullName")));
|
||
// city.setParent(cursorCity.getString(cursorCity.getColumnIndex("parent")));
|
||
// city.setTreePath(cursorCity.getString(cursorCity.getColumnIndex("treePath")));
|
||
// 城市列表
|
||
cityList.add(city);
|
||
// 城市名称
|
||
cityName.add(city.getName());
|
||
// LogUtil.i("市id="+city.get_id()+"FullName="+city.getFullName());
|
||
|
||
// 区
|
||
String cityId = cursorCity.getString(cursorCity
|
||
.getColumnIndex("_id"));
|
||
Cursor cursorDisctict = db
|
||
.rawQuery(
|
||
"select * from cn_shangyu_gdxzExpert_bean_City where parent=?",
|
||
new String[] { cityId });
|
||
|
||
ArrayList<City> disctictList = new ArrayList<City>();
|
||
// 该市的所有区名称
|
||
ArrayList<String> disctictName = new ArrayList<String>();
|
||
while (cursorDisctict.moveToNext()) {
|
||
City cityDis = new City();
|
||
cityDis.set_id(cursorDisctict.getString(cursorDisctict
|
||
.getColumnIndex("_id")));
|
||
cityDis.setName(cursorDisctict.getString(cursorDisctict
|
||
.getColumnIndex("name")));
|
||
// cityDis.setFullName(cursorDisctict.getString(cursorDisctict.getColumnIndex("fullName")));
|
||
// cityDis.setParent(cursorDisctict.getString(cursorDisctict.getColumnIndex("parent")));
|
||
// cityDis.setTreePath(cursorDisctict.getString(cursorDisctict.getColumnIndex("treePath")));
|
||
// 区id
|
||
disctictList.add(cityDis);
|
||
// 区名称
|
||
disctictName.add(cityDis.getName());
|
||
// LogUtil.i("区id="+cityDis.get_id()+"FullName="+cityDis.getFullName());
|
||
}
|
||
// 如果只有市区没有区县,为了不为空,则手动添加“”;
|
||
if (!cursorDisctict.moveToFirst()) {
|
||
disctictName.add("");
|
||
disctictList.add(city);
|
||
}
|
||
// LogUtil.i("moveToNext()="+cursorDisctict.moveToNext() +
|
||
// "moveToFirst()=" + cursorDisctict.moveToFirst());
|
||
cursorDisctict.close();
|
||
// 该城市里的所有区名称
|
||
cityDisctict.add(disctictName);
|
||
// 该城市里的所有区id
|
||
cityDisctictId.add(disctictList);
|
||
|
||
}
|
||
cursorCity.close();
|
||
// 该省的所有市id
|
||
this.cityIdList.add(cityList);
|
||
// 该省的所有市名称
|
||
this.city.add(cityName);
|
||
// 该省的该市的所有区名称
|
||
this.county.add(cityDisctict);
|
||
// 该省的该市的所有区id
|
||
this.countyIdList.add(cityDisctictId);
|
||
|
||
}
|
||
cursor.close();
|
||
db.setTransactionSuccessful(); // 设置事务处理成功,不设置会自动回滚不提交
|
||
db.endTransaction();
|
||
return true;
|
||
} else {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
/**
|
||
*
|
||
*
|
||
* 类名称:MyListAdapter 类描述: 创建人:苏三元 时间:2015-10-27 下午4:34:44
|
||
* 版权:河南商宇科技有限公司--版权所有 (c) 2015
|
||
*
|
||
*/
|
||
/*
|
||
* private class MyListAdapter extends BaseAdapter {
|
||
*
|
||
* private TextView et; private List<ListData> List; private String name =
|
||
* "";
|
||
*
|
||
* public MyListAdapter(TextView et, List<ListData> List) { this.et = et;
|
||
* this.List = List; }
|
||
*
|
||
* @Override public int getCount() { return List.size(); }
|
||
*
|
||
* @Override public Object getItem(int position) { return null; }
|
||
*
|
||
* @Override public long getItemId(int position) { return 0; }
|
||
*
|
||
* @Override public View getView(final int position, View convertView,
|
||
* ViewGroup parent) { // TextView tv_msg; // ImageView delete; // View view
|
||
* = null; ViewHolder holder; if (convertView == null) { convertView =
|
||
* View.inflate(ct, R.layout.setting_info_pop_item, null); holder = new
|
||
* ViewHolder(); holder.tv_msg = (TextView)
|
||
* convertView.findViewById(R.id.tv_list_item); // tag妙用
|
||
* convertView.setTag(holder); } else { holder = (ViewHolder)
|
||
* convertView.getTag(); }
|
||
*
|
||
* if (my_office_name.equals(et)) { name = List.get(position).officeName;//
|
||
* 科室名称 } else { name = List.get(position).name; }
|
||
* holder.tv_msg.setText(name);
|
||
*
|
||
* convertView.setOnClickListener(new OnClickListener() {
|
||
*
|
||
* @Override public void onClick(View v) { // String name1; // if
|
||
* (et_officeName.equals(et)) { // name1 =
|
||
* List.get(position).officeName;//科室名称 // }else{ // name1 =
|
||
* List.get(position).name; // } if (my_office_name.equals(et)) { officeUuid
|
||
* = List.get(position).officeUuid; officeName =
|
||
* List.get(position).officeName;// 科室名称 // 设置输入框 et.setText(officeName); }
|
||
* else if (my_hospital.equals(et)) { hospitalUuid =
|
||
* List.get(position).uuid; hospitalName = List.get(position).name; // 设置输入框
|
||
* et.setText(hospitalName); } else if (my_professional.equals(et)) {
|
||
* positionUuid = List.get(position).uuid; positionName =
|
||
* List.get(position).name; // 设置输入框 et.setText(positionName); } // 取消显示
|
||
* popWin.dismiss(); LogUtils.i("position=" + position + "=officeUuid=" +
|
||
* officeUuid + "=positionUuid=" + positionUuid + "=hospitalUuid=" +
|
||
* hospitalUuid); } }); return convertView; }
|
||
*
|
||
* private class ViewHolder { TextView tv_msg; }
|
||
*
|
||
* }
|
||
*/
|
||
|
||
/**
|
||
* 跳转之后返回的结果
|
||
*
|
||
* @param requestCode
|
||
* 表示是哪个Intent跳转的
|
||
* @param resultCode
|
||
* 返回的结果码
|
||
* @param data
|
||
* 数据
|
||
*/
|
||
@Override
|
||
protected void onActivityResult(int requestCode, int resultCode,
|
||
final Intent data) {
|
||
super.onActivityResult(requestCode, resultCode, data);
|
||
if(resultCode==333)
|
||
{
|
||
String dataname = data.getStringExtra("hospitalName");
|
||
hospitalName=dataname;
|
||
hospitalUuid=data.getStringExtra("hospitalUuid");
|
||
provinceId=data.getStringExtra("provinceId");
|
||
cityId=data.getStringExtra("cityId");
|
||
disctictId=data.getStringExtra("disctictId");
|
||
my_hospital.setText(hospitalName);
|
||
return;
|
||
}
|
||
// 证书
|
||
if (resultCode == Activity.RESULT_OK && requestCode == TO_SELECT_PHOTO) {
|
||
// imageView不设null, 第一次上传成功后,第二次在选择上传的时候会报错。
|
||
String picPath = data.getStringExtra(SelectedPhotoActivity.KEY_PHOTO_PATH);
|
||
picBase64 = data.getStringExtra(SelectedPhotoActivity.KEY_PHOTO_BASE64);
|
||
// LogUtil.i("picPath=" + picPath + "=picBase64=" + picBase64);
|
||
String imageUrl = Scheme.FILE.wrap(picPath);
|
||
LogUtil.i("imageUrl==" + imageUrl);
|
||
// Bitmap bitmap = BitmapFactory.decodeFile(picPath);
|
||
// upload_certificateImg.setImageBitmap(bitmap);
|
||
my_imageUrl = imageUrl;
|
||
ImageLoader.getInstance().displayImage(imageUrl,
|
||
upload_certificateImg,
|
||
ImageOptions.getImageOptions(R.drawable.ll_upload_certificateimg));
|
||
|
||
}
|
||
// 头像
|
||
if (resultCode == Activity.RESULT_OK && requestCode == TO_SELECT_PHOTO1) {
|
||
// imageView不设null, 第一次上传成功后,第二次在选择上传的时候会报错。
|
||
String picPath1 = data
|
||
.getStringExtra(SelectedPhotoActivity.KEY_PHOTO_PATH);
|
||
picBase641 = data
|
||
.getStringExtra(SelectedPhotoActivity.KEY_PHOTO_BASE64);
|
||
|
||
LogUtil.i("picPath1=" + picPath1 + "=picBase641=" + picBase641);
|
||
String imageUrl = Scheme.FILE.wrap(picPath1);
|
||
LogUtil.i("imageUrl2==" + imageUrl);
|
||
|
||
// 保存
|
||
my_imageUrl2 = imageUrl;
|
||
|
||
ImageLoader.getInstance().displayImage(imageUrl, my_photo);
|
||
|
||
}
|
||
}
|
||
|
||
/**
|
||
*
|
||
*
|
||
* 类名称:MyAdapter 类描述: 创建人:苏三元 时间:2015-10-27 下午4:34:36 版权:河南商宇科技有限公司--版权所有
|
||
* (c) 2015
|
||
*
|
||
*/
|
||
private class MyAdapter extends BaseAdapter {
|
||
|
||
// 用来控制CheckBox的选中状况
|
||
private HashMap<Integer, Boolean> isSelected;
|
||
private List<ListData> list;
|
||
|
||
public MyAdapter(List<ListData> diseaseList) {
|
||
this.isSelected = new HashMap<Integer, Boolean>();
|
||
this.list = diseaseList;
|
||
// 初始化数据
|
||
// initDate();
|
||
}
|
||
|
||
private void initDate() {
|
||
for (int i = 0; i < list.size(); i++) {
|
||
String uuid2 = list.get(i).uuid;
|
||
// checkNum = 0;
|
||
/*
|
||
* if (specialPosintions != null) { for (int j = 0; j <
|
||
* specialPosintions.length; j++) { if
|
||
* (uuid2.equals(specialPosintions[j])) { getIsSelected().put(i,
|
||
* true); LogUtil.i("i==" + i); checkNum ++; }else{
|
||
* getIsSelected().put(i, false); } } }else{
|
||
* getIsSelected().put(i, false); }
|
||
*/
|
||
}
|
||
}
|
||
|
||
@Override
|
||
public int getCount() {
|
||
return list.size();
|
||
}
|
||
|
||
@Override
|
||
public Object getItem(int position) {
|
||
return null;
|
||
}
|
||
|
||
@Override
|
||
public long getItemId(int position) {
|
||
return 0;
|
||
}
|
||
|
||
@Override
|
||
public View getView(int position, View convertView, ViewGroup parent) {
|
||
VHolder holder = null;
|
||
if (convertView == null) {
|
||
// 获得ViewHolder对象
|
||
holder = new VHolder();
|
||
// 导入布局并赋值给convertview
|
||
convertView = View.inflate(ct, R.layout.item_date_time, null);
|
||
holder.cb = (CheckBox) convertView
|
||
.findViewById(R.id.cb_list_title);
|
||
holder.cb.setTextSize(13);
|
||
// 为view设置标签
|
||
convertView.setTag(holder);
|
||
} else {
|
||
// 取出holder
|
||
holder = (VHolder) convertView.getTag();
|
||
}
|
||
|
||
holder.cb.setText(list.get(position).name);// stringArrays[position]
|
||
holder.cb.setChecked(getIsSelected().get(position));
|
||
return convertView;
|
||
}
|
||
|
||
public HashMap<Integer, Boolean> getIsSelected() {
|
||
return isSelected;
|
||
}
|
||
|
||
}
|
||
|
||
public static class VHolder {
|
||
CheckBox cb;
|
||
}
|
||
|
||
// 得到专长
|
||
private void getCheck() {
|
||
disease = "";
|
||
String diseaseName = "";
|
||
specialPosintions = new String[diseaseList.size()];
|
||
for (int i = 0; i < diseaseList.size(); i++) {
|
||
Boolean isCheck = adapter.getIsSelected().get(i);
|
||
if (isCheck) {
|
||
specialPosintions[i] = diseaseList.get(i).uuid;
|
||
disease += diseaseList.get(i).uuid + ",";
|
||
diseaseName += diseaseList.get(i).name + "、";
|
||
LogUtil.i("disease=" + disease + "=diseaseName=" + diseaseName);
|
||
}
|
||
}
|
||
// 保存到sp为了以后使用
|
||
SharePrefUtil.saveString(ct, "disease", disease);
|
||
// 去掉最后一个“、”
|
||
if (!TextUtils.isEmpty(diseaseName) && diseaseName.length() > 0) {
|
||
diseaseName = diseaseName.substring(0, diseaseName.length() - 1).replace("(甲、乙、丙、丁、戊肝)","");
|
||
my_disease.setText(diseaseName);
|
||
SharePrefUtil.saveString(ct, "diseaseName", diseaseName);
|
||
} else {
|
||
my_disease.setText("");
|
||
|
||
}
|
||
|
||
}
|
||
|
||
// 得到专长
|
||
private void getCancleCheck() {
|
||
disease = "";
|
||
String diseaseName = "";
|
||
specialPosintions = new String[diseaseList.size()];
|
||
for (int i = 0; i < diseaseList.size(); i++) {
|
||
Boolean isCheck = adapter.getIsSelected().get(i);
|
||
if (isCheck) {
|
||
specialPosintions[i] = diseaseList.get(i).uuid;
|
||
diseaseName += diseaseList.get(i).name + "、";
|
||
|
||
}
|
||
}
|
||
if (TextUtils.isEmpty(diseaseName)) {
|
||
my_disease.setText("");
|
||
|
||
}
|
||
|
||
}
|
||
|
||
@Override
|
||
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
|
||
|
||
// 取得ViewHolder对象,这样就省去了通过层层的findViewById去实例化我们需要的cb实例的步骤
|
||
VHolder holder = (VHolder) arg1.getTag();
|
||
|
||
LogUtil.i("checkNum=" + checkNum + "arg2=" + arg2);
|
||
if (!holder.cb.isChecked()) {
|
||
if (checkNum >= 10) {
|
||
ToastUtil.showToast("最多选十项");
|
||
return;
|
||
}
|
||
}
|
||
// 改变CheckBox的状态
|
||
holder.cb.toggle();
|
||
// 将CheckBox的选中状况记录下来
|
||
adapter.getIsSelected().put(arg2, holder.cb.isChecked());
|
||
// 调整选定条目
|
||
if (holder.cb.isChecked() == true) {
|
||
checkNum++;
|
||
} else {
|
||
checkNum--;
|
||
if (checkNum < 0) {
|
||
checkNum = 0;
|
||
}
|
||
}
|
||
}
|
||
|
||
/*
|
||
* 弹出修改信息弹出框
|
||
*/
|
||
private void showDiseasePop(View parent) {
|
||
|
||
if (popGridView != null && popGridView.isShowing()) {
|
||
popGridView.dismiss();
|
||
}
|
||
|
||
View view = getLayoutInflater().inflate(R.layout.popwindow_grid, null);
|
||
popGridView = new PopupWindow(view, LayoutParams.MATCH_PARENT,
|
||
LayoutParams.WRAP_CONTENT);
|
||
popGridView.setBackgroundDrawable(new ColorDrawable(0));
|
||
popGridView.setOutsideTouchable(true);
|
||
popGridView.setAnimationStyle(R.style.timepopwindow_anim_style);
|
||
popGridView.update();
|
||
popGridView.setFocusable(true);
|
||
|
||
TextView btnCancle = (TextView) view.findViewById(R.id.btn_cancle);
|
||
TextView btnSure = (TextView) view.findViewById(R.id.btn_sure);
|
||
gv_disease = (GridView) view.findViewById(R.id.gv_disease);
|
||
gv_disease.setOnItemClickListener(this);
|
||
adapter = new MyAdapter(diseaseList);
|
||
checkNum = 0;
|
||
for (int i = 0; i < diseaseList.size(); i++) {
|
||
String uuid2 = diseaseList.get(i).uuid;
|
||
adapter.getIsSelected().put(i, false);
|
||
if (specialPosintions != null) {
|
||
for (int j = 0; j < specialPosintions.length; j++) {
|
||
if (uuid2.equals(specialPosintions[j])) {
|
||
adapter.getIsSelected().put(i, true);
|
||
LogUtil.i("i=====" + i);
|
||
checkNum++;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
gv_disease.setAdapter(adapter);
|
||
// adapter.notifyDataSetChanged();
|
||
|
||
btnCancle.setOnClickListener(new OnClickListener() {
|
||
|
||
@Override
|
||
public void onClick(View v) {
|
||
getCancleCheck();
|
||
popGridView.dismiss();
|
||
}
|
||
});
|
||
btnSure.setOnClickListener(new OnClickListener() {
|
||
|
||
@Override
|
||
public void onClick(View v) {
|
||
getCheck();
|
||
popGridView.dismiss();
|
||
}
|
||
});
|
||
|
||
popGridView.showAtLocation(ll_my_disease, Gravity.BOTTOM, 0, 0);
|
||
|
||
}
|
||
|
||
}
|