SPMMR07000.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513
  1. /**
  2. * @desc : 메인화면 로딩
  3. * @id :
  4. * @event : onclick
  5. * @return : void
  6. * @authur : 박종훈
  7. */
  8. function fReadyForm()
  9. {
  10. fReadyFormInitData();
  11. model.setValue("/root/init/reqmedireclist/diffdt", 12); //검색 디폴트 12개월
  12. fAddDateReq("today");
  13. var defltdeptcd = getUserInfo("dutplcecd");
  14. var defltdeptnm = model.getValue("/root/init/deptlist/dept[deptcd'" + defltdeptcd + "']/deptnm");
  15. if (defltdeptcd == "2280000000" || defltdeptnm == "")
  16. {
  17. defltdeptcd = "ALL";
  18. }
  19. model.setValue("/root/init/dept", defltdeptcd);
  20. model.refresh();
  21. ivw_reccnts.window.javascript.fInitPage(parseInt(ivw_reccnts.attribute("width")) , parseInt(ivw_reccnts.attribute("height")));
  22. ivw_reccnts1.window.javascript.fInitPage(parseInt(ivw_reccnts1.attribute("width")), parseInt(ivw_reccnts1.attribute("height")));
  23. var ctrl = document.controls("ipt_pid");
  24. if (ctrl != null)
  25. {
  26. model.setFocus(ctrl.attribute("id"));
  27. ctrl.dispatch("onkeyup");
  28. }
  29. //파라이터 처리(등록번호, 기록순번)
  30. var parampid = opener.window.javascript.getParameter("SPMMR07000_param_pid");
  31. var paramformrecseq = opener.window.javascript.getParameter("SPMMR07000_param_formrecseq");
  32. var srcformcd = opener.window.javascript.getParameter("SPMMR07000_param_srcformcd");
  33. var lastyn = opener.window.javascript.getParameter("SPMMR07000_param_lastyn");
  34. model.setValue("/root/init/reqmedireclist/srcformcd",srcformcd);
  35. model.setValue("/root/init/reqmedireclist/lastyn",lastyn);
  36. if(paramformrecseq != "")
  37. {
  38. ivw_reccnts.window.javascript.fClear();
  39. ivw_reccnts1.window.javascript.fClear();
  40. model.removeNodeset("/root/send/reqmedireclist");
  41. model.makeValue("/root/send/reqmedireclist/pid", "");
  42. model.makeValue("/root/send/reqmedireclist/formrecseq", paramformrecseq);
  43. model.makeValue("/root/send/reqmedireclist/formnm", "-");
  44. if (submit("TRMMR07001"))
  45. {
  46. var cnt = getNodesetCnt(model, "/root/main/mainlist/medireclist");
  47. if (cnt > 0)
  48. {
  49. model.setValue("/root/init/dept", "ALL");
  50. var sPid = model.getValue("/root/main/mainlist/medireclist/pid");
  51. ipt_pid.value = sPid;
  52. fPidKeyPress(); //등록번호로 환자 정보조회
  53. }
  54. }
  55. }
  56. else if (parampid != "")
  57. {
  58. ipt_pid.value = parampid;
  59. fPidKeyPress(); //등록번호로 환자 정보조회
  60. fRefMediRecList();
  61. }
  62. else
  63. {
  64. var pamInfoCvs = getGlobalVariable("paminfo"); //상단정보가 있을 경우는 검색
  65. if(pamInfoCvs != null && pamInfoCvs != "")
  66. { //cvs가 null이 아닌 경우에만 처리함.
  67. model.removeNodeSet ("/root/main/result/paminfo/list");
  68. setCSVToNode ("/root/main/result/paminfo", pamInfoCvs);
  69. var pid = model.getValue ("/root/main/result/paminfo/list/pid");
  70. ipt_pid.value = pid;
  71. fPidKeyPress(); //등록번호로 환자 정보조회
  72. fRefMediRecList();
  73. }
  74. }
  75. }
  76. /**
  77. * @desc : 기록 목록 조회
  78. * @id :
  79. * @event :
  80. * @return : void
  81. * @authur : 박종훈
  82. */
  83. function fRefMediRecList()
  84. {
  85. if (model.getValue("/root/main/patinfo/patinfolist/pid") == "")
  86. {
  87. messageBox("환자정보가 존재하지 않아 진행 ", "E001");
  88. return;
  89. }
  90. ivw_reccnts.window.javascript.fClear();
  91. ivw_reccnts1.window.javascript.fClear();
  92. model.removeNodeset("/root/main/mainlist/medireclist");
  93. model.removeNodeset("/root/main/histlist/rechistlist");
  94. model.removeNodeset("/root/send/reqmedireclist");
  95. model.makeValue("/root/send/reqmedireclist/pid", model.getValue("/root/main/patinfo/patinfolist/pid"));
  96. model.makeValue("/root/send/reqmedireclist/recfromdt", model.getValue("/root/init/reqmedireclist/recfromdt"));
  97. model.makeValue("/root/send/reqmedireclist/rectodt", model.getValue("/root/init/reqmedireclist/rectodt"));
  98. model.makeValue("/root/send/reqmedireclist/formrecdeptcd", model.getValue("/root/init/dept"));
  99. model.makeValue("/root/send/reqmedireclist/formrecseq", "0");
  100. model.makeValue("/root/send/reqmedireclist/srcformcd", model.getValue("/root/init/reqmedireclist/srcformcd"));
  101. var formnm = model.getValue("/root/init/formnm");
  102. if (formnm == "")
  103. {
  104. formnm = "-";
  105. }
  106. model.makeValue("/root/send/reqmedireclist/formnm", formnm);
  107. submit("TRMMR07001");
  108. var srcformcd = model.getValue("/root/init/reqmedireclist/srcformcd");
  109. if ( srcformcd != null )
  110. {
  111. fGetRecHist(grd_medireclist.valueMatrix(1, grd_medireclist.colref("formrecseq")));
  112. fGetRecCntsHist(grd_rechist.valueMatrix(1, grd_rechist.colref("rechistseq")), grd_rechist.valueMatrix(1, grd_rechist.colref("rowcolor")));
  113. }
  114. cnt = 0;
  115. var cnt = getNodesetCnt(model, "/root/main/mainlist/visitdept");
  116. if (cnt > 0)
  117. {
  118. var orddd = model.getValue("/root/send/reqmedireclist/orddd");
  119. var cretno = model.getValue("/root/send/reqmedireclist/cretno");
  120. var cnt2 = getNodesetCnt(model, "/root/main/mainlist/medireclist");
  121. if (cnt2 == 0)
  122. {
  123. for (var i = 1; i <= cnt; i++)
  124. {
  125. model.makeValue("/root/main/mainlist/medireclist["+i+"]/formrecdeptcd", model.getValue("/root/main/mainlist/visitdept["+i+"]/orddeptcd"));
  126. model.makeValue("/root/main/mainlist/medireclist["+i+"]/formrecdeptnm", model.getValue("/root/main/mainlist/visitdept["+i+"]/orddeptnm"));
  127. model.makeValue("/root/main/mainlist/medireclist["+i+"]/formnminfo", "호출과 미작성");
  128. model.makeValue("/root/main/mainlist/medireclist["+i+"]/orddd", orddd);
  129. model.makeValue("/root/main/mainlist/medireclist["+i+"]/cretno", cretno);
  130. }
  131. }
  132. else
  133. {
  134. var cond = "/root/main/mainlist/medireclist[orddd='#orddd#' and cretno='#cretno#' and formrecdeptcd='#deptcd#']";
  135. cond = cond.replace("#orddd#", orddd);
  136. cond = cond.replace("#cretno#", cretno);
  137. var stmt;
  138. for (var i = 1; i <= cnt; i++)
  139. {
  140. stmt = cond.replace("#deptcd#", model.getValue("/root/main/mainlist/visitdept["+i+"]/orddeptcd"));
  141. nodelist = instance1.selectNodes(stmt);
  142. cnt2 = getNodesetCnt(model, stmt);
  143. if (cnt2 == 0)
  144. {
  145. grd_medireclist.insertRow(1, "above");
  146. model.setValue("/root/main/mainlist/medireclist[1]/formrecdeptcd", model.getValue("/root/main/mainlist/visitdept["+i+"]/orddeptcd"));
  147. model.setValue("/root/main/mainlist/medireclist[1]/formrecdeptnm", model.getValue("/root/main/mainlist/visitdept["+i+"]/orddeptnm"));
  148. model.setValue("/root/main/mainlist/medireclist[1]/formnminfo", "호출과 미작성");
  149. model.setValue("/root/main/mainlist/medireclist[1]/orddd", orddd);
  150. model.setValue("/root/main/mainlist/medireclist[1]/cretno", cretno);
  151. }
  152. }
  153. }
  154. model.refresh();
  155. for (var i = 1; i <= grd_medireclist.rows; i++)
  156. {
  157. if (grd_medireclist.valueMatrix(i, grd_medireclist.colref("orddd")) == orddd &&
  158. grd_medireclist.valueMatrix(i, grd_medireclist.colref("cretno")) == cretno)
  159. grd_medireclist.rowStyle(i, "data", "color") = "blue";
  160. }
  161. }
  162. if (grd_medireclist.rows > 1)
  163. {
  164. grd_medireclist.row = 1;
  165. }
  166. }
  167. /**
  168. * @desc : 기록 이력 조회
  169. * @id :
  170. * @event :
  171. * @return : void
  172. * @authur : 박종훈
  173. */
  174. function fGetRecHist(formrecseq)
  175. {
  176. ivw_reccnts.window.javascript.fClear();
  177. ivw_reccnts1.window.javascript.fClear();
  178. model.removeNodeset("/root/send/reqrechistlist");
  179. model.makeValue("/root/send/reqrechistlist/formrecseq", formrecseq);
  180. model.makeValue("/root/send/reqrechistlist/lastyn", model.getValue("/root/init/reqmedireclist/lastyn"));
  181. if(submit("TRMMR07002"))
  182. {
  183. // var rowcolor = "";
  184. // for (var i = 1; i <= grd_rechist.rows; i++)
  185. // {
  186. // rowcolor = grd_rechist.valueMatrix(i, grd_rechist.colref("rowcolor"));
  187. // grd_rechist.rowstyle(i, "data", "background-color") = "#" + rowcolor;
  188. // }
  189. }
  190. }
  191. /**
  192. * @desc : 기록 목록 내용 조회
  193. * @id :
  194. * @event :
  195. * @return : void
  196. * @authur : 박종훈
  197. */
  198. function fGetRecCntsHist(rechistseq, rowcolor)
  199. {
  200. ivw_reccnts.window.javascript.fClear();
  201. ivw_reccnts.window.javascript.fRefRecViewByHistSeq(rechistseq);
  202. // if (rowcolor == "ccffff")
  203. // {
  204. // ivw_reccnts.window.javascript.fClear();
  205. // ivw_reccnts.window.javascript.fRefRecViewByHistSeq(rechistseq);
  206. // }
  207. // else
  208. // {
  209. // ivw_reccnts1.window.javascript.fClear();
  210. // ivw_reccnts1.window.javascript.fRefRecViewByHistSeq(rechistseq);
  211. // }
  212. }
  213. /**
  214. * @group :
  215. * @ver : 2009.03.25
  216. * @by : jonghun
  217. * @---------------------------------------------------
  218. * @type : function
  219. * @access : private
  220. * @desc : 마우스 오른쪽 버튼 이벤트
  221. * @param :
  222. * @return :
  223. * @---------------------------------------------------
  224. */
  225. function fMouseRight()
  226. {
  227. if(grd_rechist.isCell(event.target) && (grd_rechist.mouserow >= grd_rechist.fixedrows))
  228. {
  229. var loginuserid = getUserId();
  230. if (loginuserid == "97055522" || loginuserid == "99031128")
  231. {
  232. setPopupMenu("grd_rechist", false, "/root/init/cnstreqmsrght/mouserght", "label", "func");
  233. }
  234. }
  235. }
  236. /**
  237. * @desc : 진료기록 리스트 조회조건의 진료과 조회 및 서식즐겨찾기 조회
  238. * @id :
  239. * @event :
  240. * @return : void
  241. * @authur : 박종훈
  242. */
  243. function fReadyFormInitData()
  244. {
  245. mmbfGetDeptCodeComboList("/root/send/reqdeptlist", "/root/init/deptlist", "A");
  246. model.setValue("/root/init/deptlist/dept[1]/deptcd", "ALL");
  247. model.setValue("/root/init/deptlist/dept[1]/depthngnm", "전체");
  248. }
  249. /**
  250. * @group :
  251. * @ver : 2009.03.25
  252. * @by : jonghun
  253. * @---------------------------------------------------
  254. * @type : function
  255. * @access : private
  256. * @desc : 마우스 오른쪽 버튼 이벤트
  257. * @param :
  258. * @return :
  259. * @---------------------------------------------------
  260. */
  261. function fSetReplaceImg()
  262. {
  263. var rechistseq = grd_rechist.valueMatrix(grd_rechist.row, grd_rechist.colref("rechistseq"));
  264. model.removeNodeset("/root/send/imgreplace");
  265. model.makeValue("/root/send/imgreplace/rechistseq", rechistseq);
  266. if (submit("TXMMR07001"))
  267. {
  268. var cnt = model.getValue("/root/main/replacecnt/cnfmcnt/updtdd");
  269. cnt = parseInt(cnt);
  270. if (cnt > 0)
  271. {
  272. messageBox("수정", "I001");
  273. }
  274. }
  275. }
  276. /**
  277. * @desc : 환자이름 정보조회
  278. * @id :
  279. * @event : onkeypress
  280. * @return : void
  281. * @authur : 박종훈
  282. */
  283. function fPnmKeyPress()
  284. {
  285. model.setValue("/root/source/srchcond", "2");
  286. model.setValue("/root/source/hngnm", ipt_hngnm.currentText);
  287. inputEnterKey("btn_search", "DOMActivate");
  288. }
  289. /**
  290. * @desc : 환자정보조회 팝업
  291. * @id :
  292. * @event : DOMActivate
  293. * @return : void
  294. * @authur : 박종훈
  295. */
  296. function fPopPtinfo()
  297. {
  298. modal("SPPMC02500", "1","150", "150", "SPPMC02500", "/root/source", "/root/send");
  299. model.resetInstanceNode("/root/source");
  300. }
  301. /**
  302. * @desc : 환자번호 정보조회
  303. * @id :
  304. * @event : onkeypress
  305. * @return : void
  306. * @authur : 박종훈(튜닝)
  307. */
  308. function fPidKeyPress()
  309. {
  310. model.setValue("/root/source/srchcond", "1");
  311. model.setValue("/root/source/pid", ipt_pid.currentText);
  312. //inputEnterKey("btn_search", "DOMActivate");
  313. //환자등록번호 체크
  314. if(ipt_pid.currentText.length >= 1 )
  315. {
  316. model.resetInstanceNode("/root/main/result/patinfo");
  317. model.makeNode("/root/main/result/patinfo");
  318. if(submit("TRPMC02500"))
  319. {
  320. //fSearch는 인적사항 화면을 임포트 해간 화면에서 구현해 주어야 하는 함수이다.
  321. if( getNodesetCount("/root/main/result/patinfo/patinfolist") > 0 ){
  322. model.copyNode("/root/main/patinfo", "/root/main/result/patinfo");
  323. model.makeValue("/root/main/patinfo/agesex", model.getValue("/root/main/patinfo/patinfolist/sex") + "/" + model.getValue("/root/main/patinfo/patinfolist/age"));
  324. model.setValue("/root/main/popupendflag", "ok");
  325. model.refresh();
  326. oprnerId = opener.window.javascript.getScreenID();
  327. if(oprnerId == "SPMRC03200")
  328. {
  329. var keyparam = model.getValue("/root/main/patinfo/patinfolist/pid") + "▦" + model.getValue("/root/main/patinfo/patinfolist/hngnm") + "▦" + model.getValue("/root/main/patinfo/patinfolist/sex") + "▦" + model.getValue("/root/main/patinfo/patinfolist/age") + "▩";
  330. opener.window.javascript.fEnterPatinfo(keyparam);
  331. }
  332. }
  333. else
  334. {
  335. model.resetInstanceNode("/root/main/patinfo/patinfolist");
  336. messageBox("없는 등록번호 입니다.", "E999", "");
  337. }
  338. }
  339. }
  340. else
  341. {
  342. messageBox("등록번호를 정확히", "C001");
  343. }
  344. }
  345. /**
  346. * @desc : 미리보기 조회
  347. * @id :
  348. * @event :
  349. * @return : void
  350. * @authur : 박종훈
  351. */
  352. function fShowMediRecCnt(formrecseq)
  353. {
  354. if (model.getValue("/root/main/paminfo/pid") == "")
  355. {
  356. return;
  357. }
  358. var cond = new COMN_CONT_RECCNTS();
  359. var instance = document.models(0).instances(0);
  360. var nodeReclist = instance.selectNodes("/root/main/mainlist/medireclist");
  361. var nodeReclistlength = nodeReclist.length;
  362. cond.pid = model.getValue("/root/main/paminfo/pid");
  363. cond.formrecdeptcd = model.getValue("/root/send/reqmedireclist/formrecdeptcd");
  364. cond.chosflag = model.getValue("/root/send/reqmedireclist/chosflag");
  365. cond.reclistlength = nodeReclistlength;
  366. if (formrecseq == "")
  367. {
  368. cond.recfromdt = model.getValue("/root/init/reqmedireclist/recfromdt");
  369. cond.rectodt = model.getValue("/root/init/reqmedireclist/rectodt");
  370. }
  371. else
  372. {
  373. cond.recfromdt = "";
  374. cond.rectodt = "";
  375. }
  376. cond.formrecseq = formrecseq;
  377. ivw_reccnts.window.javascript.fRefMediRecCnts(cond);
  378. swt_left.selectedIndex = 1;
  379. button15.selected = true;
  380. }
  381. /**
  382. * @desc : 진료기록 리스트 조회조건 시작일, 종료일 셋팅
  383. * @id :
  384. * @event :
  385. * @return : void
  386. * @authur : 박종훈
  387. */
  388. function fAddDateReq(diffFlag)
  389. {
  390. var frdd = model.getValue("/root/init/reqmedireclist/recfromdt");
  391. var todd = model.getValue("/root/init/reqmedireclist/rectodt");
  392. var srcdd = new Date();
  393. var destdd = new Date();
  394. var diffdt;
  395. if (diffFlag == "next")
  396. {
  397. srcdd = todd.toDate();
  398. srcdd = srcdd.getAddDate(1, "D");
  399. frdd = srcdd.getDateFormat();
  400. diffdt = parseInt(model.getValue("/root/init/reqmedireclist/diffdt")) * 1;
  401. destdd = srcdd.getAddDate(diffdt, "M");
  402. todd = destdd.getDateFormat();
  403. }
  404. else if (diffFlag == "back")
  405. {
  406. srcdd = frdd.toDate();
  407. srcdd = srcdd.getAddDate(-1, "D");
  408. todd = srcdd.getDateFormat();
  409. diffdt = parseInt(model.getValue("/root/init/reqmedireclist/diffdt")) * -1;
  410. destdd = srcdd.getAddDate(diffdt, "M");
  411. frdd = destdd.getDateFormat();
  412. }
  413. else if (diffFlag == "today")
  414. {
  415. todd = getCurrentDate();
  416. var today = new Date();
  417. var frday = new Date();
  418. var diffdt = parseInt(model.getValue("/root/init/reqmedireclist/diffdt")) * -1;
  419. frday = today.getAddDate(diffdt , "M");
  420. frdd = frday.getDateFormat();
  421. }
  422. else
  423. {
  424. var today = todd.toDate();
  425. var frday = new Date();
  426. var diffdt = parseInt(model.getValue("/root/init/reqmedireclist/diffdt")) * -1;
  427. frday = today.getAddDate(diffdt , "M");
  428. frdd = frday.getDateFormat();
  429. }
  430. model.setValue("/root/init/reqmedireclist/recfromdt", frdd);
  431. model.setValue("/root/init/reqmedireclist/rectodt", todd);
  432. ipt_formrecdtfr.refresh();
  433. ipt_formrecdtto.refresh();
  434. }
  435. function fGetUserComnFormCd(srcformcd)
  436. {
  437. selnode = instance1.selectSingleNode("/root/main/tmpformlist/endformlist[srcformcd='"+srcformcd+"' and formuseflag='D' and formdeptcd='"+ getUserInfo("dutplcecd") +"']/formcd");
  438. if (selnode.text == "")
  439. {
  440. selnode = instance1.selectSingleNode("/root/main/tmpformlist/endformlist[srcformcd='"+srcformcd+"' and formuseflag='C']/formcd");
  441. }
  442. return selnode.text;
  443. }