Map = function(){ this.map = new Object(); }; Map.prototype = { put : function(key, value){ this.map[key] = value; }, get : function(key){ return this.map[key]; }, containsKey : function(key){ return key in this.map; }, containsValue : function(value){ for(var prop in this.map){ if(this.map[prop] == value) return true; } return false; }, isEmpty : function(key){ return (this.size() == 0); }, clear : function(){ for(var prop in this.map){ delete this.map[prop]; } }, remove : function(key){ delete this.map[key]; }, keys : function(){ var keys = new Array(); for(var prop in this.map){ keys.push(prop); } return keys; }, values : function(){ var values = new Array(); for(var prop in this.map){ values.push(this.map[prop]); } return values; }, size : function(){ var count = 0; for (var prop in this.map) { count++; } return count; } }; var gGroupMap = new Map(); function fInit(){ if(isPopup()){ var node = getGlobalVariable("paminfo"); model.removeNodeset("/root/main/paminfo"); setCSVToNode("/root/main", node, "paminfo"); if("O" == model.getValue("/root/main/paminfo/ioflag") || "S" == model.getValue("/root/main/paminfo/ioflag")) { model.setValue("/root/send/ioflag", "O"); model.setValue("/root/send/orddd", model.getValue("/root/main/paminfo/orddd")); } else { model.setValue("/root/send/ioflag", "I"); model.setValue("/root/send/orddd", model.getValue("/root/main/paminfo/indd")); } model.setValue("/root/send/instcd", model.getValue("/root/main/paminfo/instcd")); model.setValue("/root/send/pid", model.getValue("/root/main/paminfo/pid")); model.setValue("/root/send/cretno", model.getValue("/root/main/paminfo/cretno")); model.setValue("/root/send/orddeptcd", model.getValue("/root/main/paminfo/orddeptcd")); model.setValue("/root/send/pagecls", "bfprcp"); // Àüó¹æÀÏÀÚ Á¶È¸ ¿É¼Ç È­¸é±¸ºÐ(addprcp:, bfprcp:) model.setValue("/root/send/bfprcpdd", fGetBfPrcpDd("bf")); var sDegnitemlevlcd = opener.javascript.getParameter("SPMMR09003_degnitemlevlcd"); var sDegnitemcd = opener.javascript.getParameter("SPMMR09003_degnitemcd"); model.setValue("/root/init/opener/degnitemlevlcd", sDegnitemlevlcd); model.setValue("/root/init/opener/degnitemcd", sDegnitemcd); model.setValue("/root/init/opener/content", opener.model.getValue("/root/main/recinfo/recitem[degnitemlevlcd = "+ sDegnitemlevlcd +"and degnitemcd = "+ sDegnitemcd +"]/reccnts")); btn_search.dispatch("DOMActivate"); } } function fGetBfPrcpDd(sFlag) { var sRtn = ""; var sBfPrcpDd = model.getValue("/root/send/bfprcpdd"); if(sBfPrcpDd == "") { sBfPrcpDd = model.getValue("/root/send/orddd"); } model.setValue("/root/send/bfprcpdd", sBfPrcpDd); model.setValue("/root/send/srchcls", sFlag); // Àüó¹æÀÏÀÚ Á¶È¸ ¿É¼Ç Á¶È¸±¸ºÐ (bf:ÀÌÀüó¹æÀÏ, aft:ÀÌÈÄó¹æÀÏ, init:ÃÖÃÊ»óÅÂ) submit("TRMMR09004"); sRtn = model.getValue("/root/main/temp/bfprcpdd"); if(sRtn == "") { messageBox ( "ó¹æÀû¿ëÀÏÀÌ ¾ø½À´Ï´Ù.", "I" ); sRtn = sBfPrcpDd; } return sRtn; } function fGetTestinfo(){ submit("TRMMR09005"); model.setValue("/root/temp/itemflag", "true"); gGroupMap.clear(); /* for(var i=0; i < grd_testlist.cols; i++){ grd_testlist.mergeCells = "bycol"; if(i == 1){ grd_testlist.mergeCol(i) = true; }else{ grd_testlist.mergeCol(i) = false; } } */ grd_testlist.resizeCells(); grd_testlist.rebuild(); model.refresh(); } function fSetGridFlag(){ var nTotalCount = getNodesetCount("/root/main/testlist/testinfo"); var sFlag = "false" if(nTotalCount > 0){ if(model.getValue("/root/temp/itemflag") == "true"){ sFlag = "true"; } for(var i = 1; i <= nTotalCount; i ++) { model.setValue("/root/main/testlist/testinfo[" + i + "]/itemflag", sFlag); } } } function fMakeForm(){ if(isPopup()){ var sDegnitemlevlcd = model.getValue("/root/init/opener/degnitemlevlcd"); var sDegnitemcd = model.getValue("/root/init/opener/degnitemcd"); var sContent = model.getValue("/root/init/opener/content") + "\n"; if(getNodesetCount("/root/main/testlist/testinfo") > 0){ //var dutplcecd = getUserInfo("dutplcecd"); var sOrddptcd = model.getValue("/root/main/paminfo/orddeptcd"); //ÇØ´çȯÀÚ Áø·á°ú·Î °á°ú°ª °¡Áö°í¿È switch(sOrddptcd){ case "2010700000" : sContent += fMakeForm_INM(); //½ÅÀå³»°ú break; default : sContent += fMakeForm_Default(); break; } opener.model.setValue("/root/main/recinfo/recitem[degnitemlevlcd = "+ sDegnitemlevlcd +"and degnitemcd = "+ sDegnitemcd +"]/reccnts", sContent); opener.model.refresh(); } } window.close(); } function fMakeGroupString(pItemSort, pItemGroup){ var nTotalCount = getNodesetCount("/root/main/testlist/testinfo"); var sItemSort = ""; var sItemnm = ""; var sItemval = ""; var sItemgroup = ""; var sContent_name = model.getValue("/root/main/testlist/testinfo[itemsort = "+pItemSort+"]/itemnm")+"/"; var sContent_value = model.getValue("/root/main/testlist/testinfo[itemsort = "+pItemSort+"]/itemval")+"/"; for(var i=1; i<= nTotalCount; i++){ sItemSort = model.getValue("/root/main/testlist/testinfo["+i+"]/itemsort"); sItemnm = model.getValue("/root/main/testlist/testinfo[itemsort = "+sItemSort+"]/itemnm"); sItemval = model.getValue("/root/main/testlist/testinfo[itemsort = "+sItemSort+"]/itemval"); sItemgroup = model.getValue("/root/main/testlist/testinfo[itemsort = "+sItemSort+"]/itemgroup"); if(fCopyCheckedItem(sItemSort, sItemval)){ if(!isNull(pItemGroup)){ if(pItemSort != sItemSort){ if(pItemGroup == sItemgroup ){ sContent_name += sItemnm + "/"; sContent_value += sItemval + "/"; gGroupMap.put(pItemGroup, pItemGroup); } } } } } return sContent_name.substring(0,eval(sContent_name.length -1)) + " : " + sContent_value.substring(0,eval(sContent_value.length -1)); } function fCopyCheckedItem(pItemSort, pItemval){ return model.getValue("/root/main/testlist/testinfo[itemsort = "+pItemSort+"]/itemflag") == "true" && !isNull(pItemval); } function fMakeForm_Default(){ var sTestVal = ""; var sContent = ""; var sItemSort = ""; var sItemnm = ""; var sItemval = ""; var sItemGroup = ""; var sItemExeDd = ""; var sPreExeDd = ""; var nTotalCount = getNodesetCount("/root/main/testlist/testinfo"); if(nTotalCount > 0){ for(var i=1; i <= nTotalCount; i++){ sItemSort = model.getValue("/root/main/testlist/testinfo["+i+"]/itemsort"); sItemExeDd = model.getValue("/root/main/testlist/testinfo[itemsort = "+sItemSort+"]/itemexedd"); sItemnm = model.getValue("/root/main/testlist/testinfo[itemsort = "+sItemSort+"]/itemnm"); sItemval = model.getValue("/root/main/testlist/testinfo[itemsort = "+sItemSort+"]/itemval"); sItemGroup = model.getValue("/root/main/testlist/testinfo[itemsort = "+sItemSort+"]/itemgroup"); if(fCopyCheckedItem(sItemSort, sItemval)){ if(sPreExeDd != sItemExeDd) { sPreExeDd = sItemExeDd; sContent += "\n°Ë»çÁ¢¼öÀÏÀÚ : " + sItemExeDd.substring(0,4) + ". " + sItemExeDd.substring(4,6) + ". " + sItemExeDd.substring(6,8)+ "\n\n"; } if(isNull(sItemGroup)){ sTestVal += sItemnm +" : "+ sItemval + "\n"; }else{ if(isNull(gGroupMap.get(sItemGroup))){ sContent += fMakeGroupString(sItemSort, sItemGroup) + "\n"; } } } } } return sContent; } function fMakeForm_INM(){ /* ******************************************************* * ³ëµå¼Â¿¡¼­ 1~13 ¹øÂ° ±îÁö´Â ÆûÇü½ÄÀÌ Á¤ÇØÁ® Àֱ⶧¹®¿¡ * Äõ¸®¿¡¼­µµ À¯ÀÇ ÇØ¾ß ÇÔ (ORDER BY ¿¡ À¯ÀÇ ) ±âÁØÀÚ·á : 5654 * * ¾Æ·¡ ¼ø¼­·Î µ¥ÀÌÅͰ¡ Á¸ÀçÇØ¾ß ÇÑ´Ù * itemsort itemnm * 1 Hemoglobin * 2 WBC * 3 LC1026 * 4 LC1028 * 5 LCR191 * 6 LH1007 * 7 Hematocrit * 8 Platelet * 9 LC1027 * 10 LCR190 * 11 LCR192 * 12 LH1026 * 13 LH102601 * * Hemoglobin WBC LC1026 LC1028 LCR191 LH1007 * --------------< --------+--------+---------+--------- * Hematocrit Platelet LC1027 LCR190 LCR192 LH1026 (LH102601) * * *******************************************************/ var nTotalCount = getNodesetCount("/root/main/testlist/testinfo"); var sTop = ""; var sBottom = ""; var sLine = "------<\t\t "; var sTestVal = ""; var sTestDate = "°Ë»çÁ¢¼öÀÏÀÚ : "; var sItemSort = ""; var sItemnm = ""; var sItemval = ""; var sItemGroup = ""; var sContent = ""; var bNullflag = false; if(nTotalCount > 0){ // itemsort¸¦ ÂüÁ¶ÇÏ¿© formÀ» »ý¼ºÇÑ´Ù. sTestDate += model.getValue("/root/send/orddd").substring(0,4) + ". " + model.getValue("/root/send/orddd").substring(4,6) + ". " + model.getValue("/root/send/orddd").substring(6,8); for(var i=1; i <= nTotalCount; i++){ sItemSort = model.getValue("/root/main/testlist/testinfo["+i+"]/itemsort"); sItemnm = model.getValue("/root/main/testlist/testinfo[itemsort = "+sItemSort+"]/itemnm"); sItemval = model.getValue("/root/main/testlist/testinfo[itemsort = "+sItemSort+"]/itemval"); sItemGroup = model.getValue("/root/main/testlist/testinfo[itemsort = "+sItemSort+"]/itemgroup"); if(sItemSort >= 1 && sItemSort <= 13){ if(sItemSort <= 6){ // top itemsort : 1~ 6 sTop += sItemval; if(sItemSort != 6){ if(sItemval.length < 5){ sTop += "\t\t"; }else{ sTop += "\t"; } } }else{ // bottom itemsort : 7 ~ 12 if(sItemSort != 13){ sBottom += sItemval; if(sItemval.length < 5){ sBottom += "\t\t"; }else{ sBottom += "\t"; } }else{ if(!isNull(sItemval)){ sBottom += "("+sItemval+")"; }else{ sBottom += "(\t)"; } } } bNullflag = true; }else{ if(fCopyCheckedItem(sItemSort, sItemval)){ if(isNull(sItemGroup)){ sTestVal += sItemnm +" : "+ sItemval + "\n"; }else{ if(isNull(gGroupMap.get(sItemGroup))){ sTestVal += fMakeGroupString(sItemSort, sItemGroup) + "\n"; } } } } } // Line for(var i=1; i<=4; i++){ if(i != 4){ sLine += "--------+-"; }else{ sLine += "----------"; } } // ItemSort 1~12 µ¥ÀÌÅÍ Á¸Àç ¿©ºÎ¿¡ µû¶ó Ãâ·Â Çü½ÄÀÌ ´Þ¶óÁü if(bNullflag){ sContent = sTestDate + "\n\n" + sTop + "\n" + sLine + "\n" + sBottom + "\n\n" + sTestVal; }else{ sContent = sTestDate + "\n\n" + sTestVal; } } return sContent; }