123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392 |
- 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;
-
- }
|