SMMRC04300.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. /**
  2. * @desc : Source Node의 갯수를 구한다.
  3. * @
  4. * @param : path - node path
  5. * @return :
  6. * @authur : 김선태 2007. 5. 8
  7. * @---------------------------------------------------
  8. */
  9. function getNodeSetCnt(path)
  10. {
  11. var insXml = model.instances(0);
  12. var nodeList = insXml.selectNodes(path);
  13. return nodeList.length;
  14. }
  15. /**
  16. * @desc : Source Node의 child nodelist를 Destination의 nodelist로 append한다.
  17. *
  18. * @param : strDest - 도착node path
  19. * : strSrc - 출발node path
  20. * @return :
  21. * @authur : 이상현 2007. 3. 27
  22. * @---------------------------------------------------
  23. */
  24. function addCopyNodeset(strDest, strSrc, mode, destModel, srcModel) {
  25. if( destModel == null || destModel =="" )
  26. destModel = document.models.item(0);
  27. if( srcModel == null || srcModel =="" )
  28. srcModel = document.models.item(0);
  29. var srcNodeList = srcModel.instances(0).selectNodes(strSrc);
  30. var srcNode;
  31. var pDestNode = destModel.instances.item(0).selectSingleNode(strDest).parentNode;
  32. if( mode == "replace" || mode == null ) {
  33. destModel.removeNodeset(strDest);
  34. while( srcNode = srcNodeList.nextNode() ) {
  35. pDestNode.appendChild(srcNode.cloneNode(true));
  36. }
  37. }
  38. else if( mode == "after" ) {
  39. while( srcNode = srcNodeList.nextNode() ) {
  40. pDestNode.appendChild(srcNode.cloneNode(true));
  41. }
  42. }
  43. else if( mode == "before" ) {
  44. var destNode;
  45. for( var i = srcNodeList.length - 1; i >= 0; i-- ) {
  46. destNode = destModel.instances.item(0).selectSingleNode(strDest + "[1]");
  47. pDestNode.insertBefore(srcNodeList.item(i).cloneNode(true), destNode);
  48. }
  49. }
  50. }
  51. /**
  52. * @desc : 사용자의 권한을 체크하여 버튼셋팅.
  53. * btn_r 조회버튼, btn_x 저장 및 수정 버튼, btn_p : 출력버튼
  54. * @return :
  55. * @authur : 김선태 2007. 5. 8
  56. */
  57. function fchkAuth()
  58. {
  59. for(var i=0; i<= document.controls.length-1 ; i++){
  60. if(document.controls.item(i).elementName == "xforms:button"){
  61. if(document.controls.item(i).attribute("id").substr(0,6) == "btn_r_"){
  62. document.controls.item(i).disabled = !checkAuth("R");
  63. }
  64. if(document.controls.item(i).attribute("id").substr(0,6) == "btn_x_"){
  65. document.controls.item(i).disabled = !checkAuth("X");
  66. }
  67. if(document.controls.item(i).attribute("id").substr(0,6) == "btn_p_"){
  68. document.controls.item(i).disabled = !checkAuth("P");
  69. }
  70. }
  71. }
  72. }
  73. /**
  74. * @desc : 폼초기화
  75. * @
  76. * @param :
  77. * @return :
  78. * @authur : 이은영 2008.03.18
  79. * @---------------------------------------------------
  80. */
  81. function fFormInit()
  82. {
  83. // KNUH_20101207_박성호_start_의무기록 부서코드 가져오기
  84. mmbfGetHardCodeInfo("/root/send/reqdata", "/root/temp/basedeptcd", 5501);
  85. //mmbfGetHardCodeInfo("/root/send/reqdata", "/root/temp/appdeptcd", 5503);
  86. var basedeptcd = model.getValue("/root/temp/basedeptcd/hardcd/hardcd");
  87. //var appdeptcd = model.getValue("/root/temp/appdeptcd/hardcd/hardcd");
  88. //alert(basedeptcd + " " + appdeptcd);
  89. // KNUH_20101207_박성호_end
  90. model.setValue("/root/main/condition/basedeptcd", basedeptcd);
  91. var appdeptcd = getUserInfo("dutplcecd");
  92. model.setValue("/root/main/condition/appdeptcd", appdeptcd);
  93. // 상단환자정보 가져오기..
  94. var node = getGlobalVariable("paminfo");
  95. model.removeNodeset("/root/main/result/paminfo/list");
  96. setCSVToNode("/root/main/result/paminfo", node);
  97. // 환자등록번호
  98. var pid = model.getValue("/root/main/result/paminfo/list/pid");
  99. var pnm = model.getValue("/root/main/result/paminfo/list/hngnm");
  100. var indd = model.getValue("/root/main/result/paminfo/list/indd");
  101. var cretno = model.getValue("/root/main/result/paminfo/list/cretno");
  102. //var wardcd = model.getValue("/root/main/result/paminfo/list/wardcd");
  103. //var roomcd = model.getValue("/root/main/result/paminfo/list/roomcd");
  104. model.makeValue("/root/main/condition/pid" , pid);
  105. model.makeValue("/root/main/condition/pnm" , pnm);
  106. model.makeValue("/root/main/condition/indd" , indd);
  107. model.makeValue("/root/main/condition/cretno", cretno);
  108. //model.makeValue("/root/main/condition/wardcd", wardcd);
  109. //model.makeValue("/root/main/condition/roomcd", roomcd);
  110. model.refresh();
  111. if (pid == ""){
  112. //alert("상단의 환자정보가 없습니다");
  113. //window.close();
  114. //return;
  115. }
  116. else
  117. {
  118. // 챠트조회하기..
  119. fGetOtherLendChrtList();
  120. }
  121. /*
  122. if (isPopup() == true) {
  123. // 2008.01.08. 파라메터로 입원 병동코드,병실코드 를 받는다..(응급실에서..)
  124. // 입원 병동코드,병실코드
  125. var pid = opener.javascript.getParameter("pid");
  126. //var inwardcd = opener.javascript.getParameter("inwardcd");
  127. //var inroomcd = opener.javascript.getParameter("inroomcd");
  128. if (pid.length > 0){
  129. model.makeValue("/root/main/condition/pid" , pid);
  130. //model.makeValue("/root/main/condition/wardcd", inwardcd);
  131. //model.makeValue("/root/main/condition/roomcd", inroomcd);
  132. model.makeValue("/root/hidden/param/pid" , pid);
  133. //model.makeValue("/root/hidden/param/inwardcd", inwardcd);
  134. //model.makeValue("/root/hidden/param/inroomcd", inroomcd);
  135. model.refresh();
  136. }
  137. }
  138. */
  139. // 병동조회하기..
  140. //mmbfGetDeptCodeComboList("/root/send/reqdata", "/root/init/wardlist", "W"); //병동코드 콤보
  141. // 병실조회하기..
  142. //fSelectWard();
  143. }
  144. /**
  145. * @desc : 병동에 병실 가져오기
  146. * @
  147. * @param :
  148. * @return :
  149. * @authur : 이은영 2008.03.18
  150. * @---------------------------------------------------
  151. */
  152. function fSelectWard()
  153. {
  154. model.makeValue("/root/send/reqdata/wardcd", model.getValue("/root/main/condition/wardcd"));
  155. submit("TRMRC00051");
  156. }
  157. /**
  158. * @desc : 응급실에서 대출한 챠트 리스트 조회하기
  159. * @
  160. * @param :
  161. * @return :
  162. * @authur : 이은영 2008.03.18
  163. * @---------------------------------------------------
  164. */
  165. function fGetOtherLendChrtList()
  166. {
  167. var pid = model.getValue("/root/main/condition/pid");
  168. var appdeptcd = model.getValue("/root/main/condition/appdeptcd");
  169. model.makeValue("/root/send/reqdata/pid", pid);
  170. model.makeValue("/root/send/reqdata/appdeptcd", appdeptcd);
  171. model.refresh();
  172. if (pid.length > 0) {
  173. if (submit("TRMRC04301") == true)
  174. {
  175. var chrtseqno = model.getValue("/root/main/lendchrt/chrtinfo/chrtseqno");
  176. if (chrtseqno == "")
  177. {
  178. model.resetInstanceNode("/root/main/lendchrt/chrtlist");
  179. messageBox("차트 대출정보가 없는 환자 번호 입니다.", "E999", "");
  180. }
  181. }
  182. model.refresh();
  183. }
  184. }
  185. /**
  186. * @desc : 챠트이관
  187. * @
  188. * @param :
  189. * @return :
  190. * @authur : 이은영 2008.03.18
  191. * @---------------------------------------------------
  192. */
  193. function fSendChrt()
  194. {
  195. var ref = "/root/main/lendchrt/chrtlist";
  196. var cnt = getNodeSetCnt(ref);
  197. //var savedata = "status▦chrtseqno▦medirecno▦pid▦rtndeptcd▦rtnmanid▦indd▦cretno▦wardcd▦roomcd▦basedeptcd▩";
  198. var savedata = "chrtseqno▦medirecno▦pid▦rtndeptcd▦rtnmanid▦rtnchrtseqno▦basedeptcd▩";
  199. var dataString = "";
  200. var dataCount = 0;
  201. var rtndeptcd = getUserInfo("dutplcecd");
  202. var rtnmanid = getUserInfo("userid");
  203. var rtnchrtseqno = model.getValue("/root/main/lendchrt/chrtinfo/chrtseqno");
  204. //var indd = model.getValue("/root/main/condition/indd");
  205. //var cretno = model.getValue("/root/main/condition/cretno");
  206. //var wardcd = model.getValue("/root/main/condition/wardcd");
  207. //var roomcd = model.getValue("/root/main/condition/roomcd");
  208. var basedeptcd = model.getValue("/root/main/condition/basedeptcd");
  209. /*
  210. if (wardcd == "") {
  211. alert("보낼병동을 선택하세요."); return;
  212. }
  213. if (roomcd == "") {
  214. alert("보낼병실을 선택하세요"); return;
  215. }
  216. */
  217. var chrtseqno = model.getValue(ref + "[" + grd_chrtlist.row + "]/chrtseqno");
  218. var medirecno = model.getValue(ref + "[" + grd_chrtlist.row + "]/medirecno");
  219. var pid = model.getValue(ref + "[" + grd_chrtlist.row + "]/pid");
  220. dataString = dataString + chrtseqno + "▦" + medirecno + "▦" + pid + "▦";
  221. dataString = dataString + rtndeptcd + "▦" + rtnmanid + "▦" + rtnchrtseqno + "▦" + basedeptcd + "▩";
  222. /*
  223. for ( var i = 1; i <= cnt; i++)
  224. {
  225. var checked = model.getValue(ref + "[" + i + "]/checked");
  226. var chrtseqno = model.getValue(ref + "[" + i + "]/chrtseqno");
  227. var medirecno = model.getValue(ref + "[" + i + "]/medirecno");
  228. var pid = model.getValue(ref + "[" + i + "]/pid");
  229. if (checked == "true" && medirecno != "")
  230. {
  231. dataString = dataString + "u▦" + chrtseqno + "▦" + medirecno + "▦" + pid + "▦";
  232. dataString = dataString + rtndeptcd + "▦" + rtnmanid + "▦" + rtnchrtseqno + "▦" + indd + "▦" + cretno + "▦" + basedeptcd + "▩";
  233. dataCount = dataCount + 1;
  234. }
  235. }
  236. */
  237. if (dataString.length > 0)
  238. {
  239. model.makeValue("/root/send/savedata", savedata + dataString);
  240. submit("TXMRC04301");
  241. //alert("총 " + dataCount + " 건 챠트이관 되었습니다.");
  242. // 다시 조회하기..
  243. submit("TRMRC04301");
  244. }
  245. }
  246. /**
  247. * @desc : 환자등록번호 조회 팝업
  248. * @
  249. * @param : refPid - 환자번호 node path
  250. * @ refPnm - 환자명 node path
  251. * @return :
  252. * @authur : 이은영 2008.03.18
  253. * @---------------------------------------------------
  254. */
  255. function fGetPid(refPid, refPnm)
  256. {
  257. //조회건수가 1건일 경우 팝업창을 바로 닫는다.
  258. model.setValue("/root/hidden/tmp/pidpopupinfo/checkfnexam", "1");
  259. model.setValue("/root/hidden/tmp/pidpopupinfo/autoflag", "N");
  260. if( model.getValue("/root/hidden/tmp/pidpopupinfo/srchcond") == '' ){
  261. model.setValue("/root/hidden/tmp/pidpopupinfo/srchcond", '2');
  262. }
  263. modal("SPPMC02500", "1","150", "150", "SPPMC02500", "/root/hidden/tmp/pidpopupinfo", "/root/send");
  264. model.resetInstanceNode("/root/source");
  265. //환자번호 copy
  266. var popupendflag = model.getValue("/root/main/popupendflag");
  267. if (popupendflag == "ok")
  268. {
  269. model.setValue(refPid, model.getValue("/root/main/patinfo/patinfolist/pid"));
  270. if (refPnm != null || refPnm != "") {
  271. model.setValue(refPnm, model.getValue("/root/main/patinfo/patinfolist/hngnm"));
  272. }
  273. model.refresh();
  274. }
  275. }
  276. /**
  277. * @desc : 등록된 환자번호인지 체킹한다..
  278. * @
  279. * @param : iptObj - 환자번호 입력 컨트롤 (pid)
  280. * @return : pnm - 환자명
  281. * @authur : 이은영 2008.03.18
  282. * @---------------------------------------------------
  283. */
  284. function fCheckPid(iptObj, refPnm)
  285. {
  286. model.makeValue("/root/send/req/srchcond", "1");
  287. model.makeValue("/root/send/req/pid", iptObj.currentText);
  288. //환자등록번호 체크
  289. if(iptObj.currentText.length > 0 ){
  290. model.resetInstanceNode("/root/main/result/patinfo");
  291. model.makeNode("/root/main/result/patinfo");
  292. if(submit("TRPMC02500", "", "/root/send/req", "/root/main/result/patinfo")){
  293. //fSearch는 인적사항 화면을 임포트 해간 화면에서 구현해 주어야 하는 함수이다.
  294. if( getNodesetCount("/root/main/result/patinfo/patinfolist") > 0 ){
  295. model.copyNode("/root/main/patinfo", "/root/main/result/patinfo");
  296. //* 2009.04.07. 이중번호 메세지 ( 14257937 박용석 -> 13275912 신옥순 )
  297. var sBindPid = model.getValue("/root/main/result/patinfo/patinfolist/bindpid");
  298. if( sBindPid != '-' && sBindPid != '' && sBindPid != ' ' ){
  299. //합번된 등록번호 메세지 처리
  300. var sPid = model.getValue("/root/main/result/patinfo/patinfolist/pid");
  301. var sHngnm = model.getValue("/root/main/result/patinfo/patinfolist/hngnm");
  302. var retValue = messageBox(sPid + " (" + sHngnm + ") 환자의 등록번호가 [ " + sBindPid + " ] 로 합번 되었습니다. 합번된 등록번호로 재조회 하시겠습니까?", "Q999", "");
  303. if( retValue == '6' ){
  304. model.makeValue(iptObj.attribute("ref"), sBindPid);
  305. iptObj.refresh();
  306. fCheckPid(iptObj, refPnm);
  307. return "";
  308. }
  309. }
  310. //*/
  311. var pid = model.getValue("/root/main/result/patinfo/patinfolist/pid");
  312. var pnm = model.getValue("/root/main/result/patinfo/patinfolist/hngnm");
  313. if (refPnm != null)
  314. {
  315. model.makeValue(refPnm, pnm);
  316. }
  317. return pnm;
  318. }else{
  319. model.resetInstanceNode("/root/main/patinfo/patinfolist");
  320. messageBox("없는 환자 번호 입니다.", "E999", "");
  321. model.refresh();
  322. return "";
  323. }
  324. }
  325. }else{
  326. messageBox("환자등록번호를 정확히", "C001");
  327. return "";
  328. }
  329. }
  330. /**
  331. * @desc : 하드코드 조회
  332. * @
  333. * @param : ref - reference path
  334. * rsltref - result reference path
  335. * hardcd - 하드코드
  336. * @return :
  337. * @author : 오지훈
  338. * @---------------------------------------------------
  339. */
  340. function mmbfGetHardCodeInfo(ref, rsltref, hardcd){
  341. var mmb_rsltref = "/root/hidden/mmb/hardcd";
  342. model.removeNode(mmb_rsltref);
  343. model.makeNode(mmb_rsltref);
  344. model.removeNode(ref);
  345. model.makeValue(ref + "/hardcd", hardcd);
  346. if(submit("TRMMB04103", "false", ref, mmb_rsltref)==true){
  347. model.copyNode(rsltref, mmb_rsltref);
  348. model.removeNode(mmb_rsltref);
  349. }
  350. model.refresh();
  351. }