SMMRC02700.js 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185
  1. var ClickTab = false;
  2. var allchecked = "false";
  3. /**
  4. * @desc : Source Node의 갯수를 구한다.
  5. * @
  6. * @param : path - node path
  7. * @return :
  8. * @authur : 김선태 2007. 5. 8
  9. * @---------------------------------------------------
  10. */
  11. function getNodeSetCnt(path)
  12. {
  13. var insXml = model.instances(0);
  14. var nodeList = insXml.selectNodes(path);
  15. return nodeList.length;
  16. }
  17. /**
  18. * @desc : Source Node의 child nodelist를 Destination의 nodelist로 append한다.
  19. * @
  20. * @param : strDest - 도착node path
  21. * : strSrc - 출발node path
  22. * @return :
  23. * @authur : 이상현 2007. 3. 27
  24. * @---------------------------------------------------
  25. */
  26. function addCopyNodeset(strDest, strSrc, mode, destModel, srcModel) {
  27. if( destModel == null || destModel =="" )
  28. destModel = document.models.item(0);
  29. if( srcModel == null || srcModel =="" )
  30. srcModel = document.models.item(0);
  31. var srcNodeList = srcModel.instances(0).selectNodes(strSrc);
  32. var srcNode;
  33. var pDestNode = destModel.instances.item(0).selectSingleNode(strDest).parentNode;
  34. if( mode == "replace" || mode == null ) {
  35. destModel.removeNodeset(strDest);
  36. while( srcNode = srcNodeList.nextNode() ) {
  37. pDestNode.appendChild(srcNode.cloneNode(true));
  38. }
  39. }
  40. else if( mode == "after" ) {
  41. while( srcNode = srcNodeList.nextNode() ) {
  42. pDestNode.appendChild(srcNode.cloneNode(true));
  43. }
  44. }
  45. else if( mode == "before" ) {
  46. var destNode;
  47. for( var i = srcNodeList.length - 1; i >= 0; i-- ) {
  48. destNode = destModel.instances.item(0).selectSingleNode(strDest + "[1]");
  49. pDestNode.insertBefore(srcNodeList.item(i).cloneNode(true), destNode);
  50. }
  51. }
  52. }
  53. /**
  54. * @desc : 사용자의 권한을 체크하여 버튼셋팅.
  55. * btn_r 조회버튼, btn_x 저장 및 수정 버튼, btn_p : 출력버튼
  56. * @
  57. * @param :
  58. * @return :
  59. * @authur : 김선태 2007. 5. 8
  60. * @---------------------------------------------------
  61. */
  62. function fchkAuth()
  63. {
  64. for(var i=0; i<= document.controls.length-1 ; i++){
  65. if(document.controls.item(i).elementName == "xforms:button"){
  66. if(document.controls.item(i).attribute("id").substr(0,6) == "btn_r_"){
  67. document.controls.item(i).disabled = !checkAuth("R");
  68. }
  69. if(document.controls.item(i).attribute("id").substr(0,6) == "btn_x_"){
  70. document.controls.item(i).disabled = !checkAuth("X");
  71. }
  72. if(document.controls.item(i).attribute("id").substr(0,6) == "btn_p_"){
  73. document.controls.item(i).disabled = !checkAuth("P");
  74. }
  75. }
  76. }
  77. }
  78. /**
  79. * @desc : 폼초기화
  80. * @
  81. * @param :
  82. * @return :
  83. * @authur : 이은영 2008.03.18
  84. * @---------------------------------------------------
  85. */
  86. function fFormInit()
  87. {
  88. //컨트롤 권한 설정
  89. fchkAuth();
  90. //공통코드 가져오기...
  91. //M0424:차트분실코드
  92. zbcfGetCodeList(new Array("M0424"), new Array("/root/init/M0424"));
  93. model.removeNodeset("/root/main/chartlend/clrs/applist");
  94. model.removeNodeset("/root/main/chartlend/clrs/rendlist");
  95. btn_movchrt.dispatch("onclick");
  96. var today = getCurrentDate();
  97. var valitodd = (today.toDate()).getAddDate(-90);
  98. valitodd = valitodd.getDateFormat();
  99. model.setValue("/root/req/chartlend/rendcd" , "");
  100. model.setValue("/root/req/chartlend/appdeptcd" , "");
  101. model.setValue("/root/req/chartlend/lendmanid" , "");
  102. model.setValue("/root/req/chartlend/renddd" , today);
  103. model.setValue("/root/req/chartlend/appmanid" , getUserId());
  104. model.setValue("/root/req/chartlend/appman" , getUserName());
  105. model.setValue("/root/req/chartlend/acptid" , getUserId());
  106. model.setValue("/root/req/chartreturn/rendcd" , "ALL");
  107. model.setValue("/root/req/chartreturn/appdeptcd", "ALL");
  108. model.setValue("/root/req/chartreturn/fromappdd", today);
  109. model.setValue("/root/req/chartreturn/toappdd" , today);
  110. model.setValue("/root/req/chartreturn/fromrtndd", "");
  111. model.setValue("/root/req/chartreturn/tortndd" , "");
  112. ipt_fromrtndd.disabled = true;
  113. ipt_tortndd.disabled = true;
  114. rtnterm_disabled.value = "";
  115. model.setValue("/root/req/chartlend/resettm" , getCurrentTime());
  116. model.setValue("/root/req/chartreturn/resettm" , getCurrentTime());
  117. model.removeNodeset("/root/main/rendreport/report/chrtlist");
  118. model.removeNodeset("/root/main/rendreport/report/unpreplist");
  119. model.removeNodeset("/root/main/rendreport/report/chrtlendlist");
  120. model.removeNodeset("/root/main/rendreport/report/chrtstatlist");
  121. model.refresh();
  122. }
  123. /**
  124. * @desc : 탭 클릭...
  125. * @
  126. * @param :
  127. * @return :
  128. * @authur : 이은영 2008.07.14
  129. * @---------------------------------------------------
  130. */
  131. function fClickTab()
  132. {
  133. if (ClickTab == false)
  134. {
  135. ClickTab = true;
  136. //공통코드 가져오기...
  137. //M0392:챠트미대출사유코드
  138. //M0412:과보관사유코드
  139. zbcfGetCodeList(new Array("M0392","M0412"), new Array("/root/init/M0392","/root/init/M0412"));
  140. // 대출용도, 대출과, 차트과, 차트담당자, 보관장소
  141. model.makeValue("/root/send/reqdata/ioflag" , "I");
  142. model.makeValue("/root/send/reqdata/useyn" , "Y");
  143. model.makeValue("/root/send/reqdata/allwardyn", "");
  144. model.refresh();
  145. submit("TRMRC00100");
  146. model.removeNodeset("/root/main/chartlend/clrs/chrtlendlist");
  147. model.removeNodeset("/root/main/chartreturn/clrs/rtntrgtlist");
  148. model.removeNodeset("/root/main/chartreturn/clrs/rtnlist");
  149. model.refresh();
  150. }
  151. }
  152. /**
  153. * @desc : 챠트 반납 우클릭시 - > 챠트 반납
  154. * @
  155. * @param :
  156. * @return :
  157. * @authur : 이은영 2008.07.14
  158. * @---------------------------------------------------
  159. */
  160. function fsetrtnchart(bcflag)
  161. {
  162. var ref = "/root/main/chartreturn/clrs/rtntrgtlist";
  163. var grdObj = grd_rendlist2;
  164. var savedata = "status▦pid▦ioflag▦chrtflag▦bcno▦medirecno▦chrtseqno▩";
  165. var dataString = "";
  166. var dataCount = 0;
  167. if (bcflag == "Y"){
  168. var bcno = model.getValue("/root/req/chartreturn/bcno");
  169. if (bcno != ""){
  170. dataString = dataString + "u▦▦I▦I▦" + bcno + "▦▦▩";
  171. }
  172. if (dataString.length > 0)
  173. {
  174. model.makeValue("/root/send/savedata", savedata + dataString);
  175. model.refresh();
  176. if (submit("TXMRC02702", "", "/root/send/savedata", "/root/main/result") == true){
  177. // 2008.01.25. 바코드 번호 클리어...
  178. model.makeValue("/root/req/chartreturn/bcno", "");
  179. ipt_rtnbcno.refresh();
  180. // 다시조회..
  181. model.setValue("/root/req/chartreturn/acptid", getUserId());
  182. fGetUserRtnList();
  183. }
  184. }
  185. } else {
  186. if (bcflag == "C") {
  187. for ( var i = 0; i < grdObj.rows; i++)
  188. {
  189. var checked = model.getValue(ref + "[" + i + "]/checked");
  190. if (checked == "true")
  191. {
  192. var pid = model.getValue(ref + "[" + i + "]/pid");
  193. var bcno = model.getValue(ref + "[" + i + "]/bcno");
  194. var medirecno = model.getValue(ref + "[" + i + "]/medirecno");
  195. var chrtseqno = model.getValue(ref + "[" + i + "]/chrtseqno");
  196. if (chrtseqno != ""){
  197. dataString = dataString + "u▦" + pid + "▦I▦I▦" + bcno + "▦" + medirecno + "▦" + chrtseqno + "▩";
  198. dataCount = dataCount + 1;
  199. }
  200. }
  201. }
  202. } else {
  203. for ( var i = 0; i < grdObj.selectedRows; i++)
  204. {
  205. var pid = model.getValue(ref + "[" + grdObj.selectedrow(i) + "]/pid");
  206. var bcno = model.getValue(ref + "[" + grdObj.selectedrow(i) + "]/bcno");
  207. var medirecno = model.getValue(ref + "[" + grdObj.selectedrow(i) + "]/medirecno");
  208. var chrtseqno = model.getValue(ref + "[" + grdObj.selectedrow(i) + "]/chrtseqno");
  209. if (chrtseqno != ""){
  210. dataString = dataString + "u▦" + pid + "▦I▦I▦" + bcno + "▦" + medirecno + "▦" + chrtseqno + "▩";
  211. dataCount = dataCount + 1;
  212. }
  213. }
  214. }
  215. if (dataString.length > 0)
  216. {
  217. model.makeValue("/root/send/savedata", savedata + dataString);
  218. model.refresh();
  219. if (submit("TXMRC02702", "", "/root/send/savedata", "/root/main/result") == true){
  220. alert("총 " + dataCount + " 건 챠트반납 되었습니다.");
  221. // 다시 조회하기..
  222. fGetRtnList();
  223. // 다시조회..
  224. model.setValue("/root/req/chartreturn/acptid", getUserId());
  225. fGetUserRtnList();
  226. }
  227. }
  228. }
  229. }
  230. /**
  231. * @desc : 챠트 반납 우클릭시 - > 차트 분실 처리
  232. * @
  233. * @param :
  234. * @return :
  235. * @authur : 이은영 2008.07.28
  236. * @---------------------------------------------------
  237. */
  238. function fsetlosschrt()
  239. {
  240. if(grd_rendlist2.row < 1){
  241. return;
  242. }
  243. // 2008.07.28. 차트 분실 처리하기...
  244. fShowWndIptBox();
  245. }
  246. /**
  247. * @desc : 챠트상태를 수정한다.
  248. * @
  249. * @param :
  250. * @return :
  251. * @authur : 이은영 2008.07.28
  252. * @---------------------------------------------------
  253. */
  254. function fUpdateChrtStat()
  255. {
  256. // 2008.07.28. 차트 분실 처리하기...
  257. var chrtstat = model.getValue("/root/hidden/lendlist/chrtstat");
  258. var chrtstatnm = model.getValue("/root/init/M0424/M0424[cdid='" + chrtstat + "']/cdnm");
  259. var savedata ="medirecno▦chrtseqno▦chrtstat▦msgcnts▩";
  260. var dataString = "";
  261. var dataCount = 0;
  262. for ( var i = 0; i < grd_rendlist2.selectedRows; i++)
  263. {
  264. var medirecno = model.getValue("/root/main/chrtrtn/rtntrgtlist[" + grd_rendlist2.selectedrow(i) + "]/medirecno");
  265. var chrtseqno = model.getValue("/root/main/chrtrtn/rtntrgtlist[" + grd_rendlist2.selectedrow(i) + "]/chrtseqno");
  266. var msgcnts = model.getValue("/root/main/chrtrtn/rtntrgtlist[" + grd_rendlist2.selectedrow(i) + "]/msgcnts");
  267. msgcnts = msgcnts + "[" + chrtstatnm + "]";
  268. if (chrtseqno != "") {
  269. dataString = dataString + medirecno + "▦" + chrtseqno + "▦" + chrtstat + "▦" + msgcnts + "▩";
  270. dataCount = dataCount + 1;
  271. }
  272. }
  273. grup_losschrt.visible = false;
  274. if (dataString.length > 0)
  275. {
  276. model.makeValue("/root/send/savedata", savedata + dataString);
  277. model.refresh();
  278. submit("TXMRC00107");
  279. alert("총 " + dataCount + " 건 차트 분실 처리 되었습니다.");
  280. // 다시 조회하기..
  281. fGetRtnList();
  282. }
  283. }
  284. /**
  285. * @desc : 챠트 대출 조회
  286. * @
  287. * @param :
  288. * @return :
  289. * @authur : 이은영 2008.07.14
  290. * @---------------------------------------------------
  291. */
  292. function fGetLendList()
  293. {
  294. model.setValue("/root/req/chartlend/ioflag", "I");
  295. model.setValue("/root/req/chartlend/acptid", "");
  296. model.setValue("/root/req/chartlend/renddd", getCurrentDate());
  297. model.setValue("/root/req/chartlend/resettm", "000000");
  298. model.copyNode("/root/send/reqdata", "/root/req/chartlend");
  299. // 챠트대출이력조회
  300. submit("TRMRC02703", "true", "/root/send/reqdata", "/root/main/chartlend/clrs/chrtlendlist");
  301. var pid = model.getValue("/root/req/chartlend/pid");
  302. if (pid.length > 0) {
  303. model.setValue("/root/req/chartlend/chrtpid", pid);
  304. model.refresh();
  305. btn_chrtlist.dispatch("DOMActivate");
  306. }
  307. // 2008.01.02. 대출현황 조회 총건수..
  308. model.setValue ("/root/req/chartlend/count", grd_rendlist.rows - 1);
  309. cap_rendlist.refresh();
  310. }
  311. /**
  312. * @desc : 챠트 대출 조회 - 바크도 입력후 대출현황만 다시조회한다. (로그인 사용자별)
  313. * @
  314. * @param :
  315. * @return :
  316. * @authur : 이은영 2008.07.14
  317. * @---------------------------------------------------
  318. */
  319. function fGetUserLendList()
  320. {
  321. model.setValue("/root/req/chartlend/ioflag", "I");
  322. model.setValue("/root/req/chartlend/acptid", getUserId());
  323. model.setValue("/root/req/chartlend/renddd", getCurrentDate());
  324. model.copyNode("/root/send/reqdata", "/root/req/chartlend");
  325. // 챠트대출이력조회
  326. submit("TRMRC02703", "true", "/root/send/reqdata", "/root/main/chartlend/clrs/chrtlendlist");
  327. // 2008.01.02. 대출현황 조회 총건수..
  328. model.setValue ("/root/req/chartlend/count", grd_rendlist.rows - 1);
  329. cap_rendlist.refresh();
  330. }
  331. /**
  332. * @desc : 챠트 반납 조회
  333. * @
  334. * @param :
  335. * @return :
  336. * @authur : 이은영 2008.07.14
  337. * @---------------------------------------------------
  338. */
  339. function fGetRtnList()
  340. {
  341. model.setValue("/root/req/chartreturn/ioflag", "I");
  342. model.copyNode("/root/send/reqdata", "/root/req/chartreturn");
  343. submit("TRMRC02704");
  344. }
  345. /**
  346. * @desc : 챠트 반납 조회 - 바크도 입력후 반납현황만 다시조회한다. (로그인 사용자별)
  347. * @
  348. * @param :
  349. * @return :
  350. * @authur : 이은영 2008.07.14
  351. * @---------------------------------------------------
  352. */
  353. function fGetUserRtnList()
  354. {
  355. model.setValue("/root/req/chartreturn/ioflag", "I");
  356. model.copyNode("/root/send/reqdata", "/root/req/chartreturn");
  357. submit("TRMRC02705");
  358. // 2008.01.02. 반납현황 조회 총건수..
  359. model.setValue ("/root/req/chartreturn/count", grd_rtnlist.rows - 1);
  360. cap_rtnlist.refresh();
  361. }
  362. /**
  363. * @desc : 입원 차트 선택 후 -> 대출등록
  364. * @
  365. * @param : bcflag : Y / N
  366. * @return :
  367. * @authur : 이은영 2008.07.14
  368. * @---------------------------------------------------
  369. */
  370. function fSetLendChart(bcflag)
  371. {
  372. // 2007.12.14. 대출일자는 당일로 한다...
  373. var renddd = getCurrentDate();
  374. // 대출등록
  375. var rendcd = model.getValue("/root/req/chartlend/rendcd");
  376. var appdeptcd = model.getValue("/root/req/chartlend/appdeptcd");
  377. var lendmanid = model.getValue("/root/req/chartlend/lendmanid");
  378. var appmanid = model.getValue("/root/req/chartlend/appmanid");
  379. var msgcnts = model.getValue("/root/req/chartlend/msgcnts");
  380. var cntctelno = model.getValue("/root/req/chartlend/cntctelno");
  381. var chrtpid = model.getValue("/root/req/chartlend/chrtpid");
  382. if (rendcd == ""){
  383. window.alert("대출용도를 선택해 주세요", "차트대출 및 반납", 0 | 64);
  384. model.setFocus("cbo_l_rendcd");
  385. return;
  386. }
  387. if (appdeptcd == ""){
  388. window.alert("대출과를 선택해 주세요", "차트대출 및 반납", 0 | 64);
  389. model.setFocus("cbo_l_appdeptcd");
  390. return;
  391. }
  392. if (lendmanid == "" || lendmanid.isNumber()== false){
  393. window.alert("대출자를 선택해 주세요", "차트대출 및 반납", 0 | 64);
  394. model.setFocus("cbo_l_lendmanid");
  395. return;
  396. }
  397. var icnt = 0;
  398. var HearderData = "status▦pid▦ioflag▦chrtflag▦bcno▦medirecno▦rendcd▦appdeptcd▦lendmanid▦appmanid▦msgcnts▦cntctelno▦rendbcflag▩";
  399. var tmpSaveData = "";
  400. if (bcflag == "Y")
  401. {
  402. var bcno = model.getValue("/root/req/chartlend/bcno");
  403. if (bcno == "" || bcno == "0"){
  404. window.alert("바코드번호를 입력해 주세요", "차트대출 및 반납", 0 | 64);
  405. model.setFocus("ipt_lendbcno");
  406. return;
  407. }
  408. if (bcno != "" && bcno != "0")
  409. {
  410. tmpSaveData = tmpSaveData + "i▦▦I▦I▦" + bcno + "▦▦" ;
  411. tmpSaveData = tmpSaveData + rendcd + "▦" + appdeptcd + "▦" + lendmanid + "▦" + appmanid + "▦" + msgcnts + "▦" + cntctelno + "▦B▩";
  412. }
  413. if (tmpSaveData != ""){
  414. model.makeValue("/root/send/savedata", HearderData + tmpSaveData);
  415. submit("TXMRC02701", "", "/root/send/savedata", "/root/main/result");
  416. // 바코드번호 초기화
  417. model.setValue("/root/req/chartlend/bcno", "");
  418. ipt_lendbcno.refresh();
  419. // 다시조회.. 챠트대출
  420. fGetUserLendList();
  421. }
  422. } else {
  423. if (chrtpid == ""){
  424. window.alert("환자번호를 입력해 주세요", "차트대출 및 반납", 0 | 64);
  425. model.setFocus("ipt_chrtpid");
  426. return;
  427. }
  428. for ( var i = 1; i < grd_chartlist.rows; i++)
  429. {
  430. var pid = model.getValue("/root/main/chartlend/chrtlist["+ i +"]/pid");
  431. var ioflag = model.getValue("/root/main/chartlend/chrtlist["+ i +"]/ioflag");
  432. var chrtflag = "I";
  433. var bcno = model.getValue("/root/main/chartlend/chrtlist["+ i +"]/bcno");
  434. var medirecno = model.getValue("/root/main/chartlend/chrtlist["+ i +"]/medirecno");
  435. var chkflag = model.getValue("/root/main/chartlend/chrtlist["+ i +"]/chkflag");
  436. if(chkflag == "Y"){
  437. tmpSaveData = tmpSaveData + "i▦" + pid + "▦" + ioflag + "▦" + chrtflag + "▦▦" + medirecno + "▦" ;
  438. tmpSaveData = tmpSaveData + rendcd + "▦" + appdeptcd + "▦" + lendmanid + "▦" + appmanid + "▦" + msgcnts + "▦" + cntctelno + "▦M▩";
  439. icnt++;
  440. }
  441. }
  442. if(icnt < 1){
  443. window.alert("대출할 차트를 선택해 주세요", "차트대출 및 반납", 0 | 64);
  444. return;
  445. }
  446. if (tmpSaveData != ""){
  447. model.makeValue("/root/send/savedata", HearderData + tmpSaveData);
  448. submit("TXMRC02701", "", "/root/send/savedata", "/root/main/result");
  449. // 다시조회.. 종이챠트 리스트
  450. // 2008.12.11. 환자번호 체크번호 조회 안하고 입원차트 조회하기...
  451. var pid = model.getValue("/root/req/chartlend/chrtpid");
  452. model.makeValue("/root/send/reqdata/ioflag", "I");
  453. model.makeValue("/root/send/reqdata/pid", pid);
  454. submit("TRMRC02700","","/root/send/reqdata","/root/main/chartlend/chrtlist");
  455. // 다시조회.. 챠트대출
  456. fGetUserLendList();
  457. }
  458. }
  459. }
  460. /**
  461. * @desc : 등록된 환자번호인지 체킹한다..
  462. * @
  463. * @param : iptObj - 환자번호 입력 컨트롤 (pid)
  464. * @return :
  465. * @authur : 이은영 2008.09.17
  466. * @---------------------------------------------------
  467. */
  468. function fGetPidNo(iptObj, ref)
  469. {
  470. var chkyn = model.getValue(ref);
  471. if (chkyn == "Y") {
  472. if (iptObj.currentText.length > 0) {
  473. var pid = iptObj.currentText;
  474. pid = getCretCheckNo(pid, getUserInfo("dutplceinstcd"));
  475. model.makeValue(iptObj.attribute("ref"), pid);
  476. iptObj.refresh();
  477. }
  478. }
  479. }
  480. /**
  481. * @desc : 등록된 환자번호인지 체킹한다..
  482. * @
  483. * @param : iptObj - 환자번호 입력 컨트롤 (pid)
  484. * @return : pnm - 환자명
  485. * @authur : 이은영 2008.03.18
  486. * @---------------------------------------------------
  487. */
  488. function fCheckPid(iptObj, refPnm)
  489. {
  490. model.makeValue("/root/send/req/srchcond", "1");
  491. model.makeValue("/root/send/req/pid", iptObj.currentText);
  492. //환자등록번호 체크
  493. if(iptObj.currentText.length > 0 ){
  494. model.resetInstanceNode("/root/main/result/patinfo");
  495. model.makeNode("/root/main/result/patinfo");
  496. if(submit("TRPMC02500", "", "/root/send/req", "/root/main/result/patinfo")){
  497. //fSearch는 인적사항 화면을 임포트 해간 화면에서 구현해 주어야 하는 함수이다.
  498. if( getNodesetCount("/root/main/result/patinfo/patinfolist") > 0 ){
  499. model.copyNode("/root/main/patinfo", "/root/main/result/patinfo");
  500. var pid = model.getValue("/root/main/result/patinfo/patinfolist/pid");
  501. var pnm = model.getValue("/root/main/result/patinfo/patinfolist/hngnm");
  502. if (refPnm != null)
  503. {
  504. model.makeValue(refPnm, pnm);
  505. }
  506. return pnm;
  507. }else{
  508. model.resetInstanceNode("/root/main/patinfo/patinfolist");
  509. messageBox("없는 환자 번호 입니다.", "E999", "");
  510. model.refresh();
  511. return "";
  512. }
  513. }
  514. }else{
  515. messageBox("환자등록번호를 정확히", "C001");
  516. return "";
  517. }
  518. }
  519. /**
  520. * @desc : 환자등록번호 조회 팝업
  521. * @
  522. * @param : refPid - 환자번호 참고 node path
  523. * refPnm - 환자명 참고 node path
  524. * @return :
  525. * @authur : 이은영 2008.07.14
  526. * @---------------------------------------------------
  527. */
  528. function fGetPid(refPid, refPnm)
  529. {
  530. //조회건수가 1건일 경우 팝업창을 바로 닫는다.
  531. model.setValue("/root/hidden/tmp/pidpopupinfo/checkfnexam", "1");
  532. model.setValue("/root/hidden/tmp/pidpopupinfo/autoflag", "N");
  533. if( model.getValue("/root/hidden/tmp/pidpopupinfo/srchcond") == '' ){
  534. model.setValue("/root/hidden/tmp/pidpopupinfo/srchcond", '2');
  535. }
  536. modal("SPPMC02500", "1","150", "150", "SPPMC02500", "/root/hidden/tmp/pidpopupinfo", "/root/send");
  537. model.resetInstanceNode("/root/source");
  538. //환자번호 copy
  539. var popupendflag = model.getValue("/root/main/popupendflag");
  540. if (popupendflag == "ok")
  541. {
  542. model.setValue(refPid, model.getValue("/root/main/patinfo/patinfolist/pid"));
  543. if (refPnm != null || refPnm != "") {
  544. model.setValue(refPnm, model.getValue("/root/main/patinfo/patinfolist/hngnm"));
  545. }
  546. model.refresh();
  547. }
  548. }
  549. /**
  550. * @desc : 등록된 사용자 번호인지 체킹한다..
  551. * @
  552. * @param : iptObj - 사용자 ID 입력 컨트롤 (userid)
  553. * @return : posdeptcd - 사용자 부서코드
  554. * @authur : 이은영 2008.07.14
  555. * @---------------------------------------------------
  556. */
  557. function fCheckUserid(iptObj)
  558. {
  559. setInputNodeCurText();
  560. // 사용자 번호 체크
  561. if(iptObj.currentText.length > 0 ){
  562. // 사용자 조회
  563. model.removenode("/root/hidden/tmp/tempuserinfo/list");
  564. model.reset("/root/hidden/tmp/tempuserinfo");
  565. model.setValue("/root/hidden/tmp/userpopupinfo/param", "_OneS");
  566. model.setValue("/root/hidden/tmp/userpopupinfo/flag", "userid");
  567. model.setValue("/root/hidden/tmp/userpopupinfo/searchitem", iptObj.currentText);
  568. modal("SPZSU10103", "", "200", "200", "SPZSU10103","/root/hidden/tmp/userpopupinfo","/root/main/temp");
  569. var iParam = getParameter("SPZSU10103_");
  570. setCSVToNode("/root/hidden/tmp/tempuserinfo", iParam);
  571. clearParameter("SPZSU10103_");
  572. //fSearch는 인적사항 화면을 임포트 해간 화면에서 구현해 주어야 하는 함수이다.
  573. if( getNodesetCount("/root/hidden/tmp/tempuserinfo/list") > 0 ){
  574. var userid = model.getValue("/root/hidden/tmp/tempuserinfo/list/userid");
  575. var posdeptcd = model.getValue("/root/hidden/tmp/tempuserinfo/list/posdeptcd");
  576. iptObj.value = userid;
  577. model.refresh();
  578. return posdeptcd;
  579. //fSearch();
  580. }else{
  581. model.resetInstanceNode("/root/hidden/tmp/tempuserinfo/list");
  582. messageBox("없는 사용자 번호 입니다.", "E999", "");
  583. model.refresh();
  584. }
  585. }else{
  586. messageBox("사용자 번호를 정확히", "C001");
  587. }
  588. return "";
  589. }
  590. /**
  591. * @desc : 마우스 오른쪽 버튼 팝업창
  592. * @
  593. * @param : job - 0:챠트대출, 1:챠트반납
  594. * @return :
  595. * @authur : 이은영 2008.07.14
  596. * @---------------------------------------------------
  597. */
  598. function fMouseRghtBtnPopup(gridObj, job)
  599. {
  600. if (event.button == 3) {
  601. if (gridObj.isCell(event.target) && gridObj.mouseRow >= gridObj.fixedrows) {
  602. if (job == "0") {
  603. model.removeNodeset("/root/send/savedata");
  604. window.setPopupMenu(true, "/root/hidden/applist_menu/menu", "label", "func", false);
  605. } else if (job == "1") {
  606. model.removeNodeset("/root/send/savedata");
  607. window.setPopupMenu(true, "/root/hidden/rtntrgtlist_menu/menu", "label", "func", false);
  608. } else {
  609. window.setPopupMenu(false);
  610. }
  611. } else {
  612. window.setPopupMenu(false);
  613. }
  614. } else {
  615. window.setPopupMenu(false);
  616. }
  617. }
  618. /**
  619. * @desc : 팝업폼 보여주기..
  620. * @
  621. * @param : job - 0:챠트대출(미대출사유) , 1:챠트반납(과보관사유),
  622. * @ 2:접수자명단(미대출사유), 3:챠트반납(대출연장)
  623. * @return :
  624. * @authur : 이은영 2008.07.14
  625. * @---------------------------------------------------
  626. */
  627. function fShowWndIptBox(job)
  628. {
  629. grup_losschrt.visible = "false";
  630. model.setValue("/root/hidden/lendlist/chrtstat", "01");
  631. model.refresh();
  632. if (event.clientY < 300) {
  633. grup_losschrt.attribute("top") = event.clientY-110;
  634. } else {
  635. grup_losschrt.attribute("top") = 200;
  636. }
  637. grup_losschrt.visible = "true";
  638. }
  639. /**
  640. * @desc : 선택된 환자등록번호로 현위치조회 텝이동..
  641. * @
  642. * @param : gridObj - 그리드 컨트롤, ref - node path
  643. * @return :
  644. * @authur : 이은영 2008.07.14
  645. * @---------------------------------------------------
  646. */
  647. function fMoveTabChartByPid(gridObj, ref){
  648. if (isDataCell() == false){
  649. return;
  650. }
  651. if (gridObj.row < 1){
  652. return;
  653. }
  654. var chrtdept = model.getValue(ref + "[" + gridObj.row +"]/chrtdeptcd");
  655. var pid = model.getValue(ref + "[" + gridObj.row +"]/pid");
  656. var pnm = model.getValue(ref + "[" + gridObj.row +"]/pnm");
  657. var renddd = model.getValue(ref + "[" + gridObj.row +"]/renddd");
  658. var dd = getCurrentDate();
  659. var valitodd = (dd.toDate()).getAddDate(-90);
  660. valitodd = valitodd.getDateFormat();
  661. if(renddd == ""){
  662. renddd = valitodd;
  663. }
  664. model.makeValue("/root/req/rendreport/pid" , pid);
  665. model.makeValue("/root/req/rendreport/pnm" , pnm);
  666. model.makeValue("/root/req/rendreport/fromdd", renddd);
  667. model.makeValue("/root/req/rendreport/todd" , dd);
  668. model.makeValue("/root/req/rendreport/dept" , chrtdept);
  669. model.refresh();
  670. btn_movchrt.dispatch("onclick");
  671. // 2008.12.18. 차트정보 조회하기..
  672. fChartHistory();
  673. }
  674. /**
  675. * @desc : 현위치조회
  676. * @
  677. * @param :
  678. * @return :
  679. * @authur : 이은영 2008.07.14
  680. * @---------------------------------------------------
  681. */
  682. function fChartHistory()
  683. {
  684. if(isXPathTextNull("/root/req/rendreport/pid")){
  685. messageBox("환자번호를 입력해 주세요.", "I999", "");
  686. return;
  687. }
  688. model.makeValue("/root/send/reqdata/medirecno", "");
  689. model.removeNodeset("/root/main/rendreport/report/chrtlist");
  690. model.removeNodeset("/root/main/rendreport/report/unpreplist");
  691. model.removeNodeset("/root/main/rendreport/report/chrtlendlist");
  692. model.removeNodeset("/root/main/rendreport/report/chrtstatlist");
  693. model.refresh();
  694. // 입원차트 조회하기...
  695. model.setValue("/root/req/rendreport/ioflag", "I");
  696. model.copyNode("/root/send/reqdata", "/root/req/rendreport");
  697. submit("TRMRC02700","","/root/send/reqdata","/root/main/rendreport/report/chrtlist");
  698. }
  699. /**
  700. * @desc : 입원차트 조회
  701. * @
  702. * @param :
  703. * @return :
  704. * @authur : 이은영 2008.07.14
  705. * @---------------------------------------------------
  706. */
  707. function fGetChartList()
  708. {
  709. fGetPidNo(ipt_chrtpid, "/root/hidden/chkyn2");
  710. fCheckPid(ipt_chrtpid, "/root/req/chartlend/chrtpnm");
  711. // 입원차트 조회하기...
  712. model.makeValue("/root/send/reqdata/ioflag", "I");
  713. var pid = ipt_chrtpid.currentText;
  714. model.makeValue("/root/send/reqdata/pid", pid);
  715. submit("TRMRC02700","","/root/send/reqdata","/root/main/chartlend/chrtlist");
  716. }
  717. /**
  718. * @desc : 대출용도 코드 입력시 대출용도 콤보 선택되도록 함
  719. * @
  720. * @param :
  721. * @return :
  722. * @authur : 이은영 2008.07.14
  723. * @---------------------------------------------------
  724. */
  725. function fSelectedComboLendCd(iptObj, comboRef)
  726. {
  727. var lendcd = iptObj.currentText;
  728. lendcd = lendcd.getLeftPad(3, "0");
  729. var ref = iptObj.attribute("ref");
  730. model.setValue(ref, lendcd);
  731. model.setValue(comboRef, lendcd);
  732. model.refresh();
  733. }
  734. /**
  735. * @desc : 대출과 약어 입력시 대출과 콤보 선택되도록 함
  736. * @
  737. * @param :
  738. * @return :
  739. * @authur : 이은영 2008.05.30
  740. * @---------------------------------------------------
  741. */
  742. function fSelectedComboLendDeptCd(iptObj, comboObj)
  743. {
  744. var lenddeptabbr = iptObj.currentText;
  745. lenddeptabbr = lenddeptabbr.toUpperCase( );
  746. var ref = iptObj.attribute("ref");
  747. model.setValue(ref, lenddeptabbr);
  748. var deptcd = model.getValue("/root/init/lendmastinfo/lenddeptlist[lenddeptabbr ='" + lenddeptabbr + "']/lenddeptcd");
  749. var comboRef = comboObj.attribute("ref");
  750. model.setValue(comboRef, deptcd);
  751. model.refresh();
  752. if (deptcd != ""){
  753. // 대출과에 따른 대출자(의사) 조회하기
  754. comboObj.dispatch("xforms-value-changed");
  755. }
  756. }
  757. /**
  758. * @desc : 사용자콤보 조회
  759. * @
  760. * @param : ref - reference path
  761. * rsltref - result reference path
  762. * deptcd - 부서코드
  763. * jobkindcd - 직종코드
  764. * jobposcd - 직책코드
  765. * specordyn - 선택진료여부
  766. * @return :
  767. * @author :
  768. * @---------------------------------------------------
  769. */
  770. function fGetUserComboList(ref, rsltref, deptcd, jobkindcd, specordyn)
  771. {
  772. model.removeNode(ref);
  773. model.makeValue(ref + "/deptcd" , deptcd); //부서코드
  774. model.makeValue(ref + "/jobkindcd", jobkindcd); //직종코드(의사:0330)
  775. model.makeValue(ref + "/specordyn", specordyn); //선택진료여부
  776. model.removeNode(rsltref);
  777. model.makeValue(rsltref + "/userlist/usercombo[1]/usernm", '-');
  778. model.makeValue(rsltref + "/userlist/usercombo[1]/userid", '');
  779. model.refresh();
  780. submit("TRMMB04102", "false", ref, rsltref + "/userlist");
  781. }
  782. /**
  783. * @desc : 차트 반납에서 대출일자 기간 콤보 보여줄까? 말까?
  784. * @
  785. * @param :
  786. * @return :
  787. * @authur : 이은영 2008.07.14
  788. * @---------------------------------------------------
  789. */
  790. function fLendTermDisabled()
  791. {
  792. var lendtermdisabled = lendterm_disabled.value;
  793. if (lendtermdisabled == "Y") {
  794. var today = getCurrentDate();
  795. var valitodd = (today.toDate()).getAddDate(-90);
  796. valitodd = valitodd.getDateFormat();
  797. model.setValue("/root/req/chartreturn/fromappdd", today);
  798. model.setValue("/root/req/chartreturn/toappdd" , today);
  799. ipt_rtnfromappdd.disabled = false;
  800. ipt_rtntoappdd.disabled = false;
  801. } else {
  802. model.setValue("/root/req/chartreturn/fromappdd", "");
  803. model.setValue("/root/req/chartreturn/toappdd" , "");
  804. ipt_rtnfromappdd.disabled = true;
  805. ipt_rtntoappdd.disabled = true;
  806. }
  807. ipt_rtnfromappdd.refresh();
  808. ipt_rtntoappdd.refresh();
  809. }
  810. /**
  811. * @desc : 차트 반납에서 반납예정일 기간 콤보 보여줄까? 말까?
  812. * @
  813. * @param :
  814. * @return :
  815. * @authur : 이은영 2008.07.14
  816. * @---------------------------------------------------
  817. */
  818. function fRrtTermDisabled()
  819. {
  820. var rtntermdisabled = rtnterm_disabled.value;
  821. if (rtntermdisabled == "Y") {
  822. var today = getCurrentDate();
  823. var valitodd = (today.toDate()).getAddDate(-90);
  824. valitodd = valitodd.getDateFormat();
  825. model.setValue("/root/req/chartreturn/fromrtndd", today);
  826. model.setValue("/root/req/chartreturn/tortndd" , today);
  827. ipt_fromrtndd.disabled = false;
  828. ipt_tortndd.disabled = false;
  829. } else {
  830. model.setValue("/root/req/chartreturn/fromrtndd", "");
  831. model.setValue("/root/req/chartreturn/tortndd" , "");
  832. ipt_fromrtndd.disabled = true;
  833. ipt_tortndd.disabled = true;
  834. }
  835. ipt_fromrtndd.refresh();
  836. ipt_tortndd.refresh();
  837. }
  838. /**
  839. * @desc : 챠트상태를 수정한다.
  840. * @
  841. * @param :
  842. * @return :
  843. * @authur : 이은영 2008.07.14
  844. * @---------------------------------------------------
  845. */
  846. function fUpdateChrtStat(){
  847. var medirecno = model.getValue("/root/req/rendreport/medirecno");
  848. if(medirecno == ""){
  849. messageBox("선택된 차트이력이 ", "I004")
  850. return;
  851. }
  852. model.copyNode("/root/send/reqdata", "/root/req/rendreport");
  853. model.removeNodeset("/root/main/rendreport/report/chrtstatlist");
  854. submit("TXMRC01403", "true", "/root/send/reqdata", "/root/main/rendreport/report/chrtlist");
  855. }
  856. /**
  857. * @desc : 선택된 챠트정보를 조회한다.
  858. * @
  859. * @param :
  860. * @return :
  861. * @authur : 이은영 2008.07.14
  862. * @---------------------------------------------------
  863. */
  864. function fDisplayChrtInfo(gridObj){
  865. if (gridObj.row < 1){
  866. return;
  867. }
  868. var ref = gridObj.nodeset;
  869. var row = gridObj.row;
  870. var pid = model.getValue(ref + "[" + row +"]/pid");
  871. var pnm = model.getValue(ref + "[" + row +"]/pnm");
  872. var medirecno = model.getValue(ref + "[" + row +"]/medirecno");
  873. var orddeptcd = model.getValue(ref + "[" + row +"]/orddeptcd");
  874. var bcno = model.getValue(ref + "[" + row +"]/bcno");
  875. var chrtrem = model.getValue(ref + "[" + row +"]/chrtrem");
  876. var chrtstat = model.getValue(ref + "[" + row +"]/chrtstat");
  877. var lendyn = model.getValue(ref + "[" + row +"]/lendyn");
  878. var lastorddd = model.getValue(ref + "[" + row +"]/lastorddd");
  879. var ioflag = model.getValue(ref + "[" + row +"]/ioflag");
  880. var dschdd = model.getValue(ref + "[" + row +"]/dschdd");
  881. model.makeValue("/root/req/rendreport/pid" , pid);
  882. model.makeValue("/root/req/rendreport/pnm" , pnm);
  883. model.makeValue("/root/req/rendreport/medirecno", medirecno);
  884. model.makeValue("/root/req/rendreport/orddeptcd", orddeptcd);
  885. model.makeValue("/root/req/rendreport/bcno" , bcno);
  886. model.makeValue("/root/req/rendreport/chrtrem" , chrtrem);
  887. model.makeValue("/root/req/rendreport/chrtstat" , chrtstat);
  888. model.makeValue("/root/req/rendreport/lendyn" , lendyn);
  889. model.makeValue("/root/req/rendreport/lastorddd", lastorddd);
  890. model.makeValue("/root/req/rendreport/ioflag" , ioflag);
  891. model.makeValue("/root/req/rendreport/dschdd" , dschdd);
  892. model.copyNode("/root/send/reqdata", "/root/req/rendreport");
  893. // 미비현황
  894. submit("TRMRC02701", "true", "/root/send/reqdata", "/root/main/rendreport/report/unpreplist");
  895. // 챠트대출이력조회
  896. submit("TRMRC02702", "true", "/root/send/reqdata", "/root/main/rendreport/report/chrtlendlist");
  897. // 챠트분실이력조회
  898. submit("TRMRC01401", "true", "/root/send/reqdata", "/root/main/rendreport/report/chrtstatlist");
  899. }
  900. /**
  901. * @desc : 대출자 조회
  902. * @
  903. * @param : refUserid - 대출자 ID, refUserDeptcd - 소속부서코드 ( posdeptcd )
  904. * @return :
  905. * @authur : 이은영 2008.03.18
  906. * @---------------------------------------------------
  907. */
  908. function fGetUserid(refUserid, refUsernm, refUserDeptcd, cmbObj)
  909. {
  910. model.removenode("/root/hidden/tmp/tempuserinfo/list");
  911. model.reset("/root/hidden/tmp/tempuserinfo");
  912. var user = model.getValue(refUserid);
  913. var flag = "userid";
  914. if(isNaN(user)){
  915. flag = "usernm";
  916. }
  917. model.setValue("/root/hidden/tmp/userpopupinfo/param", "_OneS");
  918. model.setValue("/root/hidden/tmp/userpopupinfo/flag", flag);
  919. model.setValue("/root/hidden/tmp/userpopupinfo/searchitem", user);
  920. modal("SPZSU10103", "", "200", "200", "SPZSU10103","/root/hidden/tmp/userpopupinfo","/root/main/temp");
  921. var iParam = getParameter("SPZSU10103_");
  922. setCSVToNode("/root/hidden/tmp/tempuserinfo", iParam);
  923. clearParameter("SPZSU10103_");
  924. model.refresh();
  925. //fSearch는 인적사항 화면을 임포트 해간 화면에서 구현해 주어야 하는 함수이다.
  926. if( getNodesetCount("/root/hidden/tmp/tempuserinfo/list") > 0 ){
  927. var userid = model.getValue("/root/hidden/tmp/tempuserinfo/list/userid");
  928. var usernm = model.getValue("/root/hidden/tmp/tempuserinfo/list/usernm");
  929. var posdeptcd = model.getValue("/root/hidden/tmp/tempuserinfo/list/posdeptcd");
  930. if (!isNull(refUsernm)){
  931. if (isNaN(refUsernm)){
  932. model.makeValue(refUsernm, usernm);
  933. }
  934. }
  935. if (!isNull(refUserDeptcd)){
  936. if (isNaN(refUserDeptcd)){
  937. model.makeValue(refUserDeptcd, posdeptcd);
  938. }
  939. }
  940. if (cmbObj != null){
  941. fAddUser(userid, usernm, cmbObj);
  942. }
  943. model.makeValue(refUserid, userid);
  944. model.refresh();
  945. }
  946. }
  947. /**
  948. * @desc : 대출자ID, 대출자명 콤보에 추가하기
  949. * @
  950. * @param : refUserid - 대출자 ID, refUsernm - 대출자명
  951. * @return :
  952. * @authur : 이은영 2008.09.01
  953. * @---------------------------------------------------
  954. */
  955. function fAddUser(Userid, Usernm, cmbObj)
  956. {
  957. var ref = cmbObj.choices.itemset.attribute("nodeset");
  958. var cnt = getNodesetCnt(model, ref) + 1 ;
  959. var userid = model.getValue(ref + "[userid ='" + Userid + "']/userid");
  960. if (userid == ""){
  961. model.makeValue(ref + "["+ cnt +"]/userid", Userid);
  962. model.makeValue(ref + "["+ cnt +"]/usernm", Usernm);
  963. }
  964. }
  965. /**
  966. * @desc : excel 저장 하기
  967. * @
  968. * @param :
  969. * @return :
  970. * @authur : 이은영 2008.07.14
  971. * @---------------------------------------------------
  972. */
  973. function fExcel(gridObj, title){
  974. if (title == null) { title = "" }
  975. var fileName = window.fileDialog("save", ",", false, title + "_" + getCurrentDate(), "xls", "Excel Files(*.xls)|*.xls|All Files (*.*)|*.*");
  976. if (fileName != "") {
  977. gridObj.saveExcel(fileName, "SheetName", true, true, "", "", true);
  978. }
  979. }