SMMRD01600.js 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043
  1. /**
  2. - ▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩
  3. 의료정보 - 연구용검색 ( SMMRD01600_연구용검색.xrw - JScript )
  4. - Version :
  5. 1) : Ver.1.00.00
  6. - Author : 강지훈
  7. - ▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩
  8. **/
  9. var xDschAnalyListPath = "/root/main/cond";
  10. /**
  11. * @ver : 2009-01-02
  12. * @desc : 화면초기화
  13. * @
  14. * @by : 강지훈
  15. * @param :
  16. * @return :
  17. * @---------------------------------------------------
  18. */
  19. function fInitialize(){
  20. btn_cond.selected = true;
  21. //퇴원일은 기본조건으로 10년치 초기화 한다
  22. var dschfromdd = (getCurrentDate().substring(0,4) - 10)+getCurrentDate().substring(4,8);
  23. //테스트위해 임시수정
  24. ipt_fromdd.value = dschfromdd;
  25. //ipt_fromdd.value = getCurrentDate();
  26. ipt_todd.value = getCurrentDate();
  27. //엑셀출력을 위한 기관코드 설정
  28. model.setValue("/root/main/cond/instcd", getUserInfo("dutplceinstcd"));
  29. //퇴원병동 설정
  30. submit("TRMNW00101");
  31. model.removenode("/root/init/init/ward[wardcd = '']"); // 응급의료센터 제외
  32. //과정보 설정
  33. mmbfGetDeptCodeComboList("/root/send/reqdata", "/root/init/orddept", "T");
  34. //공통코드 설정
  35. zbcfGetCodeList(new Array("M0149", "M0070", "M0151", "M0153",
  36. "M0155","M0152","M0157","M0156",
  37. "M0158","M0159","M0086","M0165",
  38. "P0008","M0413","M0484","M0414",
  39. "M0433","M0184","M0155","M0500",
  40. "M0501","M0502","M0503", "M0415"),
  41. new Array("/root/init/jobList", "/root/init/relignList", "/root/init/maryStatList", "/root/init/inPathList",
  42. "/root/init/dethTypeList","/root/init/cureRsltList" ,"/root/init/DschTypeList","/root/init/chosProgList",
  43. "/root/init/reInResnList","/root/init/reOpResnList","/root/init/partrtntypeList","/root/init/womntypeList",
  44. "/root/init/insukindList","/root/init/opDethTypeList","/root/init/infccaselist","/root/init/cmpllist",
  45. "/root/init/cncrlist", "/root/init/seer", "/root/init/staging", "/root/init/mdclrsdeptlist",
  46. "/root/init/gsclrsdeptlist", "/root/init/gyclrsdeptlist", "/root/init/pdclrsdeptlist", "/root/init/wundcasclslist")
  47. , true);
  48. // 중환자실 코드 설정
  49. model.makeValue("/root/send/stnddd", getCurrentDate() );
  50. if(submit("TRMRD00404", false)){
  51. copyNodesetType("/root/init/icudeptlist/icudept","/root/temp/initlist/icudept","replace", model, model);
  52. }
  53. //지표관리 코드 설정
  54. submit("TRMRD01603");
  55. // 초기 선택값 셋팅
  56. addComboItem("cmb_dschclsdept" , "전체", "-", "above");
  57. addComboItem("cmb_inclsdept" , "전체", "-", "above");
  58. addComboItem("cmb_opclsdept" , "전체", "-", "above");
  59. addComboItem("cmb_chngclsdept" , "전체", "-", "above");
  60. addComboItem("cmb_dschdeptcd" , "전체", "-", "above");
  61. addComboItem("cmb_dschwardnm" , "전체", "-", "above");
  62. addComboItem("cmb_religncd" , "전체", "-", "above");
  63. addComboItem("cmb_marystatcd" , "전체", "-", "above");
  64. addComboItem("cmb_jobcd" , "전체", "-", "above");
  65. addComboItem("cmb_insukind" , "전체", "-", "above");
  66. addComboItem("cmb_curersltcd" , "전체", "-", "above");
  67. addComboItem("cmb_dethtypecd" , "전체", "-", "above");
  68. addComboItem("cmb_dschtypecd" , "전체", "-", "above");
  69. addComboItem("cmb_opdethtypecd" , "전체", "-", "above");
  70. addComboItem("cmb_chosprogcd" , "전체", "-", "above");
  71. addComboItem("cmb_reinresncd" , "전체", "-", "above");
  72. addComboItem("cmb_inpathcd" , "전체", "-", "above");
  73. addComboItem("cmb_reopresncd" , "전체", "-", "above");
  74. addComboItem("cmb_infccascd" , "전체", "-", "above");
  75. addComboItem("cmb_cmplcd" , "전체", "-", "above");
  76. addComboItem("cmb_icuroomcd" , "전체", "-", "above");
  77. addComboItem("cmb_infcpartcd" , "전체", "-", "above");
  78. addComboItem("cmb_womntypeList" , "전체", "-", "above");
  79. addComboItem("cmb_partrtntypeList" , "전체", "-", "above");
  80. addComboItem("cmb_seer" , "전체", "-", "above");
  81. addComboItem("cmb_cncrflag" , "전체", "-", "above");
  82. addComboItem("cmb_wundcasclscd" , "전체", "-", "above");
  83. model.setValue("/root/main/cond/dschwardnm" , "-");
  84. model.setValue("/root/main/cond/dschdeptcd" , "-");
  85. model.setValue("/root/main/cond/dschclsdept" , "-");
  86. model.setValue("/root/main/cond/indeptcd" , "-");
  87. model.setValue("/root/main/cond/inclsdept" , "-");
  88. model.setValue("/root/main/cond/opdeptcd" , "-");
  89. model.setValue("/root/main/cond/opclsdept" , "-");
  90. model.setValue("/root/main/cond/chngdeptcd" , "-");
  91. model.setValue("/root/main/cond/chngclsdept" , "-");
  92. model.setValue("/root/main/cond/cnstreqdeptcd" , "-");
  93. model.setValue("/root/main/cond/cnstclsdept" , "-");
  94. model.setValue("/root/main/cond/cnstexecdeptcd" , "-");
  95. model.setValue("/root/main/cond/cnstexeclrsdeptcd" , "-");
  96. model.setValue("/root/main/cond/religncd" , "-");
  97. model.setValue("/root/main/cond/marystatcd" , "-");
  98. model.setValue("/root/main/cond/jobcd" , "-");
  99. model.setValue("/root/main/cond/insukind" , "-");
  100. model.setValue("/root/main/cond/cptrgt" , "-");
  101. model.setValue("/root/main/cond/wundcasclscd" , "-");
  102. model.setValue("/root/main/cond/curersltcd" , "-");
  103. model.setValue("/root/main/cond/dethtypecd" , "-");
  104. model.setValue("/root/main/cond/dschtypecd" , "-");
  105. model.setValue("/root/main/cond/opdethtypecd" , "-");
  106. model.setValue("/root/main/cond/chosprogcd" , "-");
  107. model.setValue("/root/main/cond/reinresncd" , "-");
  108. model.setValue("/root/main/cond/inpathcd" , "-");
  109. model.setValue("/root/main/cond/reopresncd" , "-");
  110. model.setValue("/root/main/cond/infccascd" , "-");
  111. model.setValue("/root/main/cond/cmplcd" , "-");
  112. model.setValue("/root/main/cond/icuroomcd" , "-");
  113. model.setValue("/root/main/cond/reinyn" , "-");
  114. model.setValue("/root/main/cond/infcpartcd" , "-");
  115. model.setValue("/root/main/cond/womntypecd" , "-");
  116. model.setValue("/root/main/cond/partrtnkindcd" , "-");
  117. model.setValue("/root/main/cond/seer" , "-");
  118. model.setValue("/root/main/cond/staging" , "-");
  119. model.setValue("/root/main/cond/cncrflag" , "-");
  120. //그리드의 인스턴스를 삭제한다.
  121. model.removeNodeset("/root/main/cclist");
  122. model.removeNodeset("/root/main/diagcdlist");
  123. model.removeNodeset("/root/main/opcdlist");
  124. model.removeNodeset("/root/main/chngcdlist");
  125. model.removeNodeset("/root/main/cnstcdlist");
  126. model.removeNodeset("/root/main/bfcdlist");
  127. model.removeNodeset("/root/main/mdlcdlist");
  128. model.removeNodeset("/root/main/directcdlist");
  129. model.removeNodeset("/root/main/tcdlist");
  130. model.removeNodeset("/root/main/mcdlist");
  131. model.removeNodeset("/root/main/metstascdlist");
  132. model.refresh();
  133. }
  134. /**
  135. * @desc : 의사조회
  136. * @id :
  137. * @event : DOMActivate
  138. * @return : void
  139. * @authur :
  140. */
  141. function fDrSearch(drid, drnm){
  142. model.resetInstanceNode("/root/main/userpopupinfo");
  143. model.removeNodeset("/root/main/tempuserinfo");
  144. model.makeNode("/root/main/tempuserinfo");
  145. model.removeNode("/root/send/userinfo/userid");
  146. model.makeNode("/root/send/userinfo/userid");
  147. model.setValue("/root/main/userpopupinfo/param", "_OneS_DD");
  148. modal("SPMRD01601_사용자부서선택조회", "", "200", "200", "SPMRD01601","/root/main/userpopupinfo","/root/main/temp");
  149. var iParam = getParameter("SPMRD01601_");
  150. setCSVToNode("/root/main/tempuserinfo", iParam);
  151. clearParameter("SPMRD01601_");
  152. var emplno = model.getValue("/root/main/tempuserinfo/list/userid");
  153. var empInm = model.getValue("/root/main/tempuserinfo/list/usernm");
  154. model.setValue("/root/main/cond/" + drid, emplno);
  155. model.setValue("/root/main/cond/" + drnm, empInm);
  156. model.refresh();
  157. }
  158. /**
  159. * @desc : 항목별 입력 여부 체크
  160. * @id :
  161. * @event : xforms-select
  162. * @return : void
  163. * @authur :
  164. */
  165. function fCheckItemInputYN(pFlag){
  166. // 치료결과 체크
  167. if(pFlag == "curerslt" || pFlag == null){
  168. var sCureRsltCD = model.getValue(xDschAnalyListPath+"/curersltcd");
  169. if(sCureRsltCD == "07" || sCureRsltCD == "08"){
  170. cmb_dethtypecd.disabled = false;
  171. cmb_opdethtypecd.disabled = false;
  172. }else{
  173. cmb_dethtypecd.disabled = true;
  174. cmb_opdethtypecd.disabled = true;
  175. model.makeValue(xDschAnalyListPath+"/dethtypecd","-");
  176. }
  177. }
  178. // 재입원(Unplan) 체크
  179. if(pFlag == "reinresn" || pFlag == null){
  180. var sReInResnCd = model.getValue(xDschAnalyListPath+"/reinresncd");
  181. if(sReInResnCd != ""){
  182. model.setValue(xDschAnalyListPath+"/reinyn","-");
  183. cmb_reinyn.disabled = true;
  184. }else{
  185. cmb_reinyn.disabled = false;
  186. }
  187. }
  188. // 재입원(plan) 체크
  189. if(pFlag == "reinyn" || pFlag == null){
  190. var ReInYN = model.getValue(xDschAnalyListPath+"/reinyn");
  191. if(ReInYN=="01"){
  192. model.setValue(xDschAnalyListPath+"/reinresncd","-");
  193. cmb_reinresncd.disabled = true;
  194. cmb_reinresncd.refresh();
  195. }else{
  196. cmb_reinresncd.disabled = false;
  197. cmb_reinresncd.refresh();
  198. }
  199. }
  200. // 감염종류1 선택
  201. if(pFlag == "infccascd" || pFlag == null){
  202. var code = model.getValue(xDschAnalyListPath+"/infccascd");
  203. fGetInFcCas(code);
  204. cmb_infcpartcd.refresh();
  205. addComboItem("cmb_infcpartcd" , "전체", "-", "above");
  206. model.setValue(xDschAnalyListPath+"/infcpartcd","-");
  207. model.refresh();
  208. }
  209. }
  210. /**
  211. * @ver : 2009-01-02
  212. * @desc : 감염종류1의 감염종류2의 하부항목들 조회
  213. * @by : 강지훈
  214. * @param :
  215. * @return :
  216. * @---------------------------------------------------
  217. */
  218. function fGetInFcCas(code){
  219. switch(code){
  220. case "-":
  221. model.removeNodeset("/root/init/infdcpartinfo/infdcpartlist");
  222. break;
  223. case "01":
  224. zbcfGetCodeList(new Array("M0485"), new Array("/root/hidden/infdcpartinfo/infdcpartlist"));
  225. copyNodeset("/root/init/infdcpartinfo/infdcpartlist", "/root/hidden/infdcpartinfo/infdcpartlist/M0485");
  226. break;
  227. case "02":
  228. zbcfGetCodeList(new Array("M0486"), new Array("/root/hidden/infdcpartinfo/infdcpartlist"));
  229. copyNodeset("/root/init/infdcpartinfo/infdcpartlist", "/root/hidden/infdcpartinfo/infdcpartlist/M0486");
  230. break;
  231. case "03":
  232. zbcfGetCodeList(new Array("M0487"), new Array("/root/hidden/infdcpartinfo/infdcpartlist"));
  233. copyNodeset("/root/init/infdcpartinfo/infdcpartlist", "/root/hidden/infdcpartinfo/infdcpartlist/M0487");
  234. break;
  235. case "04":
  236. zbcfGetCodeList(new Array("M0488"),new Array("/root/hidden/infdcpartinfo/infdcpartlist"));
  237. copyNodeset("/root/init/infdcpartinfo/infdcpartlist", "/root/hidden/infdcpartinfo/infdcpartlist/M0488");
  238. break;
  239. case "05":
  240. zbcfGetCodeList(new Array("M0489"), new Array("/root/hidden/infdcpartinfo/infdcpartlist"));
  241. copyNodeset("/root/init/infdcpartinfo/infdcpartlist", "/root/hidden/infdcpartinfo/infdcpartlist/M0489");
  242. break;
  243. case "06":
  244. zbcfGetCodeList(new Array("M0490"), new Array("/root/hidden/infdcpartinfo/infdcpartlist"));
  245. copyNodeset("/root/init/infdcpartinfo/infdcpartlist", "/root/hidden/infdcpartinfo/infdcpartlist/M0490");
  246. break;
  247. case "07":
  248. zbcfGetCodeList(new Array("M0491"), new Array("/root/hidden/infdcpartinfo/infdcpartlist"));
  249. copyNodeset("/root/init/infdcpartinfo/infdcpartlist", "/root/hidden/infdcpartinfo/infdcpartlist/M0491");
  250. break;
  251. case "08":
  252. zbcfGetCodeList(new Array("M0492"), new Array("/root/hidden/infdcpartinfo/infdcpartlist"));
  253. copyNodeset("/root/init/infdcpartinfo/infdcpartlist", "/root/hidden/infdcpartinfo/infdcpartlist/M0492");
  254. break;
  255. case "09":
  256. zbcfGetCodeList(new Array("M0493"), new Array("/root/hidden/infdcpartinfo/infdcpartlist"));
  257. copyNodeset("/root/init/infdcpartinfo/infdcpartlist", "/root/hidden/infdcpartinfo/infdcpartlist/M0493");
  258. break;
  259. case "10":
  260. zbcfGetCodeList(new Array("M0494"), new Array("/root/hidden/infdcpartinfo/infdcpartlist"));
  261. copyNodeset("/root/init/infdcpartinfo/infdcpartlist", "/root/hidden/infdcpartinfo/infdcpartlist/M0494");
  262. break;
  263. case "11":
  264. zbcfGetCodeList(new Array("M0495"), new Array("/root/hidden/infdcpartinfo/infdcpartlist"));
  265. copyNodeset("/root/init/infdcpartinfo/infdcpartlist", "/root/hidden/infdcpartinfo/infdcpartlist/M0495");
  266. break;
  267. case "12":
  268. zbcfGetCodeList(new Array("M0496"), new Array("/root/hidden/infdcpartinfo/infdcpartlist"));
  269. copyNodeset("/root/init/infdcpartinfo/infdcpartlist", "/root/hidden/infdcpartinfo/infdcpartlist/M0496");
  270. break;
  271. case "13":
  272. zbcfGetCodeList(new Array("M0497"), new Array("/root/hidden/infdcpartinfo/infdcpartlist"));
  273. copyNodeset("/root/init/infdcpartinfo/infdcpartlist", "/root/hidden/infdcpartinfo/infdcpartlist/M0497");
  274. break;
  275. }
  276. model.removeNodeset("/root/hidden/infdcpartinfo/infdcpartlist");
  277. model.makeNode("/root/hidden/infdcpartinfo/infdcpartlist");
  278. }
  279. /**
  280. * @ver : 2009-01-08
  281. * @desc : 검색조건에 대한 결과를 조회
  282. * @by : 강지훈
  283. * @param :
  284. * @return :
  285. * @---------------------------------------------------
  286. */
  287. function fSearch(){
  288. if(!doChkSrchCond()){
  289. return;
  290. }
  291. //섹션과 그리드조건을 cond노드에 셋팅
  292. doSetSrchCond();
  293. copyNodeType("/root/main/cond", "/root/main/cond", "replace", iviewer_list.model , "");
  294. if(iviewer_list.window.javascript.fSearchList()){
  295. //조회후 section Data 삭제
  296. doSetNullSrchCond();
  297. grp_cond.visible = false;
  298. iviewer_list.visible = true;
  299. btn_rlst.selected = true;
  300. };
  301. button16.visible=true;
  302. model.refresh();
  303. }
  304. /**
  305. * @ver : 2009-01-02
  306. * @desc : 감염종류1의 감염종류2의 하부항목들 조회
  307. * @by : 강지훈
  308. * @param :
  309. * @return :
  310. * @---------------------------------------------------
  311. */
  312. function fGetCD(grdNm, colNm){
  313. var instanceNm = grdNm.substr(4);
  314. var grdObj = document.all(grdNm);
  315. var fstRowStat = "";
  316. //그리드에 데이터가 한건이라도있어야 돌아간다
  317. var grdObjCnt = grdObj.rows;
  318. model.setValue("/root/main/cond/n_"+colNm, "");
  319. if(grdObjCnt > 1){
  320. var sql = "";
  321. var sqlNot = "";
  322. for(var i = 1 ; i < grdObjCnt; i++){
  323. var code1 = model.getValue("/root/main/"+ instanceNm +"/rows["+ i +"]/cdid1");
  324. var code2 = model.getValue("/root/main/"+ instanceNm +"/rows["+ i +"]/cdid2");
  325. var cond = model.getValue("/root/main/"+ instanceNm +"/rows["+ i +"]/cond");
  326. if(colNm == "diagtermcd"){ //20101110-김양수추가-질병코드일경우 R/O제외조건추가
  327. var exceptro = model.getValue("/root/main/"+ instanceNm +"/rows["+ i +"]/exceptro");
  328. }
  329. var code1Ln = code1.length;
  330. var code2Ln = code2.length;
  331. //데이터가 모두비었으면 스탑~
  332. if(code1 == "" && code2 == "" ){
  333. //한줄도 안들어가있으면 AND안찍기위해서...
  334. if(i == 1){
  335. fstRowStat = "B";
  336. }
  337. else{ //마지막줄이 비어있고 마지막전줄에 COND가 설정되어있다면 빼주기위해서
  338. var a = i -1;
  339. sql = sql.substr(0, sql.length-(model.getValue("/root/main/"+ instanceNm +"/rows["+ a +"]/cond").length));
  340. }
  341. break;
  342. }
  343. //-----SQL GROUP START-------
  344. if(i > 1){
  345. if(cond == "NOT"){
  346. sqlNot = " (" + sqlNot;
  347. }else{
  348. sql = " (" + sql;
  349. }
  350. }
  351. var sqlHead = "";
  352. if(colNm == "cctermcd"){
  353. sqlHead = "(SELECT 'Y' FROM emr.mrddccindx indx WHERE dsam.instcd = indx.instcd AND dsam.pid = indx.pid AND dsam.dschdd = indx.dschdd";
  354. }
  355. else if(colNm == "diagtermcd"){
  356. sqlHead = "(SELECT 'Y' FROM emr.mrdddiagindx indx WHERE dsam.instcd = indx.instcd AND dsam.pid = indx.pid AND dsam.dschdd = indx.dschdd";
  357. }
  358. else if(colNm == "optermcd"){
  359. sqlHead = "(SELECT 'Y' FROM emr.mrddopindx indx WHERE dsam.instcd = indx.instcd AND dsam.pid = indx.pid AND dsam.dschdd = indx.dschdd";
  360. }
  361. else if(colNm == "chngdeptcd"){
  362. sqlHead = "(SELECT 'Y' FROM emr.mrdddscd dscd WHERE dsam.instcd = dscd.instcd AND dsam.pid = dscd.pid AND dsam.dschdd = dscd.dschdd";
  363. }
  364. else if(colNm == "tophcd"){
  365. sqlHead = "(SELECT 'Y' FROM emr.mrdhcncr cncr WHERE dsam.instcd = cncr.instcd AND dsam.pid = cncr.pid AND dsam.dschdd = cncr.dschdd";
  366. }
  367. else if(colNm == "morphcd"){
  368. sqlHead = "(SELECT 'Y' FROM emr.mrdhcncr cncr WHERE dsam.instcd = cncr.instcd AND dsam.pid = cncr.pid AND dsam.dschdd = cncr.dschdd";
  369. }
  370. else if(colNm == "rerntmetstaspartcd"){
  371. sqlHead = "(SELECT 'Y' FROM emr.mrdhcncr cncr WHERE dsam.instcd = cncr.instcd AND dsam.pid = cncr.pid AND dsam.dschdd = cncr.dschdd";
  372. }
  373. else if(colNm == "dethcd"){ //사인코드 2009-12-17 추가
  374. sqlHead = "(SELECT 'Y' FROM emr.mrdddethindx indx WHERE dsam.instcd = indx.instcd AND dsam.pid = indx.pid AND dsam.dschdd = indx.dschdd";
  375. }
  376. var subSql = "";
  377. //2010-01-25 추가
  378. if(cond == "NOT" ){ //code1만 조건 추가됨
  379. //코드가 하나일경우 EQUAL 검색
  380. if(colNm == "morphcd"){
  381. subSql = " AND (morphcd1 = '" + code1 + "' OR morphcd2 = '" + code1 + "') ";
  382. }
  383. else if(colNm == "rerntmetstaspartcd"){
  384. subSql = " AND (rerntmetstaspartcd1 = '" + code1 + "' OR rerntmetstaspartcd2 = '" + code1 + "' OR rerntmetstaspartcd3 = '" + code1 + "' OR rerntmetstaspartcd4 = '" + code1 + "') ";
  385. }
  386. else if(colNm == "rectermcd"){//협진코드 sqlHead 쿼리 없음
  387. if(i > 1){
  388. subSql = " AND RPAD(" + colNm +", 10, '0') NOT LIKE '" + code1 + "%' ";
  389. }else{
  390. subSql = " RPAD(" + colNm +", 10, '0') NOT LIKE '" + code1 + "%' ";
  391. }
  392. }
  393. else{
  394. if(model.getValue("/root/main/cond/icd10") == "E"){ //ICD10코드 확장코드까지 검색
  395. subSql = " AND " + colNm +" = '" + code1 + "' ";
  396. }
  397. else{ //ICD10코드만으로 검색
  398. subSql = " AND RPAD(" + colNm +", 10, '0') LIKE '" + code1 + "%' ";
  399. }
  400. }
  401. //==================================================================================
  402. }else{
  403. //코드가 하나일경우 EQUAL 검색
  404. if(code1 != "" && code2 == ""){
  405. if(colNm == "morphcd"){
  406. subSql = " AND (morphcd1 = '" + code1 + "' OR morphcd2 = '" + code1 + "') ";
  407. }
  408. else if(colNm == "rerntmetstaspartcd"){
  409. subSql = " AND (rerntmetstaspartcd1 = '" + code1 + "' OR rerntmetstaspartcd2 = '" + code1 + "' OR rerntmetstaspartcd3 = '" + code1 + "' OR rerntmetstaspartcd4 = '" + code1 + "') ";
  410. }
  411. else if(colNm == "rectermcd"){//협진코드 sqlHead 쿼리 없음
  412. if(i > 1){
  413. subSql = " AND RPAD(" + colNm +", 10, '0') LIKE '" + code1 + "%' ";
  414. }else{
  415. subSql = " RPAD(" + colNm +", 10, '0') LIKE '" + code1 + "%' ";
  416. }
  417. }
  418. else{
  419. if(model.getValue("/root/main/cond/icd10") == "E"){ //ICD10코드 확장코드까지 검색
  420. subSql = " AND " + colNm +" = '" + code1 + "' ";
  421. }
  422. else{ //ICD10코드만으로 검색
  423. subSql = " AND RPAD(" + colNm +", 10, '0') LIKE '" + code1 + "%' ";
  424. }
  425. }
  426. }
  427. //코드 1,2 가 모두있을경우 BETWEEN 검색
  428. else if(code1 != "" && code2 != ""){
  429. if(colNm == "morphcd"){
  430. subSql = " AND ((morphcd1 >= '"+ code1 +"' AND morphcd1 <= '"+ code2 +"') OR (morphcd2 >= '"+ code1 +"' AND morphcd2 <= '"+ code2 +"'))";
  431. }
  432. else if(colNm == "rerntmetstaspartcd"){
  433. subSql = " AND ((rerntmetstaspartcd1 >= '"+ code1 +"' AND rerntmetstaspartcd1 <= '"+ code2 +"') OR (rerntmetstaspartcd2 >= '"+ code1 +"' AND rerntmetstaspartcd2 <= '"+ code2 +"') OR (rerntmetstaspartcd3 >= '"+ code1 +"' AND rerntmetstaspartcd3 <= '"+ code2 +"') OR (rerntmetstaspartcd4 >= '"+ code1 +"' AND rerntmetstaspartcd4 <= '"+ code2 +"'))";
  434. }//==2009-12-18 질병코드
  435. else if(colNm == "diagtermcd"){
  436. //subSql = " AND (RPAD("+ colNm +", "+ code1Ln +", '0') >= '" + code1 + "' AND RPAD("+ colNm +", "+ code2Ln +", 'Z') <= '" + code2 + "') ";
  437. //20101123-김양수주석처리(원본)
  438. //subSql = " AND (SUBSTR("+ colNm +", 0, INSTR("+ colNm +", '.', 1, 1)-1) >= '" + code1 + "' AND SUBSTR("+ colNm +", 0, INSTR("+ colNm +", '.', 1, 1)-1) <= '" + code2 + "') ";
  439. /* =============20101123-김양수-M-Code검색않되는 오류로 수정시작.================*/
  440. var code1yn = ""; code2yn = "";
  441. var code1sep = ""; code1opersymbol = ""; code2sep = ""; code2opersymbol = "";
  442. if(code1.substring(0,1) == "M"){
  443. for (var k = 0; k < code1.length; k++) {
  444. if (code1.charAt(k) == '/'){
  445. code1yn = "Y";
  446. break;
  447. }else{
  448. }
  449. }
  450. }
  451. if(code2.substring(0,1) == "M"){
  452. for (var m = 0; m < code2.length; m++) {
  453. if (code2.charAt(m) == '/'){
  454. code2yn = "Y";
  455. break;
  456. }
  457. else{
  458. }
  459. }
  460. }
  461. if(code1yn == "Y"){//code1이 M-Code이면서 '/'존재시
  462. code1sep = "/";
  463. code1opersymbol = "+1";
  464. }else{
  465. code1sep = ".";
  466. code1opersymbol = "-1";
  467. }
  468. if(code2yn == "Y"){//code2가 M-Code이면서 '/'존재시
  469. code2sep = "/";
  470. code2opersymbol = "+1";
  471. }else{
  472. code2sep = ".";
  473. code2opersymbol = "-1";
  474. }
  475. subSql = " AND (SUBSTR("+ colNm +", 0, INSTR("+ colNm +", '" + code1sep + "', 1, 1)" + code1opersymbol + ") >= '" + code1 + "' AND SUBSTR("+ colNm +", 0, INSTR("+ colNm +", '" + code2sep + "', 1, 1)" + code2opersymbol + ") <= '" + code2 + "') ";
  476. //subSql = " AND (SUBSTR("+ colNm +", 0, 4) >= '" + code1 + "' AND SUBSTR("+ colNm +", 0, 4) <= '" + code2 + "') ";
  477. /*==========20101123-김양수-M-Code검색않되는 오류로 수정끝.===============================*/
  478. }
  479. else if(colNm == "rectermcd"){//협진코드
  480. if(cond == "NOT"){
  481. if(i > 1){
  482. subSql = " AND (RPAD("+ colNm +", "+ code1Ln +", '0') <> '" + code1 + "' AND RPAD("+ colNm +", "+ code2Ln +", 'Z') <> '" + code2 + "') ";
  483. }else{
  484. subSql = " (RPAD("+ colNm +", "+ code1Ln +", '0') <> '" + code1 + "' AND RPAD("+ colNm +", "+ code2Ln +", 'Z') <> '" + code2 + "') ";
  485. }
  486. }else{
  487. if(i > 1){
  488. subSql = " AND (RPAD("+ colNm +", "+ code1Ln +", '0') >= '" + code1 + "' AND RPAD("+ colNm +", "+ code2Ln +", 'Z') <= '" + code2 + "') ";
  489. }else{
  490. subSql = " (RPAD("+ colNm +", "+ code1Ln +", '0') >= '" + code1 + "' AND RPAD("+ colNm +", "+ code2Ln +", 'Z') <= '" + code2 + "') ";
  491. }
  492. }
  493. }
  494. else{
  495. //subSql = " AND ("+ colNm +" >= '" + code1 + "' AND "+ colNm +" <= '" + code2 + "') ";
  496. //subSql = " AND (RPAD("+ colNm +", "+ code1Ln +", '0') >= '" + code1 + "' AND RPAD("+ colNm +", "+ code2Ln +", 'Z') <= '" + code2 + "') ";
  497. subSql = " AND (SUBSTR("+ colNm +", 0, INSTR("+ colNm +", '.', 1, 1)-1) >= '" + code1 + "' AND SUBSTR("+ colNm +", 0, INSTR("+ colNm +", '.', 1, 1)-1) <= '" + code2 + "') ";
  498. }
  499. }
  500. }
  501. //NOT 추가============================================
  502. if(cond == "NOT" && colNm != "rectermcd"){
  503. //Sql합체~
  504. //sqlNot = sqlNot + sqlHead + subSql + " AND ROWNUM = 1) = 'Y'"; --원본
  505. if(colNm == "diagtermcd" && exceptro == "Y"){ //20101110-김양수-추가-R/O제외
  506. sqlNot = sqlNot + sqlHead + subSql + " AND NVL(DIAGKINDCD, 'C') <> 'R' AND ROWNUM = 1) = 'Y'"; //질병코드 R/O제외체크시
  507. }else{
  508. sqlNot = sqlNot + sqlHead + subSql + " AND ROWNUM = 1) = 'Y'";
  509. }
  510. if(i > 1){
  511. sqlNot = sqlNot + ") ";
  512. }
  513. //-----SQL GROUP END---------
  514. //마지막줄이 아닐경우 조건설정
  515. if(i != grdObjCnt-1){
  516. sqlNot = sqlNot + " OR ";
  517. }
  518. }else{
  519. //Sql합체~
  520. if(colNm == "rectermcd"){
  521. sql = sql + sqlHead + subSql;
  522. }else{
  523. //sql = sql + sqlHead + subSql + " AND ROWNUM = 1) = 'Y'"; --원본
  524. if(colNm == "diagtermcd" && exceptro == "Y"){ //20101110-김양수-추가- R/O제외
  525. sql = sql + sqlHead + subSql + " AND NVL(DIAGKINDCD, 'C') <> 'R' AND ROWNUM = 1) = 'Y'"; //질병코드 R/O제외체크시
  526. }else{
  527. sql = sql + sqlHead + subSql + " AND ROWNUM = 1) = 'Y'";
  528. }
  529. }
  530. if(i > 1){
  531. sql = sql + ") ";
  532. }
  533. //-----SQL GROUP END---------
  534. //마지막줄이 아닐경우 조건설정
  535. if(i != grdObjCnt-1){
  536. sql = sql + " " + cond;
  537. }
  538. }
  539. //====================================================
  540. /* //Sql합체~
  541. sql = sql + sqlHead + subSql + " AND ROWNUM = 1) = 'Y'";
  542. if(i > 1){
  543. sql = sql + ") ";
  544. }
  545. //-----SQL GROUP END---------
  546. //마지막줄이 아닐경우 조건설정
  547. if(i != grdObjCnt-1){
  548. if(cond == "NOT") {
  549. sql = sql + " AND ";
  550. }else{
  551. sql = sql + " " + cond +" ";
  552. }
  553. }
  554. }
  555. //한줄도 안들어가있으면 AND안찍기위해서...
  556. if(fstRowStat != "B"){
  557. sql = "AND " + sql;
  558. }*/
  559. } //end for
  560. if(sqlNot != ""){
  561. var iLen = strTrim(sqlNot).length;
  562. var rVal = strRight(sqlNot, 3);
  563. var rVal2 = strRight(sqlNot, 2);
  564. if(rVal == "AND"){
  565. sqlNot = sqlNot.substring(0, iLen - 3);
  566. }else if(rVal2 == "OR"){
  567. sqlNot = sqlNot.substring(0, iLen - 2);
  568. }
  569. model.setValue("/root/main/cond/n_"+colNm, "AND " + sqlNot);
  570. }
  571. if(sql != ""){
  572. var iLen = strTrim(sql).length;
  573. var rVal = strRight(sql, 3);
  574. var rVal2 = strRight(sql, 2);
  575. if(rVal == "AND"){
  576. sql = sql.substring(0, iLen - 3);
  577. }else if(rVal2 == "OR"){
  578. sql = sql.substring(0, iLen - 2);
  579. }
  580. sql = "AND " + sql;
  581. }
  582. //한줄도 안들어가있으면 AND안찍기위해서...
  583. /* if(fstRowStat != "B"){
  584. sql = "AND " + sql;
  585. }*/
  586. } //end if
  587. return sql;
  588. }
  589. function strRight(str, n){
  590. var iLen = str.length;
  591. var rVal = str.substring(iLen, iLen - n);
  592. return rVal;
  593. }
  594. function strTrim(str){
  595. return str.replace(/\s+$/g, "");
  596. }
  597. function doSrchCondCSV(nodeList, sColSep, sRowSep){
  598. if( nodeList.length == 0 ){
  599. return;
  600. }
  601. var rCSV = "";
  602. var childNodeList = nodeList.item(0).childNodes;
  603. var childNodeCnt = childNodeList.length;
  604. if( childNodeCnt == 0 ){
  605. return;
  606. }
  607. var i, j;
  608. for( i = 0; i < childNodeCnt - 1; i++) {
  609. rCSV += childNodeList.item(i).nodeName + sColSep;
  610. }
  611. rCSV += childNodeList.item(i).nodeName + sRowSep;
  612. var node;
  613. while( node = nodeList.nextNode() ) {
  614. childNodeList = node.childNodes;
  615. for( i = 0; i < childNodeCnt - 1; i++) {
  616. rCSV += childNodeList.item(i).text + sColSep;
  617. }
  618. rCSV += childNodeList.item(i).text + sRowSep;
  619. }
  620. return rCSV;
  621. }
  622. function doChkSrchCond(){
  623. var dschfromdd = model.getValue("/root/main/cond/dschfromdd"); // 퇴원일
  624. var infromdd = model.getValue("/root/main/cond/infromdd"); // 입원일
  625. var inhospfromdd = model.getValue("/root/main/cond/inhospfromdd"); // 재원일
  626. if(dschfromdd == "" && infromdd == "" && inhospfromdd == ""){
  627. messageBox("퇴원일, 입원일, 재원일 중 하나는 입력하여야 합니다.", "I999");
  628. return false;
  629. }
  630. return true;
  631. }
  632. function doSetSrchCond(){
  633. //debugger;
  634. model.setValue("/root/main/cond/cctermcd", fGetCD("grd_cclist", "cctermcd"));
  635. model.setValue("/root/main/cond/diagtermcd", fGetCD("grd_diagcdlist", "diagtermcd"));
  636. model.setValue("/root/main/cond/optermcd", fGetCD("grd_opcdlist", "optermcd"));
  637. model.setValue("/root/main/cond/chngdeptcdlist", fGetCD("grd_chngcdlist", "chngdeptcd"));
  638. model.setValue("/root/main/cond/diagcd", fGetCD("grd_cnstcdlist", "rectermcd"));
  639. model.setValue("/root/main/cond/dethcd", fGetCD("grd_directcdlist", "dethcd"));
  640. model.setValue("/root/main/cond/tophcd", fGetCD("grd_tcdlist", "tophcd"));
  641. model.setValue("/root/main/cond/morphcd", fGetCD("grd_mcdlist", "morphcd"));
  642. model.setValue("/root/main/cond/rerntmetstaspartcd", fGetCD("grd_metstascdlist", "rerntmetstaspartcd"));
  643. //수술섹션의 정보를 파악한다.
  644. var opfromdd = model.getValue("/root/main/cond/opfromdd"); // 수술일
  645. var opdeptcd = model.getValue("/root/main/cond/opdeptcd"); // 수술과
  646. var opclsdept = model.getValue("/root/main/cond/opclsdept"); // 분과
  647. var perfdrid = model.getValue("/root/main/cond/perfdrid"); // 집도의
  648. if(opfromdd != "" || opdeptcd != "-" || opclsdept != "-" || perfdrid != "" ){ //수술정보 섹션에 데이터 들어가있을 경우
  649. model.setValue("/root/main/cond/section1", "Y");
  650. }
  651. //분만섹션의 정보를 파악한다.
  652. var partrtnfromdd = model.getValue("/root/main/cond/partrtnfromdd"); //분만일
  653. var womntypecd = model.getValue("/root/main/cond/womntypecd"); // 산모형태
  654. var stlborncd = model.getValue("/root/main/cond/stlborncd"); //사산여부
  655. var partrtnkindcd = model.getValue("/root/main/cond/partrtnkindcd"); // 분만형태
  656. var allwomntypecd = model.getValue("/root/main/cond/allwomntypecd"); // 분만정보만
  657. if(partrtnfromdd != "" || womntypecd != "-" || stlborncd != "" || partrtnkindcd != "-" || allwomntypecd != ""){
  658. model.setValue("/root/main/cond/section2", "Y");
  659. }
  660. //신생아섹션의 정보를 파악한다.
  661. var prgweekfrom = model.getValue("/root/main/cond/prgweekfrom"); // 임신주수
  662. var nbabybdwtqtyfrom = model.getValue("/root/main/cond/nbabybdwtqtyfrom"); // 신생아체중
  663. if(prgweekfrom != "" || nbabybdwtqtyfrom != ""){
  664. model.setValue("/root/main/cond/section3", "Y");
  665. }
  666. //전과섹션의 정보를 파악한다.
  667. var chngdeptfromdd = model.getValue("/root/main/cond/chngdeptfromdd"); //전출일
  668. var chngdeptcd = model.getValue("/root/main/cond/chngdeptcd"); // 전출과
  669. var chngclsdept = model.getValue("/root/main/cond/chngclsdept"); // 전출분과
  670. if(chngdeptfromdd != "" || chngdeptcd != "-" || chngclsdept != "-"){
  671. model.setValue("/root/main/cond/section4", "Y");
  672. }
  673. //협진섹션의 정보를 파악한다.
  674. var cnstreqfromdd = model.getValue("/root/main/cond/cnstreqfromdd"); // 협진의뢰일
  675. var cnstreqdeptcd = model.getValue("/root/main/cond/cnstreqdeptcd"); // 협진의뢰과
  676. var cnstclsdept = model.getValue("/root/main/cond/cnstclsdept"); // 분과
  677. var cnstexecfromdd = model.getValue("/root/main/cond/cnstexecfromdd"); //협진시행일
  678. var cnstexecdeptcd = model.getValue("/root/main/cond/cnstexecdeptcd"); // 협진 시행과
  679. var cnstexeclrsdeptcd = model.getValue("/root/main/cond/cnstexeclrsdeptcd"); // 분과
  680. if(cnstreqfromdd != "" || cnstreqdeptcd != "-" || cnstclsdept != "-" || cnstexecfromdd != "" || cnstexecdeptcd != "-" || cnstexeclrsdeptcd != "-"){
  681. model.setValue("/root/main/cond/section5", "Y");
  682. }
  683. //종양, 가코딩 섹션의 정보를 파악한다.
  684. var cncrflag = model.getValue("/root/main/cond/cncrflag"); // 종양구분
  685. var tmpcodeyn = model.getValue("/root/main/cond/tmpcodeyn"); // 가코딩
  686. if(cncrflag != "-" || tmpcodeyn != ""){
  687. model.setValue("/root/main/cond/section6", "Y");
  688. }
  689. //암환자관리 섹션의 정보를 파악한다.
  690. var prmycncryn = model.getValue("/root/main/cond/prmycncryn"); // 다발성 원발암
  691. var dethyn = model.getValue("/root/main/cond/dethyn"); // 사망여부
  692. var seer = model.getValue("/root/main/cond/seer"); // SEER
  693. var staging = model.getValue("/root/main/cond/staging"); // 병기
  694. var rerntmetstaspart = model.getValue("/root/main/cond/rerntmetstaspart"); // 전이여부
  695. var ecog = model.getValue("/root/main/cond/ecog"); // ECOG
  696. var regimen = model.getValue("/root/main/cond/regimen"); // Regimen
  697. var chosbfcuremthd = model.getValue("/root/main/cond/chosbfcuremthd"); // 내원전치료
  698. var prmypart = model.getValue("/root/main/cond/prmypart"); // 본원치료(원발)
  699. var metstaspart = model.getValue("/root/main/cond/metstaspart"); // 본원치료(전이)
  700. if(prmycncryn != "" || dethyn != "" || seer != "-" || staging != "-" || rerntmetstaspart != "" || ecog != "" || regimen != "" || chosbfcuremthd != "" || prmypart != "" || metstaspart != ""){
  701. model.setValue("/root/main/cond/section7", "Y");
  702. }
  703. }
  704. function doSetNullSrchCond(){
  705. model.setValue("/root/main/cond/section1", "");
  706. model.setValue("/root/main/cond/section2", "");
  707. model.setValue("/root/main/cond/section3", "");
  708. model.setValue("/root/main/cond/section4", "");
  709. model.setValue("/root/main/cond/section5", "");
  710. model.setValue("/root/main/cond/section6", "");
  711. model.setValue("/root/main/cond/section7", "");
  712. model.refresh();
  713. }
  714. /**
  715. * @ver : 2009-01-13
  716. * @desc : 저장된 조건 조회
  717. * @by : 강지훈
  718. * @param :
  719. * @return :
  720. * @---------------------------------------------------
  721. */
  722. function GetCondSave(){
  723. model.removeNode ("/root/tmp/condlist");
  724. model.makeNode("/root/tmp/condlist");
  725. submit("TRMRD01602");
  726. var node = model.instance1.selectSingleNode("/root/tmp/condlist");
  727. var childNodeList = node.childNodes;
  728. var childNode;
  729. while( childNode = childNodeList.nextNode() ) {
  730. model.setValue("/root/main/cond/" + childNode.nodeName, model.getValue(childNode));
  731. }
  732. //퇴원과 분과가 비어있지 않으면
  733. if(model.getValue("/root/main/cond/dschclsdept") != "-"){
  734. var deptcd = model.getValue("/root/main/cond/dschdeptcd");
  735. switch(deptcd){
  736. case "2010000000":
  737. cmb_dschclsdept.choices.itemset.attribute("nodeset") = "/root/init/mdclrsdeptlist/M0500";
  738. break;
  739. case "2040000000":
  740. cmb_dschclsdept.choices.itemset.attribute("nodeset") = "/root/init/gsclrsdeptlist/M0501";
  741. break;
  742. case "2100000000":
  743. cmb_dschclsdept.choices.itemset.attribute("nodeset") = "/root/init/gyclrsdeptlist/M0502";
  744. break;
  745. case "2110000000":
  746. cmb_dschclsdept.choices.itemset.attribute("nodeset") = "/root/init/pdclrsdeptlist/M0503";
  747. break;
  748. default:
  749. cmb_dschclsdept.choices.itemset.attribute("nodeset") = "/root/init/nulllist/M503";
  750. break;
  751. }
  752. cmb_dschclsdept.refresh();
  753. }
  754. //입원과 분과가 비어있지 않으면
  755. if(model.getValue("/root/main/cond/inclsdept") != "-"){
  756. var deptcd = model.getValue("/root/main/cond/indeptcd");
  757. switch(deptcd){
  758. case "2010000000":
  759. cmb_inclsdept.choices.itemset.attribute("nodeset") = "/root/init/mdclrsdeptlist/M0500";
  760. break;
  761. case "2040000000":
  762. cmb_inclsdept.choices.itemset.attribute("nodeset") = "/root/init/gsclrsdeptlist/M0501";
  763. break;
  764. case "2100000000":
  765. cmb_inclsdept.choices.itemset.attribute("nodeset") = "/root/init/gyclrsdeptlist/M0502";
  766. break;
  767. case "2110000000":
  768. cmb_inclsdept.choices.itemset.attribute("nodeset") = "/root/init/pdclrsdeptlist/M0503";
  769. break;
  770. default:
  771. cmb_inclsdept.choices.itemset.attribute("nodeset") = "/root/init/nulllist/M503";
  772. break;
  773. }
  774. cmb_inclsdept.refresh();
  775. }
  776. //수술과 분과가 비어있지 않으면
  777. if(model.getValue("/root/main/cond/opclsdept") != "-"){
  778. var deptcd = model.getValue("/root/main/cond/opdeptcd");
  779. switch(deptcd){
  780. case "2010000000":
  781. cmb_opclsdept.choices.itemset.attribute("nodeset") = "/root/init/mdclrsdeptlist/M0500";
  782. break;
  783. case "2040000000":
  784. cmb_opclsdept.choices.itemset.attribute("nodeset") = "/root/init/gsclrsdeptlist/M0501";
  785. break;
  786. case "2100000000":
  787. cmb_opclsdept.choices.itemset.attribute("nodeset") = "/root/init/gyclrsdeptlist/M0502";
  788. break;
  789. case "2110000000":
  790. cmb_opclsdept.choices.itemset.attribute("nodeset") = "/root/init/pdclrsdeptlist/M0503";
  791. break;
  792. default:
  793. cmb_opclsdept.choices.itemset.attribute("nodeset") = "/root/init/nulllist/M503";
  794. break;
  795. }
  796. cmb_opclsdept.refresh();
  797. }
  798. //전출과 분과가 비어있지 않으면
  799. if(model.getValue("/root/main/cond/chngclsdept") != "-"){
  800. var deptcd = model.getValue("/root/main/cond/chngdeptcd");
  801. switch(deptcd){
  802. case "2010000000":
  803. cmb_chngclsdept.choices.itemset.attribute("nodeset") = "/root/init/mdclrsdeptlist/M0500";
  804. break;
  805. case "2040000000":
  806. cmb_chngclsdept.choices.itemset.attribute("nodeset") = "/root/init/gsclrsdeptlist/M0501";
  807. break;
  808. case "2100000000":
  809. cmb_chngclsdept.choices.itemset.attribute("nodeset") = "/root/init/gyclrsdeptlist/M0502";
  810. break;
  811. case "2110000000":
  812. cmb_chngclsdept.choices.itemset.attribute("nodeset") = "/root/init/pdclrsdeptlist/M0503";
  813. break;
  814. default:
  815. cmb_chngclsdept.choices.itemset.attribute("nodeset") = "/root/init/nulllist/M503";
  816. break;
  817. }
  818. cmb_chngclsdept.refresh();
  819. }
  820. //협진과 분과가 비어있지 않으면
  821. if(model.getValue("/root/main/cond/cnstclsdept") != "-"){
  822. var deptcd = model.getValue("/root/main/cond/cnstreqdeptcd");
  823. switch(deptcd){
  824. case "2010000000":
  825. cmb_cnstclsdept.choices.itemset.attribute("nodeset") = "/root/init/mdclrsdeptlist/M0500";
  826. break;
  827. case "2040000000":
  828. cmb_cnstclsdept.choices.itemset.attribute("nodeset") = "/root/init/gsclrsdeptlist/M0501";
  829. break;
  830. case "2100000000":
  831. cmb_cnstclsdept.choices.itemset.attribute("nodeset") = "/root/init/gyclrsdeptlist/M0502";
  832. break;
  833. case "2110000000":
  834. cmb_cnstclsdept.choices.itemset.attribute("nodeset") = "/root/init/pdclrsdeptlist/M0503";
  835. break;
  836. default:
  837. cmb_cnstclsdept.choices.itemset.attribute("nodeset") = "/root/init/nulllist/M503";
  838. break;
  839. }
  840. cmb_cnstclsdept.refresh();
  841. }
  842. //협진시행과 분과가 비어있지 않으면
  843. if(model.getValue("/root/main/cond/cnstexeclrsdeptcd") != "-"){
  844. var deptcd = model.getValue("/root/main/cond/cnstexecdeptcd");
  845. switch(deptcd){
  846. case "2010000000":
  847. cmb_cnstexeclrsdeptcd.choices.itemset.attribute("nodeset") = "/root/init/mdclrsdeptlist/M0500";
  848. break;
  849. case "2040000000":
  850. cmb_cnstexeclrsdeptcd.choices.itemset.attribute("nodeset") = "/root/init/gsclrsdeptlist/M0501";
  851. break;
  852. case "2100000000":
  853. cmb_cnstexeclrsdeptcd.choices.itemset.attribute("nodeset") = "/root/init/gyclrsdeptlist/M0502";
  854. break;
  855. case "2110000000":
  856. cmb_cnstexeclrsdeptcd.choices.itemset.attribute("nodeset") = "/root/init/pdclrsdeptlist/M0503";
  857. break;
  858. default:
  859. cmb_cnstexeclrsdeptcd.choices.itemset.attribute("nodeset") = "/root/init/nulllist/M503";
  860. break;
  861. }
  862. cmb_cnstexeclrsdeptcd.refresh();
  863. }
  864. model.makeNode("/root/main/diagcdlist");
  865. model.makeNode("/root/main/cclist");
  866. model.makeNode("/root/main/chngcdlist");
  867. model.makeNode("/root/main/directcdlist");
  868. model.makeNode("/root/main/cnstcdlist");
  869. model.makeNode("/root/main/opcdlist");
  870. model.makeNode("/root/main/mcdlist");
  871. model.makeNode("/root/main/tcdlist");
  872. model.makeNode("/root/main/metstascdlist");
  873. copyNodesetType("/root/main/diagcdlist", "/root/tmp/diagcdlist" , "replace");
  874. copyNodesetType("/root/main/cclist", "/root/tmp/cclist" , "replace");
  875. copyNodesetType("/root/main/chngcdlist", "/root/tmp/chngcdlist" , "replace");
  876. copyNodesetType("/root/main/directcdlist", "/root/tmp/directcdlist" , "replace");
  877. copyNodesetType("/root/main/cnstcdlist", "/root/tmp/cnstcdlist" , "replace");
  878. copyNodesetType("/root/main/opcdlist", "/root/tmp/opcdlist" , "replace");
  879. copyNodesetType("/root/main/mcdlist", "/root/tmp/mcdlist" , "replace");
  880. copyNodesetType("/root/main/tcdlist", "/root/tmp/tcdlist" , "replace");
  881. copyNodesetType("/root/main/metstascdlist", "/root/tmp/metstascdlist" , "replace");
  882. cap_condnm.attribute("text") = "조건명 : " + model.getValue("/root/main/cond/condnm");
  883. model.refresh();
  884. }
  885. function getMonthInterval(startdd, enddd){
  886. var monthcnt = 0;
  887. while(startdd != enddd){
  888. startdd = addMonth(startdd);
  889. monthcnt++;
  890. }
  891. return monthcnt;
  892. }
  893. function addMonth(yyyymm){
  894. var yyyy = yyyymm.substring(0, 4);
  895. var mm = yyyymm.substring(4, 6);
  896. var bfmm;
  897. if(mm.substr(0,1) == "0"){ //10월 이전인 경우, 앞자리 0을 제거
  898. bfmm = mm.substr(1,1);
  899. bfmm++;
  900. }else{ //10월 이후인 경우
  901. bfmm = mm;
  902. bfmm++;
  903. }
  904. if(bfmm > 12){ // 1월 이전을 선택한 경우, 년도를 바꿈
  905. bfmm = "01";
  906. yyyy++;
  907. }else if(bfmm < 10){ //10월 이후인 경우에는 앞자리에 0을 붙임.
  908. bfmm = "0".concat(bfmm);
  909. }
  910. return "" + yyyy + "".concat(bfmm);
  911. }
  912. function excel_save(){
  913. //var fileName = window.fileDialog("save", ",", false, "", "xls", "All Files (*.*)|*.*|Excel Files(*.xls)|*.xls");
  914. var fileName = window.fileDialog("save", "|", true, "", "", "Excel Files(*.xls)|*.xls");
  915. if (fileName != ""){
  916. iviewer_list.window.javascript.grd_list.saveExcel(fileName, "SheetName", false, false, "", "", false);
  917. }
  918. }