SMMRC00300.js 51 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525
  1. var allchkflag = "N";
  2. /**
  3. * @desc : 사용자의 권한을 체크하여 버튼셋팅.
  4. * btn_r 조회버튼, btn_x 저장 및 수정 버튼, btn_p : 출력버튼
  5. * @
  6. * @param :
  7. * @return :
  8. * @authur : 김선태 2007. 5. 8
  9. * @---------------------------------------------------
  10. */
  11. function fchkAuth()
  12. {
  13. for(var i=0; i<= document.controls.length-1 ; i++){
  14. if(document.controls.item(i).elementName == "xforms:button"){
  15. if(document.controls.item(i).attribute("id").substr(0,6) == "btn_r_"){
  16. document.controls.item(i).disabled = !checkAuth("R");
  17. }
  18. if(document.controls.item(i).attribute("id").substr(0,6) == "btn_x_"){
  19. document.controls.item(i).disabled = !checkAuth("X");
  20. }
  21. if(document.controls.item(i).attribute("id").substr(0,6) == "btn_p_"){
  22. document.controls.item(i).disabled = !checkAuth("P");
  23. }
  24. }
  25. }
  26. }
  27. /**
  28. * @desc : 폼초기화
  29. * @
  30. * @param :
  31. * @return :
  32. * @authur : 이은영 2008.06.12
  33. * @---------------------------------------------------
  34. */
  35. function fFormInit()
  36. {
  37. // KNUH_20101207_박성호_start_의무기록 부서코드 가져오기
  38. mmbfGetHardCodeInfo("/root/send/reqdata", "/root/temp/hardcd", 5501);
  39. // KNUH_20101207_박성호_end
  40. model.removeNodeset("/root/main/appchrt/appchrtlist");
  41. model.removeNodeset("/root/main/appchrt/chrtlist");
  42. model.removeNodeset("/root/main/appchrt/emrlist");
  43. model.removeNodeset("/root/main/appchrtlist");
  44. //버튼 권한 설정
  45. fchkAuth();
  46. //* 마스터 정보 가져오기..
  47. //공통코드 가져오기...
  48. //M0392:챠트미대출사유코드
  49. zbcfGetCodeList(new Array("M0392"), new Array("/root/init/M0392"));
  50. // 대출용도, 대출과, 차트과, 차트담당자, 보관장소
  51. model.makeValue("/root/send/reqdata/ioflag" , "O");
  52. model.makeValue("/root/send/reqdata/useyn" , "Y");
  53. model.makeValue("/root/send/reqdata/allwardyn", "N");
  54. submit("TRMRC00100");
  55. //*/
  56. // 2009.01.12. 대출용도 셋 조회하기.. 사용자 직종코드 구하기..
  57. // 의사 : 03, 04, 05, 06
  58. // 간호사 : 11
  59. // 연구원, 연구직 : 0750, 0751 => 의사
  60. // 조교 : 0410 => 기타
  61. var jobkindcd = getUserInfo("jobkindcd");
  62. var dutplcecd = getUserInfo("dutplcecd");
  63. // 2009.02.13. 로그인 사용자의 원과를 셋하는 것으로 수정함... (보험팀 - 2개 unit 으로 구분됨 (4070300000,4070703000)) => 일단보류
  64. // getUserInfo(Key) => "userid|usernm|posinstcd|posinstnm|posdeptcd|posdeptnm|dutplceinstcd|dutplceinstnm|dutplcecd|dutplcenm|jobkindcd|jobkindnm|jobposcd|jobposnm|jobrespcd|jobrespnm|prfshipflagcd|prfshipflagnm|licnsno|specordyn|deptabbr|orddeptflag|wardflag|systemcd|systemnm|systeminstcd|systeminstnm|logindt|kmiip|kmiport|usergrp|ipaddr|dutinstcd|dutinstnm|dutunitcd|dutunitnm|mpphonno|orginstcd|orginstnm|orgdeptcd|orgdeptnm|userkindcd|ordsupdeptcd";
  65. // var dutplcecd = getUserInfo("posdeptcd");
  66. model.makeValue("/root/send/reqdata/drflag" , "");
  67. model.makeValue("/root/send/reqdata/nursflag", "");
  68. model.makeValue("/root/send/reqdata/deptcd" , "");
  69. if (jobkindcd == "0410" ) {
  70. model.makeValue("/root/send/reqdata/deptcd" , dutplcecd);
  71. } else if (jobkindcd == "0750" || jobkindcd == "0750" ) {
  72. model.makeValue("/root/send/reqdata/drflag" , "Y");
  73. } else if (jobkindcd.substring(0,2) == "03" || jobkindcd.substring(0,2) == "04" ||
  74. jobkindcd.substring(0,2) == "05" || jobkindcd.substring(0,2) == "06" ) {
  75. model.makeValue("/root/send/reqdata/drflag" , "Y");
  76. } else if (jobkindcd.substring(0,2) == "11") {
  77. model.makeValue("/root/send/reqdata/nursflag", "Y");
  78. } else {
  79. model.makeValue("/root/send/reqdata/deptcd" , dutplcecd);
  80. }
  81. submit("TRMRC01312");
  82. var cnt = getNodesetCnt(model, "/root/init/lendset/lendsetlist");
  83. if (cnt == 1) {
  84. var setcd = model.getValue("/root/init/lendset/lendsetlist[1]/setcd");
  85. model.makeValue("/root/send/reqdata/setcd" , setcd);
  86. } else {
  87. // 기타 셋코드 : 90000000000000101
  88. model.makeValue("/root/send/reqdata/setcd" , "90000000000000101");
  89. }
  90. // 2009.01.12. 대출용도 셋 아이템 조회하기..
  91. // 2009.02.02. 보험팀인데 직종구분 [ 1140 : 간호직 ]
  92. // 2009.02.13. 보험팀 - 2개 unit 으로 구분됨 (4070300000,4070703000)
  93. if (dutplcecd == "4070300000" || dutplcecd == "4070703000") {
  94. // 보험팀 (4070300000) 전체 셋코드 : 90000000000000053
  95. model.makeValue("/root/send/reqdata/setcd" , "90000000000000053");
  96. }
  97. if (dutplcecd == "4040800000") {
  98. // 원무팀 (4040800000) 전체 셋코드 : 90000000000000054
  99. model.makeValue("/root/send/reqdata/setcd" , "90000000000000054");
  100. }
  101. // KNUH_20101207_박성호_start_의무기록 부서코드 가져오기
  102. //if (dutplcecd == "3230000000") {
  103. if(model.getValue("/root/temp/hardcd/hardcd[hardcd='" + dutplcecd + "']/hardcd") != "")
  104. {
  105. // KNUH_20101207_박성호_end
  106. // 의료정보 (3230000000) 전체 셋코드 : 90000000000000060
  107. model.makeValue("/root/send/reqdata/setcd" , "90000000000000060");
  108. }
  109. model.makeValue("/root/send/reqdata/useyn" , "Y");
  110. submit("TRMRC01313");
  111. model.setValue("/root/condition/rendschedd" , getCurrentDate());
  112. model.setValue("/root/condition/rtnschedd" , getCurrentDate());
  113. model.setValue("/root/condition/ioflag" , "O");
  114. // 2009.02.13. 보험팀 - 2개 unit 으로 구분됨 (4070300000,4070703000)
  115. /*
  116. if (dutplcecd == "4070703000"){
  117. dutplcecd = "4070300000";
  118. }
  119. */
  120. // 응급의학과 (2280000000)인 경우.. 응급실진료참고 (006)
  121. // 응급의료센터 (2280200000)인 경우.. 응급실진료참고 (006)
  122. var rendcd = model.getValue("/root/init/lendsetitem/setitemlist[lenduseyn='Y']/rendcd");
  123. if (dutplcecd == "2280200000"){
  124. dutplcecd = "2280000000";
  125. }
  126. if (dutplcecd == "2280000000" || dutplcecd == "2280200000"){
  127. rendcd = "006";
  128. }
  129. model.setValue("/root/condition/rendcd" , rendcd);
  130. var deptcd = model.getValue("/root/init/lendmastinfo/lenddeptlist[lenddeptcd='"+ dutplcecd +"']/lenddeptcd");
  131. model.setValue("/root/condition/appdeptcd" , deptcd);
  132. // 2009.03.18. 대출과가 센터인 경우 진료과 조회하기...
  133. cmb_appdeptcd.dispatch("xforms-value-changed");
  134. if (deptcd != ""){
  135. var userid = model.getValue("/root/init/userlist/userlist/usercombo[userid='"+ getUserId() +"']/userid");
  136. model.setValue("/root/condition/lendmanid" , userid);
  137. model.setValue("/root/condition/lendman" , userid);
  138. }
  139. // 응급의료센터 (2280200000)인 경우.. 대출자 : 구 응급의학과
  140. /* 2009.01.14. 대출자 셋해주는 의미가 없어짐.. 구 응급의학과는 과거 부서코드이므로..
  141. if (dutplcecd == "2280200000"){
  142. model.setValue("/root/condition/lendmanid" , "12400000");
  143. model.setValue("/root/condition/lendman" , "12400000");
  144. }
  145. */
  146. model.setValue("/root/condition/appmanid" , getUserId());
  147. model.setValue("/root/condition/appman" , getUserName());
  148. model.setValue("/root/condition/pid" , getPatientId());
  149. // 신청내역 초기값
  150. model.setValue("/root/condition/applist/apprendcd" , rendcd);
  151. model.setValue("/root/condition/applist/appdeptcd" , deptcd);
  152. model.setValue("/root/condition/applist/lendmanid" , "");
  153. model.setValue("/root/condition/applist/appmanid" , getUserId());
  154. model.setValue("/root/condition/applist/appman" , getUserName());
  155. model.setValue("/root/condition/applist/appfromdd" , getCurrentDate());
  156. model.setValue("/root/condition/applist/apptodd" , getCurrentDate());
  157. // 대출내역 초기값
  158. model.setValue("/root/condition/lendlist/appdeptcd" , deptcd);
  159. model.setValue("/root/condition/lendlist/rendfromdd" , getCurrentDate());
  160. model.setValue("/root/condition/lendlist/rendtodd" , getCurrentDate());
  161. model.setValue("/root/condition/lendlist/lendmanid" , "");
  162. model.setValue("/root/condition/lendlist/appmanid" , getUserId());
  163. model.setValue("/root/condition/lendlist/appman" , getUserName());
  164. model.setValue("/root/condition/lendlist/apprendcd" , "ALL");
  165. model.setValue("/root/condition/lendlist/appfromdd" , "19000101");
  166. model.setValue("/root/condition/lendlist/apptodd" , getCurrentDate());
  167. model.setValue("/root/condition/lendlist/termdisabled" , "");
  168. model.refresh();
  169. var pid;
  170. if (isPopup() == true) {
  171. // param 환자정보
  172. pid = opener.javascript.getParameter("pid");
  173. }
  174. if ( pid == null || pid == "" ) {
  175. // 상단 환자정보
  176. var node = getGlobalVariable("paminfo");
  177. model.removeNodeset("/root/main/result/paminfo/list");
  178. setCSVToNode("/root/main/result/paminfo", node);
  179. pid = model.getValue("/root/main/result/paminfo/list/pid");
  180. // 상단 환자정보가 있는 경우 대출자는 상단의 의사아이디로 셋함.
  181. if ( pid == null ) { pid == ""; }
  182. if ( pid != "" ) {
  183. var orddrid = model.getValue("/root/main/result/paminfo/list/orddrid");
  184. model.setValue("/root/condition/lendmanid", orddrid);
  185. }
  186. }
  187. if ( pid == null ) { pid == ""; }
  188. if ( pid != "" ) {
  189. model.setValue("/root/condition/pid", pid);
  190. fGetChrtList();
  191. }
  192. // 차트 대출 신청 텝 선택..
  193. btn_rendlsit.dispatch("onclick");
  194. if (deptcd == ""){
  195. window.alert("대출과를 선택해주세요.", "차트대출신청", 0 | 64);
  196. model.setFocus("cmb_orddept");
  197. }
  198. }
  199. /**
  200. * @desc : 차트 대출 신청 후 신청 내역 텝으로 이동하기
  201. * @
  202. * @param :
  203. * @return :
  204. * @authur : 이은영 2008.06.12
  205. * @---------------------------------------------------
  206. */
  207. function faddchrt()
  208. {
  209. btn_addlist.dispatch("onclick");
  210. }
  211. /**
  212. * @desc : 환자의 차트 리스트 조회하기
  213. * @
  214. * @param :
  215. * @return :
  216. * @authur : 이은영 2008.06.12
  217. * @---------------------------------------------------
  218. */
  219. function fGetChrtList()
  220. {
  221. // 2008.10.23. 환자번호 조회해서 환자명 가져오기..
  222. fCheckPid(ipt_pid,"/root/condition/patnm");
  223. model.copyNode("/root/send/reqdata", "/root/condition");
  224. model.makeValue("/root/send/reqdata/applist/flag" , 'P');
  225. submit("TRMRC00144");
  226. // 2008.10.29. EMR 기록 조회
  227. submit("TRMRC00145");
  228. allchkflag = "N";
  229. // 2009.06.02. 의정부인 경우.. 응급실, 건진센터 구영상 조회하기..
  230. var instcd = getUserInfo("dutplceinstcd");
  231. if (instcd == "013") {
  232. submit("TRMRC00147");
  233. var msgER = "";
  234. var msgAH = "";
  235. var dataCnt = getNodesetCnt(model, "/root/main/appchrt/oldimglist");
  236. for (var i = 1 ; i <= dataCnt ; i++)
  237. {
  238. var cls = model.getValue("/root/main/appchrt/oldimglist["+ i +"]/cls");
  239. var cnt = model.getValue("/root/main/appchrt/oldimglist["+ i +"]/cnt");
  240. // 구영상 응급의학과
  241. if (cls == "E") {
  242. msgER = "▣ 구영상 응급의학과 (" + cnt + "건)";
  243. }
  244. // 구영상 건진
  245. if (cls == "S") {
  246. msgAH = "▣ 구영상 건진 (" + cnt + "건)";
  247. }
  248. }
  249. model.setValue("/root/hidden/cap_oldimgER", msgER);
  250. cap_oldimgER.refresh();
  251. model.setValue("/root/hidden/cap_oldimgAH", msgAH);
  252. cap_oldimgAH.refresh();
  253. }
  254. }
  255. /**
  256. * @desc : 환자의 차트 리스트 대출 신청 리스트 등록
  257. * @
  258. * @param :
  259. * @return :
  260. * @authur : 이은영 2008.06.12
  261. * @---------------------------------------------------
  262. */
  263. function fAddChrtList()
  264. {
  265. var appdeptcd = model.getValue("/root/condition/appdeptcd");
  266. if (appdeptcd == ""){
  267. window.alert("대출과를 선택해주세요.", "차트대출신청", 0 | 64);
  268. model.setFocus("cmb_appdeptcd");
  269. return;
  270. }
  271. var lendmanid = model.getValue("/root/condition/lendmanid");
  272. if (lendmanid == ""){
  273. window.alert("대출자를 선택해주세요.", "차트대출신청", 0 | 64);
  274. model.setFocus("cmb_orddrid");
  275. return;
  276. }
  277. var rendcd = model.getValue("/root/condition/rendcd");
  278. if (rendcd == "-"){
  279. window.alert("대출용도을 선택해주세요.", "차트대출신청", 0 | 64);
  280. model.setFocus("cbo_renduse");
  281. return;
  282. }
  283. // 2009.03.18. 대출과가 센터인 경우 진료과 선택 체킹하기...
  284. var orddeptkind = model.getValue("/root/condition/orddeptkind");
  285. var orddeptcd = model.getValue("/root/condition/orddeptcd");
  286. if (orddeptkind == "C" && orddeptcd == "-"){
  287. window.alert("대출과가 센터인 경우 진료과를 선택해주세요.", "차트대출신청", 0 | 64);
  288. model.setFocus("cmb_orddeptcd");
  289. return;
  290. }
  291. // 2008.09.01. 차트신청시 [ 021:연구용, 022:임상연구용 ]
  292. // 전달메세지 : 반드시 전달메세지 (연구 제목 및 기타사항) 을 입력해 주십시오..
  293. if (rendcd == "021" || rendcd == "022"){
  294. var msgcnts = model.getValue("/root/condition/msgcnts");
  295. msgcnts = msgcnts.getTrimLeft();
  296. msgcnts = msgcnts.getTrimRight();
  297. if (msgcnts.length == ""){
  298. window.alert("반드시 전달메세지 (연구 제목 및 기타사항) 을 입력해 주십시오..", "차트대출신청", 0 | 64);
  299. model.setFocus("ipt_msgcnts");
  300. return;
  301. }
  302. // 팝업메세지 : 신청일 포함 3일후 대출 가능합니다..
  303. // window.alert("신청일 포함 3일후 대출 가능합니다..", "차트대출신청", 0 | 64);
  304. // 2009.02.17. 팝업메세지 수정 : 신청일로부터 3일 이후에 대출 가능합니다..
  305. window.alert("신청일로부터 3일 이후에 대출 가능합니다..", "차트대출신청", 0 | 64);
  306. }
  307. if (grd_chrtlist.rows < 1){
  308. window.alert("환자의 차트정보가 없습니다..", "차트대출신청", 0 | 64);
  309. return;
  310. }
  311. // 2009.02.05. 의사 아이디로 차트신청시 전달메세지, 연락처 항목을 필수 입력항목으로 체킹한다.
  312. // 의사 : 03, 04, 05, 06
  313. // 간호사 : 11
  314. // 연구원, 연구직 : 0750, 0751 => 의사
  315. // 조교 : 0410 => 기타
  316. var jobkindcd = getUserInfo("jobkindcd");
  317. var drflag = "N";
  318. var nursflag = "N";
  319. if (jobkindcd == "0410") {
  320. drflag = "N";
  321. } else if (jobkindcd == "0750" || jobkindcd == "0750" ) {
  322. drflag = "Y";
  323. } else if (jobkindcd.substring(0,2) == "03" || jobkindcd.substring(0,2) == "04" ||
  324. jobkindcd.substring(0,2) == "05" || jobkindcd.substring(0,2) == "06" ) {
  325. drflag = "Y";
  326. } else if (jobkindcd.substring(0,2) == "11") {
  327. nursflag = "Y";
  328. }
  329. if (drflag == "Y" || nursflag == "Y") {
  330. // 2009.03.02. 차트신청시 [ 003:접수외대출, 021:연구용, 022:임상연구용, 099:기타대출 ]
  331. // 전달메세지 : 반드시 전달메세지 (연구 제목 및 기타사항) 을 입력해 주십시오..
  332. if (rendcd == "003" || rendcd == "022" || rendcd == "021" || rendcd == "099"){
  333. var msgcnts = model.getValue("/root/condition/msgcnts");
  334. msgcnts = msgcnts.getTrimLeft();
  335. msgcnts = msgcnts.getTrimRight();
  336. if (msgcnts.length == ""){
  337. window.alert("반드시 전달메세지 (연구 제목 및 신청사유) 을 입력해 주십시오.." + jobkindcd, "차트대출신청", 0 | 64);
  338. model.setFocus("ipt_msgcnts");
  339. return;
  340. }
  341. }
  342. var appmantelno = model.getValue("/root/condition/appmantelno");
  343. appmantelno = appmantelno.getTrimLeft();
  344. appmantelno = appmantelno.getTrimRight();
  345. if (appmantelno.length == ""){
  346. window.alert("반드시 연락처를 입력해 주십시오.." + jobkindcd, "차트대출신청", 0 | 64);
  347. model.setFocus("ipt_apptelno");
  348. return;
  349. }
  350. }
  351. for( var i = 1 ; i < grd_chrtlist.rows ; i++){
  352. var chk = model.getValue("/root/main/appchrt/chrtlist["+ i +"]/chkflag");
  353. if (chk == "Y"){
  354. var pid = model.getValue("/root/main/appchrt/chrtlist["+ i +"]/pid");
  355. var pnm = model.getValue("/root/main/appchrt/chrtlist["+ i +"]/pnm");
  356. var ioflag = model.getValue("/root/main/appchrt/chrtlist["+ i +"]/ioflag");
  357. var medirecno = model.getValue("/root/main/appchrt/chrtlist["+ i +"]/medirecno");
  358. var orddeptcd = model.getValue("/root/main/appchrt/chrtlist["+ i +"]/orddeptcd");
  359. var depthngnm = model.getValue("/root/main/appchrt/chrtlist["+ i +"]/depthngnm");
  360. var deptengabbr = model.getValue("/root/main/appchrt/chrtlist["+ i +"]/deptengabbr");
  361. var lendyn = model.getValue("/root/main/appchrt/chrtlist["+ i +"]/lendyn");
  362. var lenddept = model.getValue("/root/main/appchrt/chrtlist["+ i +"]/lenddept");
  363. var tmpmedino = "";
  364. var ref = "/root/main/appchrt/appchrtlist";
  365. var cnt = getNodesetCnt(model, ref);
  366. for(var j = 1 ; j <= cnt ; j++){
  367. var tmp = model.getValue(ref + "[" + j + "]/medirecno");
  368. if(tmp == medirecno){
  369. tmpmedino = tmp;
  370. break;
  371. }
  372. }
  373. if(eval(tmpmedino) != eval(medirecno)){
  374. // 차트가 이미 대출인가??
  375. var lendyn = model.getValue("/root/main/appchrt/chrtlist["+ i +"]/lendyn");
  376. if (lendyn == "Y")
  377. {
  378. var msgRtn = messageBox("대출중입니다. 차트대출 신청", "S001");
  379. // return : yes=6, no=7, cancel=2
  380. if (msgRtn == "7") {
  381. continue;
  382. } else if (msgRtn == "2") {
  383. break;
  384. }
  385. }
  386. var addrow = cnt + 1;
  387. model.makeValue(ref + "[" + addrow + "]/pid" , pid);
  388. model.makeValue(ref + "[" + addrow + "]/pnm" , pnm);
  389. model.makeValue(ref + "[" + addrow + "]/ioflag" , ioflag);
  390. model.makeValue(ref + "[" + addrow + "]/medirecno" , medirecno);
  391. model.makeValue(ref + "[" + addrow + "]/orddeptcd" , orddeptcd);
  392. model.makeValue(ref + "[" + addrow + "]/depthngnm" , depthngnm);
  393. model.makeValue(ref + "[" + addrow + "]/deptengabbr", deptengabbr);
  394. var rendcd = model.getValue("/root/condition/rendcd");
  395. var rendschedd = model.getValue("/root/condition/rendschedd");
  396. var rtnschedd = model.getValue("/root/condition/rtnschedd");
  397. var appdeptcd = model.getValue("/root/condition/appdeptcd");
  398. // 2009.03.18. 진료과 , 센터 저장하기..
  399. var orddeptkind = model.getValue("/root/condition/orddeptkind");
  400. var centcd = "-";
  401. if (orddeptkind == "C") {
  402. centcd = model.getValue("/root/condition/appdeptcd");
  403. }
  404. var orddeptcd = model.getValue("/root/condition/orddeptcd");
  405. var lendmanid = model.getValue("/root/condition/lendmanid");
  406. var appmanid = model.getValue("/root/condition/appmanid");
  407. var appman = model.getValue("/root/condition/appman");
  408. var appmantelno = model.getValue("/root/condition/appmantelno");
  409. var msgcnts = model.getValue("/root/condition/msgcnts");
  410. var appdeptnm = model.getValue("/root/init/lendmastinfo/lenddeptlist[lenddeptcd='"+ appdeptcd +"']/lenddeptnm");
  411. var orddeptnm = model.getValue("/root/init/cntrsuborddeptlist/dept[deptcd='"+ orddeptcd +"']/depthngnm");
  412. var lendman = model.getValue("/root/init/userlist/userlist/usercombo[userid='"+ lendmanid +"']/usernm");
  413. model.makeValue(ref + "[" + addrow + "]/rendcd" , rendcd);
  414. model.makeValue(ref + "[" + addrow + "]/rendschedd" , rendschedd);
  415. model.makeValue(ref + "[" + addrow + "]/rtnschedd" , rtnschedd);
  416. model.makeValue(ref + "[" + addrow + "]/appdeptcd" , appdeptcd);
  417. model.makeValue(ref + "[" + addrow + "]/appdeptnm" , appdeptnm);
  418. model.makeValue(ref + "[" + addrow + "]/orddeptkind", orddeptkind);
  419. model.makeValue(ref + "[" + addrow + "]/centcd" , centcd);
  420. model.makeValue(ref + "[" + addrow + "]/orddeptcd" , orddeptcd);
  421. model.makeValue(ref + "[" + addrow + "]/orddeptnm" , orddeptnm);
  422. model.makeValue(ref + "[" + addrow + "]/lendmanid" , lendmanid);
  423. model.makeValue(ref + "[" + addrow + "]/lendman" , lendman);
  424. model.makeValue(ref + "[" + addrow + "]/appmanid" , appmanid);
  425. model.makeValue(ref + "[" + addrow + "]/appman" , appman);
  426. model.makeValue(ref + "[" + addrow + "]/appmantelno", appmantelno);
  427. model.makeValue(ref + "[" + addrow + "]/msgcnts" , msgcnts);
  428. }
  429. }
  430. }
  431. model.refresh();
  432. }
  433. /**
  434. * @desc : 환자의 차트 리스트 대출 신청 리스트 등록
  435. * @
  436. * @param :
  437. * @return :
  438. * @authur : 이은영 2008.06.12
  439. * @---------------------------------------------------
  440. */
  441. function fSetRtnSchedd()
  442. {
  443. // 2009.02.05. 대출용도 에 따라 전달메세지 -> 연구용제목 으로 변경한다...
  444. var rendcd = model.getValue("/root/condition/rendcd");
  445. if (rendcd == '021' || rendcd == '022') {
  446. model.setValue("/root/hidden/caption", "연구용제목 :");
  447. cap_msgcnts.refresh();
  448. } else {
  449. model.setValue("/root/hidden/caption", "전달메세지 :");
  450. cap_msgcnts.refresh();
  451. }
  452. // 반납예정일 셋해주기...
  453. var rendcd = model.getValue("/root/condition/rendcd");
  454. var rendterm = model.getValue("/root/init/lendmastinfo/rendcdlist[rendcd='"+ rendcd +"']/defltrendterm");
  455. var rendunit = model.getValue("/root/init/lendmastinfo/rendcdlist[rendcd='"+ rendcd +"']/defltrendtermunit");
  456. var rendschedd = model.getValue("/root/condition/rendschedd");
  457. var tmp = rendschedd.toDate("YYYYMMDD");
  458. var rtnschedd = tmp.getAddDate(eval(rendterm), rendunit);
  459. model.setValue("/root/condition/rtnschedd", rtnschedd.getDateFormat());
  460. ipt_rtnschedd.refresh();
  461. }
  462. /**
  463. * @desc : 차트대출 신청하기 -> 신청내역으로 화면 이동하기..
  464. * @
  465. * @param :
  466. * @return :
  467. * @authur : 이은영 2008.06.12
  468. * @---------------------------------------------------
  469. */
  470. function fSetAppChrtList()
  471. {
  472. var ref = "/root/main/appchrt/appchrtlist";
  473. var grdObj = grd_appchrtlist;
  474. var savedata = "m▦medirecno▦rendcd▦rendschedd▦rendschetm▦lendmanid▦appmanid▦apptelno▦appdeptcd▦orddeptcd▦centcd▦msgcnts▩";
  475. var dataString = "";
  476. var dataCount = 0;
  477. for ( var i=1 ; i < grdObj.rows; i++)
  478. {
  479. var medirecno = model.getValue(ref + "[" + i + "]/medirecno");
  480. var rendcd = model.getValue(ref + "[" + i + "]/rendcd");
  481. var rendschedd = model.getValue(ref + "[" + i + "]/rendschedd");
  482. var lendmanid = model.getValue(ref + "[" + i + "]/lendmanid");
  483. var appmanid = model.getValue(ref + "[" + i + "]/appmanid");
  484. var apptelno = model.getValue(ref + "[" + i + "]/appmantelno");
  485. var appdeptcd = model.getValue(ref + "[" + i + "]/appdeptcd");
  486. var centcd = model.getValue(ref + "[" + i + "]/centcd");
  487. var orddeptcd = model.getValue(ref + "[" + i + "]/orddeptcd");
  488. var msgcnts = model.getValue(ref + "[" + i + "]/msgcnts");
  489. var rendschetm = getCurrentTime();
  490. rendschetm = rendschetm.substr(0,4);
  491. dataString = dataString + "i▦" + medirecno + "▦" + rendcd + "▦" + rendschedd + "▦" + rendschetm + "▦" ;
  492. dataString = dataString + lendmanid + "▦" + appmanid + "▦" + apptelno + "▦" + appdeptcd + "▦" + orddeptcd + "▦" + centcd + "▦" + msgcnts + "▩";
  493. dataCount = dataCount + 1;
  494. }
  495. if (dataString.length > 0)
  496. {
  497. model.makeValue("/root/send/savedata", savedata + dataString);
  498. submit("TXMRC00300");
  499. alert("총 " + dataCount + " 건 챠트대출 신청되었습니다.");
  500. var appdeptcd = model.getValue("/root/condition/appdeptcd");
  501. var apprendcd = model.getValue("/root/condition/apprendcd");
  502. model.setValue("/root/condition/applist/appdeptcd" , appdeptcd);
  503. model.setValue("/root/condition/applist/apprendcd" , "ALL");
  504. // 신청 내역을 조회한다..
  505. btn_applist.dispatch("onclick");
  506. model.setValue("/root/condition/applist/lendmanid", "");
  507. model.setValue("/root/condition/applist/lendman" , "");
  508. model.setValue("/root/condition/applist/appmanid" , getUserId());
  509. model.setValue("/root/condition/applist/appman" , getUserName());
  510. model.setValue("/root/condition/applist/appfromdd", getCurrentDate());
  511. model.setValue("/root/condition/applist/apptodd" , getCurrentDate());
  512. // 신청 리스트는 지운다..
  513. model.removeNodeset("/root/main/appchrt/appchrtlist");
  514. model.refresh();
  515. btn_x_appsearch.dispatch("onclick");
  516. }
  517. }
  518. /**
  519. * @desc : 마우스 오른쪽 버튼 팝업창
  520. * @
  521. * @param :
  522. * @return :
  523. * @---------------------------------------------------
  524. *
  525. */
  526. function fMouseRghtBtnPopup(gridObj, job)
  527. {
  528. if (event.button == 3) {
  529. if (gridObj.isCell(event.target)) {
  530. if (job == "1") {
  531. // 대출신청 예정목록 에서 삭제하기..
  532. if (gridObj.row > 0) {
  533. window.setPopupMenu(true, "/root/hidden/appchrtlist_menu/menu", "label", "func", false);
  534. } else {
  535. window.setPopupMenu(false);
  536. }
  537. } else if (job == "2") {
  538. // 신청내역 리스트 에서 취소하기..
  539. if (gridObj.row > 0) {
  540. window.setPopupMenu(true, "/root/hidden/applist_menu/menu", "label", "func", false);
  541. } else {
  542. window.setPopupMenu(false);
  543. }
  544. } else if (job == "3") {
  545. // 대출신청 예정목록 에서 신청내역 수정하기..
  546. if (gridObj.row > 0) {
  547. window.setPopupMenu(true, "/root/hidden/appchrtlist_menu/menu", "label", "func", false);
  548. } else {
  549. window.setPopupMenu(false);
  550. }
  551. } else if (job == "4") {
  552. // 신청내역 리스트 에서 신청내역 수정하기..
  553. if (gridObj.row > 0) {
  554. window.setPopupMenu(true, "/root/hidden/applist_menu/menu", "label", "func", false);
  555. } else {
  556. window.setPopupMenu(false);
  557. }
  558. } else {
  559. window.setPopupMenu(false);
  560. }
  561. } else {
  562. window.setPopupMenu(false);
  563. }
  564. } else {
  565. window.setPopupMenu(false);
  566. }
  567. }
  568. /**
  569. * @desc : 대출신청 예정목록 에서 삭제하기..
  570. * @
  571. * @param :
  572. * @return :
  573. * @authur : 이은영 2008.06.12
  574. * @---------------------------------------------------
  575. */
  576. function fdel_appchrtlist()
  577. {
  578. var ref = "/root/main/appchrt/appchrtlist";
  579. //선택되어 있는 행들에 delete flag 를 설정하고 숨긴다.
  580. for(var i=0; i < grd_appchrtlist.selectedRows; i++)
  581. {
  582. var row = grd_appchrtlist.selectedRow(i);
  583. model.makeValue(ref + "["+ row +"]/chk", "N");
  584. }
  585. model.refresh();
  586. var dataCnt = getNodeSetCnt(ref);
  587. for (var i=1 ; i <= dataCnt ; i++) {
  588. var chk = model.getValue(ref + "["+ i +"]/chk");
  589. if (chk == "N") {
  590. model.destroy(ref + "["+ i +"]");
  591. dataCnt = dataCnt - 1;
  592. i = i - 1;
  593. }
  594. }
  595. model.refresh();
  596. }
  597. /**
  598. * @desc : 신청내역 리스트 에서 취소하기..
  599. * @
  600. * @param :
  601. * @return :
  602. * @authur : 이은영 2008.06.12
  603. * @---------------------------------------------------
  604. */
  605. function fcancel_applist()
  606. {
  607. var ref = "/root/main/applist";
  608. var grdObj = grd_applist;
  609. var savedata = "m▦chrtseqno▦appdd▦appmanid▦appdeptcd▦appmanallyn▩";
  610. var dataString = "";
  611. var dataCount = 0;
  612. var appdd = model.getValue("/root/condition/applist/appdd");
  613. var appdeptcd = model.getValue("/root/condition/applist/appdeptcd");
  614. var appmanid = model.getValue("/root/condition/applist/appmanid");
  615. var appmanallyn = model.getValue("/root/condition/applist/appmanallyn");
  616. //선택되어 있는 행들을 신청 취소한다...
  617. for( var i=0; i < grdObj.selectedRows; i++)
  618. {
  619. var row = grdObj.selectedRow(i);
  620. var chrtseqno = model.getValue(ref + "[" + row + "]/chrtseqno");
  621. dataString = dataString + "u▦" + chrtseqno + "▦" + appdd + "▦" + appmanid + "▦" + appdeptcd + "▦" + appmanallyn + "▩";
  622. dataCount = dataCount + 1;
  623. }
  624. if (dataString.length > 0)
  625. {
  626. model.makeValue("/root/send/savedata", savedata + dataString);
  627. submit("TXMRC00310");
  628. // fDisplayAppList();
  629. }
  630. }
  631. /**
  632. * @desc : 차트 대출 신청 내역 조회하기
  633. * @
  634. * @param :
  635. * @return :
  636. * @authur : 이은영 2008.06.12
  637. * @---------------------------------------------------
  638. */
  639. function fGetAppList()
  640. {
  641. var apprendcd = model.getValue("/root/condition/applist/apprendcd");
  642. var appdeptcd = model.getValue("/root/condition/applist/appdeptcd");
  643. var appmanid = model.getValue("/root/condition/applist/appmanid");
  644. var lendmanid = model.getValue("/root/condition/applist/lendmanid");
  645. var appfromdd = model.getValue("/root/condition/applist/appfromdd");
  646. var apptodd = model.getValue("/root/condition/applist/apptodd");
  647. model.makeValue("/root/send/reqdata/applist/apprendcd" , apprendcd);
  648. model.makeValue("/root/send/reqdata/applist/appdeptcd" , appdeptcd);
  649. model.makeValue("/root/send/reqdata/applist/appmanid" , appmanid);
  650. model.makeValue("/root/send/reqdata/applist/lendmanid" , lendmanid);
  651. model.makeValue("/root/send/reqdata/applist/appfromdd" , appfromdd);
  652. model.makeValue("/root/send/reqdata/applist/apptodd" , apptodd);
  653. model.refresh();
  654. submit("TRMRC00310");
  655. // fDisplayAppList();
  656. }
  657. /**
  658. * @desc : 차트 대출 신청 내역 디스플래이 해주기..
  659. * @
  660. * @param :
  661. * @return :
  662. * @authur : 이은영 2008.06.12
  663. * @---------------------------------------------------
  664. */
  665. function fDisplayAppList()
  666. {
  667. var grdObj = grd_applist;
  668. var ref = "/root/main/applist";
  669. // 2008.01.16. 상태에 따라 로우 색상 지정해 주기..
  670. for ( var i = 1; i < grdObj.rows; i++)
  671. {
  672. grdObj.rowstyle(i, "data", "background-color") = "#ffffff";
  673. var chrtlendyn = model.getValue(ref + "["+ i +"]/chrtlendyn");
  674. var unrendcd = model.getValue(ref + "["+ i +"]/unrendcd");
  675. var renddt = model.getValue(ref + "["+ i +"]/renddt");
  676. var delyn = model.getValue(ref + "["+ i +"]/delyn");
  677. if(chrtlendyn == "Y"){
  678. grdObj.rowstyle(i, "data", "background-color") = "#ffccff"; // 이미대출중
  679. }
  680. if(unrendcd != "00"){
  681. grdObj.rowstyle(i, "data", "background-color") = "#ffff99"; // 미대출처리
  682. }
  683. if(unrendcd != "00"){
  684. grdObj.rowstyle(i, "data", "background-color") = "#ffff99"; // 미대출처리 + 이미대출중
  685. }
  686. if(delyn != "N"){
  687. grdObj.rowstyle(i, "data", "background-color") = "#ff0000"; // 대출신청취소
  688. }
  689. if(renddt != ""){
  690. grdObj.rowstyle(i, "data", "background-color") = "#ccffcc"; // 대출완료
  691. }
  692. }
  693. }
  694. /**
  695. * @desc : 차트 대출 현황 조회하기
  696. * @
  697. * @param :
  698. * @return :
  699. * @authur : 이은영 2008.07.21
  700. * @---------------------------------------------------
  701. */
  702. function fGetLendList()
  703. {
  704. var appdeptcd = model.getValue("/root/condition/lendlist/appdeptcd");
  705. var apprendcd = model.getValue("/root/condition/lendlist/apprendcd");
  706. var lendmanid = model.getValue("/root/condition/lendlist/lendmanid");
  707. var appmanid = model.getValue("/root/condition/lendlist/appmanid");
  708. var rendfromdd = model.getValue("/root/condition/lendlist/rendfromdd");
  709. var rendtodd = model.getValue("/root/condition/lendlist/rendtodd");
  710. var appfromdd = model.getValue("/root/condition/lendlist/appfromdd");
  711. var apptodd = model.getValue("/root/condition/lendlist/apptodd");
  712. model.makeValue("/root/send/reqdata/lendlist/appdeptcd" , appdeptcd);
  713. model.makeValue("/root/send/reqdata/lendlist/apprendcd" , apprendcd);
  714. model.makeValue("/root/send/reqdata/lendlist/lendmanid" , lendmanid);
  715. model.makeValue("/root/send/reqdata/lendlist/appmanid" , appmanid);
  716. model.makeValue("/root/send/reqdata/lendlist/rendfromdd", "");
  717. model.makeValue("/root/send/reqdata/lendlist/rendtodd" , "");
  718. model.makeValue("/root/send/reqdata/lendlist/appfromdd" , appfromdd);
  719. model.makeValue("/root/send/reqdata/lendlist/apptodd" , apptodd);
  720. submit("TRMRC00320");
  721. }
  722. /**
  723. * @desc : 사용자콤보 조회
  724. * @
  725. * @param : ref - reference path
  726. * rsltref - result reference path
  727. * deptcd - 부서코드
  728. * jobkindcd - 직종코드
  729. * jobposcd - 직책코드
  730. * specordyn - 선택진료여부
  731. * @return :
  732. * @author :
  733. * @---------------------------------------------------
  734. */
  735. function fGetUserComboList(ref, rsltref, deptcd, jobkindcd, specordyn)
  736. {
  737. model.removeNode(ref);
  738. model.makeValue(ref + "/deptcd" , deptcd); //부서코드
  739. model.makeValue(ref + "/jobkindcd", jobkindcd); //직종코드(의사:0330)
  740. model.makeValue(ref + "/specordyn", specordyn); //선택진료여부
  741. model.removeNode(rsltref);
  742. model.makeValue(rsltref + "/userlist/usercombo[1]/usernm", '-');
  743. model.makeValue(rsltref + "/userlist/usercombo[1]/userid", '');
  744. model.refresh();
  745. submit("TRMMB04102", "false", ref, rsltref + "/userlist");
  746. cmb_orddrid.select(0);
  747. model.refresh();
  748. }
  749. /**
  750. * @desc : 대출자 조회
  751. * @
  752. * @param : refUserid - 대출자 ID, refUserDeptcd - 소속부서코드 ( posdeptcd )
  753. * @return :
  754. * @authur : 이은영 2008.03.18
  755. * @---------------------------------------------------
  756. */
  757. function fGetUserid(refUserid, refUsernm, refUserDeptcd, cmbObj)
  758. {
  759. model.removenode("/root/hidden/tmp/tempuserinfo/list");
  760. model.reset("/root/hidden/tmp/tempuserinfo");
  761. var user = model.getValue(refUserid);
  762. var flag = "userid";
  763. if(isNaN(user)){
  764. flag = "usernm";
  765. }
  766. model.setValue("/root/hidden/tmp/userpopupinfo/param", "_OneS");
  767. model.setValue("/root/hidden/tmp/userpopupinfo/flag", flag);
  768. model.setValue("/root/hidden/tmp/userpopupinfo/searchitem", user);
  769. modal("SPZSU10103", "", "200", "200", "SPZSU10103","/root/hidden/tmp/userpopupinfo","/root/main/temp");
  770. var iParam = getParameter("SPZSU10103_");
  771. setCSVToNode("/root/hidden/tmp/tempuserinfo", iParam);
  772. clearParameter("SPZSU10103_");
  773. model.refresh();
  774. //fSearch는 인적사항 화면을 임포트 해간 화면에서 구현해 주어야 하는 함수이다.
  775. if( getNodesetCount("/root/hidden/tmp/tempuserinfo/list") > 0 ){
  776. var userid = model.getValue("/root/hidden/tmp/tempuserinfo/list/userid");
  777. var usernm = model.getValue("/root/hidden/tmp/tempuserinfo/list/usernm");
  778. var posdeptcd = model.getValue("/root/hidden/tmp/tempuserinfo/list/posdeptcd");
  779. if (!isNull(refUsernm)){
  780. if (isNaN(refUsernm)){
  781. model.makeValue(refUsernm, usernm);
  782. }
  783. }
  784. if (!isNull(refUserDeptcd)){
  785. if (isNaN(refUserDeptcd)){
  786. model.makeValue(refUserDeptcd, posdeptcd);
  787. }
  788. }
  789. if (cmbObj != null){
  790. fAddUser(userid, usernm, cmbObj)
  791. }
  792. model.makeValue(refUserid, userid);
  793. model.refresh();
  794. }
  795. }
  796. /**
  797. * @desc : 대출자ID, 대출자명 콤보에 추가하기
  798. * @
  799. * @param : refUserid - 대출자 ID, refUsernm - 대출자명
  800. * @return :
  801. * @authur : 이은영 2008.09.01
  802. * @---------------------------------------------------
  803. */
  804. function fAddUser(Userid, Usernm, cmbObj)
  805. {
  806. var ref = cmbObj.choices.itemset.attribute("nodeset");
  807. var cnt = getNodesetCnt(model, ref) + 1;
  808. var userid = model.getValue(ref + "[userid ='" + Userid + "']/userid");
  809. if (userid == ""){
  810. model.makeValue(ref + "["+ cnt +"]/userid", Userid);
  811. model.makeValue(ref + "["+ cnt +"]/usernm", Usernm);
  812. }
  813. }
  814. /**
  815. * @desc : 등록된 환자번호인지 체킹한다..
  816. * @
  817. * @param : iptObj - 환자번호 입력 컨트롤 (pid)
  818. * @return : pnm - 환자명
  819. * @authur : 이은영 2008.03.18
  820. * @---------------------------------------------------
  821. */
  822. function fCheckPid(iptObj, refPnm)
  823. {
  824. model.makeValue("/root/send/req/srchcond", "1");
  825. model.makeValue("/root/send/req/pid", iptObj.currentText);
  826. //환자등록번호 체크
  827. if(iptObj.currentText.length > 0 ){
  828. model.resetInstanceNode("/root/main/result/patinfo");
  829. model.makeNode("/root/main/result/patinfo");
  830. if(submit("TRPMC02500", "", "/root/send/req", "/root/main/result/patinfo")){
  831. //fSearch는 인적사항 화면을 임포트 해간 화면에서 구현해 주어야 하는 함수이다.
  832. if( getNodesetCount("/root/main/result/patinfo/patinfolist") > 0 ){
  833. model.copyNode("/root/main/patinfo", "/root/main/result/patinfo");
  834. //* 2009.04.07. 이중번호 메세지 ( 14257937 박용석 -> 13275912 신옥순 )
  835. var sBindPid = model.getValue("/root/main/result/patinfo/patinfolist/bindpid");
  836. if( sBindPid != '-' && sBindPid != '' && sBindPid != ' ' ){
  837. //합번된 등록번호 메세지 처리
  838. var sPid = model.getValue("/root/main/result/patinfo/patinfolist/pid");
  839. var sHngnm = model.getValue("/root/main/result/patinfo/patinfolist/hngnm");
  840. var retValue = messageBox(sPid + " (" + sHngnm + ") 환자의 등록번호가 [ " + sBindPid + " ] 로 합번 되었습니다. 합번된 등록번호로 재조회 하시겠습니까?", "Q999", "");
  841. if( retValue == '6' ){
  842. model.makeValue(iptObj.attribute("ref"), sBindPid);
  843. iptObj.refresh();
  844. fCheckPid(iptObj, refPnm);
  845. return "";
  846. }
  847. }
  848. //*/
  849. var pid = model.getValue("/root/main/result/patinfo/patinfolist/pid");
  850. var pnm = model.getValue("/root/main/result/patinfo/patinfolist/hngnm");
  851. if (refPnm != null)
  852. {
  853. model.makeValue(refPnm, pnm);
  854. }
  855. return pnm;
  856. }else{
  857. model.resetInstanceNode("/root/main/patinfo/patinfolist");
  858. messageBox("없는 환자 번호 입니다.", "E999", "");
  859. model.refresh();
  860. return "";
  861. }
  862. }
  863. }else{
  864. messageBox("환자등록번호를 정확히", "C001");
  865. return "";
  866. }
  867. }
  868. /**
  869. * @desc : 환자등록번호 조회 팝업
  870. * @
  871. * @param : refPid - 환자번호 참고 node path
  872. * refPnm - 환자명 참고 node path
  873. * @return :
  874. * @authur : 이은영 2008.03.18
  875. * @---------------------------------------------------
  876. */
  877. function fGetPid(refPid, refPnm)
  878. {
  879. //조회건수가 1건일 경우 팝업창을 바로 닫는다.
  880. model.makeValue("/root/hidden/tmp/pidpopupinfo/checkfnexam", "1");
  881. model.makeValue("/root/hidden/tmp/pidpopupinfo/autoflag", "N");
  882. if( model.getValue("/root/hidden/tmp/pidpopupinfo/srchcond") == '' ){
  883. model.makeValue("/root/hidden/tmp/pidpopupinfo/srchcond", '2');
  884. }
  885. modal("SPPMC02500", "1","150", "150", "SPPMC02500", "/root/hidden/tmp/pidpopupinfo", "/root/send");
  886. model.resetInstanceNode("/root/source");
  887. //환자번호 copy
  888. var popupendflag = model.getValue("/root/main/popupendflag");
  889. if (popupendflag == "ok")
  890. {
  891. model.makeValue(refPid, model.getValue("/root/main/patinfo/patinfolist/pid"));
  892. if (refPnm == null) { refPnm = "" }
  893. if (refPnm != "") {
  894. model.makeValue(refPnm, model.getValue("/root/main/patinfo/patinfolist/hngnm"));
  895. }
  896. model.refresh();
  897. }
  898. }
  899. /**
  900. * @desc : 대출현황에서 신청일자 기간 콤보 보여줄까? 말까?
  901. * @
  902. * @param :
  903. * @return :
  904. * @authur : 이은영 2009.02.10
  905. * @---------------------------------------------------
  906. */
  907. function fTermDisabled(chkObj, fromddObj, toddObj)
  908. {
  909. var termdisabled = chkObj.value;
  910. if (termdisabled == "Y") {
  911. model.setValue(fromddObj.attribute("ref"), getCurrentDate());
  912. model.setValue(toddObj.attribute("ref") , getCurrentDate());
  913. fromddObj.disabled = false;
  914. toddObj.disabled = false;
  915. } else {
  916. model.setValue(fromddObj.attribute("ref"), "19000101");
  917. model.setValue(toddObj.attribute("ref") , getCurrentDate());
  918. fromddObj.disabled = true;
  919. toddObj.disabled = true;
  920. }
  921. fromddObj.refresh();
  922. toddObj.refresh();
  923. }
  924. /**
  925. * @desc : 대출신쳥 목록에서 우클릭 메뉴 일괄변경 선택시 기본셋하기..
  926. * @
  927. * @param :
  928. * @return :
  929. * @authur : 이은영 2009.02.16
  930. * @---------------------------------------------------
  931. */
  932. function fCheckFlagDisabled1()
  933. {
  934. var ref = "/root/condition/updateapplist1";
  935. model.setValue(ref + "/chkrendcd" , "");
  936. model.setValue(ref + "/chklenddeptcd" , "");
  937. model.setValue(ref + "/chkmsgcnts" , "");
  938. model.setValue(ref + "/chkappmantelno", "");
  939. cbo_renduse1.disabled = true;
  940. cbo_appdeptcd1.disabled = true;
  941. cbo_orddeptcd1.disabled = true;
  942. cbo_lendmanid1.disabled = true;
  943. ipt_msgcnts1.disabled = true;
  944. ipt_appmantelno1.disabled = true;
  945. var rendcd = model.getValue("/root/init/lendsetitem/setitemlist[lenduseyn='Y']/rendcd");
  946. model.setValue(ref + "/rendcd" , rendcd);
  947. model.setValue(ref + "/appdeptcd" , "");
  948. model.setValue(ref + "/orddeptcd" , "");
  949. model.setValue(ref + "/centcd" , "");
  950. model.setValue(ref + "/lendmanid" , "");
  951. model.setValue(ref + "/msgcnts" , "");
  952. model.setValue(ref + "/appmantelno", "");
  953. grup_updateapplist1.refresh();
  954. }
  955. /**
  956. * @desc : 대출신쳥 목록에서 우클릭 메뉴 일괄변경 선택시 기본셋하기..
  957. * @
  958. * @param :
  959. * @return :
  960. * @authur : 이은영 2009.02.16
  961. * @---------------------------------------------------
  962. */
  963. function fCheckFlagDisabled2()
  964. {
  965. var ref = "/root/condition/updateapplist2";
  966. model.setValue(ref + "/chkrendcd" , "");
  967. model.setValue(ref + "/chklenddeptcd" , "");
  968. model.setValue(ref + "/chkmsgcnts" , "");
  969. model.setValue(ref + "/chkappmantelno", "");
  970. cbo_renduse2.disabled = true;
  971. cbo_appdeptcd2.disabled = true;
  972. cbo_orddeptcd2.disabled = true;
  973. cbo_lendmanid2.disabled = true;
  974. ipt_msgcnts2.disabled = true;
  975. ipt_appmantelno2.disabled = true;
  976. var rendcd = model.getValue("/root/init/lendsetitem/setitemlist[lenduseyn='Y']/rendcd");
  977. model.setValue(ref + "/rendcd" , rendcd);
  978. model.setValue(ref + "/appdeptcd" , "");
  979. model.setValue(ref + "/orddeptcd" , "");
  980. model.setValue(ref + "/centcd" , "");
  981. model.setValue(ref + "/lendmanid" , "");
  982. model.setValue(ref + "/msgcnts" , "");
  983. model.setValue(ref + "/appmantelno", "");
  984. grup_updateapplist2.refresh();
  985. }
  986. /**
  987. * @desc : 체크여부에 따라 컨트롤 disabled 값 셋하기.. true / false
  988. * @
  989. * @param :
  990. * @return :
  991. * @authur : 이은영 2009.02.16
  992. * @---------------------------------------------------
  993. */
  994. function fDisabled(chkObj, Obj)
  995. {
  996. var disabled = chkObj.value;
  997. if (disabled == "Y") {
  998. Obj.disabled = false;
  999. } else {
  1000. Obj.disabled = true;
  1001. }
  1002. Obj.refresh();
  1003. }
  1004. /**
  1005. * @desc : 팝업폼 보여주기..
  1006. * @
  1007. * @param : job - 0:대출신청 예정목록 (일괄수정)
  1008. * @ 1:신청내역 리스트 (일괄수정)
  1009. * @return :
  1010. * @authur : 이은영 2009.02.16
  1011. * @---------------------------------------------------
  1012. */
  1013. function fShowWndIptBox(job)
  1014. {
  1015. grup_updateapplist1.visible = "false";
  1016. grup_updateapplist2.visible = "false";
  1017. if (job == "0") {
  1018. // 일괄 수정 항목 초기화..
  1019. fCheckFlagDisabled1();
  1020. // 2009.02.16. 대출신청 예정목록 (일괄수정)
  1021. if (event.clientY < 500) {
  1022. grup_updateapplist1.attribute("top") = event.clientY-100;
  1023. } else {
  1024. grup_updateapplist1.attribute("top") = 500;
  1025. }
  1026. grup_updateapplist1.visible = "true";
  1027. }
  1028. if (job == "1") {
  1029. // 일괄 수정 항목 초기화..
  1030. fCheckFlagDisabled2();
  1031. // 2009.02.16. 신청내역 리스트 (일괄수정)
  1032. if (event.clientY < 500) {
  1033. grup_updateapplist2.attribute("top") = event.clientY-100;
  1034. } else {
  1035. grup_updateapplist2.attribute("top") = 500;
  1036. }
  1037. grup_updateapplist2.visible = "true";
  1038. }
  1039. }
  1040. /**
  1041. * @desc : 대출신청 예정목록 에서 신청내역 수정하기..
  1042. * @
  1043. * @param :
  1044. * @return :
  1045. * @authur : 이은영 2009.02.16
  1046. * @---------------------------------------------------
  1047. */
  1048. function fmodify_applist()
  1049. {
  1050. if(grd_appchrtlist.row < 1){
  1051. return;
  1052. }
  1053. // 2009.02.16 대출신청 예정목록 에서 신청내역 수정하기..
  1054. fShowWndIptBox("0");
  1055. }
  1056. /**
  1057. * @desc : 신청내역 리스트 에서 신청내역 수정하기..
  1058. * @
  1059. * @param :
  1060. * @return :
  1061. * @authur : 이은영 2009.02.16
  1062. * @---------------------------------------------------
  1063. */
  1064. function fupdate_applist()
  1065. {
  1066. if(grd_applist.row < 1){
  1067. return;
  1068. }
  1069. // 2009.02.16 신청내역 리스트 에서 신청내역 수정하기..
  1070. fShowWndIptBox("1");
  1071. }
  1072. /**
  1073. * @desc : 대출신청 예정목록 에서 신청내역 수정하기..
  1074. * @
  1075. * @param :
  1076. * @return :
  1077. * @authur : 이은영 2009.02.16
  1078. * @---------------------------------------------------
  1079. */
  1080. function fModifyApplist()
  1081. {
  1082. var chkrendcd = model.getValue("/root/condition/updateapplist1/chkrendcd");
  1083. var chklenddeptcd = model.getValue("/root/condition/updateapplist1/chklenddeptcd");
  1084. var chkmsgcnts = model.getValue("/root/condition/updateapplist1/chkmsgcnts");
  1085. var chkappmantelno = model.getValue("/root/condition/updateapplist1/chkappmantelno");
  1086. var rendcd = model.getValue("/root/condition/updateapplist1/rendcd");
  1087. var appdeptcd = model.getValue("/root/condition/updateapplist1/appdeptcd");
  1088. var lendmanid = model.getValue("/root/condition/updateapplist1/lendmanid");
  1089. var msgcnts = model.getValue("/root/condition/updateapplist1/msgcnts");
  1090. var appmantelno = model.getValue("/root/condition/updateapplist1/appmantelno");
  1091. // 2009.03.18. 진료과 , 센터 저장하기..
  1092. var orddeptkind = model.getValue("/root/condition/updateapplist1/orddeptkind");
  1093. var centcd = "-";
  1094. if (orddeptkind == "C") {
  1095. centcd = model.getValue("/root/condition/updateapplist1/appdeptcd");
  1096. }
  1097. var orddeptcd = model.getValue("/root/condition/updateapplist1/orddeptcd");
  1098. // 2008.09.01. 차트신청시 [ 021:연구용, 022:임상연구용 ]
  1099. // 전달메세지 : 반드시 전달메세지 (연구 제목 및 기타사항) 을 입력해 주십시오..
  1100. if (rendcd == "021" || rendcd == "022"){
  1101. msgcnts = msgcnts.getTrimLeft();
  1102. msgcnts = msgcnts.getTrimRight();
  1103. if (msgcnts.length == ""){
  1104. window.alert("반드시 전달메세지 (연구 제목 및 기타사항) 을 입력해 주십시오..", "차트대출신청", 0 | 64);
  1105. model.setFocus("ipt_msgcnts1");
  1106. return;
  1107. }
  1108. appmantelno = appmantelno.getTrimLeft();
  1109. appmantelno = appmantelno.getTrimRight();
  1110. if (appmantelno.length == ""){
  1111. window.alert("반드시 연락처를 입력해 주십시오..", "차트대출신청", 0 | 64);
  1112. model.setFocus("ipt_appmantelno1");
  1113. return;
  1114. }
  1115. }
  1116. if (chklenddeptcd == "Y") {
  1117. if (appdeptcd == "") {
  1118. window.alert("대출과를 선택해 주십시오..", "차트대출신청", 0 | 64);
  1119. model.setFocus("cbo_appdeptcd1");
  1120. return;
  1121. }
  1122. if (lendmanid == "") {
  1123. window.alert("대출자를 선택해 주십시오..", "차트대출신청", 0 | 64);
  1124. model.setFocus("cbo_lendmanid1");
  1125. return;
  1126. }
  1127. }
  1128. // 2009.03.18. 대출과가 센터인 경우 진료과 선택 체킹하기...
  1129. var orddeptkind = model.getValue("/root/condition/updateapplist1/orddeptkind");
  1130. var orddeptcd = model.getValue("/root/condition/updateapplist1/orddeptcd");
  1131. if (orddeptkind == "C" && orddeptcd == "-"){
  1132. window.alert("대출과가 센터인 경우 진료과를 선택해주세요.", "차트대출신청", 0 | 64);
  1133. model.setFocus("cbo_orddeptcd1");
  1134. return;
  1135. }
  1136. var ref = "/root/main/appchrt/appchrtlist";
  1137. var gridObj = grd_appchrtlist;
  1138. // 선택된 항목에 대해서만 수정함..
  1139. for(var i=0; i < gridObj.selectedRows; i++)
  1140. {
  1141. var row = gridObj.selectedRow(i);
  1142. if (chkrendcd == "Y") {
  1143. model.setValue(ref + "["+ row +"]/rendcd", rendcd);
  1144. }
  1145. if (chklenddeptcd == "Y") {
  1146. model.setValue(ref + "["+ row +"]/appdeptcd" , appdeptcd);
  1147. var appdeptnm = model.getValue("/root/init/lendmastinfo/lenddeptlist[lenddeptcd ='"+ appdeptcd +"']/lenddeptnm");
  1148. model.setValue(ref + "["+ row +"]/appdeptnm" , appdeptnm);
  1149. // 2009.03.18. 진료과 , 센터 저장하기..
  1150. model.setValue(ref + "["+ row +"]/orddeptcd" , orddeptcd);
  1151. var orddeptnm = model.getValue("/root/init/cntrsuborddeptlist1/dept[deptcd ='"+ orddeptcd +"']/depthngnm");
  1152. model.setValue(ref + "["+ row +"]/orddeptnm" , orddeptnm);
  1153. model.setValue(ref + "["+ row +"]/centcd" , centcd);
  1154. model.setValue(ref + "["+ row +"]/lendmanid" , lendmanid);
  1155. var lendman = model.getValue("/root/init/userlist1/userlist/usercombo[userid ='"+ lendmanid +"']/usernm");
  1156. model.setValue(ref + "["+ row +"]/lendman" , lendman);
  1157. }
  1158. if (chkmsgcnts == "Y") {
  1159. model.setValue(ref + "["+ row +"]/msgcnts" , msgcnts);
  1160. }
  1161. if (chkappmantelno == "Y") {
  1162. model.setValue(ref + "["+ row +"]/appmantelno", appmantelno);
  1163. }
  1164. }
  1165. model.refresh();
  1166. grup_updateapplist1.visible = "false";
  1167. }
  1168. /**
  1169. * @desc : 신청내역 리스트 에서 신청내역 수정하기..
  1170. * @
  1171. * @param :
  1172. * @return :
  1173. * @authur : 이은영 2009.02.16
  1174. * @---------------------------------------------------
  1175. */
  1176. function fUpdateApplist()
  1177. {
  1178. var chkrendcd = model.getValue("/root/condition/updateapplist2/chkrendcd");
  1179. var chklenddeptcd = model.getValue("/root/condition/updateapplist2/chklenddeptcd");
  1180. var chkmsgcnts = model.getValue("/root/condition/updateapplist2/chkmsgcnts");
  1181. var chkappmantelno = model.getValue("/root/condition/updateapplist2/chkappmantelno");
  1182. var rendcd = model.getValue("/root/condition/updateapplist2/rendcd");
  1183. var appdeptcd = model.getValue("/root/condition/updateapplist2/appdeptcd");
  1184. var lendmanid = model.getValue("/root/condition/updateapplist2/lendmanid");
  1185. var msgcnts = model.getValue("/root/condition/updateapplist2/msgcnts");
  1186. var appmantelno = model.getValue("/root/condition/updateapplist2/appmantelno");
  1187. // 2009.03.18. 진료과 , 센터 저장하기..
  1188. var orddeptkind = model.getValue("/root/condition/updateapplist2/orddeptkind");
  1189. var centcd = "-";
  1190. if (orddeptkind == "C") {
  1191. centcd = model.getValue("/root/condition/updateapplist2/appdeptcd");
  1192. }
  1193. var orddeptcd = model.getValue("/root/condition/updateapplist2/orddeptcd");
  1194. // 2009.03.18. 대출과가 센터인 경우 진료과 선택 체킹하기...
  1195. if (orddeptkind == "C" && orddeptcd == "-"){
  1196. window.alert("대출과가 센터인 경우 진료과를 선택해주세요.", "차트대출신청", 0 | 64);
  1197. model.setFocus("cbo_orddeptcd2");
  1198. return;
  1199. }
  1200. // 2008.09.01. 차트신청시 [ 021:연구용, 022:임상연구용 ]
  1201. // 전달메세지 : 반드시 전달메세지 (연구 제목 및 기타사항) 을 입력해 주십시오..
  1202. if (rendcd == "021" || rendcd == "022"){
  1203. msgcnts = msgcnts.getTrimLeft();
  1204. msgcnts = msgcnts.getTrimRight();
  1205. if (msgcnts.length == ""){
  1206. window.alert("반드시 전달메세지 (연구 제목 및 기타사항) 을 입력해 주십시오..", "차트대출신청", 0 | 64);
  1207. model.setFocus("ipt_msgcnts2");
  1208. return;
  1209. }
  1210. appmantelno = appmantelno.getTrimLeft();
  1211. appmantelno = appmantelno.getTrimRight();
  1212. if (appmantelno.length == ""){
  1213. window.alert("반드시 연락처를 입력해 주십시오..", "차트대출신청", 0 | 64);
  1214. model.setFocus("ipt_appmantelno2");
  1215. return;
  1216. }
  1217. }
  1218. if (chklenddeptcd == "Y") {
  1219. if (appdeptcd == "") {
  1220. window.alert("대출과를 선택해 주십시오..", "차트대출신청", 0 | 64);
  1221. model.setFocus("cbo_appdeptcd2");
  1222. return;
  1223. }
  1224. if (lendmanid == "") {
  1225. window.alert("대출자를 선택해 주십시오..", "차트대출신청", 0 | 64);
  1226. model.setFocus("cbo_lendmanid2");
  1227. return;
  1228. }
  1229. }
  1230. // 2009.02.05. 의사 아이디로 차트신청시 전달메세지, 연락처 항목을 필수 입력항목으로 체킹한다.
  1231. // 의사 : 03, 04, 05, 06
  1232. // 간호사 : 11
  1233. // 연구원, 연구직 : 0750, 0751 => 의사
  1234. // 조교 : 0410 => 기타
  1235. var jobkindcd = getUserInfo("jobkindcd");
  1236. var drflag = "N";
  1237. var nursflag = "N";
  1238. if (jobkindcd == "0410") {
  1239. drflag = "N";
  1240. } else if (jobkindcd == "0750" || jobkindcd == "0750" ) {
  1241. drflag = "Y";
  1242. } else if (jobkindcd.substring(0,2) == "03" || jobkindcd.substring(0,2) == "04" ||
  1243. jobkindcd.substring(0,2) == "05" || jobkindcd.substring(0,2) == "06" ) {
  1244. drflag = "Y";
  1245. } else if (jobkindcd.substring(0,2) == "11") {
  1246. nursflag = "Y";
  1247. }
  1248. if (drflag == "Y" || nursflag == "Y") {
  1249. // 2009.03.02. 차트신청시 [ 003:접수외대출, 021:연구용, 022:임상연구용, 099:기타대출 ]
  1250. // 전달메세지 : 반드시 전달메세지 (연구 제목 및 기타사항) 을 입력해 주십시오..
  1251. if (rendcd == "003" || rendcd == "022" || rendcd == "021" || rendcd == "099"){
  1252. msgcnts = msgcnts.getTrimLeft();
  1253. msgcnts = msgcnts.getTrimRight();
  1254. if (msgcnts.length == ""){
  1255. window.alert("반드시 전달메세지 (연구 제목 및 신청사유) 을 입력해 주십시오.." + jobkindcd, "차트대출신청", 0 | 64);
  1256. model.setFocus("ipt_msgcnts2");
  1257. return;
  1258. }
  1259. }
  1260. if (chkappmantelno == "Y") {
  1261. appmantelno = appmantelno.getTrimLeft();
  1262. appmantelno = appmantelno.getTrimRight();
  1263. if (appmantelno.length == ""){
  1264. window.alert("반드시 연락처를 입력해 주십시오.." + jobkindcd, "차트대출신청", 0 | 64);
  1265. model.setFocus("ipt_apptelno2");
  1266. return;
  1267. }
  1268. }
  1269. }
  1270. var ref = "/root/main/applist";
  1271. var gridObj = grd_applist;
  1272. var savedata = "m▦chrtseqno▦rendcd▦appdeptcd▦lendmanid▦chkmsgcnts▦msgcnts▦chkappmantelno▦appmantelno▦orddeptcd▦centcd▩";
  1273. var dataString = "";
  1274. var dataCount = 0;
  1275. if (chkrendcd != "Y") {
  1276. rendcd = "";
  1277. }
  1278. if (chklenddeptcd != "Y") {
  1279. appdeptcd = "";
  1280. lendmanid = "";
  1281. }
  1282. // 선택되어 있는 행들을 신청 수정한다...
  1283. for( var i=0; i < gridObj.selectedRows; i++)
  1284. {
  1285. var row = gridObj.selectedRow(i);
  1286. var chrtseqno = model.getValue(ref + "[" + row + "]/chrtseqno");
  1287. dataString = dataString + "u▦" + chrtseqno + "▦" + rendcd + "▦" + appdeptcd + "▦" + lendmanid + "▦";
  1288. dataString = dataString + chkmsgcnts + "▦" + msgcnts + "▦" + chkappmantelno + "▦" + appmantelno + "▦" + orddeptcd + "▦" + centcd + "▩";
  1289. dataCount = dataCount + 1;
  1290. }
  1291. if (dataString.length > 0)
  1292. {
  1293. model.makeValue("/root/send/savedata", savedata + dataString);
  1294. submit("TXMRC00320");
  1295. // 다시 조회하기..
  1296. fGetAppList();
  1297. }
  1298. grup_updateapplist2.visible = "false";
  1299. }
  1300. /**
  1301. * @desc : excel 저장 하기
  1302. * @
  1303. * @param :
  1304. * @return :
  1305. * @authur : 이은영 2008.07.14
  1306. * @---------------------------------------------------
  1307. */
  1308. function fExcel(gridObj, title){
  1309. if (title == null) { title = "" }
  1310. var fileName = window.fileDialog("save", ",", false, title + "_" + getCurrentDate(), "xls", "Excel Files(*.xls)|*.xls|All Files (*.*)|*.*");
  1311. if (fileName != "") {
  1312. gridObj.saveExcel(fileName, "SheetName", true, true, "", "", true);
  1313. }
  1314. }
  1315. /**
  1316. * @desc : 하드코드 조회
  1317. * @
  1318. * @param : ref - reference path
  1319. * rsltref - result reference path
  1320. * hardcd - 하드코드
  1321. * @return :
  1322. * @author : 오지훈
  1323. * @---------------------------------------------------
  1324. */
  1325. function mmbfGetHardCodeInfo(ref, rsltref, hardcd){
  1326. var mmb_rsltref = "/root/hidden/mmb/hardcd";
  1327. model.removeNode(mmb_rsltref);
  1328. model.makeNode(mmb_rsltref);
  1329. model.removeNode(ref);
  1330. model.makeValue(ref + "/hardcd", hardcd);
  1331. if(submit("TRMMB04103", "false", ref, mmb_rsltref)==true){
  1332. model.copyNode(rsltref, mmb_rsltref);
  1333. model.removeNode(mmb_rsltref);
  1334. }
  1335. model.refresh();
  1336. }