examlist.js 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. "use strict";
  2. /**
  3. * mplus_modal_examlist
  4. */
  5. var mplus_modal_examlist = 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. var varExamlistResultLists = [];
  14. //==== 변수 { ====
  15. //==== 변수 } ====
  16. /**
  17. * 초기화
  18. */
  19. this.init = function(){ //여기서 모든화면 콤보박스데이터를 집어넣자!!! 그래야지 화면이동할때 속도가 오래걸리지않음!!!
  20. // 초기 화면 조건 구성
  21. initCondition();
  22. // 이벤트 초기화
  23. addEvent();
  24. };
  25. //==== 초기화 설정 { ====
  26. var initCondition = function(){
  27. //결과값 초기화
  28. initEmptyData();
  29. // 초기 화면 조건 구성
  30. initStartEndDate();
  31. //접수부서
  32. initReceiptDeptList();
  33. };
  34. var initEmptyData = function(){
  35. $("#divExamResultRows").empty();
  36. varExamlistResultLists=[];
  37. }
  38. var initReceiptDeptList = function(){
  39. var param = {
  40. userId:gLoginUserId,
  41. patientId:gPatientId,
  42. startDt:moment($("#txtExamStartDt").val()).format("YYYYMMDD"),
  43. endDt:moment($("#txtExamEndDt").val()).format("YYYYMMDD")
  44. };
  45. self.medical.getExamReceiptDeptList(param, processReceiptDeptList);
  46. };
  47. var processReceiptDeptList = function(lists){
  48. $("#selReceiptDept").empty();
  49. var strDisplayTemp = "";
  50. strDisplayTemp = "<option value=\"\">접수부서</option>";
  51. if(lists != undefined){
  52. for(var i=0; i<lists.length; i++){
  53. strDisplayTemp += "<option value=\""+ lists[i].receiptDeptCd + "\" >"+ lists[i].receiptDeptNm +"</option>";
  54. }
  55. }
  56. $("#selReceiptDept").append(strDisplayTemp);
  57. $("#selReceiptDept").val($("#selReceiptDept option:first").val());
  58. searchExam();
  59. };
  60. var initStartEndDate = function(){
  61. //오늘일자 로드
  62. var varToday = new Date();
  63. //varToday.setDate(varToday.getMonth() - 1);
  64. //일요일이면 차주 가져오기
  65. //다른 요일이면 해당 요일 처리
  66. $("#txtExamEndDt").val( moment(varToday).format("YYYY-MM-DD") );
  67. $("#txtExamStartDt").val( moment().subtract(1, 'months').format("YYYY-MM-DD") );
  68. };
  69. var searchExam = function(){
  70. var param = {
  71. hospitalCd: localStorage.getItem("hospitalCd"),
  72. userId:gLoginUserId,
  73. patientId:gPatientId,
  74. startDt:moment($("#txtExamStartDt").val()).format("YYYYMMDD"),
  75. endDt:moment($("#txtExamEndDt").val()).format("YYYYMMDD"),
  76. receiptDeptCd:$("#selReceiptDept").val()
  77. };
  78. self.medical.getExamList(param, processSearchExamList);
  79. };
  80. var processSearchExamList = function(lists){
  81. var strDisplayTemp = "";
  82. var varExamReceiptDt = "";
  83. var varExamReceiptTm = "";
  84. var varExamDt = "";
  85. varExamlistResultLists = lists;
  86. $("#divExamResultRows").empty();
  87. for( var i = 0; i < lists.length; i++){
  88. if(lists[i].examReceiptDt != undefined && lists[i].examReceiptDt != "" && lists[i].examReceiptDt != null) {
  89. varExamReceiptDt = moment(lists[i].examReceiptDt).format("YYYY-MM-DD");
  90. varExamReceiptTm = moment(lists[i].examReceiptDt , "YYYYMMDDHHmmss").format("HH:mm");
  91. } else {
  92. varExamReceiptDt = lists[i].examReceiptDt;
  93. varExamReceiptTm = lists[i].examReceiptDt;
  94. }
  95. if(lists[i].examDt != undefined && lists[i].examDt != "" && lists[i].examDt != null) {
  96. varExamDt = moment(lists[i].examDt).format("YYYY-MM-DD");
  97. } else {
  98. varExamDt = lists[i].examDt;
  99. }
  100. strDisplayTemp += "<div class=\"chart-content\" listCnt=\"" + i + "\" examRsltKey=\"" + lists[i].examRsltKey + "\" style=\"overflow: hidden;\">"
  101. + " <div class=\"row\">"
  102. + " <div class=\"col-xs-1 text-center\" style=\"padding: 4px 0px;word-wrap: break-word;\"><p>" + lists[i].examClsNm + "</p></div>"
  103. // + " <div class=\"col-xs-3 text-center\" style=\"padding: 4px 0px;word-wrap: break-word;\"><p>" + moment(lists[i].examReceiptDt).format("YYYY-MM-DD") + "<br>" + moment(lists[i].examReceiptDt , "YYYYMMDDHHmmss").format("HH:mm") + "</p></div>"
  104. + " <div class=\"col-xs-3 text-center\" style=\"padding: 4px 0px;word-wrap: break-word;\"><p>" + varExamReceiptDt + "<br>" + varExamReceiptTm + "</p></div>"
  105. // + " <div class=\"col-xs-2 text-center\" style=\"padding: 4px 0px;word-wrap: break-word;\"><p>" + moment(lists[i].examDt).format("YYYY-MM-DD") + "</p></div>"
  106. + " <div class=\"col-xs-2 text-center\" style=\"padding: 4px 0px;word-wrap: break-word;\"><p>" + varExamDt + "</p></div>"
  107. + " <div class=\"col-xs-6\" style=\"padding: 4px 0px;word-wrap: break-word;\"><p>" + lists[i].examNm + "</p></div>"
  108. + " </div>"
  109. + "</div>"
  110. ;
  111. //console.log( i + " : " + lists[i].deptNm);
  112. }
  113. $("#divExamResultRows").append(strDisplayTemp); // element 추가
  114. addEventExamList();
  115. };
  116. var addEventExamList = function() {
  117. $("#divExamResultRows .chart-content").off("click"); // 기존 이벤트 해제
  118. $("#divExamResultRows .chart-content").on("click", function(e){
  119. if(varExamlistResultLists[e.currentTarget.attributes.listCnt.value].examRsltTy == "1"){ // 1:검체검사 2:판독결과 3:병리검사
  120. // 환자 정보 화면 띄우기
  121. $("#modalExamRsltTy1").modal("show");
  122. mplusModalExamrsltty1.init(varExamlistResultLists[e.currentTarget.attributes.listCnt.value]);
  123. // }else if(varExamlistResultLists[e.currentTarget.attributes.listCnt.value].examRsltTy == "2"){
  124. }else{
  125. // 환자 정보 화면 띄우기
  126. $("#modalExamRsltTy2").modal("show");
  127. mplusModalExamrsltty2.init(varExamlistResultLists[e.currentTarget.attributes.listCnt.value]);
  128. //} else {
  129. // self.alert("검사결과 타입값에 오류가 있습니다.");
  130. }
  131. });
  132. };
  133. var btnSetClassDefault = function(){
  134. $(".inquiry-btn").removeClass("on");
  135. };
  136. //==== 초기화 설정 } ====
  137. //==== 이벤트 설정 { ====
  138. var addEvent = function(){
  139. //$("#btnLogout").on("click", function(){
  140. // logout();
  141. //});
  142. eventConditionClick();
  143. eventColumnClick();
  144. eventRowClick();
  145. };
  146. var eventConditionClick = function(){
  147. // 1일
  148. $("#btnExamOneDaySearch").off("click"); // 기존 이벤트 해제
  149. $("#btnExamOneDaySearch").on("click", function(e){
  150. btnSetClassDefault();
  151. $("#btnExamOneDaySearch").addClass("on");
  152. $("#txtExamStartDt").val( moment().subtract(1, 'days').format("YYYY-MM-DD") );
  153. //접수부서
  154. initReceiptDeptList();
  155. });
  156. // 1주 버튼클릭
  157. $("#btnExamOneWeekSearch").off("click"); // 기존 이벤트 해제
  158. $("#btnExamOneWeekSearch").on("click", function(e){
  159. btnSetClassDefault();
  160. $("#btnExamOneWeekSearch").addClass("on");
  161. var varSelDate = new Date($("#txtExamEndDt").val());
  162. varSelDate.setDate(varSelDate.getDate() - 7);
  163. $("#txtExamStartDt").val( moment(varSelDate).format("YYYY-MM-DD") );
  164. //접수부서
  165. initReceiptDeptList();
  166. });
  167. // 1달 버튼클릭
  168. $("#btnExamOneMonthSearch").off("click"); // 기존 이벤트 해제
  169. $("#btnExamOneMonthSearch").on("click", function(e){
  170. btnSetClassDefault();
  171. $("#btnExamOneMonthSearch").addClass("on");
  172. $("#txtExamStartDt").val( moment().subtract(1, 'months').format("YYYY-MM-DD") );
  173. //접수부서
  174. initReceiptDeptList();
  175. });
  176. // 3달 버튼클릭
  177. $("#btnExamThreeMonthSearch").off('click'); // 기존 이벤트 해제
  178. $("#btnExamThreeMonthSearch").on('click', function(e){
  179. btnSetClassDefault();
  180. $("#btnExamThreeMonthSearch").addClass("on");
  181. $("#txtExamStartDt").val( moment().subtract(3, 'months').format("YYYY-MM-DD") );
  182. //접수부서
  183. initReceiptDeptList();
  184. });
  185. // 조회버튼
  186. $("#btnExamSearch").off("click"); // 기존 이벤트 해제
  187. $("#btnExamSearch").on("click", function(e){
  188. searchExam();
  189. });
  190. //날짜 변경 시 부서 다시 가져오기
  191. $("#txtExamStartDt").off("change"); // 기존 이벤트 해제
  192. $("#txtExamStartDt").on("change", function(e){
  193. //접수부서
  194. initReceiptDeptList();
  195. });
  196. $("#txtExamEndDt").off("change"); // 기존 이벤트 해제
  197. $("#txtExamEndDt").on("change", function(e){
  198. //접수부서
  199. initReceiptDeptList();
  200. });
  201. };
  202. var eventColumnClick = function(){
  203. };
  204. var eventRowClick = function(){
  205. };
  206. //==== 이벤트 설정 } ====
  207. //==== 서비스 실행 { ====
  208. //==== 서비스 실행 { ====
  209. };