package com.lemon.lifecenter.dto;

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 > 140 || this.phrValue2 > 90;
				boolean lowBP = this.phrValue < 80 || this.phrValue2 < 60;
			
				return highBP || lowBP;
			}
			else if (this.phrType.equals("oxygenSaturation")) {
				return this.phrValue < 95;
			}
		}
		catch(Exception e) {
			
		}
		
		return false;
	}
}
