SPMMR09001.xjs 12 KB

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