正在查看: 六分钟步行测试管理软件 v1.1.0.2112120029 应用的 PatientDetailActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 六分钟步行测试管理软件 v1.1.0.2112120029 应用的 PatientDetailActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package cn.neoprint.padmonitor.ui;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.text.InputFilter;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RadioGroup;
import android.widget.TextView;
import android.widget.Toast;
import cn.neoprint.padmonitor.R;
import cn.neoprint.padmonitor.data.DataRepository;
import cn.neoprint.padmonitor.data.entity.PatientEntity;
import cn.neoprint.padmonitor.data.entity.ReportEntity;
import cn.neoprint.padmonitor.ui.base.BaseDialogActivity;
import cn.neoprint.padmonitor.utils.DateUtils;
import cn.neoprint.padmonitor.utils.SpaceFilter;
import com.blankj.utilcode.util.ClickUtils;
import com.blankj.utilcode.util.KeyboardUtils;
import com.jzxiang.pickerview.TimePickerDialog;
import com.jzxiang.pickerview.data.Type;
import com.jzxiang.pickerview.listener.OnDateSetListener;
import com.sayeasytech.base.base.Layout;
import com.sayeasytech.base.log.KLog;
import java.util.Iterator;
import java.util.List;
import org.greenrobot.eventbus.EventBus;
public class PatientDetailActivity extends BaseDialogActivity {
public EditText etPatientAge;
public EditText etPatientCaseId;
public EditText etPatientClinicalDiagnosis;
public EditText etPatientCurrentMedication;
public EditText etPatientHealthInsurance;
public EditText etPatientHeight;
public TextView etPatientIdCard;
public EditText etPatientMedicalHistory;
public EditText etPatientName;
public EditText etPatientPhoneNumber;
public EditText etPatientStepPitch;
public EditText etPatientWeight;
private boolean isLocked = false;
public PatientEntity patient;
public RadioGroup rgPatientGender;
public TextView tvPatientBirth;
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
long longExtra = getIntent().getLongExtra("patient_id", -1L);
if (longExtra < 0) {
KLog.e("can't find this patient id: " + longExtra);
finish();
return;
}
List<PatientEntity> query = DataRepository.getInstance().getPatientDao().query(longExtra);
if (query.size() < 1) {
KLog.e("can't find this patient id: " + longExtra);
finish();
return;
}
PatientEntity patientEntity = query.get(0);
this.patient = patientEntity;
patientEntity.setAge(DateUtils.yearsSpan1(patientEntity.getBirth().longValue(), System.currentTimeMillis()));
KLog.i("get patient: " + this.patient);
List<ReportEntity> query2 = DataRepository.getInstance().getReportDao().query(this.patient.getIdCard());
if (query2 != null && query2.size() > 0) {
this.isLocked = true;
}
EditText editText = (EditText) findViewById(R.id.et_patient_name);
this.etPatientName = editText;
editText.setText(this.patient.getName());
this.etPatientName.setFilters(new InputFilter[]{new SpaceFilter()});
EditText editText2 = (EditText) findViewById(R.id.et_patient_case_id);
this.etPatientCaseId = editText2;
editText2.setText(this.patient.getCaseId());
this.etPatientCaseId.setFilters(new InputFilter[]{new SpaceFilter()});
TextView textView = (TextView) findViewById(R.id.et_patient_id_card);
this.etPatientIdCard = textView;
textView.setText(this.patient.getIdCard());
this.etPatientIdCard.setEnabled(!this.isLocked);
RadioGroup radioGroup = (RadioGroup) findViewById(R.id.rg_patient_gender);
this.rgPatientGender = radioGroup;
radioGroup.check(this.patient.getGender().equals(getString(R.string.woman)) ? R.id.rb_woman : R.id.rb_man);
EditText editText3 = (EditText) findViewById(R.id.et_patient_age);
this.etPatientAge = editText3;
editText3.setText(this.patient.getAge() > 0 ? String.valueOf(this.patient.getAge()) : "");
TextView textView2 = (TextView) findViewById(R.id.tv_patient_birth);
this.tvPatientBirth = textView2;
textView2.setText(DateUtils.longToYearMonthDay(this.patient.getBirth().longValue()));
this.tvPatientBirth.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
PatientDetailActivity.this.m227xb68ac43d(view);
}
});
EditText editText4 = (EditText) findViewById(R.id.et_patient_height);
this.etPatientHeight = editText4;
editText4.setText(String.valueOf((int) this.patient.getHeight()));
EditText editText5 = (EditText) findViewById(R.id.et_patient_weight);
this.etPatientWeight = editText5;
editText5.setText(String.valueOf(this.patient.getWeight()));
EditText editText6 = (EditText) findViewById(R.id.et_patient_health_insurance);
this.etPatientHealthInsurance = editText6;
editText6.setFilters(new InputFilter[]{new SpaceFilter()});
if (!TextUtils.isEmpty(this.patient.getHealthInsuranceId())) {
this.etPatientHealthInsurance.setText(this.patient.getHealthInsuranceId());
}
EditText editText7 = (EditText) findViewById(R.id.et_medical_history);
this.etPatientMedicalHistory = editText7;
editText7.setFilters(new InputFilter[]{new SpaceFilter()});
if (!TextUtils.isEmpty(this.patient.getMedicalHistory())) {
this.etPatientMedicalHistory.setText(this.patient.getMedicalHistory());
}
EditText editText8 = (EditText) findViewById(R.id.et_clinical_diagnosis);
this.etPatientClinicalDiagnosis = editText8;
editText8.setFilters(new InputFilter[]{new SpaceFilter()});
if (!TextUtils.isEmpty(this.patient.getClinicalDiagnosis())) {
this.etPatientClinicalDiagnosis.setText(this.patient.getClinicalDiagnosis());
}
EditText editText9 = (EditText) findViewById(R.id.et_current_medication);
this.etPatientCurrentMedication = editText9;
editText9.setFilters(new InputFilter[]{new SpaceFilter()});
if (!TextUtils.isEmpty(this.patient.getCurrentMedication())) {
this.etPatientCurrentMedication.setText(this.patient.getCurrentMedication());
}
this.etPatientStepPitch = (EditText) findViewById(R.id.et_step_pitch);
if (this.patient.getStepPitch() > 0.0d) {
this.etPatientStepPitch.setText(String.valueOf((int) this.patient.getStepPitch()));
}
EditText editText10 = (EditText) findViewById(R.id.et_patient_phone_number);
this.etPatientPhoneNumber = editText10;
editText10.setFilters(new InputFilter[]{new SpaceFilter()});
if (!TextUtils.isEmpty(this.patient.getPhoneNumber())) {
this.etPatientPhoneNumber.setText(this.patient.getPhoneNumber());
}
((Button) findViewById(R.id.back_btn)).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
PatientDetailActivity.this.m228xb6145e3e(view);
}
});
((Button) findViewById(R.id.update_patient_btn)).setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
PatientDetailActivity.this.m229xb59df83f(view);
}
});
setName();
}
public void m227xb68ac43d(View view) {
new TimePickerDialog.Builder().setType(Type.YEAR_MONTH_DAY).setThemeColor(getResources().getColor(R.color.main_blue)).setTitleStringId(getString(R.string.picker_title)).setSureStringId(getString(R.string.picker_sure)).setCancelStringId(getString(R.string.picker_cancel)).setDayText(getString(R.string.picker_day)).setHourText(getString(R.string.picker_hour)).setMinuteText(getString(R.string.picker_minute)).setMonthText(getString(R.string.picker_month)).setYearText(getString(R.string.picker_year)).setWheelItemTextSize(20).setMinMillseconds(System.currentTimeMillis() - 3153600000000L).setMaxMillseconds(System.currentTimeMillis()).setCurrentMillseconds(this.patient.getBirth().longValue()).setCallBack(new OnDateSetListener() {
public final void onDateSet(TimePickerDialog timePickerDialog, long j) {
PatientDetailActivity.this.m226xb7012a3c(timePickerDialog, j);
}
}).build().show(getSupportFragmentManager(), "patient_detail_year_month_day");
}
public void m226xb7012a3c(TimePickerDialog timePickerDialog, long j) {
this.tvPatientBirth.setText(DateUtils.longToYearMonthDay(j));
this.etPatientAge.setText(String.valueOf(DateUtils.yearsSpan1(j, System.currentTimeMillis())));
}
public void m228xb6145e3e(View view) {
finish();
}
public void m229xb59df83f(View view) {
if (!isNeedInfoReady()) {
Toast.makeText((Context) this, R.string.please_input_necessary_info, 0).show();
return;
}
if (!isIdCardUnique()) {
Toast.makeText((Context) this, R.string.please_check_id_card, 0).show();
return;
}
if (!isCaseIdUnique()) {
Toast.makeText((Context) this, R.string.please_check_case_id, 0).show();
return;
}
this.patient.setName(this.etPatientName.getText().toString());
this.patient.setCaseId(this.etPatientCaseId.getText().toString());
this.patient.setGender(getString(this.rgPatientGender.getCheckedRadioButtonId() == 2131363161 ? R.string.woman : R.string.man));
this.patient.setAge(Integer.parseInt(this.etPatientAge.getText().toString()));
this.patient.setBirth(Long.valueOf(DateUtils.yearMonthDayStrToLong(this.tvPatientBirth.getText().toString())));
this.patient.setHeight(Double.parseDouble(this.etPatientHeight.getText().toString()));
this.patient.setWeight(Double.parseDouble(this.etPatientWeight.getText().toString()));
this.patient.setHealthInsuranceId(this.etPatientHealthInsurance.getText().toString());
String obj = this.etPatientStepPitch.getText().toString();
if (!TextUtils.isEmpty(obj) && Double.parseDouble(obj) > 0.0d) {
this.patient.setStepPitch(Double.parseDouble(obj));
} else {
this.patient.setStepPitch(0.0d);
}
this.patient.setPhoneNumber(this.etPatientPhoneNumber.getText().toString());
this.patient.setMedicalHistory(this.etPatientMedicalHistory.getText().toString());
this.patient.setClinicalDiagnosis(this.etPatientClinicalDiagnosis.getText().toString());
this.patient.setCurrentMedication(this.etPatientCurrentMedication.getText().toString());
DataRepository.getInstance().getPatientDao().update(this.patient);
EventBus.getDefault().post(this.patient);
KLog.i("update patient: " + this.patient);
finish();
}
private void setName() {
ClickUtils.applySingleDebouncing(findViewById(R.id.tv_patient_name), new View.OnClickListener() {
@Override
public final void onClick(View view) {
PatientDetailActivity.this.m230lambda$setName$4$cnneoprintpadmonitoruiPatientDetailActivity(view);
}
});
}
public void m230lambda$setName$4$cnneoprintpadmonitoruiPatientDetailActivity(View view) {
startActivityForResult(new Intent((Context) this, (Class<?>) VerifyAdminPasswordActivity.class), 101);
}
protected Layout getLayout() {
return Layout.createLayoutByID(R.layout.activity_patient_detail);
}
@Override
public void finish() {
super.finish();
overridePendingTransition(0, R.anim.zoomout);
}
private boolean isNeedInfoReady() {
return (TextUtils.isEmpty(this.etPatientName.getText().toString()) || TextUtils.isEmpty(this.etPatientCaseId.getText().toString()) || TextUtils.isEmpty(this.etPatientAge.getText().toString()) || Integer.parseInt(this.etPatientAge.getText().toString()) <= 0 || TextUtils.isEmpty(this.etPatientHeight.getText().toString()) || Double.parseDouble(this.etPatientHeight.getText().toString()) <= 0.0d || TextUtils.isEmpty(this.etPatientWeight.getText().toString()) || Double.parseDouble(this.etPatientWeight.getText().toString()) <= 0.0d) ? false : true;
}
private boolean isCaseIdUnique() {
Iterator<PatientEntity> it = DataRepository.getInstance().getPatientDao().queryByCaseId(this.etPatientCaseId.getText().toString()).iterator();
while (it.hasNext()) {
if (!it.next().getId().equals(this.patient.getId())) {
return false;
}
}
return true;
}
private boolean isIdCardUnique() {
Iterator<PatientEntity> it = DataRepository.getInstance().getPatientDao().query(this.etPatientIdCard.getText().toString()).iterator();
while (it.hasNext()) {
if (!it.next().getId().equals(this.patient.getId())) {
return false;
}
}
return true;
}
protected void onActivityResult(int i, int i2, Intent intent) {
super.onActivityResult(i, i2, intent);
if (i2 == 10 && i == 101) {
findViewById(R.id.tv_patient_name).setVisibility(8);
KeyboardUtils.showSoftInput(this.etPatientName);
EditText editText = this.etPatientName;
editText.setSelection(editText.getText().length());
}
}
}