SPMRF05300.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568
  1. /**
  2. - ▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩
  3. 진료 - ( SPMRF05300_전체이력이미지확인.xrw - JScript )
  4. * Version :
  5. - Ver.1.00.00
  6. * 개발자: 이경희
  7. * 최초작성일:
  8. - 2008/10/30
  9. * 수정이력:
  10. * 기타:
  11. - ▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩▩
  12. */
  13. function fInitialize()
  14. {
  15. datagrid1.allowselection = false;
  16. datagrid2.allowselection = false;
  17. model.setValue("/root/send/fromdt", "20090203");
  18. model.setValue("/root/send/todt", "20090320");
  19. model.refresh();
  20. }
  21. function fRecSearch()
  22. {
  23. model.removeNodeset("/root/main/finalrechistinfo/rechist");
  24. model.removeNodeset("/root/main/matchrechistinfo/rechist");
  25. submit("TRMRF05301");
  26. model.refresh();
  27. }
  28. function fSelectRecHistseq()
  29. {
  30. if(!isDataCell())
  31. return;
  32. if((datagrid1.isCell(event.target) && datagrid1.mouserow >= datagrid1.fixedrows))
  33. {
  34. iRow = datagrid1.row;
  35. if(iRow < 1){
  36. return;
  37. }
  38. var totalrow = datagrid1.rows;
  39. model.setValue("/root/send/formrecseq", model.getValue("/root/main/rechistinfo/rechist[" + iRow + "]/formrecseq"));
  40. submit("TRMRF05302");
  41. }
  42. model.refresh();
  43. }
  44. function fMatchallrecimge()
  45. {
  46. //debugger;
  47. var totalRecseqRow = datagrid1.rows;
  48. var totalRechistRow = "";
  49. if(totalRecseqRow == 0)
  50. return;
  51. for(var idx = 1; idx < totalRecseqRow; idx++)
  52. {
  53. var formrecseq = model.getValue("/root/main/rechistinfo/rechist[" + idx + "]/formrecseq");
  54. //if(formrecseq == "900000001055088")
  55. //debugger;
  56. model.setValue("/root/send/formrecseq", model.getValue("/root/main/rechistinfo/rechist[" + parseInt(idx) + "]/formrecseq"));
  57. submit("TRMRF05302");
  58. model.refresh();
  59. totalRechistRow = datagrid3.rows;
  60. if(totalRechistRow == 2)
  61. {
  62. // 임시 환자 테이블에 업데이트함.
  63. submit("TXMRF05301");
  64. continue;
  65. }
  66. model.addlog("해당 기록(formrecseq: " + formrecseq + ")의 이력에 저장된 이미지를 비교합니다." );
  67. var fstrechistseq = "";
  68. var fstrecimge = "";
  69. var fstformdegnseq = "";
  70. var fstdegnitemlevlcd = "";
  71. var fstreccnts = "";
  72. var matchrechistseq = "";
  73. var matchformdegnseq = "";
  74. var matchimge = "";
  75. var matchdegnitemlevlcd = "";
  76. var matchreccnts = "";
  77. var matchresult = "";
  78. for(var histidx = 1; histidx < totalRechistRow; histidx++)
  79. {
  80. if(fstrecimge == "")
  81. {
  82. fstrechistseq = model.getValue("/root/main/matchrechistinfo/rechist[" + histidx + "]/rechistseq");
  83. fstdegnitemlevlcd = model.getValue("/root/main/matchrechistinfo/rechist[" + histidx + "]/degnitemlevlcd");
  84. fstrecimge = model.getValue("/root/main/matchrechistinfo/rechist[" + histidx + "]/recimge");
  85. fstformdegnseq = model.getValue("/root/main/matchrechistinfo/rechist[" + histidx + "]/formdegnseq");
  86. fstreccnts = model.getValue("/root/main/matchrechistinfo/rechist[" + histidx + "]/reccnts");
  87. if(fstrecimge != "")
  88. {
  89. model.addlog(histidx + "번째 기록시퀀스: " + fstrechistseq);
  90. model.addlog(histidx + "번째 기록이미지 아이템레벨코드: " + fstdegnitemlevlcd );
  91. model.addlog(histidx + "번째 기록당시 formdegnseq: " + fstformdegnseq );
  92. model.addlog(histidx + "번째 기록당시 reccnts: " + fstreccnts );
  93. }
  94. continue;
  95. }
  96. else
  97. {
  98. matchdegnitemlevlcd = model.getValue("/root/main/matchrechistinfo/rechist[" + histidx + "]/degnitemlevlcd");
  99. // 다른 degnitemlevlcd 인 경우
  100. if(fstdegnitemlevlcd == matchdegnitemlevlcd)
  101. {
  102. matchrechistseq = model.getValue("/root/main/matchrechistinfo/rechist[" + histidx + "]/rechistseq");
  103. matchimge = model.getValue("/root/main/matchrechistinfo/rechist[" + histidx + "]/recimge");
  104. matchformdegnseq = model.getValue("/root/main/matchrechistinfo/rechist[" + histidx + "]/formdegnseq");
  105. matchreccnts = model.getValue("/root/main/matchrechistinfo/rechist[" + histidx + "]/reccnts");
  106. model.addlog(histidx + "번째 기록시퀀스: " + matchrechistseq);
  107. model.addlog(histidx + "번째 기록이미지 아이템레벨코드: " + matchdegnitemlevlcd );
  108. model.addlog(histidx + "번째 기록당시 formdegnseq: " + matchrechistseq );
  109. model.addlog(histidx + "번째 기록당시 reccnts: " + matchreccnts );
  110. var msg = "";
  111. if(fstrecimge == matchimge && fstreccnts == matchreccnts)
  112. {
  113. matchresult = "동일";
  114. // 임시 환자 테이블에 업데이트함.
  115. submit("TXMRF05301");
  116. msg = "최초기록이미지와 " + histidx +"번째 이력의 기록이미지 및 편집정보가 동일합니다.";
  117. //model.addlog("첫번째 기록이미지와 " + histidx + "번째 기록이미지 비교 결과:" + matchresult);
  118. //model.addlog("첫번째 기록이미지와 " + histidx + "번째 기록이미지 비교 결과:" + msg);
  119. model.addlog("비교 결과:" + msg);
  120. }
  121. else
  122. {
  123. matchresult = "다름";
  124. // 조회된 기록 시퀀스 내역을 복사함.
  125. var cnts = getNodesetCnt(model, "/root/main/finalrechistinfo/rechist");
  126. //model.copyNode("/root/main/finalreciteminfo/rechist[" + (parseInt(cnts)+1) + "]", "/root/main/rechistinfo/rechist[" + idx + "]");
  127. copyNode(model, model, "/root/main/finalrechistinfo/rechist[" + (parseInt(cnts)+1) + "]", "/root/main/rechistinfo/rechist[" + idx + "]");
  128. if(fstrecimge == matchimge)
  129. {
  130. if(fstreccnts != matchreccnts)
  131. msg = "최초기록이미지와 " + histidx +"번째 이력의 기록이미지가 같르나 편집정보가 다릅니다.";
  132. }
  133. else
  134. {
  135. if(fstreccnts == matchreccnts)
  136. msg = "최초기록이미지와 " + histidx +"번째 이력의 기록이미지는 다르나 편집정보가 같습니다.";
  137. else
  138. msg = "최초기록이미지와 " + histidx +"번째 이력의 기록이미지, 편집정보 모두 다릅니다.";
  139. }
  140. model.makeValue("/root/main/finalrechistinfo/rechist[" + (parseInt(cnts)+1) + "]/info", msg, true);
  141. datagrid1.rowstyle(idx, "data", "background-color") = "#ffff99";
  142. datagrid1.rebuild();
  143. model.refresh();
  144. //model.addlog("첫번째 기록이미지와 " + histidx + "번째 기록이미지 비교 결과:" + matchresult);
  145. //model.addlog("첫번째 기록이미지와 " + histidx + "번째 기록이미지 비교 결과:" + msg);
  146. model.addlog("비교 결과:" + msg);
  147. break;
  148. }
  149. }
  150. else
  151. {
  152. //
  153. model.addlog("degnitemlevlcd 가 변경되어 기준 recimge를 다시 설정합니다.");
  154. fstrechistseq = model.getValue("/root/main/matchrechistinfo/rechist[" + histidx + "]/rechistseq");
  155. fstdegnitemlevlcd = model.getValue("/root/main/matchrechistinfo/rechist[" + histidx + "]/degnitemlevlcd");
  156. fstrecimge = model.getValue("/root/main/matchrechistinfo/rechist[" + histidx + "]/recimge");
  157. fstformdegnseq = model.getValue("/root/main/matchrechistinfo/rechist[" + histidx + "]/formdegnseq");
  158. fstreccnts = model.getValue("/root/main/matchrechistinfo/rechist[" + histidx + "]/reccnts");
  159. if(fstrecimge != "")
  160. {
  161. model.addlog(histidx + "번째 기록시퀀스: " + fstrechistseq);
  162. model.addlog(histidx + "번째 기록이미지 아이템레벨코드: " + fstdegnitemlevlcd );
  163. model.addlog(histidx + "번째 기록당시 formdegnseq: " + fstformdegnseq );
  164. model.addlog(histidx + "번째 기록당시 reccnts: " + fstreccnts );
  165. }
  166. continue;
  167. }
  168. }
  169. }
  170. model.removeNodeset("/root/main/matchrechistinfo/rechist");
  171. }
  172. model.refresh();
  173. //datagrid2.gridToInstance();
  174. datagrid2.rebuild();
  175. messageBox("조회된 기록의 이미지 데이터 비교가", "I002");
  176. }
  177. // 이미지가 있는 이력을
  178. function fMatchallrecimge_old()
  179. {
  180. var totalRecseqRow = datagrid1.rows;
  181. var totalRechistRow = "";
  182. if(totalRecseqRow == 0)
  183. return;
  184. for(var idx = 1; idx < totalRecseqRow; idx++)
  185. {
  186. var formrecseq = model.getValue("/root/main/rechistinfo/rechist[" + idx + "]/formrecseq");
  187. model.setValue("/root/send/formrecseq", model.getValue("/root/main/rechistinfo/rechist[" + parseInt(idx) + "]/formrecseq"));
  188. submit("TRMRF05302");
  189. model.refresh();
  190. model.addlog("해당 기록(formrecseq: " + formrecseq + ")의 이력에 저장된 이미지를 비교합니다." );
  191. var fstrechistseq = "";
  192. var fstrecimge = "";
  193. var fstformdegnseq = "";
  194. var fstdegnitemlevlcd = "";
  195. var fstreccnts = "";
  196. var matchrechistseq = "";
  197. var matchformdegnseq = "";
  198. var matchimge = "";
  199. var matchdegnitemlevlcd = "";
  200. var matchreccnts = "";
  201. var matchresult = "";
  202. totalRechistRow = datagrid3.rows;
  203. for(var histidx = 1; histidx < totalRechistRow; histidx++)
  204. {
  205. if(fstrecimge == "")
  206. {
  207. fstrechistseq = model.getValue("/root/main/matchrechistinfo/rechist[" + histidx + "]/rechistseq");
  208. fstdegnitemlevlcd = model.getValue("/root/main/matchrechistinfo/rechist[" + histidx + "]/degnitemlevlcd");
  209. fstrecimge = model.getValue("/root/main/matchrechistinfo/rechist[" + histidx + "]/recimge");
  210. fstformdegnseq = model.getValue("/root/main/matchrechistinfo/rechist[" + histidx + "]/formdegnseq");
  211. fstreccnts = model.getValue("/root/main/matchrechistinfo/rechist[" + histidx + "]/reccnts");
  212. if(fstrecimge != "")
  213. {
  214. model.addlog(histidx + "번째 기록시퀀스: " + fstrechistseq);
  215. model.addlog(histidx + "번째 기록이미지 아이템레벨코드: " + fstdegnitemlevlcd );
  216. model.addlog(histidx + "번째 기록당시 formdegnseq: " + fstformdegnseq );
  217. model.addlog(histidx + "번째 기록당시 reccnts: " + fstreccnts );
  218. }
  219. continue;
  220. }
  221. else
  222. {
  223. matchdegnitemlevlcd = model.getValue("/root/main/matchrechistinfo/rechist[" + histidx + "]/degnitemlevlcd");
  224. // 다른 degnitemlevlcd 인 경우
  225. if(fstdegnitemlevlcd == matchdegnitemlevlcd)
  226. {
  227. matchrechistseq = model.getValue("/root/main/matchrechistinfo/rechist[" + histidx + "]/rechistseq");
  228. matchimge = model.getValue("/root/main/matchrechistinfo/rechist[" + histidx + "]/recimge");
  229. matchformdegnseq = model.getValue("/root/main/matchrechistinfo/rechist[" + histidx + "]/formdegnseq");
  230. matchreccnts = model.getValue("/root/main/matchrechistinfo/rechist[" + histidx + "]/reccnts");
  231. model.addlog(histidx + "번째 기록시퀀스: " + matchrechistseq);
  232. model.addlog(histidx + "번째 기록이미지 아이템레벨코드: " + matchdegnitemlevlcd );
  233. model.addlog(histidx + "번째 기록당시 formdegnseq: " + matchrechistseq );
  234. model.addlog(histidx + "번째 기록당시 reccnts: " + matchreccnts );
  235. var msg = "";
  236. if(fstrecimge == matchimge && fstreccnts == matchreccnts)
  237. {
  238. matchresult = "동일";
  239. msg = "최초기록이미지와 " + histidx +"번째 이력의 기록이미지 및 편집정보가 동일합니다.";
  240. //model.addlog("첫번째 기록이미지와 " + histidx + "번째 기록이미지 비교 결과:" + matchresult);
  241. //model.addlog("첫번째 기록이미지와 " + histidx + "번째 기록이미지 비교 결과:" + msg);
  242. model.addlog("비교 결과:" + msg);
  243. }
  244. else
  245. {
  246. matchresult = "다름";
  247. // 조회된 기록 시퀀스 내역을 복사함.
  248. var cnts = getNodesetCnt(model, "/root/main/finalrechistinfo/rechist");
  249. //model.copyNode("/root/main/finalreciteminfo/rechist[" + (parseInt(cnts)+1) + "]", "/root/main/rechistinfo/rechist[" + idx + "]");
  250. copyNode(model, model, "/root/main/finalrechistinfo/rechist[" + (parseInt(cnts)+1) + "]", "/root/main/rechistinfo/rechist[" + idx + "]");
  251. if(fstrecimge == matchimge)
  252. {
  253. if(fstreccnts != matchreccnts)
  254. msg = "최초기록이미지와 " + histidx +"번째 이력의 기록이미지가 같르나 편집정보가 다릅니다.";
  255. }
  256. else
  257. {
  258. if(fstreccnts == matchreccnts)
  259. msg = "최초기록이미지와 " + histidx +"번째 이력의 기록이미지는 다르나 편집정보가 같습니다.";
  260. else
  261. msg = "최초기록이미지와 " + histidx +"번째 이력의 기록이미지, 편집정보 모두 다릅니다.";
  262. }
  263. model.makeValue("/root/main/finalrechistinfo/rechist[" + (parseInt(cnts)+1) + "]/info", msg, true);
  264. datagrid1.rowstyle(idx, "data", "background-color") = "#ffff99";
  265. datagrid1.rebuild();
  266. model.refresh();
  267. //model.addlog("첫번째 기록이미지와 " + histidx + "번째 기록이미지 비교 결과:" + matchresult);
  268. //model.addlog("첫번째 기록이미지와 " + histidx + "번째 기록이미지 비교 결과:" + msg);
  269. model.addlog("비교 결과:" + msg);
  270. break;
  271. }
  272. }
  273. else
  274. {
  275. //
  276. model.addlog("degnitemlevlcd 가 변경되어 기준 recimge를 다시 설정합니다.");
  277. rechistseq = model.getValue("/root/main/matchrechistinfo/rechist[" + histidx + "]/rechistseq");
  278. fstdegnitemlevlcd = model.getValue("/root/main/matchrechistinfo/rechist[" + histidx + "]/degnitemlevlcd");
  279. fstrecimge = model.getValue("/root/main/matchrechistinfo/rechist[" + histidx + "]/recimge");
  280. formdegnseq = model.getValue("/root/main/matchrechistinfo/rechist[" + histidx + "]/formdegnseq");
  281. reccnts = model.getValue("/root/main/matchrechistinfo/rechist[" + histidx + "]/reccnts");
  282. if(fstrecimge != "")
  283. {
  284. model.addlog(histidx + "번째 기록시퀀스: " + rechistseq);
  285. model.addlog(histidx + "번째 기록이미지 아이템레벨코드: " + fstdegnitemlevlcd );
  286. model.addlog(histidx + "번째 기록당시 formdegnseq: " + formdegnseq );
  287. model.addlog(histidx + "번째 기록당시 reccnts: " + reccnts );
  288. }
  289. continue;
  290. }
  291. }
  292. }
  293. model.removeNodeset("/root/main/matchrechistinfo/rechist");
  294. }
  295. model.refresh();
  296. //datagrid2.gridToInstance();
  297. datagrid2.rebuild();
  298. }
  299. function fDoReplaceLtGt()
  300. {
  301. var nodelist = model.instances(0).selectNodes("/root/main/reciteminfo/reccnts");
  302. var shape = "";
  303. for (var i = 0; i < nodelist.length; i++)
  304. {
  305. if (nodelist.item(i).text.indexOf("&lt;") == 0)
  306. {
  307. shape = nodelist.item(i).text.replace(/&lt;/gi, "<");
  308. nodelist.item(i).text = shape.replace(/&gt;/gi, ">");
  309. }
  310. }
  311. }
  312. function fGetMetaMode(str)
  313. {
  314. var strXrw = str;
  315. var regexp = new RegExp('(<Xvg [^<>]+>)', 'igm');
  316. if (regexp.test(strXrw) == true)
  317. {
  318. var xvginfo = strXrw.match(regexp);
  319. var strRtn = "";
  320. for(var idx =0; idx < xvginfo.length; idx++)
  321. {
  322. strRtn += xvginfo[idx];
  323. }
  324. // ViewMode 얻기
  325. strRtn = strRtn.setReplaceWord("<", "");
  326. strRtn = strRtn.setReplaceWord(">", "");
  327. strRtn = strRtn.setReplaceWord("'", "");
  328. var arrAttrs = strRtn.split(" ");
  329. var viewMode = "";
  330. var viewWidth = "";
  331. var viewHeight = "";
  332. var strXvgInfo = new Array(3);
  333. for(var i = 0; i < arrAttrs.length; i++)
  334. {
  335. var strSplit = arrAttrs[i].split("=");
  336. if(strSplit[0] == "viewMode") {
  337. viewMode = strSplit[1];
  338. strXvgInfo[0] = viewMode;
  339. continue;
  340. }
  341. if(strSplit[0] == "width") {
  342. viewWidth = strSplit[1];
  343. strXvgInfo[1] = viewWidth;
  344. continue;
  345. }
  346. if(strSplit[0] == "height") {
  347. viewHeight = strSplit[1];
  348. strXvgInfo[2] = viewHeight;
  349. continue;
  350. }
  351. }
  352. return strXvgInfo;
  353. }
  354. else
  355. {
  356. return "";
  357. }
  358. }
  359. /**
  360. * @desc : 메타데이터에서 caption을 CDATA로 감싼다.
  361. * @id :
  362. * @event :
  363. * @return :
  364. * @authur : 이경희
  365. */
  366. function fSetCdata(metadata)
  367. {
  368. var strMeta = metadata;
  369. // 1. CDATA로 감싸져 있는지 확인.
  370. if(isSearchString(strMeta, "CDATA") == false)
  371. {
  372. var strStCaptionOld = "";
  373. var strEdCaptionOld = "";
  374. var strStCaptionNew = "";
  375. var strEdCaptionNew = "";
  376. // 배열로 반환
  377. strStCaptionOld = fGetXvgStCaption(strMeta);
  378. strEdCaptionOld = fGetXvgEdCaption(strMeta);
  379. // for문으로 반복
  380. for(var idx = 0; idx < strStCaptionOld.length; idx++)
  381. {
  382. if(idx == 0)
  383. {
  384. // 모든 </caption> 을 ]]></caption> 으로 변경
  385. strEdCaptionNew = "]]>" + strEdCaptionOld[idx];
  386. strMeta = strMeta.setReplaceWord(strEdCaptionOld[idx], strEdCaptionNew);
  387. }
  388. strStCaptionNew = strStCaptionOld[idx] + "<![CDATA[";
  389. strMeta = strMeta.setReplaceWord(strStCaptionOld[idx], strStCaptionNew);
  390. }
  391. }
  392. return strMeta;
  393. }
  394. /**
  395. * @desc : 메타데이터에서 caption의 시작 태그를 반환한다.
  396. * @id :
  397. * @event :
  398. * @return :
  399. * @authur : 이경희
  400. */
  401. function fGetXvgStCaption(metadata)
  402. {
  403. var strMeta = metadata;
  404. var getStCaption = new Array();
  405. var grpexpSt = new RegExp('(<caption[^<>]+>)', 'igm');
  406. if(grpexpSt.test(strMeta) == true)
  407. {
  408. getStCaption = strMeta.match(grpexpSt);
  409. strMeta = strMeta.replace(grpexpSt, "");
  410. }
  411. if(getStCaption.length > 0)
  412. return getStCaption;
  413. else
  414. return "";
  415. }
  416. /**
  417. * @desc : 메타데이터에서 caption의 종료 태그를 반환한다.
  418. * @id :
  419. * @event :
  420. * @return :
  421. * @authur : 이경희
  422. */
  423. function fGetXvgEdCaption(metadata)
  424. {
  425. var strMeta = metadata;
  426. var getEdCaption = new Array();
  427. var grpexpEd = new RegExp('(</caption>)', 'igm');
  428. if (grpexpEd.test(strMeta) == true)
  429. {
  430. getEdCaption = strMeta.match(grpexpEd);
  431. strMeta = strMeta.replace(grpexpEd, "");
  432. }
  433. if(getEdCaption.length > 0)
  434. return getEdCaption;
  435. else
  436. return "";
  437. }
  438. function fSaveExcel()
  439. {
  440. try
  441. {
  442. var fileNm = model.getValue("/root/main/searchDate") + ".xls";
  443. var filePath = window.fileDialog("save", "", "", fileNm, "xls", "Excel File(*.xls)|*.xsl|All Files (*.*)|*.*");
  444. if (filePath == "")
  445. return;
  446. datagrid1.saveExcel(filePath, "sheetname:sheet1;colhiddenextend:false;rowhiddenextend:false;");
  447. }
  448. catch(e)
  449. {
  450. }
  451. }