导航菜单

页面标题

页面副标题

爱心e站 v1.0.0 - RehabilitationServiceApplyActivity.java 源代码

正在查看: 爱心e站 v1.0.0 应用的 RehabilitationServiceApplyActivity.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package com.newheyd.JZKFcanjiren.Activity;

import android.content.DialogInterface;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.google.gson.Gson;
import com.iflytek.cloud.SpeechEvent;
import com.igexin.assist.sdk.AssistPushConsts;
import com.newheyd.JZKFcanjiren.Adapter.FilePickerAdapter;
import com.newheyd.JZKFcanjiren.Adapter.PickerPhotoAdapter;
import com.newheyd.JZKFcanjiren.BaseActivity;
import com.newheyd.JZKFcanjiren.Bean.AvatarBean;
import com.newheyd.JZKFcanjiren.Bean.DisabledFileInfoBean;
import com.newheyd.JZKFcanjiren.Bean.FuJianBean;
import com.newheyd.JZKFcanjiren.Bean.MessageEvent;
import com.newheyd.JZKFcanjiren.Bean.RehabServicApplyDicBean;
import com.newheyd.JZKFcanjiren.Bean.UserInfo;
import com.newheyd.JZKFcanjiren.LargerPhoto.ShowLargerPhotoActivity;
import com.newheyd.JZKFcanjiren.MyApplication;
import com.newheyd.JZKFcanjiren.R;
import com.newheyd.JZKFcanjiren.Utils.DataParseUtil;
import com.newheyd.JZKFcanjiren.Utils.DataUtil;
import com.newheyd.JZKFcanjiren.Utils.FileDownloadUtil;
import com.newheyd.JZKFcanjiren.Utils.ImageUtil;
import com.newheyd.JZKFcanjiren.Utils.RegexUtils;
import com.newheyd.JZKFcanjiren.Utils.StastisticUtil;
import com.newheyd.JZKFcanjiren.Utils.TextUtil;
import com.newheyd.JZKFcanjiren.Utils.ToastUtils;
import com.newheyd.JZKFcanjiren.Utils.locationUtil.LocationAddrUtil;
import com.newheyd.JZKFcanjiren.View.Dialog.MyDialog;
import com.newheyd.JZKFcanjiren.View.PhotoSelect.PhotoPickerActivity;
import com.newheyd.JZKFcanjiren.View.PhotoSelect.entity.FileBean;
import com.newheyd.JZKFcanjiren.View.PhotoSelect.entity.Photo;
import com.newheyd.JZKFcanjiren.View.TitleView;
import com.newheyd.JZKFcanjiren.config.NewHYConfig;
import com.newheyd.JZKFcanjiren.listener.OnMultyClickListener;
import com.newheyd.JZKFcanjiren.model.BaseResult;
import com.newheyd.JZKFcanjiren.net.AttachUploadTask;
import com.newheyd.JZKFcanjiren.net.CommonTask;
import com.newheyd.JZKFcanjiren.net.NewHYTask;
import com.newheyd.JZKFcanjiren.net.RequestServiceList;
import com.tencent.connect.common.Constants;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import org.greenrobot.eventbus.EventBus;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class RehabilitationServiceApplyActivity extends BaseActivity implements PickerPhotoAdapter.OnDelAttachmentListener, View.OnClickListener, FilePickerAdapter.OnDelFileAttachmentListener {
    private DisabledFileInfoBean disabledFileInfoBean;
    private EditText et_jianhuren;
    private EditText et_jiatingzhuzhi;
    private EditText et_phonenumber;
    private RecyclerView fileRecycle;
    private Gson gson;
    private Button hand_btn;
    private Button hand_btn_temp;
    private String id;
    private LinearLayout ll_check_content;
    private LinearLayout ll_content;
    private LinearLayout ll_disa4_fzqj;
    private LinearLayout ll_need_content;
    private RecyclerView mRecycle;
    private TextView name;
    private RehabServicApplyDicBean rehabServicApplyDicBean;
    private TextView sex;
    private TitleView titleView;
    private TextView tv_applyser_name;
    private TextView tv_borndate;
    private TextView tv_check_applytime;
    private TextView tv_check_groupers;
    private TextView tv_check_idea;
    private TextView tv_check_jianhu;
    private TextView tv_check_method;
    private TextView tv_check_result;
    private TextView tv_check_time;
    private TextView tv_cid;
    private TextView tv_disa4_fzqj;
    private TextView tv_disa4_gnxl;
    private TextView tv_disa4_qt;
    private TextView tv_disa4_ss;
    private TextView tv_disid;
    private TextView tv_dislevel;
    private TextView tv_distype;
    private TextView tv_minzu;
    private TextView tv_xiagnshoubaoxian;
    private UserInfo userInfo;
    private String editType = "";
    private String deleteType = "";
    private String deleteID = "";
    private PickerPhotoAdapter pickerPhotoAdapter = null;
    private ArrayList<Photo> photos = null;
    private GridLayoutManager layoutManager = null;
    private ArrayList<String> resultPhotoUris = null;
    private ArrayList<FileBean> files = null;
    private FilePickerAdapter filePickerAdapter = null;
    private List<FuJianBean> fileList = new ArrayList();
    private CompressAnyscTask compressAnyscTask = null;
    private List<String> newPaths = null;
    private Photo deleteInfo = null;
    private boolean isEditable = true;
    private HashMap<String, String> params = new HashMap<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        setContentView(R.layout.activity_rehabilitation_service_apply);
        this.userInfo = MyApplication.getInstance().getUserInfo();
        this.editType = getIntent().getStringExtra(Constants.PARAM_KEY_TYPE);
        super.onCreate(savedInstanceState);
        this.gson = new Gson();
        if (!"3".equals(this.editType)) {
            this.id = getIntent().getStringExtra("id");
        }
        if ("3".equals(this.editType)) {
            showMyDialog();
        } else {
            getDic();
        }
        if ("1".equals(this.editType)) {
            goStatistics("1");
        } else if ("2".equals(this.editType)) {
            goStatistics("2");
        } else if ("3".equals(this.editType)) {
            goStatistics("3");
        }
    }

    public void goStatistics(String s) {
        HashMap<String, String> map = LocationAddrUtil.getInstance().getLocationParam(this.mContext);
        StastisticUtil.getInstance().onEvent(this.mContext, "RehabilitationServiceApplyActivity" + s, map);
    }

    @Override
    public void onResponseBefore(NewHYTask task) {
        switch (task.getService()) {
            case GET_DICTIONNARY_DATA:
            case GET_REHABILITATION_SERVICE_INFO:
                showProgress("正在获取数据", false);
                break;
            case REHABILITATION_SERVICE_APPLY:
            case UPDATE_REHABILITATION_SERVICE_INFO:
                showProgress("正在提交数据", false);
                break;
            case ATTACHMENT_UPLOAD:
                showProgress("正在上传附件", false);
                break;
            case ATTACHMENT_CALLBACK:
                showProgress("正在获取附件数据", false);
                break;
            case ATTACHMENT_DELETE:
                showProgress("正在删除附件数据", false);
                break;
        }
    }

    @Override
    public void onResponseAfter(NewHYTask task) {
        cancleProgress();
    }

    @Override
    public void onResponseSuccessful(NewHYTask task, BaseResult object) {
        switch (task.getService()) {
            case GET_DICTIONNARY_DATA:
                String data = object.getData();
                if (!TextUtils.isEmpty(data)) {
                    this.rehabServicApplyDicBean = (RehabServicApplyDicBean) this.gson.fromJson(data, RehabServicApplyDicBean.class);
                }
                if ("2".equals(this.editType) || "1".equals(this.editType)) {
                    getApplyInfo(this.id);
                    break;
                }
                break;
            case GET_REHABILITATION_SERVICE_INFO:
                this.disabledFileInfoBean = (DisabledFileInfoBean) this.gson.fromJson(object.getData(), DisabledFileInfoBean.class);
                initViewData();
                getAttchFile(this.disabledFileInfoBean.getId());
                break;
            case REHABILITATION_SERVICE_APPLY:
                JSONObject jsonObject = object.getJsonObject();
                if (jsonObject != null) {
                    JSONObject jsonObject1 = jsonObject.optJSONObject(SpeechEvent.KEY_EVENT_RECORD_DATA);
                    if (jsonObject1 != null) {
                        String id = jsonObject1.optString("id");
                        if (!TextUtils.isEmpty(id) && ((this.photos != null && this.photos.size() > 0) || (this.files != null && this.files.size() > 0))) {
                            postFileToServer(id, NewHYConfig.RECOVER_APPLY_TYPE_STR);
                            break;
                        } else {
                            TishiDialog("操作成功", true, new BaseActivity.OnTishiDialogClicked() {
                                @Override
                                public void onTishiDialogClicked(DialogInterface dialogInterface, int i) {
                                    RehabilitationServiceApplyActivity.this.finish();
                                }
                            });
                            MessageEvent messageEvent = new MessageEvent("康复申请操作成功", NewHYConfig.ACTIVITY_REHABILITATION_APPLICATION_SUSS);
                            EventBus.getDefault().post(messageEvent);
                            break;
                        }
                    } else {
                        TishiDialog("操作成功", true, new BaseActivity.OnTishiDialogClicked() {
                            @Override
                            public void onTishiDialogClicked(DialogInterface dialogInterface, int i) {
                                RehabilitationServiceApplyActivity.this.finish();
                            }
                        });
                        MessageEvent messageEvent2 = new MessageEvent("康复申请操作成功", NewHYConfig.ACTIVITY_REHABILITATION_APPLICATION_SUSS);
                        EventBus.getDefault().post(messageEvent2);
                        break;
                    }
                } else {
                    TishiDialog("操作成功", true, new BaseActivity.OnTishiDialogClicked() {
                        @Override
                        public void onTishiDialogClicked(DialogInterface dialogInterface, int i) {
                            RehabilitationServiceApplyActivity.this.finish();
                        }
                    });
                    MessageEvent messageEvent3 = new MessageEvent("康复申请操作成功", NewHYConfig.ACTIVITY_REHABILITATION_APPLICATION_SUSS);
                    EventBus.getDefault().post(messageEvent3);
                    break;
                }
                break;
            case UPDATE_REHABILITATION_SERVICE_INFO:
                if (!TextUtils.isEmpty(this.id) && ((this.photos != null && this.photos.size() > 0) || (this.files != null && this.files.size() > 0))) {
                    postFileToServer(this.id, NewHYConfig.RECOVER_APPLY_TYPE_STR);
                    break;
                } else {
                    TishiDialog("操作成功", true, new BaseActivity.OnTishiDialogClicked() {
                        @Override
                        public void onTishiDialogClicked(DialogInterface dialogInterface, int i) {
                            RehabilitationServiceApplyActivity.this.finish();
                        }
                    });
                    MessageEvent messageEvent4 = new MessageEvent("康复申请操作成功", NewHYConfig.ACTIVITY_REHABILITATION_APPLICATION_SUSS);
                    EventBus.getDefault().post(messageEvent4);
                    break;
                }
                break;
            case ATTACHMENT_UPLOAD:
                TishiDialog("操作成功", true, new BaseActivity.OnTishiDialogClicked() {
                    @Override
                    public void onTishiDialogClicked(DialogInterface dialogInterface, int i) {
                        RehabilitationServiceApplyActivity.this.finish();
                    }
                });
                MessageEvent messageEvent5 = new MessageEvent("康复申请操作成功", NewHYConfig.ACTIVITY_REHABILITATION_APPLICATION_SUSS);
                EventBus.getDefault().post(messageEvent5);
                break;
            case ATTACHMENT_CALLBACK:
                JSONObject jsonObject12 = object.getJsonObject();
                if (jsonObject12 != null) {
                    try {
                        if (this.fileList != null) {
                            this.fileList.clear();
                        }
                        JSONArray dataarr = jsonObject12.optJSONArray(SpeechEvent.KEY_EVENT_RECORD_DATA);
                        if (dataarr != null) {
                            for (int i = 0; i < dataarr.length(); i++) {
                                this.fileList.add((FuJianBean) this.gson.fromJson(dataarr.getString(i), FuJianBean.class));
                            }
                        }
                    } catch (JSONException e) {
                        e.printStackTrace();
                        return;
                    }
                }
                if (this.fileList.size() > 0) {
                    if (this.photos != null) {
                        this.photos.clear();
                    }
                    for (FuJianBean fuJianBean : this.fileList) {
                        if (NewHYConfig.photoStyle.contains(fuJianBean.fileExt)) {
                            Photo photo = new Photo();
                            photo.setId(fuJianBean.id);
                            photo.setUri(NewHYConfig.ROOT + fuJianBean.filePath + fuJianBean.newFileName);
                            photo.setFileName(fuJianBean.fileName);
                            this.photos.add(photo);
                        } else if (NewHYConfig.fileStyle.contains(fuJianBean.fileExt)) {
                            FileBean fileBean = new FileBean();
                            fileBean.setId(fuJianBean.id);
                            fileBean.setName(fuJianBean.fileName);
                            fileBean.setNetpath(NewHYConfig.ROOT + fuJianBean.filePath + fuJianBean.newFileName);
                            fileBean.setUri(NewHYConfig.ROOT + fuJianBean.filePath + fuJianBean.newFileName);
                            fileBean.setType(2);
                            this.files.add(fileBean);
                        }
                    }
                }
                initAttachFile();
                break;
            case ATTACHMENT_DELETE:
                if ("1".equals(this.deleteType)) {
                    Iterator<Photo> it = this.photos.iterator();
                    while (it.hasNext()) {
                        Photo photo2 = it.next();
                        if (this.deleteID.equals(photo2.getId())) {
                            this.photos.remove(photo2);
                            this.pickerPhotoAdapter.notifyDataSetChanged();
                        }
                    }
                    break;
                } else if ("2".equals(this.deleteType)) {
                    Iterator<FileBean> it2 = this.files.iterator();
                    while (it2.hasNext()) {
                        FileBean fileBean2 = it2.next();
                        if (this.deleteID.equals(fileBean2.getId())) {
                            this.files.remove(fileBean2);
                            this.filePickerAdapter.notifyDataSetChanged();
                        }
                    }
                    break;
                }
                break;
        }
    }

    private void initAttachFile() {
        if (this.pickerPhotoAdapter == null) {
            this.pickerPhotoAdapter = new PickerPhotoAdapter(this.mContext, this.photos);
            this.pickerPhotoAdapter.setListener(this);
            this.pickerPhotoAdapter.setEditable("2".equals(this.editType));
            this.mRecycle.setAdapter(this.pickerPhotoAdapter);
        } else {
            this.pickerPhotoAdapter.setEditable("2".equals(this.editType));
            this.pickerPhotoAdapter.setmItems(this.photos);
            this.pickerPhotoAdapter.notifyDataSetChanged();
        }
        if (this.filePickerAdapter == null) {
            this.filePickerAdapter = new FilePickerAdapter(this.mContext, this.files);
            this.filePickerAdapter.setListener(this);
            this.filePickerAdapter.setEditable("2".equals(this.editType));
            this.fileRecycle.setAdapter(this.filePickerAdapter);
            return;
        }
        this.filePickerAdapter.setEditable("2".equals(this.editType));
        this.filePickerAdapter.setmItems(this.files);
        this.filePickerAdapter.notifyDataSetChanged();
    }

    @Override
    public void onResponseError(NewHYTask task, BaseResult object) {
        switch (task.getService()) {
            case GET_DICTIONNARY_DATA:
                ToastUtils.showShortToast(this.mContext, object.getMsg());
                break;
            case GET_REHABILITATION_SERVICE_INFO:
            case ATTACHMENT_UPLOAD:
            case ATTACHMENT_CALLBACK:
            case ATTACHMENT_DELETE:
                ToastUtils.showShortToast(this.mContext, object.getMsg());
                break;
            case REHABILITATION_SERVICE_APPLY:
            case UPDATE_REHABILITATION_SERVICE_INFO:
                ToastUtils.showShortToast(this.mContext, object.getMsg());
                break;
        }
    }

    @Override
    public void onServerError(NewHYTask task, int failedType) {
        onResultShow(failedType);
    }

    @Override
    public void initViews() {
        this.titleView = (TitleView) findView(R.id.titleview);
        this.name = (TextView) findView(R.id.tv_name);
        this.sex = (TextView) findView(R.id.tv_sex);
        this.tv_minzu = (TextView) findView(R.id.tv_minzu);
        this.tv_borndate = (TextView) findView(R.id.tv_borndate);
        this.tv_cid = (TextView) findView(R.id.tv_cid);
        this.tv_disid = (TextView) findView(R.id.tv_disid);
        this.tv_distype = (TextView) findView(R.id.tv_distype);
        this.tv_dislevel = (TextView) findView(R.id.tv_dislevel);
        this.et_jianhuren = (EditText) findView(R.id.et_jianhuren);
        this.et_phonenumber = (EditText) findView(R.id.et_phonenumber);
        this.et_jiatingzhuzhi = (EditText) findView(R.id.et_jiatingzhuzhi);
        this.tv_xiagnshoubaoxian = (TextView) findView(R.id.tv_xiagnshoubaoxian);
        this.ll_disa4_fzqj = (LinearLayout) findView(R.id.ll_disa4_fzqj);
        this.ll_content = (LinearLayout) findViewById(2131689634);
        this.ll_need_content = (LinearLayout) findViewById(R.id.ll_need_content);
        this.ll_check_content = (LinearLayout) findViewById(R.id.ll_check_content);
        this.tv_applyser_name = (TextView) findViewById(R.id.tv_applyser_name);
        this.tv_check_method = (TextView) findViewById(R.id.tv_check_method);
        this.tv_check_idea = (TextView) findViewById(R.id.tv_check_idea);
        this.tv_check_result = (TextView) findViewById(R.id.tv_check_result);
        this.tv_check_jianhu = (TextView) findViewById(R.id.tv_check_jianhu);
        this.tv_check_applytime = (TextView) findViewById(R.id.tv_check_applytime);
        this.tv_check_groupers = (TextView) findViewById(R.id.tv_check_groupers);
        this.tv_check_time = (TextView) findViewById(R.id.tv_check_time);
        this.hand_btn = (Button) findView(R.id.hand_btn);
        this.hand_btn_temp = (Button) findView(R.id.hand_btn_temp);
        this.tv_disa4_ss = (TextView) findView(R.id.tv_disa4_ss);
        this.tv_disa4_gnxl = (TextView) findView(R.id.tv_disa4_gnxl);
        this.tv_disa4_fzqj = (TextView) findView(R.id.tv_disa4_fzqj);
        this.tv_disa4_qt = (TextView) findView(R.id.tv_disa4_qt);
        this.mRecycle = (RecyclerView) findViewById(R.id.recycle);
        this.layoutManager = new GridLayoutManager(this, 4);
        this.mRecycle.setLayoutManager(this.layoutManager);
        GridLayoutManager layoutManager2 = new GridLayoutManager(this, 4);
        this.fileRecycle = (RecyclerView) findViewById(R.id.recycle_file);
        this.fileRecycle.setLayoutManager(layoutManager2);
        this.photos = new ArrayList<>();
        this.files = new ArrayList<>();
        freshData();
        freshFileData();
    }

    public void initViewData() {
        this.ll_disa4_fzqj.setVisibility(8);
        if (this.userInfo == null) {
            ToastUtils.showShortToast(this.mContext, "未获取到用户信息,请重新登陆此账户");
            finish();
            return;
        }
        this.name.setText(this.userInfo.getNickname());
        this.sex.setText(DataParseUtil.getSex(this.userInfo.getSex()));
        this.tv_minzu.setText(DataParseUtil.getMinZu(this.userInfo.getRace()));
        this.tv_borndate.setText(this.userInfo.getBirthdate());
        this.tv_cid.setText(this.userInfo.getCitizenId());
        this.tv_disid.setText(this.userInfo.getCardNum());
        this.tv_distype.setText(DataParseUtil.getIdtKind(this.userInfo.getIdtKind()));
        this.tv_dislevel.setText(DataParseUtil.getIdtLevel(this.userInfo.getIdtLevel()));
        if ("1".equals(this.editType)) {
            this.et_jianhuren.setEnabled(false);
            this.et_phonenumber.setEnabled(false);
            this.et_jiatingzhuzhi.setEnabled(false);
            this.tv_xiagnshoubaoxian.setEnabled(false);
            this.tv_disa4_ss.setEnabled(false);
            this.tv_disa4_gnxl.setEnabled(false);
            this.tv_disa4_fzqj.setEnabled(false);
            this.tv_disa4_qt.setEnabled(false);
            this.hand_btn.setVisibility(8);
            this.hand_btn_temp.setVisibility(8);
            if ("2".equals(this.disabledFileInfoBean.getIsSubmit())) {
                findView(R.id.fl_shenhe_detail).setVisibility(0);
                this.ll_check_content.setVisibility(0);
            } else {
                findView(R.id.fl_shenhe_detail).setVisibility(8);
                this.ll_check_content.setVisibility(8);
            }
        }
        if ("3".equals(this.editType)) {
            this.et_jianhuren.setText(this.userInfo.getGuardian());
            this.et_phonenumber.setText(this.userInfo.getGuardianPhone());
            this.et_jiatingzhuzhi.setText(this.userInfo.getNowAdd());
        } else if (this.disabledFileInfoBean != null) {
            this.et_jianhuren.setText(this.disabledFileInfoBean.getGuarder());
            this.et_phonenumber.setText(this.disabledFileInfoBean.getLinkTel());
            this.et_jiatingzhuzhi.setText(this.disabledFileInfoBean.getFamilyAddress());
            this.tv_xiagnshoubaoxian.setText(TextUtil.getLableStringFromList(this.rehabServicApplyDicBean.getMedical_insurance(), this.disabledFileInfoBean.getMedicalSafe()));
            this.tv_disa4_ss.setText(TextUtil.getLableStringFromList(this.rehabServicApplyDicBean.getDtgx2017_o4_type(), this.disabledFileInfoBean.getO4()));
            this.tv_disa4_gnxl.setText(TextUtil.getLableStringFromList(this.rehabServicApplyDicBean.getDtgx2017_o5_type(), this.disabledFileInfoBean.getO5()));
            this.tv_disa4_qt.setText(TextUtil.getLableStringFromList(this.rehabServicApplyDicBean.getDtgx2017_o7_type(), this.disabledFileInfoBean.getO7()));
        } else {
            return;
        }
        if (this.disabledFileInfoBean != null && ("1".equals(this.disabledFileInfoBean.getStatus()) || "2".equals(this.disabledFileInfoBean.getStatus()))) {
            findView(R.id.fl_shenhe_detail).setVisibility(8);
            this.ll_check_content.setVisibility(8);
        } else {
            initCaiji();
        }
    }

    private void initCaiji() {
        if (this.disabledFileInfoBean != null) {
            this.tv_applyser_name.setText(this.disabledFileInfoBean.getCatalogName());
            String evaluateMethod = this.disabledFileInfoBean.getEvaluateMethod();
            if (!TextUtil.isEmpty(evaluateMethod)) {
                if ("1".equals(evaluateMethod)) {
                    this.tv_check_method.setText("现场评估");
                } else {
                    this.tv_check_method.setText("转至评估机构");
                }
            }
            this.tv_check_idea.setText(this.disabledFileInfoBean.getCommAuditOpinion());
            String ext3 = this.disabledFileInfoBean.getExt3();
            if (!TextUtil.isEmpty(ext3)) {
                switch (ext3) {
                    case "1":
                        this.tv_check_result.setText("需求明确");
                        break;
                    case "2":
                        this.tv_check_result.setText("不能确定");
                        break;
                    case "3":
                        this.tv_check_result.setText("无需求");
                        break;
                }
            }
            this.tv_check_jianhu.setText(this.disabledFileInfoBean.getApplyPerson());
            this.tv_check_applytime.setText(this.disabledFileInfoBean.getApplyDate());
            this.tv_check_groupers.setText(this.disabledFileInfoBean.getServicePerson());
            this.tv_check_time.setText(this.disabledFileInfoBean.getSurveyTime());
        }
    }

    @Override
    public void setListener() {
        this.titleView.setOnTitleClik(null, null);
        this.tv_xiagnshoubaoxian.setOnClickListener(this);
        this.tv_disa4_ss.setOnClickListener(this);
        this.tv_disa4_gnxl.setOnClickListener(this);
        this.tv_disa4_fzqj.setOnClickListener(this);
        this.tv_disa4_qt.setOnClickListener(this);
        this.hand_btn.setOnClickListener(this);
        this.hand_btn_temp.setOnClickListener(this);
        findViewById(R.id.fl_fj).setOnClickListener(this);
        findViewById(R.id.fl_kf).setOnClickListener(this);
        findViewById(R.id.fl_shenhe_detail).setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.tv_xiagnshoubaoxian:
                if (this.rehabServicApplyDicBean != null) {
                    String[] medical_insurance = TextUtil.getArrayFromList(this.rehabServicApplyDicBean.getMedical_insurance());
                    showMutilAlertDialog(R.id.tv_xiagnshoubaoxian, "请选择享受医疗保险情况", medical_insurance, this.tv_xiagnshoubaoxian.getText().toString(), new OnMultyClickListener() {
                        @Override
                        public void onMultyItemClick(DialogInterface dialogInterface, int id, int which, boolean isChecked) {
                        }

                        @Override
                        public void onMultyPositiveButtonClick(DialogInterface dialogInterface, int id, String selectedStr, boolean[] selected) {
                        }

                        @Override
                        public void onMultyNegativeButtonClick(DialogInterface dialogInterface, int id) {
                        }
                    });
                    break;
                }
                break;
            case R.id.fl_kf:
                if (this.ll_need_content.getVisibility() == 0) {
                    this.ll_need_content.setVisibility(8);
                    break;
                } else {
                    this.ll_need_content.setVisibility(0);
                    break;
                }
            case R.id.fl_fj:
                if (this.ll_content.getVisibility() == 0) {
                    this.ll_content.setVisibility(8);
                    break;
                } else {
                    this.ll_content.setVisibility(0);
                    break;
                }
            case R.id.fl_shenhe_detail:
                if (this.ll_check_content.getVisibility() == 0) {
                    this.ll_check_content.setVisibility(8);
                    break;
                } else {
                    this.ll_check_content.setVisibility(0);
                    break;
                }
            case R.id.hand_btn:
                ChoiceTishiDialog("您确定保存并提交吗,提交后就不能再进行编辑了", false, new BaseActivity.OnChoiceDialogYes() {
                    @Override
                    public void onChoiceDialogYes(DialogInterface dialogInterface, int i) {
                        RehabilitationServiceApplyActivity.this.params.put("status", "2");
                        RehabilitationServiceApplyActivity.this.params.put("isSubmit", "2");
                        RehabilitationServiceApplyActivity.this.params.put("auditState", "2");
                        RehabilitationServiceApplyActivity.this.submitForm();
                    }
                }, new BaseActivity.OnChoiceDialogNo() {
                    @Override
                    public void onChoiceDialogNo(DialogInterface dialogInterface, int i) {
                    }
                });
                break;
            case R.id.hand_btn_temp:
                this.params.put("status", "1");
                this.params.put("isSubmit", "1");
                this.params.put("auditState", "1");
                submitForm();
                break;
            case R.id.tv_disa4_ss:
                if (this.rehabServicApplyDicBean != null) {
                    String[] ssxuqiu = TextUtil.getArrayFromList(this.rehabServicApplyDicBean.getDtgx2017_o4_type());
                    showMutilAlertDialog(R.id.tv_disa4_ss, "请选择手术需求项", ssxuqiu, this.tv_disa4_ss.getText().toString(), new OnMultyClickListener() {
                        @Override
                        public void onMultyItemClick(DialogInterface dialogInterface, int id, int which, boolean isChecked) {
                        }

                        @Override
                        public void onMultyPositiveButtonClick(DialogInterface dialogInterface, int id, String selectedStr, boolean[] selected) {
                            StringBuffer take_tv = new StringBuffer();
                            for (int i = 0; i < selected.length; i++) {
                                if (selected[i]) {
                                    take_tv.append(RehabilitationServiceApplyActivity.this.rehabServicApplyDicBean.getDtgx2017_o4_type().get(i).getValue()).append(",");
                                }
                            }
                            RehabilitationServiceApplyActivity.this.params.put("o4", take_tv.toString());
                        }

                        @Override
                        public void onMultyNegativeButtonClick(DialogInterface dialogInterface, int id) {
                        }
                    });
                    break;
                }
                break;
            case R.id.tv_disa4_gnxl:
                if (this.rehabServicApplyDicBean != null) {
                    String[] gnxl = TextUtil.getArrayFromList(this.rehabServicApplyDicBean.getDtgx2017_o5_type());
                    showMutilAlertDialog(R.id.tv_disa4_gnxl, "请选择功能训练需求项", gnxl, this.tv_disa4_gnxl.getText().toString(), new OnMultyClickListener() {
                        @Override
                        public void onMultyItemClick(DialogInterface dialogInterface, int id, int which, boolean isChecked) {
                        }

                        @Override
                        public void onMultyPositiveButtonClick(DialogInterface dialogInterface, int id, String selectedStr, boolean[] selected) {
                            StringBuffer take_tv = new StringBuffer();
                            for (int i = 0; i < selected.length; i++) {
                                if (selected[i]) {
                                    take_tv.append(RehabilitationServiceApplyActivity.this.rehabServicApplyDicBean.getDtgx2017_o5_type().get(i).getValue()).append(",");
                                }
                            }
                            RehabilitationServiceApplyActivity.this.params.put("o5", take_tv.toString());
                        }

                        @Override
                        public void onMultyNegativeButtonClick(DialogInterface dialogInterface, int id) {
                        }
                    });
                    break;
                }
                break;
            case R.id.tv_disa4_fzqj:
                if (this.rehabServicApplyDicBean != null) {
                    String[] fjxl = TextUtil.getArrayFromList(this.rehabServicApplyDicBean.getDtgx2017_o6_type());
                    showMutilAlertDialog(R.id.tv_disa4_fzqj, "请选择辅助器具需求项", fjxl, this.tv_disa4_fzqj.getText().toString(), new OnMultyClickListener() {
                        @Override
                        public void onMultyItemClick(DialogInterface dialogInterface, int id, int which, boolean isChecked) {
                        }

                        @Override
                        public void onMultyPositiveButtonClick(DialogInterface dialogInterface, int id, String selectedStr, boolean[] selected) {
                            StringBuffer take_tv = new StringBuffer();
                            for (int i = 0; i < selected.length; i++) {
                                if (selected[i]) {
                                    take_tv.append(RehabilitationServiceApplyActivity.this.rehabServicApplyDicBean.getDtgx2017_o6_type().get(i).getValue()).append(",");
                                }
                            }
                            RehabilitationServiceApplyActivity.this.params.put("o6", take_tv.toString());
                        }

                        @Override
                        public void onMultyNegativeButtonClick(DialogInterface dialogInterface, int id) {
                        }
                    });
                    break;
                }
                break;
            case R.id.tv_disa4_qt:
                if (this.rehabServicApplyDicBean != null) {
                    String[] qt = TextUtil.getArrayFromList(this.rehabServicApplyDicBean.getDtgx2017_o7_type());
                    showMutilAlertDialog(R.id.tv_disa4_qt, "请选择其他需求项", qt, this.tv_disa4_qt.getText().toString(), new OnMultyClickListener() {
                        @Override
                        public void onMultyItemClick(DialogInterface dialogInterface, int id, int which, boolean isChecked) {
                        }

                        @Override
                        public void onMultyPositiveButtonClick(DialogInterface dialogInterface, int id, String selectedStr, boolean[] selected) {
                            StringBuffer take_tv = new StringBuffer();
                            for (int i = 0; i < selected.length; i++) {
                                if (selected[i]) {
                                    take_tv.append(RehabilitationServiceApplyActivity.this.rehabServicApplyDicBean.getDtgx2017_o7_type().get(i).getValue()).append(",");
                                }
                            }
                            RehabilitationServiceApplyActivity.this.params.put("o7", take_tv.toString());
                        }

                        @Override
                        public void onMultyNegativeButtonClick(DialogInterface dialogInterface, int id) {
                        }
                    });
                    break;
                }
                break;
        }
    }

    @Override
    public void onFileClickListener(int positon) {
        FileDownloadUtil fileDownload = new FileDownloadUtil(this.mContext);
        fileDownload.startDownLoadFile(this.files.get(positon).getUri(), this.files.get(positon).getName());
    }

    @Override
    public void onPhotoClickListener(int postion) {
        Intent intent = new Intent(this.mContext, (Class<?>) ShowLargerPhotoActivity.class);
        ArrayList<AvatarBean> bigPhotoList = new ArrayList<>();
        Iterator<Photo> it = this.photos.iterator();
        while (it.hasNext()) {
            Photo photo = it.next();
            AvatarBean avatarBean = new AvatarBean(photo.getUri());
            bigPhotoList.add(avatarBean);
        }
        intent.putExtra("photos", bigPhotoList);
        intent.putExtra("position", postion);
        startActivity(intent);
    }

    @Override
    public void attachmentFileDel(final FileBean info) {
        ChoiceTishiDialog("您确定删除服务器上已经上传的附件吗?", false, new BaseActivity.OnChoiceDialogYes() {
            @Override
            public void onChoiceDialogYes(DialogInterface dialogInterface, int i) {
                RehabilitationServiceApplyActivity.this.deleteAttchFile(info.getId());
                RehabilitationServiceApplyActivity.this.deleteID = info.getId();
                RehabilitationServiceApplyActivity.this.deleteType = "2";
            }
        }, new BaseActivity.OnChoiceDialogNo() {
            @Override
            public void onChoiceDialogNo(DialogInterface dialogInterface, int i) {
                dialogInterface.dismiss();
            }
        });
    }

    @Override
    public void attachmentDel(final Photo info) {
        ChoiceTishiDialog("您确定删除服务器上已经上传的附件吗?", false, new BaseActivity.OnChoiceDialogYes() {
            @Override
            public void onChoiceDialogYes(DialogInterface dialogInterface, int i) {
                RehabilitationServiceApplyActivity.this.deleteAttchFile(info.getId());
                RehabilitationServiceApplyActivity.this.deleteID = info.getId();
                RehabilitationServiceApplyActivity.this.deleteType = "1";
            }
        }, new BaseActivity.OnChoiceDialogNo() {
            @Override
            public void onChoiceDialogNo(DialogInterface dialogInterface, int i) {
                dialogInterface.dismiss();
            }
        });
    }

    class CompressAnyscTask extends AsyncTask<ArrayList<String>, List<String>, List<String>> {
        CompressAnyscTask() {
        }

        @Override
        protected void onPreExecute() {
            RehabilitationServiceApplyActivity.this.showProgress("图片压缩中", false);
        }

        @Override
        public List<String> doInBackground(ArrayList<String>... params) {
            List<String> newPaths = ImageUtil.compressImage(RehabilitationServiceApplyActivity.this.mContext, params[0]);
            return newPaths;
        }

        @Override
        public void onPostExecute(List<String> result) {
            RehabilitationServiceApplyActivity.this.newPaths = result;
            if (RehabilitationServiceApplyActivity.this.newPaths != null && RehabilitationServiceApplyActivity.this.newPaths.size() != 0) {
                int i = 0;
                while (i < RehabilitationServiceApplyActivity.this.photos.size()) {
                    if (TextUtils.isEmpty(((Photo) RehabilitationServiceApplyActivity.this.photos.get(i)).getId())) {
                        RehabilitationServiceApplyActivity.this.photos.remove(RehabilitationServiceApplyActivity.this.photos.get(i));
                        i--;
                    }
                    i++;
                }
                for (int i2 = 0; i2 < RehabilitationServiceApplyActivity.this.newPaths.size(); i2++) {
                    RehabilitationServiceApplyActivity.this.photos.add(new Photo((String) RehabilitationServiceApplyActivity.this.newPaths.get(i2)));
                }
                RehabilitationServiceApplyActivity.this.cancleProgress();
                RehabilitationServiceApplyActivity.this.freshData();
            }
        }
    }

    public void freshData() {
        if (this.photos != null && this.deleteInfo != null) {
            Iterator<Photo> it = this.photos.iterator();
            while (true) {
                if (!it.hasNext()) {
                    break;
                }
                Photo p = it.next();
                if (!isNull(p.getUri()) && p.getUri().equals(this.deleteInfo.getUri())) {
                    this.photos.remove(p);
                    break;
                }
            }
        }
        if (this.pickerPhotoAdapter == null) {
            this.pickerPhotoAdapter = new PickerPhotoAdapter(this.mContext, this.photos);
            this.pickerPhotoAdapter.setListener(this);
            this.pickerPhotoAdapter.setEditable(this.isEditable);
            this.mRecycle.setAdapter(this.pickerPhotoAdapter);
            return;
        }
        this.pickerPhotoAdapter.setEditable(this.isEditable);
        this.pickerPhotoAdapter.setmItems(this.photos);
        this.pickerPhotoAdapter.notifyDataSetChanged();
    }

    public void freshFileData() {
        if (this.files != null && this.deleteInfo != null) {
            Iterator<FileBean> it = this.files.iterator();
            while (true) {
                if (!it.hasNext()) {
                    break;
                }
                FileBean p = it.next();
                if (!isNull(p.getUri()) && p.getUri().equals(this.deleteInfo.getUri())) {
                    this.files.remove(p);
                    break;
                }
            }
        }
        if (this.filePickerAdapter == null) {
            this.filePickerAdapter = new FilePickerAdapter(this.mContext, this.files);
            this.filePickerAdapter.setListener(this);
            this.filePickerAdapter.setEditable(this.isEditable);
            this.fileRecycle.setAdapter(this.filePickerAdapter);
            return;
        }
        this.filePickerAdapter.setEditable(this.isEditable);
        this.filePickerAdapter.setmItems(this.files);
        this.filePickerAdapter.notifyDataSetChanged();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        ImageUtil.compressAftDelete(this.mContext);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (resultCode == -1) {
            switch (requestCode) {
                case 1000:
                    this.resultPhotoUris = data.getStringArrayListExtra(PhotoPickerActivity.SELECT_RESULTS_ARRAY);
                    if (this.compressAnyscTask != null && this.compressAnyscTask.getStatus() == AsyncTask.Status.RUNNING) {
                        this.compressAnyscTask.cancel(true);
                        this.compressAnyscTask = null;
                    }
                    this.compressAnyscTask = new CompressAnyscTask();
                    this.compressAnyscTask.execute(this.resultPhotoUris);
                    break;
                case 1001:
                    FileBean fileBean = new FileBean(data.getStringExtra(NewHYConfig.EXTRA_FILE_PATH), data.getStringExtra(NewHYConfig.EXTRA_FILE_NAME), 2);
                    this.files.add(fileBean);
                    freshFileData();
                    break;
            }
            super.onActivityResult(requestCode, resultCode, data);
        }
    }

    public void submitForm() {
        String guarder = this.et_jianhuren.getText().toString().trim();
        if (!TextUtils.isEmpty(guarder)) {
            this.params.put("guarder", guarder);
            String phonenumber = this.et_phonenumber.getText().toString().trim();
            if (!TextUtils.isEmpty(phonenumber)) {
                if (RegexUtils.judgePhone(phonenumber) || RegexUtils.judgeMobile(phonenumber)) {
                    this.params.put("linkTel", phonenumber);
                    String address = this.et_jiatingzhuzhi.getText().toString().trim();
                    if (!TextUtils.isEmpty(address)) {
                        this.params.put("familyAddress", address);
                        String medicalSafeStr = this.tv_xiagnshoubaoxian.getText().toString();
                        String valueStringFromList = TextUtil.getValueStringFromList(this.rehabServicApplyDicBean.getMedical_insurance(), medicalSafeStr);
                        this.params.put("medicalSafe", valueStringFromList);
                        if (TextUtils.isEmpty(this.params.get("medicalSafe"))) {
                            ToastUtils.showShortToast(this.mContext, "未填写享受医疗保险情况");
                            return;
                        }
                        String tv_disa4_ssstr = this.tv_disa4_ss.getText().toString();
                        String o4Str = TextUtil.getValueStringFromList(this.rehabServicApplyDicBean.getDtgx2017_o4_type(), tv_disa4_ssstr);
                        this.params.put("o4", o4Str);
                        String tv_disa4_gnxlstr = this.tv_disa4_gnxl.getText().toString();
                        String o5Str = TextUtil.getValueStringFromList(this.rehabServicApplyDicBean.getDtgx2017_o5_type(), tv_disa4_gnxlstr);
                        this.params.put("o5", o5Str);
                        String tv_disa4_qtstr = this.tv_disa4_qt.getText().toString();
                        String o7Str = TextUtil.getValueStringFromList(this.rehabServicApplyDicBean.getDtgx2017_o7_type(), tv_disa4_qtstr);
                        this.params.put("o7", o7Str);
                        this.params.put("name", this.userInfo.getNickname());
                        this.params.put("citizenId", this.userInfo.getCitizenId());
                        this.params.put("areaCode", this.userInfo.getJiedaoCode());
                        this.params.put("idtKind", this.userInfo.getIdtKind());
                        this.params.put(AssistPushConsts.MSG_TYPE_TOKEN, this.userInfo.getToken());
                        try {
                            this.params.put("applyDate", DataUtil.longToString(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss"));
                        } catch (ParseException e) {
                            e.printStackTrace();
                        }
                        if ("2".equals(this.editType)) {
                            this.params.put("id", this.id);
                            this.params.put("personalFrom", this.disabledFileInfoBean.getPersonalFrom());
                            this.params.put("year", this.disabledFileInfoBean.getYear());
                            this.params.put("g36", this.disabledFileInfoBean.getG36());
                            this.params.put("hasAuxiliary", this.disabledFileInfoBean.getHasAuxiliary());
                            CommonTask updataTask = new CommonTask(RequestServiceList.UPDATE_REHABILITATION_SERVICE_INFO, this.params);
                            executeRequest(updataTask);
                            return;
                        }
                        if ("3".equals(this.editType)) {
                            CommonTask sendTask = new CommonTask(RequestServiceList.REHABILITATION_SERVICE_APPLY, this.params);
                            executeRequest(sendTask);
                            return;
                        }
                        return;
                    }
                    ToastUtils.showShortToast(this.mContext, "未填写家庭住址");
                    return;
                }
                ToastUtils.showShortToast(this.mContext, this.mContext.getResources().getString(R.string.contract_format));
                return;
            }
            ToastUtils.showShortToast(this.mContext, "未填写联系电话");
            return;
        }
        ToastUtils.showShortToast(this.mContext, "未填写监护人姓名");
    }

    public void checkData() {
    }

    private void showMyDialog() {
        MyDialog myDialog = new MyDialog(this.mContext, getResources().getString(R.string.recover_law_str), "关于服务办理的相关声明", "同意", "不同意", false);
        myDialog.setOnDiaLogListener(new MyDialog.OnDialogListenerPN() {
            @Override
            public void dialogPositiveListener(View customView, DialogInterface dialogInterface, int which) {
                RehabilitationServiceApplyActivity.this.initViewData();
                RehabilitationServiceApplyActivity.this.getDic();
                dialogInterface.dismiss();
            }

            @Override
            public void dialogNegativeListener(View customView, DialogInterface dialogInterface, int which) {
                ToastUtils.showShortToast(RehabilitationServiceApplyActivity.this.mContext, "您需要同意上述条款才可进行在线办理");
                RehabilitationServiceApplyActivity.this.finish();
                dialogInterface.dismiss();
            }
        });
        myDialog.showDialog();
    }

    public void getDic() {
        HashMap<String, String> params = new HashMap<>();
        params.put("type", "medical_insurance,dtgx2017_o4_type,dtgx2017_o5_type,dtgx2017_o6_type,dtgx2017_o7_type");
        CommonTask requestTask = new CommonTask(RequestServiceList.GET_DICTIONNARY_DATA, params);
        executeRequest(requestTask);
    }

    public void postFileToServer(String id, String type) {
        HashMap<String, String> params = new HashMap<>();
        HashMap<String, String> imgParms = new HashMap<>();
        HashMap<String, String> fileParms = new HashMap<>();
        UserInfo userInfo = MyApplication.getInstance().getUserInfo();
        params.put("relationId", id);
        params.put("style", type);
        if (userInfo != null) {
            params.put(AssistPushConsts.MSG_TYPE_TOKEN, userInfo.getToken());
        }
        if (this.photos != null) {
            for (int i = 0; i < this.photos.size(); i++) {
                Photo photo = this.photos.get(i);
                if (TextUtil.isEmpty(photo.getId())) {
                    imgParms.put("uploadifyphoto" + i, photo.getUri());
                }
            }
        }
        if (this.files != null) {
            for (int i2 = 0; i2 < this.files.size(); i2++) {
                FileBean fileBean = this.files.get(i2);
                if (TextUtil.isEmpty(fileBean.getId())) {
                    fileParms.put("uploadify_file" + i2, this.files.get(i2).getUri());
                }
            }
        }
        AttachUploadTask filePostTask = new AttachUploadTask(RequestServiceList.ATTACHMENT_UPLOAD, params, imgParms, fileParms);
        if (imgParms.size() == 0 && fileParms.size() == 0) {
            TishiDialog("操作成功", true, new BaseActivity.OnTishiDialogClicked() {
                @Override
                public void onTishiDialogClicked(DialogInterface dialogInterface, int i3) {
                    MessageEvent messageEvent = new MessageEvent("康复申请提交成功", 10004);
                    EventBus.getDefault().post(messageEvent);
                    RehabilitationServiceApplyActivity.this.finish();
                }
            });
        } else {
            executeRequest(filePostTask);
        }
    }

    public void getApplyInfo(String id) {
        if (!TextUtils.isEmpty(id)) {
            HashMap<String, String> params = new HashMap<>();
            UserInfo userInfo = MyApplication.getInstance().getUserInfo();
            if (userInfo != null) {
                params.put(AssistPushConsts.MSG_TYPE_TOKEN, userInfo.getToken());
                params.put("id", id);
                CommonTask infoApplyTask = new CommonTask(RequestServiceList.GET_REHABILITATION_SERVICE_INFO, params);
                executeRequest(infoApplyTask);
            }
        }
    }

    public void getAttchFile(String id) {
        HashMap<String, String> params = new HashMap<>();
        UserInfo userInfo = MyApplication.getInstance().getUserInfo();
        if (userInfo != null) {
            params.put(AssistPushConsts.MSG_TYPE_TOKEN, userInfo.getToken());
            params.put("relationId", id);
            CommonTask getFileTask = new CommonTask(RequestServiceList.ATTACHMENT_CALLBACK, params);
            executeRequest(getFileTask);
        }
    }

    public void deleteAttchFile(String id) {
        HashMap<String, String> params = new HashMap<>();
        UserInfo userInfo = MyApplication.getInstance().getUserInfo();
        if (userInfo != null) {
            params.put(AssistPushConsts.MSG_TYPE_TOKEN, userInfo.getToken());
            params.put("id", id);
            CommonTask getFileTask = new CommonTask(RequestServiceList.ATTACHMENT_DELETE, params);
            executeRequest(getFileTask);
        }
    }
}