state.jsp 18 KB

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