正在查看: 六分钟步行测试管理软件 v1.1.0.2112120029 应用的 WalkTestReportNewActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 六分钟步行测试管理软件 v1.1.0.2112120029 应用的 WalkTestReportNewActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package cn.neoprint.padmonitor.ui;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.DashPathEffect;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.media.session.PlaybackStateCompat;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import androidx.exifinterface.media.ExifInterface;
import androidx.recyclerview.widget.LinearLayoutManager;
import cn.neoprint.padmonitor.R;
import cn.neoprint.padmonitor.adapter.ExerciseIntensityAdapter;
import cn.neoprint.padmonitor.app.AppGlobal;
import cn.neoprint.padmonitor.bean.ExerciseIntensityBean;
import cn.neoprint.padmonitor.corealgorithm.PanTompkinsForEcg;
import cn.neoprint.padmonitor.corealgorithm.RespPeakCal;
import cn.neoprint.padmonitor.data.DataRepository;
import cn.neoprint.padmonitor.data.entity.EcgMarkEntity;
import cn.neoprint.padmonitor.data.entity.HospitalEntity;
import cn.neoprint.padmonitor.data.entity.HrvStatisticDataEntity;
import cn.neoprint.padmonitor.data.entity.PatientEntity;
import cn.neoprint.padmonitor.data.entity.PatientEntityDao;
import cn.neoprint.padmonitor.data.entity.ReportDataEntity;
import cn.neoprint.padmonitor.data.entity.ReportEntity;
import cn.neoprint.padmonitor.data.entity.ReportParaEntity;
import cn.neoprint.padmonitor.data.entity.TestWaveDataLists;
import cn.neoprint.padmonitor.databinding.ActivityWalkTestReportGzBinding;
import cn.neoprint.padmonitor.databinding.IncludeExerciseIntensityBinding;
import cn.neoprint.padmonitor.databinding.IncludeMarkEcgBinding;
import cn.neoprint.padmonitor.kthelper.EcgHelper;
import cn.neoprint.padmonitor.pdf.PrintPdfKt;
import cn.neoprint.padmonitor.presenter.ReportPresenter;
import cn.neoprint.padmonitor.thread.CSVOpThread_gz;
import cn.neoprint.padmonitor.ui.WalkTestReportNewActivity;
import cn.neoprint.padmonitor.ui.fragment.HrvStatisticTableDataAdapter;
import cn.neoprint.padmonitor.ui.fragment.ReportTableDataAdapter;
import cn.neoprint.padmonitor.ui.view.BorgGradePopupWindow;
import cn.neoprint.padmonitor.ui.view.BreathGradePopupWindow;
import cn.neoprint.padmonitor.ui.view.KnowledgePop;
import cn.neoprint.padmonitor.ui.view.ReportParasPopupWindow;
import cn.neoprint.padmonitor.ui.view.SelectEcgChannelPopupWindow;
import cn.neoprint.padmonitor.utils.DateUtils;
import cn.neoprint.padmonitor.utils.DialogUtils;
import cn.neoprint.padmonitor.utils.DisplayUtils;
import cn.neoprint.padmonitor.utils.FileUtils;
import cn.neoprint.padmonitor.utils.IDCardInfoExtractor;
import cn.neoprint.padmonitor.utils.LogFile;
import cn.neoprint.padmonitor.utils.SixMinUtils;
import cn.neoprint.padmonitor.utils.ThreadPoolUtils;
import cn.neoprint.padmonitor.utils.ToastUtils;
import cn.neoprint.padmonitor.utils.constant.ConstDefine;
import cn.neoprint.padmonitor.utils.constant.Constants;
import cn.neoprint.padmonitor.utils.constant.GzjSharePref;
import com.blankj.utilcode.util.ClickUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.github.gcacace.signaturepad.views.SignaturePad;
import com.github.mikephil.charting.charts.BarChart;
import com.github.mikephil.charting.charts.LineChart;
import com.github.mikephil.charting.charts.ScatterChart;
import com.github.mikephil.charting.components.Legend;
import com.github.mikephil.charting.components.XAxis;
import com.github.mikephil.charting.components.YAxis;
import com.github.mikephil.charting.data.BarData;
import com.github.mikephil.charting.data.BarDataSet;
import com.github.mikephil.charting.data.BarEntry;
import com.github.mikephil.charting.data.Entry;
import com.github.mikephil.charting.data.LineData;
import com.github.mikephil.charting.data.LineDataSet;
import com.github.mikephil.charting.data.ScatterData;
import com.github.mikephil.charting.data.ScatterDataSet;
import com.github.mikephil.charting.formatter.DefaultValueFormatter;
import com.github.mikephil.charting.formatter.IFillFormatter;
import com.github.mikephil.charting.formatter.ValueFormatter;
import com.github.mikephil.charting.interfaces.dataprovider.LineDataProvider;
import com.github.mikephil.charting.interfaces.datasets.ILineDataSet;
import com.github.mikephil.charting.utils.ColorTemplate;
import com.github.mikephil.charting.utils.EntryXComparator;
import com.sayeasytech.base.base.BaseActivity;
import com.sayeasytech.base.base.Layout;
import com.sayeasytech.base.log.KLog;
import com.sayeasytech.base.utils.FileUtil;
import com.sayeasytech.base.utils.ImageUtils;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Vector;
public class WalkTestReportNewActivity extends BaseActivity {
private static final double FEMALE_STANDARD_HEIGHT = 160.0d;
private static final double FEMALE_STANDARD_STEP_COUNT = 60.0d;
private static final int JG_TIME = 5000;
private static final double MALE_STANDARD_HEIGHT = 180.0d;
private static final double MALE_STANDARD_STEP_COUNT = 70.0d;
private static final int SHOW_TIME_STAGE = 96;
public long afterMidTime;
public long beforeMidTime;
public ActivityWalkTestReportGzBinding binding;
public String borgGradeScore;
public String borgScoreAndDescription;
public String breathGradeScore;
public String breathScoreAndDescription;
public String cardiopulmonarySummary;
public int circleDistance;
public long currentTime;
public DataFactory dataFactory;
public StringBuilder distanceList;
public long fastTime;
private int gainType;
private String gainTypeStr;
public HospitalEntity hospitalEntity;
public String hr_chronctropic_index;
public String hr_recovery_rate;
public String hr_reverse;
private boolean isCb1;
private boolean isCb2;
private boolean isCb3;
private boolean isCb4;
private boolean isCb5;
private boolean isCb6;
private boolean isCb7;
private boolean isCb8;
private boolean isChecked3;
private boolean isChecked4;
private boolean isChecked5;
private boolean isManualInputNibp;
private double manualInputStepPitch;
private double manualInputTotalDistance;
public long mark1Time;
public long mark2Time;
public long mark3Time;
public long mark4Time;
private IncludeMarkEcgBinding markHr;
public String mets;
public PanTompkinsForEcg.PanTompkinsForEcgResult panTompkinsForEcgResult;
public PatientEntity patient;
public ReportEntity reportEntity;
public ReportParaEntity reportParaEntity;
public String reportSummary;
public ReportTableDataAdapter reportTableDataAdapter;
public RespPeakCal.RespPeakCalResult respPeakCalResult;
public int signatureType;
public long slowTime;
public int speedType;
private String speedTypeStr;
public String sportsSummary;
public long start1Time;
public long start2Time;
public long start3Time;
public long start4Time;
public long start5Time;
public long start6Time;
public long startTime;
public StringBuilder stepCountList;
public double stepPitch;
private String stopCause;
private byte[] testData;
private int timeRemaining;
public int totalCircle;
public double totalDistance;
public int totalStepCount;
private long waveDataLength;
private float ydpi;
private static final String CURRENT_POINT_FILE = ConstDefine.SD_PATH + "/WalkTest/WaveReviewpoint.dat";
private static final String CURRENT_DATA_FILE = ConstDefine.SD_PATH + "/WalkTest/WaveReview.dat";
public List<ReportDataEntity> reportDataEntityList = new ArrayList();
public List<HrvStatisticDataEntity> hrvStatisticDataEntityList = new ArrayList();
public String title1 = "";
public String title2 = "";
private long dataTime = 0;
private long originalPoint = 0;
public List<Integer> ecgIList = new Vector();
public List<Integer> ecgIIList = new Vector();
public List<Integer> ecgIIIList = new Vector();
public List<Integer> ecgVList = new Vector();
public List<Integer> ecgAVLList = new Vector();
public List<Integer> ecgAVFList = new Vector();
public List<Integer> ecgAVRList = new Vector();
private byte[] fileData = null;
private final int WAVE_DATA_LEN_8MIN = 983040;
private final int WAVE_DATA_LEN_4S = 8192;
private final int WAVE_DATA_COUNT_4S = 500;
private final int WAVE_DATA_FILE_LENGTH = 530841600;
public List<EcgMarkEntity> ecgMarkEntityList = new ArrayList();
public List<Integer> testSpo2WaveDataList = new ArrayList();
public List<Integer> testRespWaveDataList = new ArrayList();
private File mFile = null;
private int length = 0;
private FileChannel mChannel = null;
private MappedByteBuffer out = null;
private List<Byte> waveDataTypeList = Arrays.asList((byte) 1, (byte) 2, (byte) 3, (byte) 5, (byte) 4, (byte) 6, (byte) 7);
private List<Integer> oriStepCountList = new ArrayList();
private List<Integer> calStepCountList = new ArrayList();
private boolean isTryCatch = false;
public boolean isSport = false;
private List<Float> oriDistanceList = new ArrayList();
private List<Float> calDistanceList = new ArrayList();
private List<String> bpList = new ArrayList();
public List<Integer> spo2MeanList = new ArrayList();
EcgHelper ecgHelper = new EcgHelper();
public Handler handler = new Handler();
private ReportPresenter reportPresenter = new ReportPresenter();
protected Layout getLayout() {
return null;
}
public int merge(byte b, byte b2) {
return ((b << 8) | (b2 & 255)) & 65535;
}
protected void onCreate(Bundle bundle) {
float maleStepPitch;
double d;
double d2;
double d3;
super.onCreate(bundle);
ActivityWalkTestReportGzBinding inflate = ActivityWalkTestReportGzBinding.inflate(getLayoutInflater());
this.binding = inflate;
setContentView(inflate.getRoot());
this.markHr = this.binding.markHr;
IncludeExerciseIntensityBinding includeExerciseIntensityBinding = this.binding.includeExerciseIntensity;
KLog.d("get into walk test report activity");
if (getIntent().getExtras() == null) {
KLog.e("can't get report bundle data");
showMessage(R.string.can_not_get_report_data);
return;
}
Bundle extras = getIntent().getExtras();
if (extras.getLong("create_time") > 0) {
this.isSport = false;
this.currentTime = extras.getLong("create_time");
String string = extras.getString("patient_idcard");
this.patient = DataRepository.getInstance().getPatientDao().query(string).get(0);
KLog.i("review report, get patient: " + this.patient);
ReportEntity reportEntity = DataRepository.getInstance().getReportDao().query(string, this.currentTime).get(0);
this.reportEntity = reportEntity;
if (!TextUtils.isEmpty(reportEntity.getStepCountList()) && this.reportEntity.getStepCountList().split(",").length > 0) {
for (String str : this.reportEntity.getStepCountList().split(",")) {
this.oriStepCountList.add(Integer.valueOf(Integer.parseInt(str)));
}
}
for (String str2 : this.reportEntity.getDistanceList().split(",")) {
this.oriDistanceList.add(Float.valueOf(str2));
}
this.totalCircle = this.reportEntity.getTotalCircle();
this.circleDistance = this.reportEntity.getCircleDistance();
Collections.addAll(this.bpList, this.reportEntity.getBpList().split(","));
this.isManualInputNibp = this.reportEntity.getIsManualInputNibp();
this.stopCause = this.reportEntity.getStopCause();
this.timeRemaining = this.reportEntity.getTimeRemaining();
this.manualInputTotalDistance = this.reportEntity.getManualInputTotalDistance().doubleValue();
this.manualInputStepPitch = this.reportEntity.getManualInputStepPitch().doubleValue();
this.signatureType = this.reportEntity.getSignatureType();
KLog.i("review report, current_time: " + this.currentTime + ", step_count_list: " + this.oriStepCountList + ", distance array: " + this.oriDistanceList + ", total_circle: " + this.totalCircle + ", circle_distance: " + this.circleDistance + ", bp_list: " + this.bpList + ", is_manual_input_nibp: " + this.isManualInputNibp + ", stop_cause: " + this.stopCause + ", time_remaining: " + this.timeRemaining + ", manualInputTotalDistance: " + this.manualInputTotalDistance + ", manualInputStepPitch: " + this.manualInputStepPitch + ", signatureType: " + this.signatureType);
List<ReportParaEntity> query = DataRepository.getInstance().getReportParaDao().query(string, this.currentTime);
if (query != null && query.size() > 0) {
ReportParaEntity reportParaEntity = query.get(0);
this.reportParaEntity = reportParaEntity;
reportParaEntity.checkMe();
KLog.i("get history report parameters: " + this.reportParaEntity);
} else {
KLog.e("can't history report parameters!!!");
showMessage(R.string.can_not_get_report_para);
finish();
return;
}
} else {
this.isSport = true;
this.currentTime = extras.getLong("current_time", System.currentTimeMillis());
this.oriStepCountList = extras.getIntegerArrayList("step_count_list");
float[] floatArray = extras.getFloatArray("distance_array");
if (floatArray != null) {
int length = floatArray.length;
int i = 0;
while (i < length) {
this.oriDistanceList.add(Float.valueOf(floatArray[i]));
i++;
floatArray = floatArray;
}
}
this.totalCircle = extras.getInt("total_circle", 0);
this.circleDistance = extras.getInt("circle_distance", 0);
this.bpList = extras.getStringArrayList("bp_list");
this.isManualInputNibp = extras.getBoolean("is_manual_input_nibp", false);
this.stopCause = extras.getString("stop_cause");
this.timeRemaining = extras.getInt("time_remaining", 0);
KLog.i("current_time: " + this.currentTime + ", step_count_list: " + this.oriStepCountList + ", distance array: " + this.oriDistanceList + ", total_circle: " + this.totalCircle + ", circle_distance: " + this.circleDistance + ", bp_list: " + this.bpList + ", is_manual_input_nibp: " + this.isManualInputNibp + ", stop_cause: " + this.stopCause + ", time_remaining: " + this.timeRemaining);
this.patient = (PatientEntity) extras.getSerializable(PatientEntityDao.TABLENAME);
KLog.i("get patient: " + this.patient);
this.reportParaEntity = new ReportParaEntity(this.patient.getIdCard(), Long.valueOf(this.currentTime), GzjSharePref.getIntValueByDefault(this, GzjSharePref.KEY_PREDICT_DISTANCE, 600), GzjSharePref.getFloatValueByDefault(this, GzjSharePref.KEY_MALE_STEP_PITCH, 65.0f), GzjSharePref.getFloatValueByDefault(this, GzjSharePref.KEY_FEMALE_STEP_PITCH, 60.0f), GzjSharePref.getIntValueByDefault(this, GzjSharePref.KEY_ONCE_ROUTE, 20), GzjSharePref.getIntValueByDefault(this, GzjSharePref.KEY_WORKSTATION_POSITION, 10), GzjSharePref.getIntValueByDefault(this, GzjSharePref.KEY_TEST_DURATION, 6) + 2, GzjSharePref.getBoolValue((Context) this, GzjSharePref.KEY_HIDE_STEP_COUNT), GzjSharePref.getBoolValueByDefault(this, GzjSharePref.KEY_HIDE_EVERY_STEP_COUNT, true), GzjSharePref.getBoolValue((Context) this, GzjSharePref.KEY_HIDE_MET), GzjSharePref.getBoolValueByDefault(this, GzjSharePref.KEY_HIDE_EXERCISE_PRESCRIPTION, true), GzjSharePref.getBoolValueByDefault(this, GzjSharePref.KEY_HIDE_HR, true), GzjSharePref.getBoolValueByDefault(this, GzjSharePref.KEY_HIDE_BEFORE_HR, true), GzjSharePref.getBoolValueByDefault(this, GzjSharePref.KEY_HIDE_AFTER_HR, true), GzjSharePref.getBoolValueByDefault(this, GzjSharePref.KEY_HIDE_START_EVERY_HR, true), GzjSharePref.getBoolValueByDefault(this, GzjSharePref.KEY_HIDE_TREND, true), GzjSharePref.getBoolValueByDefault(this, GzjSharePref.KEY_HIDE_RR_STATISTIC, true), GzjSharePref.getIntValueByDefault(this, "ecgfilter", 1), GzjSharePref.getIntValueByDefault(this, GzjSharePref.KEY_CAL_ECG_GAIN, 1), GzjSharePref.getIntValueByDefault(this, GzjSharePref.KEY_REPORT_ECG_GAIN_TYPE, 2), GzjSharePref.getIntValueByDefault(this, GzjSharePref.KEY_CIRCLE_COUNTER_MODE, 0), GzjSharePref.getIntValueByDefault(this, GzjSharePref.KEY_ECG_SPEED_TYPE, 1), "");
KLog.i("current report parameters: " + this.reportParaEntity);
}
this.stepCountList = new StringBuilder();
for (int i2 = 0; i2 < this.oriStepCountList.size(); i2++) {
this.stepCountList.append(this.oriStepCountList.get(i2));
if (i2 < this.oriStepCountList.size() - 1) {
this.stepCountList.append(",");
}
}
this.distanceList = new StringBuilder();
for (int i3 = 0; i3 < this.oriDistanceList.size(); i3++) {
this.distanceList.append(this.oriDistanceList.get(i3));
if (i3 < this.oriDistanceList.size() - 1) {
this.distanceList.append(",");
}
}
this.speedType = this.reportParaEntity.getSpeedType();
int testDuration = this.reportParaEntity.getTestDuration();
int i4 = this.speedType;
long j = 8000;
if (i4 == 1) {
j = 16000;
} else if (i4 != 2 && i4 == 3) {
j = 4000;
}
long j2 = ((testDuration * 60) * 1000) - (this.timeRemaining * 1000);
this.waveDataLength = (PlaybackStateCompat.ACTION_PLAY_FROM_URI * j2) / 4000;
long j3 = this.currentTime;
long j4 = j3 - j2;
this.startTime = j4;
long j5 = j4 + 0;
this.beforeMidTime = j5;
if (j5 + j > j3) {
j5 = 0;
}
this.beforeMidTime = j5;
long j6 = j4 + 0 + 60000;
this.start1Time = j6;
if (j6 + j > j3) {
j6 = 0;
}
this.start1Time = j6;
long j7 = j4 + 0 + 120000;
this.start2Time = j7;
if (j7 + j > j3) {
j7 = 0;
}
this.start2Time = j7;
long j8 = j4 + 0 + 180000;
this.start3Time = j8;
if (j8 + j > j3) {
j8 = 0;
}
this.start3Time = j8;
long j9 = j4 + 0 + 240000;
this.start4Time = j9;
if (j9 + j > j3) {
j9 = 0;
}
this.start4Time = j9;
long j10 = j4 + 0 + 300000;
this.start5Time = j10;
if (j10 + j > j3) {
j10 = 0;
}
this.start5Time = j10;
long j11 = j4 + 0 + 360000;
this.start6Time = j11;
if (j11 + j > j3) {
j11 = 0;
}
this.start6Time = j11;
long j12 = j4 + 0 + 420000;
this.afterMidTime = j12;
if (j + j12 > j3) {
j12 = 0;
}
this.afterMidTime = j12;
KLog.i("testDuration: " + j2 + ", waveDataLength: " + this.waveDataLength + ", startTime: " + this.startTime + ", beforeMidTime: " + this.beforeMidTime + ", start1Time: " + this.start1Time + ", start2Time: " + this.start2Time + ", start3Time: " + this.start3Time + ", start4Time: " + this.start4Time + ", start5Time: " + this.start5Time + ", start6Time: " + this.start6Time + ", afterMidTime: " + this.afterMidTime);
ClickUtils.applySingleDebouncing(this.binding.reviewWaveBtn, new View.OnClickListener() {
@Override
public final void onClick(View view) {
WalkTestReportNewActivity.this.m291x5cae1017(view);
}
});
ClickUtils.applySingleDebouncing(this.binding.reAnalysisBtn, new View.OnClickListener() {
@Override
public final void onClick(View view) {
WalkTestReportNewActivity.this.m300x77237319(view);
}
});
ClickUtils.applySingleDebouncing(this.binding.reviewTrendBtn, new View.OnClickListener() {
@Override
public final void onClick(View view) {
WalkTestReportNewActivity.this.m301x45e249a(view);
}
});
ClickUtils.applySingleDebouncing(this.binding.scoreGradeBtn, new View.OnClickListener() {
@Override
public final void onClick(View view) {
WalkTestReportNewActivity.this.m302x9198d61b(view);
}
});
ClickUtils.applySingleDebouncing(this.binding.reportParasBtn, new View.OnClickListener() {
@Override
public final void onClick(View view) {
WalkTestReportNewActivity.this.m303x1ed3879c(view);
}
});
this.binding.completeTestBtn.setText(this.reportEntity == null ? R.string.complete_walk_test : R.string.save_change);
ClickUtils.applySingleDebouncing(this.binding.completeTestBtn, new View.OnClickListener() {
@Override
public final void onClick(View view) {
WalkTestReportNewActivity.this.m304xac0e391d(view);
}
});
ClickUtils.applySingleDebouncing(this.binding.btnOutputCsv, new View.OnClickListener() {
@Override
public final void onClick(View view) {
WalkTestReportNewActivity.this.m305x3948ea9e(view);
}
});
this.binding.btnOutputCsv.setVisibility(GzjSharePref.getBoolValueByDefault(this, GzjSharePref.KEY_ENABLE_REPORT_OUTPUT_CSV, true) ? 0 : 8);
this.binding.cancelTestBtn.setText(this.reportEntity == null ? R.string.cancel_walk_test : R.string.cancel_save);
ClickUtils.applySingleDebouncing(this.binding.cancelTestBtn, new View.OnClickListener() {
@Override
public final void onClick(View view) {
WalkTestReportNewActivity.this.m306xc6839c1f(view);
}
});
ClickUtils.applySingleDebouncing(this.binding.printReportBtn, new View.OnClickListener() {
@Override
public final void onClick(View view) {
WalkTestReportNewActivity.this.m307x53be4da0(view);
}
});
this.binding.btnKnow.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
WalkTestReportNewActivity.this.m293xbe476e5e(view);
}
});
this.dataFactory = new DataFactory();
List<HospitalEntity> query2 = DataRepository.getInstance().getHospitalDao().query();
if (query2 != null && query2.size() > 0) {
this.hospitalEntity = query2.get(0);
} else {
this.hospitalEntity = new HospitalEntity();
}
String hospitalName = this.hospitalEntity.getHospitalName() == null ? "" : this.hospitalEntity.getHospitalName();
TextView textView = this.binding.hospitalNameTv;
if (TextUtils.isEmpty(hospitalName)) {
hospitalName = getString(R.string.hospital_info_description);
}
textView.setText(hospitalName);
String hospitalAddress = this.hospitalEntity.getHospitalAddress() == null ? "" : this.hospitalEntity.getHospitalAddress();
String hospitalTel = this.hospitalEntity.getHospitalTel() == null ? "" : this.hospitalEntity.getHospitalTel();
if (TextUtils.isEmpty(hospitalAddress)) {
hospitalAddress = "";
}
if (!TextUtils.isEmpty(hospitalTel)) {
hospitalAddress = String.format("%s\n%s", hospitalAddress, hospitalTel);
}
this.binding.hospitalInfoTv.setText(hospitalAddress);
this.binding.patientName.setText(String.format("%s: %s", getString(R.string.name), this.patient.getName()));
this.binding.patientCaseId.setText(String.format("%s %s", getString(R.string.case_id_), this.patient.getCaseId()));
this.binding.patientIdCard.setText(String.format("%s: %s", AppGlobal.getInstance().getString(R.string.id_card), IDCardInfoExtractor.hideId(this.patient.getIdCard())));
this.binding.patientGender.setText(String.format("%s: %s", getString(R.string.gender), this.patient.getGender()));
this.binding.patientAge.setText(String.format("%s: %s", getString(R.string.age), Integer.valueOf(DateUtils.yearsSpan1(this.patient.getBirth().longValue(), this.currentTime))) + "岁");
this.binding.patientBirth.setText(String.format("%s %s", AppGlobal.getInstance().getString(R.string.birth_), DateUtils.longToYearMonthDay(this.patient.getBirth().longValue())));
this.binding.patientHeight.setText(String.format("%s %s%s", AppGlobal.getInstance().getString(R.string.height_), Integer.valueOf((int) this.patient.getHeight()), AppGlobal.getInstance().getString(R.string.height_unit)));
this.binding.patientWeight.setText(String.format("%s %s%s", AppGlobal.getInstance().getString(R.string.weight_), Double.valueOf(this.patient.getWeight()), AppGlobal.getInstance().getString(R.string.weight_unit)));
this.binding.patientBmi.setText(String.format("%s %s", AppGlobal.getInstance().getString(R.string.bmi_), String.format("%.1f", Double.valueOf(this.patient.getWeight() / (((float) (this.patient.getHeight() * this.patient.getHeight())) / 10000.0f)))));
this.binding.patientHealthInsurance.setText(String.format("%s %s", AppGlobal.getInstance().getString(R.string.health_insurance_), this.patient.getHealthInsuranceId()));
this.binding.patientMedicalHistory.setText(String.format("%s %s", AppGlobal.getInstance().getString(R.string.medical_history_), this.patient.getMedicalHistory()));
this.binding.patientClinicalDiagnosis.setText(String.format("%s %s", AppGlobal.getInstance().getString(R.string.clinical_diagnosis_), this.patient.getClinicalDiagnosis()));
this.binding.patientCurrentMedication.setText(String.format("%s %s", AppGlobal.getInstance().getString(R.string.current_medication_), this.patient.getCurrentMedication()));
this.binding.patientHealthInsurance.setVisibility(TextUtils.isEmpty(this.patient.getHealthInsuranceId()) ? 4 : 0);
this.binding.trPatientMedicalHistory.setVisibility(TextUtils.isEmpty(this.patient.getMedicalHistory()) ? 8 : 0);
this.binding.trPatientClinicalDiagnosis.setVisibility(TextUtils.isEmpty(this.patient.getClinicalDiagnosis()) ? 8 : 0);
this.binding.trPatientCurrentMedication.setVisibility(TextUtils.isEmpty(this.patient.getCurrentMedication()) ? 8 : 0);
this.binding.doctorSignatureWarnTv.setVisibility(this.isManualInputNibp ? 0 : 8);
if (this.patient.getStepPitch() > 0.0d) {
d3 = this.patient.getStepPitch();
} else {
double height = this.patient.getHeight();
if (this.patient.getGender().equals(getString(R.string.woman))) {
if (height > 0.0d) {
d = height / FEMALE_STANDARD_HEIGHT;
d2 = FEMALE_STANDARD_STEP_COUNT;
d3 = d * d2;
} else {
maleStepPitch = this.reportParaEntity.getFemaleStepPitch();
d3 = maleStepPitch;
}
} else if (height > 0.0d) {
d = height / MALE_STANDARD_HEIGHT;
d2 = MALE_STANDARD_STEP_COUNT;
d3 = d * d2;
} else {
maleStepPitch = this.reportParaEntity.getMaleStepPitch();
d3 = maleStepPitch;
}
}
ReportEntity reportEntity2 = this.reportEntity;
this.stepPitch = (reportEntity2 == null || reportEntity2.getManualInputStepPitch().doubleValue() <= 0.0d) ? d3 / 100.0d : this.reportEntity.getManualInputStepPitch().doubleValue();
this.binding.patientSp.setText(String.format("%s %s%s", getString(R.string.step_pitch_), String.format("%.0f", Double.valueOf(this.stepPitch * 100.0d)), getString(R.string.centimetre)));
initDistanceAndStepCount();
this.binding.signaturePad.setOnSignedListener(new SignaturePad.OnSignedListener() {
public void onStartSigning() {
}
public void onSigned() {
WalkTestReportNewActivity.this.binding.saveButton.setEnabled(true);
WalkTestReportNewActivity.this.binding.clearButton.setEnabled(true);
}
public void onClear() {
WalkTestReportNewActivity.this.binding.saveButton.setEnabled(false);
}
});
this.binding.clearButton.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
WalkTestReportNewActivity.this.m294x4b821fdf(view);
}
});
ClickUtils.applySingleDebouncing(this.binding.saveButton, new View.OnClickListener() {
@Override
public final void onClick(View view) {
WalkTestReportNewActivity.this.m295xd8bcd160(view);
}
});
ClickUtils.applySingleDebouncing(this.binding.saveDigitalSignatureButton, new View.OnClickListener() {
@Override
public final void onClick(View view) {
WalkTestReportNewActivity.this.m296x65f782e1(view);
}
});
ReportEntity reportEntity3 = this.reportEntity;
if (reportEntity3 != null) {
this.borgGradeScore = reportEntity3.getBorgGradeScore();
this.breathGradeScore = this.reportEntity.getBreathGradeScore();
TextView textView2 = this.binding.borgScaleTv;
Object[] objArr = new Object[2];
objArr[0] = getString(R.string.borg_scale_);
objArr[1] = TextUtils.isEmpty(this.borgGradeScore) ? "" : this.borgGradeScore;
textView2.setText(String.format("%s %s", objArr));
TextView textView3 = this.binding.breathGradeTv;
Object[] objArr2 = new Object[2];
objArr2[0] = getString(R.string.breath_scale_);
objArr2[1] = TextUtils.isEmpty(this.breathGradeScore) ? "" : this.breathGradeScore;
textView3.setText(String.format("%s %s", objArr2));
if (this.reportEntity.getSignatureType() == 1) {
Bitmap bitmapByFile = ImageUtils.getBitmapByFile(new File(ConstDefine.SD_PATH + ConstDefine.IMAGE_PATH + "/" + Constants.ImageFile.SIGNATURE_PREFIX + this.patient.getIdCard() + "_" + this.currentTime + Constants.ImageFile.SIGNATURE_SUFFIX));
if (bitmapByFile != null) {
this.binding.signaturePad.setSignatureBitmap(bitmapByFile);
}
handWrittenSignature();
} else if (this.reportEntity.getSignatureType() == 2) {
digitalSignature();
} else {
clearSignature();
}
}
initRrCharts();
initHisDataGridChartList();
ThreadPoolUtils.execute(new Runnable() {
@Override
public final void run() {
WalkTestReportNewActivity.this.m299xda79764();
}
});
setExerciseIntensity(includeExerciseIntensityBinding);
setHrv();
this.reportPresenter.init(this.binding, this.reportParaEntity, this);
}
public void m291x5cae1017(View view) {
Intent intent = new Intent((Context) this, (Class<?>) WalkTestEcgReviewActivity.class);
intent.putExtra("current_time", this.currentTime);
intent.putExtra("start_time", this.startTime);
intent.putExtra("fast_time", this.fastTime);
intent.putExtra("slow_time", this.slowTime);
intent.putExtra("gain_type", this.reportParaEntity.getReportEcgGain());
intent.putExtra("current_patient", this.patient);
startActivityForResult(intent, 10);
}
public void m300x77237319(View view) {
SelectEcgChannelPopupWindow selectEcgChannelPopupWindow = new SelectEcgChannelPopupWindow(this, this.reportParaEntity.getCalEcgGain(), new SelectEcgChannelPopupWindow.SelectEcgChannelAndSignalGainClickListener() {
@Override
public final void callback(String str, int i) {
WalkTestReportNewActivity.this.m292xe9e8c198(str, i);
}
});
selectEcgChannelPopupWindow.setPopupGravity(17);
selectEcgChannelPopupWindow.showPopupWindow();
}
public void m292xe9e8c198(java.lang.String r5, int r6) {
throw new UnsupportedOperationException("Method not decompiled: cn.neoprint.padmonitor.ui.WalkTestReportNewActivity.m292xe9e8c198(java.lang.String, int):void");
}
public void m301x45e249a(View view) {
startActivity(new Intent((Context) this, (Class<?>) StreamDataReviewActivity.class));
}
public void m302x9198d61b(View view) {
startGradePopupWindows();
}
public void m303x1ed3879c(View view) {
startReportParasWindows();
}
public void m304xac0e391d(View view) {
String str = ConstDefine.SD_PATH + "/WalkTest/Pdf/" + (Constants.ReportFile.PDF_PREFIX + this.patient.getName() + "_" + this.currentTime + Constants.ReportFile.PDF_SUFFIX);
if (this.signatureType > 0) {
KLog.i("complete test report");
this.binding.waitingPb.setVisibility(0);
this.binding.waitingTv.setVisibility(0);
this.reportSummary = this.binding.walkDistanceTv.getText().toString() + " " + this.binding.walkPercentTv.getText().toString() + " " + this.binding.metsTv.getText().toString() + " " + this.binding.hrReverseTv.getText().toString() + " " + this.binding.hrChronctropicIndexTv.getText().toString() + " " + this.binding.hrRecoveryRateTv.getText().toString();
this.borgScoreAndDescription = this.binding.borgScaleTv.getText().toString();
this.breathScoreAndDescription = this.binding.breathGradeTv.getText().toString();
printPdf(false, false, false);
return;
}
ToastUtils.showMessage((Context) this, R.string.please_save_signature_first);
}
public void m305x3948ea9e(View view) {
outputCsv();
}
public void m306xc6839c1f(View view) {
showNotSavePopupWindow();
}
public void m307x53be4da0(View view) {
String str = ConstDefine.SD_PATH + "/WalkTest/Pdf/" + (Constants.ReportFile.PDF_PREFIX + this.patient.getName() + "_" + this.currentTime + Constants.ReportFile.PDF_SUFFIX);
if (this.signatureType > 0) {
KLog.d("print test report");
this.binding.waitingPb.setVisibility(0);
this.binding.waitingTv.setVisibility(0);
this.reportSummary = this.binding.walkDistanceTv.getText().toString() + " " + this.binding.walkPercentTv.getText().toString() + " " + this.binding.metsTv.getText().toString() + " " + this.binding.hrReverseTv.getText().toString() + " " + this.binding.hrChronctropicIndexTv.getText().toString() + " " + this.binding.hrRecoveryRateTv.getText().toString();
this.borgScoreAndDescription = this.binding.borgScaleTv.getText().toString();
this.breathScoreAndDescription = this.binding.breathGradeTv.getText().toString();
printPdf(true, false, false);
return;
}
ToastUtils.showMessage((Context) this, R.string.please_save_signature_first);
}
public void m293xbe476e5e(View view) {
KnowledgePop knowledgePop = new KnowledgePop(this);
knowledgePop.setPopupGravity(17);
knowledgePop.showPopupWindow();
}
public void m294x4b821fdf(View view) {
this.signatureType = 0;
clearSignature();
}
public void m295xd8bcd160(View view) {
Bitmap signatureBitmap = this.binding.signaturePad.getSignatureBitmap();
FileUtil.createFolderIfNotExist(ConstDefine.SD_PATH + ConstDefine.IMAGE_PATH);
try {
FileUtils.saveBitmapToJPG(signatureBitmap, new File(ConstDefine.SD_PATH + ConstDefine.IMAGE_PATH + "/" + Constants.ImageFile.SIGNATURE_PREFIX + this.patient.getIdCard() + "_" + this.currentTime + Constants.ImageFile.SIGNATURE_SUFFIX));
this.signatureType = 1;
handWrittenSignature();
ToastUtils.showMessage((Context) this, R.string.save_completed);
} catch (IOException e) {
KLog.e("save signature image failed. ", e);
}
}
public void m296x65f782e1(View view) {
File file = new File(ConstDefine.SD_PATH + ConstDefine.IMAGE_PATH + "/" + Constants.ImageFile.SIGNATURE_PREFIX + this.patient.getIdCard() + "_" + this.currentTime + Constants.ImageFile.SIGNATURE_SUFFIX);
if (file.exists()) {
FileUtils.delete(file);
}
this.signatureType = 2;
digitalSignature();
ToastUtils.showMessage((Context) this, R.string.save_completed);
}
public void m299xda79764() {
byte[] waveData = getWaveData((int) this.waveDataLength);
this.testData = waveData;
parseWalkTestWaveDataList(waveData);
RespPeakCal.RespPeakCalResult cal = RespPeakCal.cal(100, 125, 128, this.testRespWaveDataList);
this.respPeakCalResult = cal;
LogFile.saveLog(cal.getInfo());
PanTompkinsForEcg.PanTompkinsForEcgResult cal2 = PanTompkinsForEcg.cal(409.6d, 250, TestWaveDataLists.getInstance().getECGIIWaveDataList(), 0, this.reportParaEntity.getCalEcgGain());
this.panTompkinsForEcgResult = cal2;
LogFile.saveLog(cal2.getInfo());
for (int i = 0; i < 8; i++) {
int i2 = 15 * i;
int min = Math.min(this.testSpo2WaveDataList.size() - i2, 15);
if (min > 0) {
int i3 = 0;
for (int i4 = 0; i4 < min; i4++) {
i3 += this.testSpo2WaveDataList.get(i4 + i2).intValue();
}
this.spo2MeanList.add(Integer.valueOf(i3 / min));
} else {
this.spo2MeanList.add(0);
}
}
runOnUiThread(new Runnable() {
@Override
public final void run() {
WalkTestReportNewActivity.this.m298x806ce5e3();
}
});
}
public void m298x806ce5e3() {
ReportEntity reportEntity = this.reportEntity;
if (reportEntity == null) {
createEcgDataTables(true);
this.binding.scoreGradeBtn.post(new Runnable() {
@Override
public final void run() {
WalkTestReportNewActivity.this.m297xf3323462();
}
});
return;
}
createEcgDataTables(reportEntity.getSlowTime().longValue(), this.reportEntity.getFastTime().longValue(), true);
double d = this.manualInputTotalDistance;
if (d > 0.0d) {
updateTotalDistance(d);
refreshReportDataView();
}
double d2 = this.manualInputStepPitch;
if (d2 > 0.0d) {
updateStepPitch(d2 * 100.0d);
}
}
public void m297xf3323462() {
startGradePopupWindows();
preSavePdf();
}
private void setExerciseIntensity(final IncludeExerciseIntensityBinding includeExerciseIntensityBinding) {
BaseQuickAdapter exerciseIntensityAdapter = new ExerciseIntensityAdapter(R.layout.item_exercise_intensity, Arrays.asList(new ExerciseIntensityBean(false, false), new ExerciseIntensityBean(false, false), new ExerciseIntensityBean(false, false), new ExerciseIntensityBean(false, false), new ExerciseIntensityBean(false, false), new ExerciseIntensityBean(false, false), new ExerciseIntensityBean(false, false), new ExerciseIntensityBean(false, false)), this.totalDistance);
includeExerciseIntensityBinding.recyclerViewExerciseIntensity.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
includeExerciseIntensityBinding.recyclerViewExerciseIntensity.setAdapter(exerciseIntensityAdapter);
includeExerciseIntensityBinding.cb3.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
WalkTestReportNewActivity.this.m310x16f73967(includeExerciseIntensityBinding, view);
}
});
includeExerciseIntensityBinding.cb4.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
WalkTestReportNewActivity.this.m311xa431eae8(includeExerciseIntensityBinding, view);
}
});
includeExerciseIntensityBinding.cb5.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
WalkTestReportNewActivity.this.m312x316c9c69(includeExerciseIntensityBinding, view);
}
});
}
public void m310x16f73967(IncludeExerciseIntensityBinding includeExerciseIntensityBinding, View view) {
CheckBox checkBox = includeExerciseIntensityBinding.cb3;
boolean z = !this.isChecked3;
this.isChecked3 = z;
checkBox.setChecked(z);
CheckBox checkBox2 = includeExerciseIntensityBinding.cb4;
this.isChecked4 = false;
checkBox2.setChecked(false);
CheckBox checkBox3 = includeExerciseIntensityBinding.cb5;
this.isChecked5 = false;
checkBox3.setChecked(false);
}
public void m311xa431eae8(IncludeExerciseIntensityBinding includeExerciseIntensityBinding, View view) {
CheckBox checkBox = includeExerciseIntensityBinding.cb3;
this.isChecked3 = false;
checkBox.setChecked(false);
CheckBox checkBox2 = includeExerciseIntensityBinding.cb4;
boolean z = !this.isChecked4;
this.isChecked4 = z;
checkBox2.setChecked(z);
CheckBox checkBox3 = includeExerciseIntensityBinding.cb5;
this.isChecked5 = false;
checkBox3.setChecked(false);
}
public void m312x316c9c69(IncludeExerciseIntensityBinding includeExerciseIntensityBinding, View view) {
CheckBox checkBox = includeExerciseIntensityBinding.cb3;
this.isChecked3 = false;
checkBox.setChecked(false);
CheckBox checkBox2 = includeExerciseIntensityBinding.cb4;
this.isChecked4 = false;
checkBox2.setChecked(false);
CheckBox checkBox3 = includeExerciseIntensityBinding.cb5;
boolean z = !this.isChecked5;
this.isChecked5 = z;
checkBox3.setChecked(z);
}
private void setHrv() {
this.binding.hrvSelect.cb1.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
WalkTestReportNewActivity.this.m313x1039fbae(view);
}
});
this.binding.hrvSelect.cb2.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
WalkTestReportNewActivity.this.m314x9d74ad2f(view);
}
});
this.binding.hrvSelect.cb3.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
WalkTestReportNewActivity.this.m315x2aaf5eb0(view);
}
});
this.binding.hrvSelect.cb4.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
WalkTestReportNewActivity.this.m316xb7ea1031(view);
}
});
this.binding.hrvSelect.cb5.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
WalkTestReportNewActivity.this.m317x4524c1b2(view);
}
});
this.binding.hrvSelect.cb6.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
WalkTestReportNewActivity.this.m318xd25f7333(view);
}
});
this.binding.hrvSelect.cb7.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
WalkTestReportNewActivity.this.m319x5f9a24b4(view);
}
});
this.binding.hrvSelect.cb8.setOnClickListener(new View.OnClickListener() {
@Override
public final void onClick(View view) {
WalkTestReportNewActivity.this.m320xecd4d635(view);
}
});
}
public void m313x1039fbae(View view) {
CheckBox checkBox = this.binding.hrvSelect.cb1;
boolean z = !this.isCb1;
this.isCb1 = z;
checkBox.setChecked(z);
CheckBox checkBox2 = this.binding.hrvSelect.cb2;
this.isCb2 = false;
checkBox2.setChecked(false);
CheckBox checkBox3 = this.binding.hrvSelect.cb3;
this.isCb3 = false;
checkBox3.setChecked(false);
CheckBox checkBox4 = this.binding.hrvSelect.cb4;
this.isCb4 = false;
checkBox4.setChecked(false);
CheckBox checkBox5 = this.binding.hrvSelect.cb5;
this.isCb5 = false;
checkBox5.setChecked(false);
}
public void m314x9d74ad2f(View view) {
CheckBox checkBox = this.binding.hrvSelect.cb1;
this.isCb1 = false;
checkBox.setChecked(false);
CheckBox checkBox2 = this.binding.hrvSelect.cb2;
boolean z = !this.isCb2;
this.isCb2 = z;
checkBox2.setChecked(z);
CheckBox checkBox3 = this.binding.hrvSelect.cb3;
this.isCb3 = false;
checkBox3.setChecked(false);
CheckBox checkBox4 = this.binding.hrvSelect.cb4;
this.isCb4 = false;
checkBox4.setChecked(false);
CheckBox checkBox5 = this.binding.hrvSelect.cb5;
this.isCb5 = false;
checkBox5.setChecked(false);
}
public void m315x2aaf5eb0(View view) {
CheckBox checkBox = this.binding.hrvSelect.cb1;
this.isCb1 = false;
checkBox.setChecked(false);
CheckBox checkBox2 = this.binding.hrvSelect.cb2;
this.isCb2 = false;
checkBox2.setChecked(false);
CheckBox checkBox3 = this.binding.hrvSelect.cb3;
boolean z = !this.isCb3;
this.isCb3 = z;
checkBox3.setChecked(z);
CheckBox checkBox4 = this.binding.hrvSelect.cb4;
this.isCb4 = false;
checkBox4.setChecked(false);
CheckBox checkBox5 = this.binding.hrvSelect.cb5;
this.isCb5 = false;
checkBox5.setChecked(false);
}
public void m316xb7ea1031(View view) {
CheckBox checkBox = this.binding.hrvSelect.cb1;
this.isCb1 = false;
checkBox.setChecked(false);
CheckBox checkBox2 = this.binding.hrvSelect.cb2;
this.isCb2 = false;
checkBox2.setChecked(false);
CheckBox checkBox3 = this.binding.hrvSelect.cb3;
this.isCb3 = false;
checkBox3.setChecked(false);
CheckBox checkBox4 = this.binding.hrvSelect.cb4;
boolean z = !this.isCb4;
this.isCb4 = z;
checkBox4.setChecked(z);
CheckBox checkBox5 = this.binding.hrvSelect.cb5;
this.isCb5 = false;
checkBox5.setChecked(false);
}
public void m317x4524c1b2(View view) {
CheckBox checkBox = this.binding.hrvSelect.cb1;
this.isCb1 = false;
checkBox.setChecked(false);
CheckBox checkBox2 = this.binding.hrvSelect.cb2;
this.isCb2 = false;
checkBox2.setChecked(false);
CheckBox checkBox3 = this.binding.hrvSelect.cb3;
this.isCb3 = false;
checkBox3.setChecked(false);
CheckBox checkBox4 = this.binding.hrvSelect.cb4;
this.isCb4 = false;
checkBox4.setChecked(false);
CheckBox checkBox5 = this.binding.hrvSelect.cb5;
boolean z = !this.isCb5;
this.isCb5 = z;
checkBox5.setChecked(z);
}
public void m318xd25f7333(View view) {
CheckBox checkBox = this.binding.hrvSelect.cb6;
boolean z = !this.isCb6;
this.isCb6 = z;
checkBox.setChecked(z);
CheckBox checkBox2 = this.binding.hrvSelect.cb7;
this.isCb7 = false;
checkBox2.setChecked(false);
CheckBox checkBox3 = this.binding.hrvSelect.cb8;
this.isCb8 = false;
checkBox3.setChecked(false);
}
public void m319x5f9a24b4(View view) {
CheckBox checkBox = this.binding.hrvSelect.cb6;
this.isCb6 = false;
checkBox.setChecked(false);
CheckBox checkBox2 = this.binding.hrvSelect.cb7;
boolean z = !this.isCb7;
this.isCb7 = z;
checkBox2.setChecked(z);
CheckBox checkBox3 = this.binding.hrvSelect.cb8;
this.isCb8 = false;
checkBox3.setChecked(false);
}
public void m320xecd4d635(View view) {
CheckBox checkBox = this.binding.hrvSelect.cb6;
this.isCb6 = false;
checkBox.setChecked(false);
CheckBox checkBox2 = this.binding.hrvSelect.cb7;
this.isCb7 = false;
checkBox2.setChecked(false);
CheckBox checkBox3 = this.binding.hrvSelect.cb8;
boolean z = !this.isCb8;
this.isCb8 = z;
checkBox3.setChecked(z);
}
public void initHisDataGridChartList() {
int i = this.speedType;
if (i == 1) {
this.speedTypeStr = getString(R.string.print_speed2);
} else if (i == 2) {
this.speedTypeStr = getString(R.string.print_speed3);
} else if (i == 3) {
this.speedTypeStr = getString(R.string.print_speed4);
}
int reportEcgGain = this.reportParaEntity.getReportEcgGain();
this.gainType = reportEcgGain;
if (reportEcgGain == 1) {
this.ydpi = AppGlobal.getInstance().displayMetrics.ydpi / 2.0f;
this.gainTypeStr = " (" + this.speedTypeStr + " " + getString(R.string.gain1) + ")";
} else if (reportEcgGain == 2) {
this.ydpi = AppGlobal.getInstance().displayMetrics.ydpi;
this.gainTypeStr = " (" + this.speedTypeStr + " " + getString(R.string.gain2) + ")";
} else if (reportEcgGain == 3) {
this.ydpi = AppGlobal.getInstance().displayMetrics.ydpi * 2.0f;
this.gainTypeStr = " (" + this.speedTypeStr + " " + getString(R.string.gain3) + ")";
}
this.binding.beforeEcgTitle.setText(String.format("%s%s", getString(R.string.before_wave_line), this.gainTypeStr));
this.binding.afterEcgTitle.setText(String.format("%s%s", getString(R.string.after_wave_line), this.gainTypeStr));
this.binding.start1EcgTitle.setText(String.format("%s%s", getString(R.string.start1_wave_line), this.gainTypeStr));
this.binding.start2EcgTitle.setText(String.format("%s%s", getString(R.string.start2_wave_line), this.gainTypeStr));
this.binding.start3EcgTitle.setText(String.format("%s%s", getString(R.string.start3_wave_line), this.gainTypeStr));
this.binding.start4EcgTitle.setText(String.format("%s%s", getString(R.string.start4_wave_line), this.gainTypeStr));
this.binding.start5EcgTitle.setText(String.format("%s%s", getString(R.string.start5_wave_line), this.gainTypeStr));
this.binding.start6EcgTitle.setText(String.format("%s%s", getString(R.string.start6_wave_line), this.gainTypeStr));
this.binding.fastEcgTitle.setText(String.format("%s%s", getString(R.string.fast_wave_line), this.gainTypeStr));
this.binding.slowEcgTitle.setText(String.format("%s%s", getString(R.string.slow_wave_line), this.gainTypeStr));
if (this.ecgMarkEntityList != null) {
TextView textView = this.markHr.mark1EcgTitle;
Object[] objArr = new Object[2];
objArr[0] = this.ecgMarkEntityList.size() > 0 ? this.ecgMarkEntityList.get(0).getEcgDesc() + "(" + this.gainTypeStr + ")" : "";
objArr[1] = this.gainTypeStr;
textView.setText(String.format("%s%s", objArr));
TextView textView2 = this.markHr.mark2EcgTitle;
Object[] objArr2 = new Object[2];
objArr2[0] = this.ecgMarkEntityList.size() > 1 ? this.ecgMarkEntityList.get(1).getEcgDesc() + "(" + this.gainTypeStr + ")" : "";
objArr2[1] = this.gainTypeStr;
textView2.setText(String.format("%s%s", objArr2));
TextView textView3 = this.markHr.mark3EcgTitle;
Object[] objArr3 = new Object[2];
objArr3[0] = this.ecgMarkEntityList.size() > 2 ? this.ecgMarkEntityList.get(2).getEcgDesc() + "(" + this.gainTypeStr + ")" : "";
objArr3[1] = this.gainTypeStr;
textView3.setText(String.format("%s%s", objArr3));
TextView textView4 = this.markHr.mark4EcgTitle;
Object[] objArr4 = new Object[2];
objArr4[0] = this.ecgMarkEntityList.size() > 3 ? this.ecgMarkEntityList.get(3).getEcgDesc() + "(" + this.gainTypeStr + ")" : "";
objArr4[1] = this.gainTypeStr;
textView4.setText(String.format("%s%s", objArr4));
}
}
public void createEcgDataTables(boolean z) {
createEcgDataTables(0L, 0L, z);
}
public void createEcgDataTables(long j, long j2, boolean z) {
getEcgData(z);
refreshReportDataView();
getTrendData();
if (this.binding.hrvStatisticChart != null) {
this.hrvStatisticDataEntityList = this.dataFactory.createHrvStatisticDataList(this);
this.binding.hrvStatisticChart.setDataAdapter(new HrvStatisticTableDataAdapter(this, this.hrvStatisticDataEntityList, this.binding.hrvStatisticChart));
this.binding.hrvStatisticChart.setSwipeToRefreshEnabled(false);
}
this.ecgHelper.getReportEcgBeanListByFastSlow().clear();
clearList();
for (int i = 0; i < 7; i++) {
this.fastTime = j2 > 0 ? j2 : (this.startTime + (((int) this.panTompkinsForEcgResult.getHrMaxTim()) * 1000)) - 8000;
getLine(this.waveDataTypeList.get(i).byteValue(), this.fastTime);
}
EcgHelper ecgHelper = this.ecgHelper;
ecgHelper.saveFastSlowData(ecgHelper.map(this.ecgIList, this.ecgIIList, this.ecgIIIList, this.ecgAVRList, this.ecgAVLList, this.ecgAVFList, this.ecgVList), this.binding.fastEcgStaticEcg);
this.binding.includeFastEcgTime.tvTimeEcg.setText(DateUtils.longToHourMinuteSecond(this.fastTime));
clearList();
for (int i2 = 0; i2 < 7; i2++) {
this.slowTime = j > 0 ? j : (this.startTime + (((int) this.panTompkinsForEcgResult.getHrMinTim()) * 1000)) - 8000;
getLine(this.waveDataTypeList.get(i2).byteValue(), this.slowTime);
}
EcgHelper ecgHelper2 = this.ecgHelper;
ecgHelper2.saveFastSlowData(ecgHelper2.map(this.ecgIList, this.ecgIIList, this.ecgIIIList, this.ecgAVRList, this.ecgAVLList, this.ecgAVFList, this.ecgVList), this.binding.slowEcgStaticEcg);
this.binding.includeSlowEcgTime.tvTimeEcg.setText(DateUtils.longToHourMinuteSecond(this.slowTime));
this.ecgHelper.showFastSlowView(this.gainType);
setData(this.binding.rrIntervalStatisticChart, 40, 50.0f, 1);
setRrLorenzData(this.binding.rrLorenzStatisticChart, 2000, 2000);
this.binding.waitingPb.setVisibility(8);
this.binding.waitingTv.setVisibility(8);
this.binding.cancelTestBtn.setVisibility(0);
this.ecgMarkEntityList = DataRepository.getInstance().getEcgMarkDao().query(this.patient.getIdCard(), this.currentTime);
refreshReportVisible();
refreshEcgMarkList();
}
private void preSavePdf() {
KLog.i("pre save test report pdf");
this.reportSummary = this.binding.walkDistanceTv.getText().toString() + " " + this.binding.walkPercentTv.getText().toString() + " " + this.binding.metsTv.getText().toString() + " " + this.binding.hrReverseTv.getText().toString() + " " + this.binding.hrChronctropicIndexTv.getText().toString() + " " + this.binding.hrRecoveryRateTv.getText().toString();
this.borgScoreAndDescription = "";
this.breathScoreAndDescription = "";
saveWaveData();
printPdf(false, true, true);
}
private void printPdf(boolean z, boolean z2, boolean z3) {
this.handler.postDelayed(new Runnable() {
@Override
public final void run() {
WalkTestReportNewActivity.this.m308x63069a7b();
}
}, 2000L);
if (!z) {
savePdfData();
}
new PrintPdfKt(this).print(z, z2, z3);
}
public void m308x63069a7b() {
this.binding.waitingPb.setVisibility(8);
this.binding.waitingTv.setVisibility(8);
}
private void savePdfData() {
String str = this.reportDataEntityList.get(0).getBp() + "," + this.reportDataEntityList.get(7).getBp();
List<ReportEntity> query = DataRepository.getInstance().getReportDao().query(this.patient.getIdCard(), this.currentTime);
ReportEntity reportEntity = new ReportEntity(query.size() == 0 ? null : query.get(0).getId(), this.patient.getIdCard(), Long.valueOf(this.currentTime), str, this.stepCountList.toString(), this.distanceList.toString(), this.totalCircle, this.circleDistance, this.isManualInputNibp, this.stopCause, this.timeRemaining, Double.valueOf(this.manualInputStepPitch), Double.valueOf(this.manualInputTotalDistance), this.breathGradeScore, this.borgGradeScore, Long.valueOf(this.slowTime), Long.valueOf(this.fastTime), this.signatureType, Constants.ReportFile.PDF_PREFIX + this.patient.getName() + "_" + this.currentTime + Constants.ReportFile.PDF_SUFFIX, Constants.ReportFile.HISTORY_DATA_PREFIX + this.patient.getIdCard() + "_" + this.currentTime + Constants.ReportFile.HISTORY_DATA_SUFFIX, "", 0L, "", this.reportPresenter.getDoctorIdea());
DataRepository.getInstance().getReportDao().insertOrReplace(reportEntity);
KLog.i("saved pdf data. " + reportEntity);
DataRepository.getInstance().getReportParaDao().insertOrReplace(this.reportParaEntity);
}
public void onBackPressed() {
showNotSavePopupWindow();
}
private void showNotSavePopupWindow() {
Intent intent = new Intent();
Bundle bundle = new Bundle();
bundle.putInt("popuptextview", R.string.dialog_title_save_history_report);
intent.putExtras(bundle);
intent.setClass(this, PopUpDialogActivity.class);
startActivityForResult(intent, 15);
}
public boolean isValidStepCountList() {
List<Integer> list = this.oriStepCountList;
if (list == null) {
return false;
}
Iterator<Integer> it = list.iterator();
int i = 0;
while (it.hasNext()) {
i += it.next().intValue();
}
return this.oriStepCountList.size() == 6 && i > 0;
}
private boolean isValidDistanceList() {
Iterator<Float> it = this.oriDistanceList.iterator();
int i = 0;
while (it.hasNext()) {
i = (int) (i + it.next().floatValue());
}
List<Float> list = this.oriDistanceList;
return list != null && list.size() == 6 && i > 0;
}
public boolean hasDistanceAndStepCount() {
List<Float> list;
List<Integer> list2 = this.calStepCountList;
return list2 != null && list2.size() == 6 && (list = this.calDistanceList) != null && list.size() == 6;
}
private void initDistanceAndStepCount() {
this.calStepCountList.clear();
this.calDistanceList.clear();
boolean isValidStepCountList = isValidStepCountList();
boolean isValidDistanceList = isValidDistanceList();
if (isValidStepCountList && isValidDistanceList) {
float f = 0.0f;
ArrayList arrayList = new ArrayList();
int i = 0;
for (int i2 = 0; i2 < 6; i2++) {
i += this.oriStepCountList.get(i2).intValue();
f += this.oriDistanceList.get(i2).floatValue();
arrayList.add(Integer.valueOf(Math.round(this.oriDistanceList.get(i2).floatValue() / ((float) this.stepPitch))));
}
if (Math.abs(i - (f / ((float) this.stepPitch))) > 80.0f) {
this.calStepCountList.addAll(arrayList);
} else {
this.calStepCountList.addAll(this.oriStepCountList);
}
this.calDistanceList.addAll(this.oriDistanceList);
this.totalStepCount = 0;
this.totalDistance = 0.0d;
Iterator<Integer> it = this.calStepCountList.iterator();
while (it.hasNext()) {
this.totalStepCount += it.next().intValue();
}
Iterator<Float> it2 = this.calDistanceList.iterator();
while (it2.hasNext()) {
this.totalDistance += it2.next().floatValue();
}
} else if (!isValidStepCountList && isValidDistanceList) {
this.calDistanceList.addAll(this.oriDistanceList);
for (int i3 = 0; i3 < 6; i3++) {
this.calStepCountList.add(Integer.valueOf(Math.round(this.oriDistanceList.get(i3).floatValue() / ((float) this.stepPitch))));
}
this.totalStepCount = 0;
this.totalDistance = 0.0d;
Iterator<Integer> it3 = this.calStepCountList.iterator();
while (it3.hasNext()) {
this.totalStepCount += it3.next().intValue();
}
Iterator<Float> it4 = this.calDistanceList.iterator();
while (it4.hasNext()) {
this.totalDistance += it4.next().floatValue();
}
} else if (isValidStepCountList && !isValidDistanceList) {
this.calStepCountList.addAll(this.oriStepCountList);
for (int i4 = 0; i4 < 6; i4++) {
this.calDistanceList.add(Float.valueOf(this.oriStepCountList.get(i4).intValue() * ((float) this.stepPitch)));
}
this.totalStepCount = 0;
this.totalDistance = 0.0d;
Iterator<Integer> it5 = this.calStepCountList.iterator();
while (it5.hasNext()) {
this.totalStepCount += it5.next().intValue();
}
Iterator<Float> it6 = this.calDistanceList.iterator();
while (it6.hasNext()) {
this.totalDistance += it6.next().floatValue();
}
} else {
KLog.w("ori step count list is INVALID! ori distance list is INVALID!");
}
KLog.i("isValidStepCountList=" + isValidStepCountList + ", isValidDistanceList=" + isValidDistanceList + ", totalStepCount=" + this.totalStepCount + ", totalDistance=" + this.totalDistance + ", oriStepCountList=" + this.oriStepCountList + ", oriDistanceList=" + this.oriDistanceList + ", calStepCountList=" + this.calStepCountList + ", calDistanceList=" + this.calDistanceList);
initDistanceAndStepCountRelations();
}
private void updateTotalDistance(double d) {
this.oriStepCountList.clear();
this.oriDistanceList.clear();
this.calStepCountList.clear();
this.calDistanceList.clear();
KLog.i("update total distance: " + d);
this.manualInputTotalDistance = d;
this.totalDistance = d;
this.totalStepCount = (int) Math.round(d / this.stepPitch);
initDistanceAndStepCountRelations();
}
private void initDistanceAndStepCountRelations() {
this.binding.distance.setText(String.format("%s %s%s", getString(R.string.walk_distance_), String.format("%.2f", Double.valueOf(this.totalDistance)), getString(R.string.meter)));
double d = this.totalDistance;
this.cardiopulmonarySummary = String.format(getString(R.string.cardiopulmonary_summary), Integer.valueOf(d < 300.0d ? 1 : d < 374.9d ? 2 : d < 449.9d ? 3 : 4));
this.binding.cardiopulmonaryGradeTv.setText(this.cardiopulmonarySummary);
String valueOf = String.valueOf(this.totalStepCount * 4);
String format = String.format("%.0f", Double.valueOf(this.totalDistance * 4.0d));
String valueOf2 = String.valueOf((int) ((220 - this.patient.getAge()) * 0.8d));
this.binding.llExerciseIntensity.setVisibility(this.reportParaEntity.getHideExercisePrescription() ? 8 : 0);
this.binding.sportAdviceTv.setVisibility(this.reportParaEntity.getHideExercisePrescription() ? 8 : 0);
this.binding.sportAdviceTv.setVisibility(8);
this.sportsSummary = String.format(getString(R.string.sports_summary), valueOf, format, valueOf2);
if (!TextUtils.isEmpty(this.stopCause)) {
this.sportsSummary = String.format(getString(R.string.cause_of_emergency_stop), this.stopCause);
}
this.binding.sportAdviceTv.setText(this.sportsSummary);
this.mets = String.format("%.1f", Double.valueOf((((this.totalDistance * 0.1d) / 6.0d) + 3.5d) / 3.5d));
this.binding.metsTv.setText(this.reportParaEntity.getHideMet() ? "" : String.format("%s %s", getString(R.string.mets_), this.mets + "METs"));
this.binding.walkDistanceTv.setText(String.format("%s %s%s", getString(R.string.walk_distance_), String.format("%.1f", Double.valueOf(this.totalDistance)), getString(R.string.meter)));
int predictDistance = this.reportParaEntity.getPredictDistance();
double sixmwdNew = SixMinUtils.sixmwdNew(this.patient.getGender(), this.patient.getAge(), this.patient.getHeight(), this.binding.patientBmi.getText().toString());
if (sixmwdNew <= 0.0d) {
sixmwdNew = predictDistance;
}
this.binding.walkPercentTv.setText(String.format("%s %s%s", getString(R.string.walk_percent_), String.format("%.0f", Float.valueOf((((float) this.totalDistance) * 100.0f) / ((float) sixmwdNew))), getString(R.string.percent_unit)) + "(" + String.format("%.0f", Double.valueOf(sixmwdNew)) + getString(R.string.meter) + ")");
this.binding.testInfoTv.setText(String.format("%s%d%s, %s%d%s", getString(R.string.predict_distance), Integer.valueOf(predictDistance), getString(R.string.meter), getString(R.string.test_duration), Integer.valueOf(this.reportParaEntity.getTestDuration()), getString(R.string.minute_unit)));
}
private void initHrRelations() {
this.hr_reverse = String.format("%.0f", Double.valueOf(this.panTompkinsForEcgResult.getRunHrMax() - this.panTompkinsForEcgResult.getBeforeRunHr()));
this.hr_chronctropic_index = String.format("%.1f", Double.valueOf((this.panTompkinsForEcgResult.getRunHrMax() - this.panTompkinsForEcgResult.getBeforeRunHr()) / ((220 - this.patient.getAge()) - this.panTompkinsForEcgResult.getBeforeRunHr())));
this.hr_recovery_rate = String.format("%.1f", Double.valueOf(Math.abs(this.panTompkinsForEcgResult.getRunStopHr() - this.panTompkinsForEcgResult.getAfterRunHr()) / 10.0d));
boolean hideMet = this.reportParaEntity.getHideMet();
this.binding.hrReverseTv.setText(hideMet ? "" : String.format("%s %s", getString(R.string.hr_reverse_), this.hr_reverse));
this.binding.hrChronctropicIndexTv.setText(hideMet ? "" : String.format("%s %s", getString(R.string.hr_chronctropic_index_), this.hr_chronctropic_index));
this.binding.hrRecoveryRateTv.setText(hideMet ? "" : String.format("%s %s", getString(R.string.hr_recovery_rate_), this.hr_recovery_rate));
this.binding.metsTv.setVisibility(hideMet ? 8 : 0);
this.binding.hrReverseTv.setVisibility(hideMet ? 8 : 0);
this.binding.hrChronctropicIndexTv.setVisibility(hideMet ? 8 : 0);
this.binding.hrRecoveryRateTv.setVisibility(hideMet ? 8 : 0);
this.binding.tvFastestHeart.setText(String.format("%s %s%s", getString(R.string.fastest_heart_rate_during_exercise_), String.format("%.0f", Double.valueOf(this.panTompkinsForEcgResult.getHrMax())), getString(R.string.times_minute)));
this.binding.tvSlowestHeart.setText(String.format("%s %s%s", getString(R.string.slowest_heart_rate_during_exercise_), String.format("%.0f", Double.valueOf(this.panTompkinsForEcgResult.getBeforeRunHr())), getString(R.string.times_minute)));
this.binding.tvTargetHeartRate.setText(String.format("%s %s%s", getString(R.string.target_heart_rate_), String.format("%.0f", Double.valueOf((((220 - this.patient.getAge()) - this.panTompkinsForEcgResult.getBeforeRunHr()) * 0.6d) + this.panTompkinsForEcgResult.getBeforeRunHr())), getString(R.string.times_minute)));
}
public void updateStepPitch(double d) {
double d2 = d / 100.0d;
this.stepPitch = d2;
this.manualInputStepPitch = d2;
KLog.i("manual update step pitch: " + this.manualInputStepPitch);
this.binding.patientSp.setText(String.format("%s %s%s", getString(R.string.step_pitch_), String.format("%.0f", Double.valueOf(this.stepPitch * 100.0d)), getString(R.string.centimetre)));
initDistanceAndStepCount();
refreshReportDataView();
}
private void refreshEcgMarkList() {
KLog.i("update ecg mark view.");
List<EcgMarkEntity> query = DataRepository.getInstance().getEcgMarkDao().query(this.patient.getIdCard(), this.currentTime);
this.ecgMarkEntityList = query;
if (query.size() > 0 && this.ecgMarkEntityList.get(0) != null && this.ecgMarkEntityList.get(0).getEcgTime().longValue() != 0) {
this.markHr.mark1EcgFl.setVisibility(0);
this.markHr.mark1Ecg.setVisibility(0);
this.markHr.mark1EcgTitle.setText(this.ecgMarkEntityList.get(0).getEcgDesc() + "(" + this.gainTypeStr + ")");
this.mark1Time = this.ecgMarkEntityList.get(0).getEcgTime().longValue();
clearList();
for (int i = 0; i < 7; i++) {
getLine(this.waveDataTypeList.get(i).byteValue(), this.mark1Time);
}
this.ecgHelper.setData(this.markHr.mark1Ecg, this.gainType, AppGlobal.getAppContext(), this.ecgHelper.map(this.ecgIList, this.ecgIIList, this.ecgIIIList, this.ecgAVRList, this.ecgAVLList, this.ecgAVFList, this.ecgVList));
this.markHr.includeMark1EcgTime.tvTimeEcg.setText(DateUtils.longToHourMinuteSecond(this.mark1Time));
} else {
this.markHr.mark1EcgFl.setVisibility(8);
this.markHr.mark1Ecg.setVisibility(8);
}
if (this.ecgMarkEntityList.size() > 1 && this.ecgMarkEntityList.get(1) != null && this.ecgMarkEntityList.get(1).getEcgTime().longValue() != 0) {
this.markHr.mark2EcgFl.setVisibility(0);
this.markHr.mark2Ecg.setVisibility(0);
this.markHr.mark2EcgTitle.setText(this.ecgMarkEntityList.get(1).getEcgDesc() + "(" + this.gainTypeStr + ")");
this.mark2Time = this.ecgMarkEntityList.get(1).getEcgTime().longValue();
clearList();
for (int i2 = 0; i2 < 7; i2++) {
getLine(this.waveDataTypeList.get(i2).byteValue(), this.mark2Time);
}
this.ecgHelper.setData(this.markHr.mark2Ecg, this.gainType, AppGlobal.getAppContext(), this.ecgHelper.map(this.ecgIList, this.ecgIIList, this.ecgIIIList, this.ecgAVRList, this.ecgAVLList, this.ecgAVFList, this.ecgVList));
this.markHr.includeMark2EcgTime.tvTimeEcg.setText(DateUtils.longToHourMinuteSecond(this.mark2Time));
} else {
this.markHr.mark2EcgFl.setVisibility(8);
this.markHr.mark2Ecg.setVisibility(8);
}
if (this.ecgMarkEntityList.size() > 2 && this.ecgMarkEntityList.get(2) != null && this.ecgMarkEntityList.get(2).getEcgTime().longValue() != 0) {
this.markHr.mark3EcgFl.setVisibility(0);
this.markHr.mark3Ecg.setVisibility(0);
this.markHr.mark3EcgTitle.setText(this.ecgMarkEntityList.get(2).getEcgDesc() + "(" + this.gainTypeStr + ")");
this.mark3Time = this.ecgMarkEntityList.get(2).getEcgTime().longValue();
clearList();
int i3 = 0;
for (int i4 = 7; i3 < i4; i4 = 7) {
getLine(this.waveDataTypeList.get(i3).byteValue(), this.mark3Time);
i3++;
}
this.ecgHelper.setData(this.markHr.mark3Ecg, this.gainType, AppGlobal.getAppContext(), this.ecgHelper.map(this.ecgIList, this.ecgIIList, this.ecgIIIList, this.ecgAVRList, this.ecgAVLList, this.ecgAVFList, this.ecgVList));
this.markHr.includeMark3EcgTime.tvTimeEcg.setText(DateUtils.longToHourMinuteSecond(this.mark3Time));
} else {
this.markHr.mark3EcgFl.setVisibility(8);
this.markHr.mark3Ecg.setVisibility(8);
}
if (this.ecgMarkEntityList.size() > 3 && this.ecgMarkEntityList.get(3) != null && this.ecgMarkEntityList.get(3).getEcgTime().longValue() != 0) {
this.markHr.mark4EcgFl.setVisibility(0);
this.markHr.mark4Ecg.setVisibility(0);
this.markHr.mark4EcgTitle.setText(this.ecgMarkEntityList.get(3).getEcgDesc() + "(" + this.gainTypeStr + ")");
this.mark4Time = this.ecgMarkEntityList.get(3).getEcgTime().longValue();
clearList();
for (int i5 = 0; i5 < 7; i5++) {
getLine(this.waveDataTypeList.get(i5).byteValue(), this.mark4Time);
}
this.ecgHelper.setData(this.markHr.mark4Ecg, this.gainType, AppGlobal.getAppContext(), this.ecgHelper.map(this.ecgIList, this.ecgIIList, this.ecgIIIList, this.ecgAVRList, this.ecgAVLList, this.ecgAVFList, this.ecgVList));
this.markHr.includeMark4EcgTime.tvTimeEcg.setText(DateUtils.longToHourMinuteSecond(this.mark4Time));
return;
}
this.markHr.mark4EcgFl.setVisibility(8);
this.markHr.mark4Ecg.setVisibility(8);
}
protected void onResume() {
super.onResume();
HospitalEntity hospitalEntity = this.hospitalEntity;
if (hospitalEntity != null) {
String hospitalImagePath = hospitalEntity.getHospitalImagePath() == null ? "" : this.hospitalEntity.getHospitalImagePath();
if (TextUtils.isEmpty(hospitalImagePath)) {
return;
}
this.binding.hospitalLogoIv.setImageBitmap(BitmapFactory.decodeFile(hospitalImagePath));
}
}
protected void onActivityResult(int i, int i2, Intent intent) {
super.onActivityResult(i, i2, intent);
if (i != 10) {
if (i == 15 && intent != null && intent.getExtras().getBoolean("popupresult")) {
KLog.d("user cancel save walk test report.");
finish();
return;
}
return;
}
if (intent != null) {
long longExtra = intent.getLongExtra("slow_time", 0L);
long longExtra2 = intent.getLongExtra("fast_time", 0L);
if (longExtra != 0) {
this.ecgHelper.getReportEcgBeanListByFastSlow().clear();
this.slowTime = longExtra;
clearList();
for (int i3 = 0; i3 < 7; i3++) {
getLine(this.waveDataTypeList.get(i3).byteValue(), longExtra);
}
EcgHelper ecgHelper = this.ecgHelper;
ecgHelper.saveFastSlowData(ecgHelper.map(this.ecgIList, this.ecgIIList, this.ecgIIIList, this.ecgAVRList, this.ecgAVLList, this.ecgAVFList, this.ecgVList), this.binding.slowEcgStaticEcg);
this.binding.includeSlowEcgTime.tvTimeEcg.setText(DateUtils.longToHourMinuteSecond(longExtra));
}
if (longExtra2 != 0) {
this.fastTime = longExtra2;
clearList();
for (int i4 = 0; i4 < 7; i4++) {
getLine(this.waveDataTypeList.get(i4).byteValue(), longExtra2);
}
EcgHelper ecgHelper2 = this.ecgHelper;
ecgHelper2.saveFastSlowData(ecgHelper2.map(this.ecgIList, this.ecgIIList, this.ecgIIIList, this.ecgAVRList, this.ecgAVLList, this.ecgAVFList, this.ecgVList), this.binding.fastEcgStaticEcg);
this.binding.includeFastEcgTime.tvTimeEcg.setText(DateUtils.longToHourMinuteSecond(longExtra2));
}
this.ecgHelper.setMmMv(false);
this.ecgHelper.showFastSlowView(this.gainType);
refreshEcgMarkList();
}
}
protected void onDestroy() {
super.onDestroy();
KLog.d("destroy walk test report activity");
DisplayUtils.resetDeviceConfigDisplay(this);
}
public boolean onKeyDown(int i, KeyEvent keyEvent) {
if (i != 4 && i != 3) {
return true;
}
showNotSavePopupWindow();
return true;
}
public class DataFactory {
public DataFactory() {
}
List<ReportDataEntity> createReportDataList(Context context) {
char c;
String format;
int i;
String valueOf;
if (WalkTestReportNewActivity.this.bpList == null) {
WalkTestReportNewActivity.this.bpList = new ArrayList();
}
while (WalkTestReportNewActivity.this.bpList.size() < 2) {
WalkTestReportNewActivity.this.bpList.add("--");
}
if (WalkTestReportNewActivity.this.spo2MeanList == null) {
WalkTestReportNewActivity.this.spo2MeanList = new ArrayList();
}
while (WalkTestReportNewActivity.this.spo2MeanList.size() < 6) {
WalkTestReportNewActivity.this.spo2MeanList.add(0);
}
if (WalkTestReportNewActivity.this.spo2MeanList.size() > 0) {
for (int i2 = 0; i2 < WalkTestReportNewActivity.this.spo2MeanList.size(); i2++) {
if (WalkTestReportNewActivity.this.spo2MeanList.get(i2).intValue() > 100) {
WalkTestReportNewActivity.this.spo2MeanList.set(i2, 100);
}
}
}
ArrayList arrayList = new ArrayList();
arrayList.add(new ReportDataEntity(context.getString(R.string.before_1), String.format("%.0f", WalkTestReportNewActivity.this.panTompkinsForEcgResult.getHrMinute().get(0)), String.valueOf(Math.max(75, WalkTestReportNewActivity.this.spo2MeanList.get(0).intValue())), getRespItemStr(0), "--", "--", (String) WalkTestReportNewActivity.this.bpList.get(0)));
boolean hideStepCount = WalkTestReportNewActivity.this.reportParaEntity.getHideStepCount();
if (!WalkTestReportNewActivity.this.reportParaEntity.getHideEveryStepCount() && WalkTestReportNewActivity.this.hasDistanceAndStepCount()) {
arrayList.add(new ReportDataEntity("1", String.format("%.0f", WalkTestReportNewActivity.this.panTompkinsForEcgResult.getHrMinute().get(1)), String.valueOf(Math.max(75, WalkTestReportNewActivity.this.spo2MeanList.get(1).intValue())), getRespItemStr(1), hideStepCount ? "--" : String.valueOf(WalkTestReportNewActivity.this.calStepCountList.get(0)), String.format("%.0f", WalkTestReportNewActivity.this.calDistanceList.get(0)), "--"));
arrayList.add(new ReportDataEntity(ExifInterface.GPS_MEASUREMENT_2D, String.format("%.0f", WalkTestReportNewActivity.this.panTompkinsForEcgResult.getHrMinute().get(2)), String.valueOf(Math.max(75, WalkTestReportNewActivity.this.spo2MeanList.get(2).intValue())), getRespItemStr(2), hideStepCount ? "--" : String.valueOf(WalkTestReportNewActivity.this.calStepCountList.get(1)), String.format("%.0f", WalkTestReportNewActivity.this.calDistanceList.get(1)), "--"));
String format2 = String.format("%.0f", WalkTestReportNewActivity.this.panTompkinsForEcgResult.getHrMinute().get(3));
String valueOf2 = String.valueOf(Math.max(75, WalkTestReportNewActivity.this.spo2MeanList.get(3).intValue()));
String respItemStr = getRespItemStr(3);
if (hideStepCount) {
valueOf = "--";
i = 2;
} else {
i = 2;
valueOf = String.valueOf(WalkTestReportNewActivity.this.calStepCountList.get(2));
}
arrayList.add(new ReportDataEntity(ExifInterface.GPS_MEASUREMENT_3D, format2, valueOf2, respItemStr, valueOf, String.format("%.0f", WalkTestReportNewActivity.this.calDistanceList.get(i)), "--"));
arrayList.add(new ReportDataEntity("4", String.format("%.0f", WalkTestReportNewActivity.this.panTompkinsForEcgResult.getHrMinute().get(4)), String.valueOf(Math.max(75, WalkTestReportNewActivity.this.spo2MeanList.get(4).intValue())), getRespItemStr(4), hideStepCount ? "--" : String.valueOf(WalkTestReportNewActivity.this.calStepCountList.get(3)), String.format("%.0f", WalkTestReportNewActivity.this.calDistanceList.get(3)), "--"));
arrayList.add(new ReportDataEntity("5", String.format("%.0f", WalkTestReportNewActivity.this.panTompkinsForEcgResult.getHrMinute().get(5)), String.valueOf(Math.max(75, WalkTestReportNewActivity.this.spo2MeanList.get(5).intValue())), getRespItemStr(5), hideStepCount ? "--" : String.valueOf(WalkTestReportNewActivity.this.calStepCountList.get(4)), String.format("%.0f", WalkTestReportNewActivity.this.calDistanceList.get(4)), "--"));
arrayList.add(new ReportDataEntity("6", String.format("%.0f", WalkTestReportNewActivity.this.panTompkinsForEcgResult.getHrMinute().get(6)), String.valueOf(Math.max(75, WalkTestReportNewActivity.this.spo2MeanList.get(6).intValue())), getRespItemStr(6), hideStepCount ? "--" : String.valueOf(WalkTestReportNewActivity.this.calStepCountList.get(5)), String.format("%.0f", WalkTestReportNewActivity.this.calDistanceList.get(5)), "--"));
} else {
arrayList.add(new ReportDataEntity("1", String.format("%.0f", WalkTestReportNewActivity.this.panTompkinsForEcgResult.getHrMinute().get(1)), String.valueOf(Math.max(75, WalkTestReportNewActivity.this.spo2MeanList.get(1).intValue())), getRespItemStr(1), "--", "--", "--"));
arrayList.add(new ReportDataEntity(ExifInterface.GPS_MEASUREMENT_2D, String.format("%.0f", WalkTestReportNewActivity.this.panTompkinsForEcgResult.getHrMinute().get(2)), String.valueOf(Math.max(75, WalkTestReportNewActivity.this.spo2MeanList.get(2).intValue())), getRespItemStr(2), "--", "--", "--"));
arrayList.add(new ReportDataEntity(ExifInterface.GPS_MEASUREMENT_3D, String.format("%.0f", WalkTestReportNewActivity.this.panTompkinsForEcgResult.getHrMinute().get(3)), String.valueOf(Math.max(75, WalkTestReportNewActivity.this.spo2MeanList.get(3).intValue())), getRespItemStr(3), "--", "--", "--"));
arrayList.add(new ReportDataEntity("4", String.format("%.0f", WalkTestReportNewActivity.this.panTompkinsForEcgResult.getHrMinute().get(4)), String.valueOf(Math.max(75, WalkTestReportNewActivity.this.spo2MeanList.get(4).intValue())), getRespItemStr(4), "--", "--", "--"));
arrayList.add(new ReportDataEntity("5", String.format("%.0f", WalkTestReportNewActivity.this.panTompkinsForEcgResult.getHrMinute().get(5)), String.valueOf(Math.max(75, WalkTestReportNewActivity.this.spo2MeanList.get(5).intValue())), getRespItemStr(5), "--", "--", "--"));
arrayList.add(new ReportDataEntity("6", String.format("%.0f", WalkTestReportNewActivity.this.panTompkinsForEcgResult.getHrMinute().get(6)), String.valueOf(Math.max(75, WalkTestReportNewActivity.this.spo2MeanList.get(6).intValue())), getRespItemStr(6), "--", "--", "--"));
}
arrayList.add(new ReportDataEntity(context.getString(R.string.after_1), String.format("%.0f", WalkTestReportNewActivity.this.panTompkinsForEcgResult.getHrMinute().get(7)), String.valueOf(Math.max(75, WalkTestReportNewActivity.this.spo2MeanList.get(7).intValue())), getRespItemStr(7), hideStepCount ? "--" : String.valueOf(WalkTestReportNewActivity.this.totalStepCount), String.format("%.0f", Double.valueOf(WalkTestReportNewActivity.this.totalDistance)), (String) WalkTestReportNewActivity.this.bpList.get(1)));
arrayList.add(new ReportDataEntity(context.getString(R.string.max), String.format("%.0f", Double.valueOf(getMaxDouble(WalkTestReportNewActivity.this.panTompkinsForEcgResult.getHrMinute()))), String.valueOf(Math.max(75, getMaxInt(WalkTestReportNewActivity.this.spo2MeanList))), getRespItemStr(8), "--", "--", "--"));
arrayList.add(new ReportDataEntity(context.getString(R.string.min), String.format("%.0f", Double.valueOf(getMinDouble(WalkTestReportNewActivity.this.panTompkinsForEcgResult.getHrMinute()))), String.valueOf(Math.max(75, getMinInt(WalkTestReportNewActivity.this.spo2MeanList))), getRespItemStr(9), "--", "--", "--"));
String string = context.getString(R.string.ave);
String format3 = String.format("%.0f", Double.valueOf(getAveDouble(WalkTestReportNewActivity.this.panTompkinsForEcgResult.getHrMinute())));
String format4 = String.format("%.0f", Float.valueOf(Math.max(75.0f, getAveInt(WalkTestReportNewActivity.this.spo2MeanList))));
String respItemStr2 = getRespItemStr(10);
if (hideStepCount) {
format = "--";
c = 0;
} else {
c = 0;
format = String.format("%.0f", Float.valueOf(WalkTestReportNewActivity.this.totalStepCount / 6.0f));
}
Object[] objArr = new Object[1];
objArr[c] = Float.valueOf(((float) WalkTestReportNewActivity.this.totalDistance) / 6.0f);
arrayList.add(new ReportDataEntity(string, format3, format4, respItemStr2, format, String.format("%.0f", objArr), "--"));
return arrayList;
}
private String getRespItemStr(int i) {
List<Double> hrMinute = WalkTestReportNewActivity.this.respPeakCalResult.getHrMinute();
if (!GzjSharePref.getBoolValue(GzjSharePref.KEY_SHOW_RESP) || hrMinute == null || hrMinute.isEmpty()) {
return "--";
}
double d = 0.0d;
if (i >= 0 && i <= 7) {
d = hrMinute.get(i).doubleValue();
} else if (i == 8) {
d = getMaxDouble(hrMinute);
} else if (i == 9) {
d = getMinDouble(hrMinute);
} else if (i == 10) {
d = getAveDouble(hrMinute);
}
return String.format("%.0f", Double.valueOf(d));
}
public double getMaxDouble(List<Double> list) {
if (list == null || list.size() == 0) {
return 0.0d;
}
double doubleValue = list.get(0).doubleValue();
Iterator<Double> it = list.iterator();
while (it.hasNext()) {
doubleValue = Math.max(it.next().doubleValue(), doubleValue);
}
return doubleValue;
}
public int getMaxInt(List<Integer> list) {
int i = 0;
if (list != null && list.size() != 0) {
i = list.get(0).intValue();
Iterator<Integer> it = list.iterator();
while (it.hasNext()) {
i = Math.max(it.next().intValue(), i);
}
}
return i;
}
public double getMinDouble(List<Double> list) {
if (list == null || list.size() == 0) {
return 0.0d;
}
double doubleValue = list.get(0).doubleValue();
Iterator<Double> it = list.iterator();
while (it.hasNext()) {
doubleValue = Math.min(it.next().doubleValue(), doubleValue);
}
return doubleValue;
}
public int getMinInt(List<Integer> list) {
int i = 0;
if (list != null && list.size() != 0) {
i = list.get(0).intValue();
Iterator<Integer> it = list.iterator();
while (it.hasNext()) {
i = Math.min(it.next().intValue(), i);
}
}
return i;
}
public double getAveDouble(List<Double> list) {
double d = 0.0d;
if (list == null || list.size() == 0) {
return 0.0d;
}
Iterator<Double> it = list.iterator();
while (it.hasNext()) {
d += it.next().doubleValue();
}
return d / list.size();
}
public float getAveInt(List<Integer> list) {
if (list == null || list.size() == 0) {
return 0.0f;
}
int i = 0;
Iterator<Integer> it = list.iterator();
while (it.hasNext()) {
i += it.next().intValue();
}
return i / list.size();
}
List<HrvStatisticDataEntity> createHrvStatisticDataList(Context context) {
ArrayList arrayList = new ArrayList();
arrayList.add(new HrvStatisticDataEntity(context.getString(R.string.measured_value), ((float) WalkTestReportNewActivity.this.panTompkinsForEcgResult.getSdnn()) * 1000.0f, ((float) WalkTestReportNewActivity.this.panTompkinsForEcgResult.getRmsdd()) * 1000.0f, ((float) WalkTestReportNewActivity.this.panTompkinsForEcgResult.getSdsd()) * 1000.0f));
return arrayList;
}
}
private void startGradePopupWindows() {
BreathGradePopupWindow breathGradePopupWindow = new BreathGradePopupWindow(this, new BreathGradePopupWindow.BreathGradeItemClickListener() {
@Override
public final void onBreathGradeItemClick(String str) {
WalkTestReportNewActivity.this.m321xe891075(str);
}
});
breathGradePopupWindow.setOutSideDismiss(false);
breathGradePopupWindow.setBackPressEnable(false);
breathGradePopupWindow.showPopupWindow();
}
public void m321xe891075(String str) {
this.binding.breathGradeTv.setText(String.format("%s %s", getString(R.string.breath_scale_), str));
this.breathGradeScore = str;
KLog.d(String.format("%s %s", getString(R.string.breath_scale_), str));
BorgGradePopupWindow borgGradePopupWindow = new BorgGradePopupWindow(this, new AnonymousClass2());
borgGradePopupWindow.setOutSideDismiss(false);
borgGradePopupWindow.setBackPressEnable(false);
borgGradePopupWindow.showPopupWindow();
}
class AnonymousClass2 implements BorgGradePopupWindow.BorgGradeItemClickListener {
AnonymousClass2() {
}
@Override
public void onBorgGradeItemClick(String str) {
double maleStepPitch;
float maleStepPitch2;
WalkTestReportNewActivity.this.binding.borgScaleTv.setText(String.format("%s %s", WalkTestReportNewActivity.this.getString(R.string.borg_scale_), str));
WalkTestReportNewActivity.this.borgGradeScore = str;
KLog.d(String.format("%s %s", WalkTestReportNewActivity.this.getString(R.string.borg_scale_), str));
if (WalkTestReportNewActivity.this.isValidStepCountList() || WalkTestReportNewActivity.this.patient.getStepPitch() > 0.0d) {
return;
}
double height = WalkTestReportNewActivity.this.patient.getHeight();
if (WalkTestReportNewActivity.this.patient.getGender().equals(WalkTestReportNewActivity.this.getString(R.string.woman))) {
maleStepPitch = height > 0.0d ? (height / WalkTestReportNewActivity.FEMALE_STANDARD_HEIGHT) * WalkTestReportNewActivity.FEMALE_STANDARD_STEP_COUNT : WalkTestReportNewActivity.this.reportParaEntity.getFemaleStepPitch();
maleStepPitch2 = WalkTestReportNewActivity.this.reportParaEntity.getFemaleStepPitch();
} else {
maleStepPitch = height > 0.0d ? (height / WalkTestReportNewActivity.MALE_STANDARD_HEIGHT) * WalkTestReportNewActivity.MALE_STANDARD_STEP_COUNT : WalkTestReportNewActivity.this.reportParaEntity.getMaleStepPitch();
maleStepPitch2 = WalkTestReportNewActivity.this.reportParaEntity.getMaleStepPitch();
}
final double d = maleStepPitch2;
View inflate = LayoutInflater.from(WalkTestReportNewActivity.this).inflate(R.layout.dialog_edit_text, (ViewGroup) null);
final EditText editText = (EditText) inflate.findViewById(R.id.et_step_pitch);
final String format = String.format(Locale.CHINA, "%.1f", Double.valueOf(maleStepPitch));
?? r10 = WalkTestReportNewActivity.this;
DialogUtils.showEditTextDialog(r10, r10.getString(R.string.dialog_02), WalkTestReportNewActivity.this.getString(R.string.notice_no_patient_step_pitch), WalkTestReportNewActivity.this.getString(R.string.yes), WalkTestReportNewActivity.this.getString(R.string.returndefault) + String.format(Locale.CHINA, "%.1f", Double.valueOf(d)) + WalkTestReportNewActivity.this.getString(R.string.centimetre), new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
WalkTestReportNewActivity.AnonymousClass2.this.m323x2e9f0fe9(format, editText, dialogInterface, i);
}
}, new DialogInterface.OnClickListener() {
@Override
public final void onClick(DialogInterface dialogInterface, int i) {
WalkTestReportNewActivity.AnonymousClass2.this.m324x57f3652a(d, dialogInterface, i);
}
}, inflate, editText, format);
}
public void m323x2e9f0fe9(String str, EditText editText, DialogInterface dialogInterface, int i) {
if (str.equals(editText.getText().toString())) {
return;
}
double parseDouble = Double.parseDouble(editText.getText().toString());
if (parseDouble > 0.0d) {
WalkTestReportNewActivity.this.updateStepPitch(parseDouble);
} else {
ToastUtils.showMessage((Context) WalkTestReportNewActivity.this, R.string.param_can_not_below_zero);
}
}
public void m324x57f3652a(double d, DialogInterface dialogInterface, int i) {
if (d > 0.0d) {
WalkTestReportNewActivity.this.updateStepPitch(d);
}
}
}
private void refreshReportDataView() {
if (this.binding.reportDataTableView != null) {
this.reportDataEntityList.clear();
this.reportDataEntityList = this.dataFactory.createReportDataList(this);
this.reportTableDataAdapter = new ReportTableDataAdapter(this, this.reportDataEntityList, this.binding.reportDataTableView);
this.binding.reportDataTableView.setDataAdapter(this.reportTableDataAdapter);
this.binding.reportDataTableView.setSwipeToRefreshEnabled(false);
this.reportTableDataAdapter.notifyDataSetChanged();
initHrRelations();
}
}
public void refreshReportVisible() {
this.mets = String.format("%.1f", Double.valueOf((((this.totalDistance * 0.1d) / 6.0d) + 3.5d) / 3.5d));
this.binding.metsTv.setText(this.reportParaEntity.getHideMet() ? "" : String.format("%s%s", getString(R.string.mets_), this.mets + "METs"));
initHrRelations();
this.binding.llExerciseIntensity.setVisibility(this.reportParaEntity.getHideExercisePrescription() ? 8 : 0);
this.binding.sportAdviceTv.setVisibility(this.reportParaEntity.getHideExercisePrescription() ? 8 : 0);
this.binding.sportAdviceTv.setVisibility(8);
setEcgVisible(this.binding.beforeEcgFlStatic, this.reportParaEntity.getHideHr() || this.reportParaEntity.getHideBeforeHr());
setEcgVisible(this.binding.fastEcgFlStatic, this.reportParaEntity.getHideHr());
setEcgVisible(this.binding.slowEcgFlStatic, this.reportParaEntity.getHideHr());
setEcgVisible(this.binding.afterEcgFlStatic, this.reportParaEntity.getHideHr() || this.reportParaEntity.getHideAfterHr());
setEcgVisible(this.binding.start1EcgFlStatic, this.reportParaEntity.getHideHr() || this.reportParaEntity.getHideStartEveryHr());
setEcgVisible(this.binding.start2EcgFlStatic, this.reportParaEntity.getHideHr() || this.reportParaEntity.getHideStartEveryHr());
setEcgVisible(this.binding.start3EcgFlStatic, this.reportParaEntity.getHideHr() || this.reportParaEntity.getHideStartEveryHr());
setEcgVisible(this.binding.start4EcgFlStatic, this.reportParaEntity.getHideHr() || this.reportParaEntity.getHideStartEveryHr());
setEcgVisible(this.binding.start5EcgFlStatic, this.reportParaEntity.getHideHr() || this.reportParaEntity.getHideStartEveryHr());
setEcgVisible(this.binding.start6EcgFlStatic, this.reportParaEntity.getHideHr() || this.reportParaEntity.getHideStartEveryHr());
if (this.reportParaEntity.getHideHr()) {
this.binding.markHr.mark1EcgFl.setVisibility(8);
this.binding.markHr.mark2EcgFl.setVisibility(8);
this.binding.markHr.mark3EcgFl.setVisibility(8);
this.binding.markHr.mark4EcgFl.setVisibility(8);
this.binding.markHr.mark1Ecg.setVisibility(8);
this.binding.markHr.mark2Ecg.setVisibility(8);
this.binding.markHr.mark3Ecg.setVisibility(8);
this.binding.markHr.mark4Ecg.setVisibility(8);
} else {
if (this.ecgMarkEntityList.size() > 0 && this.ecgMarkEntityList.get(0) != null && this.ecgMarkEntityList.get(0).getEcgTime().longValue() != 0) {
this.binding.markHr.mark1EcgFl.setVisibility(0);
this.binding.markHr.mark1Ecg.setVisibility(0);
} else {
this.binding.markHr.mark1EcgFl.setVisibility(8);
this.binding.markHr.mark1Ecg.setVisibility(8);
}
if (this.ecgMarkEntityList.size() > 1 && this.ecgMarkEntityList.get(1) != null && this.ecgMarkEntityList.get(1).getEcgTime().longValue() != 0) {
this.binding.markHr.mark2EcgFl.setVisibility(0);
this.binding.markHr.mark2Ecg.setVisibility(0);
} else {
this.binding.markHr.mark2EcgFl.setVisibility(8);
this.binding.markHr.mark2Ecg.setVisibility(8);
}
if (this.ecgMarkEntityList.size() > 2 && this.ecgMarkEntityList.get(2) != null && this.ecgMarkEntityList.get(2).getEcgTime().longValue() != 0) {
this.binding.markHr.mark3EcgFl.setVisibility(0);
this.binding.markHr.mark3Ecg.setVisibility(0);
} else {
this.binding.markHr.mark3EcgFl.setVisibility(8);
this.binding.markHr.mark3Ecg.setVisibility(8);
}
if (this.ecgMarkEntityList.size() > 3 && this.ecgMarkEntityList.get(3) != null && this.ecgMarkEntityList.get(3).getEcgTime().longValue() != 0) {
this.binding.markHr.mark4EcgFl.setVisibility(0);
this.binding.markHr.mark4Ecg.setVisibility(0);
} else {
this.binding.markHr.mark4EcgFl.setVisibility(8);
this.binding.markHr.mark4Ecg.setVisibility(8);
}
}
if (this.reportParaEntity.getHideTrend()) {
this.binding.hrTrendTitleLl.setVisibility(8);
this.binding.hrTrendChart.setVisibility(8);
} else {
this.binding.hrTrendTitleLl.setVisibility(0);
this.binding.hrTrendChart.setVisibility(0);
}
boolean hideRrStatistic = this.reportParaEntity.getHideRrStatistic();
this.binding.hrvStatisticTitle.setVisibility(hideRrStatistic ? 8 : 0);
this.binding.hrvStatisticChart.setVisibility(hideRrStatistic ? 8 : 0);
this.binding.rrIntervalStatisticTitle.setVisibility(hideRrStatistic ? 8 : 0);
this.binding.rrIntervalStatisticChart.setVisibility(hideRrStatistic ? 8 : 0);
this.binding.rrDiffIntervalStatisticTitle.setVisibility(8);
this.binding.rrDiffIntervalStatisticChart.setVisibility(8);
this.binding.rrLorenzStatisticTitle.setVisibility(hideRrStatistic ? 8 : 0);
this.binding.rrLorenzStatisticChart.setVisibility(hideRrStatistic ? 8 : 0);
this.binding.hrvSelect.clHrv.setVisibility(hideRrStatistic ? 8 : 0);
}
private void setEcgVisible(FrameLayout frameLayout, boolean z) {
frameLayout.getChildAt(0).setVisibility(z ? 8 : 0);
frameLayout.setVisibility(z ? 8 : 0);
}
public void startReportParasWindows() {
ReportParasPopupWindow reportParasPopupWindow = new ReportParasPopupWindow(this, this.totalDistance, this.reportParaEntity, new ReportParasPopupWindow.ReportParasConfirmClickListener() {
@Override
public final void onConfirmClick(double d, int i, boolean z, boolean z2, boolean z3, boolean z4, boolean z5, boolean z6, boolean z7, boolean z8, boolean z9, boolean z10, boolean z11) {
WalkTestReportNewActivity.this.m322xbfd58c8b(d, i, z, z2, z3, z4, z5, z6, z7, z8, z9, z10, z11);
}
});
reportParasPopupWindow.setOutSideDismiss(false);
reportParasPopupWindow.setBackPressEnable(false);
reportParasPopupWindow.showPopupWindow();
}
public void m322xbfd58c8b(double d, int i, boolean z, boolean z2, boolean z3, boolean z4, boolean z5, boolean z6, boolean z7, boolean z8, boolean z9, boolean z10, boolean z11) {
int reportEcgGain = this.reportParaEntity.getReportEcgGain();
this.reportParaEntity.setReportEcgGain(i);
this.reportParaEntity.setHideStepCount(z);
this.reportParaEntity.setHideEveryStepCount(z2);
this.reportParaEntity.setHideMet(z3);
this.reportParaEntity.setHideExercisePrescription(z4);
this.reportParaEntity.setHideBeforeHr(z5);
this.reportParaEntity.setHideAfterHr(z6);
this.reportParaEntity.setHideStartEveryHr(z7);
this.reportParaEntity.setHideHr(z8);
this.reportParaEntity.setHideTrend(z9);
this.reportParaEntity.setHideRrStatistic(z10);
this.reportParaEntity.setHideDoctorIdea(Boolean.valueOf(z11));
KLog.i("set report parameters: " + this.reportParaEntity);
if (reportEcgGain != i) {
initHisDataGridChartList();
this.gainType = i;
this.ecgHelper.setMmMv(true);
createEcgDataTables(this.slowTime, this.fastTime, false);
}
if (!String.format("%.2f", Double.valueOf(this.totalDistance)).equals(String.format("%.2f", Double.valueOf(d)))) {
KLog.i("update totalDistance:" + String.format("%.2f", Double.valueOf(this.totalDistance)) + " to " + String.format("%.2f", Double.valueOf(d)));
updateTotalDistance(Double.parseDouble(String.format("%.2f", Double.valueOf(d))));
}
refreshReportDataView();
refreshReportVisible();
this.reportPresenter.switchDoctorIdea(z11);
this.reportPresenter.setImageScrollBorder();
}
public void getTrendData() {
Drawable drawable;
int i;
int i2;
String str;
char c;
ArrayList<Entry> arrayList = new ArrayList<>();
int i3 = 1;
String str2 = "%.0f";
int parseInt = Integer.parseInt(String.format("%.0f", this.panTompkinsForEcgResult.getHrMinute().get(0)));
int parseInt2 = Integer.parseInt(String.format("%.0f", this.panTompkinsForEcgResult.getHrMinute().get(0)));
int i4 = 0;
while (true) {
drawable = null;
i = 7;
if (i4 >= 8) {
break;
}
float parseFloat = Float.parseFloat(String.format("%.0f", this.panTompkinsForEcgResult.getHrMinute().get(i4)));
if (i4 == 0 || i4 == 7) {
arrayList.add(new Entry(i4 + 1, parseFloat, getResources().getDrawable(R.drawable.star)));
} else {
arrayList.add(new Entry(i4 + 1, parseFloat, (Drawable) null));
}
if (parseInt <= parseFloat) {
parseInt = Integer.parseInt(String.format("%.0f", this.panTompkinsForEcgResult.getHrMinute().get(i4)));
}
if (parseInt2 >= parseFloat) {
parseInt2 = Integer.parseInt(String.format("%.0f", this.panTompkinsForEcgResult.getHrMinute().get(i4)));
}
i4++;
}
int i5 = ((parseInt / 10) + 1) * 10;
int i6 = (parseInt2 / 10) * 10;
ArrayList<Entry> arrayList2 = new ArrayList<>();
int intValue = this.spo2MeanList.get(0).intValue();
int intValue2 = this.spo2MeanList.get(0).intValue();
if (this.spo2MeanList.get(0).intValue() > 100) {
intValue = 100;
intValue2 = 100;
}
if (this.spo2MeanList.get(0).intValue() < 75) {
intValue = 75;
intValue2 = 75;
}
int i7 = 0;
for (i2 = 8; i7 < i2; i2 = 8) {
float parseFloat2 = Float.parseFloat(String.valueOf(this.spo2MeanList.get(i7)));
if (parseFloat2 > 100.0f) {
parseFloat2 = 100.0f;
}
if (parseFloat2 < 75.0f) {
parseFloat2 = 75.0f;
}
if (intValue <= parseFloat2) {
intValue = (int) parseFloat2;
}
if (intValue2 >= parseFloat2) {
intValue2 = (int) parseFloat2;
}
if (i7 == 0 || i7 == i) {
arrayList2.add(new Entry(i7 + 1, parseFloat2, getResources().getDrawable(R.drawable.star)));
} else {
arrayList2.add(new Entry(i7 + 1, parseFloat2, drawable));
}
i7++;
drawable = null;
i = 7;
}
int i8 = ((intValue / 10) + 1) * 10;
int i9 = i8 <= 100 ? i8 : 100;
int i10 = (intValue2 / 10) * 10;
ArrayList<Entry> arrayList3 = new ArrayList<>();
char c2 = 0;
int parseInt3 = Integer.parseInt(String.format("%.0f", this.respPeakCalResult.getHrMinute().get(0)));
int parseInt4 = Integer.parseInt(String.format("%.0f", this.respPeakCalResult.getHrMinute().get(0)));
int i11 = 0;
while (i11 < 8) {
Object[] objArr = new Object[i3];
objArr[c2] = this.respPeakCalResult.getHrMinute().get(i11);
float parseFloat3 = Float.parseFloat(String.format(str2, objArr));
if (parseInt3 <= parseFloat3) {
Object[] objArr2 = new Object[i3];
objArr2[c2] = this.respPeakCalResult.getHrMinute().get(i11);
parseInt3 = Integer.parseInt(String.format(str2, objArr2));
}
if (parseInt4 >= parseFloat3) {
Object[] objArr3 = new Object[i3];
objArr3[0] = this.respPeakCalResult.getHrMinute().get(i11);
parseInt4 = Integer.parseInt(String.format(str2, objArr3));
}
if (i11 == 0 || i11 == 7) {
str = str2;
c = 446;
arrayList3.add(new Entry(i11 + 1, parseFloat3, getResources().getDrawable(R.drawable.star)));
} else {
arrayList3.add(new Entry(i11 + 1, parseFloat3, (Drawable) null));
str = str2;
c = 446;
}
i11++;
str2 = str;
i3 = 1;
c2 = 0;
}
int i12 = ((parseInt3 / 10) + 1) * 10;
int i13 = (parseInt4 / 10) * 10;
ArrayList arrayList4 = new ArrayList();
arrayList4.add(arrayList);
arrayList4.add(arrayList2);
if (GzjSharePref.getBoolValue(GzjSharePref.KEY_SHOW_RESP)) {
arrayList4.add(arrayList3);
}
this.binding.hrTrendChart.getAxisLeft().setAxisMaximum(Math.max(Math.max(i5, i9), i12));
this.binding.hrTrendChart.getAxisLeft().setAxisMinimum(Math.min(Math.min(i6, i10), i13));
setLineChartData(this.binding.hrTrendChart, arrayList4);
}
public void setLineChartData(final LineChart lineChart, List<ArrayList<Entry>> list) {
String sb;
int color;
int color2;
lineChart.setBackgroundColor(-1);
lineChart.getDescription().setEnabled(false);
lineChart.getXAxis().setPosition(XAxis.XAxisPosition.BOTTOM);
lineChart.setTouchEnabled(false);
lineChart.setDrawGridBackground(false);
lineChart.getAxisRight().setEnabled(false);
ArrayList arrayList = new ArrayList();
int i = 0;
while (i < list.size()) {
ArrayList<Entry> arrayList2 = list.get(i);
if (i == 0) {
sb = getString(R.string.ecg) + getString(R.string.times_minute_);
} else {
sb = (i == 1 ? new StringBuilder().append(getString(R.string.spo2)).append("(%)") : new StringBuilder().append(getString(R.string.resp)).append(getString(R.string.times_minute_))).toString();
}
LineDataSet lineDataSet = new LineDataSet(arrayList2, sb);
lineDataSet.setDrawIcons(true);
if (i == 0) {
color = ContextCompat.getColor(this, R.color.black);
} else {
color = i == 1 ? ContextCompat.getColor(this, R.color.black_95) : ContextCompat.getColor(this, R.color.black_70);
}
lineDataSet.setColor(color);
if (i == 0) {
color2 = ContextCompat.getColor(this, R.color.black);
} else {
color2 = i == 1 ? ContextCompat.getColor(this, R.color.black_95) : ContextCompat.getColor(this, R.color.black_70);
}
lineDataSet.setCircleColor(color2);
lineDataSet.setLineWidth(2.0f);
lineDataSet.setCircleRadius(5.0f);
lineDataSet.setDrawCircleHole(false);
lineDataSet.setFormLineWidth(1.0f);
lineDataSet.setFormLineDashEffect(new DashPathEffect(new float[]{10.0f, 5.0f}, 0.0f));
lineDataSet.setFormSize(18.0f);
lineDataSet.setValueTextSize(14.0f);
lineDataSet.setValueFormatter(new DefaultValueFormatter(0));
if (i == 1) {
lineDataSet.enableDashedLine(10.0f, 5.0f, 0.0f);
lineDataSet.enableDashedHighlightLine(10.0f, 5.0f, 0.0f);
}
lineDataSet.setDrawFilled(false);
lineDataSet.setFillFormatter(new IFillFormatter() {
public final float getFillLinePosition(ILineDataSet iLineDataSet, LineDataProvider lineDataProvider) {
float axisMinimum;
axisMinimum = lineChart.getAxisLeft().getAxisMinimum();
return axisMinimum;
}
});
arrayList.add(lineDataSet);
lineChart.setData(new LineData(arrayList));
lineChart.invalidate();
i++;
}
}
public void clearEcgIList() {
this.ecgIList.clear();
this.ecgIIList.clear();
}
public void clearList() {
this.originalPoint = 0L;
this.dataTime = 0L;
this.ecgIList.clear();
this.ecgIIList.clear();
this.ecgIIIList.clear();
this.ecgVList.clear();
this.ecgAVLList.clear();
this.ecgAVFList.clear();
this.ecgAVRList.clear();
}
public String setDHS(String str) {
return DateUtils.longToTimeMillisStr(Long.parseLong(str)).split(" +")[1];
}
public int getNowPoint() {
FileInputStream fileInputStream;
File file = new File(CURRENT_POINT_FILE);
int length = (int) file.length();
if (length == 0) {
return 0;
}
byte[] bArr = new byte[length];
?? r3 = 0;
FileInputStream fileInputStream2 = null;
try {
try {
try {
fileInputStream = new FileInputStream(file);
} catch (Throwable th) {
th = th;
}
} catch (Exception e) {
e = e;
}
} catch (IOException e2) {
e2.printStackTrace();
}
try {
fileInputStream.read(bArr);
fileInputStream.close();
} catch (Exception e3) {
e = e3;
fileInputStream2 = fileInputStream;
e.printStackTrace();
fileInputStream2.close();
r3 = 65536;
return (bArr[0] & 255) + ((bArr[1] & 255) * 256) + ((bArr[2] & 255) * 65536) + ((bArr[3] & 255) * 16777216);
} catch (Throwable th2) {
th = th2;
r3 = fileInputStream;
try {
r3.close();
} catch (IOException e4) {
e4.printStackTrace();
}
throw th;
}
r3 = 65536;
return (bArr[0] & 255) + ((bArr[1] & 255) * 256) + ((bArr[2] & 255) * 65536) + ((bArr[3] & 255) * 16777216);
}
public long findTime(int i) {
this.fileData = new byte[8];
this.mChannel = null;
this.out = null;
long j = 0;
try {
try {
try {
FileChannel channel = new RandomAccessFile(this.mFile, "rw").getChannel();
this.mChannel = channel;
MappedByteBuffer map = channel.map(FileChannel.MapMode.READ_ONLY, i, 8L);
this.out = map;
map.get(this.fileData, 0, 8);
for (int i2 = 0; i2 < 8; i2++) {
j += (this.fileData[i2] & 255) << (i2 * 8);
}
FileChannel fileChannel = this.mChannel;
if (fileChannel != null) {
fileChannel.close();
}
} catch (Exception e) {
e.printStackTrace();
FileChannel fileChannel2 = this.mChannel;
if (fileChannel2 != null) {
fileChannel2.close();
}
}
} catch (Throwable th) {
try {
FileChannel fileChannel3 = this.mChannel;
if (fileChannel3 != null) {
fileChannel3.close();
}
} catch (Exception e2) {
e2.printStackTrace();
}
throw th;
}
} catch (Exception e3) {
e3.printStackTrace();
}
return j;
}
private void getEcgData(boolean z) {
if (z) {
clearList();
for (int i = 0; i < 7; i++) {
getLine(this.waveDataTypeList.get(i).byteValue(), this.beforeMidTime);
}
this.ecgHelper.showEcgView(this.binding.beforeEcgStaticEcg, this.ecgIList, this.ecgIIList, this.ecgIIIList, this.ecgAVRList, this.ecgAVLList, this.ecgAVFList, this.ecgVList, 0L);
setEcgTime(this.binding.includeBeforeEcgTime.tvTimeEcg, this.beforeMidTime);
clearList();
for (int i2 = 0; i2 < 7; i2++) {
getLine(this.waveDataTypeList.get(i2).byteValue(), this.start1Time);
}
this.ecgHelper.showEcgView(this.binding.start1EcgStaticEcg, this.ecgIList, this.ecgIIList, this.ecgIIIList, this.ecgAVRList, this.ecgAVLList, this.ecgAVFList, this.ecgVList, 300L);
setEcgTime(this.binding.includeStart1EcgTime.tvTimeEcg, this.start1Time);
clearList();
for (int i3 = 0; i3 < 7; i3++) {
getLine(this.waveDataTypeList.get(i3).byteValue(), this.start2Time);
}
this.ecgHelper.showEcgView(this.binding.start2EcgStaticEcg, this.ecgIList, this.ecgIIList, this.ecgIIIList, this.ecgAVRList, this.ecgAVLList, this.ecgAVFList, this.ecgVList, 600L);
setEcgTime(this.binding.includeStart2EcgTime.tvTimeEcg, this.start2Time);
clearList();
for (int i4 = 0; i4 < 7; i4++) {
getLine(this.waveDataTypeList.get(i4).byteValue(), this.start3Time);
}
this.ecgHelper.showEcgView(this.binding.start3EcgStaticEcg, this.ecgIList, this.ecgIIList, this.ecgIIIList, this.ecgAVRList, this.ecgAVLList, this.ecgAVFList, this.ecgVList, 900L);
setEcgTime(this.binding.includeStart3EcgTime.tvTimeEcg, this.start3Time);
clearList();
for (int i5 = 0; i5 < 7; i5++) {
getLine(this.waveDataTypeList.get(i5).byteValue(), this.start4Time);
}
this.ecgHelper.showEcgView(this.binding.start4EcgStaticEcg, this.ecgIList, this.ecgIIList, this.ecgIIIList, this.ecgAVRList, this.ecgAVLList, this.ecgAVFList, this.ecgVList, 1200L);
setEcgTime(this.binding.includeStart4EcgTime.tvTimeEcg, this.start4Time);
clearList();
for (int i6 = 0; i6 < 7; i6++) {
getLine(this.waveDataTypeList.get(i6).byteValue(), this.start5Time);
}
this.ecgHelper.showEcgView(this.binding.start5EcgStaticEcg, this.ecgIList, this.ecgIIList, this.ecgIIIList, this.ecgAVRList, this.ecgAVLList, this.ecgAVFList, this.ecgVList, 1500L);
setEcgTime(this.binding.includeStart5EcgTime.tvTimeEcg, this.start5Time);
clearList();
for (int i7 = 0; i7 < 7; i7++) {
getLine(this.waveDataTypeList.get(i7).byteValue(), this.start6Time);
}
this.ecgHelper.showEcgView(this.binding.start6EcgStaticEcg, this.ecgIList, this.ecgIIList, this.ecgIIIList, this.ecgAVRList, this.ecgAVLList, this.ecgAVFList, this.ecgVList, 1800L);
setEcgTime(this.binding.includeStart6EcgTime.tvTimeEcg, this.start6Time);
clearList();
for (int i8 = 0; i8 < 7; i8++) {
getLine(this.waveDataTypeList.get(i8).byteValue(), this.afterMidTime);
}
this.ecgHelper.showEcgView(this.binding.afterEcgStaticEcg, this.ecgIList, this.ecgIIList, this.ecgIIIList, this.ecgAVRList, this.ecgAVLList, this.ecgAVFList, this.ecgVList, 2100L);
setEcgTime(this.binding.includeAfterEcgTime.tvTimeEcg, this.afterMidTime);
}
}
private void setEcgTime(TextView textView, long j) {
textView.setText(j <= 0 ? "" : DateUtils.longToHourMinuteSecond(j));
}
public void getECGIList(int i, int i2) {
int i3;
int i4 = i;
while (true) {
i3 = i + i2;
if (i4 >= i3) {
break;
}
if (i4 < TestWaveDataLists.getInstance().getECGIWaveDataFilterList().size()) {
this.ecgIList.add(TestWaveDataLists.getInstance().getECGIWaveDataFilterList().get(i4));
}
i4++;
}
while (i < i3) {
if (i < TestWaveDataLists.getInstance().getECGIIWaveDataFilterList().size()) {
this.ecgIIList.add(TestWaveDataLists.getInstance().getECGIIWaveDataFilterList().get(i));
}
i++;
}
}
public void getECGIIIList(int i, int i2) {
for (int i3 = i; i3 < i + i2; i3++) {
if (i3 < TestWaveDataLists.getInstance().getECGIIIWaveDataFilterList().size()) {
this.ecgIIIList.add(TestWaveDataLists.getInstance().getECGIIIWaveDataFilterList().get(i3));
}
}
}
public void getECGaVLList(int i, int i2) {
for (int i3 = i; i3 < i + i2; i3++) {
if (i3 < TestWaveDataLists.getInstance().getECGaVLWaveDataFilterList().size()) {
this.ecgAVLList.add(TestWaveDataLists.getInstance().getECGaVLWaveDataFilterList().get(i3));
}
}
}
public void getECGaVFList(int i, int i2) {
for (int i3 = i; i3 < i + i2; i3++) {
if (i3 < TestWaveDataLists.getInstance().getECGaVFWaveDataFilterList().size()) {
this.ecgAVFList.add(TestWaveDataLists.getInstance().getECGaVFWaveDataFilterList().get(i3));
}
}
}
public void getECGaVRList(int i, int i2) {
for (int i3 = i; i3 < i + i2; i3++) {
if (i3 < TestWaveDataLists.getInstance().getECGaVRWaveDataFilterList().size()) {
this.ecgAVRList.add(TestWaveDataLists.getInstance().getECGaVRWaveDataFilterList().get(i3));
}
}
}
public void getECGVList(int i, int i2) {
for (int i3 = i; i3 < i + i2; i3++) {
if (i3 < TestWaveDataLists.getInstance().getECGVWaveDataFilterList().size()) {
this.ecgVList.add(TestWaveDataLists.getInstance().getECGVWaveDataFilterList().get(i3));
}
}
}
public void getLine(byte b, long j) {
if (j <= 0) {
}
long j2 = j - this.startTime;
int i = this.speedType;
int i2 = 2000;
if (i == 1) {
i2 = 4000;
} else if (i != 2 && i == 3) {
i2 = 1000;
}
int max = Math.max((int) (j2 / 4), 0);
switch (b) {
case 1:
clearEcgIList();
getECGIList(max, i2);
break;
case 2:
clearEcgIList();
getECGIList(max, i2);
break;
case 3:
getECGIIIList(max, i2);
break;
case 4:
getECGaVLList(max, i2);
break;
case 5:
getECGaVRList(max, i2);
break;
case 6:
getECGaVFList(max, i2);
break;
case 7:
getECGVList(max, i2);
break;
}
}
public void saveWaveData() {
this.handler.post(new Runnable() {
@Override
public final void run() {
WalkTestReportNewActivity.this.m309xcd3f6c59();
}
});
}
public void m309xcd3f6c59() {
if (this.testData != null) {
KLog.d("save 8min wave data size=" + this.testData.length);
String str = ConstDefine.SD_PATH + "/WalkTest/HistoryData/" + (Constants.ReportFile.HISTORY_DATA_PREFIX + this.patient.getIdCard() + "_" + this.currentTime + Constants.ReportFile.HISTORY_DATA_SUFFIX);
File file = new File(ConstDefine.SD_PATH + "/WalkTest/HistoryData/");
if (!file.exists()) {
file.mkdirs();
}
File file2 = new File(str);
if (file2.exists()) {
file2.delete();
}
try {
file2.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
FileUtils.createFile(str, this.testData);
}
}
public byte[] get8MinFileData(int i, int i2) {
MappedByteBuffer map;
byte[] bArr = new byte[i2];
FileChannel fileChannel = null;
try {
try {
try {
fileChannel = new RandomAccessFile(this.mFile, "rw").getChannel();
if (fileChannel.size() > 1966080 && this.mFile.getName().contains(this.currentTime + "")) {
map = fileChannel.map(FileChannel.MapMode.READ_ONLY, 0L, i2);
} else {
map = fileChannel.map(FileChannel.MapMode.READ_ONLY, i, i2);
}
map.get(bArr, 0, i2);
} catch (Exception e) {
e.printStackTrace();
this.isTryCatch = true;
KLog.i("get8MinFileData发生catch");
if (fileChannel != null) {
fileChannel.close();
}
}
if (fileChannel != null) {
fileChannel.close();
}
} catch (Throwable th) {
if (fileChannel != null) {
try {
fileChannel.close();
} catch (IOException e2) {
e2.printStackTrace();
}
}
throw th;
}
} catch (IOException e3) {
e3.printStackTrace();
}
return bArr;
}
public byte[] getWaveData(int i) {
int length;
this.dataTime = 0L;
if (this.reportEntity == null) {
length = getNowPoint();
this.mFile = new File(CURRENT_DATA_FILE);
KLog.i("getWaveData 从运动界面进入");
} else {
File file = new File(ConstDefine.SD_PATH + "/WalkTest/HistoryData/" + Constants.ReportFile.HISTORY_DATA_PREFIX + this.patient.getIdCard() + "_" + this.currentTime + Constants.ReportFile.HISTORY_DATA_SUFFIX);
this.mFile = file;
length = (int) file.length();
if (!this.mFile.exists()) {
length = getNowPoint();
this.mFile = new File(CURRENT_DATA_FILE);
KLog.i("getWaveData get8MinFileData发生catch ");
}
}
int length2 = (int) this.mFile.length();
this.length = length2;
if (length2 < 530841600 || (length2 == 530841600 && length2 == length)) {
int i2 = (length2 / 8192) - 1;
this.fileData = new byte[8];
while (i2 >= 0 && findTime(i2 * 8192) - this.startTime >= 4000) {
i2--;
}
return get8MinFileData(i2 * 8192, i);
}
if (length2 != 530841600 || length2 <= length) {
return null;
}
int i3 = length / 8192;
int i4 = i3 - 1;
while (i4 >= 0 && findTime(i4 * 8192) - this.startTime >= 4000) {
i4--;
}
if (i4 >= 0) {
return get8MinFileData(i4 * 8192, i);
}
int i5 = 64799;
while (i5 >= i3 && findTime(i5 * 8192) - this.startTime >= 4000) {
i5--;
}
if (i5 >= i3) {
int i6 = i5 * 8192;
int i7 = 530841600 - i6;
byte[] bArr = get8MinFileData(i6, i7);
byte[] bArr2 = get8MinFileData(0, i - i7);
byte[] bArr3 = new byte[bArr.length + bArr2.length];
System.arraycopy(bArr, 0, bArr3, 0, bArr.length);
System.arraycopy(bArr2, 0, bArr3, bArr.length, bArr2.length);
return bArr3;
}
System.out.println(AppGlobal.getInstance().getResources().getString(R.string.toast_noData));
return null;
}
public void parseWalkTestWaveDataList(byte[] bArr) {
ArrayList arrayList = new ArrayList();
ArrayList arrayList2 = new ArrayList();
ArrayList arrayList3 = new ArrayList();
ArrayList arrayList4 = new ArrayList();
ArrayList arrayList5 = new ArrayList();
ArrayList arrayList6 = new ArrayList();
int i = 0;
while (i < bArr.length / 8192) {
int i2 = i * 8192;
int i3 = i2 + 7;
int i4 = 0;
while (i4 < 500) {
int i5 = (i4 * 16) + i3;
short merge = (short) merge(bArr[i5 + 2], bArr[i5 + 1]);
short merge2 = (short) merge(bArr[i5 + 9], bArr[i5 + 8]);
arrayList4.add(Integer.valueOf(merge));
arrayList4.add(Integer.valueOf(merge2));
short merge3 = (short) merge(bArr[i5 + 4], bArr[i5 + 3]);
short merge4 = (short) merge(bArr[i5 + 11], bArr[i5 + 10]);
arrayList5.add(Integer.valueOf(merge3));
arrayList5.add(Integer.valueOf(merge4));
int i6 = i3;
short merge5 = (short) merge(bArr[i5 + 6], bArr[i5 + 5]);
ArrayList arrayList7 = arrayList5;
short merge6 = (short) merge(bArr[i5 + 13], bArr[i5 + 12]);
arrayList6.add(Integer.valueOf(merge5));
arrayList6.add(Integer.valueOf(merge6));
arrayList.add(Integer.valueOf((merge3 * (-1)) + 2048));
arrayList.add(Integer.valueOf((merge4 * (-1)) + 2048));
int i7 = i5 + 16;
this.testRespWaveDataList.add(Integer.valueOf(bArr[i7] & 255));
arrayList2.add(Integer.valueOf(bArr[i5 + 15] & 255));
arrayList3.add(Integer.valueOf(bArr[i7] & 255));
i4++;
i3 = i6;
arrayList5 = arrayList7;
}
this.testSpo2WaveDataList.add(Integer.valueOf(merge(bArr[i2 + 8023], bArr[i2 + 8022])));
i++;
arrayList5 = arrayList5;
}
TestWaveDataLists.getInstance().initECGWaveDataList(arrayList4, arrayList5, arrayList6, arrayList2, arrayList3);
LogFile.printLog(arrayList.toString());
}
private void initRrCharts() {
this.binding.rrIntervalStatisticChart.setDrawBarShadow(false);
this.binding.rrIntervalStatisticChart.setDrawValueAboveBar(true);
this.binding.rrIntervalStatisticChart.getDescription().setEnabled(true);
this.binding.rrIntervalStatisticChart.setMaxVisibleValueCount(60);
this.binding.rrIntervalStatisticChart.setPinchZoom(false);
this.binding.rrIntervalStatisticChart.setDrawGridBackground(false);
this.binding.rrIntervalStatisticChart.setTouchEnabled(false);
this.binding.rrIntervalStatisticChart.getAxisRight().setEnabled(false);
this.binding.rrIntervalStatisticChart.getDescription().setYOffset(-14.0f);
this.binding.rrIntervalStatisticChart.getDescription().setTextSize(10.0f);
this.binding.rrIntervalStatisticChart.getDescription().setText("(ms)");
rrChartValueFormatter rrchartvalueformatter = new rrChartValueFormatter();
XAxis xAxis = this.binding.rrIntervalStatisticChart.getXAxis();
xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);
xAxis.setDrawGridLines(false);
xAxis.setGranularity(1.0f);
xAxis.setLabelCount(40);
xAxis.setValueFormatter(rrchartvalueformatter);
YAxis axisLeft = this.binding.rrIntervalStatisticChart.getAxisLeft();
axisLeft.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART);
axisLeft.setSpaceTop(15.0f);
axisLeft.setAxisMinimum(0.0f);
Legend legend = this.binding.rrIntervalStatisticChart.getLegend();
legend.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);
legend.setHorizontalAlignment(Legend.LegendHorizontalAlignment.LEFT);
legend.setOrientation(Legend.LegendOrientation.HORIZONTAL);
legend.setDrawInside(false);
legend.setForm(Legend.LegendForm.SQUARE);
legend.setFormSize(9.0f);
legend.setTextSize(11.0f);
legend.setXEntrySpace(4.0f);
this.binding.rrDiffIntervalStatisticChart.setDrawBarShadow(false);
this.binding.rrDiffIntervalStatisticChart.setDrawValueAboveBar(true);
this.binding.rrDiffIntervalStatisticChart.getDescription().setEnabled(true);
this.binding.rrDiffIntervalStatisticChart.setMaxVisibleValueCount(60);
this.binding.rrDiffIntervalStatisticChart.setPinchZoom(false);
this.binding.rrDiffIntervalStatisticChart.setDrawGridBackground(false);
this.binding.rrDiffIntervalStatisticChart.setTouchEnabled(false);
this.binding.rrDiffIntervalStatisticChart.getAxisRight().setEnabled(false);
this.binding.rrDiffIntervalStatisticChart.getDescription().setYOffset(-14.0f);
this.binding.rrDiffIntervalStatisticChart.getDescription().setTextSize(10.0f);
this.binding.rrDiffIntervalStatisticChart.getDescription().setText("毫秒");
XAxis xAxis2 = this.binding.rrDiffIntervalStatisticChart.getXAxis();
xAxis2.setPosition(XAxis.XAxisPosition.BOTTOM);
xAxis2.setDrawGridLines(false);
xAxis2.setGranularity(1.0f);
xAxis2.setLabelCount(20);
xAxis2.setValueFormatter(rrchartvalueformatter);
YAxis axisLeft2 = this.binding.rrDiffIntervalStatisticChart.getAxisLeft();
axisLeft2.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART);
axisLeft2.setSpaceTop(15.0f);
axisLeft2.setAxisMinimum(0.0f);
Legend legend2 = this.binding.rrDiffIntervalStatisticChart.getLegend();
legend2.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);
legend2.setHorizontalAlignment(Legend.LegendHorizontalAlignment.LEFT);
legend2.setOrientation(Legend.LegendOrientation.HORIZONTAL);
legend2.setDrawInside(false);
legend2.setForm(Legend.LegendForm.SQUARE);
legend2.setFormSize(9.0f);
legend2.setTextSize(11.0f);
legend2.setXEntrySpace(4.0f);
this.binding.rrLorenzStatisticChart.getDescription().setEnabled(false);
this.binding.rrLorenzStatisticChart.setDrawGridBackground(false);
this.binding.rrLorenzStatisticChart.setTouchEnabled(false);
this.binding.rrLorenzStatisticChart.setClipValuesToContent(false);
this.binding.rrLorenzStatisticChart.setDragEnabled(false);
this.binding.rrLorenzStatisticChart.setScaleEnabled(false);
this.binding.rrLorenzStatisticChart.setMaxVisibleValueCount(20000);
this.binding.rrLorenzStatisticChart.setPinchZoom(false);
Legend legend3 = this.binding.rrLorenzStatisticChart.getLegend();
legend3.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);
legend3.setHorizontalAlignment(Legend.LegendHorizontalAlignment.RIGHT);
legend3.setOrientation(Legend.LegendOrientation.VERTICAL);
legend3.setDrawInside(false);
legend3.setXOffset(5.0f);
YAxis axisLeft3 = this.binding.rrLorenzStatisticChart.getAxisLeft();
axisLeft3.setDrawGridLines(false);
axisLeft3.setAxisMinimum(0.0f);
this.binding.rrLorenzStatisticChart.getAxisRight().setEnabled(false);
XAxis xAxis3 = this.binding.rrLorenzStatisticChart.getXAxis();
xAxis3.setPosition(XAxis.XAxisPosition.BOTTOM);
xAxis3.setDrawGridLines(false);
xAxis3.setAxisMinimum(0.0f);
}
private void setData(BarChart barChart, int i, float f, int i2) {
ArrayList arrayList = new ArrayList();
for (int i3 = 0; i3 < i; i3++) {
arrayList.add(0);
}
if (i2 == 1) {
Iterator<Double> it = this.panTompkinsForEcgResult.getRrList().iterator();
while (it.hasNext()) {
double doubleValue = it.next().doubleValue() * 1000.0d;
if (doubleValue >= 0.0d && doubleValue < i * 50) {
int i4 = ((int) doubleValue) / 50;
arrayList.set(i4, Integer.valueOf(((Integer) arrayList.get(i4)).intValue() + 1));
}
}
} else if (i2 == 2) {
Iterator<Double> it2 = this.panTompkinsForEcgResult.getRrDelList().iterator();
while (it2.hasNext()) {
double abs = Math.abs(it2.next().doubleValue()) * 1000.0d;
if (abs >= 0.0d && abs < i * 50) {
int i5 = ((int) abs) / 50;
arrayList.set(i5, Integer.valueOf(((Integer) arrayList.get(i5)).intValue() + 1));
}
}
}
System.out.println("RR间期:" + arrayList);
ArrayList arrayList2 = new ArrayList();
int i6 = (int) 1.0f;
while (true) {
float f2 = i6;
if (f2 >= i + 1.0f) {
break;
}
arrayList2.add(new BarEntry(f2, ((Integer) arrayList.get(i6 - 1)).intValue()));
i6++;
}
if (barChart.getData() != null && barChart.getData().getDataSetCount() > 0) {
barChart.getData().getDataSetByIndex(0).setValues(arrayList2);
barChart.getData().notifyDataChanged();
barChart.notifyDataSetChanged();
barChart.invalidate();
return;
}
BarDataSet barDataSet = new BarDataSet(arrayList2, getString(R.string.interval_count));
barDataSet.setDrawIcons(false);
ArrayList arrayList3 = new ArrayList();
arrayList3.add(barDataSet);
BarData barData = new BarData(arrayList3);
barData.setValueTextSize(10.0f);
barData.setBarWidth(0.9f);
barChart.setData(barData);
barChart.invalidate();
}
private void setRrLorenzData(ScatterChart scatterChart, int i, int i2) {
ArrayList arrayList = new ArrayList();
ArrayList arrayList2 = new ArrayList();
ArrayList arrayList3 = new ArrayList();
List<Double> rrList = this.panTompkinsForEcgResult.getRrList();
for (int i3 = 0; i3 < rrList.size() - 1; i3++) {
if (rrList.get(i3).doubleValue() * 1000.0d >= 0.0d && rrList.get(i3).doubleValue() * 1000.0d <= 2000.0d) {
int i4 = i3 + 1;
if (rrList.get(i4).doubleValue() * 1000.0d >= 0.0d && rrList.get(i4).doubleValue() * 1000.0d <= 2000.0d) {
float parseFloat = Float.parseFloat(String.valueOf(rrList.get(i3).doubleValue() * 1000.0d));
float parseFloat2 = Float.parseFloat(String.valueOf(rrList.get(i4).doubleValue() * 1000.0d));
if (parseFloat < parseFloat2) {
arrayList.add(new Entry(parseFloat, parseFloat2));
} else if (parseFloat == parseFloat2) {
arrayList2.add(new Entry(parseFloat, parseFloat2));
} else if (parseFloat > parseFloat2) {
arrayList3.add(new Entry(parseFloat, parseFloat2));
}
}
}
}
Collections.sort(arrayList, new EntryXComparator());
Collections.sort(arrayList2, new EntryXComparator());
Collections.sort(arrayList3, new EntryXComparator());
ScatterDataSet scatterDataSet = new ScatterDataSet(arrayList, "x < y");
scatterDataSet.setScatterShape(ScatterChart.ScatterShape.SQUARE);
scatterDataSet.setColor(ColorTemplate.COLORFUL_COLORS[0]);
scatterDataSet.setDrawValues(false);
ScatterDataSet scatterDataSet2 = new ScatterDataSet(arrayList2, "x = y");
scatterDataSet2.setScatterShape(ScatterChart.ScatterShape.CIRCLE);
scatterDataSet2.setScatterShapeHoleColor(ColorTemplate.COLORFUL_COLORS[3]);
scatterDataSet2.setScatterShapeHoleRadius(3.0f);
scatterDataSet2.setColor(ColorTemplate.COLORFUL_COLORS[3]);
scatterDataSet2.setDrawValues(false);
ScatterDataSet scatterDataSet3 = new ScatterDataSet(arrayList3, "x > y");
scatterDataSet3.setScatterShape(ScatterChart.ScatterShape.TRIANGLE);
scatterDataSet3.setScatterShapeHoleColor(ColorTemplate.COLORFUL_COLORS[2]);
scatterDataSet3.setScatterShapeHoleRadius(3.0f);
scatterDataSet3.setColor(ColorTemplate.COLORFUL_COLORS[2]);
scatterDataSet3.setDrawValues(false);
scatterDataSet.setScatterShapeSize(8.0f);
scatterDataSet2.setScatterShapeSize(8.0f);
scatterDataSet3.setScatterShapeSize(8.0f);
ArrayList arrayList4 = new ArrayList();
arrayList4.add(scatterDataSet);
arrayList4.add(scatterDataSet2);
arrayList4.add(scatterDataSet3);
scatterChart.setData(new ScatterData(arrayList4));
scatterChart.invalidate();
}
protected void handWrittenSignature() {
this.binding.saveButton.setEnabled(false);
this.binding.signaturePad.setEnabled(false);
this.binding.saveDigitalSignatureButton.setVisibility(4);
}
protected void digitalSignature() {
this.binding.saveDigitalSignatureButton.setEnabled(false);
this.binding.saveButton.setVisibility(4);
this.binding.clearButton.setEnabled(true);
this.binding.signaturePad.clear();
this.binding.signaturePad.setEnabled(false);
this.binding.signaturePad.setVisibility(8);
this.binding.confirmReportTv.setVisibility(0);
}
protected void clearSignature() {
this.binding.saveButton.setVisibility(0);
this.binding.saveButton.setEnabled(false);
this.binding.clearButton.setEnabled(false);
this.binding.saveDigitalSignatureButton.setEnabled(true);
this.binding.signaturePad.setVisibility(0);
this.binding.confirmReportTv.setVisibility(8);
this.binding.signaturePad.setEnabled(true);
this.binding.signaturePad.clear();
this.binding.saveDigitalSignatureButton.setVisibility(0);
}
protected void outputCsv() {
new CSVOpThread_gz(this).start();
}
public static class rrChartValueFormatter extends ValueFormatter {
public String getFormattedValue(float f) {
int i = ((int) f) * 50;
return i == 2000 ? "" : i + "";
}
}
public class AnalysisThread extends Thread {
private List<Integer> signInput;
private int signalGain;
public AnalysisThread() {
}
public void setSign(List<Integer> list, int i) {
this.signInput = list;
this.signalGain = i;
}
@Override
public void run() {
super.run();
WalkTestReportNewActivity walkTestReportNewActivity = WalkTestReportNewActivity.this;
List<Integer> list = this.signInput;
if (list == null) {
list = TestWaveDataLists.getInstance().getECGIIWaveDataList();
}
walkTestReportNewActivity.panTompkinsForEcgResult = PanTompkinsForEcg.cal(409.6d, 250, list, 1, this.signalGain);
LogFile.saveLog(WalkTestReportNewActivity.this.panTompkinsForEcgResult.getInfo());
WalkTestReportNewActivity.this.ecgHelper.setMmMv(false);
WalkTestReportNewActivity.this.runOnUiThread(new Runnable() {
@Override
public final void run() {
WalkTestReportNewActivity.AnalysisThread.this.m325x44e775dd();
}
});
}
public void m325x44e775dd() {
WalkTestReportNewActivity.this.createEcgDataTables(false);
}
}
}