SMMRC02300.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  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. model.setValue("/root/main/condition/appdeptcd", appdeptcd);
  92. // 상단환자정보 가져오기..
  93. var node = getGlobalVariable("paminfo");
  94. model.removeNodeset("/root/main/result/paminfo/list");
  95. setCSVToNode("/root/main/result/paminfo", node);
  96. // 환자등록번호
  97. var pid = model.getValue("/root/main/result/paminfo/list/pid");
  98. var pnm = model.getValue("/root/main/result/paminfo/list/hngnm");
  99. var indd = model.getValue("/root/main/result/paminfo/list/indd");
  100. var cretno = model.getValue("/root/main/result/paminfo/list/cretno");
  101. var wardcd = model.getValue("/root/main/result/paminfo/list/wardcd");
  102. var roomcd = model.getValue("/root/main/result/paminfo/list/roomcd");
  103. model.makeValue("/root/main/condition/pid" , pid);
  104. model.makeValue("/root/main/condition/pnm" , pnm);
  105. model.makeValue("/root/main/condition/indd" , indd);
  106. model.makeValue("/root/main/condition/cretno", cretno);
  107. model.makeValue("/root/main/condition/wardcd", wardcd);
  108. model.makeValue("/root/main/condition/roomcd", roomcd);
  109. model.refresh();
  110. if (pid == ""){
  111. alert("상단의 환자정보가 없습니다");
  112. window.close();
  113. return;
  114. }
  115. if (isPopup() == true) {
  116. // 2008.01.08. 파라메터로 입원 병동코드,병실코드 를 받는다..(응급실에서..)
  117. // 입원 병동코드,병실코드
  118. var pid = opener.javascript.getParameter("pid");
  119. var inwardcd = opener.javascript.getParameter("inwardcd");
  120. var inroomcd = opener.javascript.getParameter("inroomcd");
  121. if (pid.length > 0){
  122. model.makeValue("/root/main/condition/pid" , pid);
  123. model.makeValue("/root/main/condition/wardcd", inwardcd);
  124. model.makeValue("/root/main/condition/roomcd", inroomcd);
  125. model.makeValue("/root/hidden/param/pid" , pid);
  126. model.makeValue("/root/hidden/param/inwardcd", inwardcd);
  127. model.makeValue("/root/hidden/param/inroomcd", inroomcd);
  128. model.refresh();
  129. }
  130. }
  131. // 병동조회하기..
  132. mmbfGetDeptCodeComboList("/root/send/reqdata", "/root/init/wardlist", "W"); //병동코드 콤보
  133. // 병실조회하기..
  134. fSelectWard();
  135. // 챠트조회하기..
  136. fGetERLendChrtList();
  137. }
  138. /**
  139. * @desc : 병동에 병실 가져오기
  140. * @
  141. * @param :
  142. * @return :
  143. * @authur : 이은영 2008.03.18
  144. * @---------------------------------------------------
  145. */
  146. function fSelectWard()
  147. {
  148. model.makeValue("/root/send/reqdata/wardcd", model.getValue("/root/main/condition/wardcd"));
  149. submit("TRMRC00051");
  150. }
  151. /**
  152. * @desc : 응급실에서 대출한 챠트 리스트 조회하기
  153. * @
  154. * @param :
  155. * @return :
  156. * @authur : 이은영 2008.03.18
  157. * @---------------------------------------------------
  158. */
  159. function fGetERLendChrtList()
  160. {
  161. var pid = model.getValue("/root/main/condition/pid");
  162. var appdeptcd = model.getValue("/root/main/condition/appdeptcd");
  163. model.makeValue("/root/send/reqdata/pid", pid);
  164. model.makeValue("/root/send/reqdata/appdeptcd", appdeptcd);
  165. model.refresh();
  166. if (pid.length > 0) {
  167. submit("TRMRC02301");
  168. }
  169. }
  170. /**
  171. * @desc : 챠트이관
  172. * @
  173. * @param :
  174. * @return :
  175. * @authur : 이은영 2008.03.18
  176. * @---------------------------------------------------
  177. */
  178. function fSendChrt()
  179. {
  180. var ref = "/root/main/lendchrt/chrtlist";
  181. var cnt = getNodeSetCnt(ref);
  182. var grdObj = grd_chrtlist;
  183. var savedata = "status▦chrtseqno▦medirecno▦pid▦rtndeptcd▦rtnmanid▦indd▦cretno▦wardcd▦roomcd▦basedeptcd▩";
  184. var dataString = "";
  185. var dataCount = 0;
  186. var rtndeptcd = getUserInfo("dutplcecd");
  187. var rtnmanid = getUserInfo("userid");
  188. var indd = model.getValue("/root/main/condition/indd");
  189. var cretno = model.getValue("/root/main/condition/cretno");
  190. var wardcd = model.getValue("/root/main/condition/wardcd");
  191. var roomcd = model.getValue("/root/main/condition/roomcd");
  192. var basedeptcd = model.getValue("/root/main/condition/basedeptcd");
  193. if (wardcd == "") {
  194. alert("보낼병동을 선택하세요."); return;
  195. }
  196. if (roomcd == "") {
  197. alert("보낼병실을 선택하세요"); return;
  198. }
  199. for ( var i = 1; i <= cnt; i++)
  200. {
  201. var checked = model.getValue(ref + "[" + i + "]/checked");
  202. var chrtseqno = model.getValue(ref + "[" + i + "]/chrtseqno");
  203. var medirecno = model.getValue(ref + "[" + i + "]/medirecno");
  204. var pid = model.getValue(ref + "[" + i + "]/pid");
  205. if (checked == "true" && medirecno != "")
  206. {
  207. dataString = dataString + "u▦" + chrtseqno + "▦" + medirecno + "▦" + pid + "▦";
  208. dataString = dataString + rtndeptcd + "▦" + rtnmanid + "▦" + indd + "▦" + cretno + "▦" + wardcd + "▦" + roomcd + "▦" + basedeptcd + "▩";
  209. dataCount = dataCount + 1;
  210. }
  211. }
  212. if (dataString.length > 0)
  213. {
  214. model.makeValue("/root/send/savedata", savedata + dataString);
  215. submit("TXMRC02301");
  216. alert("총 " + dataCount + " 건 챠트이관 되었습니다.");
  217. // 다시 조회하기..
  218. submit("TRMRC02301");
  219. }
  220. }
  221. /**
  222. * @desc : 환자등록번호 조회 팝업
  223. * @
  224. * @param : refPid - 환자번호 node path
  225. * @ refPnm - 환자명 node path
  226. * @return :
  227. * @authur : 이은영 2008.03.18
  228. * @---------------------------------------------------
  229. */
  230. function fGetPid(refPid, refPnm)
  231. {
  232. //조회건수가 1건일 경우 팝업창을 바로 닫는다.
  233. model.setValue("/root/hidden/tmp/pidpopupinfo/checkfnexam", "1");
  234. model.setValue("/root/hidden/tmp/pidpopupinfo/autoflag", "N");
  235. if( model.getValue("/root/hidden/tmp/pidpopupinfo/srchcond") == '' ){
  236. model.setValue("/root/hidden/tmp/pidpopupinfo/srchcond", '2');
  237. }
  238. modal("SPPMC02500", "1","150", "150", "SPPMC02500", "/root/hidden/tmp/pidpopupinfo", "/root/send");
  239. model.resetInstanceNode("/root/source");
  240. //환자번호 copy
  241. var popupendflag = model.getValue("/root/main/popupendflag");
  242. if (popupendflag == "ok")
  243. {
  244. model.setValue(refPid, model.getValue("/root/main/patinfo/patinfolist/pid"));
  245. if (refPnm != null || refPnm != "") {
  246. model.setValue(refPnm, model.getValue("/root/main/patinfo/patinfolist/hngnm"));
  247. }
  248. model.refresh();
  249. }
  250. }
  251. /**
  252. * @desc : 등록된 환자번호인지 체킹한다..
  253. * @
  254. * @param : iptObj - 환자번호 입력 컨트롤
  255. * @return : pnm
  256. * @authur : 이은영 2008.03.18
  257. * @---------------------------------------------------
  258. */
  259. function fCheckPid(iptObj)
  260. {
  261. setInputNodeCurText();
  262. model.makeValue("/root/send/reqdata/srchcond", "1");
  263. model.makeValue("/root/send/reqdata/pid", iptObj.currentText);
  264. //환자등록번호 체크
  265. if(iptObj.currentText.length > 0 ){
  266. model.resetInstanceNode("/root/main/result/patinfo");
  267. model.makeNode("/root/main/result/patinfo");
  268. if(submit("TRPMC02500")){
  269. //fSearch는 인적사항 화면을 임포트 해간 화면에서 구현해 주어야 하는 함수이다.
  270. if( getNodesetCount("/root/main/result/patinfo/patinfolist") > 0 ){
  271. model.copyNode("/root/main/patinfo", "/root/main/result/patinfo");
  272. var pid = model.getValue("/root/main/result/patinfo/patinfolist/pid");
  273. var pnm = model.getValue("/root/main/result/patinfo/patinfolist/hngnm");
  274. return pnm;
  275. //fSearch();
  276. }else{
  277. model.resetInstanceNode("/root/main/patinfo/patinfolist");
  278. messageBox("없는 환자 번호 입니다.", "E999", "");
  279. model.refresh();
  280. }
  281. }
  282. }else{
  283. messageBox("환자등록번호를 정확히", "C001");
  284. }
  285. return "";
  286. }
  287. /**
  288. * @desc : 하드코드 조회
  289. * @
  290. * @param : ref - reference path
  291. * rsltref - result reference path
  292. * hardcd - 하드코드
  293. * @return :
  294. * @author : 오지훈
  295. * @---------------------------------------------------
  296. */
  297. function mmbfGetHardCodeInfo(ref, rsltref, hardcd){
  298. var mmb_rsltref = "/root/hidden/mmb/hardcd";
  299. model.removeNode(mmb_rsltref);
  300. model.makeNode(mmb_rsltref);
  301. model.removeNode(ref);
  302. model.makeValue(ref + "/hardcd", hardcd);
  303. if(submit("TRMMB04103", "false", ref, mmb_rsltref)==true){
  304. model.copyNode(rsltref, mmb_rsltref);
  305. model.removeNode(mmb_rsltref);
  306. }
  307. model.refresh();
  308. }