state.jsp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  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. let mCurrentPage = ${page}
  9. let mTotalCount = 0;
  10. let mReloadTimer = null;
  11. function getPageSize() {
  12. return localStorage.getItem('dashboardPageSize') || "30";
  13. }
  14. function setPageSize(value) {
  15. localStorage.setItem('dashboardPageSize', value);
  16. }
  17. function getTotalPage() {
  18. return Math.ceil(mTotalCount / getPageSize());
  19. }
  20. function getReloadIntervalTime() {
  21. // console.log("getReloadIntervalTime");
  22. return localStorage.getItem('reloadIntervalTime') || "30";
  23. }
  24. function setReloadIntervalTime(value) {
  25. // console.log("setReloadIntervalTime" + value);
  26. localStorage.setItem('reloadIntervalTime', value);
  27. }
  28. // function getPlayOnOff() {
  29. // console.log("getPlayOnOff");
  30. // console.log(localStorage.getItem('isPlaying'));
  31. // return localStorage.getItem('isPlaying') || "off";
  32. // }
  33. // function setPlayOnOff(value) {
  34. // console.log("setPlayOnOff" + value);
  35. // localStorage.setItem('isPlaying', value);
  36. // }
  37. function ajaxErrorHandler(request, status, error){
  38. //로그인 페이지 redirect 처리
  39. var contentType = request.getResponseHeader("Content-Type");
  40. if (request.status === 200 && contentType.toLowerCase().indexOf("text/html") >= 0) {
  41. // assume that our login has expired - reload our current page
  42. window.location.reload();
  43. }
  44. else if (request.status === 0) {
  45. alert('Not connect.\n Verify Network.');
  46. }
  47. else if (request.status == 400) {
  48. alert('Server understood the request, but request content was invalid. [400]' + '\n\n' + request.responseText);
  49. }
  50. else if (request.status == 401) {
  51. alert('Unauthorized access. [401]' + '\n\n' + request.responseText);
  52. }
  53. else if (request.status == 403) {
  54. alert('Forbidden resource can not be accessed. [403]' + '\n\n' + request.responseText);
  55. }
  56. else if (request.status == 404) {
  57. alert('Requested page not found. [404]' + '\n\n' + request.responseText);
  58. }
  59. else if (request.status == 500) {
  60. alert('Internal server error. [500]' + '\n\n' + request.responseText);
  61. }
  62. else if (request.status == 503) {
  63. alert('Service unavailable. [503]' + '\n\n' + request.responseText);
  64. }
  65. else if (status === 'parsererror') {
  66. alert('Requested JSON parse failed. [Failed]' + '\n\n' + request.responseText);
  67. }
  68. else if (status === 'timeout') {
  69. alert('Time out error. [Timeout]' + '\n\n' + request.responseText);
  70. }
  71. else if (status === 'abort') {
  72. alert('Ajax request aborted. [Aborted]' + '\n\n' + request.responseText);
  73. }
  74. else {
  75. alert('Uncaught Error.' + '\n\n' + request.responseText);
  76. }
  77. }
  78. function changeReloadInterval() {
  79. var value = $("#reloadIntervalSelect option:selected").val();
  80. setReloadIntervalTime(value);
  81. }
  82. function activeReloadTimer() {
  83. if (mReloadTimer) {
  84. deactiveReloadTimer();
  85. }
  86. mReloadTimer = setInterval(function() {
  87. nextPage();
  88. }, getReloadIntervalTime() * 1000);
  89. return true;
  90. }
  91. function deactiveReloadTimer() {
  92. if (mReloadTimer) {
  93. clearInterval(mReloadTimer);
  94. mReloadTimer = null;
  95. }
  96. }
  97. function searchPatients() {
  98. var keyword = $("#searchKeyword").val();
  99. location.href = "./state?searchText="+encodeURIComponent(keyword);
  100. }
  101. function retrieveStateData(page, needInitPagination) {
  102. mCurrentPage = page;
  103. var searchText = '<c:out value="${searchText}" />';
  104. var ignoreCache = moment().unix();
  105. var params = {page: page, size: getPageSize(), searchText: searchText, ignoreCache:ignoreCache};
  106. $.ajax({
  107. url : "./api/state",
  108. data : params,
  109. method : "GET",
  110. dataType : "json",
  111. success : function( result ){
  112. mTotalCount = result.count;
  113. var html = '<div class="blankItem">표시할 데이터가 없습니다.</div>';
  114. if (result.items.length > 0) {
  115. html = "";
  116. result.items.forEach(function(d) {
  117. var danger = (d.isTemperatureWarning || d.isBloodPressureWarning || d.isOxygenSaturationeWarning) ? "danger" : "";
  118. var temperatureStep = d.isTemperatureWarning ? "step_two" : "step_one";
  119. var bloodPressureStep = d.isBloodPressureWarning ? "step_two" : "step_one";
  120. var oxygenSaturationStep = d.isOxygenSaturationeWarning ? "step_two" : "step_one";
  121. var temperatureCheck = d.needTemperatureCheck ? "timeover" : "";
  122. var bloodPressureCheck = d.needBloodPressCheck ? "timeover" : "";
  123. var oxygenSaturationCheck = d.needOxygenSaturationCheck ? "timeover" : "";
  124. var temperature = d.temperature ? parseFloat(d.temperature).toFixed(1) : "--";
  125. temperature += ' ℃ ';
  126. var bloodPressure = (d.bloodPressureDisplay) + " ";
  127. var oxygenSaturation = (d.oxygenSaturation || "--") + " % ";
  128. html += '<div class="col-lg-2 col-md-6 mb-4">';
  129. html += ' <div class="patients-stats" data-url="./info?patientIdx='+d.patientIdx+'">';
  130. html += ' <div class="name">';
  131. html += ' '+(d.wardNumber !== "" ? d.wardNumber+'/' : '')+d.roomNumber+'('+d.patientName+')';
  132. html += ' <div class="check">';
  133. html += ' <ul>';
  134. if (d.memoCount > 0) {
  135. html += ' <li><a href="javscript:;" class="memo"><i class="align-middle ml-2 fas fa-fw fa-edit"></i></a></li>';
  136. }
  137. if (d.hasTodaySymptom) {
  138. html += ' <li><a href="javscript:;" class="symptom"><i class="align-middle ml-2 fas fa-fw fa-user-plus"></i></a></li>';
  139. }
  140. html += ' </ul>';
  141. html += ' </div>';
  142. html += ' </div>';
  143. html += ' <div class="stats '+danger+'">';
  144. html += ' <ul>';
  145. html += ' <li class="fever '+temperatureStep+' '+temperatureCheck+'">'+temperature+'</li>';
  146. html += ' <li class="bloodPressure '+bloodPressureStep+' '+bloodPressureCheck+'">'+bloodPressure+'</li>';
  147. html += ' <li class="oxygen '+oxygenSaturationStep+' '+oxygenSaturationCheck+'">'+oxygenSaturation+'</li>';
  148. html += ' </ul>';
  149. html += ' </div>';
  150. html += ' </div>';
  151. html += '</div>';
  152. });
  153. };
  154. $(".patients-list").fadeOut('fast',function(){
  155. $(".patients-list").html(html).fadeIn('fast');
  156. if (needInitPagination) {
  157. initPagination(page, getTotalPage())
  158. }
  159. });
  160. },
  161. error : ajaxErrorHandler
  162. }).done( function(){
  163. });
  164. }
  165. function nextPage() {
  166. if (getTotalPage() === 1) {
  167. retrieveStateData(1, false);
  168. return;
  169. }
  170. var next = $("#pagination .active").next();
  171. if (!next.is(':visible') || next.hasClass("disabled")) {
  172. $("#pagination .first").click();
  173. }
  174. else {
  175. next.click();
  176. }
  177. }
  178. //윈도우 폭에 따른 반응형 목록 수 분기 함수
  179. function responsiblePagination() {
  180. var window_width = $(window).width();
  181. if(window_width >= 1200) {
  182. $('#pagination').bootpag({
  183. maxVisible: 10, // 한번에 보여지는 페이지수
  184. firstLastUse: true
  185. });
  186. }
  187. if(window_width < 1200 && window_width >= 600) {
  188. $('#pagination').bootpag({
  189. maxVisible: 5, // 한번에 보여지는 페이지수
  190. firstLastUse: true
  191. });
  192. }
  193. if(window_width < 600){
  194. $('#pagination').bootpag({
  195. maxVisible: 3, // 한번에 보여지는 페이지수
  196. firstLastUse: false
  197. });
  198. }
  199. }
  200. function initPagination(initPage, totalPage) {
  201. ////////////////////////////////////////////////////////////////////////////////
  202. //// Pagination
  203. ////////////////////////////////////////////////////////////////////////////////
  204. // 페이지 네이션 실행
  205. // Pagination API -> http://botmonster.com/jquery-bootpag/#.XD2VElwzaUk
  206. $('#pagination').bootpag({
  207. // maxVisible: 3, // 한번에 보여지는 페이지수
  208. // firstLastUse: true,
  209. // href: 'URL',// template for pagination links (default javascript:void(0);)
  210. // hrefVariable: false,// variable name in href template for page number (default {{number}})
  211. total: totalPage, // 페이지 수
  212. page: initPage, // 초기 페이지
  213. leaps: true,
  214. first: '<i class="mdi mdi-chevron-double-left"></i>',
  215. prev: '<i class="mdi mdi-chevron-left"></i>',
  216. next: '<i class="mdi mdi-chevron-right"></i>',
  217. last: '<i class="mdi mdi-chevron-double-right"></i>',
  218. wrapClass: 'pagination',
  219. activeClass: 'active',
  220. disabledClass: 'disabled',
  221. nextClass: 'next',
  222. prevClass: 'prev',
  223. lastClass: 'last',
  224. firstClass: 'first'
  225. })
  226. .off("page")
  227. .on("page", function(event, num){
  228. retrieveStateData(num, false);
  229. });
  230. responsiblePagination();
  231. }
  232. $(document).ready(function() {
  233. setTimeout(function () {
  234. $(".preloader").fadeOut("fast");
  235. }, 1000);
  236. $("#viewEntry").val(getPageSize());
  237. $(document).on("change", "#viewEntry", function() {
  238. var viewEntry = $(this).find("option:selected").val();
  239. setPageSize(viewEntry);
  240. retrieveStateData(1, true);
  241. });
  242. retrieveStateData(mCurrentPage, true);
  243. $("#reloadIntervalSelect").val(getReloadIntervalTime());
  244. // if (getPlayOnOff() === "on") {
  245. // if (activeReloadTimer()) {
  246. // $(".playPause").attr('id','pauseButton');
  247. // $(".playPause").find('i').removeClass('fa-play').addClass('fa-pause');
  248. // $('#reloadIntervalSelect').prop('disabled',true);
  249. // }
  250. // }
  251. // else {
  252. // deactiveReloadTimer();
  253. // $(".playPause").attr('id','playButton');
  254. // $(".playPause").find('i').removeClass('fa-pause').addClass('fa-play');
  255. // $('#reloadIntervalSelect').prop('disabled',false);
  256. // }
  257. $(document).on("click", ".patients-stats", function() {
  258. var searchText = '<c:out value="${searchText}" />';
  259. var currentPage = $("#pagination .active").children("a").text();
  260. var url = $(this).attr("data-url");
  261. if (searchText !== "") {
  262. url += "&refererSearch="+encodeURIComponent(searchText);
  263. }
  264. url += "&refererPage="+currentPage;
  265. location.href = url;
  266. });
  267. // 반복 start/stop 클릭
  268. $(document).on('click','.playPause', function () {
  269. var thisID = $(this).attr('id');
  270. if(thisID == 'playButton'){
  271. if (activeReloadTimer()) {
  272. $(this).attr('id','pauseButton');
  273. $(this).find('i').removeClass('fa-play').addClass('fa-pause');
  274. $('#reloadIntervalSelect').prop('disabled',true);
  275. // setPlayOnOff("on");
  276. }
  277. }
  278. else if(thisID == 'pauseButton'){
  279. deactiveReloadTimer();
  280. $(this).attr('id','playButton');
  281. $(this).find('i').removeClass('fa-pause').addClass('fa-play');
  282. $('#reloadIntervalSelect').prop('disabled',false);
  283. // setPlayOnOff("off");
  284. }
  285. });
  286. // 윈도우 폭 변경에 따른 반응형 목록 수 적용
  287. $(window).resize(function(){
  288. responsiblePagination();
  289. });
  290. });
  291. </script>
  292. </head>
  293. <body>
  294. <div class="preloader">
  295. <div class="loadingIcon"></div>
  296. </div>
  297. <div class="modal fade" id="legendGuide" tabindex="-1" role="dialog" aria-hidden="true">
  298. <div class="modal-dialog modal-sm" role="document">
  299. <div class="modal-content">
  300. <div class="modal-header">
  301. <h5 class="modal-title">알람 표시 기준 안내</h5>
  302. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  303. </div>
  304. <div class="modal-body m-1">
  305. <h4>생체측정 알람 표시 기준</h4>
  306. <ul class="legend">
  307. <li class="row fever">
  308. <div class="col-lg-4">체온</div>
  309. <div class="col-lg-8">37.5 이상</div>
  310. </li>
  311. <li class="row bloodPressure">
  312. <div class="col-lg-4">고혈압</div>
  313. <div class="col-lg-8">수축기 149 이상<br>이완기 99 이상</div>
  314. </li>
  315. <li class="row bloodPressure">
  316. <div class="col-lg-4">저혈압</div>
  317. <div class="col-lg-8">수축기 90 이하<br>이완기 60 이하</div>
  318. </li>
  319. <li class="row oxygen">
  320. <div class="col-lg-4">산소포화도</div>
  321. <div class="col-lg-8">94% 이하</div>
  322. </li>
  323. <li class="row pulse">
  324. <div class="col-lg-4">맥박</div>
  325. <div class="col-lg-8">최저 55 이하<br>최고 110 이상</div>
  326. </li>
  327. <li class="row sugar">
  328. <div class="col-lg-4">고혈당</div>
  329. <div class="col-lg-8">200 이상</div>
  330. </li>
  331. <li class="row sugar">
  332. <div class="col-lg-4">저혈당</div>
  333. <div class="col-lg-8">70 이하</div>
  334. </li>
  335. </ul>
  336. </div>
  337. <div class="modal-footer">
  338. <button type="button" class="btn btn-primary" data-dismiss="modal">닫기</button>
  339. </div>
  340. </div>
  341. </div>
  342. </div>
  343. <div class="wrapper">
  344. <jsp:include page="${data._INCLUDE}/sidebar.jsp"></jsp:include>
  345. <div class="main">
  346. <jsp:include page="${data._INCLUDE}/top.jsp"></jsp:include>
  347. <main class="content">
  348. <div class="container-fluid p-0">
  349. <!-- 환자관리 : 신규환자 등록 START -->
  350. <div class="row">
  351. <div class="col-12 col-lg-6">
  352. <h1 class="h3 mb-3">진료관리</h1>
  353. </div>
  354. <div class="col-12 col-lg-6 text-right">
  355. <nav aria-label="breadcrumb">
  356. <ol class="breadcrumb">
  357. <li class="breadcrumb-item"><a href="javscript:;">Home</a></li>
  358. <li class="breadcrumb-item active">진료관리</li>
  359. </ol>
  360. </nav>
  361. </div>
  362. </div>
  363. <div class="row">
  364. <div class="col-12">
  365. <div class="card">
  366. <div class="card-header">
  367. <div class="row">
  368. <div class="col-lg-12 mb-3">
  369. <h1 class="h4">
  370. 대시보드
  371. <span class="small showLegend ml-2" data-toggle="modal" data-target="#legendGuide"><i class="mdi mdi-comment-question-outline"></i> 알람 표시 기준</span>
  372. </h1>
  373. </div>
  374. <div class="col-lg-6 entrySelect">
  375. <label>
  376. <select id="viewEntry" class="custom-select">
  377. <option value="18">18명</option>
  378. <option value="30" selected>30명</option>
  379. <option value="60">60명</option>
  380. <option value="120">120명</option>
  381. <option value="10000">전체</option>
  382. </select>
  383. </label>
  384. 보기
  385. </div>
  386. <div class="col-lg-6 search text-right">
  387. <label>
  388. <select id="reloadIntervalSelect" class="custom-select" onchange="changeReloadInterval()">
  389. <option value="10">10초</option>
  390. <option value="30" selected>30초</option>
  391. <option value="60">60초</option>
  392. </select>
  393. </label>
  394. <label>
  395. <button type="button" id="playButton" class="playPause btn btn-primary">
  396. <i class="fas fa-play"></i>
  397. </button>
  398. </label>
  399. <input type="text" class="form-control w150" id="searchKeyword" placeholder="호실 or 환자명" value="${searchText}" onkeyup="if(event.keyCode===13){searchPatients()}">
  400. <button id="searchKeywordBtn" class="btn btn-primary" onclick="searchPatients()">검색</button>
  401. </div>
  402. </div>
  403. </div>
  404. <div class="card-body">
  405. <ul class="row patients-list">
  406. <c:choose>
  407. <c:when test="${total == 0}">
  408. <li class="blankItem">표시할 데이터가 없습니다.</div>
  409. </c:when>
  410. <c:otherwise>
  411. <c:forEach var="patient" items="${items}" varStatus="status">
  412. <c:set var="title" value="${patient.wardNumber != '' ? patient.wardNumber : ''}${patient.wardNumber != '' ? '/' : ''}${patient.roomNumber}(${patient.patientName})" />
  413. <c:set var="viewLink" value="./info?patientIdx=${patient.patientIdx}" />
  414. <c:set var="temperatureStep" value="${patient.isTemperatureWarning ? 'step_two' : 'step_one'}" />
  415. <c:set var="bloodPressureStep" value="${patient.isBloodPressureWarning ? 'step_two' : 'step_one'}" />
  416. <c:set var="oxygenSaturationStep" value="${patient.isOxygenSaturationeWarning ? 'step_two' : 'step_one'}" />
  417. <c:set var="temperatureCheck" value="${patient.needTemperatureCheck ? 'timeover' : ''}" />
  418. <c:set var="bloodPressureCheck" value="${patient.needBloodPressCheck ? 'timeover' : ''}" />
  419. <c:set var="oxygenSaturationCheck" value="${patient.needOxygenSaturationCheck ? 'timeover' : ''}" />
  420. <li class="col-lg-2 col-md-4 mb-4">
  421. <div class="patients-stats" data-url="${viewLink}">
  422. <div class="name">
  423. <c:out value="${title}" />
  424. <div class="check">
  425. <ul>
  426. <c:if test="${patient.memoCount > 0}">
  427. <li><a href="javscript:;" class="memo"><i class="align-middle ml-2 fas fa-fw fa-edit"></i></a></li>
  428. </c:if>
  429. <c:if test="${patient.hasTodaySymptom}">
  430. <li><a href="javscript:;" class="symptom"> <i class="align-middle ml-2 fas fa-fw fa-user-plus"></i></a></li>
  431. </c:if>
  432. </ul>
  433. </div>
  434. </div>
  435. <div class="stats ${patient.isTemperatureWarning || patient.isBloodPressureWarning || patient.isOxygenSaturationeWarning ? 'danger' : '' }">
  436. <ul>
  437. <li class="fever ${temperatureStep} ${temperatureCheck}"><c:out value="${patient.temperature != null ? patient.temperature : '--'} ℃ " /></li>
  438. <li class="bloodPressure ${bloodPressureStep} ${bloodPressureCheck}"><c:out value='${patient.bloodPressureDisplay} ' /></li>
  439. <li class="oxygen ${oxygenSaturationStep} ${oxygenSaturationCheck}"><c:out value="${patient.oxygenSaturation != null ? patient.oxygenSaturation : '--'} %" />
  440. </ul>
  441. </div>
  442. </div>
  443. </li>
  444. </c:forEach>
  445. </c:otherwise>
  446. </c:choose>
  447. </ul>
  448. </div>
  449. <div class="card-footer">
  450. <div id="pagination" class="paginationContainer"></div>
  451. </div>
  452. </div>
  453. </div>
  454. </div>
  455. <!-- 환자관리 : 신규환자 등록 END -->
  456. </div>
  457. </main>
  458. <jsp:include page="${data._INCLUDE}/footer.jsp"></jsp:include>
  459. </div>
  460. </div>
  461. </body>
  462. </html>