SMMRC01500.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499
  1. /**
  2. - ▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩
  3. - 외래차트대출신청 및 상태조회 ( SMMRC01500_외래차트대출신청 및 상태조회.xrw - JScript )
  4. - Version :
  5. 1) : Ver.1.00.01
  6. - ▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩
  7. **/
  8. /**
  9. * @ver : 2007/12/11
  10. * @desc : 폼초기화 및 공통코드 load,상단정보 있을시 검색
  11. * @
  12. * @by : 이창록
  13. * @param :
  14. * @return :
  15. * @---------------------------------------------------
  16. */
  17. function finitialize(){
  18. model.removeNodeset("/root/main/appchrt/outchrtlist");
  19. model.removeNodeset("/root/main/otherchrt/otherchrtlist");
  20. mmbfGetDeptCodeComboList("/root/send/reqdata", "/root/init/wardlist", "W"); //병동코드 콤보
  21. var pamInfoCvs = getGlobalVariable("paminfo");
  22. if(pamInfoCvs != null && pamInfoCvs != "")
  23. { //cvs가 null이 아닌 경우에만 처리함.
  24. model.removeNodeSet ("/root/main/result/paminfo/list");
  25. setCSVToNode ("/root/main/result/paminfo", pamInfoCvs);
  26. var pid = model.getValue("/root/main/result/paminfo/list/pid");
  27. var orddeptcd = model.getValue("/root/main/result/paminfo/list/orddeptcd");
  28. var wardcd = model.getValue("/root/main/result/paminfo/list/wardcd");
  29. var roomcd = model.getValue("/root/main/result/paminfo/list/roomcd");
  30. var indd = model.getValue("/root/main/result/paminfo/list/indd");
  31. //model.setValue("/root/outcond/chrtdept" ,orddeptcd);
  32. model.setValue("/root/outcond/ward" ,wardcd);
  33. model.setValue("/root/outcond/pid" ,pid);
  34. model.setValue("/root/outcond/ddlist" ,getCurrentDate());
  35. model.makeValue("/root/outcond/instcd" ,getUserInfo("dutplceinstcd"));
  36. //model.makeValue("/root/outcond/dschdd" ,getCurrentDate());
  37. model.setValue("/root/othercond/ward" ,wardcd);
  38. fSelectWard();
  39. fOutChartList();
  40. model.setValue("/root/othercond/room" ,roomcd);
  41. fRoomPatList();
  42. model.setValue("/root/othercond/pid" ,pid);
  43. model.makeValue("/root/othercond/indd" ,indd);
  44. model.makeValue("/root/othercond/instcd",getUserInfo("dutplceinstcd"));
  45. fOtherChrtList();
  46. }else if(pamInfoCvs==""){
  47. model.setValue("/root/outcond/ward" ,getUserInfo("dutplcecd"));
  48. model.makeValue("/root/outcond/ddlist" ,getCurrentDate());
  49. model.makeValue("/root/outcond/instcd" ,getUserInfo("dutplceinstcd"));
  50. fOutChartList();
  51. }
  52. grd_outchrtlist.colHidden(10)=true;
  53. }
  54. /**
  55. * @group :
  56. * @ver : 2007.12.11
  57. * @by : 이창록
  58. * @---------------------------------------------------
  59. * @type : function
  60. * @access : public
  61. * @desc : 외래차트대출 상태조회
  62. * @param :
  63. * @return :
  64. * @---------------------------------------------------
  65. */
  66. function fOutChartList()
  67. {
  68. if(submit("TRMRC01501")==true){
  69. var trgCol = grd_outchrtlist.colRef("appdd");
  70. var rendflagCol = grd_outchrtlist.colRef("rendflag");
  71. for(var i =1; i < grd_outchrtlist.rows; i++ ) {
  72. if(model.getValue("/root/outcond/dschInddlist")=="dschdd"){
  73. if( grd_outchrtlist.valueMatrix(i, trgCol) != "" ){//그 인덱스 값이 없을 때
  74. grd_outchrtlist.isReadOnly(i, rendflagCol) = true;//edit못하게
  75. }
  76. }else if(model.getValue("/root/outcond/dschInddlist")=="indd"){
  77. if(grd_outchrtlist.valueMatrix(i,grd_outchrtlist.colRef("appdd"))=="신청중"){
  78. grd_outchrtlist.isReadOnly(i, rendflagCol) = true;
  79. grd_outchrtlist.refresh();
  80. }else if(grd_outchrtlist.valueMatrix(i,grd_outchrtlist.colRef("appdd"))!=""){
  81. grd_outchrtlist.isReadOnly(i, rendflagCol) = true;
  82. grd_outchrtlist.refresh();
  83. }else{
  84. grd_outchrtlist.isReadOnly(i, rendflagCol) = false;
  85. }
  86. }
  87. }
  88. }
  89. model.refresh();
  90. }
  91. /**
  92. * @group :
  93. * @ver : 2007.12.11
  94. * @by : 이창록
  95. * @---------------------------------------------------
  96. * @type : function
  97. * @access : public
  98. * @desc : 외래차트대출
  99. * @param :
  100. * @return :
  101. * @---------------------------------------------------
  102. */
  103. function fRowRendflag(){
  104. if (grd_outchrtlist.isCell(event.target)
  105. && grd_outchrtlist.row >= grd_outchrtlist.fixedRows){
  106. var iRow = grd_outchrtlist.row - grd_outchrtlist.fixedRows + 1;
  107. var rRow = grd_otherchrtlist.row - grd_otherchrtlist.fixedRows + 1;
  108. var rendflag = model.getValue("/root/main/appchrt/outchrtlist[" + iRow + "]/rendflag");
  109. var chrtflag = model.getValue("/root/main/appchrt/outchrtlist[" + iRow + "]/chrtflag");
  110. var appdeptcd = model.getValue("/root/main/appchrt/outchrtlist[" + iRow + "]/appdeptcd");
  111. var appdd = model.getValue("/root/main/appchrt/outchrtlist[" + iRow + "]/appdd");
  112. var appmanid = model.getValue("/root/main/appchrt/outchrtlist[" + iRow + "]/appmanid");
  113. var lendmanid = model.getValue("/root/main/appchrt/outchrtlist[" + iRow + "]/lendmanid");
  114. var rtndd = model.getValue("/root/main/appchrt/outchrtlist[" + iRow + "]/rtndd");
  115. if(chrtflag != "P")
  116. {
  117. messageBox("이 환자는 해당 입원과 차트가 없으니 오른쪽의 타과 차트 대출에서 신청","I008");
  118. model.setValue("/root/main/appchrt/outchrtlist[" + iRow + "]/rendflag", "false");
  119. grd_outchrtlist.refresh();
  120. return;
  121. }
  122. if(rendflag=="true"){
  123. model.setValue("/root/main/appchrt/outchrtlist[" + iRow + "]/rendflag", "true");
  124. model.setValue("/root/main/appchrt/outchrtlist[" + iRow + "]/appdd",getCurrentDate());
  125. }else if(rendflag=="false"){
  126. model.setValue("/root/main/appchrt/outchrtlist[" + iRow + "]/appdd" , "");
  127. model.setValue("/root/main/appchrt/outchrtlist[" + iRow + "]/rendflag", "false");
  128. grd_outchrtlist.refresh();
  129. }
  130. }
  131. model.refresh();
  132. }
  133. /**
  134. * @group :
  135. * @ver : 2007.12.11
  136. * @by : 이창록
  137. * @---------------------------------------------------
  138. * @type : function
  139. * @access : public
  140. * @desc : 병동에 병실 조회
  141. * @param :
  142. * @return :
  143. * @---------------------------------------------------
  144. */
  145. function fSelectWard()
  146. {
  147. model.makeValue("/root/send/reqdata/wardcd", model.getValue("/root/othercond/ward"));
  148. submit("TRMRC00051");
  149. cmb_room.refresh();
  150. cmb_pid.refresh();
  151. ipt_pid.value="";
  152. }
  153. /**
  154. * @group :
  155. * @ver : 2007.12.11
  156. * @by : 이창록
  157. * @---------------------------------------------------
  158. * @type : function
  159. * @access : public
  160. * @desc : 입원환자차트리스트 저장
  161. * @param :
  162. * @return :
  163. * @---------------------------------------------------
  164. */
  165. function fReqLendChrt()
  166. {
  167. grd_outchrtlist.clearStatus();
  168. var iRow = grd_outchrtlist.row - grd_outchrtlist.fixedRows + 1;
  169. var bSave = false;
  170. for ( var i= 1; i< grd_outchrtlist.rows; i++)
  171. {
  172. var check = model.getValue("/root/main/appchrt/outchrtlist[" + i + "]/rendflag");
  173. if(check == "true")
  174. {
  175. grd_outchrtlist.rowStatus(i) = 1;
  176. bSave = true;
  177. }
  178. }
  179. if(bSave == true)
  180. {
  181. var iRow = grd_outchrtlist.row - grd_outchrtlist.fixedRows+ 1;
  182. var ward =model.getValue("/root/outcond/ward");
  183. if (ward=="2280200000"){
  184. //병동이 응급의료센터일때 대출용도를 강제로 006로 저장
  185. model.setValue("/root/main/appchrt/outchrtlist[" + iRow + "]/rendcd","006");
  186. }else
  187. model.setValue("/root/main/appchrt/outchrtlist[" + iRow + "]/rendcd","004");
  188. model.makeValue("/root/send/savedata", grd_outchrtlist.getUpdateData());
  189. if(submit("TXMRC01501")==true)
  190. {
  191. messageBox("선택하신 차트가","I001");
  192. }else{
  193. messageBox("선택하신 차트가","E009");
  194. }
  195. model.removeNodeset("/root/send/savedata");
  196. fOutChartList();
  197. model.refresh();
  198. }else{
  199. messageBox("대출신청할 종이차트를","C002");
  200. }
  201. }
  202. /**
  203. * @group :
  204. * @ver : 2007.12.11
  205. * @by : 이창록
  206. * @---------------------------------------------------
  207. * @type : function
  208. * @access : public
  209. * @desc : 병실에 환자 가져오기
  210. * @param :
  211. * @return :
  212. * @---------------------------------------------------
  213. */
  214. function fRoomPatList()
  215. {
  216. model.makeValue("/root/send/reqdata/room/roomcd", model.getValue("/root/othercond/room"));
  217. submit("TRMRC01503");
  218. cmb_pid.refresh();
  219. ipt_pid.value="";
  220. }
  221. /**
  222. * @group :
  223. * @ver : 2007.12.11
  224. * @by : 이창록
  225. * @---------------------------------------------------
  226. * @type : function
  227. * @access : public
  228. * @desc : 기준일자에 따른 버튼 disabled 상태변경 및 TEXT명 변경
  229. * @param :
  230. * @return :
  231. * @---------------------------------------------------
  232. */
  233. function fSelectRdoList()
  234. {
  235. var dschInddlist=model.getValue("/root/outcond/dschInddlist");
  236. if(dschInddlist=="indd")
  237. {
  238. cap_snm.text="입원기준일"
  239. btn_x_appchrt.disabled = "false";
  240. grd_outchrtlist.colHidden(10)=true;
  241. grd_outchrtlist.colHidden(7)=false;
  242. model.removeNodeset("/root/main/appchrt/outchrtlist");
  243. }else if(dschInddlist=="dschdd")
  244. {
  245. cap_snm.text="퇴원기준일"
  246. btn_x_appchrt.disabled = "true";
  247. ipt_srchfrdd.refresh();
  248. grd_outchrtlist.colHidden(10)=false;
  249. grd_outchrtlist.colHidden(7)=true;
  250. model.setValue("/root/outcond/ddlist",getCurrentDate());
  251. model.removeNodeset("/root/main/appchrt/outchrtlist");
  252. }
  253. model.refresh();
  254. }
  255. /**
  256. * @group :
  257. * @ver : 2007.12.11
  258. * @by : 이창록
  259. * @---------------------------------------------------
  260. * @type : function
  261. * @access : public
  262. * @desc :타과 차트리스트 조회
  263. * @param :
  264. * @return :
  265. * @---------------------------------------------------
  266. */
  267. function fOtherChrtList()
  268. {
  269. var pid=model.getValue("/root/othercond/pid");
  270. var indd=model.getValue("/root/init/roompatlist[ pid = '" + pid + "']/indd");
  271. var iRow = grd_otherchrtlist.row - grd_otherchrtlist.fixedRows+ 1;
  272. var instcd = getUserInfo("dutplceinstcd");
  273. model.makeValue("/root/othercond/indd",indd);
  274. model.makeValue("/root/othercond/instcd",instcd);
  275. if(submit("TRMRC01502"))
  276. {
  277. for(var i =1; i < grd_otherchrtlist.rows; i++ ) {
  278. var trgCol = grd_otherchrtlist.colRef("appdd");
  279. var rendflagCol = grd_otherchrtlist.colRef("rendflag");
  280. var appmCol = cmb_ward.value;
  281. if(grd_otherchrtlist.valueMatrix(i, trgCol) =="신청중"){
  282. grd_otherchrtlist.isReadOnly(i, rendflagCol) = true;
  283. grd_otherchrtlist.refresh();
  284. }else{
  285. if(grd_otherchrtlist.valueMatrix(i, trgCol)!=""){
  286. grd_otherchrtlist.isReadOnly(i, rendflagCol) = true;
  287. grd_otherchrtlist.refresh();
  288. }else{
  289. grd_otherchrtlist.isReadOnly(i, rendflagCol) = false;
  290. }
  291. }
  292. }
  293. }
  294. model.refresh();
  295. // 2009.06.02. 의정부인 경우.. 응급실, 건진센터 구영상 조회하기..
  296. var instcd = getUserInfo("dutplceinstcd");
  297. if (instcd == "013") {
  298. submit("TRMRC00147");
  299. var msgER = "";
  300. var msgAH = "";
  301. var dataCnt = getNodesetCnt(model, "/root/main/oldimg/oldimglist");
  302. for (var i = 1 ; i <= dataCnt ; i++)
  303. {
  304. var cls = model.getValue("/root/main/oldimg/oldimglist["+ i +"]/cls");
  305. var cnt = model.getValue("/root/main/oldimg/oldimglist["+ i +"]/cnt");
  306. // 구영상 응급의학과
  307. if (cls == "E") {
  308. msgER = "▣ 구영상 응급의학과 (" + cnt + "건)";
  309. }
  310. // 구영상 건진
  311. if (cls == "S") {
  312. msgAH = "▣ 구영상 건진 (" + cnt + "건)";
  313. }
  314. }
  315. model.setValue("/root/hidden/cap_oldimgER", msgER);
  316. cap_oldimgER.refresh();
  317. model.setValue("/root/hidden/cap_oldimgAH", msgAH);
  318. cap_oldimgAH.refresh();
  319. }
  320. }
  321. /**
  322. * @group :
  323. * @ver : 2007.12.11
  324. * @by : 이창록
  325. * @---------------------------------------------------
  326. * @type : function
  327. * @access : public
  328. * @desc :타과 차트신청
  329. * @param :
  330. * @return :
  331. * @---------------------------------------------------
  332. */
  333. function fReqotherLendChrt()
  334. {
  335. grd_otherchrtlist.clearStatus();
  336. var iRow = grd_otherchrtlist.row - grd_otherchrtlist.fixedRows + 1;
  337. var cSave = false;
  338. for ( var i= 1; i< grd_otherchrtlist.rows; i++)
  339. {
  340. var check = model.getValue("/root/main/otherchrt/otherchrtlist[" + i + "]/rendflag");
  341. var stat = model.getValue("/root/main/otherchrt/otherchrtlist[" + i + "]/stat");
  342. if(check == "true")
  343. {
  344. if(stat==""){
  345. grd_otherchrtlist.rowStatus(i) = 1;
  346. }else if(stat=="u"){
  347. grd_otherchrtlist.rowStatus(i) = 2;
  348. }
  349. cSave = true;
  350. }
  351. }
  352. if(cSave == true)
  353. {
  354. var iRow = grd_otherchrtlist.row - grd_otherchrtlist.fixedRows+ 1;
  355. var xOtherChrtListPath="/root/main/otherchrt/otherchrtlist";
  356. var ward =model.getValue("/root/othercond/ward");
  357. if (ward=="2280200000"){
  358. model.setValue("/root/main/otherchrt/otherchrtlist[" + iRow + "]/rendcd","006");
  359. }else{
  360. model.setValue("/root/main/otherchrt/otherchrtlist[" + iRow + "]/rendcd","004");
  361. }
  362. model.makeValue("/root/send/savedata", grd_otherchrtlist.getUpdateData());
  363. if(submit("TXMRC01502"))
  364. {
  365. messageBox("선택한 차트가","I001");
  366. model.removeNodeset("/root/send/savedata");
  367. fOtherChrtList();
  368. }
  369. }else{
  370. messageBox("대출신청할 차트가","I004");
  371. }
  372. model.refresh();
  373. }
  374. /**
  375. * @group :
  376. * @ver : 2007.12.11
  377. * @by : 이창록
  378. * @---------------------------------------------------
  379. * @type : function
  380. * @access : public
  381. * @desc :타과 차트 신청시 신청된 차트는 확인
  382. * @param :
  383. * @return :
  384. * @---------------------------------------------------
  385. */
  386. function fOtherRowRendflag()
  387. {
  388. if (grd_otherchrtlist.isCell(event.target)
  389. && grd_otherchrtlist.row >= grd_otherchrtlist.fixedRows){
  390. var iRow = grd_otherchrtlist.row - grd_otherchrtlist.fixedRows + 1;
  391. var outRow = grd_outchrtlist.row - grd_outchrtlist.fixedRows + 1;
  392. var Rendflag = model.getValue("/root/main/otherchrt/otherchrtlist[" + iRow + "]/rendflag");
  393. var Chrtflag = model.getValue("/root/main/otherchrt/otherchrtlist[" + iRow + "]/chrtflag");
  394. var ward = model.getValue("/root/main/otherchrt/otherchrtlist[" + iRow + "]/ward");
  395. var Otherdeptcd = model.getValue("/root/main/otherchrt/otherchrtlist[" + outRow + "]/appdeptcd");
  396. var Outdeptcd = model.getValue("/root/main/appchrt/outchrtlist[" + outRow + "]/appdeptcd");
  397. if(Chrtflag != "P")
  398. {
  399. messageBox("종이차트만 대출신청","I006");
  400. model.setValue("/root/main/otherchrt/otherchrtlist[" + iRow + "]/rendflag", "false");
  401. grd_otherchrtlist.refresh();
  402. return;
  403. }
  404. if(Rendflag=="true"){
  405. if(grd_otherchrtlist.valueMatrix(iRow,grd_otherchrtlist.colRef("appdd"))=="신청중"){
  406. var Msgchrt=messageBox("이 차트는 이미 신청된차트입니다. 그래도 ","Q004");
  407. if(Msgchrt=="7")
  408. {
  409. model.setValue("/root/main/otherchrt/otherchrtlist[" + iRow + "]/rendflag", "false");
  410. model.makeValue("/root/main/otherchrt/otherchrtlist[" + iRow + "]/appdd" , "신청중");
  411. grd_otherchrtlist.refresh();
  412. return;
  413. }else if(Msgchrt=="6")
  414. {
  415. model.setValue("/root/main/otherchrt/otherchrtlist[" + iRow + "]/rendflag" ,"true");
  416. model.setValue("/root/main/otherchrt/otherchrtlist[" + iRow + "]/appdd" ,getCurrentDate());
  417. model.makeValue("/root/main/otherchrt/otherchrtlist[" + iRow + "]/appmanid" ,getUserId());
  418. model.makeValue("/root/main/otherchrt/otherchrtlist[" + iRow + "]/appmanm" ,getUserInfo("usernm"));
  419. model.makeValue("/root/main/otherchrt/otherchrtlist[" + iRow + "]/appdeptcd",getUserInfo("dutplcecd"));
  420. model.makeValue("/root/main/otherchrt/otherchrtlist[" + iRow + "]/appdeptnm",getUserInfo("dutplcenm"));
  421. //model.makeValue("/root/main/otherchrt/otherchrtlist[" + iRow + "]/stat" ,"u");
  422. grd_otherchrtlist.refresh();
  423. }
  424. }else{
  425. model.setValue("/root/main/otherchrt/otherchrtlist[" + iRow + "]/rendflag", "true");
  426. model.setValue("/root/main/otherchrt/otherchrtlist[" + iRow + "]/appdd",getCurrentDate());
  427. }
  428. }else if(Rendflag=="false"){
  429. model.setValue("/root/main/otherchrt/otherchrtlist[" + iRow + "]/appdd" , "");
  430. model.setValue("/root/main/otherchrt/otherchrtlist[" + iRow + "]/appmanid" , "");
  431. model.setValue("/root/main/otherchrt/otherchrtlist[" + iRow + "]/appmanm" , "");
  432. model.setValue("/root/main/otherchrt/otherchrtlist[" + iRow + "]/appdeptcd", "");
  433. model.setValue("/root/main/otherchrt/otherchrtlist[" + iRow + "]/appdeptnm", "");
  434. }
  435. }
  436. model.refresh();
  437. }
  438. /**
  439. * @ver :
  440. * @desc : 입원/퇴원환자 차트 리스트 조회한 것을 엑셀에 저장
  441. * @
  442. * @by : 이창록
  443. * @param :
  444. * @return :
  445. * @---------------------------------------------------
  446. */
  447. function fChrtListSaveExcel(){
  448. var fileName = window.fileDialog("save", ",", false, "입퇴원환자차트리스트", "xls", "Excel Files(*.xls)|*.xls|All Files (*.*)|*.*");
  449. if (fileName != "")
  450. {
  451. grd_outchrtlist.saveExcel(fileName, "SheetName", false, false, "", "", "false");
  452. }
  453. }
  454. /**
  455. * @ver :
  456. * @desc : 입/퇴원환자차트 리스트 더블클릭시 환자별 차트리스트 조회
  457. * @
  458. * @by : 이창록
  459. * @param :
  460. * @return :
  461. * @---------------------------------------------------
  462. */
  463. function fPatChrtInfo(iRow){
  464. model.setValue("/root/othercond/ward" ,model.getValue("/root/main/appchrt/outchrtlist["+iRow+"]/ward"));
  465. model.setValue("/root/othercond/instcd" ,model.getValue("/root/main/appchrt/outchrtlist["+iRow+"]/instcd"));
  466. fSelectWard();
  467. model.setValue("/root/othercond/room" ,model.getValue("/root/main/appchrt/outchrtlist["+iRow+"]/roomcd"));
  468. model.setValue("/root/othercond/indd" ,model.getValue("/root/main/appchrt/outchrtlist["+iRow+"]/indd"));
  469. fRoomPatList();
  470. model.setValue("/root/othercond/pid" ,model.getValue("/root/main/appchrt/outchrtlist["+iRow+"]/pid"));
  471. fOtherChrtList();
  472. }