SMMRJ00100.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  1. /* ---------------------------------------------------------------------
  2. Care Plan 관리 (SMMRJ00100_CountList관리.xrw - JScript )
  3. - Version :
  4. 1) : Ver.1.00.01
  5. : Create By taebum
  6. : 2009-11-27 오전 10:05:51
  7. ---------------------------------------------------------------------- */
  8. /* --------------------------------------------------*/
  9. /* type : function */
  10. /* access : public */
  11. /* desc : xforms-ready시 수행한다 */
  12. /* return : */
  13. /* --------------------------------------------------*/
  14. function fInit() {
  15. ipt_reqfromstnddd.value = getNewDate().getAddDate(-2, "D").getDateFormat("YYYYMMDD").substr(0, 8);
  16. ipt_reqtostnddd.value = getCurrentDate().substr(0, 8);
  17. fInitMain();
  18. fGetOpenPatInfo();
  19. // fSearchPatNm();
  20. }
  21. function fInitMain() {
  22. model.removeNodeSet("/root/main/careplanlists/careplanlist");
  23. model.removeNodeSet("/root/init/ordlists/ordlist");
  24. model.removeNodeSet("/root/main/careplanlists/diagengnminfo/diagengnm");
  25. model.removeNodeSet("/root/main/careplanlists/medirecinfo/medi0000931");
  26. model.removeNodeSet("/root/main/careplanlists/medirecinfo/medi0001173");
  27. model.removeNodeSet("/root/main/careplanlists/medirecinfo/medi0000098");
  28. combo1.refresh();
  29. ipt_diagengnm.refresh();
  30. tar_medi0001173.refresh();
  31. ipt_medi0000931.refresh();
  32. tar_medi0000098.refresh();
  33. datagrid01.refresh();
  34. datagrid02.refresh();
  35. datagrid03.refresh();
  36. datagrid04.refresh();
  37. datagrid05.refresh();
  38. datagrid99.refresh();
  39. }
  40. function fGetOpenPatInfo(){
  41. var pid = "";
  42. var orddd = "";
  43. var cretno = "";
  44. var hngnm = "";
  45. var ioflag= "";
  46. if (isPopup() == true) {
  47. // param 환자정보
  48. pid = opener.javascript.getParameter("SMMRJ00100_pid");
  49. orddd = opener.javascript.getParameter("SMMRJ00100_orddd");
  50. cretno = opener.javascript.getParameter("SMMRJ00100_cretno");
  51. hngnm = opener.javascript.getParameter("SMMRJ00100_hngnm");
  52. ioflag = opener.javascript.getParameter("SMMRJ00100_ioflag");
  53. if ( pid == null ) { pid == ""; }
  54. if ( orddd == null ) { orddd == ""; }
  55. if ( cretno == null ) { cretno == ""; }
  56. if ( hngnm == null ) { hngnm == ""; }
  57. if ( ioflag == null ) { ioflag == ""; }
  58. if ( pid != "" && orddd !="" && cretno!="" && hngnm != "" && ioflag!= "") {
  59. model.setValue("/root/send/reqdata/pid", pid);
  60. model.setValue("/root/send/reqdata/ordtype", ioflag);
  61. input3.refresh();
  62. model.setValue("/root/send/pid", pid);
  63. model.setValue("/root/send/orddd", orddd);
  64. model.setValue("/root/send/cretno", cretno);
  65. model.makeValue("/root/init/condition/pid", pid);
  66. model.makeValue("/root/init/condition/orddd", orddd);
  67. model.makeValue("/root/init/condition/cretno", cretno);
  68. model.setValue("/root/send/reqdata/pnm", hngnm);
  69. input4.refresh();
  70. fSearchOrdList();
  71. fChangeComboValue("open");
  72. }
  73. if(pid != "" && hngnm =="" ){
  74. model.setValue("/root/send/reqdata/pid", pid);
  75. fSearchPatNm();
  76. }
  77. }
  78. if ( pid == null || pid == "" ) {
  79. // 상단 환자정보
  80. var node = getGlobalVariable("paminfo");
  81. model.removeNodeset("/root/init/paminfo/list");
  82. setCSVToNode("/root/init/paminfo", node);
  83. pid = model.getValue("/root/init/paminfo/list/pid");
  84. model.makeValue("/root/send/reqdata/pid", pid);
  85. hngnm = model.getValue("/root/init/paminfo/list/hngnm");
  86. model.makeValue("/root/send/reqdata/pnm", hngnm);
  87. ioflag = model.getValue("/root/init/paminfo/list/ioflag");
  88. if(ioflag == "I"||ioflag == "D"||ioflag == "E"){
  89. ioflag = "I";
  90. }
  91. else if(ioflag == "O"){
  92. ioflag = "O";
  93. }
  94. else{
  95. ioflag = "ALL";
  96. }
  97. if(ioflag == "I"){
  98. orddd = model.getValue("/root/init/paminfo/list/indd");
  99. } else {
  100. orddd = model.getValue("/root/init/paminfo/list/orddd");
  101. }
  102. cretno = model.getValue("/root/init/paminfo/list/cretno");
  103. // orddd = "20060428";
  104. // cretno = "800339501";
  105. if ( pid == null ) { pid == ""; }
  106. if ( hngnm == null ) { hngnm == ""; }
  107. if ( orddd == null ) { orddd == ""; }
  108. if ( cretno == null ) { cretno == ""; }
  109. if ( pid != "" && orddd !="" && cretno!="" && hngnm != "") {
  110. model.makeValue("/root/init/condition/pid", pid);
  111. model.makeValue("/root/init/condition/orddd", orddd);
  112. model.makeValue("/root/init/condition/cretno", cretno);
  113. model.setValue("/root/send/reqdata/ordtype", ioflag);
  114. fSearchOrdList();
  115. fChangeComboValue("new");
  116. } else {
  117. model.setFocus("input1")
  118. }
  119. }
  120. }
  121. /*
  122. * 구분 콤보 박스 선택
  123. *
  124. */
  125. function fValueChangedCombo(){
  126. model.makeValue("/root/send/workflag",combo1.value);
  127. }
  128. function fSearchPatNm(){
  129. if(model.getValue("/root/send/reqdata/pid")==""){
  130. return;
  131. }else{
  132. fGetPid("/root/send/reqdata/pid", "/root/send/reqdata/pnm");
  133. }
  134. input4.refresh();
  135. }
  136. function fSearchOrdList(){
  137. model.removeNodeset("/root/init/ordlists");
  138. combo1.refresh();
  139. fInitMain();
  140. // model.setValue("/root/send/reqdata/ordtype" ,"I");
  141. if(model.getValue("/root/send/reqdata/pnm")==""){
  142. return;
  143. }else{
  144. submit("TRMRJ00102");
  145. }
  146. fChangeComboValue("new");
  147. }
  148. /**
  149. * @desc : 환자등록번호 조회 팝업
  150. * @
  151. * @param : refPid - 환자번호 참고 node path
  152. * refPnm - 환자명 참고 node path
  153. * @return :
  154. * @authur : 이은영 2008.03.18
  155. * @---------------------------------------------------
  156. */
  157. function fGetPid(refPid, refPnm)
  158. {
  159. model.setValue("/root/send/reqdata/pnm","");
  160. input4.refresh();
  161. fInitMain();
  162. //조회건수가 1건일 경우 팝업창을 바로 닫는다.
  163. model.makeValue("/root/hidden/tmp/pidpopupinfo/checkfnexam", "1");
  164. model.makeValue("/root/hidden/tmp/pidpopupinfo/autoflag", "Y");
  165. model.makeValue("/root/hidden/tmp/pidpopupinfo/pid", model.getValue(refPid));
  166. if( model.getValue("/root/hidden/tmp/pidpopupinfo/srchcond") == '' ){
  167. model.makeValue("/root/hidden/tmp/pidpopupinfo/srchcond", '1');
  168. }
  169. modal("SPPMC02500", "1","150", "150", "SPPMC02500", "/root/hidden/tmp/pidpopupinfo", "/root/send");
  170. model.resetInstanceNode("/root/source");
  171. //환자번호 copy
  172. var popupendflag = model.getValue("/root/main/popupendflag");
  173. if (popupendflag == "ok")
  174. {
  175. model.makeValue(refPid, model.getValue("/root/main/patinfo/patinfolist/pid"));
  176. if (refPnm == null) { refPnm = "" }
  177. if (refPnm != "") {
  178. model.makeValue(refPnm, model.getValue("/root/main/patinfo/patinfolist/hngnm"));
  179. }
  180. model.refresh();
  181. fSearchOrdList();
  182. }
  183. }
  184. /**
  185. * Count List 등록 내역 조회
  186. *
  187. */
  188. function fChangeComboValue(value){
  189. var i = 0;
  190. if(value == "open" && model.getValue("/root/init/condition/pid") !="" && model.getValue("/root/init/condition/orddd") != "" && model.getValue("/root/init/condition/cretno") != ""){
  191. for(i=1;i<=combo1.length; i++ ){
  192. if(model.getValue("/root/init/ordlists/ordlist["+i+"]/suminfo") == model.getValue("/root/init/condition/pid")+model.getValue("/root/init/condition/orddd")+model.getValue("/root/init/condition/cretno")){
  193. combo1.select(i-1);
  194. combo1.refresh();
  195. model.removenode("/root/init/condition/pid");
  196. model.removenode("/root/init/condition/orddd");
  197. model.removenode("/root/init/condition/cretno");
  198. model.makeValue("/root/init/condition/pid","");
  199. model.makeValue("/root/init/condition/orddd","");
  200. model.makeValue("/root/init/condition/cretno","");
  201. }
  202. }
  203. }else{
  204. if(value =="new"){
  205. combo1.select(0);
  206. }
  207. combo1.refresh();
  208. model.setValue("/root/send/pid" , model.getValue("/root/init/ordlists/ordlist["+(combo1.focusIndex+1)+"]/pid"));
  209. model.setValue("/root/send/orddd" , model.getValue("/root/init/ordlists/ordlist["+(combo1.focusIndex+1)+"]/orddd"));
  210. model.setValue("/root/send/cretno" ,model.getValue("/root/init/ordlists/ordlist["+(combo1.focusIndex+1)+"]/cretno"));
  211. }
  212. fSelectCodeList();
  213. fSetPinfo();
  214. }
  215. function fSelectCodeList(){
  216. // model.makeValue("/root/send/frcd" , model.getValue("/root/hidden/condition/kindcd"));
  217. // model.makeValue("/root/send/tocd" , model.getValue("/root/init/combolists/kindcombolists/kindcombo["+(combo2.selectedIndex+1)+"]/cd2"));
  218. if(submit("TRMRJ00101")){
  219. fColDisableChk(datagrid01);
  220. fColDisableChk(datagrid02);
  221. fColDisableChk(datagrid03);
  222. fColDisableChk(datagrid04);
  223. fColDisableChk(datagrid05);
  224. fColDisableChk(datagrid99);
  225. }
  226. }
  227. /**
  228. * 환자정보(원무키) 기본 세팅
  229. *
  230. */
  231. function fSetPinfo(){
  232. model.makeValue("/root/init/pinfo/pid" , model.getValue("/root/send/pid"));
  233. model.makeValue("/root/init/pinfo/orddd" , model.getValue("/root/send/orddd"));
  234. model.makeValue("/root/init/pinfo/cretno" , model.getValue("/root/send/cretno"));
  235. model.makeValue("/root/init/pinfo/workflag" , "99");
  236. }
  237. /**
  238. * 그리드 행추가 버튼을 클릭하였을 경우 이벤트
  239. *
  240. */
  241. function fClickRowAddBtn(grid, vWorkflag){
  242. // grid.addRow();
  243. grid.insertRow(0, 'below');
  244. var cur_row = grid.row; // 추가된 행 번호 가져오기
  245. grid.valueMatrix(cur_row, 1) = getCurrentDate().substr(0, 8);
  246. grid.valueMatrix(cur_row, 2) = getCurrentTime().substr(0, 4);;
  247. grid.valueMatrix(cur_row, 8) = model.getValue("/root/init/pinfo/instcd");
  248. grid.valueMatrix(cur_row, 10) = model.getValue("/root/init/pinfo/pid");
  249. grid.valueMatrix(cur_row, 11) = model.getValue("/root/init/pinfo/orddd");
  250. grid.valueMatrix(cur_row, 12) = model.getValue("/root/init/pinfo/cretno");
  251. grid.valueMatrix(cur_row, 13) = vWorkflag;
  252. }
  253. /**
  254. * 삭제 버튼을 클릭하였을 경우 이벤트
  255. *
  256. */
  257. function fClickDeleteBtn(grid, vWorkflag){
  258. var cur_row = grid.row; // 행 번호 가져오기
  259. var iStatus = grid.rowstatus(cur_row);
  260. if (getUserId()!=grid.valueMatrix(cur_row,14)&&grid.valueMatrix(cur_row,14)!=""){
  261. alert("삭제 권한은 등록한 사용자만 가능합니다...!");
  262. return;
  263. }
  264. if (grid.valueMatrix(cur_row,7)!="-"&&grid.valueMatrix(cur_row,14)!=""){
  265. alert("서식 기록에서 생성된 Care Plan 기록내용은 삭제 처리가 불가능 합니다...!");
  266. return;
  267. }
  268. if(cur_row <= 0 || cur_row =="undefined") {
  269. alert("삭제할 행을 선택하시기 바랍니다...");
  270. return;
  271. }
  272. if (iStatus == 1 || iStatus == 3){ // 새로 삽입된 행이면
  273. grid.deleteitem(cur_row);
  274. }else if (iStatus == 4){ // 삭제로 표시된 행이면
  275. grid.removestatus(cur_row, "delete");
  276. }else{
  277. grid.addStatus(cur_row, "delete");
  278. }
  279. }
  280. /*
  281. * 저장 버튼을 클릭하였을 경우 이벤트
  282. *
  283. */
  284. function fOnClickSaveBtn(grid, vWorkflag){
  285. if(!checkGridUpdate(grid)){
  286. alert("저장할 자료가 존재하지 않습니다.");
  287. return;
  288. }
  289. var vTitle = "";
  290. model.refresh();
  291. if (vWorkflag=="01"){
  292. vTitle = "Treatment Plan";
  293. if(checkGridField(datagrid01,"2▦3")==false){
  294. alert(vTitle+" 데이터중에 비어있는 필수필드가 있습니다.");
  295. return;
  296. }
  297. }
  298. if(vWorkflag=="02"){
  299. vTitle = "Discharge Plan";
  300. if(checkGridField(datagrid02,"2▦3")==false){
  301. alert(vTitle+" 데이터중에 비어있는 필수필드가 있습니다.");
  302. return;
  303. }
  304. }
  305. if(vWorkflag=="03"){
  306. vTitle = "Nursing Care Plan";
  307. if(checkGridField(datagrid03,"2▦3")==false){
  308. alert(vTitle+" 데이터중에 비어있는 필수필드가 있습니다.");
  309. return;
  310. }
  311. }
  312. if(vWorkflag=="04"){
  313. vTitle = "Nutrition Management Plan";
  314. if(checkGridField(datagrid04,"2▦3")==false){
  315. alert(vTitle+" 데이터중에 비어있는 필수필드가 있습니다.");
  316. return;
  317. }
  318. }
  319. if(vWorkflag=="05"){
  320. vTitle = "Activity/Rehabilitation Plan";
  321. if(checkGridField(datagrid05,"2▦3")==false){
  322. alert(vTitle+" 데이터중에 비어있는 필수필드가 있습니다.");
  323. return;
  324. }
  325. }
  326. if(vWorkflag=="99"){
  327. vTitle = "Medication Management Plan";
  328. if(checkGridField(datagrid99,"2▦3")==false){
  329. alert(vTitle+" 데이터중에 비어있는 필수필드가 있습니다.");
  330. return;
  331. }
  332. }
  333. model.makeValue("/root/send/listdata",grid.getUpdateData());
  334. if ( submit("TXMRJ00101") ) {
  335. //datagrid1.clearStatus(); // submit() 성공하면 그리드의 i,u,d 상태 제거
  336. fSelectCodeList();
  337. }
  338. }
  339. /**
  340. * @group :
  341. * @ver : 2006.12.20
  342. * @by :
  343. * @---------------------------------------------------
  344. * @type : function
  345. * @access : public
  346. * @desc :
  347. * @return : bool
  348. * @---------------------------------------------------
  349. */
  350. function checkGridUpdate(grid)
  351. {
  352. var iData = grid.getUpdateDataXml("insert");
  353. var uData = grid.getUpdateDataXml("update");
  354. var dData = grid.getUpdateDataXml("delete");
  355. if (iData=="" && uData=="" && dData=="") return false;
  356. else return true;
  357. }
  358. /**
  359. * @group :
  360. * @ver : 2006.12.20
  361. * @by :
  362. * @---------------------------------------------------
  363. * @type : function
  364. * @access : public
  365. * @desc :
  366. * @return : bool
  367. * @---------------------------------------------------
  368. */
  369. function checkGridField(grid, field){
  370. var iStatus;
  371. //var iData = grid.getUpdateDataXml("insert");
  372. for (i=grid.fixedRows; i<grid.rows; i++){
  373. iStatus = grid.rowstatus(i);
  374. if (iStatus == 1 || iStatus == 3){
  375. var fieldArr = field.split("▦");
  376. if(fieldArr.length < 1){
  377. return false;
  378. }
  379. for(var j = 0; j < fieldArr.length; j++){
  380. if(fieldArr[j] == null || fieldArr[j] == "" || fieldArr[j] == "undefined"){
  381. continue;
  382. }
  383. if(grid.valueMatrix(i,fieldArr[j])=="") return false;
  384. }
  385. }
  386. }
  387. return true;
  388. }
  389. function fColDisableChk(grid){
  390. var rowSize = grid.rows
  391. for (i=1;i <rowSize; i++){
  392. if (getUserId()!= grid.valueMatrix(i,14)||grid.valueMatrix(i,7)!="-"){
  393. grid.cellAttribute("disabled", i, 1, i, 4) = "true";
  394. grid.cellstyle("background-color", i,1,i,4) = "#E6E6E6";
  395. }
  396. }
  397. }
  398. function fOpenPopok(vWorkflag){
  399. var vPid = model.getValue("/root/init/pinfo/pid");
  400. var vOrddd = model.getValue("/root/init/pinfo/orddd");
  401. var vCretno = model.getValue("/root/init/pinfo/cretno");
  402. var vordtype = model.getValue("/root/send/reqdata/ordtype");
  403. var vfromdd = model.getValue("/root/send/fromdd");
  404. var vtodd = model.getValue("/root/send/todd");
  405. var vdaycheck = model.getValue("/root/send/daycheck");
  406. if (vPid!="" && vOrddd!="" && vCretno!=""){
  407. setParameter("SPMRJ00100_pid", vPid);
  408. setParameter("SPMRJ00100_orddd", vOrddd);
  409. setParameter("SPMRJ00100_cretno", vCretno);
  410. setParameter("SPMRJ00100_workflag", vWorkflag);
  411. setParameter("SPMRJ00100_ordtype", vordtype);
  412. setParameter("SPMRJ00100_fromdd", vfromdd);
  413. setParameter("SPMRJ00100_todd", vtodd);
  414. setParameter("SPMRJ00100_daycheck", vdaycheck);
  415. modal("SPMRJ00101");
  416. fSelectCodeList();
  417. }else{
  418. messageBox("수진키 정보가 없습니다.","I003");
  419. }
  420. }