MRF04100.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. var instance = document.models(0).instances(0);
  2. var pageInfo = new PAGEINFO();
  3. var nodelistMain = null;
  4. var nodelistTemp = null;
  5. /**
  6. * @group :
  7. * @ver : 2007.03.20
  8. * @by : ??????
  9. * @---------------------------------------------------
  10. * @type : function
  11. * @access : public
  12. * @desc : ?????? Enable / Disable
  13. * @param :
  14. * @return :
  15. * @---------------------------------------------------
  16. */
  17. function fInitialize() {
  18. model.removeNodeset("/root/main/selectdiaglist");
  19. grd_diaglist.col = 2;
  20. grd_diaglist.row = grd_diaglist.rows - 1;
  21. fAddrow();
  22. //dispOnLoadComplete("", model.getValue(pageInfo.formmastRef + "/formcd"));
  23. dispOnLoadComplete("", "0000000901");
  24. //parent.window.javascript.setParameter("loadformcd", model.getValue(pageInfo.formmastRef + "/formcd"));
  25. //parent.body.dispatch("onloadcomplete");
  26. //model.refresh();
  27. }
  28. /**
  29. * @group :
  30. * @ver : 2007.03.20
  31. * @by : ??????
  32. * @---------------------------------------------------
  33. * @type : function
  34. * @access : public
  35. * @desc : ?????? Enable / Disable
  36. * @param :
  37. * @return :
  38. * @---------------------------------------------------
  39. */
  40. function fGrdDelRow(){
  41. var iRow = grd_diaglist.row;
  42. var path = "/root/main/recinfo/grid";
  43. var nodelistJuh = instance.selectNodes(path);
  44. var nodelength = nodelistJuh.length;
  45. var smmcnts = model.getValue("/root/main/recinfo/grid[" + iRow + "]/recitem[colno='0']/rectermnm");
  46. var smmcntcd = model.getValue("/root/main/recinfo/grid[" + iRow + "]/recitem[colno='0']/rectermcd");
  47. if(nodelength > 0 && (smmcnts != "" || smmcntcd != "")){
  48. model.removeNode("/root/main/recinfo/grid[" + iRow + "]");
  49. model.removeNode("/root/tmpcc/selectdiaglist[" + iRow + "]");
  50. }
  51. var nodelist = model.instance1.selectNodes("/root/main/recinfo/grid");
  52. var totrow = nodelist.length;
  53. var irowcnt = 0;
  54. for(var i = 0; i < totrow; i++){
  55. var node = nodelist.item(i);
  56. var path1 = node.selectSingleNode("recitem[degnitemlevlcd='0000931.0000931']/rowno"); //주호소header
  57. var path2 = node.selectSingleNode("recitem[degnitemlevlcd='0000931.0000931.0000931']/rowno"); //주호소
  58. var path3 = node.selectSingleNode("recitem[degnitemlevlcd='0000931.0000931.0000168']/rowno"); //Comments
  59. var path4 = node.selectSingleNode("recitem[degnitemlevlcd='0000931.0000931.0000299']/rowno"); //발생일
  60. path1.text = irowcnt;
  61. path2.text = irowcnt;
  62. path3.text = irowcnt;
  63. path4.text = irowcnt;
  64. irowcnt++;
  65. }
  66. grd_diaglist.rebuild();
  67. //model.refresh();
  68. }
  69. /**
  70. * @group :
  71. * @ver : 2007.03.20
  72. * @by : ??????
  73. * @---------------------------------------------------
  74. * @type : function
  75. * @access : public
  76. * @desc : ?????? Enable / Disable
  77. * @param :
  78. * @return :
  79. * @---------------------------------------------------
  80. */
  81. function fClickPopUp()
  82. {
  83. setParameter("SPMRF04200_param_nodepath", "/root/tmpcc");
  84. modal("../../../emr/formngtweb/xrw/SPMRF04200_주호소팝업.xrw", 1, 0, 0, "", "", "");
  85. var dataYn = getParameter("MRF04200_DataYn");
  86. if(dataYn == "Y")
  87. {
  88. var iRow = grd_diaglist.row;
  89. var path = "/root/main/recinfo/grid";
  90. var nodelistJuh = instance.selectNodes(path);
  91. var nodelength = nodelistJuh.length;
  92. var smmcnts = model.getValue(path + "/grid[" + nodelength + "]/recitem/rectermnm");
  93. if (smmcnts == "")
  94. {
  95. model.removeNodeset("/root/main/recinfo/grid[" + nodelength + "]");
  96. model.removeNodeset("/root/main/selectdiaglist[" + nodelength + "]");
  97. grd_diaglist.refresh();
  98. }
  99. fReMakeInst();
  100. }
  101. }
  102. function fInitPage(colhide, heig, wid, ivwID)
  103. {
  104. body.attribute("height") = heig;
  105. body.attribute("width") = wid;
  106. grd_diaglist.attribute("height") = heig - 2;
  107. grd_diaglist.attribute("width") = wid - 4;
  108. grd_diaglist.extendLastCol = "scroll";
  109. if(colhide)
  110. {
  111. grd_diaglist.colhidden(0) = colhide;
  112. btn_pop.attribute("visibility") = "hidden";
  113. }
  114. if (ivwID != null && ivwID != "")
  115. gSendParentCallID = ivwID;
  116. body.refresh();
  117. }
  118. /**
  119. * @desc : 인스턴스 구조 변경
  120. * @
  121. * @param :
  122. * @return :
  123. * @---------------------------------------------------
  124. */
  125. function fReMakeInst()
  126. {
  127. var instance = document.models(0).instances(0);
  128. var iLeng = 0;
  129. var sTmpdiagcd = "";
  130. var sTmpdiagengnm = "";
  131. nodelistMain = instance.selectNodes("/root/main/selectdiaglist");
  132. nodelistTemp = instance.selectNodes("/root/tmpcc/selectdiaglist");
  133. var iMainleng = nodelistMain.length;
  134. if(nodelistTemp.length >= 1){
  135. for(var i = 1; i <= nodelistTemp.length; i++)
  136. {
  137. //debugger;
  138. sTmpdiagcd = model.getValue("/root/tmpcc/selectdiaglist[" + i + "]/termcd");
  139. sTmpdiagengnm = model.getValue("/root/tmpcc/selectdiaglist[" + i + "]/termengnm");
  140. sComments = model.getValue("/root/tmpcc/selectdiaglist[" + i + "]/comments");
  141. sTmphappendd = model.getValue("/root/tmpcc/selectdiaglist[" + i + "]/happendd");
  142. // if(sTmphappendd == "" || sTmphappendd == null)
  143. // {
  144. // sTmphappendd = '-';
  145. // }
  146. //var iFndRow = getNodesetCnt(model, "/root/main/selectdiaglist/col[reccnts='" + sTmpdiagengnm + "']");
  147. var iFndRow = getNodesetCnt(model, "/root/main/recinfo/grid/recitem[reccnts ='" + sTmpdiagengnm + "' or rectermnm ='" + sTmpdiagengnm + "']");
  148. if(iFndRow > 0){
  149. iMainleng = iMainleng - 1;
  150. }else if(iFndRow <= 0){
  151. iLeng = i + iMainleng;
  152. model.makeValue("/root/main/selectdiaglist[" + iLeng + "]/col["+ 1 + "]/rectermcd", sTmpdiagcd);
  153. model.makeValue("/root/main/selectdiaglist[" + iLeng + "]/col["+ 1 + "]/reccnts", sTmpdiagengnm);
  154. model.makeValue("/root/main/selectdiaglist[" + iLeng + "]/col["+ 1 + "]/cccnts", sComments);
  155. model.makeValue("/root/main/selectdiaglist[" + iLeng + "]/col["+ 1 + "]/cntsyn", "N");
  156. model.makeValue("/root/main/selectdiaglist[" + iLeng + "]/col["+ 1 + "]/comp", "true");
  157. model.makeValue("/root/main/selectdiaglist[" + iLeng + "]/col["+ 1 + "]/colno", "0");
  158. model.makeValue("/root/main/selectdiaglist[" + iLeng + "]/col["+ 1 + "]/ccflag", "CC");
  159. if (sTmpdiagcd != "")
  160. {
  161. model.makeValue("/root/main/selectdiaglist[" + iLeng + "]/col["+ 1 + "]/rectermflag", "004");
  162. }
  163. else
  164. {
  165. model.makeValue("/root/main/selectdiaglist[" + iLeng + "]/col["+ 1 + "]/rectermflag", "");
  166. }
  167. model.makeValue("/root/main/selectdiaglist[" + iLeng + "]/col["+ 2 + "]/rectermcd", "");
  168. model.makeValue("/root/main/selectdiaglist[" + iLeng + "]/col["+ 2 + "]/reccnts", sTmphappendd);
  169. model.makeValue("/root/main/selectdiaglist[" + iLeng + "]/col["+ 2 + "]/cntsyn", "Y");
  170. model.makeValue("/root/main/selectdiaglist[" + iLeng + "]/col["+ 2 + "]/comp", "false");
  171. model.makeValue("/root/main/selectdiaglist[" + iLeng + "]/col["+ 2 + "]/colno", "2");
  172. }
  173. }
  174. }
  175. //debugger;
  176. makeProgInstance(pageInfo, instance, nodelistMain);
  177. fAddrow();
  178. }
  179. /**
  180. * @desc : 줄추가
  181. * @
  182. * @param :
  183. * @return :
  184. * @---------------------------------------------------
  185. */
  186. function fAddrow()
  187. {
  188. var path1 = "/root/main/recinfo/grid[degnitemno = '1']";
  189. var nodelistJuh = instance.selectNodes(path1);
  190. var nodelength = nodelistJuh.length;
  191. var path2 = "/root/main/recinfo/grid[degnitemno = '1'][" + nodelength + "]";
  192. copyNodeset("/root/tmp", path2, "replace", model, model);
  193. var smmcnts = model.getValue("/root/tmp/recitem[colno='0']/rectermnm");
  194. if(smmcnts != "" || nodelength == 0)
  195. {
  196. model.makeValue("/root/main/selectdiaglist[" + 1 + "]/col["+ 1 + "]/rectermcd", "");
  197. model.makeValue("/root/main/selectdiaglist[" + 1 + "]/col["+ 1 + "]/reccnts", "-");
  198. model.makeValue("/root/main/selectdiaglist[" + 1 + "]/col["+ 1 + "]/cccnts", "");
  199. model.makeValue("/root/main/selectdiaglist[" + 1 + "]/col["+ 1 + "]/cntsyn", "N");
  200. model.makeValue("/root/main/selectdiaglist[" + 1 + "]/col["+ 1 + "]/comp", "true");
  201. model.makeValue("/root/main/selectdiaglist[" + 1 + "]/col["+ 1 + "]/colno", "0");
  202. model.makeValue("/root/main/selectdiaglist[" + 1 + "]/col["+ 1 + "]/ccflag", "CC");
  203. model.makeValue("/root/main/selectdiaglist[" + 1 + "]/col["+ 1 + "]/rectermflag", "");
  204. model.makeValue("/root/main/selectdiaglist[" + 1 + "]/col["+ 2 + "]/rectermcd", "");
  205. model.makeValue("/root/main/selectdiaglist[" + 1 + "]/col["+ 2 + "]/reccnts", "");
  206. model.makeValue("/root/main/selectdiaglist[" + 1 + "]/col["+ 2 + "]/cntsyn", "Y");
  207. model.makeValue("/root/main/selectdiaglist[" + 1 + "]/col["+ 2 + "]/comp", "false");
  208. model.makeValue("/root/main/selectdiaglist[" + 1 + "]/col["+ 2 + "]/colno", "2");
  209. nodelistMain = instance.selectNodes("/root/main/selectdiaglist");
  210. makeProgInstance(pageInfo, instance, nodelistMain);
  211. // grd_diaglist.row = nodelength + 1;
  212. // grd_diaglist.col = 2;
  213. // grd_diaglist.editCell();
  214. grd_diaglist.refresh();
  215. }
  216. }
  217. /**
  218. * @desc : 편집 후 termcd가 없는 경우 '-'를 넣어줌(저장문제)
  219. * @
  220. * @param :
  221. * @return :
  222. * @---------------------------------------------------
  223. */
  224. function fEndEdit()
  225. {
  226. //debugger;
  227. var path1 = "/root/main/recinfo/grid[degnitemno = '1']";
  228. var nodelistJuh = instance.selectNodes(path1);
  229. var nodelength = nodelistJuh.length;
  230. var smmcnts = model.getValue("/root/main/recinfo/grid[degnitemno = '1'][" + nodelength + "]/recitem[colno='0']/rectermnm");
  231. if(smmcnts != "")
  232. {
  233. model.setValue("/root/main/recinfo/grid[degnitemno = '1'][" + nodelength + "]/recitem[colno='0']/rectermcd", "-");
  234. }
  235. var sCcnm = model.getValue("/root/main/recinfo/grid[degnitemno = '1'][" + grd_diaglist.row + "]/recitem[colno='0']/rectermnm");
  236. if (sCcnm == "")
  237. {
  238. fGrdDelRow();
  239. }
  240. }
  241. /**
  242. * @desc : 저장전 검사
  243. * @
  244. * @param :
  245. * @return :
  246. * @---------------------------------------------------
  247. */
  248. function fChkGrdPreSave()
  249. {
  250. var path = "/root/main/recinfo/recitem[degnitemno = '1']";
  251. var nodelistJuh = instance.selectNodes(path);
  252. var nodelength = (nodelistJuh.length);
  253. var smmcnts = "";
  254. var comment = "";
  255. var happendd = "";
  256. var sMsg = "";
  257. var rtn = true;
  258. for (var i = 1; i <= nodelength; i++)
  259. {
  260. smmcnts = model.getValue(path + "[" + i + "]/recitem[colno='0']/rectermnm");
  261. comment = model.getValue(path + "[" + i + "]/recitem[colno='0']/reccnts");
  262. happendd = model.getValue(path + "[" + i + "]/recitem[colno='2']/reccnts");
  263. if ((comment != "" || happendd != "") && smmcnts == "")
  264. {
  265. var sMsg = "주호소는";
  266. }
  267. }
  268. if(sMsg != "")
  269. {
  270. messageBox(sMsg, "I003");
  271. rtn = false;
  272. }
  273. return rtn;
  274. }
  275. /**
  276. * @desc : 상용구 팝업
  277. * @id :
  278. * @event : DOMActivate
  279. * @return : void
  280. * @authur : 박종훈
  281. */
  282. function fPopCommUse()
  283. {
  284. setParameter("comn_chosflag", "C") // C : 상용구
  285. setParameter("comn_formprogflag", "B") // A: Summary, B : 주호소
  286. setParameter("openmode", "select");
  287. // 새로운 상용구 관리 Param 추가
  288. setParameter("deptflag", "U");
  289. //modal("SPMRF04700");
  290. var pageInfo = new PAGEINFO();
  291. //var grdNodeList = findNodeset(model, "/root/main/recinfo/grid[degnitemlevlcd = '0000931']");
  292. //var fstlevlitemcd = model.getValue(pageInfo.recItemRef + "[degnitemno='" + degnitemno + "']/fstlevlitemcd");
  293. setParameter("comn_degnitemcd", "0000931");
  294. setParameter("comn_srcformcd", "0000000901");
  295. modal("SPMRF04900",1 ,50, 50);
  296. var rtn = getParameter("comncnts"); //내용
  297. setParameter("comncnts", "");
  298. var grdNodeList = findNodeset(model, "/root/main/recinfo/grid[degnitemno = '1']");
  299. var rowno = grd_diaglist.row -1;
  300. var grdNode = "";
  301. var recitemNodelist = "";
  302. var recitemNode = "";
  303. var reccnts = "";
  304. var subnode = "";
  305. grdNode = grdNodeList.item(rowno);
  306. recitemNodelist = grdNode.selectSingleNode("recitem[colno='0']");
  307. if(recitemNodelist != null)
  308. {
  309. reccnts = recitemNodelist.selectSingleNode("rectermnm").text;
  310. }
  311. if (rtn == "")
  312. {
  313. return;
  314. }
  315. if (reccnts == "")
  316. {
  317. recitemNodelist.selectSingleNode("rectermnm'").text = rtn;
  318. fEndEdit();
  319. fAddrow();
  320. }
  321. else
  322. {
  323. recitemNodelist.selectSingleNode("rectermnm").text = reccnts + " " + rtn;
  324. }
  325. model.refresh();
  326. }