medirecord.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. "use strict";
  2. /**
  3. * mplus_modal_medicalrecord
  4. */
  5. var mplus_modal_medicalrecord = 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. var varGetDeviceInfo;
  17. /**
  18. * 초기화
  19. */
  20. this.init = function(){ //여기서 모든화면 콤보박스데이터를 집어넣자!!! 그래야지 화면이동할때 속도가 오래걸리지않음!!!
  21. //데이터
  22. initData();
  23. // 초기 화면 조건 구성
  24. initCondition();
  25. // 이벤트 초기화
  26. addEvent();
  27. };
  28. //==== 초기화 설정 { ====
  29. var initData = function(){
  30. $("#sltMedicalRecordListSearch").val("1");//기록 목록조회
  31. $("#sltMedicalRecordListSearch").trigger("change");//header 처리
  32. $("#chkMedicalRecordSelfList").prop("checked" , false);//본인기록
  33. /*
  34. * 진료기록 안드로이드 앱버전체크 후 안내 계획 폐지
  35. //앱버전체크
  36. var toNaiveMsg = {
  37. "type" : "command",
  38. "functionType" : "getDeviceInfo",
  39. "value" : {
  40. "callbackFn":"window.activeObj.toNativeCallbackFn"
  41. }
  42. };
  43. */
  44. //self.toNative(toNaiveMsg);
  45. };
  46. this.toNativeCallbackFn = function(result){
  47. varGetDeviceInfo = result;
  48. console.log(JSON.stringify(varGetDeviceInfo));
  49. };
  50. var initCondition = function(){
  51. // 초기 화면 조건 구성
  52. // 일자 설정
  53. initStartEndDate();
  54. searchMedicalRecord();
  55. };
  56. var searchMedicalRecord = function(){
  57. if($("#sltMedicalRecordListSearch").val() == 1){//기록목록조회
  58. var param = {
  59. userId:gLoginUserId,
  60. patientId:gPatientId,
  61. startDt: moment($("#txtMedicalRecordStartDt").val()).format("YYYYMMDD"),
  62. endDt: moment($("#txtMedicalRecordEndDt").val()).format("YYYYMMDD"),
  63. deptCd:gPatientDeptCd,
  64. personalRecordYn:($("#chkMedicalRecordSelfList").prop("checked") == true ? "Y" : "N" ),
  65. searchCls:gPatientTreatCls
  66. };
  67. //console.log("TEST : " + JSON.stringify(param));
  68. self.medical.getMediRecordList(param, processSearchMediRecordList);
  69. }else if($("#sltMedicalRecordListSearch").val() == 2){//기록내용조회
  70. var param = {
  71. userId:gLoginUserId,
  72. patientId:gPatientId,
  73. startDt: moment($("#txtMedicalRecordStartDt").val()).format("YYYYMMDD"),
  74. endDt: moment($("#txtMedicalRecordEndDt").val()).format("YYYYMMDD"),
  75. deptCd:gPatientDeptCd,
  76. personalRecordYn:($("#chkMedicalRecordSelfList").prop("checked") == true ? "Y" : "N" ),
  77. searchCls:gPatientTreatCls
  78. };
  79. //console.log("TEST : " + JSON.stringify(param));
  80. self.medical.getMediRecordFormList(param, processSearchMediRecordFormList);
  81. }
  82. };
  83. var processSearchMediRecordList = function(lists){
  84. //console.log(JSON.stringify(lists));
  85. varResultLists = lists;
  86. var strDisplayTemp = "";
  87. $("#divMedicalRecordRows").empty();
  88. for( var i = 0; i < lists.length; i++){
  89. var medicalRecordColor = "";
  90. if(lists[i].medicalRecordSubTitle != null && lists[i].medicalRecordSubTitle != "-"){
  91. medicalRecordColor = "color:#C86400;";
  92. }
  93. strDisplayTemp += "<div class=\"row list-group-item\" rowNo=\"" + i + "\" medicalRecordSeq=\"" + lists[i].medicalRecordSeq + "\" style=\"overflow: hidden; padding-left: 0px; padding-right: 0px;\">"
  94. + " <div class=\"col-xs-12 col-sm-6 col-lg-6\">"
  95. + " <div class=\"col-xs-3 col-sm-3 col-lg-3 text-center\" style=\"padding: 0px;\">" + ((moment(lists[i].medicalRecordDt).format("YYYY-MM-DD") != "Invalid date") ? moment(lists[i].medicalRecordDt).format("YYYY-MM-DD") : "-") + "</div>"
  96. + " <div class=\"col-xs-4 col-sm-3 col-lg-3 text-center\" style=\"padding: 0px; "+medicalRecordColor+" \">" + lists[i].medicalRecordFormNm + "</div>"
  97. + " <div class=\"col-xs-3 col-sm-3 col-lg-3 text-center\" style=\"padding: 0px; "+medicalRecordColor+" \">" + lists[i].medicalRecordSubTitle + "</div>"
  98. + " <div class=\"col-xs-2 col-sm-3 col-lg-3 text-center\" style=\"padding: 0px;\">" + lists[i].lastWriter + "</div>"
  99. + " </div>"
  100. + "</div>"
  101. ;
  102. //console.log( i + " : " + lists[i].deptNm);
  103. }
  104. $("#divMedicalRecordRows").append(strDisplayTemp); // element 추가
  105. addEventSearchMediRecord(); // row click event 추가
  106. };
  107. var processSearchMediRecordFormList = function(lists){
  108. //console.log(JSON.stringify(lists));
  109. varResultLists = lists;
  110. var strDisplayTemp = "";
  111. $("#divMedicalRecordRows").empty();
  112. for( var i = 0; i < lists.length; i++){
  113. strDisplayTemp += "<div class=\"row list-group-item\" rowNo=\"" + i + "\" medicalRecordFormCd=\"" + lists[i].medicalRecordFormCd + "\" style=\"overflow: hidden; padding-left: 0px; padding-right: 0px;\">"
  114. + " <div class=\"col-xs-12 col-sm-6 col-lg-6\">"
  115. + " <div class=\"col-xs-12 col-sm-3 col-lg-3 text-center\" style=\"padding: 0px;\">" + lists[i].medicalRecordFormNm + "</div>"
  116. + " </div>"
  117. + "</div>"
  118. ;
  119. //console.log( i + " : " + lists[i].deptNm);
  120. }
  121. $("#divMedicalRecordRows").append(strDisplayTemp); // element 추가
  122. addEventSearchMediRecord(); // row click event 추가
  123. };
  124. var addEventSearchMediRecord = function() {
  125. $("#divMedicalRecordRows .list-group-item").off("click"); // 기존 이벤트 해제
  126. $("#divMedicalRecordRows .list-group-item").on("click", function(e){
  127. //진료기록 조회 리스트 검색 처리
  128. var varMedicalRecordrowNo = "";
  129. var varMedicalRecordSeq = "";
  130. var varMedicalRecordFormCd = "";
  131. if(e.currentTarget.attributes.rowNo !== undefined){
  132. varMedicalRecordrowNo = e.currentTarget.attributes.rowNo.value;
  133. }
  134. if(e.currentTarget.attributes.medicalRecordSeq !== undefined){
  135. varMedicalRecordSeq = e.currentTarget.attributes.medicalRecordSeq.value;
  136. }
  137. if(e.currentTarget.attributes.medicalRecordFormCd !== undefined){
  138. varMedicalRecordFormCd = e.currentTarget.attributes.medicalRecordFormCd.value;
  139. }
  140. /* 2019 03 11 iSO일 경우 alert후 return */
  141. /*
  142. if(gLoginUserId == "29990030"){
  143. }else if(self.isIos()){
  144. //console.log("iOS입니다.");
  145. self.alert("iOS에서 본 기능은 서비스 개발중입니다.");
  146. return;
  147. }else{//안드로이드일때 처리
  148. }*/
  149. if($("#sltMedicalRecordListSearch").val() == 1 && varMedicalRecordSeq != ""){//기록목록조회
  150. /*
  151. var initParam = {
  152. medicalRecordFormNm:varResultLists[varMedicalRecordrowNo].medicalRecordFormNm,
  153. userId:gLoginUserId,
  154. patientId:gPatientId,
  155. deptCd:gPatientDeptCd,
  156. searchCls:gPatientTreatCls,
  157. medicalRecordSeq:varMedicalRecordSeq
  158. };
  159. //$("#modalMedicalRecordRslt").modal("show");
  160. //mplusModalMedicalrecorddetail.initList(initParam);
  161. */
  162. //진료 기록 상세 조회
  163. var sendParam = {
  164. userId:gLoginUserId,
  165. patientId:gPatientId,
  166. deptCd:gPatientDeptCd,
  167. searchCls:gPatientTreatCls,
  168. medicalRecordSeq:varMedicalRecordSeq
  169. };
  170. //console.log(JSON.stringify(sendParam));
  171. self.medical.getMediRecordDetail(sendParam, processMedicalRecordResult);
  172. }else if($("#sltMedicalRecordListSearch").val() == 2 && varMedicalRecordFormCd != ""){//기록내용조회
  173. /*
  174. var initParam = {
  175. medicalRecordFormNm:varResultLists[varMedicalRecordrowNo].medicalRecordFormNm,
  176. userId:gLoginUserId,
  177. patientId:gPatientId,
  178. deptCd:gPatientDeptCd,
  179. startDt: moment($("#txtMedicalRecordStartDt").val()).format("YYYYMMDD"),
  180. endDt: moment($("#txtMedicalRecordEndDt").val()).format("YYYYMMDD"),
  181. personalRecordYn:($("#chkMedicalRecordSelfList").prop("checked") == true ? "Y" : "N" ),
  182. medicalRecordFormCd:varMedicalRecordFormCd,
  183. searchCls:gPatientTreatCls
  184. };
  185. //$("#modalMedicalRecordRslt").modal("show");
  186. //mplusModalMedicalrecorddetail.initContents(initParam);
  187. */
  188. //진료 기록 내용 상세 조회
  189. var sendParam = {
  190. userId:gLoginUserId,
  191. patientId:gPatientId,
  192. deptCd:gPatientDeptCd,
  193. startDt:moment($("#txtMedicalRecordStartDt").val()).format("YYYYMMDD"),
  194. endDt:moment($("#txtMedicalRecordEndDt").val()).format("YYYYMMDD"),
  195. personalRecordYn:($("#chkMedicalRecordSelfList").prop("checked") == true ? "Y" : "N" ),
  196. medicalRecordFormCd:varMedicalRecordFormCd,
  197. searchCls:gPatientTreatCls
  198. };
  199. //console.log(JSON.stringify(sendParam));
  200. self.medical.getMediRecordContentDetail(sendParam, processMedicalRecordResult);
  201. }else{
  202. self.alert("데이터 오류입니다. 관리자에게 문의하세요.");
  203. return;
  204. }
  205. });
  206. };
  207. var processMedicalRecordResult = function(lists){
  208. if(lists[0].url != null && lists !== undefined){
  209. //$("#divMedicalRecordResult").append(lists[0].url); // element 추가
  210. var jsonMsg = {
  211. "type":"command",
  212. "functionType":"popup",
  213. "value" : {
  214. "url" : lists[0].url,
  215. "method": "GET", // Default "GET" ** 2017-10-19 추가
  216. "parameters": "-" // POST 인 경우만, GET 인 경우는 "url" 에 모두 붙여서 전달 ** 2017-10-19 추가
  217. }
  218. };
  219. self.toNative(jsonMsg);
  220. }else{
  221. self.alert("데이터 오류입니다. 관리자에게 문의하세요.");
  222. }
  223. };
  224. var initStartEndDate = function(){
  225. //오늘일자 로드
  226. var varToday = new Date();
  227. //일요일이면 차주 가져오기
  228. //다른 요일이면 해당 요일 처리
  229. $("#txtMedicalRecordEndDt").val( moment(varToday).format("YYYY-MM-DD") );
  230. varToday.setDate(varToday.getDate() - 6);
  231. $("#txtMedicalRecordStartDt").val( moment(varToday).format("YYYY-MM-DD") );
  232. };
  233. //==== 초기화 설정 } ====
  234. //==== 이벤트 설정 { ====
  235. var addEvent = function(){
  236. //$("#btnLogout").on("click", function(){
  237. // logout();
  238. //});
  239. eventColumnClick();
  240. eventRowClick();
  241. eventConditionClick();
  242. };
  243. var eventConditionClick = function(){
  244. // 1주 버튼클릭
  245. $("#btnMedicalRecordOneWeekSearch").off('click'); // 기존 이벤트 해제
  246. $("#btnMedicalRecordOneWeekSearch").on('click', function(e){
  247. var varSelDate = new Date($("#txtMedicalRecordEndDt").val());
  248. varSelDate.setDate(varSelDate.getDate() - 6);
  249. $("#txtMedicalRecordStartDt").val( moment(varSelDate).format("YYYY-MM-DD") );
  250. });
  251. // 1달 버튼클릭
  252. $("#btnMedicalRecordOneMonthSearch").off('click'); // 기존 이벤트 해제
  253. $("#btnMedicalRecordOneMonthSearch").on('click', function(e){
  254. var varSelDate = new Date($("#txtMedicalRecordEndDt").val());
  255. varSelDate.setDate(varSelDate.getDate() - 1);
  256. varSelDate.setMonth(varSelDate.getMonth() - 1);
  257. $("#txtMedicalRecordStartDt").val( moment(varSelDate).format("YYYY-MM-DD") );
  258. });
  259. // 3달 버튼클릭
  260. $("#btnMedicalRecordThreeMonthSearch").off('click'); // 기존 이벤트 해제
  261. $("#btnMedicalRecordThreeMonthSearch").on('click', function(e){
  262. var varSelDate = new Date($("#txtMedicalRecordEndDt").val());
  263. varSelDate.setDate(varSelDate.getDate() - 1);
  264. varSelDate.setMonth(varSelDate.getMonth() - 3);
  265. $("#txtMedicalRecordStartDt").val( moment(varSelDate).format("YYYY-MM-DD") );
  266. });
  267. // 조회버튼
  268. $("#btnMedicalRecordSearch").off('click'); // 기존 이벤트 해제
  269. $("#btnMedicalRecordSearch").on('click', function(e){
  270. //로우 초기화
  271. $("#divMedicalRecordRows").empty();
  272. searchMedicalRecord();
  273. });
  274. $("#sltMedicalRecordListSearch").off("change");
  275. $("#sltMedicalRecordListSearch").on("change", function(){
  276. var strDisplayTemp = "";
  277. //header변경
  278. if($("#sltMedicalRecordListSearch").val() == 1){//기록목록조회
  279. $("#divMedicalRecordListResultHeader").empty();
  280. strDisplayTemp = "<div class=\"chart-title well\">"
  281. + "<div class=\"row\">"
  282. + " <div class=\"col-xs-3 text-center\" style=\"padding: 4px 0px;\">"
  283. + " <p>접수일</p>"
  284. + " </div>"
  285. + " <div class=\"col-xs-4 text-center\" style=\"padding: 4px 0px;\">"
  286. + " <p>서식명</p>"
  287. + " </div>"
  288. + " <div class=\"col-xs-3 text-center\" style=\"padding: 4px 0px;\">"
  289. + " <p>부제목</p>"
  290. + " </div>"
  291. + " <div class=\"col-xs-2 text-center\" style=\"padding: 4px 0px;\">"
  292. + " <p>최종작성</p>"
  293. + " </div>"
  294. + "</div>"
  295. + "</div>"
  296. ;
  297. }else if($("#sltMedicalRecordListSearch").val() == 2){//기록내용조회
  298. $("#divMedicalRecordListResultHeader").empty();
  299. strDisplayTemp = "<div class=\"chart-title well\">"
  300. + "<div class=\"row\">"
  301. + " <div class=\"col-xs-12 text-center\" style=\"padding: 4px 0px;\">"
  302. + " <p>해당기간 기록내용조회 선택</p>"
  303. + " </div>"
  304. + " </div>"
  305. + "</div>"
  306. ;
  307. }
  308. $("#divMedicalRecordListResultHeader").append(strDisplayTemp);
  309. searchMedicalRecord();
  310. });
  311. };
  312. var eventColumnClick = function(){
  313. };
  314. var eventRowClick = function(){
  315. };
  316. //==== 이벤트 설정 } ====
  317. //==== 서비스 실행 { ====
  318. //==== 서비스 실행 { ====
  319. };