medihistory.js 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. "use strict";
  2. /**
  3. * mplus_modal_medicalhistory
  4. */
  5. var mplus_modal_medicalhistory = function(){
  6. // 상속
  7. mplus_common.call(this);
  8. // 상위 객체 생성
  9. //var mplusPatient = new mplus_mobile_patient();
  10. //var mplusNursing = new mplus_nursing();
  11. //super
  12. var self = this;
  13. //==== 변수 { ====
  14. var varResultLists = [];
  15. //==== 변수 } ====
  16. /**
  17. * 초기화
  18. */
  19. this.init = function(){ //여기서 모든화면 콤보박스데이터를 집어넣자!!! 그래야지 화면이동할때 속도가 오래걸리지않음!!!
  20. // 초기 화면 조건 구성
  21. initCondition();
  22. // 이벤트 초기화
  23. addEvent();
  24. };
  25. //==== 초기화 설정 { ====
  26. var initCondition = function(){
  27. // 초기 화면 조건 구성
  28. // 일자 설정
  29. initStartEndDate();
  30. searchMedicalHis();
  31. };
  32. var searchMedicalHis = function(){
  33. var param = {
  34. userId:gLoginUserId,
  35. patientId:gPatientId,
  36. startDt: moment($("#txtInMedicalHisStartDt").val()).format("YYYYMMDD"),
  37. endDt: moment($("#txtInMedicalHisEndDt").val()).format("YYYYMMDD")
  38. };
  39. self.medical.getOpHistoryList(param, processSearchMedicalOpHisList);
  40. self.medical.getInHistoryList(param, processSearchMedicalInHisList);
  41. self.medical.getOutHistoryList(param, processSearchMedicalOutHisList);
  42. };
  43. var processSearchMedicalInHisList = function(lists){
  44. //console.log(JSON.stringify(lists));
  45. var strDisplayTemp = "";
  46. $("#divMedicalInHistoryResultRows").empty();
  47. for( var i = 0; i < lists.length; i++){
  48. strDisplayTemp += "<div class=\"row list-group-item\" patientNo=\"" + i + "\" patientId=\"" + lists[i].patientId + "\" style=\"overflow: hidden; padding-left: 0px; padding-right: 0px;\">"
  49. + " <div class=\"col-xs-12 col-sm-6 col-lg-6\">"
  50. + " <div class=\"col-xs-2 col-sm-3 col-lg-3 text-center\" style=\"padding: 0px;\">입원</div>"
  51. + " <div class=\"col-xs-4 col-sm-3 col-lg-3 text-center\" style=\"padding: 0px;\">" + ((moment(lists[i].hospitalizationDt).format("YYYY-MM-DD") != "Invalid date") ? moment(lists[i].hospitalizationDt).format("YYYY-MM-DD") : "-") + "</div>"
  52. + " <div class=\"col-xs-3 col-sm-3 col-lg-3 text-center\" style=\"padding: 0px;\">" + lists[i].deptNm + "</div>"
  53. + " <div class=\"col-xs-3 col-sm-3 col-lg-3 text-center\" style=\"padding: 0px;\">" + lists[i].doctorNm + "</div>"
  54. + " </div>"
  55. + " <div class=\"col-xs-12 col-sm-6 col-lg-6\">"
  56. + " <div class=\"col-xs-4 col-sm-3 col-lg-3\" style=\"padding: 0px;\">" + ((lists[i].wardNm != undefined) ? (lists[i].wardNm) : "")
  57. + ((lists[i].roomNm != undefined) ? ("<p>" + lists[i].roomNm+"/") : "")
  58. + ((lists[i].bedNm != undefined) ? (lists[i].bedNm + "</p>") : "</p>") + "</div>"
  59. + " <div class=\"col-xs-8 col-sm-3 col-lg-3\" style=\"padding: 0px;\">" + lists[i].diagnosisNm + "</div>"
  60. + " </div>"
  61. + "</div>"
  62. ;
  63. //console.log( i + " : " + lists[i].deptNm);
  64. }
  65. $("#divMedicalInHistoryResultRows").append(strDisplayTemp); // element 추가
  66. };
  67. var processSearchMedicalOutHisList = function(lists){
  68. //console.log(JSON.stringify(lists));
  69. var strDisplayTemp = "";
  70. $("#divMedicalOutHistoryResultRows").empty();
  71. for( var i = 0; i < lists.length; i++){
  72. strDisplayTemp += "<div class=\"row list-group-item\" patientNo=\"" + i + "\" patientId=\"" + lists[i].patientId + "\" style=\"overflow: hidden; padding-left: 0px; padding-right: 0px;\">"
  73. + " <div class=\"col-xs-12 col-sm-6 col-lg-6\">"
  74. + " <div class=\"col-xs-2 col-sm-3 col-lg-3 text-center\" style=\"padding: 0px;\">외래</div>"
  75. + " <div class=\"col-xs-4 col-sm-3 col-lg-3 text-center\" style=\"padding: 0px;\">" + ((moment(lists[i].visitDt).format("YYYY-MM-DD") != "Invalid date") ? moment(lists[i].visitDt).format("YYYY-MM-DD") : "-") + "</div>"
  76. + " <div class=\"col-xs-3 col-sm-3 col-lg-3 text-center\" style=\"padding: 0px;\">" + lists[i].deptNm + "</div>"
  77. + " <div class=\"col-xs-3 col-sm-3 col-lg-3 text-center\" style=\"padding: 0px;\">" + lists[i].doctorNm + "</div>"
  78. + " </div>"
  79. + " <div class=\"col-xs-12 col-sm-6 col-lg-6\">"
  80. + " <div class=\"col-xs-4 col-sm-3 col-lg-3\" style=\"padding: 0px;\">" + ((lists[i].wardNm != undefined) ? (lists[i].wardNm+"/") : "")
  81. + ((lists[i].roomNm != undefined) ? (lists[i].roomNm+"/") : "")
  82. + ((lists[i].bedNm != undefined) ? (lists[i].bedNm) : "") + "</div>"
  83. + " <div class=\"col-xs-8 col-sm-3 col-lg-3\" style=\"padding: 0px;\">" + lists[i].diagnosisNm + "</div>"
  84. + " </div>"
  85. + "</div>"
  86. ;
  87. //console.log( i + " : " + lists[i].deptNm);
  88. }
  89. $("#divMedicalOutHistoryResultRows").append(strDisplayTemp); // element 추가
  90. };
  91. var processSearchMedicalOpHisList = function(lists){
  92. //console.log(JSON.stringify(lists));
  93. var strDisplayTemp = "";
  94. $("#divMedicalOpHistoryResultRows").empty();
  95. for( var i = 0; i < lists.length; i++){
  96. strDisplayTemp += "<div class=\"row list-group-item\" patientNo=\"" + i + "\" patientId=\"" + lists[i].patientId + "\" style=\"overflow: hidden; padding-left: 0px; padding-right: 0px;\">"
  97. + " <div class=\"col-xs-12 col-sm-6 col-lg-6\">"
  98. + " <div class=\"col-xs-2 col-sm-3 col-lg-3 text-center\" style=\"padding: 0px;\">수술</div>"
  99. + " <div class=\"col-xs-4 col-sm-3 col-lg-3 text-center\" style=\"padding: 0px;\">" + ((moment(lists[i].operationDt).format("YYYY-MM-DD") != "Invalid date") ? moment(lists[i].operationDt).format("YYYY-MM-DD") : "-") + "</div>"
  100. + " <div class=\"col-xs-3 col-sm-3 col-lg-3 text-center\" style=\"padding: 0px;\">" + lists[i].deptNm + "</div>"
  101. + " <div class=\"col-xs-3 col-sm-3 col-lg-3 text-center\" style=\"padding: 0px;\">" + lists[i].operationDrNm + "</div>"
  102. + " </div>"
  103. + " <div class=\"col-xs-12 col-sm-6 col-lg-6\">"
  104. + " <div class=\"col-xs-4 col-sm-3 col-lg-3\" style=\"padding: 0px;\">" + ((lists[i].wardNm != undefined) ? (lists[i].wardNm+"/") : "")
  105. + ((lists[i].roomNm != undefined) ? (lists[i].roomNm+"/") : "")
  106. + ((lists[i].bedNm != undefined) ? (lists[i].bedNm) : "") + "</div>"
  107. + " <div class=\"col-xs-8 col-sm-3 col-lg-3\" style=\"padding: 0px;\">" + lists[i].operationNm + "</div>"
  108. + " </div>"
  109. + "</div>"
  110. ;
  111. //console.log( i + " : " + lists[i].deptNm);
  112. }
  113. $("#divMedicalOpHistoryResultRows").append(strDisplayTemp); // element 추가
  114. };
  115. var initStartEndDate = function(){
  116. //오늘일자 로드
  117. var varToday = new Date();
  118. //일요일이면 차주 가져오기
  119. //다른 요일이면 해당 요일 처리
  120. $("#txtInMedicalHisEndDt").val( moment(varToday).format("YYYY-MM-DD") );
  121. $("#txtInMedicalHisStartDt").val( moment().subtract(1, 'months').format("YYYY-MM-DD") );
  122. };
  123. //==== 초기화 설정 } ====
  124. //==== 이벤트 설정 { ====
  125. var addEvent = function(){
  126. //$("#btnLogout").on("click", function(){
  127. // logout();
  128. //});
  129. eventColumnClick();
  130. eventRowClick();
  131. eventConditionClick();
  132. };
  133. var eventConditionClick = function(){
  134. // 1일
  135. $("#btnMedicalHisOneDaySearch").off("click"); // 기존 이벤트 해제
  136. $("#btnMedicalHisOneDaySearch").on("click", function(e){
  137. $("#txtInMedicalHisStartDt").val( moment().subtract(1, 'days').format("YYYY-MM-DD") );
  138. searchMedicalHis();
  139. });
  140. // 1달 버튼클릭
  141. $("#btnMedicalHisOneMonthSearch").off('click'); // 기존 이벤트 해제
  142. $("#btnMedicalHisOneMonthSearch").on('click', function(e){
  143. $("#txtInMedicalHisStartDt").val( moment().subtract(1, 'months').format("YYYY-MM-DD") );
  144. searchMedicalHis();
  145. });
  146. // 3달 버튼클릭
  147. $("#btnMedicalHisThreeMonthSearch").off('click'); // 기존 이벤트 해제
  148. $("#btnMedicalHisThreeMonthSearch").on('click', function(e){
  149. $("#txtInMedicalHisStartDt").val( moment().subtract(3, 'months').format("YYYY-MM-DD") );
  150. searchMedicalHis();
  151. });
  152. // 6달 버튼클릭
  153. $("#btnMedicalHisSixMonthSearch").off('click'); // 기존 이벤트 해제
  154. $("#btnMedicalHisSixMonthSearch").on('click', function(e){
  155. var varSelDate = new Date($("#txtInMedicalHisEndDt").val());
  156. varSelDate.setDate(varSelDate.getDate() - 1);
  157. varSelDate.setMonth(varSelDate.getMonth() - 6);
  158. $("#txtInMedicalHisStartDt").val( moment(varSelDate).format("YYYY-MM-DD") );
  159. });
  160. // 1년 버튼클릭
  161. $("#btnMedicalHisOneYearSearch").off('click'); // 기존 이벤트 해제
  162. $("#btnMedicalHisOneYearSearch").on('click', function(e){
  163. var varSelDate = new Date($("#txtInMedicalHisEndDt").val());
  164. varSelDate.setDate(varSelDate.getDate() - 1);
  165. varSelDate.setFullYear(varSelDate.getFullYear() - 1);
  166. $("#txtInMedicalHisStartDt").val( moment(varSelDate).format("YYYY-MM-DD") );
  167. });
  168. // 조회버튼
  169. $("#btnMedicalHisSearch").off('click'); // 기존 이벤트 해제
  170. $("#btnMedicalHisSearch").on('click', function(e){
  171. //로우 초기화
  172. $("#divMedicalInHistoryResultRows").empty();
  173. $("#divMedicalOutHistoryResultRows").empty();
  174. $("#divMedicalOpHistoryResultRows").empty();
  175. searchMedicalHis();
  176. });
  177. };
  178. var eventColumnClick = function(){
  179. };
  180. var eventRowClick = function(){
  181. };
  182. //==== 이벤트 설정 } ====
  183. //==== 서비스 실행 { ====
  184. //==== 서비스 실행 { ====
  185. };