state.jsp 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
  2. <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
  3. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
  4. <jsp:include page="${data._INCLUDE}/header.jsp"></jsp:include>
  5. <link rel="stylesheet" href="/resources/bower_components/mdi/css/materialdesignicons.min.css">
  6. <script src="/resources/bower_components/jquery-bootpag-master/lib/jquery.bootpag.min.js"></script>
  7. <script>
  8. var totalList = ${total}; // 저장된 데이터 항목 수
  9. var viewEntry = 30; // 한 화면에 표시되는 갯수
  10. var totalPage = Math.ceil(totalList / viewEntry);
  11. var reloadIntervalTime = 30; //
  12. var reloadTimer = null;
  13. function changeReloadInterval() {
  14. reloadIntervalTime = $("#reloadIntervalSelect option:selected").val();
  15. }
  16. function activeReloadTimer() {
  17. if (reloadIntervalTime) {
  18. if (reloadTimer) {
  19. deactiveReloadTimer();
  20. }
  21. reloadTimer = setInterval(function() {
  22. nextPage();
  23. }, reloadIntervalTime * 1000);
  24. return true;
  25. }
  26. else {
  27. return false;
  28. }
  29. }
  30. function deactiveReloadTimer() {
  31. if (reloadTimer) {
  32. clearInterval(reloadTimer);
  33. reloadTimer = null;
  34. }
  35. }
  36. function searchPatients() {
  37. var keyword = $("#searchKeyword").val();
  38. location.href = "./state?searchText="+keyword;
  39. }
  40. function retrieveStateData(page) {
  41. var searchText = '<c:out value="${searchText}" />';
  42. var params = {page: page, searchText: searchText};
  43. $.ajax({
  44. url : "./api/state",
  45. data : params,
  46. method : "GET",
  47. dataType : "json",
  48. success : function( datas ){
  49. var html = '<div class="blankItem">표시할 데이터가 없습니다.</div>';
  50. if (datas.length > 0) {
  51. html = "";
  52. datas.forEach(function(d) {
  53. var danger = (d.isTemperatureWarning || d.isBloodPressureWarning || d.isOxygenSaturationeWarning) ? "danger" : "";
  54. var temperatureStep = d.isTemperatureWarning ? "step_two" : "step_one";
  55. var bloodPressureStep = d.isBloodPressureWarning ? "step_two" : "step_one";
  56. var oxygenSaturationStep = d.isOxygenSaturationeWarning ? "step_two" : "step_one";
  57. var temperatureCheck = d.needTemperatureCheck ? "timeover" : "";
  58. var bloodPressureCheck = d.needBloodPressCheck ? "timeover" : "";
  59. var oxygenSaturationCheck = d.needOxygenSaturationCheck ? "timeover" : "";
  60. var temperature = d.temperature ? parseFloat(d.temperature).toFixed(1) : "--";
  61. temperature += ' ℃ ';
  62. var bloodPressure = (d.bloodPressureDisplay) + " ";
  63. var oxygenSaturation = (d.oxygenSaturation || "--") + " % ";
  64. html += '<div class="col-lg-2 col-md-6 mb-4">';
  65. html += ' <div class="patients-stats" data-url="./info?patientIdx='+d.patientIdx+'">';
  66. html += ' <div class="name">';
  67. html += ' '+d.wardNumber+'/'+d.roomNumber+'('+d.patientName+')';
  68. html += ' <div class="check">';
  69. html += ' <ul>';
  70. if (d.memoCount > 0) {
  71. html += ' <li><a href="javscript:;" class="memo"><i class="align-middle ml-2 fas fa-fw fa-edit"></i></a></li>';
  72. }
  73. if (d.hasTodaySymptom) {
  74. html += ' <li><a href="javscript:;" class="symptom"><i class="align-middle ml-2 fas fa-fw fa-user-plus"></i></a></li>';
  75. }
  76. html += ' </ul>';
  77. html += ' </div>';
  78. html += ' </div>';
  79. html += ' <div class="stats '+danger+'">';
  80. html += ' <ul>';
  81. html += ' <li class="fever '+temperatureStep+' '+temperatureCheck+'">'+temperature+'</li>';
  82. html += ' <li class="bloodPressure '+bloodPressureStep+' '+bloodPressureCheck+'">'+bloodPressure+'</li>';
  83. html += ' <li class="oxygen '+oxygenSaturationStep+' '+oxygenSaturationCheck+'">'+oxygenSaturation+'</li>';
  84. html += ' </ul>';
  85. html += ' </div>';
  86. html += ' </div>';
  87. html += '</div>';
  88. });
  89. };
  90. $(".patients-list").fadeOut('fast',function(){
  91. $(".patients-list").html(html).fadeIn('fast');
  92. });
  93. },
  94. error : function(error){
  95. alert(error.message);
  96. }
  97. }).done( function(){
  98. });
  99. }
  100. function nextPage() {
  101. if (totalPage === 1) {
  102. retrieveStateData(1);
  103. return;
  104. }
  105. var next = $("#pagination .active").next();
  106. if (!next.is(':visible')) {
  107. $("#pagination .first").click();
  108. }
  109. else {
  110. next.click();
  111. }
  112. }
  113. //윈도우 폭에 따른 반응형 목록 수 분기 함수
  114. function responsiblePagination() {
  115. var window_width = $(window).width();
  116. if(window_width >= 1200) {
  117. $('#pagination').bootpag({
  118. maxVisible: 10, // 한번에 보여지는 페이지수
  119. firstLastUse: true
  120. });
  121. }
  122. if(window_width < 1200 && window_width >= 600) {
  123. $('#pagination').bootpag({
  124. maxVisible: 5, // 한번에 보여지는 페이지수
  125. firstLastUse: true
  126. });
  127. }
  128. if(window_width < 600){
  129. $('#pagination').bootpag({
  130. maxVisible: 3, // 한번에 보여지는 페이지수
  131. firstLastUse: false
  132. });
  133. }
  134. }
  135. $(document).ready(function() {
  136. $(document).on("click", ".patients-stats", function() {
  137. location.href = $(this).attr("data-url");
  138. });
  139. // 반복 start/stop 클릭
  140. $('#playButton').click(function () {
  141. if (activeReloadTimer()) {
  142. $('#playButton').addClass('disabled');
  143. $('#pauseButton').removeClass('disabled');
  144. $("#reloadIntervalSelect").prop("disabled", true);
  145. }
  146. });
  147. $('#pauseButton').click(function () {
  148. deactiveReloadTimer();
  149. $('#playButton').removeClass('disabled');
  150. $('#pauseButton').addClass('disabled');
  151. $("#reloadIntervalSelect").prop("disabled", false);
  152. });
  153. ////////////////////////////////////////////////////////////////////////////////
  154. //// Pagination
  155. ////////////////////////////////////////////////////////////////////////////////
  156. // 페이지 네이션 실행
  157. // Pagination API -> http://botmonster.com/jquery-bootpag/#.XD2VElwzaUk
  158. $('#pagination').bootpag({
  159. // maxVisible: 10, // 한번에 보여지는 페이지수
  160. // firstLastUse: true,
  161. // href: 'URL',// template for pagination links (default javascript:void(0);)
  162. // hrefVariable: false,// variable name in href template for page number (default {{number}})
  163. total: totalPage, // 페이지 수
  164. page: 1, // 초기 페이지
  165. leaps: true,
  166. first: '<i class="mdi mdi-chevron-double-left"></i>',
  167. prev: '<i class="mdi mdi-chevron-left"></i>',
  168. next: '<i class="mdi mdi-chevron-right"></i>',
  169. last: '<i class="mdi mdi-chevron-double-right"></i>',
  170. wrapClass: 'pagination',
  171. activeClass: 'active',
  172. disabledClass: 'disabled',
  173. nextClass: 'next',
  174. prevClass: 'prev',
  175. lastClass: 'last',
  176. firstClass: 'first'
  177. }).on("page", function(event, num){
  178. retrieveStateData(num);
  179. });
  180. responsiblePagination();
  181. // 윈도우 폭 변경에 따른 반응형 목록 수 적용
  182. $(window).resize(function(){
  183. responsiblePagination();
  184. });
  185. });
  186. </script>
  187. </head>
  188. <body>
  189. <div class="wrapper">
  190. <jsp:include page="${data._INCLUDE}/sidebar.jsp"></jsp:include>
  191. <div class="main">
  192. <jsp:include page="${data._INCLUDE}/top.jsp"></jsp:include>
  193. <main class="content">
  194. <div class="container-fluid p-0">
  195. <!-- 환자관리 : 신규환자 등록 START -->
  196. <div class="row">
  197. <div class="col-12 col-lg-6">
  198. <h1 class="h3 mb-3">진료관리</h1>
  199. </div>
  200. <div class="col-12 col-lg-6 text-right">
  201. <nav aria-label="breadcrumb">
  202. <ol class="breadcrumb">
  203. <li class="breadcrumb-item"><a href="javscript:;">Home</a></li>
  204. <li class="breadcrumb-item active">진료관리</li>
  205. </ol>
  206. </nav>
  207. </div>
  208. </div>
  209. <div class="row">
  210. <div class="col-12">
  211. <div class="card">
  212. <div class="card-header">
  213. <div class="row">
  214. <div class="col-lg-6">
  215. <h1 class="h4">- 상태현황</h1>
  216. </div>
  217. <div class="col-lg-6 search text-right">
  218. <label> <select id="reloadIntervalSelect" class="custom-select" onchange="changeReloadInterval()">
  219. <option value="10">10초</option>
  220. <option value="30" selected>30초</option>
  221. <option value="60">60초</option>
  222. </select>
  223. </label> <label>
  224. <button type="button" id="playButton" class="btn btn-primary">
  225. <i class="fas fa-play"></i>
  226. </button>
  227. <button type="button" id="pauseButton" class="btn btn-primary disabled">
  228. <i class="fas fa-pause"></i>
  229. </button>
  230. </label> <input type="text" class="form-control w150" id="searchKeyword" placeholder="호실 or 환자명" value="${searchText}" onkeyup="if(event.keyCode===13){searchPatients()}">
  231. <button class="btn btn-primary" onclick="searchPatients()">검색</button>
  232. </div>
  233. </div>
  234. </div>
  235. <div class="card-body">
  236. <div class="row patients-list">
  237. <c:choose>
  238. <c:when test="${total == 0}">
  239. <div class="blankItem">표시할 데이터가 없습니다.</div>
  240. </c:when>
  241. <c:otherwise>
  242. <c:forEach var="patient" items="${items}" varStatus="status">
  243. <c:set var="title" value="${patient.wardNumber}/${patient.roomNumber}(${patient.patientName})" />
  244. <c:set var="viewLink" value="./info?patientIdx=${patient.patientIdx}" />
  245. <c:set var="temperatureStep" value="${patient.isTemperatureWarning ? 'step_two' : 'step_one'}" />
  246. <c:set var="bloodPressureStep" value="${patient.isBloodPressureWarning ? 'step_two' : 'step_one'}" />
  247. <c:set var="oxygenSaturationStep" value="${patient.isOxygenSaturationeWarning ? 'step_two' : 'step_one'}" />
  248. <c:set var="temperatureCheck" value="${patient.needTemperatureCheck ? 'timeover' : ''}" />
  249. <c:set var="bloodPressureCheck" value="${patient.needBloodPressCheck ? 'timeover' : ''}" />
  250. <c:set var="oxygenSaturationCheck" value="${patient.needOxygenSaturationCheck ? 'timeover' : ''}" />
  251. <div class="col-lg-2 col-md-6 mb-4">
  252. <div class="patients-stats" data-url="${viewLink}">
  253. <div class="name">
  254. <c:out value="${title}" />
  255. <div class="check">
  256. <ul>
  257. <c:if test="${patient.memoCount > 0}">
  258. <li><a href="javscript:;" class="memo"><i class="align-middle ml-2 fas fa-fw fa-edit"></i></a></li>
  259. </c:if>
  260. <c:if test="${patient.hasTodaySymptom}">
  261. <li><a href="javscript:;" class="symptom"> <i class="align-middle ml-2 fas fa-fw fa-user-plus"></i></a></li>
  262. </c:if>
  263. </ul>
  264. </div>
  265. </div>
  266. <div class="stats ${patient.isTemperatureWarning || patient.isBloodPressureWarning || patient.isOxygenSaturationeWarning ? 'danger' : '' }">
  267. <ul>
  268. <li class="fever ${temperatureStep} ${temperatureCheck}"><c:out value="${patient.temperature != null ? patient.temperature : '--'} ℃ " /></li>
  269. <li class="bloodPressure ${bloodPressureStep} ${bloodPressureCheck}"><c:out value='${patient.bloodPressureDisplay} ' /></li>
  270. <li class="oxygen ${oxygenSaturationStep} ${oxygenSaturationCheck}"><c:out value="${patient.oxygenSaturation != null ? patient.oxygenSaturation : '--'} %" />
  271. </ul>
  272. </div>
  273. </div>
  274. </div>
  275. </c:forEach>
  276. </c:otherwise>
  277. </c:choose>
  278. </div>
  279. </div>
  280. <div class="card-footer">
  281. <div id="pagination" class="paginationContainer"></div>
  282. </div>
  283. </div>
  284. </div>
  285. </div>
  286. <!-- 환자관리 : 신규환자 등록 END -->
  287. </div>
  288. </main>
  289. <jsp:include page="${data._INCLUDE}/footer.jsp"></jsp:include>
  290. </div>
  291. </div>
  292. </body>
  293. </html>