/* --------------------------------------------------------------------- Care Plan °ü¸® (SMMRJ00100_CountList°ü¸®.xrw - JScript ) - Version : 1) : Ver.1.00.01 : Create By taebum : 2009-11-27 ¿ÀÀü 10:05:51 ---------------------------------------------------------------------- */ /* --------------------------------------------------*/ /* type : function */ /* access : public */ /* desc : xforms-ready½Ã ¼öÇàÇÑ´Ù */ /* return : */ /* --------------------------------------------------*/ function fInit() { ipt_reqfromstnddd.value = getNewDate().getAddDate(-2, "D").getDateFormat("YYYYMMDD").substr(0, 8); ipt_reqtostnddd.value = getCurrentDate().substr(0, 8); fInitMain(); fGetOpenPatInfo(); // fSearchPatNm(); } function fInitMain() { model.removeNodeSet("/root/main/careplanlists/careplanlist"); model.removeNodeSet("/root/init/ordlists/ordlist"); model.removeNodeSet("/root/main/careplanlists/diagengnminfo/diagengnm"); model.removeNodeSet("/root/main/careplanlists/medirecinfo/medi0000931"); model.removeNodeSet("/root/main/careplanlists/medirecinfo/medi0001173"); model.removeNodeSet("/root/main/careplanlists/medirecinfo/medi0000098"); combo1.refresh(); ipt_diagengnm.refresh(); tar_medi0001173.refresh(); ipt_medi0000931.refresh(); tar_medi0000098.refresh(); datagrid01.refresh(); datagrid02.refresh(); datagrid03.refresh(); datagrid04.refresh(); datagrid05.refresh(); datagrid99.refresh(); } function fGetOpenPatInfo(){ var pid = ""; var orddd = ""; var cretno = ""; var hngnm = ""; var ioflag= ""; if (isPopup() == true) { // param ȯÀÚÁ¤º¸ pid = opener.javascript.getParameter("SMMRJ00100_pid"); orddd = opener.javascript.getParameter("SMMRJ00100_orddd"); cretno = opener.javascript.getParameter("SMMRJ00100_cretno"); hngnm = opener.javascript.getParameter("SMMRJ00100_hngnm"); ioflag = opener.javascript.getParameter("SMMRJ00100_ioflag"); if ( pid == null ) { pid == ""; } if ( orddd == null ) { orddd == ""; } if ( cretno == null ) { cretno == ""; } if ( hngnm == null ) { hngnm == ""; } if ( ioflag == null ) { ioflag == ""; } if ( pid != "" && orddd !="" && cretno!="" && hngnm != "" && ioflag!= "") { model.setValue("/root/send/reqdata/pid", pid); model.setValue("/root/send/reqdata/ordtype", ioflag); input3.refresh(); model.setValue("/root/send/pid", pid); model.setValue("/root/send/orddd", orddd); model.setValue("/root/send/cretno", cretno); model.makeValue("/root/init/condition/pid", pid); model.makeValue("/root/init/condition/orddd", orddd); model.makeValue("/root/init/condition/cretno", cretno); model.setValue("/root/send/reqdata/pnm", hngnm); input4.refresh(); fSearchOrdList(); fChangeComboValue("open"); } if(pid != "" && hngnm =="" ){ model.setValue("/root/send/reqdata/pid", pid); fSearchPatNm(); } } if ( pid == null || pid == "" ) { // »ó´Ü ȯÀÚÁ¤º¸ var node = getGlobalVariable("paminfo"); model.removeNodeset("/root/init/paminfo/list"); setCSVToNode("/root/init/paminfo", node); pid = model.getValue("/root/init/paminfo/list/pid"); model.makeValue("/root/send/reqdata/pid", pid); hngnm = model.getValue("/root/init/paminfo/list/hngnm"); model.makeValue("/root/send/reqdata/pnm", hngnm); ioflag = model.getValue("/root/init/paminfo/list/ioflag"); if(ioflag == "I"||ioflag == "D"||ioflag == "E"){ ioflag = "I"; } else if(ioflag == "O"){ ioflag = "O"; } else{ ioflag = "ALL"; } if(ioflag == "I"){ orddd = model.getValue("/root/init/paminfo/list/indd"); } else { orddd = model.getValue("/root/init/paminfo/list/orddd"); } cretno = model.getValue("/root/init/paminfo/list/cretno"); // orddd = "20060428"; // cretno = "800339501"; if ( pid == null ) { pid == ""; } if ( hngnm == null ) { hngnm == ""; } if ( orddd == null ) { orddd == ""; } if ( cretno == null ) { cretno == ""; } if ( pid != "" && orddd !="" && cretno!="" && hngnm != "") { model.makeValue("/root/init/condition/pid", pid); model.makeValue("/root/init/condition/orddd", orddd); model.makeValue("/root/init/condition/cretno", cretno); model.setValue("/root/send/reqdata/ordtype", ioflag); fSearchOrdList(); fChangeComboValue("new"); } else { model.setFocus("input1") } } } /* * ±¸ºÐ ÄÞº¸ ¹Ú½º ¼±Åà * */ function fValueChangedCombo(){ model.makeValue("/root/send/workflag",combo1.value); } function fSearchPatNm(){ if(model.getValue("/root/send/reqdata/pid")==""){ return; }else{ fGetPid("/root/send/reqdata/pid", "/root/send/reqdata/pnm"); } input4.refresh(); } function fSearchOrdList(){ model.removeNodeset("/root/init/ordlists"); combo1.refresh(); fInitMain(); // model.setValue("/root/send/reqdata/ordtype" ,"I"); if(model.getValue("/root/send/reqdata/pnm")==""){ return; }else{ submit("TRMRJ00102"); } fChangeComboValue("new"); } /** * @desc : ȯÀÚµî·Ï¹øÈ£ Á¶È¸ ÆË¾÷ * @ * @param : refPid - ȯÀÚ¹øÈ£ Âü°í node path * refPnm - ȯÀÚ¸í Âü°í node path * @return : * @authur : ÀÌÀº¿µ 2008.03.18 * @--------------------------------------------------- */ function fGetPid(refPid, refPnm) { model.setValue("/root/send/reqdata/pnm",""); input4.refresh(); fInitMain(); //Á¶È¸°Ç¼ö°¡ 1°ÇÀÏ °æ¿ì ÆË¾÷âÀ» ¹Ù·Î ´Ý´Â´Ù. model.makeValue("/root/hidden/tmp/pidpopupinfo/checkfnexam", "1"); model.makeValue("/root/hidden/tmp/pidpopupinfo/autoflag", "Y"); model.makeValue("/root/hidden/tmp/pidpopupinfo/pid", model.getValue(refPid)); if( model.getValue("/root/hidden/tmp/pidpopupinfo/srchcond") == '' ){ model.makeValue("/root/hidden/tmp/pidpopupinfo/srchcond", '1'); } modal("SPPMC02500", "1","150", "150", "SPPMC02500", "/root/hidden/tmp/pidpopupinfo", "/root/send"); model.resetInstanceNode("/root/source"); //ȯÀÚ¹øÈ£ copy var popupendflag = model.getValue("/root/main/popupendflag"); if (popupendflag == "ok") { model.makeValue(refPid, model.getValue("/root/main/patinfo/patinfolist/pid")); if (refPnm == null) { refPnm = "" } if (refPnm != "") { model.makeValue(refPnm, model.getValue("/root/main/patinfo/patinfolist/hngnm")); } model.refresh(); fSearchOrdList(); } } /** * Count List µî·Ï ³»¿ª Á¶È¸ * */ function fChangeComboValue(value){ var i = 0; if(value == "open" && model.getValue("/root/init/condition/pid") !="" && model.getValue("/root/init/condition/orddd") != "" && model.getValue("/root/init/condition/cretno") != ""){ for(i=1;i<=combo1.length; i++ ){ 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")){ combo1.select(i-1); combo1.refresh(); model.removenode("/root/init/condition/pid"); model.removenode("/root/init/condition/orddd"); model.removenode("/root/init/condition/cretno"); model.makeValue("/root/init/condition/pid",""); model.makeValue("/root/init/condition/orddd",""); model.makeValue("/root/init/condition/cretno",""); } } }else{ if(value =="new"){ combo1.select(0); } combo1.refresh(); model.setValue("/root/send/pid" , model.getValue("/root/init/ordlists/ordlist["+(combo1.focusIndex+1)+"]/pid")); model.setValue("/root/send/orddd" , model.getValue("/root/init/ordlists/ordlist["+(combo1.focusIndex+1)+"]/orddd")); model.setValue("/root/send/cretno" ,model.getValue("/root/init/ordlists/ordlist["+(combo1.focusIndex+1)+"]/cretno")); } fSelectCodeList(); fSetPinfo(); } function fSelectCodeList(){ // model.makeValue("/root/send/frcd" , model.getValue("/root/hidden/condition/kindcd")); // model.makeValue("/root/send/tocd" , model.getValue("/root/init/combolists/kindcombolists/kindcombo["+(combo2.selectedIndex+1)+"]/cd2")); if(submit("TRMRJ00101")){ fColDisableChk(datagrid01); fColDisableChk(datagrid02); fColDisableChk(datagrid03); fColDisableChk(datagrid04); fColDisableChk(datagrid05); fColDisableChk(datagrid99); } } /** * ȯÀÚÁ¤º¸(¿ø¹«Å°) ±âº» ¼¼ÆÃ * */ function fSetPinfo(){ model.makeValue("/root/init/pinfo/pid" , model.getValue("/root/send/pid")); model.makeValue("/root/init/pinfo/orddd" , model.getValue("/root/send/orddd")); model.makeValue("/root/init/pinfo/cretno" , model.getValue("/root/send/cretno")); model.makeValue("/root/init/pinfo/workflag" , "99"); } /** * ±×¸®µå ÇàÃß°¡ ¹öưÀ» Ŭ¸¯ÇÏ¿´À» °æ¿ì À̺¥Æ® * */ function fClickRowAddBtn(grid, vWorkflag){ // grid.addRow(); grid.insertRow(0, 'below'); var cur_row = grid.row; // Ãß°¡µÈ Çà ¹øÈ£ °¡Á®¿À±â grid.valueMatrix(cur_row, 1) = getCurrentDate().substr(0, 8); grid.valueMatrix(cur_row, 2) = getCurrentTime().substr(0, 4);; grid.valueMatrix(cur_row, 8) = model.getValue("/root/init/pinfo/instcd"); grid.valueMatrix(cur_row, 10) = model.getValue("/root/init/pinfo/pid"); grid.valueMatrix(cur_row, 11) = model.getValue("/root/init/pinfo/orddd"); grid.valueMatrix(cur_row, 12) = model.getValue("/root/init/pinfo/cretno"); grid.valueMatrix(cur_row, 13) = vWorkflag; } /** * »èÁ¦ ¹öưÀ» Ŭ¸¯ÇÏ¿´À» °æ¿ì À̺¥Æ® * */ function fClickDeleteBtn(grid, vWorkflag){ var cur_row = grid.row; // Çà ¹øÈ£ °¡Á®¿À±â var iStatus = grid.rowstatus(cur_row); if (getUserId()!=grid.valueMatrix(cur_row,14)&&grid.valueMatrix(cur_row,14)!=""){ alert("»èÁ¦ ±ÇÇÑÀº µî·ÏÇÑ »ç¿ëÀÚ¸¸ °¡´ÉÇÕ´Ï´Ù...!"); return; } if (grid.valueMatrix(cur_row,7)!="-"&&grid.valueMatrix(cur_row,14)!=""){ alert("¼­½Ä ±â·Ï¿¡¼­ »ý¼ºµÈ Care Plan ±â·Ï³»¿ëÀº »èÁ¦ 󸮰¡ ºÒ°¡´É ÇÕ´Ï´Ù...!"); return; } if(cur_row <= 0 || cur_row =="undefined") { alert("»èÁ¦ÇÒ ÇàÀ» ¼±ÅÃÇϽñ⠹ٶø´Ï´Ù..."); return; } if (iStatus == 1 || iStatus == 3){ // »õ·Î »ðÀÔµÈ ÇàÀ̸é grid.deleteitem(cur_row); }else if (iStatus == 4){ // »èÁ¦·Î Ç¥½ÃµÈ ÇàÀ̸é grid.removestatus(cur_row, "delete"); }else{ grid.addStatus(cur_row, "delete"); } } /* * ÀúÀå ¹öưÀ» Ŭ¸¯ÇÏ¿´À» °æ¿ì À̺¥Æ® * */ function fOnClickSaveBtn(grid, vWorkflag){ if(!checkGridUpdate(grid)){ alert("ÀúÀåÇÒ ÀÚ·á°¡ Á¸ÀçÇÏÁö ¾Ê½À´Ï´Ù."); return; } var vTitle = ""; model.refresh(); if (vWorkflag=="01"){ vTitle = "Treatment Plan"; if(checkGridField(datagrid01,"2¢Ë3")==false){ alert(vTitle+" µ¥ÀÌÅÍÁß¿¡ ºñ¾îÀÖ´Â ÇʼöÇʵ尡 ÀÖ½À´Ï´Ù."); return; } } if(vWorkflag=="02"){ vTitle = "Discharge Plan"; if(checkGridField(datagrid02,"2¢Ë3")==false){ alert(vTitle+" µ¥ÀÌÅÍÁß¿¡ ºñ¾îÀÖ´Â ÇʼöÇʵ尡 ÀÖ½À´Ï´Ù."); return; } } if(vWorkflag=="03"){ vTitle = "Nursing Care Plan"; if(checkGridField(datagrid03,"2¢Ë3")==false){ alert(vTitle+" µ¥ÀÌÅÍÁß¿¡ ºñ¾îÀÖ´Â ÇʼöÇʵ尡 ÀÖ½À´Ï´Ù."); return; } } if(vWorkflag=="04"){ vTitle = "Nutrition Management Plan"; if(checkGridField(datagrid04,"2¢Ë3")==false){ alert(vTitle+" µ¥ÀÌÅÍÁß¿¡ ºñ¾îÀÖ´Â ÇʼöÇʵ尡 ÀÖ½À´Ï´Ù."); return; } } if(vWorkflag=="05"){ vTitle = "Activity/Rehabilitation Plan"; if(checkGridField(datagrid05,"2¢Ë3")==false){ alert(vTitle+" µ¥ÀÌÅÍÁß¿¡ ºñ¾îÀÖ´Â ÇʼöÇʵ尡 ÀÖ½À´Ï´Ù."); return; } } if(vWorkflag=="99"){ vTitle = "Medication Management Plan"; if(checkGridField(datagrid99,"2¢Ë3")==false){ alert(vTitle+" µ¥ÀÌÅÍÁß¿¡ ºñ¾îÀÖ´Â ÇʼöÇʵ尡 ÀÖ½À´Ï´Ù."); return; } } model.makeValue("/root/send/listdata",grid.getUpdateData()); if ( submit("TXMRJ00101") ) { //datagrid1.clearStatus(); // submit() ¼º°øÇÏ¸é ±×¸®µåÀÇ i,u,d »óÅ Á¦°Å fSelectCodeList(); } } /** * @group : * @ver : 2006.12.20 * @by : * @--------------------------------------------------- * @type : function * @access : public * @desc : * @return : bool * @--------------------------------------------------- */ function checkGridUpdate(grid) { var iData = grid.getUpdateDataXml("insert"); var uData = grid.getUpdateDataXml("update"); var dData = grid.getUpdateDataXml("delete"); if (iData=="" && uData=="" && dData=="") return false; else return true; } /** * @group : * @ver : 2006.12.20 * @by : * @--------------------------------------------------- * @type : function * @access : public * @desc : * @return : bool * @--------------------------------------------------- */ function checkGridField(grid, field){ var iStatus; //var iData = grid.getUpdateDataXml("insert"); for (i=grid.fixedRows; i