PatientPHRLatestDTO.java 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  1. package com.lemon.lifecenter.dto;
  2. import java.util.Calendar;
  3. import java.util.Date;
  4. import org.springframework.stereotype.Repository;
  5. @Repository
  6. public class PatientPHRLatestDTO {
  7. private int patientIdx;
  8. private String patientName;
  9. private String centerCode;
  10. private String wardNumber="";
  11. private String roomNumber="";
  12. private String todayHospitalizationYN;
  13. private Float temperature;
  14. private Date temperatureCreateDate;
  15. private String temperatureAlarmYN;
  16. private Integer oxygenSaturation;
  17. private Date oxygenSaturationCreateDate;
  18. private String oxygenSaturationAlarmYN;
  19. private Integer pulseRate;
  20. private Date pulseRateCreateDate;
  21. private String pulseRateAlarmYN;
  22. private Integer systolicBloodPressure;
  23. private Date systolicBloodPressureCreateDate;
  24. private Integer diastolicBloodPressure;
  25. private Date diastolicBloodPressureCreateDate;
  26. private String highBloodPressureAlarmYN;
  27. private String lowBloodPressureAlarmYN;
  28. private Integer bloodSugar;
  29. private Date bloodSugarCreateDate;
  30. private String bloodSugarAlarmYN;
  31. private String symptomYN;
  32. private int memoCount;
  33. private Date symptomLastDate;
  34. private String searchText;
  35. private String sortType;
  36. private String[] filterList;
  37. private String timeCriterion;
  38. private int limit;
  39. private int limitMax;
  40. private boolean needCheckValue(Date targetDate) {
  41. boolean needCheck = true;
  42. Calendar todayCalendar = Calendar.getInstance();
  43. Calendar targetCalendar = Calendar.getInstance();
  44. try {
  45. todayCalendar.setTime(new Date());
  46. targetCalendar.setTime(targetDate);
  47. if (targetCalendar.get(Calendar.YEAR) == todayCalendar.get(Calendar.YEAR)
  48. && targetCalendar.get(Calendar.MONTH) == todayCalendar.get(Calendar.MONTH)
  49. && targetCalendar.get(Calendar.DAY_OF_MONTH) == todayCalendar.get(Calendar.DAY_OF_MONTH)
  50. && targetCalendar.get(Calendar.AM_PM) == todayCalendar.get(Calendar.AM_PM)) {
  51. needCheck = false;
  52. }
  53. }
  54. catch (Exception e) {
  55. // 체크가 필요한 것으로 처리
  56. }
  57. return needCheck;
  58. }
  59. public int getPatientIdx() {
  60. return patientIdx;
  61. }
  62. public void setPatientIdx(int patientIdx) {
  63. this.patientIdx = patientIdx;
  64. }
  65. public String getCenterCode() {
  66. return centerCode;
  67. }
  68. public void setCenterCode(String centerCode) {
  69. this.centerCode = centerCode;
  70. }
  71. public String getPatientName() {
  72. return patientName;
  73. }
  74. public void setPatientName(String patientName) {
  75. this.patientName = patientName;
  76. }
  77. public String getWardNumber() {
  78. return wardNumber;
  79. }
  80. public void setWardNumber(String wardNumber) {
  81. this.wardNumber = wardNumber;
  82. }
  83. public String getRoomNumber() {
  84. return roomNumber;
  85. }
  86. public void setRoomNumber(String roomNumber) {
  87. this.roomNumber = roomNumber;
  88. }
  89. public String getTodayHospitalizationYN() {
  90. return todayHospitalizationYN;
  91. }
  92. public void setTodayHospitalizationYN(String todayHospitalizationYN) {
  93. this.todayHospitalizationYN = todayHospitalizationYN;
  94. }
  95. public Float getTemperature() {
  96. return temperature;
  97. }
  98. public void setTemperature(float temperature) {
  99. this.temperature = temperature;
  100. }
  101. public Date getTemperatureCreateDate() {
  102. return temperatureCreateDate;
  103. }
  104. public String getTemperatureAlarmYN() {
  105. return temperatureAlarmYN;
  106. }
  107. public void setTemperatureAlarmYN(String temperatureAlarmYN) {
  108. this.temperatureAlarmYN = temperatureAlarmYN;
  109. }
  110. public Integer getOxygenSaturation() {
  111. return oxygenSaturation;
  112. }
  113. public void setOxygenSaturation(int oxygenSaturation) {
  114. this.oxygenSaturation = oxygenSaturation;
  115. }
  116. public Date getOxygenSaturationCreateDate() {
  117. return oxygenSaturationCreateDate;
  118. }
  119. public String getOxygenSaturationAlarmYN() {
  120. return oxygenSaturationAlarmYN;
  121. }
  122. public void setOxygenSaturationAlarmYN(String oxygenSaturationAlarmYN) {
  123. this.oxygenSaturationAlarmYN = oxygenSaturationAlarmYN;
  124. }
  125. public Integer getPulseRate() {
  126. return pulseRate;
  127. }
  128. public void setPulseRate(int pulseRate) {
  129. this.pulseRate = pulseRate;
  130. }
  131. public Date getPulseRateCreateDate() {
  132. return pulseRateCreateDate;
  133. }
  134. public String getPulseRateAlarmYN() {
  135. return pulseRateAlarmYN;
  136. }
  137. public void setPulseRateAlarmYN(String pulseRateAlarmYN) {
  138. this.pulseRateAlarmYN = pulseRateAlarmYN;
  139. }
  140. public Integer getSystolicBloodPressure() {
  141. return systolicBloodPressure;
  142. }
  143. public void setSystolicBloodPressure(int systolicBloodPressure) {
  144. this.systolicBloodPressure = systolicBloodPressure;
  145. }
  146. public Date getSystolicBloodPressureCreateDate() {
  147. return systolicBloodPressureCreateDate;
  148. }
  149. public Integer getDiastolicBloodPressure() {
  150. return diastolicBloodPressure;
  151. }
  152. public void setDiastolicBloodPressure(int diastolicBloodPressure) {
  153. this.diastolicBloodPressure = diastolicBloodPressure;
  154. }
  155. public Date getDiastolicBloodPressureCreateDate() {
  156. return diastolicBloodPressureCreateDate;
  157. }
  158. public String getHighBloodPressureAlarmYN() {
  159. return highBloodPressureAlarmYN;
  160. }
  161. public void setHighBloodPressureAlarmYN(String highBloodPressureAlarmYN) {
  162. this.highBloodPressureAlarmYN = highBloodPressureAlarmYN;
  163. }
  164. public String getLowBloodPressureAlarmYN() {
  165. return lowBloodPressureAlarmYN;
  166. }
  167. public void setLowBloodPressureAlarmYN(String lowBloodPressureAlarmYN) {
  168. this.lowBloodPressureAlarmYN = lowBloodPressureAlarmYN;
  169. }
  170. public Integer getBloodSugar() {
  171. return bloodSugar;
  172. }
  173. public void setBloodSugar(int bloodSugar) {
  174. this.bloodSugar = bloodSugar;
  175. }
  176. public Date getBloodSugarCreateDate() {
  177. return bloodSugarCreateDate;
  178. }
  179. public String getBloodSugarAlarmYN() {
  180. return bloodSugarAlarmYN;
  181. }
  182. public void setBloodSugarAlarmYN(String bloodSugarAlarmYN) {
  183. this.bloodSugarAlarmYN = bloodSugarAlarmYN;
  184. }
  185. public int getMemoCount() {
  186. return memoCount;
  187. }
  188. public void setMemoCount(int memoCount) {
  189. this.memoCount = memoCount;
  190. }
  191. public Date getSymptomLastDate() {
  192. return symptomLastDate;
  193. }
  194. public String getSymptomYN() {
  195. return symptomYN;
  196. }
  197. public void setSymptomYN(String symptomYN) {
  198. this.symptomYN = symptomYN;
  199. }
  200. public String getSearchText() {
  201. return searchText;
  202. }
  203. public void setSearchText(String searchText) {
  204. this.searchText = searchText;
  205. }
  206. public String getSortType() {
  207. return sortType;
  208. }
  209. public void setSortType(String sortType) {
  210. this.sortType = sortType;
  211. }
  212. public String[] getFilterList() {
  213. return filterList;
  214. }
  215. public void setFilterList(String[] filterList) {
  216. this.filterList = filterList;
  217. }
  218. public String getTimeCriterion() {
  219. return timeCriterion;
  220. }
  221. public void setTimeCriterion(String timeCriterion) {
  222. this.timeCriterion = timeCriterion;
  223. }
  224. public int getLimit() {
  225. return limit;
  226. }
  227. public void setLimit(int limit) {
  228. this.limit = limit;
  229. }
  230. public int getLimitMax() {
  231. return limitMax;
  232. }
  233. public void setLimitMax(int limitMax) {
  234. this.limitMax = limitMax;
  235. }
  236. public String getBloodPressureDisplay() {
  237. String systolicBloodPressureString = "--";
  238. if (this.systolicBloodPressure != null) {
  239. systolicBloodPressureString = this.systolicBloodPressure.toString();
  240. }
  241. String diastolicBloodPressureString = "--";
  242. if (this.diastolicBloodPressure != null) {
  243. diastolicBloodPressureString = this.diastolicBloodPressure.toString();
  244. }
  245. return systolicBloodPressureString + " / " + diastolicBloodPressureString;
  246. }
  247. public boolean getNeedTemperatureCheck() {
  248. return needCheckValue(this.temperatureCreateDate);
  249. }
  250. public boolean getNeedBloodPressCheck() {
  251. return needCheckValue(this.systolicBloodPressureCreateDate) || needCheckValue(this.diastolicBloodPressureCreateDate);
  252. }
  253. public boolean getNeedPulseRateCheck() {
  254. return needCheckValue(this.pulseRateCreateDate);
  255. }
  256. public boolean getNeedOxygenSaturationCheck() {
  257. return needCheckValue(this.oxygenSaturationCreateDate);
  258. }
  259. public boolean getNeedBloodSugarCheck() {
  260. return needCheckValue(this.bloodSugarCreateDate);
  261. }
  262. private boolean isAlarm(String alarmYn, boolean defaultValue) {
  263. boolean useDefaultValue = (alarmYn != "Y") && (alarmYn != "N");
  264. return useDefaultValue ? defaultValue : (alarmYn == "Y");
  265. }
  266. public boolean getIsTemperatureWarning() {
  267. if (this.temperature == null) return false;
  268. return isAlarm(this.temperatureAlarmYN, (this.temperature >= 37.5));
  269. }
  270. public boolean getIsBloodPressureWarning() {
  271. if (this.systolicBloodPressure == null || this.diastolicBloodPressure == null) return false;
  272. boolean highBPWarning = isAlarm(this.highBloodPressureAlarmYN, (this.systolicBloodPressure >= 149 || this.diastolicBloodPressure >= 99));
  273. boolean lowBPWarning = isAlarm(this.lowBloodPressureAlarmYN, (this.systolicBloodPressure <= 90 || this.diastolicBloodPressure <= 60));
  274. return highBPWarning || lowBPWarning;
  275. }
  276. public boolean getIsPulseRateWarning() {
  277. if (this.pulseRate == null) return false;
  278. return isAlarm(this.pulseRateAlarmYN, (this.pulseRate <= 55 || this.pulseRate >= 110));
  279. }
  280. public boolean getIsOxygenSaturationeWarning() {
  281. if (this.oxygenSaturation == null) return false;
  282. return isAlarm(this.oxygenSaturationAlarmYN, (this.oxygenSaturation <= 94));
  283. }
  284. public boolean getIsBloodSugarWarning() {
  285. if (this.bloodSugar == null) return false;
  286. return isAlarm(this.bloodSugarAlarmYN, (this.bloodSugar <= 70 || this.bloodSugar >= 200));
  287. }
  288. public boolean getHasTodaySymptom() {
  289. boolean ret = false;
  290. Calendar todayCalendar = Calendar.getInstance();
  291. Calendar symptomCalendar = Calendar.getInstance();
  292. try {
  293. todayCalendar.setTime(new Date());
  294. symptomCalendar.setTime(this.symptomLastDate);
  295. if (symptomCalendar.get(Calendar.YEAR) == todayCalendar.get(Calendar.YEAR)
  296. && symptomCalendar.get(Calendar.MONTH) == todayCalendar.get(Calendar.MONTH)
  297. && symptomCalendar.get(Calendar.DAY_OF_MONTH) == todayCalendar.get(Calendar.DAY_OF_MONTH)
  298. && symptomCalendar.get(Calendar.AM_PM) == todayCalendar.get(Calendar.AM_PM)) {
  299. ret = true;
  300. }
  301. }
  302. catch (Exception e) {
  303. // 없는 것으로 처리
  304. }
  305. return ret;
  306. }
  307. }