PatientPHRLatestDTO.java 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. package com.lemon.lifecenter.dto;
  2. import java.text.SimpleDateFormat;
  3. import java.util.Calendar;
  4. import java.util.Date;
  5. import org.springframework.stereotype.Repository;
  6. @Repository
  7. public class PatientPHRLatestDTO {
  8. private int patientIdx;
  9. private String patientName;
  10. private String centerCode;
  11. private String wardNumber="";
  12. private String roomNumber="";
  13. private String todayHospitalizationYN;
  14. private Float temperature;
  15. private Date temperatureCreateDate;
  16. private Integer oxygenSaturation;
  17. private Date oxygenSaturationCreateDate;
  18. private Integer pulseRate;
  19. private Date pulseRateCreateDate;
  20. private Integer systolicBloodPressure;
  21. private Date systolicBloodPressureCreateDate;
  22. private Integer diastolicBloodPressure;
  23. private Date diastolicBloodPressureCreateDate;
  24. private Integer bloodSugar;
  25. private Date bloodSugarCreateDate;
  26. private int memoCount;
  27. private Date symptomLastDate;
  28. private String searchText;
  29. private String sortType;
  30. private int limit;
  31. private int limitMax;
  32. private boolean needCheckValue(Date targetDate) {
  33. boolean needCheck = true;
  34. Calendar todayCalendar = Calendar.getInstance();
  35. Calendar targetCalendar = Calendar.getInstance();
  36. try {
  37. todayCalendar.setTime(new Date());
  38. targetCalendar.setTime(targetDate);
  39. if (targetCalendar.get(Calendar.YEAR) == todayCalendar.get(Calendar.YEAR)
  40. && targetCalendar.get(Calendar.MONTH) == todayCalendar.get(Calendar.MONTH)
  41. && targetCalendar.get(Calendar.DAY_OF_MONTH) == todayCalendar.get(Calendar.DAY_OF_MONTH)
  42. && targetCalendar.get(Calendar.AM_PM) == todayCalendar.get(Calendar.AM_PM)) {
  43. needCheck = false;
  44. }
  45. }
  46. catch (Exception e) {
  47. // 체크가 필요한 것으로 처리
  48. }
  49. return needCheck;
  50. }
  51. public int getPatientIdx() {
  52. return patientIdx;
  53. }
  54. public void setPatientIdx(int patientIdx) {
  55. this.patientIdx = patientIdx;
  56. }
  57. public String getCenterCode() {
  58. return centerCode;
  59. }
  60. public void setCenterCode(String centerCode) {
  61. this.centerCode = centerCode;
  62. }
  63. public String getPatientName() {
  64. return patientName;
  65. }
  66. public void setPatientName(String patientName) {
  67. this.patientName = patientName;
  68. }
  69. public String getWardNumber() {
  70. return wardNumber;
  71. }
  72. public void setWardNumber(String wardNumber) {
  73. this.wardNumber = wardNumber;
  74. }
  75. public String getRoomNumber() {
  76. return roomNumber;
  77. }
  78. public void setRoomNumber(String roomNumber) {
  79. this.roomNumber = roomNumber;
  80. }
  81. public String getTodayHospitalizationYN() {
  82. return todayHospitalizationYN;
  83. }
  84. public void setTodayHospitalizationYN(String todayHospitalizationYN) {
  85. this.todayHospitalizationYN = todayHospitalizationYN;
  86. }
  87. public Float getTemperature() {
  88. return temperature;
  89. }
  90. public void setTemperature(float temperature) {
  91. this.temperature = temperature;
  92. }
  93. public Date getTemperatureCreateDate() {
  94. return temperatureCreateDate;
  95. }
  96. public Integer getOxygenSaturation() {
  97. return oxygenSaturation;
  98. }
  99. public void setOxygenSaturation(int oxygenSaturation) {
  100. this.oxygenSaturation = oxygenSaturation;
  101. }
  102. public Date getOxygenSaturationCreateDate() {
  103. return oxygenSaturationCreateDate;
  104. }
  105. public Integer getPulseRate() {
  106. return pulseRate;
  107. }
  108. public void setPulseRate(int pulseRate) {
  109. this.pulseRate = pulseRate;
  110. }
  111. public Date getPulseRateCreateDate() {
  112. return pulseRateCreateDate;
  113. }
  114. public Integer getSystolicBloodPressure() {
  115. return systolicBloodPressure;
  116. }
  117. public void setSystolicBloodPressure(int systolicBloodPressure) {
  118. this.systolicBloodPressure = systolicBloodPressure;
  119. }
  120. public Date getSystolicBloodPressureCreateDate() {
  121. return systolicBloodPressureCreateDate;
  122. }
  123. public Integer getDiastolicBloodPressure() {
  124. return diastolicBloodPressure;
  125. }
  126. public void setDiastolicBloodPressure(int diastolicBloodPressure) {
  127. this.diastolicBloodPressure = diastolicBloodPressure;
  128. }
  129. public Date getDiastolicBloodPressureCreateDate() {
  130. return diastolicBloodPressureCreateDate;
  131. }
  132. public Integer getBloodSugar() {
  133. return bloodSugar;
  134. }
  135. public void setBloodSugar(int bloodSugar) {
  136. this.bloodSugar = bloodSugar;
  137. }
  138. public Date getBloodSugarCreateDate() {
  139. return bloodSugarCreateDate;
  140. }
  141. public int getMemoCount() {
  142. return memoCount;
  143. }
  144. public void setMemoCount(int memoCount) {
  145. this.memoCount = memoCount;
  146. }
  147. public Date getSymptomLastDate() {
  148. return symptomLastDate;
  149. }
  150. public String getSearchText() {
  151. return searchText;
  152. }
  153. public void setSearchText(String searchText) {
  154. this.searchText = searchText;
  155. }
  156. public String getSortType() {
  157. return sortType;
  158. }
  159. public void setSortType(String sortType) {
  160. this.sortType = sortType;
  161. }
  162. public int getLimit() {
  163. return limit;
  164. }
  165. public void setLimit(int limit) {
  166. this.limit = limit;
  167. }
  168. public int getLimitMax() {
  169. return limitMax;
  170. }
  171. public void setLimitMax(int limitMax) {
  172. this.limitMax = limitMax;
  173. }
  174. public String getBloodPressureDisplay() {
  175. String systolicBloodPressureString = "--";
  176. if (this.systolicBloodPressure != null) {
  177. systolicBloodPressureString = this.systolicBloodPressure.toString();
  178. }
  179. String diastolicBloodPressureString = "--";
  180. if (this.diastolicBloodPressure != null) {
  181. diastolicBloodPressureString = this.diastolicBloodPressure.toString();
  182. }
  183. return systolicBloodPressureString + " / " + diastolicBloodPressureString;
  184. }
  185. public boolean getNeedTemperatureCheck() {
  186. return needCheckValue(this.temperatureCreateDate);
  187. }
  188. public boolean getNeedBloodPressCheck() {
  189. return needCheckValue(this.systolicBloodPressureCreateDate) || needCheckValue(this.diastolicBloodPressureCreateDate);
  190. }
  191. public boolean getNeedOxygenSaturationCheck() {
  192. return needCheckValue(this.oxygenSaturationCreateDate);
  193. }
  194. public boolean getIsTemperatureWarning() {
  195. if (this.temperature == null) return false;
  196. return this.temperature >= 37.5;
  197. }
  198. public boolean getIsBloodPressureWarning() {
  199. if (this.systolicBloodPressure == null || this.diastolicBloodPressure == null) return false;
  200. boolean highBP = this.systolicBloodPressure >= 149 || this.diastolicBloodPressure >= 99;
  201. boolean lowBP = this.systolicBloodPressure <= 90 || this.diastolicBloodPressure <= 60;
  202. return highBP || lowBP;
  203. }
  204. public boolean getIsOxygenSaturationeWarning() {
  205. if (this.oxygenSaturation == null) return false;
  206. return this.oxygenSaturation <= 94;
  207. }
  208. public boolean getHasTodaySymptom() {
  209. boolean ret = false;
  210. Calendar todayCalendar = Calendar.getInstance();
  211. Calendar symptomCalendar = Calendar.getInstance();
  212. try {
  213. todayCalendar.setTime(new Date());
  214. symptomCalendar.setTime(this.symptomLastDate);
  215. if (symptomCalendar.get(Calendar.YEAR) == todayCalendar.get(Calendar.YEAR)
  216. && symptomCalendar.get(Calendar.MONTH) == todayCalendar.get(Calendar.MONTH)
  217. && symptomCalendar.get(Calendar.DAY_OF_MONTH) == todayCalendar.get(Calendar.DAY_OF_MONTH)
  218. && symptomCalendar.get(Calendar.AM_PM) == todayCalendar.get(Calendar.AM_PM)) {
  219. ret = true;
  220. }
  221. }
  222. catch (Exception e) {
  223. // 없는 것으로 처리
  224. }
  225. return ret;
  226. }
  227. }