package com.lemon.lifecenter.dto; import java.text.SimpleDateFormat; import java.util.Date; import org.springframework.stereotype.Repository; @Repository public class PatientPHRHistoryDTO { private int patientIdx; private String phrType; private Float phrValue; private Float phrValue2; private String recordedByName; private String recordedById; private String createDate; private int limit; private int limitMax; public int getPatientIdx() { return patientIdx; } public void setPatientIdx(int patientIdx) { this.patientIdx = patientIdx; } public String getPhrType() { return phrType; } public void setPhrType(String phrType) { this.phrType = phrType; } public Float getPhrValue() { return phrValue; } public void setPhrValue(Float phrValue) { this.phrValue = phrValue; } public Float getPhrValue2() { return phrValue2; } public void setPhrValue2(Float phrValue2) { this.phrValue2 = phrValue2; } public String getRecordedByName() { return recordedByName != null ? recordedByName : ""; } public void setRecordedByName(String recordedByName) { this.recordedByName = recordedByName; } public String getRecordedById() { return recordedById != null ? recordedById : ""; } public void setRecordedById(String recordedById) { this.recordedById = recordedById; } public String getCreateDate() { return createDate; } public void setCreateDate(String createDate) { this.createDate = createDate; } public int getLimit() { return limit; } public void setLimit(int limit) { this.limit = limit; } public int getLimitMax() { return limitMax; } public void setLimitMax(int limitMax) { this.limitMax = limitMax; } public boolean getIsWarning() { try { if (this.phrType.equals("temperature")) { return this.phrValue >= 37.5; } else if (this.phrType.equals("bloodPressure")) { boolean highBP = this.phrValue >= 149 || this.phrValue2 >= 99; boolean lowBP = this.phrValue <= 90 || this.phrValue2 <= 60; return highBP || lowBP; } else if (this.phrType.equals("oxygenSaturation")) { return this.phrValue <= 94; } else if (this.phrType.equals("pulseRate")) { return this.phrValue <= 55 || this.phrValue >= 110; } else if (this.phrType.equals("bloodSugar")) { return this.phrValue <= 70; } } catch(Exception e) { } return false; } public String getCreateDateFormatted() { SimpleDateFormat originalFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); SimpleDateFormat targetFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { Date t = originalFormat.parse(this.createDate); return targetFormat.format(t); } catch (Exception e) { return createDate; } } }