patientinfo.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  1. "use strict";
  2. /**
  3. * mplus_modal_patientinfo
  4. */
  5. var mplus_modal_patientinfo = 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. var varDeptCd = ""; // 진료과 코드
  16. var varDeptNm = ""; // 진료과 명
  17. var varDoctorId = ""; // 의사 ID
  18. var varDoctorNm = ""; // 의사명
  19. //==== 변수 } ====
  20. /**
  21. * 초기화
  22. */
  23. this.init = function(){ //여기서 모든화면 콤보박스데이터를 집어넣자!!! 그래야지 화면이동할때 속도가 오래걸리지않음!!!
  24. // 접근 권한 체크
  25. checkAccessPermission();
  26. // 초기 화면 조건 구성
  27. initCondition();
  28. // 이벤트 초기화
  29. addEvent();
  30. // 환자 정보 화면 출력
  31. getPatientInfo();
  32. };
  33. //==== 접근 권한 체크 { ====
  34. var checkAccessPermission = function(){
  35. /* if( !self.common.checkAccessJobKind( "1000")){
  36. self.alertTrue("접근 권한이 없습니다.", function(){ $("#modalPatientInfo").modal("hide")});
  37. }
  38. if( !self.common.checkAccessUserAuth( "01")){
  39. self.alertTrue("접근 권한이 없습니다.", function(){ $("#modalPatientInfo").modal("hide");});
  40. }
  41. if( !self.common.checkAccessJobKind( "1000")){
  42. self.common.disableElements( $("#myModalBtn"));
  43. } else{
  44. self.common.enableElements( $("#myModalBtn"));
  45. }
  46. self.common.disableElements( $("#btnCollaborationDetail"));
  47. self.common.disableElements( $("#btnInternWorkSchDetail"));*/
  48. checkAccessRights();
  49. };
  50. //==== 접근 권한 체크 } ====
  51. //==== 초기화 설정 { ====
  52. var initCondition = function(){
  53. // 초기 화면 조건 구성
  54. };
  55. //==== 초기화 설정 } ====
  56. //==== 이벤트 설정 { ====
  57. var addEvent = function(){
  58. eventPatientInfoClick();
  59. };
  60. var eventPatientInfoClick = function(){
  61. $("#btnPatientInfoMedicalHistory").off("click");
  62. $("#btnPatientInfoMedicalHistory").on("click", function(){
  63. $("#modalMedicalHistory").modal("show");
  64. mplusModalMedicalhistory.init();
  65. });
  66. $("#btnPatientInfoMedicalRecord").off("click");
  67. $("#btnPatientInfoMedicalRecord").on("click", function(){
  68. $("#modalMedicalRecord").modal("show");
  69. mplusModalMedicalrecord.init();
  70. });
  71. $("#btnPrescriptionPrescription").off("click");
  72. $("#btnPrescriptionPrescription").on("click", function(){
  73. $("#modalPrescription").modal("show");
  74. mplusModalPrescription.init();
  75. });
  76. $("#btnPatientInfoExamList").off("click");
  77. $("#btnPatientInfoExamList").on("click", function(){
  78. $("#modalExamList").modal("show");
  79. mplusModalExamlist.init();
  80. });
  81. $("#btnPatientInfoOperation").off("click");
  82. $("#btnPatientInfoOperation").on("click", function(){
  83. $("#modalOperationDetail").modal("show");
  84. mplusModalOperationdetail.init();
  85. });
  86. $("#btnPatientInfoTreatment").off("click");
  87. $("#btnPatientInfoTreatment").on("click", function(){
  88. $("#modalTreatmentDetail").modal("show");
  89. mplusModalTreatmentdetail.init();
  90. });
  91. $("#btnVitalList").off("click");
  92. $("#btnVitalList").on("click", function(){
  93. $("#modalVitalList").modal("show");
  94. mplusModalVitallist.init();
  95. });
  96. $("#btMedicationList").off("click");
  97. $("#btMedicationList").on("click", function(){
  98. $("#modalMedicationList").modal("show");
  99. mplusModalMedicationlist.init();
  100. });
  101. $("#btnPatientInfoCollaboration").off("click");
  102. $("#btnPatientInfoCollaboration").on("click", function(){
  103. $("#modalCollaborationDetail").modal("show");
  104. mplusModalCollaborationdetail.init();
  105. });
  106. // 20190228 shinsunwoo 환부 이미지 촬영 버튼 클릭
  107. $("#btnWoundImg").off("click");
  108. $("#btnWoundImg").on("click", function(){
  109. readPicture();
  110. });
  111. };
  112. //==== 이벤트 설정 } ====
  113. //==== 서비스 실행 { ====
  114. var checkAccessRights = function(){
  115. var param = {
  116. userId: gLoginUserId,
  117. patientId: gPatientId,
  118. accessCd : "00"
  119. };
  120. self.medical.checkAccessRights(param, processCheckAccessRights);
  121. };
  122. var processCheckAccessRights = function(lists){
  123. if( lists.length == 1){
  124. if( lists[0].isAllowed == "0"){
  125. // 환자 정보 화면을 종료함
  126. self.alertTrue( "환자 정보 접근 권한이 없습니다, " + lists[0].rejectedMsg, function(){$("#modalPatientInfo").modal("hide");});
  127. }
  128. } else {
  129. // 환자 정보 화면을 종료함
  130. self.alertTrue( "환자 정보 접근 권한이 없습니다.", function(){$("#modalPatientInfo").modal("hide");});
  131. }
  132. };
  133. var getPatientInfo = function(){
  134. var param = {
  135. userId: gLoginUserId,
  136. patientId: gPatientId,
  137. receiptNo: gPatientReceiptNo,
  138. treatCls: gPatientTreatCls
  139. };
  140. self.medical.getPatientInfo(param, processGetPatientInfo);
  141. };
  142. var processGetPatientInfo = function(lists){
  143. // 1. 환자 정보 조회 결과를 varResultLists로 복사
  144. varResultLists = lists;
  145. // 3. 환자 정보 결과를 화면에 disaplay
  146. drawPatientInfo();
  147. // 4. 글로벌 변수 처리
  148. if(lists[0].hospitalizationDt != undefined && lists[0].hospitalizationDt != "" && lists[0].hospitalizationDt != null){
  149. self.common.setHospitalizationDt(lists[0].hospitalizationDt);
  150. }
  151. };
  152. // 환자 정보 화면에 그리기
  153. var drawPatientInfo = function(){
  154. var lists = varResultLists;
  155. var strDisplayTemp = "";
  156. $("#divPatientInfoResult").empty();
  157. //2019.03.12. 진료기록 29990030 오픈
  158. //var tempMedirecordCSS = "control-disabled";
  159. for( var i = 0; i < lists.length; i++){
  160. // strDisplayTemp += "<hr>"
  161. // + "<div>"
  162. // + " <p>"
  163. // + " <label>생년월일:</label><span>" + lists[i].birthDt + "</span>"
  164. // + " <label>전화번호:</label>" + lists[i].cellphoneNo + "<span></span><a href=\"tel:" + lists[i].cellphoneNo + "\">[전화걸기]</a><a href=\"sms:" + lists[i].cellphoneNo + "\">[문자 보내기]</a>"
  165. // + " </p>"
  166. // + " <p>"
  167. // + " <label>내원구분:</label><span>" + self.common.displayTreatCls( gPatientTreatCls) + "</span>"
  168. // + " <label>병동/병상:</label><span>" + lists[i].wardNm + " / " + lists[i].roomNm + "</span>"
  169. // + " </p>"
  170. // + " <p>"
  171. // + " <label>진료의:</label><span>" + lists[i].doctorNm + "</span>"
  172. // + " <label>주치의:</label><span>" + lists[i].specialistNm + "</span>"
  173. // + " </p>"
  174. // + " <p>"
  175. // + " <label>주진단명:</label><span>" + lists[i].diagnosisNm + "</span>"
  176. // + " </p>"
  177. // + " <p>"
  178. // + " <label>수술일/주수술명:</label><span>" + lists[i].operationDt + " / " + lists[i].operationNm + "</span>"
  179. // + " </p>"
  180. // + "</div>"
  181. // + "<hr>"
  182. // + "<div>"
  183. // + " <button type=\"button\" class=\"btn btn-info\" id=\"btnPatientInfoMedicalHistory\">과거이력</button>"
  184. // + " <button type=\"button\" class=\"btn btn-info\" id=\"btnPatientInfoMedicalRecord\">진료기록</button>"
  185. // + " <button type=\"button\" class=\"btn btn-info\" id=\"btnPrescriptionPrescription\">처방조회</button>"
  186. // + " <button type=\"button\" class=\"btn btn-info\" id=\"btnPatientInfoExamList\">검사결과</button>"
  187. // + " <button type=\"button\" class=\"btn btn-info\" id=\"btnPatientInfoCollaboration\">협진내역</button>"
  188. // + " <button type=\"button\" class=\"btn btn-info\" id=\"btnPatientInfoOperation\">수술내역</button>"
  189. // + " <button type=\"button\" class=\"btn btn-info\" id=\"btnPatientInfoTreatment\">시술내역</button>"
  190. // + "</div>"
  191. // + "<hr> "
  192. // + "<div>"
  193. // + " <button type=\"button\" class=\"btn btn-info\" id=\"btnPatientInfoWoundPicture\">환부이미지관리</button>"
  194. // + "</div>"
  195. // + "<hr> "
  196. // + "<div>"
  197. // + " <label>Notice:</label>"
  198. // + " <textarea class=\"form-control\" rows=\"5\" id=\"areaPatientInfoNoticeTxt\"></textarea>"
  199. // + "</div>"
  200. // ;
  201. var tmpIsExamResult = lists[i].isExamResult == "1" ? " on" : "";
  202. var tmpIsCollaboration = lists[i].isCollaboration == "1" ? " on" : "";
  203. var tmpIsOperation = lists[i].isOperation == "1" ? " on" : "";
  204. var tmpIsTreatment = lists[i].isTreatment == "1" ? " on" : "";
  205. var tmpoperationDt = (moment(lists[i].operationDt).format("YYYY-MM-DD HH:mm") != "Invalid date") ? moment(lists[i].operationDt).format("YYYY-MM-DD HH:mm") : "-";
  206. strDisplayTemp += "<div class=\"chart-view-top\">"
  207. + " <div class=\"row\">"
  208. + " <div class=\"col-xs-12\">"
  209. + " <p class=\"patient-name\">" + lists[i].patientNm + " (" + lists[i].patientId + ")</p>"
  210. + " <p class=\"patient-info\">"
  211. + " <span></span><span><a href=\"sms:" + lists[i].cellphoneNo + "\" class=\"sms\"><i>문자</i></a> <a href=\"tel:" + lists[i].cellphoneNo + "\" class=\"tel\"><i>전화</i></a></span>"
  212. + " </p>"
  213. + " </div>"
  214. + " </div>"
  215. + " <div class=\"row\">"
  216. + " <div class=\"col-xs-6\">"
  217. + " <p class=\"patient-info\">"
  218. + " <span>나이/성별</span> <span>" + lists[i].age + "/" + lists[i].gender + "</span>"
  219. + " </p>"
  220. + " </div>"
  221. + " <div class=\"col-xs-6\">"
  222. + " <p class=\"patient-info\">"
  223. + " <span>진료</span> <span>" + self.common.displayTreatCls( gPatientTreatCls) + "</span>"
  224. + " </p>"
  225. + " </div>"
  226. + " </div>"
  227. + " <div class=\"row\">"
  228. + " <div class=\"col-xs-12\">"
  229. + " <p class=\"patient-info\">"
  230. + " <span>진료과</span> <span>" + lists[i].deptNm + "</span>"
  231. + " </p>"
  232. + " </div>"
  233. + " </div>"
  234. + " <div class=\"row\">"
  235. + " <div class=\"col-xs-12\">"
  236. + " <p class=\"patient-info\">"
  237. + " <span>담당의 / 주치의</span>"
  238. + " <span>"
  239. + lists[i].doctorNm + "<a href=\"sms:" + lists[i].doctorCellphoneNo + "\" class=\"smssub\"><i>문자</i></a> <a href=\"tel:" + lists[i].doctorCellphoneNo + "\" class=\"telsub\"><i>전화</i></a>"
  240. + " / " + lists[i].specialistNm + "<a href=\"sms:" + lists[i].specialistCellphoneNo + "\" class=\"smssub\" style=\"margin-left: 5px;\"><i>문자</i></a> <a href=\"tel:" + lists[i].specialistCellphoneNo + "\" class=\"telsub\"><i>전화</i></a>"
  241. + " </span>"
  242. + " </p>"
  243. + " </div>"
  244. + " </div>"
  245. + " <div class=\"row description\">"
  246. + " <div class=\"col-xs-12\">"
  247. + " <p class=\"patient-info\">"
  248. + " <span>주진단명</span> <span class=\"description\">" + lists[i].diagnosisNm + "</span>"
  249. + " </p>"
  250. + " </div>"
  251. + " </div>"
  252. + " <div class=\"row description\">"
  253. + " <div class=\"col-xs-12\">"
  254. + " <p class=\"patient-info\">"
  255. + " <span>수술일 /주 수술 명</span> <span class=\"description\">" + tmpoperationDt+ " / " + lists[i].operationNm + "</span>"
  256. + " </p>"
  257. + " </div>"
  258. + " </div>"
  259. + "</div>"
  260. + "<!-- /chart-view-top -->"
  261. + "<div class=\"chart-view-item \">"
  262. + " <div class=\"row\">"
  263. + " <div class=\"col-xs-12\">"
  264. + " <p class=\"view-item-title\">"
  265. + " <i class=\"icon-patient01\"></i> <span>진료정보</span>"
  266. + " </p>"
  267. + " </div>"
  268. + " </div>"
  269. + " <div class=\"row\">"
  270. + " <div class=\"col-xs-4\" style=\"padding-left: 5px; padding-right: 5px;\">"
  271. + " <button type=\"button\" name=\"treatmentBtn\" class=\"btn\" id=\"btnPatientInfoMedicalHistory\">진료이력</button>"
  272. + " </div>"
  273. + " <div class=\"col-xs-4\" style=\"padding-left: 5px; padding-right: 5px;\">"
  274. + " <button type=\"button\" name=\"treatmentBtn\" class=\"btn\" id=\"btnPrescriptionPrescription\">처방조회</button>"
  275. + " </div>"
  276. // + " <div class=\"col-xs-4\" style=\"padding-left: 5px; padding-right: 5px;\">"
  277. // + " <button type=\"button\" name=\"treatmentBtn\" class=\"btn\" id=\"btnPatientInfoMedicalRecord\">진료기록</button>"
  278. // + " </div>"
  279. + " <div class=\"col-xs-4\" style=\"padding-left: 5px; padding-right: 5px;\">"
  280. + " <button type=\"button\" name=\"treatmentBtn\" class=\"btn " + tmpIsExamResult + "\" id=\"btnPatientInfoExamList\">검사결과</button>"
  281. + " </div>"
  282. + " </div>"
  283. + " <div class=\"row \">"
  284. + " <div class=\"col-xs-4\" style=\"padding-left: 5px; padding-right: 5px;\">"
  285. + " <button type=\"button\" name=\"treatmentBtn\" class=\"btn " + tmpIsOperation + "\" id=\"btnPatientInfoOperation\">수술내역</button>"
  286. + " </div>"
  287. + " <div class=\"col-xs-4\" style=\"padding-left: 5px; padding-right: 5px;\">"
  288. + " <button type=\"button\" name=\"treatmentBtn\" class=\"btn " + tmpIsCollaboration + "\" id=\"btnPatientInfoCollaboration\">협진내역</button>"
  289. + " </div>"
  290. + " <div class=\"col-xs-4\" style=\"padding-left: 5px; padding-right: 5px;\">"
  291. + " <button type=\"button\" name=\"treatmentBtn\" class=\"btn " + tmpIsTreatment + "\" id=\"btnPatientInfoTreatment\">시술내역</button>"
  292. + " </div>"
  293. + " </div>"
  294. //20190528 dkchoi75 백병원 별 환자정보_서비스 메뉴 미노출 처리
  295. // if (gClientIp == "14.40.0.113" || gClientIp == "14.40.4.137" || gClientIp == "100.100.251.251" || gClientIp == "10.10.10.36" || gClientIp == "127.0.0.1") {
  296. // console.log(gClientIp);
  297. + " <div class=\"row \">"
  298. + " <div class=\"col-xs-4\" style=\"padding-left: 5px; padding-right: 5px;\">"
  299. + " <button type=\"button\" name=\"treatmentBtn\" class=\"btn\" id=\"btnVitalList\">임상관찰</button>"
  300. + " </div>"
  301. + " <div class=\"col-xs-4\" style=\"padding-left: 5px; padding-right: 5px;\">"
  302. + " <button type=\"button\" name=\"treatmentBtn\" class=\"btn\" id=\"btMedicationList\">투약조회</button>"
  303. + " </div>"
  304. + " </div>"
  305. // }
  306. // + " <div class=\"row \">"
  307. // + " <div class=\"col-xs-4\">"
  308. // + " <button type=\"button\" name=\"treatmentBtn\" class=\"btn col-xs-4 control-disabled\">임상관찰조회</button>"
  309. // + " </div>"
  310. // + " <div class=\"col-xs-4 px-0\">"
  311. // + " <button type=\"button\" name=\"treatmentBtn\" class=\"btn col-xs-4 control-disabled\">투약정보</button>"
  312. // + " </div>"
  313. // + " <div class=\"col-xs-4\">"
  314. // + " <button type=\"button\" name=\"treatmentBtn\" class=\"btn col-xs-4 control-disabled\">환부 이미지 조회</button>"
  315. // + " </div>"
  316. // + " </div>"
  317. // + "</div>"
  318. // + "<div class=\"chart-view-item \">"
  319. // + " <div class=\"row \">"
  320. // + " <div class=\"col-xs-12\">"
  321. // + " <p class=\"view-item-title\">"
  322. // + " <i class=\"icon-patient02\"></i><span>조치</span>"
  323. // + " </p>"
  324. // + " </div>"
  325. // + " </div>"
  326. // + " <div class=\"row \">"
  327. // + " <div class=\"col-xs-4\">"
  328. // + " <button type=\"button\" name=\"treatmentBtn\" class=\"btn icon-btn camera-icon control-disabled\" id=\"btnWoundImg\">환부 촬영</button>"
  329. // + " </div>"
  330. // + " <div class=\"col-xs-4 px-0\">"
  331. // + " <button type=\"button\" name=\"treatmentBtn\" class=\"btn icon-btn eye-icon control-disabled\">임상 관찰</button>"
  332. // + " </div>"
  333. // + " <div class=\"col-xs-4 \">"
  334. // + " <button type=\"button\" name=\"treatmentBtn\" class=\"btn icon-btn medicine-icon control-disabled\">투약 실시</button>"
  335. // + " </div>"
  336. // + " </div>"
  337. // + "</div>"
  338. // + "<div class=\"chart-notice\">"
  339. // + " <div class=\"row \">"
  340. // + " <div class=\"col-sm-12\">"
  341. // + " <p class=\"notice\">2018-12-12, 홍길동</p>"
  342. // + " </div>"
  343. // + " <div class=\"col-sm-12\">"
  344. // + " <p class=\"text\">환자가 알약 투약이 어려우니 처방된 약을 분말로...</p>"
  345. // + " </div>"
  346. // + " </div>"
  347. // + "</div>"
  348. ;
  349. // 20190228 shinsunwoo 환부촬영 이미지에서 사용할 변수에 값을 할당
  350. varDeptCd = lists[i].deptCd; // 진료과 코드
  351. varDeptNm = lists[i].deptNm; // 진료과 명
  352. varDoctorId = lists[i].doctorId; // 의사 ID
  353. varDoctorNm = lists[i].doctorNm; // 의사명
  354. }
  355. $("#divPatientInfoResult").append(strDisplayTemp); // element 추가
  356. eventPatientInfoClick(); // 클릭 이벤트 처리
  357. // notice 를 추가해줌
  358. getPatientNotice();
  359. }
  360. // notice를 조회
  361. var getPatientNotice = function(){
  362. var param = {
  363. userId: gLoginUserId,
  364. patientId: gPatientId
  365. };
  366. self.medical.getPatientNotice(param, processGetPatientNotice);
  367. };
  368. // notice 처리
  369. var processGetPatientNotice = function(lists){
  370. var strDisplayTemp = "";
  371. if( lists.length < 0){
  372. return;
  373. }
  374. // 초기 notice div element 추가
  375. strDisplayTemp = "<div class=\"chart-notice\"></div>";
  376. $("#divPatientInfoResult").append(strDisplayTemp); // element 추가
  377. strDisplayTemp = "";
  378. //$(".chart-notice").empty();
  379. for( var i = 0; i < lists.length; i++){
  380. //strDisplayTemp += lists[i].noticeTxt + " , " + lists[i].noticeWriter + " , " + lists[i].writeDtTM + "\n";
  381. strDisplayTemp += "<div class=\"row\">"
  382. + " <div class=\"col-sm-12\">"
  383. + " <p class=\"notice\">" + lists[i].writeDtTm + ", " + lists[i].noticeWriter + "</p>"
  384. + " </div>"
  385. + " <div class=\"col-sm-12\">"
  386. + " <p class=\"text\">" + lists[i].noticeTxt + "</p>"
  387. + " </div>"
  388. + "</div>"
  389. ;
  390. }
  391. $(".chart-notice").html(strDisplayTemp);
  392. };
  393. //==== 서비스 실행 } ====
  394. // 20190228 shinsunwoo 환자의 환부이미지 추출 toNative 호출
  395. var readPicture = function( param_deptNm, param_doctorNm){
  396. console.log('call readPicture');
  397. var serviceUrl = contextPath + "/mobile/medical/inputWoundImg.json";
  398. var msg = {
  399. type : "command",
  400. functionType : "readPicture",
  401. value : {
  402. hospitalCD : "01",
  403. userId: gLoginUserId,
  404. patientId: gPatientId,
  405. patientNm: gPatientNm,
  406. age: gPatientAge,
  407. gender: gPatientGender,
  408. deptCd: varDeptCd,
  409. deptNm: varDeptNm,
  410. doctorId: varDoctorId,
  411. doctorNm : varDoctorNm,
  412. treatCls: gPatientTreatCls,
  413. serviceUrl: serviceUrl,
  414. callbackFn : "window.activeObj.readBarcodeCallBack"
  415. }
  416. };
  417. self.toNative( msg );
  418. };
  419. // 20190228 shinsunwoo 환자의 바코드 추출 callback 처리
  420. this.readPictureCallBack = function( returnCode){
  421. var results = new Object();
  422. if( typeof returnCode === "string" ){
  423. results = self.util.parseJson( returnCode );
  424. } else {
  425. results = returnCode;
  426. }
  427. if( results.success != undefined && results.success == "true" ) {
  428. console.log("readPicture : success");
  429. console.log( results.result);
  430. } else {
  431. console.log("readPicture : failed");
  432. self.alert( "readPicture APP function 호출 오류 " );
  433. }
  434. };
  435. };