Ejemplo n.º 1
0
  private void submit() {

    String hospital = mEtHospital.getText().toString();
    if (TextUtils.isEmpty(hospital)) {
      mActivity.showToast("请填写医疗机构");
      return;
    }
    String checkDate = DateFormatUtils.timeToLongString(mTvDate.getText().toString());
    PostAddReportItem postAddReportItem = new PostAddReportItem();
    if (mImageFilePaths.size() > 0) {
      List<File> files = new LinkedList<>();
      for (int i = 0; i < mImageFilePaths.size() - 1; i++) // -1的目的去除默认的+
      {
        File file = new File(mImageFilePaths.get(i));
        if (file != null && file.exists()) {
          files.add(file);
        }
      }
      postAddReportItem.files = files;
    }
    postAddReportItem.checkTime = checkDate;
    postAddReportItem.name = mTvDate.getText().toString() + "的检查报告";
    postAddReportItem.institution = hospital;
    postAddReportItem.userId = RSAUtil.clientEncrypt(mActivity.getLoginSuccessItem().id);
    SubmitAddReportPresenter submitAddReportPresenter =
        new SubmitAddReportPresenterImpl(mActivity, this, REQUEST_SUBMIT_TAG);
    submitAddReportPresenter.doAddReport(postAddReportItem);
  }
 @Override
 public void doGetUserMedicalDetail(String id) {
   String userCounselUrl = APIURL.GET_USER_MEDICAL_DETAIL_URL;
   PostItem postItem = new PostItem();
   postItem.userId = mActivity.getLoginSuccessItem().id;
   postItem.id = id;
   String mingPostBody = GsonUtils.toJson(postItem);
   System.out.println("mingPostBody = " + mingPostBody);
   String postBody = RSAUtil.clientEncrypt(mingPostBody);
   System.out.println("postBody = " + postBody);
   RequestUtils.getDataFromUrlByPostWithLoginInfo(
       mActivity,
       userCounselUrl,
       postBody,
       mActivity.getLoginSuccessItem(),
       mDataView,
       mRequestTag);
 }