SPMMR03300_아파치환자그래프.xfdl 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <FDL version="1.5">
  3. <TypeDefinition url="..\..\..\default_typedef.xml"/>
  4. <Form id="SPMMR03300" position="absolute 0 0 700 580" titletext="APACHE II 환자 그래프" oninit="SPMMR03300_oninit" onload="SPMMR03300_onload">
  5. <Layouts>
  6. <Layout>
  7. <Div position="absolute 0 555 690 580" id="grp_btn" scrollbars="autoboth">
  8. <Layouts>
  9. <Layout>
  10. <Button position="absolute 624 0 680 22" id="button35" class="btn4" text="닫기" onclick="grp_btn_button35_onclick" anchor="default"/>
  11. <Shape position="absolute 14 0 404 25" id="roundrect1" type="roundrectangle" anchor="default"/>
  12. <Static text="* A : APACHE|| score (점)" position="absolute 29 5 194 20" id="caption1" anchor="default"/>
  13. <Static text="D : Predicted death rate(%)" position="absolute 234 5 419 20" id="caption3" anchor="default"/>
  14. </Layout>
  15. </Layouts>
  16. </Div>
  17. <Static text="APACHE II - 환자 그래프" position="absolute 0 0 180 17" id="caption2" class="tit_2"/>
  18. <Shape position="absolute 0 24 700 30" linetype="horizontal" id="line2" class="line_1" style="strokepen:3 solid #9ebed4ff;"/>
  19. <ActiveX position="absolute 14 40 689 450" id="Tchart1" progid="{fab9b41c-87d6-474d-ab7e-f07d78f2422e}" windowed="true"/>
  20. <Grid position="absolute 14 455 689 540" align="align:center middle;" id="datagrid1" binddataset="ds_datagrid1" cellsizingtype="both">
  21. <Formats>
  22. <Format id="default">
  23. <Columns>
  24. <Column size="60" band="left"/>
  25. </Columns>
  26. <Rows>
  27. <Row size="24" band="head"/>
  28. <Row size="24"/>
  29. </Rows>
  30. <Band id="head">
  31. <Cell text="작성일자"/>
  32. </Band>
  33. <Band id="body">
  34. <Cell celltype="head" text="bind:ad"/>
  35. </Band>
  36. </Format>
  37. </Formats>
  38. </Grid>
  39. <Grid position="absolute 540 460 605 575" id="datagrid3" visible="false" binddataset="ds_datagrid3">
  40. <Formats>
  41. <Format id="default">
  42. <Columns>
  43. <Column size="60"/>
  44. </Columns>
  45. <Rows>
  46. <Row size="24" band="head"/>
  47. <Row size="24"/>
  48. </Rows>
  49. <Band id="head">
  50. <Cell text="작성일자"/>
  51. </Band>
  52. <Band id="body">
  53. <Cell text="bind:apchdd"/>
  54. </Band>
  55. </Format>
  56. </Formats>
  57. </Grid>
  58. <Grid position="absolute 325 450 525 600" id="datagrid2" visible="false" binddataset="ds_datagrid2">
  59. <Formats>
  60. <Format id="default">
  61. <Columns>
  62. <Column size="60"/>
  63. <Column size="60"/>
  64. <Column size="60"/>
  65. </Columns>
  66. <Rows>
  67. <Row size="24" band="head"/>
  68. <Row size="24"/>
  69. </Rows>
  70. <Band id="head">
  71. <Cell text="작성일자"/>
  72. <Cell col="1" text="1"/>
  73. <Cell col="2" text="2"/>
  74. </Band>
  75. <Band id="body">
  76. <Cell text="bind:ad"/>
  77. <Cell col="1" text="bind:apchdd"/>
  78. <Cell col="2" text="bind:result"/>
  79. </Band>
  80. </Format>
  81. </Formats>
  82. </Grid>
  83. </Layout>
  84. </Layouts>
  85. <Objects>
  86. <Dataset id="ds_datagrid1" firefirstcount="0" firenextcount="0" useclientlayout="false" updatecontrol="true" enableevent="true" loadkeymode="keep" reversesubsum="false">
  87. <ColumnInfo>
  88. <Column id="ad" type="STRING"/>
  89. </ColumnInfo>
  90. </Dataset>
  91. <Dataset id="ds_datagrid3" firefirstcount="0" firenextcount="0" useclientlayout="false" updatecontrol="true" enableevent="true" loadkeymode="keep" reversesubsum="false">
  92. <ColumnInfo>
  93. <Column id="apchdd" type="STRING" size="256" sumtext="아파치작성일자"/>
  94. </ColumnInfo>
  95. </Dataset>
  96. <Dataset id="ds_datagrid2" firefirstcount="0" firenextcount="0" useclientlayout="false" updatecontrol="true" enableevent="true" loadkeymode="keep" reversesubsum="false">
  97. <ColumnInfo>
  98. <Column id="ad" type="STRING" size="256" sumtext="apchscore/dethrate"/>
  99. <Column id="apchdd" type="STRING" size="256" sumtext="작성일자"/>
  100. <Column id="result" type="STRING" size="256" sumtext="결과값"/>
  101. </ColumnInfo>
  102. </Dataset>
  103. <Dataset id="ds_send" firefirstcount="0" firenextcount="0" useclientlayout="false" updatecontrol="true" enableevent="true" loadkeymode="keep" loadfiltermode="keep" reversesubsum="false">
  104. <ColumnInfo>
  105. <Column id="fromdd" type="STRING" size="256" sumtext="조회시작일자"/>
  106. <Column id="todd" type="STRING" size="256" sumtext="조회종료일자"/>
  107. <Column id="pid" type="STRING" size="256" sumtext="환자번호"/>
  108. <Column id="orddd" type="STRING" size="256" sumtext="입원일자"/>
  109. <Column id="range" type="STRING" size="256" sumtext="조회범위"/>
  110. <Column id="status" type="STRING" size="256" sumtext="조회상태"/>
  111. <Column id="ward" type="STRING" size="256" sumtext="병동"/>
  112. <Column id="orddept" type="STRING" size="256" sumtext="진료과"/>
  113. <Column id="outchk" type="STRING" size="256" sumtext="퇴실환자포함여부"/>
  114. <Column id="scorechk" type="STRING" size="256" sumtext="20점이하"/>
  115. <Column id="scoredown" type="STRING" size="256" sumtext="2125까지"/>
  116. <Column id="scoreup" type="STRING" size="256" sumtext="26이상"/>
  117. </ColumnInfo>
  118. <Rows>
  119. <Row>
  120. <Col id="stnddd"/>
  121. <Col id="enddd"/>
  122. <Col id="range"/>
  123. <Col id="status"/>
  124. <Col id="ward"/>
  125. <Col id="orddept"/>
  126. <Col id="outchk"/>
  127. <Col id="scorechk"/>
  128. <Col id="scoredown"/>
  129. <Col id="scoreup"/>
  130. <Col id="fromdd"/>
  131. <Col id="todd"/>
  132. <Col id="pid"/>
  133. <Col id="orddd"/>
  134. </Row>
  135. </Rows>
  136. </Dataset>
  137. </Objects>
  138. <Script type="xscript4.0"><![CDATA[/***************************************************************************************
  139. * System Name :
  140. * Job Name :
  141. * Creator :
  142. * Make Date : 2014-10-29
  143. * Description :
  144. *---------------------------------------------------------------------------------------
  145. * Modify Date Modifier Modify Description
  146. *---------------------------------------------------------------------------------------
  147. * 2014-10-29 Live Converter TF->XP
  148. *
  149. *---------------------------------------------------------------------------------------
  150. ****************************************************************************************/
  151. //=======================================================================================
  152. // Lib Include
  153. //---------------------------------------------------------------------------------------
  154. include "com_commonxp::comm_main.xjs"
  155. //=======================================================================================
  156. // Global Form Variable
  157. //---------------------------------------------------------------------------------------
  158. var arErrorCode = new HashArray();
  159. //=======================================================================================
  160. // Function
  161. //---------------------------------------------------------------------------------------
  162. /****************************************************************************************
  163. * Argument : 01.sKey : 코드아이디
  164. * : 02.sValue : 코드명
  165. * Description : 공통코드를 가져온다.
  166. ****************************************************************************************/
  167. function fGetRefInfo(){
  168. init_grid();
  169. ds_send.clearData();
  170. var nRow = ds_send.addRow();
  171. ds_send.setColumn(nRow, "pid", opener.frmf_getParameter("SPMMR03300_pid"));
  172. ds_send.setColumn(nRow, "fromdd", opener.frmf_getParameter("SPMMR03300_fromdd"));
  173. ds_send.setColumn(nRow, "todd", opener.frmf_getParameter("SPMMR03300_todd"));
  174. ds_send.setColumn(nRow, "orddd", opener.frmf_getParameter("SPMMR03300_orddd"));
  175. ds_send.setColumn(nRow, "range", opener.frmf_getParameter("SPMMR03300_range"));
  176. ds_send.setColumn(nRow, "status", opener.frmf_getParameter("SPMMR03300_status"));
  177. ds_send.setColumn(nRow, "ward", opener.frmf_getParameter("SPMMR03300_ward"));
  178. ds_send.setColumn(nRow, "orddept", opener.frmf_getParameter("SPMMR03300_orddept"));
  179. ds_send.setColumn(nRow, "outchk", opener.frmf_getParameter("SPMMR03300_outchk"));
  180. ds_send.setColumn(nRow, "scorechk", opener.frmf_getParameter("SPMMR03300_scorechk"));
  181. ds_send.setColumn(nRow, "scoredown", opener.frmf_getParameter("SPMMR03300_scoredown"));
  182. ds_send.setColumn(nRow, "scoreup", opener.frmf_getParameter("SPMMR03300_scoreup"));
  183. var oParam = {};
  184. oParam.id = "TRMMR03301";
  185. oParam.service = "anstrecapp.ApacheRec";
  186. oParam.method = "reqGetGraphDDList";
  187. oParam.inds = "req=ds_send";
  188. oParam.outds = "ds_datagrid3=ddlist";
  189. oParam.async = false;
  190. oParam.callback = "cf_TRMMR03301";
  191. tranf_submit(oParam); //아파치 작성된 일자 리스트
  192. var oParam = {};
  193. oParam.id = "TRMMR03300";
  194. oParam.service = "anstrecapp.ApacheRec";
  195. oParam.method = "reqGetApacheScore";
  196. oParam.inds = "cond=ds_send";
  197. oParam.outds = "ds_datagrid2=apache";
  198. oParam.async = false;
  199. oParam.callback = "cf_TRMMR03300";
  200. tranf_submit(oParam); //아파치 일자별 결과값 리스트
  201. // 원본 데이터 그리드 : datagrid2
  202. // 그래프 생성 될 데이터 그리드 : datagrid1
  203. // 티챠트가 거지 같아서 그리드 이름은 꼭 datagrid1 이어야 제대로 가져 온다.
  204. // 원본 데이터 갯수
  205. var row_cnt = ds_datagrid2.rowcount;
  206. var day_cnt = ds_datagrid3.rowcount; // 아파치 작성일자 리스트
  207. // 캡션 날짜, inputdate의 최소 날짜에서 최대 날짜 까지를 그리드에 몽땅 그려 준다.
  208. var min_date = "2100-12-31";
  209. var max_date = "1900-12-31";
  210. // min,max 날짜 구하기 , full search 할 수 밖에 없다.
  211. for( i = 1 ; i < day_cnt ; i++ ){
  212. if( min_date > ds_datagrid3.getColumn(i,0)){
  213. min_date = ds_datagrid3.getColumn(i,0);
  214. }
  215. if( max_date < ds_datagrid3.getColumn(i,0)){
  216. max_date = ds_datagrid3.getColumn(i,0);
  217. }
  218. }
  219. // 구한 날짜를 날짜 형식으로 변형한다. ( 날짜가 하루씩 증가해야 하니까.. )
  220. var minyear = min_date.substr(0,4);
  221. var minmon = min_date.substr(5,2);
  222. var minday = min_date.substr(8,2);
  223. // 날짜 계산을 위해서 여기서 1달 작은 값을 넣고 밑에서는 +1달을 해 준다.
  224. // 월을 0~11 까지로 출력하기 때문에 이런 뻘짓이 필요하다. 이렇게 안 하면 내년에 1월이 00으로 찍힌다.
  225. var tmp_min_date = new Date(minyear,minmon-1,minday);
  226. // 성능 대박 향상을 위한 caption_tmp!!! 컬럼 추가 될때 마다 캡션값을 입력하면 컬럼 하나씩 들어가는게 눈에 보인다.
  227. // 고로.. 변수에 저장해 두었다가 마지막에 찍어 주자.
  228. //var caption_tmp = datagrid1.caption;
  229. // 날짜가 하루 더 많다. 그래서 하루 빼줬다.
  230. tmp_min_date.setDate(tmp_min_date.getDate()-1);
  231. // 컬럼 추가, 그리드 캡션 지정, 최대날짜와 같다면 루프 종료
  232. // ## 검색된 건수가 없으면 종료, 요거 없으면 무한 루프!!!! ##
  233. for(k = 0; k < day_cnt; k++){
  234. tmp_min_date.setDate(tmp_min_date.getDate()+1);
  235. // 그리드에서 비교를 위해 날짜 포맷 설정
  236. ty = tmp_min_date.getYear();
  237. tm = tmp_min_date.getMonth()+1;
  238. td = tmp_min_date.getDate();
  239. if(tm < 10)
  240. tm = "0" + tm;
  241. if(td < 10)
  242. td = "0" + td;
  243. tt = ty + "-" + tm + "-" + td;
  244. // 최대날짜가 되면 컬럼 생성을 중지한다.
  245. // if(tt == max_date)
  246. // {
  247. // datagrid1.addColumn("ref:d" + tt + "; type: output;",false);
  248. // datagrid1.caption = caption_tmp + "^" + tt;
  249. // break;
  250. // }
  251. // 최대날짜까지 컬럼 추가
  252. // datagrid1.addColumn("ref:d" + tt + "; type: output;",false);
  253. // caption_tmp = caption_tmp + "^" + tt;
  254. var idx1 = datagrid1.insertContentsCol("body", datagrid1.getFormatColCount() + 1, false);
  255. datagrid1.setCellProperty("head", idx1, "text", ds_datagrid3.getColumn(k,0));
  256. // column binding
  257. datagrid1.setCellProperty("body", idx1 , "text", "bind:"+idx1);
  258. // dataset addColumn
  259. ds_datagrid1.addColumn(idx1, "string");
  260. // 열 크기 조절
  261. datagrid1.setFormatColProperty(idx1,"size",60);
  262. }
  263. /*
  264. for(j = 1; j < day_cnt; j++){
  265. //아파치 작성일자 추가
  266. //아파치 일자와 그리드 날짜가 동일할 때
  267. if(datagrid1.textmatrix(0,j) != datagrid3.textmatrix(j,0)){
  268. datagrid1.textmatrix(0,j) = datagrid3.textmatrix(j,0); //날짜는 0 로우에..add_row_cnt-i-1
  269. }
  270. }
  271. */
  272. // 로우 생성, subteam,dev 입력
  273. var add_row_cnt = 0;
  274. var col_cnt = 0;
  275. var cmp_dev = "시작은암것두엄는거다";
  276. // 원본 데이터를 첨 부터 끝까지 읽어 내려가면서 그래프 기준이 될 데이터 그리드를 생성한다.
  277. for( i = 0 ; i < row_cnt ; i++ )
  278. {
  279. // 앞에 이름과 현재 로우의 dev가 다르면 로우를 추가한다. (dev로 sort 해서 가져 왔심)
  280. // 앞에 이름과 같은데 팀이 달라도 로우를 추가 한다. 두탕 뛰는 개발자 색출
  281. if (cmp_dev != ds_datagrid2.getColumn(i,"ad")){
  282. add_row_cnt = ds_datagrid1.addRow();
  283. // fixed컬럼에 dev, subteam에 해당팀, 개발자 입력
  284. ds_datagrid1.setColumn(add_row_cnt, "ad", ds_datagrid2.getColumn(i,"ad"));
  285. //add_row_cnt = add_row_cnt + 1;
  286. }
  287. // 데이터 맵핑
  288. for ( c = 1 ; c < datagrid1.getCellCount("body") ; c++ ) {
  289. // input date가 같다면 해당 셀에 데이터 맵핑
  290. if (datagrid1.getCellProperty("head", c, "text") == ds_datagrid2.getColumn(i,"apchdd")){
  291. // 통계 데이터 맵핑
  292. ds_datagrid1.setColumn(add_row_cnt, (c).toString(), ds_datagrid2.getColumn(i,"result"));
  293. }else{
  294. // 빈 셀은 0으로 채워 준다 -> 값이 비었을 경우 티차트에서 에러 발생.
  295. if (utlf_isNull(ds_datagrid1.getColumn(add_row_cnt,(c).toString()))){
  296. ds_datagrid1.setColumn(add_row_cnt,(c).toString(), "0");
  297. }
  298. }
  299. }
  300. // 현재 행의 개발자,Subteam 을 저장해 두었다가 다음 행과 비교한다.
  301. cmp_dev = ds_datagrid2.getColumn(i,0);
  302. }
  303. // 챠트 그리기
  304. inff_drawLineAll(Tchart1, datagrid1, "Project Rate Chart");
  305. //drawLine(Tchart1, datagrid1, 1, "ApacheScore/Dethrate", true);
  306. //drawLine(Tchart1, datagrid1, 2, "ApacheScore/Dethrate", false);
  307. }
  308. function init_grid()
  309. {
  310. //그리드 초기화
  311. datagrid1.formats = datagrid1.userdata;
  312. // 노드 초기화
  313. ds_datagrid1.clearData();
  314. ds_datagrid2.clearData();
  315. // 차트 초기화
  316. inff_clearTChart(Tchart1);
  317. }
  318. //=======================================================================================
  319. // Transaction Callback
  320. //---------------------------------------------------------------------------------------
  321. /****************************************************************************************
  322. * Argument : 01.sSvcId : 서비스 ID
  323. * : 02.nErrorCode : 에러코드
  324. * : 03.sErrorMsg : 에러메시지
  325. * Description : tr_getCodeList의 콜백함수
  326. ****************************************************************************************/
  327. function cf_TRMMR03301(sSvcId, nErrorCode, sErrorMsg) {
  328. if(nErrorCode < 0) return;
  329. arErrorCode.push(sSvcId, nErrorCode);
  330. sysf_trace("***** cf_TRMMR03301 *****");
  331. }
  332. function cf_TRMMR03300(sSvcId, nErrorCode, sErrorMsg) {
  333. if(nErrorCode < 0) return;
  334. arErrorCode.push(sSvcId, nErrorCode);
  335. sysf_trace("***** cf_TRMMR03300 *****");
  336. }
  337. //=======================================================================================
  338. // Event
  339. //---------------------------------------------------------------------------------------
  340. /****************************************************************************************
  341. * Components :
  342. * Components ID : button5
  343. * Event : onlbuttonup
  344. * Argument : 01.obj : Object Event has occurred
  345. * : 02.e : Event Object
  346. * Description :
  347. ****************************************************************************************/
  348. function SPMMR03300_oninit(obj:Form, e:InitEventInfo)
  349. {
  350. frmf_initForm(obj);
  351. }
  352. function SPMMR03300_onload(obj:Form, e:LoadEventInfo)
  353. {
  354. var sForm = datagrid1.getFormatString();
  355. datagrid1.userdata = sForm;
  356. fGetRefInfo();
  357. }
  358. function grp_btn_button35_onclick(obj:Button, e:ClickEventInfo)
  359. {
  360. this.close();
  361. }
  362. ]]></Script>
  363. </Form>
  364. </FDL>