SPMMR09001.xjs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <Script type="xscript4.0"><![CDATA[ Map = function(){
  3. this.map = new Object();
  4. put = function(key, value){
  5. this.map[key] = value;
  6. },
  7. get = function(key){
  8. return this.map[key];
  9. },
  10. containsKey = function(key){
  11. return key in this.map;
  12. },
  13. containsValue = function(value){
  14. for(var prop in this.map){
  15. if(this.map[prop] == value) return true;
  16. }
  17. return false;
  18. },
  19. isEmpty = function(key){
  20. return (this.size() == 0);
  21. },
  22. clear = function(){
  23. for(var prop in this.map){
  24. delete this.map[prop];
  25. }
  26. },
  27. remove = function(key){
  28. delete this.map[key];
  29. },
  30. keys = function(){
  31. var keys = new Array();
  32. for(var prop in this.map){
  33. keys.push(prop);
  34. }
  35. return keys;
  36. },
  37. values = function(){
  38. var values = new Array();
  39. for(var prop in this.map){
  40. values.push(this.map[prop]);
  41. }
  42. return values;
  43. },
  44. size = function(){
  45. var count = 0;
  46. for (var prop in this.map) {
  47. count++;
  48. }
  49. return count;
  50. }
  51. };
  52. var gGroupMap = new Map();
  53. function fInit(){ //ready
  54. if(frmf_isPopup()){
  55. var node = sysf_getGlobalVariable("paminfo");
  56. ds_main_paminfo.clear();
  57. dsf_setCSVToDs("ds_main_paminfo", node);
  58. ds_send.setColumn(0, "instcd", ds_main_paminfo.getColumn(0, "instcd"));
  59. ds_send.setColumn(0, "pid", ds_main_paminfo.getColumn(0, "pid"));
  60. ds_send.setColumn(0, "orddeptcd", ds_main_paminfo.getColumn(0, "orddeptcd"));
  61. var sDegnitemlevlcd = opener.frmf_getParameter("SPMMR09001_degnitemlevlcd");
  62. var sDegnitemcd = opener.frmf_getParameter("SPMMR09001_degnitemcd");
  63. ds_init_opener.setColumn(0, "degnitemlevlcd", sDegnitemlevlcd);
  64. ds_init_opener.setColumn(0, "degnitemcd", sDegnitemcd);
  65. var idx = opener.ds_data_recitem.findRowExpr("degnitemlevlcd == '"+ sDegnitemlevlcd +"' && degnitemcd == '"+ sDegnitemcd +"'");
  66. ds_init_opener.setColumn(0, "content" , opener.ds_data_recitem.getColumn(idx, "reccnts"));
  67. fGetOrdddinfo();
  68. grp_sea.btn_search.click();
  69. }
  70. }
  71. function fGetOrdddinfo(){ //일자조회
  72. var oParam = {};
  73. oParam.id = "TRMMR09002";
  74. oParam.service = "medirecapp.ComnMediRec";
  75. oParam.method = "reqGetTestResultinfo_Orddd";
  76. oParam.inds = "req=ds_send";
  77. oParam.outds = "ds_main_ordddlist_ordddinfo=dateinfo";
  78. oParam.async = false;
  79. tranf_submit(oParam);
  80. ds_send.setColumn(0, "orddd", ds_main_ordddlist_ordddinfo.getColumn(0, "repdd"));
  81. }
  82. function fMakeForm(){ //복사버튼 클릭
  83. if(frmf_isPopup()){
  84. var sDegnitemlevlcd = ds_init_opener.getColumn(0, "degnitemlevlcd");
  85. var sDegnitemcd = ds_init_opener.getColumn(0, "degnitemcd");
  86. var sContent = utlf_transNullToEmpty(ds_init_opener.getColumn(0, "content")) + "\n";
  87. if(ds_main_testlist_testinfo.rowcount > 0){
  88. var sOrddptcd = ds_main_paminfo.getColumn(0, "orddeptcd"); //해당환자 진료과로 결과값 가지고옴
  89. switch(sOrddptcd){
  90. case "2010700000" : sContent += fMakeForm_INM(); //신장내과
  91. break;
  92. default :
  93. sContent += fMakeForm_Default();
  94. break;
  95. }
  96. var idx = opener.ds_data_recitem.findRowExpr("degnitemlevlcd == '"+ sDegnitemlevlcd +"' && degnitemcd == '"+ sDegnitemcd +"'");
  97. var sItemCd = opener.ds_data_recitem.getColumn(idx, "fstlevlitemcd");
  98. opener.ds_data_recitem.setColumn(idx, "reccnts", sContent);
  99. var objTextArea = opener.ComnFormObj.components["tar_" + sItemCd];
  100. objTextArea.value = sContent;
  101. }
  102. }
  103. close();
  104. }
  105. function fGetTestinfo(){ //조회버튼 클릭
  106. var oParam = {};
  107. oParam.id = "TRMMR09001";
  108. oParam.service = "medirecapp.ComnMediRec";
  109. oParam.method = "reqGetTestResultinfo";
  110. oParam.inds = "req=ds_send";
  111. oParam.outds = "ds_main_testlist_testinfo=testinfo";
  112. oParam.async = false;
  113. oParam.callback = "cf_TRMMR09001";
  114. tranf_submit(oParam);
  115. ds_temp.setColumn(0, "itemflag", "true");
  116. frmf_inputEnterKey("group2.checkbox1", "onchanged", new CheckBoxChangeEventInfo );
  117. gGroupMap.clear();
  118. for(var i=0; i < group2.grd_testlist.getCellCount("Body"); i++){
  119. if(i == 1){
  120. group2.grd_testlist.setCellProperty("body", i, "suppress", "1");
  121. }else{
  122. group2.grd_testlist.setCellProperty("body", i, "suppress", "0");
  123. }
  124. }
  125. }
  126. function cf_TRMMR09001(sSvcId, nErrorCode, sErrorMsg) {
  127. if(nErrorCode < 0) return;
  128. ds_main_testlist_testinfo.addColumn("itemflag", "string");
  129. //dsf_setDefaultVal(ds_main_testlist_testinfo, "itemflag:1");
  130. }
  131. function fSetGridFlag(obj:CheckBox, e:CheckBoxChangeEventInfo){ //체크값이 바뀔 때
  132. var nTotalCount = ds_main_testlist_testinfo.rowcount;
  133. var sFlag = 0;
  134. if(nTotalCount > 0){
  135. //if(e.postvalue == "true"){
  136. if( obj.value == "true" ){
  137. sFlag = 1;
  138. }
  139. for(var i = 0; i < nTotalCount; i++) {
  140. ds_main_testlist_testinfo.setColumn(i, "itemflag", sFlag);
  141. }
  142. }
  143. }
  144. function fMakeGroupString(pItemSort, pItemGroup){
  145. var nTotalCount = ds_main_testlist_testinfo.rowcount;
  146. var sItemSort = "";
  147. var sItemnm = "";
  148. var sItemval = "";
  149. var sItemgroup = "";
  150. var nFindRow = ds_main_testlist_testinfo.findRow("itemsort", pItemSort);
  151. var sContent_name = ds_main_testlist_testinfo.getColumn(nFindRow, "itemnm")+"/";
  152. var sContent_value = ds_main_testlist_testinfo.getColumn(nFindRow, "itemval")+"/";
  153. for(var i=0; i< nTotalCount; i++){
  154. sItemSort = ds_main_testlist_testinfo.getColumn(i, "itemsort");
  155. nFindRow = ds_main_testlist_testinfo.findRow("itemsort", sItemSort);
  156. sItemnm = ds_main_testlist_testinfo.getColumn(nFindRow, "itemnm");
  157. sItemval = ds_main_testlist_testinfo.getColumn(nFindRow, "itemval");
  158. sItemgroup = ds_main_testlist_testinfo.getColumn(nFindRow, "itemgroup");
  159. if(fCopyCheckedItem(sItemSort, sItemval)){
  160. if(!utlf_isNull(pItemGroup)){
  161. if(pItemSort != sItemSort){
  162. if(pItemGroup == sItemgroup ){
  163. sContent_name += sItemnm + "/";
  164. sContent_value += sItemval + "/";
  165. gGroupMap.put(pItemGroup, pItemGroup);
  166. }
  167. }
  168. }
  169. }
  170. }
  171. return sContent_name.substring(0,eval(sContent_name.length -1)) + " : " + sContent_value.substring(0,eval(sContent_value.length -1));
  172. }
  173. function fCopyCheckedItem(pItemSort, pItemval){
  174. return ds_main_testlist_testinfo.lookup("itemsort",pItemSort,"itemflag") == true && !utlf_isNull(pItemval);
  175. }
  176. function fMakeForm_Default(){
  177. var sContent = "";
  178. var sItemSort = "";
  179. var sItemnm = "";
  180. var sItemval = "";
  181. var sItemGroup = "";
  182. var sItemExeDd = "";
  183. var sPreExeDd = "";
  184. var nTotalCount = ds_main_testlist_testinfo.rowcount;
  185. var nFindRow = "";
  186. if(nTotalCount > 0){
  187. for(var i=0; i < nTotalCount; i++){
  188. sItemSort = ds_main_testlist_testinfo.getColumn(i, "itemsort");
  189. nFindRow = ds_main_testlist_testinfo.findRow("itemsort", sItemSort);
  190. sItemExeDd = ds_main_testlist_testinfo.getColumn(nFindRow, "itemexedd");
  191. sItemnm = ds_main_testlist_testinfo.getColumn(nFindRow, "itemnm");
  192. sItemval = ds_main_testlist_testinfo.getColumn(nFindRow, "itemval");
  193. sItemGroup = ds_main_testlist_testinfo.getColumn(nFindRow, "itemgroup");
  194. if(fCopyCheckedItem(sItemSort, sItemval)){
  195. if(sPreExeDd != sItemExeDd) {
  196. sPreExeDd = sItemExeDd;
  197. sContent += "\n검사접수일자 : " + sItemExeDd.substring(0,4) + ". " + sItemExeDd.substring(4,6) + ". " + sItemExeDd.substring(6,8)+ "\n\n";
  198. }
  199. if(utlf_isNull(sItemGroup)){
  200. sContent += sItemnm +" : "+ sItemval + "\n";
  201. }else{
  202. if(utlf_isNull(gGroupMap.get(sItemGroup))){
  203. trace("fMakeGroupString"+i+":"+fMakeGroupString);
  204. sContent += fMakeGroupString(sItemSort, sItemGroup) + "\n";
  205. }
  206. }
  207. }
  208. }
  209. }
  210. return sContent;
  211. }
  212. function fMakeForm_INM(){ //신장내과
  213. /* *******************************************************
  214. * 노드셋에서 1~13 번째 까지는 폼형식이 정해져 있기때문에
  215. * 쿼리에서도 유의 해야 함 (ORDER BY 에 유의 ) 기준자료 : 5654
  216. *
  217. * 아래 순서로 데이터가 존재해야 한다
  218. * itemsort itemnm
  219. * 1 Hemoglobin
  220. * 2 WBC
  221. * 3 LC1026
  222. * 4 LC1028
  223. * 5 LCR191
  224. * 6 LH1007
  225. * 7 Hematocrit
  226. * 8 Platelet
  227. * 9 LC1027
  228. * 10 LCR190
  229. * 11 LCR192
  230. * 12 LH1026
  231. * 13 LH102601
  232. *
  233. * Hemoglobin WBC LC1026 LC1028 LCR191 LH1007
  234. * --------------< --------+--------+---------+---------
  235. * Hematocrit Platelet LC1027 LCR190 LCR192 LH1026 (LH102601)
  236. *
  237. * *******************************************************/
  238. var nTotalCount = ds_main_testlist_testinfo.rowcount;
  239. var sTop = "";
  240. var sBottom = "";
  241. var sLine = "------<\t\t ";
  242. var sTestVal = "";
  243. var sTestDate = "검사접수일자 : ";
  244. var sItemSort = "";
  245. var sItemnm = "";
  246. var sItemval = "";
  247. var sItemGroup = "";
  248. var sContent = "";
  249. var nFindRow = "";
  250. var bNullflag = false;
  251. if(nTotalCount > 0){
  252. // itemsort를 참조하여 form을 생성한다.
  253. var ordddsave = ds_send.getColumn(0, "orddd");
  254. if(!utlf_isNull(ordddsave)){
  255. sTestDate += ordddsave.substring(0,4) + ". " + ordddsave.substring(4,6) + ". " + ordddsave.substring(6,8);
  256. }
  257. for(var i=0; i < nTotalCount; i++){
  258. sItemSort = ds_main_testlist_testinfo.getColumn(i,"itemsort");
  259. nFindRow = ds_main_testlist_testinfo.findRow("itemsort", sItemSort);
  260. sItemnm = ds_main_testlist_testinfo.getColumn(nFindRow,"itemnm");
  261. sItemval = ds_main_testlist_testinfo.getColumn(nFindRow,"itemval");
  262. sItemGroup = ds_main_testlist_testinfo.getColumn(nFindRow,"itemgroup");
  263. if(utlf_isNull(sItemval)){
  264. sItemval = "";
  265. }
  266. if(sItemSort >= 1 && sItemSort <= 13){
  267. if(sItemSort <= 6){ // top itemsort : 1~ 6
  268. sTop += sItemval;
  269. if(sItemSort != 6){
  270. if(sItemval.length < 5){
  271. sTop += "\t\t";
  272. }else{
  273. sTop += "\t";
  274. }
  275. }
  276. }else{ // bottom itemsort : 7 ~ 12
  277. if(sItemSort != 13){
  278. sBottom += sItemval;
  279. if(sItemval.length < 5){
  280. sBottom += "\t\t";
  281. }else{
  282. sBottom += "\t";
  283. }
  284. }else{
  285. if(!utlf_isNull(sItemval)){
  286. sBottom += "("+sItemval+")";
  287. }else{
  288. sBottom += "(\t)";
  289. }
  290. }
  291. }
  292. bNullflag = true;
  293. }else{
  294. if(fCopyCheckedItem(sItemSort, sItemval)){
  295. if(utlf_isNull(sItemGroup)){
  296. sTestVal += sItemRnm +" : "+ sItemval + "\n";
  297. }else{
  298. trace("sItemGroup"+i+":"+sItemGroup);
  299. if(utlf_isNull(gGroupMap.get(sItemGroup))){
  300. trace("fMakeGroupString"+i+":"+fMakeGroupString(sItemSort, sItemGroup));
  301. sTestVal += fMakeGroupString(sItemSort, sItemGroup) + "\n";
  302. }
  303. }
  304. }
  305. }
  306. }
  307. // Line
  308. for(var i=1; i<=4; i++){
  309. if(i != 4){
  310. sLine += "--------+-";
  311. }else{
  312. sLine += "----------";
  313. }
  314. }
  315. // ItemSort 1~12 데이터 존재 여부에 따라 출력 형식이 달라짐
  316. if(bNullflag){
  317. sContent = sTestDate + "\n\n" + sTop + "\n" + sLine + "\n" + sBottom + "\n\n" + sTestVal;
  318. }else{
  319. sContent = sTestDate + "\n\n" + sTestVal;
  320. }
  321. }
  322. return sContent;
  323. }
  324. ]]></Script>