SMMRI08000.js 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148
  1. /*
  2. - ▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩
  3. 열람신청 및 내역조회 ( SMMRI08000_의무기록열람신청및조회.xrw - JScript )
  4. - ▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩
  5. */
  6. /**
  7. * @desc : 화면 초기화
  8. * @
  9. * @param :
  10. * @return :
  11. * @author : 2010.08.16 주희경
  12. * @---------------------------------------------------
  13. */
  14. function fInitialize()
  15. {
  16. //mmbfGetDeptCodeComboList("/root/send/reqdata", "/root/init/orddept", "A"); //진료과 콤보 조회
  17. // 열람신청 부서 가져오기(20120204 이윤주)
  18. submit("TRMRI08109");
  19. //mmbfGetUserComboList("/root/send/reqdata", "/root/init/userlist", getUserInfo("dutplcecd"), "0330");//사용자 콤보 조회
  20. mmbfGetUserComboList("/root/send/reqdata", "/root/init/userlist", getUserInfo("dutplcecd"));//사용자 콤보 조회
  21. addComboInstance("/root/init/userlist" , "userid^usernm" , "-^전체", "usercombo"); //의사콤보 전체항목 추가
  22. fGetRsnsrch(); //열람목적, 통합기록조회 제한차트 사유 기준자료 테이블 조회
  23. fGetPopupDeptList(); //접근 제한 부서 영문명 조회
  24. //특정사용자만(원무팀 산재 담당, 진료행정팀 특정사용자) 출력신청기능 오픈(20120130 이윤주)
  25. model.removenode("/root/hidden/prntuser");
  26. mmbfGetHardCodeInfo("/root/send/reqdata", "/root/hidden/prntuser", 5565);
  27. var userid = getUserInfo("userid");
  28. var nodeCnt = getNodesetCount("/root/hidden/prntuser/hardcd");
  29. var chkcnt = 0;
  30. for( var i = 1; i <= nodeCnt ; i++ ){
  31. if( model.getValue("/root/hidden/prntuser/hardcd["+ i + "]/hardcd") == userid ){
  32. chkcnt++;
  33. }
  34. }
  35. if (chkcnt > 0)
  36. grd_apppatlist.colHidden(grd_apppatlist.colRef("prntstatus")) = false;
  37. else
  38. grd_apppatlist.colHidden(grd_apppatlist.colRef("prntstatus")) = true;
  39. model.setValue("/root/send/cond/appdeptcd", getUserInfo("dutplcecd"));
  40. model.setValue("/root/send/cond/appid" , getUserInfo("userid"));
  41. //btn_readapp.dispatch("DOMActivate");
  42. fResetData("appfromdd");
  43. btn_new.dispatch("DOMActivate");
  44. grd_apppatlist.frozenCols = grd_apppatlist.colRef("orddeptnm");
  45. // if (typeof(opener) != "undefined")
  46. // {
  47. // //열람신청화면으으로 데이터 넘기기
  48. // var pid = opener.window.javascript.getParameter("SMMRI08000_param_pid");
  49. // var pnm = opener.window.javascript.getParameter("SMMRI08000_param_pnm");
  50. // model.setValue("/root/excel/patinfo/pid",pid);
  51. // model.setValue("/root/excel/patinfo/pnm",pnm);
  52. // fLoadfromExcel(2);
  53. // }
  54. model.refresh();
  55. }
  56. /**
  57. * @desc : //[열람목적리스트] 통합기록조회 제한차트 사유 기준자료 테이블 조회
  58. * @
  59. * @param :
  60. * @return :
  61. * @author : 2010.08.16 주희경
  62. * @---------------------------------------------------
  63. */
  64. function fGetRsnsrch()
  65. {
  66. var sUserDeptcd = getUserInfo("dutplcecd");
  67. var sJobkind = getUserInfo("jobkindcd").substring(0, 2);
  68. var iptjobkind = "";
  69. if(sJobkind == "03") {
  70. iptjobkind = "03";
  71. }
  72. else if (sJobkind == "11") {
  73. iptjobkind = "05";
  74. }
  75. else {
  76. iptjobkind = "-";
  77. }
  78. model.makeValue("/root/send/rsnsrch/jobkind", iptjobkind);
  79. model.makeValue("/root/send/rsnsrch/deptcd", sUserDeptcd);
  80. /*
  81. if (sUserDeptcd == "4071200000" || sUserDeptcd == "4070300000" || sUserDeptcd == "2361500000" || sUserDeptcd == "3320100000" )
  82. {
  83. model.makevalue("/root/send/rsnsrch/jobkind", "-");
  84. model.makevalue("/root/send/rsnsrch/deptcd", sUserDeptcd);
  85. }
  86. else
  87. {
  88. var sJobkind = getUserInfo("jobkindcd").substring(0, 2);
  89. if(sJobkind == "03")
  90. {
  91. model.makevalue("/root/send/rsnsrch/jobkind", sJobkind);
  92. model.makevalue("/root/send/rsnsrch/deptcd", "-");
  93. }
  94. else if (sJobkind == "11")//간호
  95. {
  96. model.makevalue("/root/send/rsnsrch/jobkind", "05");
  97. model.makevalue("/root/send/rsnsrch/deptcd", "-");
  98. }
  99. else
  100. {
  101. model.makevalue("/root/send/rsnsrch/jobkind", "0");
  102. model.makevalue("/root/send/rsnsrch/deptcd", "0");
  103. }
  104. }
  105. */
  106. submit("TRMRI03102");
  107. }
  108. var POPUP_DEPTENGABBR = ""; //접근제한 사유 부서 리스트 (,)로 분리
  109. /**
  110. * @desc : 접근제한 사유 부서 리스트 조회
  111. * @
  112. * @param :
  113. * @return :
  114. * @author : 2010.08.16 주희경
  115. * @---------------------------------------------------
  116. */
  117. function fGetPopupDeptList()
  118. {
  119. model.makeValue("/root/send/cond/trgtno", 1100); //접근 제한 부서 하드코드 1100번 조건 설정
  120. model.makeValue("/root/send/cond/exno", 1110); //사유입력 제외 부서 하드코드 1110번
  121. submit("TRMRI08104"); //접근 제한 부서 영문명 조회
  122. var nodes = instance1.selectNodes("/root/init/hardcd/trgtdept/deptengabbr");
  123. for ( i=0; i<nodes.length; i++ )
  124. {
  125. POPUP_DEPTENGABBR = POPUP_DEPTENGABBR + nodes.item(i).value + ",";
  126. }
  127. POPUP_DEPTENGABBR = POPUP_DEPTENGABBR.substr(0,POPUP_DEPTENGABBR.length-1);
  128. }
  129. /**
  130. * @desc : 신청일, 열람희망일 셋팅
  131. * @
  132. * @param :
  133. * @return :
  134. * @author : 2010.08.16 주희경
  135. * @---------------------------------------------------
  136. */
  137. function fResetdd( fromdd_nodename )
  138. {
  139. var fromdd = ((getCurrentDate().toDate()).getAddDate(-3,"M")).getDateFormat(); //시작일자는 3개월 전
  140. var curdd = getCurrentDate(); //종료일자는 현재일자
  141. if ( fromdd_nodename == "appfromdd" )
  142. {
  143. model.setValue("/root/send/cond/appfromdd" , fromdd);
  144. model.setValue("/root/send/cond/apptodd" , curdd);
  145. model.setValue("/root/send/cond/appreadfromdd" , "");
  146. model.setValue("/root/send/cond/appreadtodd" , "");
  147. }
  148. else if ( fromdd_nodename == "appreadfromdd" )
  149. {
  150. model.setValue("/root/send/cond/appfromdd" , "");
  151. model.setValue("/root/send/cond/apptodd" , "");
  152. model.setValue("/root/send/cond/appreadfromdd" , fromdd);
  153. model.setValue("/root/send/cond/appreadtodd" , curdd);
  154. }
  155. }
  156. /**
  157. * @desc : 신규신청 버튼 클릭 시 열람신청 및 조회, 신청목록 초기화
  158. * @
  159. * @param :
  160. * @return :
  161. * @author : 2010.08.19 주희경
  162. * @---------------------------------------------------
  163. */
  164. function fSetNewReq()
  165. {
  166. btn_save.value = "신청";
  167. btn_save.disabled = false; //신청 버튼 활성화
  168. btn_resave.disabled = true; //연장/재신청 버튼 비활성화
  169. model.resetInstanceNode("/root/main/readappinfo/detail");
  170. model.setValue("/root/main/readappinfo/detail/applist/appdd", getCurrentDate()); //신청일 셋팅
  171. //model.setValue("/root/main/readappinfo/detail/applist/appdeptcd", getUserInfo("dutplcecd"));//신청과 셋팅
  172. //model.setValue("/root/main/readappinfo/detail/applist/appid" , getUserInfo("userid")); //신청자id 셋팅
  173. //이윤주수정(20120127)
  174. model.setValue("/root/main/readappinfo/detail/applist/appreadfromdd" , getCurrentDate()); //기본 희망일 세팅
  175. fResetDetailGrid();
  176. grp_applist.refresh();
  177. }
  178. /**
  179. * @desc : 화면의 데이터 모두 리셋
  180. * @
  181. * @param :
  182. * @return :
  183. * @author : 2010.08.19 주희경
  184. * @---------------------------------------------------
  185. */
  186. function fResetData( fromdd_nodename )
  187. {
  188. model.setValue("/root/send/cond/acptstatus", "-"); //처리구분 리셋
  189. fResetdd( fromdd_nodename ); //신청일, 열람희망일 셋팅
  190. //신청내역 그리드 리셋
  191. model.resetInstanceNode("/root/main/readappinfo/master/readapplist");
  192. model.removeNodeSet("/root/main/readappinfo/master/readapplist");
  193. grd_readapplist.rebuild();
  194. fResetDetailGrid();
  195. model.refresh();
  196. }
  197. /**
  198. * @desc : 오른쪽의 상세 조회 그리드 리셋
  199. * @
  200. * @param :
  201. * @return :
  202. * @author : 2010.08.19 주희경
  203. * @---------------------------------------------------
  204. */
  205. function fResetDetailGrid()
  206. {
  207. //환자 수진 그리드 리셋
  208. model.removeNodeset("/root/main/readappinfo/detail/orddeptlist/orddeptinfo");
  209. grd_orddeptlist.rebuild();
  210. //신청목록 그리드 리셋
  211. model.removeNodeset("/root/main/readappinfo/detail/apppatlist/apppatinfo");
  212. grd_apppatlist.rebuild();
  213. //열람신청결과 및 조회 그리드 리셋
  214. grd_readpatlist.rebuild();
  215. }
  216. /**
  217. * @desc : 환자번호 검색 및 진료과 정보조회
  218. * @
  219. * @param :
  220. * @return :
  221. * @author : 2010.08.19 주희경
  222. * @---------------------------------------------------
  223. */
  224. function fSetPatInfo()
  225. {
  226. //환자번호 검색
  227. modal("SPPMC02500");
  228. var pid = model.getValue("/root/main/patinfo/patinfolist/pid");
  229. var hngnm = model.getValue("/root/main/patinfo/patinfolist/hngnm");
  230. model.setValue("/root/main/readappinfo/detail/pid", pid);
  231. model.setValue("/root/main/readappinfo/detail/pnm", hngnm);
  232. grp_applist2.refresh();
  233. fGetOrddeptList(pid);
  234. }
  235. /**
  236. * @desc : 해당 환자의 진료과정보를 조회 하여 수진과 목록에 추가
  237. * @
  238. * @param :
  239. * @return :
  240. * @author : 2010.08.19 주희경
  241. * @---------------------------------------------------
  242. */
  243. function fGetOrddeptList(pid)
  244. {
  245. model.resetInstanceNode("/root/main/readappinfo/detail/orddeptlist/orddeptinfo");
  246. model.removeNodeSet("/root/main/readappinfo/detail/orddeptlist/orddeptinfo");
  247. //model.resetInstanceNode("/root/main/readappinfo/detail/apppatlist/apppatinfo");
  248. //model.removeNodeSet("/root/main/readappinfo/detail/apppatlist/apppatinfo");
  249. grd_orddeptlist.rebuild();
  250. //환자의 진료과정보 조회
  251. model.makeValue("/root/send/cond/pid", pid);
  252. if ( submit("TRMRI03001") )
  253. {
  254. //환자의 진료과 정보를 그리드로 복사
  255. var orddeptlistcnt = parseInt(model.getXpathValue("count(/root/initinfo/dplist)"));
  256. //종이챠트 신청용(20130124 이윤주)
  257. if (orddeptlistcnt == 0){
  258. var pid = model.getValue("/root/main/readappinfo/detail/pid");
  259. var pnm = model.getValue("/root/main/readappinfo/detail/pnm");
  260. var orddeptnm = "종이";
  261. fAddrowAppPatList ( pid, pnm, orddeptnm);
  262. var addrow = grd_apppatlist.row;
  263. model.setValue("/root/main/readappinfo/detail/apppatlist/apppatinfo["+addrow+"]/pappyn","Y");
  264. return;
  265. }
  266. //7개컬럼에 차례로 복사
  267. var mod = orddeptlistcnt % 7;
  268. var value = parseInt(orddeptlistcnt / 7);
  269. var cnt = 0;
  270. for (i=0; i<value+1; i++)
  271. {
  272. grd_orddeptlist.addRow(false);
  273. for ( j=0; j<7; j++ )
  274. {
  275. if ( i==0 && j==0 )
  276. {
  277. grd_orddeptlist.valueMatrix( grd_orddeptlist.row, j ) = "전체";
  278. }
  279. else
  280. {
  281. cnt++;
  282. var deptengabbr = model.getValue("/root/initinfo/dplist["+cnt+"]/deptengabbr");
  283. grd_orddeptlist.valueMatrix( grd_orddeptlist.row, j ) = deptengabbr;
  284. }
  285. if ( orddeptlistcnt == cnt )
  286. break;
  287. }
  288. }
  289. grd_orddeptlist.rebuild();
  290. }
  291. }
  292. /**
  293. * @desc : 선택한 환자의 수진과를 신청목록으로 추가
  294. * @
  295. * @param :
  296. * @return :
  297. * @author : 2010.08.19 주희경
  298. * @---------------------------------------------------
  299. */
  300. function fCopyPatInfo()
  301. {
  302. if (fCheckEssnInput() == false) //필수 입력 체크
  303. {
  304. return;
  305. }
  306. var selectedCells = grd_orddeptlist.selectedCells;
  307. if ( selectedCells.length <= 0 )
  308. {
  309. messageBox("수진과를", "C002");
  310. return;
  311. }
  312. ///////////////////
  313. //추가하려는 수진과 중 "전체"가 포함되어 있으면 전체로 "추가" 진행
  314. for (var i=0; i<selectedCells.length; i++)
  315. {
  316. var cell = selectedCells.item(i);
  317. if (cell)
  318. {
  319. var orddeptnm = grd_orddeptlist.valueMatrix( cell.row, cell.col);
  320. if ( orddeptnm == "전체" )
  321. {
  322. fAllCopyPatInfo();
  323. return;
  324. }
  325. }
  326. }
  327. /////////////////
  328. /////////////////
  329. //멀티 선택한 셀들을 체크하여 신청목록으로 데이터 복사
  330. for (var i=0; i<selectedCells.length; i++)
  331. {
  332. var cell = selectedCells.item(i);
  333. if (cell)
  334. {
  335. var pid = model.getValue("/root/main/readappinfo/detail/pid");
  336. var pnm = model.getValue("/root/main/readappinfo/detail/pnm");
  337. var orddeptnm = grd_orddeptlist.valueMatrix( cell.row, cell.col);
  338. fAddrowAppPatList ( pid, pnm, orddeptnm );
  339. }
  340. }
  341. /////////////////
  342. //이윤주 수정
  343. //grd_apppatlist.rebuild();
  344. }
  345. /**
  346. * @desc : 신청목록에 환자의 신청 수진과 추가(addrow)
  347. * @
  348. * @param :
  349. * @return :
  350. * @author : 2010.08.19 주희경
  351. * @---------------------------------------------------
  352. */
  353. function fAddrowAppPatList ( pid, pnm, orddeptnm)
  354. {
  355. //중복 신청 제거
  356. var node = instance1.selectNodes("/root/main/readappinfo/detail/apppatlist/apppatinfo[pid='"+pid+"' and orddeptnm='"+orddeptnm+"']");
  357. if ( node.length == 1 )
  358. {
  359. return;
  360. }
  361. //행추가, 데이터 복사
  362. grd_apppatlist.addRow();
  363. grd_apppatlist.valueMatrix( grd_apppatlist.row, grd_apppatlist.colRef("pid")) = pid;
  364. grd_apppatlist.valueMatrix( grd_apppatlist.row, grd_apppatlist.colRef("pnm")) = pnm;
  365. grd_apppatlist.valueMatrix( grd_apppatlist.row, grd_apppatlist.colRef("orddeptnm")) = orddeptnm;
  366. grd_apppatlist.valueMatrix( grd_apppatlist.row, grd_apppatlist.colRef("prntstatus")) = "-";
  367. var deptabbr = getUserInfo("deptabbr");
  368. //접근제한 챠트의 경우 바탕에 빨간색 표시
  369. if ( POPUP_DEPTENGABBR.indexOf(orddeptnm) > -1 && orddeptnm != deptabbr )
  370. {
  371. grd_apppatlist.cellStyle("background-color", grd_apppatlist.row, 1, grd_apppatlist.row, grd_apppatlist.cols-1) = "#ff0000";
  372. }
  373. }
  374. /**
  375. * @desc : 선택한 환자의 전체 수진과를 신청목록으로 추가
  376. * @
  377. * @param :
  378. * @return :
  379. * @author : 2010.08.19 주희경
  380. * @---------------------------------------------------
  381. */
  382. function fAllCopyPatInfo()
  383. {
  384. var breakYN = false;
  385. var popupDeptCopyYN = true; //접근제한 차트 신청 추가 여부
  386. var sUserDeptcd = getUserInfo("dutplcecd");
  387. var iexNodeCnt = getNodesetCount(model, "/root/hardcd/exdept[trgtcd = '" + sUserDeptcd + "']"); //사유제외부서
  388. /////////////////////////////
  389. //전체 수진과를 대상으로 접근 제한 차트과가 검색되면 안내문구 표출
  390. var arr_deptnm = POPUP_DEPTENGABBR.split(",");
  391. for ( i=0; i<arr_deptnm.length; i++)
  392. {
  393. for(j=0; j<grd_orddeptlist.cols; j++ )
  394. {
  395. if (grd_orddeptlist.findRow(arr_deptnm[i], 1, j ) > -1)
  396. {
  397. var orddeptcd = model.getValue("root/initinfo/dplist[deptengabbr='"+arr_deptnm[i]+"']/deptcd");
  398. //사유 제외 부서가 아니거나 사용자부서와 환자수진부서가 다른경우
  399. if ((iexNodeCnt <= 0) && (sUserDeptcd != orddeptcd))
  400. {
  401. //" 하시려면 예(Yes)\n" + pOptMsg.split("|")[0] + " 하시려면 아니오(No)\n" + pOptMsg.split("|")[1] + " 하시려면 취소를 선택하십시오"
  402. var pOptMsg = "모두 신청|모두 취소";
  403. var rtnval = messageBox("신청목록 중 접근제한된 수진과가 포함되어 있습니다. \n\n**접근제한과 열람시 해당과에 별도 보고됩니다. 해당 버튼을 선택하십시오. \n\n접근제한과를 제외하고 신청", "S006", pOptMsg);
  404. //접근 제한과 제외 신청
  405. if ( rtnval == 6 )
  406. {
  407. popupDeptCopyYN = false;
  408. }
  409. //모두 신청
  410. else if ( rtnval == 7 )
  411. {
  412. popupDeptCopyYN = true;
  413. }
  414. else
  415. {
  416. return; //취소시
  417. }
  418. breakYN = true;
  419. break;
  420. }
  421. }
  422. }
  423. if ( breakYN )
  424. {
  425. break;
  426. }
  427. }
  428. ////////////////////////////
  429. //수진과 전체를 추가
  430. for (var i=1; i<grd_orddeptlist.rows; i++)
  431. {
  432. for( j=0; j<grd_orddeptlist.cols; j++ )
  433. {
  434. var orddeptnm = grd_orddeptlist.valueMatrix(i,j);
  435. var pid = model.getValue("/root/main/readappinfo/detail/pid");
  436. var pnm = model.getValue("/root/main/readappinfo/detail/pnm");
  437. if ( (i== 1 && j == 0) || orddeptnm == "" ) //전체이면 패스
  438. {
  439. continue;
  440. }
  441. //접근제한 챠트이고 사용자가 신청 동의 안했으면 패스
  442. if ( POPUP_DEPTENGABBR.indexOf(orddeptnm) > -1 )
  443. {
  444. if ( !popupDeptCopyYN )
  445. {
  446. continue;
  447. }
  448. }
  449. //행추가 및 데이터 복사
  450. fAddrowAppPatList ( pid, pnm, orddeptnm );
  451. }
  452. }
  453. //lyj 20111213
  454. //grd_apppatlist.rebuild();
  455. }
  456. /**
  457. * @desc : 열람신청 시 신청목록의 필수 입력 체크(엑셀 로드시 필수입력체크)
  458. * @
  459. * @param :
  460. * @return :
  461. * @author : 2010.08.19 주희경
  462. * @---------------------------------------------------
  463. */
  464. function fCheckExcelLoadInput()
  465. {
  466. for(i=1; i<grd_apppatlist.rows; i++ )
  467. {
  468. var pid = grd_apppatlist.valueMatrix( i, grd_apppatlist.colRef("pid"));
  469. var pnm = grd_apppatlist.valueMatrix( i, grd_apppatlist.colRef("pnm"));
  470. var orddeptnm = grd_apppatlist.valueMatrix( i, grd_apppatlist.colRef("orddeptnm"));
  471. if ( pid == "" )
  472. {
  473. messageBox("신청목록의 환자번호를","C001");
  474. return false;
  475. }
  476. if ( pnm == "" )
  477. {
  478. messageBox("신청목록의 환자성명을","C001");
  479. return false;
  480. }
  481. if ( orddeptnm == "" )
  482. {
  483. messageBox("신청목록의 진료과 영문명을","C001");
  484. return false;
  485. }
  486. }
  487. return true;
  488. }
  489. /**
  490. * @desc : 열람신청 시 필수 입력 체크
  491. * @
  492. * @param :
  493. * @return :
  494. * @author : 2010.08.19 주희경
  495. * @---------------------------------------------------
  496. */
  497. function fCheckEssnInput()
  498. {
  499. if (model.getValue("/root/main/readappinfo/detail/applist/apptel") == "")
  500. {
  501. messageBox("연락처를","C001");
  502. return false;
  503. }
  504. if (model.getValue("/root/main/readappinfo/detail/applist/apptype") == "")
  505. {
  506. messageBox("열람목적을","C001");
  507. return false;
  508. }
  509. if (model.getValue("/root/main/readappinfo/detail/applist/appreadfromdd") == "")
  510. {
  511. messageBox("열람희망일을","C001");
  512. return false;
  513. }
  514. var appreadfromdd = model.getValue("/root/main/readappinfo/detail/applist/appreadfromdd");
  515. if (appreadfromdd < getCurrentDate())
  516. {
  517. messageBox("열람희망일을 현재일보다 작을 날로 세팅","E001");
  518. return false;
  519. }
  520. var apptype = model.getValue("/root/main/readappinfo/detail/applist/apptype");
  521. //병원마다 기준이 다르고 코드가 다르므로 텍스트로 비교
  522. if ( cmb_resn.value == "F3" || cmb_resn.label.indexOf("기타") > -1 || cmb_resn.label == "연구용" || cmb_resn.label == "Conference" || cmb_resn.label == "conference" ||cmb_resn.label == "집담회용")
  523. {
  524. if ( model.getValue("/root/main/readappinfo/detail/applist/appdetail") == "" )
  525. {
  526. messageBox("열람목적에 따른 주제(상세사유)를","C001");
  527. return false;
  528. }
  529. }
  530. }
  531. /**
  532. * @desc : 열람희망일 선택 시 열람목적에 따른 열람기한으로 열람 종료일 셋팅(기준자료 의거)
  533. * @
  534. * @param :
  535. * @return :
  536. * @author : 2010.08.19 주희경
  537. * @---------------------------------------------------
  538. */
  539. function fSetAppReadtodd()
  540. {
  541. var apptype = model.getValue("/root/main/readappinfo/detail/applist/apptype");
  542. if ( apptype == "" )
  543. {
  544. messageBox("열람목적을 먼저","C002");
  545. model.setValue("/root/main/readappinfo/detail/applist/appreadfromdd", "");
  546. ipt_appreadfromdd.refresh();
  547. return;
  548. }
  549. //열람목적에 따른 열람 기한
  550. var readterm = parseInt(model.getValue("/root/init/resn/resnlist[rsncd = '"+apptype+"']/readterm"))-1;
  551. //열람희망시작일
  552. var appreadfromdd = model.getValue("/root/main/readappinfo/detail/applist/appreadfromdd");
  553. if ( appreadfromdd == "" )
  554. {
  555. return;
  556. }
  557. var appreadtodd = ((appreadfromdd.toDate()).getAddDate( readterm, "D")).getDateFormat();
  558. //기준자료에 따른 열람 종료일 셋팅
  559. model.setValue("/root/main/readappinfo/detail/applist/appreadtodd", appreadtodd);
  560. ipt_appreadtodd.refresh();
  561. }
  562. /**
  563. * @desc : 환자 등록번호를 통한 환자 이름 가져오기
  564. * @
  565. * @param :
  566. * @return :
  567. * @author : 김영학
  568. * @---------------------------------------------------
  569. */
  570. function fPatSrch(s_val, flag){
  571. if(flag == "1"){
  572. model.makeValue("/root/tmp/pid", s_val);
  573. } else if(flag == "2"){
  574. model.makeValue("/root/tmp/hngnm", s_val);
  575. }
  576. model.makeValue("/root/tmp/srchcond", flag);
  577. model.makeValue("/root/tmp/autoflag","Y"); // 1건인경우 자동으로닫힘
  578. model.resetInstanceNode("/root/main/patinfo/patinfolist");
  579. modal("SPPMC02500", 1,10, 10, "SPPMC02500", "/root/tmp", "/root/send");
  580. model.refresh();
  581. }
  582. /**
  583. * @desc : 조회
  584. * @id :
  585. * @event : DOMActivate
  586. * @return : void
  587. * @author : 2010.08.19 주희경
  588. */
  589. function fSearch()
  590. {
  591. var fromddpath = "/root/send/cond/appfromdd";
  592. var toddpath = "/root/send/cond/apptodd";
  593. if(!isValidDateTime(model.getValue(fromddpath),"YYYYMMDD")){
  594. messageBox("검색 시작일자를 유효한 날짜로","C001");
  595. return;
  596. }
  597. if(!isValidDateTime(model.getValue(toddpath),"YYYYMMDD")){
  598. messageBox("검색 종료일자를 유효한 날짜로","C001");
  599. return;
  600. }
  601. if(submit("TRMRI08101")){
  602. }
  603. }
  604. /**
  605. * @desc : 열람 신청 저장
  606. * @
  607. * @param :
  608. * @return :
  609. * @author : 2010.08.19 주희경
  610. * @---------------------------------------------------
  611. */
  612. function fSaveReadApp( histstat )
  613. {
  614. if ( grd_apppatlist.rows == 1 )
  615. {
  616. messageBox("신청목록에 데이터가 존재하지","I011");
  617. return;
  618. }
  619. if (fCheckEssnInput() == false) //필수 입력 체크
  620. {
  621. return;
  622. }
  623. if (fCheckExcelLoadInput() == false)//신청목록 필수 입력 체크
  624. {
  625. return;
  626. }
  627. if (histstat == "R" )
  628. {
  629. //신청목록의 데이터를 모두 insert 플래그 처리
  630. for (i=1; i<grd_apppatlist.rows ; i++)
  631. {
  632. grd_apppatlist.addStatus(i, "insert");
  633. }
  634. model.resetInstanceNode("/root/send/reqdata");
  635. }
  636. //신청자 정보 copy
  637. model.makeNode("/root/send/reqdata/applist");
  638. model.copyNode("/root/send/reqdata/applist", "/root/main/readappinfo/detail/applist");
  639. model.setValue("/root/send/reqdata/applist/appdd",getCurrentDate());
  640. model.setValue("/root/send/reqdata/applist/appid",getUserInfo("userid"));
  641. model.setValue("/root/send/reqdata/applist/appdeptcd",getUserInfo("dutplcecd"));
  642. //histno 설정
  643. var histno = model.getValue("/root/send/reqdata/applist/histno");
  644. if ( histstat == "Y" ) //신청
  645. {
  646. histno = "1";
  647. }
  648. else if (histstat == "R" ) // 재신청
  649. {
  650. submit("TRMRI08106");
  651. histno = model.getValue("/root/hidden/result/histno");
  652. }
  653. model.makeValue("/root/send/reqdata/applist/histno", histno);
  654. //histstat 설정
  655. model.makeValue("/root/send/reqdata/applist/histstat", histstat);
  656. //신청 환자 정보 copy
  657. model.makeValue("/root/send/reqdata/apppatlist", grd_apppatlist.getUpdateData());
  658. for (i= grd_apppatlist.fixedRows;i<=grd_apppatlist.rows - grd_apppatlist.fixedRows;i++)
  659. {
  660. var backcolor = grd_apppatlist.cellStyle("background-color", i, 2, i, grd_apppatlist.cols-1);
  661. var appdetail = grd_apppatlist.valueMatrix(i, grd_apppatlist.colRef("appdetail"));
  662. if (backcolor == "#ff0000" && appdetail == "")
  663. {
  664. messageBox("접근제한 수진과는 사유입력이","I003");
  665. return;
  666. }
  667. }
  668. if ( submit("TXMRI08101") )
  669. {
  670. var appno = model.getValue("/root/main/appinfo/appno");
  671. if (appno != "")
  672. {
  673. fSetNewReq();
  674. fSearch();
  675. messageBox("정상","I002");
  676. }
  677. else
  678. {
  679. messageBox("처리에","E009");
  680. }
  681. }
  682. }
  683. /**
  684. * @desc : 열람 서약 인증 및 서약서 출력
  685. * @
  686. * @param :
  687. * @return :
  688. * @author : 2010.08.19 주희경
  689. * @---------------------------------------------------
  690. */
  691. function fSetSign( appno )
  692. {
  693. setParameter("SPMRI08100_param_appno", appno);
  694. // ------------------jeongtaek Lee 서약서 부분 수정(20110330)------------
  695. // modal("SPMRI08100");
  696. // ------------------jeongtaek Lee 서약서 부분 수정(20110330)------------
  697. var signeddt = getParameter("SPMRI08100_param_signeddt");
  698. var pledgeflag = getParameter("SPMRI08100_param_pledgeflag");
  699. /** ----------------jeongtaek Lee 서약서 부분 수정(20110330)--------------
  700. //인증에 실패하면
  701. if ( signeddt == "" )
  702. {
  703. //인증도 실패하고 서약서 출력도 안했으면
  704. if ( pledgeflag == "N" || pledgeflag == "")
  705. {
  706. model.makeValue("/root/send/reqdata/applist/histstat", "X");
  707. }
  708. //서약서 출력했으면
  709. else if ( pledgeflag == "P")
  710. {
  711. model.makeValue("/root/send/reqdata/applist/pledgeflag", "P");
  712. model.makeValue("/root/send/reqdata/applist/histstat", "Y");
  713. }
  714. }
  715. else //인증에 성공했으면
  716. {
  717. model.makeValue("/root/send/reqdata/applist/pledgeflag", "E");
  718. model.makeValue("/root/send/reqdata/applist/pledgepath", signeddt);
  719. }
  720. */
  721. //---------------jeongtaek Lee 서약서 부분 수정(20110330)----------------
  722. model.makeValue("/root/send/reqdata/applist/appno", appno);
  723. //신청 변경 사항 업데이트
  724. if ( submit("TXMRI08103") )
  725. {
  726. }
  727. setParameter("SPMRI08100_param_appno", "");
  728. setParameter("SPMRI08100_param_pledgeflag", "");
  729. setParameter("SPMRI08100_param_signeddt", "");
  730. if ( model.getValue("/root/send/reqdata/applist/histstat") == "X" )
  731. {
  732. return false;
  733. }
  734. return true;
  735. }
  736. /**
  737. * @desc : 상세 기록 신청 데이터 조회
  738. * @
  739. * @param :
  740. * @return :
  741. * @author : 2010.08.19 주희경
  742. * @---------------------------------------------------
  743. */
  744. function fSearchDetail()
  745. {
  746. //열람신청 및 내역 조회 탭인 경우 오른쪽 화면에 신청자 정보 복사
  747. if ( btn_readapp.selected == true )
  748. {
  749. btn_resave.disabled = true;
  750. //이미 신청한 건 이므로 신청 버튼을 수정으로 텍스트 변경
  751. btn_save.value = "수정";
  752. //처리 상태가 신청 단계이면 수정 가능
  753. var acptstatus = grd_readapplist.valueMatrix(grd_readapplist.row, grd_readapplist.colRef("acptstatus"));
  754. if ( acptstatus == "01" )
  755. btn_save.disabled = false;
  756. else
  757. btn_save.disabled = true;
  758. //처리 상태가 불가,부분승인,승인,보류이면 재신청으로 버튼 변경
  759. if ( acptstatus == "02" || acptstatus == "03" || acptstatus == "04" || acptstatus == "05" )
  760. {
  761. // var appreadtodd = grd_readapplist.valueMatrix(grd_readapplist.row, grd_readapplist.colRef("appreadtodd"));
  762. //
  763. // if (getCurrentDate() > appreadtodd){
  764. // btn_resave.value = "재신청";
  765. // btn_resave.disabled = false;
  766. // }
  767. btn_resave.value = "재신청";
  768. btn_resave.disabled = false;
  769. }
  770. //열람희망일 체크 하여 연장/ 재신청으로 버튼변경
  771. var curdate = getCurrentDate();
  772. var appreadfromdd = grd_readapplist.valueMatrix(grd_readapplist.row, grd_readapplist.colRef("appreadfromdd"));
  773. var appreadtodd = grd_readapplist.valueMatrix(grd_readapplist.row, grd_readapplist.colRef("appreadtodd"));
  774. }
  775. var appno = model.getValue("/root/main/readappinfo/master/readapplist["+grd_readapplist.row+"]/appno");
  776. var histno = model.getValue("/root/main/readappinfo/master/readapplist["+grd_readapplist.row+"]/histno");
  777. model.setValue("/root/send/cond/appno", appno);
  778. model.setValue("/root/send/cond/histno", histno);
  779. //그리드 스타일 초기화
  780. if ( btn_readexe.selected == true ) //의무기록열람 탭인경우
  781. grd_readpatlist.rebuildStyle( 1, 1, grd_readpatlist.rows-1, grd_readpatlist.cols-1);
  782. else
  783. grd_apppatlist.rebuildStyle( 1, 1, grd_apppatlist.rows-1, grd_apppatlist.cols-1);
  784. ////////////////////////////////
  785. if(btn_readexe.selected == true) // 의무기록 열람
  786. {
  787. submit("TRMRI08102");
  788. model.copyNode("/root/main/readappinfo/detail/applist", "/root/main/readappinfo/master/readapplist["+grd_readapplist.row+"]");
  789. var rows = model.getXpathValue("count(/root/main/readappinfo/detail/apppatlist/apppatinfo)");
  790. for( i=1; i<=rows; i++ )
  791. {
  792. if ( grd_readpatlist.valueMatrix( i, grd_readpatlist.colRef("acptstatus")) == "02" )
  793. {
  794. grd_readpatlist.cellstyle("background-image", i, grd_readpatlist.colRef("search")) = "../../../com/commonweb/images/icon_list.gif";
  795. grd_readpatlist.cellstyle("background-position", i, grd_readpatlist.colRef("search")) = "center";
  796. }
  797. }
  798. }
  799. else
  800. {
  801. submit("TRMRI08107");
  802. model.copyNode("/root/main/readappinfo/detail/applist", "/root/main/readappinfo/master/readapplist["+grd_readapplist.row+"]");
  803. var rows = model.getXpathValue("count(/root/main/readappinfo/detail/apppatlist/apppatinfo)");
  804. //상세 신청 리스트에 조회 아이콘, 접근체한 차트 표시
  805. for( i=1; i<=rows; i++ )
  806. {
  807. var orddeptnm = model.getValue("/root/main/readappinfo/detail/apppatlist/apppatinfo["+i+"]/orddeptnm");
  808. var deptabbr = getUserInfo("deptabbr");
  809. //접근제한 챠트의 경우 바탕에 빨간색 표시
  810. if ( POPUP_DEPTENGABBR.indexOf(orddeptnm) > -1 && orddeptnm != deptabbr )
  811. {
  812. grd_apppatlist.cellStyle("background-color", i, 1, i, grd_apppatlist.cols-1) = "#ff0000";
  813. }
  814. if ( grd_apppatlist.valueMatrix( i, grd_apppatlist.colRef("acptstatus")) == "02" )
  815. {
  816. grd_apppatlist.cellstyle("background-image", i, grd_apppatlist.colRef("search")) = "../../../com/commonweb/images/icon_list.gif";
  817. grd_apppatlist.cellstyle("background-position", i, grd_apppatlist.colRef("search")) = "center";
  818. }
  819. }
  820. cmb_resn.dispatch("xforms-value-changed");
  821. }
  822. model.refresh();
  823. }
  824. /**
  825. * @desc : 통합기록조회 연결하여 승인된 기록만 열람가능하게 해줌
  826. * @id :
  827. * @event : DOMActivate
  828. * @return : void
  829. * @author : 2010.08.19 주희경
  830. */
  831. function fOpenSMMRI00400(datagrid)
  832. {
  833. var curdate = getCurrentDate();
  834. var appreadfromdd = grd_readapplist.valueMatrix(grd_readapplist.row, grd_readapplist.colRef("appreadfromdd"));
  835. var appreadtodd = grd_readapplist.valueMatrix(grd_readapplist.row, grd_readapplist.colRef("appreadtodd"));
  836. if (datagrid == "grd_apppatlist" && grd_apppatlist.valueMatrix(grd_apppatlist.row, grd_apppatlist.colRef("acptstatus")) != "02" ){
  837. messageBox("승인후 열람가능합니다","");
  838. return;
  839. }
  840. if ( appreadfromdd > curdate || appreadtodd < curdate )
  841. {
  842. //열람기간을 확인하십시오. I007
  843. messageBox("열람기간을","I007");
  844. return;
  845. }
  846. var pid;
  847. if (datagrid == "grd_apppatlist"){
  848. pid = grd_apppatlist.valueMatrix(grd_apppatlist.row, grd_apppatlist.colRef("pid"));
  849. }
  850. else {
  851. pid = grd_readpatlist.valueMatrix(grd_readpatlist.row, grd_readpatlist.colRef("pid"));
  852. }
  853. var appno = grd_readapplist.valueMatrix(grd_readapplist.row, grd_readapplist.colRef("appno"));
  854. var appid = grd_readapplist.valueMatrix(grd_readapplist.row, grd_readapplist.colRef("appid"));
  855. var histstat = grd_readapplist.valueMatrix(grd_readapplist.row, grd_readapplist.colRef("histstat"));
  856. var histno = grd_readapplist.valueMatrix(grd_readapplist.row, grd_readapplist.colRef("histno"));
  857. model.setValue("/root/send/cond/appid", appid);
  858. model.setValue("/root/send/cond/appno", appno);
  859. model.setValue("/root/send/cond/pid", pid);
  860. model.makeValue("/root/send/cond/histstat", histstat);
  861. model.makeValue("/root/send/cond/histno", histno);
  862. model.removenode("/root/main/deptengabbrinfo/deptengabbrlist");
  863. if(submit("TRMRI08103")){ //해당 환자의 승인된 수진과 조회
  864. var orddeptengabbr = "";
  865. var prntdeptengabbr = "";
  866. var deptlen = model.getXpathValue("count(/root/main/deptengabbrinfo/deptengabbrlist)");
  867. for ( i=1; i<= deptlen; i++)
  868. {
  869. orddeptengabbr = orddeptengabbr + model.getValue("/root/main/deptengabbrinfo/deptengabbrlist["+i+"]/deptengabbr") + ",";
  870. //출력승인된 부서
  871. if (model.getValue("/root/main/deptengabbrinfo/deptengabbrlist["+i+"]/prntdeptengabbr") !=""){
  872. prntdeptengabbr = prntdeptengabbr + model.getValue("/root/main/deptengabbrinfo/deptengabbrlist["+i+"]/prntdeptengabbr") + ",";
  873. }
  874. }
  875. if ( orddeptengabbr.length > 1 )
  876. {
  877. var openerid = "SMMRI08000";
  878. //var orddeptengabbr = "MD,MG,ME,AH";
  879. clearParameter("SMMRI00400_param_openerid");
  880. clearParameter("SMMRI00400_param_pid");
  881. clearParameter("SMMRI00400_param_orddeptengabbr");
  882. clearParameter("SMMRI00400_param_prntdeptengabbr");
  883. clearParameter("SMMRI00400_param_resncd");
  884. clearParameter("SMMRI00400_param_etc");
  885. clearParameter("SMMRI00400_param_appno");
  886. clearParameter("SMMRI00400_param_histno");
  887. setParameter("SMMRI00400_param_openerid", openerid); //기록승인열람 화면번호 셋팅
  888. setParameter("SMMRI00400_param_pid", pid); //조회할 환자번호 셋팅
  889. setParameter("SMMRI00400_param_orddeptengabbr", orddeptengabbr); //승인된 수진과 셋팅
  890. setParameter("SMMRI00400_param_prntdeptengabbr", prntdeptengabbr); //출력승인된 수진과 셋팅
  891. setParameter("SMMRI00400_param_resncd", model.getValue("/root/main/readappinfo/master/readapplist["+grd_readapplist.row+"]/apptype")); //열람목적 코드
  892. setParameter("SMMRI00400_param_etc", model.getValue("/root/main/readappinfo/master/readapplist["+grd_readapplist.row+"]/appdetail")); //열람목적 사유
  893. setParameter("SMMRI00400_param_appno", model.getValue("/root/main/readappinfo/master/readapplist["+grd_readapplist.row+"]/appno")); //열람신청번호
  894. setParameter("SMMRI00400_param_histno", model.getValue("/root/main/readappinfo/master/readapplist["+grd_readapplist.row+"]/histno")); //열람신청 HISTNO
  895. open("SMMRI00400"); //통합기록조회 오픈
  896. }
  897. else
  898. {
  899. messageBox("열람승인내역을","I007");
  900. return;
  901. }
  902. }
  903. }
  904. function fLoadExcel(){
  905. var fileName = window.fileDialog("open", ",", false, "", "xlsx", "Excel Files(*.xlsx)|*.xlsx|All Files (*.*)|*.*");
  906. if (fileName != ""){
  907. grd_pid.loadExcel(fileName);
  908. var rows = grd_pid.rows;
  909. if (rows < 2) {
  910. messageBox("챠트번호가 없습니다","");
  911. return;
  912. }
  913. fLoadfromExcel(rows);
  914. }
  915. }
  916. function fLoadfromExcel(rows){
  917. for (i = 1; i < rows; i++){
  918. var pid = model.getValue("/root/excel/patinfo["+i+"]/pid");
  919. var pnm = model.getValue("/root/excel/patinfo["+i+"]/pnm");
  920. if ( pid == "") {
  921. continue;
  922. }
  923. if(reqPatInfo("pid", "ptbs", pid)==true){
  924. model.setValue("/root/excel/patinfo/pid", pid);
  925. submit("TRMRI08108");
  926. var cnt = getNodesetCount( "/root/temp/patinfo" );
  927. if (cnt ==0 ) {
  928. var orddeptnm = "종이";
  929. fAddrowAppPatList ( pid, pnm, orddeptnm);
  930. var addrow = grd_apppatlist.row;
  931. model.setValue("/root/main/readappinfo/detail/apppatlist/apppatinfo["+addrow+"]/pappyn","Y");
  932. continue;
  933. }
  934. for ( j = 1; j <= cnt ; j++)
  935. {
  936. var deptnm = model.getValue("/root/temp/patinfo["+j+"]/deptengabbr");
  937. fAddrowAppPatList ( pid, pnm, deptnm);
  938. }
  939. }
  940. }
  941. }