SPMRI03800.js 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218
  1. var sORDERBY = "desc";
  2. var sMEDIALERT = ""; //의료정보 전달사항
  3. var sDRALERT = ""; //의사 전달사항
  4. // 이전 등록번호, 입원일자, 생성번호를 저장하여, 환자정보가 다른 경우 기록지를 새로 조회하기 설정해 둠
  5. // 2008. 1. 7. 오지훈
  6. var sBFPID = ""; //이전등록번호
  7. var sBFORDDD = ""; //이전입원일자
  8. var sBFCRETNO = ""; //이전생성번호
  9. function fInit() {
  10. mmbfGetHardCodeInfoNm("/root/send/reqhardcd", "/root/init/hardcd", 1240);
  11. //미비기록리스트의 merge기본 설정을 false로 처리
  12. grd_unprepreclist.autoMerge = false;
  13. for(var i = 0; i < grd_unprepreclist.cols; i++){
  14. grd_unprepreclist.mergeCol(i) = false;
  15. }
  16. zbcfGetKindCodeList(new Array("M0037"), new Array("M0546"), new Array("/root/init/openday"), false);
  17. //그리드의 짝수행의 색변화를 제거
  18. grd_unprepreclist.backColorAlternate = "#ffffff";
  19. //조회구분일자(퇴원, 작업) 설정
  20. model.setValue("/root/main/cond/unprepdrbase/fromdd", getCurrentDate());
  21. model.setValue("/root/main/cond/unprepdrbase/todd" , getCurrentDate());
  22. //미비과, 퇴원과설정
  23. fGetDeptCodeComboList("/root/send/reqdata", "/root/init/orddept", "A", getCurrentDate());
  24. addComboItem("cmb_orddept", "전체", "-", "above");
  25. addComboItem("cmb_orddept", "호스피스과", "3100000000", "below");
  26. //미비기록리스트 grid 초기화
  27. model.removeNodeset("/root/main/unpreprecinfo/unprepreclist");
  28. model.refresh();
  29. zbcfGetCodeList(new Array("M0501", "M0502", "M0503"), new Array("/root/init/M0501", "/root/init/M0502", "/root/init/M0503"));
  30. var ls_pid = opener.javascript.getParameter("SPMRI03800_pid");
  31. // knuh_20110801_추가
  32. var ls_indd = opener.javascript.getParameter("SPMRI03800_indd");
  33. if (ls_pid != "")
  34. {
  35. model.setValue("/root/main/cond/unpreppatbase/pid", ls_pid);
  36. // knuh_20110801_추가
  37. model.setValue("/root/main/cond/unpreppatbase/indd", ls_indd);
  38. model.refresh();
  39. chk_unprepflagA.dispatch("xforms-select");
  40. ipt_pid.dispatch("onkeypress");
  41. }
  42. }
  43. /**
  44. * @desc 미비환자 내원정보 조회
  45. */
  46. function fReqGetUnPrepPatChosInfo(pid, ioflag, dschflag){
  47. model.removeNodeset("/root/send/reqdata");
  48. model.makeValue("/root/send/reqdata/pid", pid);
  49. model.makeValue("/root/send/reqdata/ioflag", ioflag);
  50. model.makeValue("/root/send/reqdata/dschflag", dschflag);
  51. if(submit("TRMRI02605")){
  52. var nodelist = model.instances(0).selectNodes("/root/main/patinfo/pathistlist");
  53. if(nodelist.length == 0){
  54. messageBox("환자의 진료내역 정보가", "I004");
  55. return;
  56. }
  57. }
  58. }
  59. /**
  60. * @desc 미비기록 리스트 조회, 환자정보 기준
  61. */
  62. function fReqGetUnPrepRecList(){
  63. model.setValue("/root/main/cond/srchflag", "pat");
  64. model.setValue("/root/main/cond/unpreppatbase/scrnflag", "unpreppatbase");
  65. model.copyNode("/root/send/reqdata", "/root/main/cond/unpreppatbase");
  66. //var pid = model.getValue("/root/main/cond/unpreppatbase/pid");
  67. //var indd = model.getValue("/root/main/cond/unpreppatbase/indd");
  68. //var cretno = model.getValue("/root/main/cond/unpreppatbase/cretno");
  69. //var orderby = model.getValue("/root/main/cond/unpreppatbase/orderby");
  70. //var scrnflag = "unpreppatbase";
  71. //
  72. //model.removeNodeset("/root/send/reqdata");
  73. //model.makeValue("/root/send/reqdata/pid" , pid);
  74. //model.makeValue("/root/send/reqdata/indd" , indd);
  75. //model.makeValue("/root/send/reqdata/cretno" , cretno);
  76. //model.makeValue("/root/send/reqdata/orderby" , orderby);
  77. if(submit("TRMRI02106")){
  78. fDoMergeUnPrepRecList();
  79. }
  80. }
  81. /**
  82. * @desc 미비의사 조회
  83. * @param srchflag 검색구분(id:아이디, nm:명)
  84. * unprepdeptcd 미비진료과
  85. * unprepdr 미비의사(srch?id:아이디, nm:명)
  86. * stnddd 기준일자
  87. * deptengabbr 부서약어명
  88. */
  89. function fReqGetUnPrepDrList(srchflag, unprepdeptcd, unprepdr, stnddd, deptengabbr, grupflag){
  90. model.removeNodeset("/root/send/reqdata");
  91. model.makeValue("/root/send/reqdata/srchflag" , srchflag);
  92. model.makeValue("/root/send/reqdata/unprepdeptcd", unprepdeptcd);
  93. model.makeValue("/root/send/reqdata/unprepdr" , unprepdr);
  94. model.makeValue("/root/send/reqdata/deptengabbr" , deptengabbr);
  95. model.makeValue("/root/send/reqdata/stnddd" , stnddd);
  96. model.makeValue("/root/send/reqdata/grupflag" , grupflag);
  97. if(submit("TRMRI02604")){
  98. }
  99. }
  100. /**
  101. * @desc 숫자여부 판단
  102. */
  103. function isNumber(str) {
  104. str += ''; // 문자열로 변환
  105. str = str.replace(/^\s*|\s*$/g, ''); // 좌우 공백 제거
  106. if (str == '' || isNaN(str)){
  107. return false;
  108. }
  109. return true;
  110. }
  111. /**
  112. * @desc 부서콤보 조회
  113. */
  114. function fGetDeptCodeComboList(ref, rsltref, orddeptflag, stnddd){
  115. var mmb_rsltref = "/root/hidden/mmb/orddept";
  116. model.removeNode(mmb_rsltref);
  117. model.makeNode(mmb_rsltref);
  118. model.removeNode(ref);
  119. model.makeValue(ref + "/orddeptflag", orddeptflag);
  120. if(stnddd != ""){
  121. model.makeValue(ref + "/stnddd", stnddd);
  122. }
  123. if(submit("TRMMB04101", "false", ref, mmb_rsltref)==true){
  124. model.copyNode(rsltref, mmb_rsltref);
  125. model.removeNode(mmb_rsltref);
  126. }
  127. model.refresh();
  128. }
  129. /**
  130. * @desc 미비기록상태 배치미비수정
  131. */
  132. function fSetUnPrepRecInfo0(){
  133. var len = grd_unprepreclist.selectedRows;
  134. for(var i = 0 ; i < len; i++){
  135. var currow = grd_unprepreclist.selectedRow(i);
  136. var status = model.getValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/status");
  137. if(status == "ud"){
  138. messageBox("의사변경 후에 미비상태를 변경", "I006");
  139. continue;
  140. }
  141. model.setValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/status" , "u");
  142. model.setValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/unprepstat", "0");
  143. var startcol = grd_unprepreclist.colRef("dschdd");
  144. var endcol = grd_unprepreclist.colRef("lastupdtdt");
  145. grd_unprepreclist.cellStyle("color", currow, startcol, currow, endcol) = "#0000ff";
  146. }
  147. model.refresh();
  148. }
  149. /**
  150. * @desc 미비기록상태 미비확인수정
  151. */
  152. function fSetUnPrepRecInfo1(){
  153. var len = grd_unprepreclist.selectedRows;
  154. for(var i = 0 ; i < len; i++){
  155. var currow = grd_unprepreclist.selectedRow(i);
  156. var status = model.getValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/status");
  157. if(status == "ud"){
  158. messageBox("의사변경 후에 미비상태를 변경", "I006");
  159. continue;
  160. }
  161. model.setValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/status", "u");
  162. model.setValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/unprepstat", "1");
  163. var startcol = grd_unprepreclist.colRef("dschdd");
  164. var endcol = grd_unprepreclist.colRef("lastupdtdt");
  165. grd_unprepreclist.cellStyle("color", currow, startcol, currow, endcol) = "#0000ff";
  166. }
  167. model.refresh();
  168. }
  169. /**
  170. * @desc 미비기록상태 의사확인수정
  171. */
  172. function fSetUnPrepRecInfo2(){
  173. var len = grd_unprepreclist.selectedRows;
  174. for(var i = 0 ; i < len; i++){
  175. var currow = grd_unprepreclist.selectedRow(i);
  176. var status = model.getValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/status");
  177. if(status == "ud"){
  178. messageBox("의사변경 후에 미비상태를 변경", "I006");
  179. continue;
  180. }
  181. model.setValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/status", "u");
  182. model.setValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/unprepstat", "2");
  183. var startcol = grd_unprepreclist.colRef("dschdd");
  184. var endcol = grd_unprepreclist.colRef("lastupdtdt");
  185. grd_unprepreclist.cellStyle("color", currow, startcol, currow, endcol) = "#0000ff";
  186. }
  187. model.refresh();
  188. }
  189. /**
  190. * @desc 미비기록상태 재미비수정
  191. */
  192. function fSetUnPrepRecInfo3(){
  193. var len = grd_unprepreclist.selectedRows;
  194. for(var i = 0 ; i < len; i++){
  195. var currow = grd_unprepreclist.selectedRow(i);
  196. var status = model.getValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/status");
  197. if(status == "ud"){
  198. messageBox("의사변경 후에 미비상태를 변경", "I006");
  199. continue;
  200. }
  201. model.setValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/status", "u");
  202. model.setValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/unprepstat", "3");
  203. var startcol = grd_unprepreclist.colRef("dschdd");
  204. var endcol = grd_unprepreclist.colRef("lastupdtdt");
  205. grd_unprepreclist.cellStyle("color", currow, startcol, currow, endcol) = "#0000ff";
  206. }
  207. model.refresh();
  208. }
  209. /**
  210. * @desc 미비기록상태 완료수정
  211. */
  212. function fSetUnPrepRecInfo4(){
  213. var len = grd_unprepreclist.selectedRows;
  214. for(var i = 0 ; i < len; i++){
  215. var currow = grd_unprepreclist.selectedRow(i);
  216. var status = model.getValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/status");
  217. if(status == "ud"){
  218. messageBox("의사변경 후에 미비상태를 변경", "I006");
  219. continue;
  220. }
  221. model.setValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/status", "u");
  222. model.setValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/unprepstat", "4");
  223. var startcol = grd_unprepreclist.colRef("dschdd");
  224. var endcol = grd_unprepreclist.colRef("lastupdtdt");
  225. grd_unprepreclist.cellStyle("color", currow, startcol, currow, endcol) = "#0000ff";
  226. }
  227. model.refresh();
  228. }
  229. /**
  230. * @desc 수정취소
  231. */
  232. function fCnclSetPrepRecInfo(){
  233. var len = grd_unprepreclist.selectedRows;
  234. for(var i = 0 ; i < len; i++){
  235. var currow = grd_unprepreclist.selectedRow(i);
  236. var status = model.getValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/status");
  237. var orgunprepstat = model.getValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/orgunprepstat");
  238. var orgunprepdrnm = model.getValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/orgunprepdrnm");
  239. var orgdoctkindflag = model.getValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/orgdoctkindflag");
  240. var orgunprepdrid = model.getValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/orgunprepdrid");
  241. var orgorddeptcd = model.getValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/orgorddeptcd");
  242. var orgdetldeptnm = model.getValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/orgdetldeptnm");
  243. var orgdetldeptcd = model.getValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/orgdetldeptcd");
  244. model.setValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/unprepstat", orgunprepstat);
  245. var startcol = grd_unprepreclist.colRef("dschdd");
  246. var endcol = grd_unprepreclist.colRef("lastupdtdt");
  247. grd_unprepreclist.cellStyle("color", currow, startcol, currow, endcol) = "#000000";
  248. if(status == "ud" || status == "l"){
  249. model.setValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/unprepdrnm" , orgunprepdrnm);
  250. model.setValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/doctkindflag", orgdoctkindflag);
  251. model.setValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/unprepdrid" , orgunprepdrid);
  252. model.setValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/orddeptcd" , orgorddeptcd);
  253. model.setValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/detldeptnm" , orgdetldeptnm);
  254. model.setValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/detldeptcd" , orgdetldeptcd);
  255. }
  256. model.setValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/status", "");
  257. }
  258. model.refresh();
  259. }
  260. /**
  261. * @desc 미비삭제
  262. */
  263. function fDelUnPrepRecInfo(){
  264. var len = grd_unprepreclist.selectedRows;
  265. for(var i = len-1 ; i >= 0; i--){
  266. var currow = grd_unprepreclist.selectedRow(i);
  267. var status = model.getValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/status");
  268. if(status == "i"){
  269. model.removeNode("/root/main/unpreprecinfo/unprepreclist[" + currow + "]");
  270. }else{
  271. var startcol = grd_unprepreclist.colRef("dschdd");
  272. var endcol = grd_unprepreclist.colRef("lastupdtdt");
  273. grd_unprepreclist.cellStyle("color", currow, startcol, currow, endcol) = "#ff0000";
  274. model.setValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/status", "d");
  275. model.setValue("/root/main/unpreprecinfo/unprepreclist[" + currow + "]/unprepstat", "9");
  276. }
  277. }
  278. grd_unprepreclist.refresh();
  279. }
  280. /**
  281. * @desc 미비의사변경
  282. */
  283. function fChngUnPrepDrInfo(){
  284. var orddd = model.getValue(grd_unprepreclist.nodeset + "[" + grd_unprepreclist.row + "]/formrecdd");
  285. setParameter("SPMRI02900_stnddd", orddd);
  286. modal("SPMRI02900");
  287. if(getParameter("SPMRI02900_useyn")=="Y"){
  288. var doctinfo = getParameter("SPMRI02900_rtnparam");
  289. doctinfo = doctinfo.split("^");
  290. var len = grd_unprepreclist.selectedRows;
  291. for(var i = 0; i < len; i++){
  292. var currow = grd_unprepreclist.selectedRow(i);
  293. var status = model.getValue(grd_unprepreclist.nodeset + "[" + currow + "]/status");
  294. if(status != "i"){ //신규가 아닌 경우, 의사변경으로 상태변경
  295. model.setValue(grd_unprepreclist.nodeset + "[" + currow + "]/status", "ud");
  296. }
  297. model.setValue(grd_unprepreclist.nodeset + "[" + currow + "]/orddeptcd" , doctinfo[0]);
  298. model.setValue(grd_unprepreclist.nodeset + "[" + currow + "]/unprepdeptnm", doctinfo[1]);
  299. model.setValue(grd_unprepreclist.nodeset + "[" + currow + "]/doctkindflag", doctinfo[2]);
  300. model.setValue(grd_unprepreclist.nodeset + "[" + currow + "]/unprepdrid" , doctinfo[3]);
  301. model.setValue(grd_unprepreclist.nodeset + "[" + currow + "]/unprepdrnm" , doctinfo[4]);
  302. var startcol = grd_unprepreclist.colRef("dschdd");
  303. var endcol = grd_unprepreclist.colRef("lastupdtdt");
  304. grd_unprepreclist.cellStyle("color", currow, startcol, currow, endcol) = "#808080";
  305. }
  306. model.refresh();
  307. }
  308. setParameter("SPMRI02900_useyn" , "");
  309. setParameter("SPMRI02900_rtnparam", "");
  310. }
  311. /**
  312. * @desc : NodeList sorting
  313. * : node 구조를 변경하며 정렬을 수행
  314. */
  315. function nodeListSort( nodeset, trgRef, mode ){
  316. var nodesetCnt = model.getXPathValue("count(" + nodeset + ")");
  317. if(nodesetCnt == 0) return;
  318. var tmpVal1, tmpVal2;
  319. var tmpIndx;
  320. for(var i = 1; i <= nodesetCnt; i++){
  321. for(var j = i + 1 ; j <= nodesetCnt; j++){
  322. tmpVal1 = model.getValue(nodeset + "[" + i + "]/" + trgRef);
  323. tmpVal2 = model.getValue(nodeset + "[" + j + "]/" + trgRef);
  324. if(isNumber(tmpVal1)==true){tmpVal1 = Number(tmpVal1);}
  325. if(isNumber(tmpVal2)==true){tmpVal2 = Number(tmpVal2);}
  326. if(mode == "desc"){
  327. if(tmpVal1 < tmpVal2){
  328. model.duplicate(instance1.selectSingleNode(nodeset).parentNode, nodeset + "[" + j + "]", "*[" + i + "]");
  329. model.removenode(nodeset + "[" + (j + 1) + "]");
  330. model.duplicate(instance1.selectSingleNode(nodeset).parentNode, nodeset + "[" + (i + 1) + "]", "*[" + j + "]");
  331. model.removenode(nodeset + "[" + (i + 1) + "]");
  332. }
  333. }else if(mode == "asc"){
  334. if(tmpVal1 > tmpVal2){
  335. model.duplicate(instance1.selectSingleNode(nodeset).parentNode, nodeset + "[" + j + "]", "*[" + i + "]");
  336. model.removenode(nodeset + "[" + (j + 1) + "]");
  337. model.duplicate(instance1.selectSingleNode(nodeset).parentNode, nodeset + "[" + (i + 1) + "]", "*[" + j + "]");
  338. model.removenode(nodeset + "[" + (i + 1) + "]");
  339. }
  340. }
  341. }
  342. }
  343. }
  344. /**
  345. * @desc : 미비추가 후 저장될 정보 설정
  346. */
  347. function fSetUnPrepSaveInfo(){
  348. var nodelist = model.instances(0).selectNodes("/root/temp/unpreprecinfo/unprepreclist");
  349. var iloopcnt = nodelist.length;
  350. for(var i = 1 ; i <= iloopcnt; i++){
  351. var pid = model.getValue("/root/temp/unpreprecinfo/unprepreclist[" + i + "]/pid");
  352. var indd = model.getValue("/root/temp/unpreprecinfo/unprepreclist[" + i + "]/indd");
  353. var cretno = model.getValue("/root/temp/unpreprecinfo/unprepreclist[" + i + "]/cretno");
  354. var hngnm = model.getValue("/root/temp/unpreprecinfo/unprepreclist[" + i + "]/hngnm");
  355. var dschdeptcd = model.getValue("/root/temp/unpreprecinfo/unprepreclist[" + i + "]/dschdeptcd");
  356. var dschdeptnm = model.getValue("/root/temp/unpreprecinfo/unprepreclist[" + i + "]/dschdeptnm");
  357. var dschdd = model.getValue("/root/temp/unpreprecinfo/unprepreclist[" + i + "]/dschdd");
  358. var doctkindflag = model.getValue("/root/temp/unpreprecinfo/unprepreclist[" + i + "]/jobposnm");
  359. var unprepdrnm = model.getValue("/root/temp/unpreprecinfo/unprepreclist[" + i + "]/unprepdrnm");
  360. var unprepdrid = model.getValue("/root/temp/unpreprecinfo/unprepreclist[" + i + "]/unprepdrid");
  361. var formcd = model.getValue("/root/temp/unpreprecinfo/unprepreclist[" + i + "]/formcd");
  362. var formnm = model.getValue("/root/temp/unpreprecinfo/unprepreclist[" + i + "]/formnm");
  363. var unprepitemnm = model.getValue("/root/temp/unpreprecinfo/unprepreclist[" + i + "]/unprepitemnm");
  364. var unprepitemcd = model.getValue("/root/temp/unpreprecinfo/unprepreclist[" + i + "]/unprepitemcd");
  365. var oprsrvno = model.getValue("/root/temp/unpreprecinfo/unprepreclist[" + i + "]/oprsrvno");
  366. var orddd = model.getValue("/root/temp/unpreprecinfo/unprepreclist[" + i + "]/orddd");
  367. var indschflag = model.getValue("/root/temp/unpreprecinfo/unprepreclist[" + i + "]/indschflag");
  368. var orddeptcd = model.getValue("/root/temp/unpreprecinfo/unprepreclist[" + i + "]/orddeptcd");
  369. var formrecseq = model.getValue("/root/temp/unpreprecinfo/unprepreclist[" + i + "]/formrecseq");
  370. var medirecalertcnts = model.getValue("/root/temp/unpreprecinfo/unprepreclist[" + i + "]/medirecalertcnts");
  371. var unprepno = model.getValue("/root/temp/unpreprecinfo/unprepreclist[" + i + "]/unprepno");
  372. if(formrecseq == ""){
  373. formrecseq = "-1";
  374. }
  375. grd_unprepreclist.addRow(false, true);
  376. var trgtrow = grd_unprepreclist.row;
  377. model.setValue(grd_unprepreclist.nodeset + "[" + trgtrow + "]/status" , "i");
  378. model.setValue(grd_unprepreclist.nodeset + "[" + trgtrow + "]/indschflag" , indschflag);
  379. model.setValue(grd_unprepreclist.nodeset + "[" + trgtrow + "]/pid" , pid);
  380. model.setValue(grd_unprepreclist.nodeset + "[" + trgtrow + "]/indd" , indd);
  381. model.setValue(grd_unprepreclist.nodeset + "[" + trgtrow + "]/cretno" , cretno);
  382. model.setValue(grd_unprepreclist.nodeset + "[" + trgtrow + "]/hngnm" , hngnm);
  383. model.setValue(grd_unprepreclist.nodeset + "[" + trgtrow + "]/dschdeptcd" , dschdeptcd);
  384. model.setValue(grd_unprepreclist.nodeset + "[" + trgtrow + "]/dschdeptnm" , dschdeptnm);
  385. model.setValue(grd_unprepreclist.nodeset + "[" + trgtrow + "]/dschdd" , dschdd);
  386. model.setValue(grd_unprepreclist.nodeset + "[" + trgtrow + "]/unprepstat" , "1");
  387. model.setValue(grd_unprepreclist.nodeset + "[" + trgtrow + "]/doctkindflag", doctkindflag);
  388. model.setValue(grd_unprepreclist.nodeset + "[" + trgtrow + "]/unprepdrnm" , unprepdrnm);
  389. model.setValue(grd_unprepreclist.nodeset + "[" + trgtrow + "]/unprepdrid" , unprepdrid);
  390. model.setValue(grd_unprepreclist.nodeset + "[" + trgtrow + "]/formrecdd" , orddd);
  391. model.setValue(grd_unprepreclist.nodeset + "[" + trgtrow + "]/orddeptcd" , orddeptcd);
  392. model.setValue(grd_unprepreclist.nodeset + "[" + trgtrow + "]/formcd" , formcd);
  393. model.setValue(grd_unprepreclist.nodeset + "[" + trgtrow + "]/formnm" , formnm);
  394. model.setValue(grd_unprepreclist.nodeset + "[" + trgtrow + "]/oprsrvno" , oprsrvno);
  395. model.setValue(grd_unprepreclist.nodeset + "[" + trgtrow + "]/unprepitemnm" , unprepitemnm);
  396. model.setValue(grd_unprepreclist.nodeset + "[" + trgtrow + "]/unprepitemcd" , unprepitemcd);
  397. model.setValue(grd_unprepreclist.nodeset + "[" + trgtrow + "]/formrecseq" , formrecseq);
  398. model.setValue(grd_unprepreclist.nodeset + "[" + trgtrow + "]/medirecalertcnts" , medirecalertcnts);
  399. model.setValue(grd_unprepreclist.nodeset + "[" + trgtrow + "]/unprepno" , unprepno);
  400. }
  401. model.removeNodeset("/root/temp/unpreprecinfo/unprepreclist");
  402. model.refresh();
  403. }
  404. /**
  405. * @desc 미비의사 직종(Staff)로 변경
  406. */
  407. function fChngUnPrepStaffPos(){
  408. var len = grd_unprepreclist.selectedRows;
  409. for(var i = 0; i < len; i++){
  410. var currow = grd_unprepreclist.selectedRow(i);
  411. var status = model.getValue(grd_unprepreclist.nodeset + "[" + currow + "]/status");
  412. if(status != "i"){
  413. model.setValue(grd_unprepreclist.nodeset + "[" + currow + "]/status", "up");
  414. }
  415. model.setValue(grd_unprepreclist.nodeset + "[" + currow + "]/doctkindflag", "St");
  416. }
  417. model.refresh();
  418. }
  419. /**
  420. * @desc 미비의사 직종(Resident)로 변경
  421. */
  422. function fChngUnPrepResiPos(){
  423. var len = grd_unprepreclist.selectedRows;
  424. for(var i = 0; i < len; i++){
  425. var currow = grd_unprepreclist.selectedRow(i);
  426. var status = model.getValue(grd_unprepreclist.nodeset + "[" + currow + "]/status");
  427. if(status != "i"){
  428. model.setValue(grd_unprepreclist.nodeset + "[" + currow + "]/status", "up");
  429. }
  430. model.setValue(grd_unprepreclist.nodeset + "[" + currow + "]/doctkindflag", "R");
  431. }
  432. model.refresh();
  433. }
  434. /**
  435. * @desc 미비의사 직종(Intern)으로 변경
  436. */
  437. function fChngUnPrepInternPos(){
  438. var len = grd_unprepreclist.selectedRows;
  439. for(var i = 0; i < len; i++){
  440. var currow = grd_unprepreclist.selectedRow(i);
  441. var status = model.getValue(grd_unprepreclist.nodeset + "[" + currow + "]/status");
  442. if(status != "i"){
  443. model.setValue(grd_unprepreclist.nodeset + "[" + currow + "]/status", "up");
  444. }
  445. model.setValue(grd_unprepreclist.nodeset + "[" + currow + "]/doctkindflag", "I");
  446. }
  447. model.refresh();
  448. }
  449. /**
  450. * @desc 미비과 변경 팝업창 open
  451. */
  452. function fOpenUnPrepDeptCD(){
  453. group1.attribute("left") = event.targetX;
  454. group1.attribute("top") = event.targetY;
  455. // targetX가 간혹 음수가 나오는 케이스를 수정
  456. //group1.attribute("left") = event.clientX;
  457. //group1.attribute("top") = event.clientY;
  458. group1.attribute("height") = 55;
  459. //grd_unprepreclist.disabled = true;
  460. //btn_requnpreppatbase.disabled = true;
  461. //btn_requnprepdrbase.disabled = true;
  462. //btn_realunprep.disabled = true;
  463. //btn_opinfo.disabled = true;
  464. //btn_totrec.disabled = true;
  465. //btn_unprepcert.disabled = true;
  466. //btn_del.disabled = true;
  467. //btn_ex.disabled = true;
  468. //btn_save.disabled = true;
  469. }
  470. /**
  471. * @desc 미비과 변경
  472. */
  473. function fReqSetUnPrepDeptCD(){
  474. var len = grd_unprepreclist.selectedRows;
  475. var orddeptcd = model.getValue("/root/init/unprepdeptcd");
  476. var orddeptnm = combo1.label;
  477. for(var i = 0; i < len; i++){
  478. var currow = grd_unprepreclist.selectedRow(i);
  479. model.setValue(grd_unprepreclist.nodeset + "[" + currow + "]/status" , "di");
  480. model.setValue(grd_unprepreclist.nodeset + "[" + currow + "]/orddeptcd" , orddeptcd);
  481. }
  482. model.refresh();
  483. var savenodelist = model.instances(0).selectNodes("/root/main/unpreprecinfo/unprepreclist[status='di']");
  484. /*
  485. var srchflag = model.getValue("/root/main/cond/srchflag");
  486. if(srchflag == "pat"){
  487. model.copyNode("/root/send/reqdata", "/root/main/cond/unpreppatbase");
  488. }else{
  489. model.copyNode("/root/send/reqdata", "/root/main/cond/unprepdrbase");
  490. }*/
  491. var srchnodelist = model.instances(0).selectNodes("/root/send/reqdata");
  492. if(savenodelist.length == 0){
  493. messageBox("저장할 정보가", "I004");
  494. return;
  495. }else{
  496. var savedata = getNodeListCSV(savenodelist);
  497. var srchdata = getNodeListCSV(srchnodelist);
  498. model.removeNodeset("/root/send/savedata");
  499. model.makeNode("/root/send/savedata");
  500. model.makeValue("/root/send/savedata", savedata);
  501. model.makeValue("/root/send/srchdata", srchdata);
  502. if(submit("TXMRI01702")){
  503. grd_unprepreclist.allstyle("data", "color") = "#000000";
  504. grd_unprepreclist.mergeCells = "bycol";
  505. grd_unprepreclist.mergeCol(grd_unprepreclist.colRef("pid")) = true;
  506. grd_unprepreclist.mergeCol(grd_unprepreclist.colRef("hngnm"))= true;
  507. grd_unprepreclist.merge();
  508. }
  509. }
  510. }
  511. function doSrchCondCSV(nodeList, sColSep, sRowSep){
  512. if( nodeList.length == 0 ){
  513. return;
  514. }
  515. var rCSV = "";
  516. var childNodeList = nodeList.item(0).childNodes;
  517. var childNodeCnt = childNodeList.length;
  518. if( childNodeCnt == 0 ){
  519. return;
  520. }
  521. var i, j;
  522. for( i = 0; i < childNodeCnt - 1; i++) {
  523. rCSV += childNodeList.item(i).nodeName + sColSep;
  524. }
  525. rCSV += childNodeList.item(i).nodeName + sRowSep;
  526. var node;
  527. while( node = nodeList.nextNode() ) {
  528. childNodeList = node.childNodes;
  529. for( i = 0; i < childNodeCnt - 1; i++) {
  530. rCSV += childNodeList.item(i).text + sColSep;
  531. }
  532. rCSV += childNodeList.item(i).text + sRowSep;
  533. }
  534. return rCSV;
  535. }
  536. /**
  537. * @desc 미비항목코드 Count예외코드 조회
  538. */
  539. function reqGetUnPrepBaseExptCnt(){
  540. model.removeNodeset("/root/send/reqdata");
  541. if(submit("TRMRI01703")){
  542. }
  543. }
  544. /**
  545. * @desc 다음달을 구하는 함수
  546. * @param yyyy : 년도
  547. * @param mm : 월
  548. * @return yyyymm : 년월
  549. */
  550. function addMonth(yyyymm){
  551. var yyyy = yyyymm.substring(0, 4);
  552. var mm = yyyymm.substring(4, 6);
  553. var bfmm;
  554. if(mm.substr(0,1) == "0"){ //10월 이전인 경우, 앞자리 0을 제거
  555. bfmm = mm.substr(1,1);
  556. bfmm++;
  557. }else{ //10월 이후인 경우
  558. bfmm = mm;
  559. bfmm++;
  560. }
  561. if(bfmm > 12){ // 1월 이전을 선택한 경우, 년도를 바꿈
  562. bfmm = "01";
  563. yyyy++;
  564. }else if(bfmm < 10){ //10월 이후인 경우에는 앞자리에 0을 붙임.
  565. bfmm = "0".concat(bfmm);
  566. }
  567. return "" + yyyy + "".concat(bfmm);
  568. }
  569. /**
  570. * @desc 달간격을 구하는 함수
  571. * @param startdd : 시작년월(YYYY-MM)
  572. * @param enddd : 종료년월(YYYY-MM)
  573. * @return monthcnt : 달간격
  574. */
  575. function getMonthInterval(startdd, enddd){
  576. var monthcnt = 0;
  577. while(startdd != enddd){
  578. startdd = addMonth(startdd);
  579. monthcnt++;
  580. }
  581. return monthcnt;
  582. }
  583. /**
  584. * @desc 환자 기록지 조회
  585. */
  586. function fReqGetPatRecList(pid, orddd, cretno){
  587. model.removeNodeset("/root/send/recreqdata");
  588. model.makeValue("/root/send/recreqdata/pid", pid);
  589. model.makeValue("/root/send/recreqdata/orddd", orddd);
  590. model.makeValue("/root/send/recreqdata/cretno", cretno);
  591. if(submit("TRMRI01704")){
  592. }
  593. }
  594. /**
  595. * @desc 의사별미비리스트 unmerge
  596. */
  597. function fDoUnMergeUnPrepRecList()
  598. {
  599. grd_unprepreclist.sortClear();
  600. for(var i = 1; i < grd_unprepreclist.rows; i++)
  601. {
  602. if(grd_unprepreclist.isMerge(i, grd_unprepreclist.colRef("pid")))
  603. {
  604. grd_unprepreclist.unmergeByFree(i, grd_unprepreclist.colRef("pid"));
  605. grd_unprepreclist.unmergeByFree(i, grd_unprepreclist.colRef("hngnm"));
  606. grd_unprepreclist.unmergeByFree(i, grd_unprepreclist.colRef("dschdd"));
  607. grd_unprepreclist.unmergeByFree(i, grd_unprepreclist.colRef("dschdeptnm"));
  608. grd_unprepreclist.unmergeByFree(i, grd_unprepreclist.colRef("medispclnm"));
  609. }
  610. }
  611. grd_unprepreclist.refresh();
  612. model.refresh();
  613. }
  614. /**
  615. * @desc 미비기록관리 merge
  616. */
  617. function fDoMergeUnPrepRecList()
  618. {
  619. grd_unprepreclist.allstyle("data", "color") = "#000000";
  620. grd_unprepreclist.allStyle("data", "font-style") = "";
  621. var patcnt = 0;
  622. var reccnt = 0;
  623. var icnt = 0;
  624. var startrow = 1;
  625. var color = "#ffffcc"; // 그리드 배경색
  626. var checkcol = grd_unprepreclist.colRef("check");
  627. for(var i = 1; i < grd_unprepreclist.rows; i++)
  628. {
  629. var unprepitemcd = model.getValue(grd_unprepreclist.nodeset + "[" + i + "]/unprepitemcd");
  630. var formrecseq = model.getValue(grd_unprepreclist.nodeset + "[" + i + "]/formrecseq");
  631. var delyn = model.getValue(grd_unprepreclist.nodeset + "[" + i + "]/delyn");
  632. var result = model.getValue("/root/main/unprepiteminfo/unprepiteminfo[unprepitemcd='" + unprepitemcd + "']/unprepitemcd");
  633. var deldt = model.getValue(grd_unprepreclist.nodeset + "[" + i + "]/deldt");
  634. var deluserid = model.getValue(grd_unprepreclist.nodeset + "[" + i + "]/deluserid");
  635. var delusernm = model.getValue(grd_unprepreclist.nodeset + "[" + i + "]/delusernm");
  636. /*
  637. //if(delyn == "Y"){
  638. if(delyn == "Y" || (formrecseq == "-1" && deluserid != "" && deldt != "")){
  639. grd_unprepreclist.cellStyle("color", i, checkcol, i, grd_unprepreclist.cols-1) = "#999999";
  640. }
  641. */
  642. if(result == ""){
  643. reccnt++;
  644. }
  645. if(i == 1){
  646. patcnt++;
  647. var orgpid = model.getValue(grd_unprepreclist.nodeset + "[" + i + "]/pid");
  648. var orgdschdd = model.getValue(grd_unprepreclist.nodeset + "[" + i + "]/dschdd");
  649. var orgindd = model.getValue(grd_unprepreclist.nodeset + "[" + i + "]/indd");
  650. startrow = 1;
  651. grd_unprepreclist.rowStyle(i, "data", "background-color")= color;
  652. if(formrecseq <= 0){
  653. grd_unprepreclist.cellStyle("background-color", i, checkcol, i, checkcol) = "#ff0000"; // 기록지 연결안된 미비내역(빨간색)
  654. }
  655. if(delyn == "Y" || (formrecseq == "-1" && deluserid != "" && deldt != "")){
  656. grd_unprepreclist.cellStyle("color", i, checkcol, i, grd_unprepreclist.cols-1) = "#999999"; // 삭제된 기록지(연한 회색)
  657. }
  658. continue;
  659. }
  660. var pid = model.getValue(grd_unprepreclist.nodeset + "[" + i + "]/pid");
  661. var indd = model.getValue(grd_unprepreclist.nodeset + "[" + i + "]/indd");
  662. var dschdd = model.getValue(grd_unprepreclist.nodeset + "[" + i + "]/dschdd");
  663. if(orgpid == pid && orgdschdd == dschdd && orgindd == indd){
  664. grd_unprepreclist.mergeByFree(startrow, grd_unprepreclist.colRef("pid") , i, grd_unprepreclist.colRef("pid"));
  665. grd_unprepreclist.mergeByFree(startrow, grd_unprepreclist.colRef("hngnm") , i, grd_unprepreclist.colRef("hngnm"));
  666. grd_unprepreclist.mergeByFree(startrow, grd_unprepreclist.colRef("dschdd") , i, grd_unprepreclist.colRef("dschdd"));
  667. grd_unprepreclist.mergeByFree(startrow, grd_unprepreclist.colRef("dschdeptnm"), i, grd_unprepreclist.colRef("dschdeptnm"));
  668. grd_unprepreclist.mergeByFree(startrow, grd_unprepreclist.colRef("medispclnm"), i, grd_unprepreclist.colRef("medispclnm"));
  669. }
  670. else
  671. {
  672. patcnt++;
  673. var orgpid = model.getValue(grd_unprepreclist.nodeset + "[" + i + "]/pid");
  674. var orgdschdd= model.getValue(grd_unprepreclist.nodeset + "[" + i + "]/dschdd");
  675. var orgindd = model.getValue(grd_unprepreclist.nodeset + "[" + i + "]/indd");
  676. startrow = i;
  677. if(color == "#ffffcc"){
  678. color = "#ffffff"; // 투명색
  679. }else{
  680. color = "#ffffcc"; // 그리드 배경색(연한 노란색)
  681. }
  682. }
  683. grd_unprepreclist.rowStyle(i, "data", "background-color")= color;
  684. if(formrecseq <= 0){
  685. grd_unprepreclist.cellStyle("background-color", i, checkcol, i, checkcol) = "#ff0000"; // 기록지 연결안된 미비내역(빨간색)
  686. }
  687. if(delyn == "Y" || (formrecseq == "-1" && deluserid != "" && deldt != "")){
  688. grd_unprepreclist.cellStyle("color", i, checkcol, i, grd_unprepreclist.cols-1) = "#999999"; // 삭제된 기록지(연한 회색)
  689. }
  690. }
  691. model.setValue("/root/main/cond/patcnt", patcnt);
  692. model.setValue("/root/main/cond/reccnt", reccnt);
  693. model.refresh();
  694. }
  695. /**
  696. * @desc 미비기록 리스트 조회, 의사정보 기준
  697. */
  698. function fReqGetUnPrepRecDrBaseList(unprepsign){
  699. //미비기록추가, 저장 이후에 현재 조회된 미비기록리스트를 재조회하기 위해 설정함
  700. model.setValue("/root/main/cond/srchflag", "dr");
  701. model.setValue("/root/main/cond/unprepdrbase/scrnflag" , "unprepdrbase");
  702. model.setValue("/root/main/cond/unprepdrbase/unprepsign", unprepsign); //실제미비리스트 조회시
  703. //미비의사명이 없는 경우, 조회조건의 의사ID를 삭제
  704. if(ipt_unprepdrnm.currentText == ""){
  705. model.setValue("/root/main/cond/unprepdrbase/unprepdrid", "");
  706. }
  707. //조회조건 미비상태값 설정
  708. var unprepstat = model.getValue("/root/main/cond/unprepdrbase/unprepstat");
  709. if(unprepstat != "-"){
  710. var unprepstatArray = unprepstat.split(' ');
  711. var cond = "";
  712. for(var i = 0; i < unprepstatArray.length; i++){
  713. cond += unprepstatArray[i] + '\',\'';
  714. }
  715. model.setValue("/root/main/cond/unprepdrbase/unprepstatlist", cond.substring(0, cond.length - 3));
  716. }
  717. model.removeNodeset("/root/send/reqdata");
  718. model.makeNode("/root/send/reqdata");
  719. model.copyNode("/root/send/reqdata", "/root/main/cond/unprepdrbase");
  720. if(submit("TRMRI02107")){
  721. fDoMergeUnPrepRecList();
  722. }
  723. }
  724. /**
  725. * @desc 미비기록 load
  726. */
  727. function fLoadUnPrepFormRec(){
  728. var currow = grd_unprepreclist.row;
  729. if(currow < 1){
  730. return;
  731. }
  732. var pid = model.getValue(grd_unprepreclist.nodeset + "["+ currow +"]/pid");
  733. var indd = model.getValue(grd_unprepreclist.nodeset + "["+ currow +"]/indd");
  734. var cretno = model.getValue(grd_unprepreclist.nodeset + "["+ currow +"]/cretno");
  735. var formcd = model.getValue(grd_unprepreclist.nodeset + "["+ currow +"]/formcd");
  736. var srcformcd = model.getValue(grd_unprepreclist.nodeset + "["+ currow +"]/srcformcd");
  737. var dschdd = model.getValue(grd_unprepreclist.nodeset + "["+ currow +"]/dschdd");
  738. var oprsrvno = model.getValue(grd_unprepreclist.nodeset + "["+ currow +"]/oprsrvno");
  739. var orddrid = model.getValue(grd_unprepreclist.nodeset + "["+ currow +"]/unprepdrid");
  740. var orddeptcd = model.getValue(grd_unprepreclist.nodeset + "["+ currow +"]/indschdeptcd");
  741. var formrecseq = model.getValue(grd_unprepreclist.nodeset + "["+ currow +"]/formrecseq");
  742. var formrecdd = model.getValue(grd_unprepreclist.nodeset + "["+ currow +"]/formrecdd");
  743. var instcd = getUserInfo("dutplceinstcd");
  744. //2009-07-08 오후 8:03:43 강지훈 수정 : 20091002로 하드코딩된 내역을 공통코드 "M0546" 유형코드 "M0037" 로 관리
  745. var opendd = model.getValue("/root/init/openday/M0037M0546/cdid"); // 병원별 오픈일
  746. var preopendd = opendd.toDate().getAddDate(-1, "D").getDateFormat();
  747. var preOpenMonth = preopendd.substring(4,6);
  748. var preOpenDay = preopendd.substring(6,8);
  749. if(formrecdd <= preopendd){
  750. messageBox(preOpenMonth+"월 "+preOpenDay+"일까지 발생된 미비기록은 구OCS프로그램과 종이에 작성", "I008");
  751. return;
  752. }
  753. // 2009-11-02 이경희
  754. // 오픈이전 기록 메시지와 기록지 연결이 안된 미비 메시지와 순서를 변경함
  755. if(formrecseq == 0 || formrecseq == -1){
  756. messageBox("기록지와 연결이 되지 않은 미비", "I009");
  757. return;
  758. }
  759. // 2009.07.01 이경희
  760. // 환자의 퇴원일이 해당 일자 이후인 경우. 즉 재원중인 환자는 dschdd를 현재일자로 넘긴다.
  761. var today = getCurrentDate();
  762. if(dschdd > today) {
  763. dschdd = today
  764. }
  765. //수술기록인 경우, 상단정보 처리
  766. if(srcformcd == "0000000676"){
  767. var param = "T" + "▦" +
  768. pid + "▦" +
  769. formrecdd + "▦" +
  770. cretno + "▦" +
  771. instcd + "▦" +
  772. "" + "▦" +
  773. "" + "▦" +
  774. "I" + "▦" +
  775. "F" + "▦" +
  776. oprsrvno + "▦" +
  777. "" + "▦" +
  778. dschdd;
  779. setParameter("condparam", param);
  780. //수술기록 이외의 상단정보 처리
  781. }else{
  782. var param = "I" + "▦" +
  783. pid + "▦" +
  784. indd + "▦" +
  785. cretno + "▦" +
  786. instcd + "▦" +
  787. dschdd;
  788. setParameter("condparam", param);
  789. }
  790. setGlobalVariable("linked_formcd" , formcd , "emr");
  791. setGlobalVariable("linked_formrecseq", formrecseq , "emr");
  792. setGlobalVariable("linked_formrecdd" , formrecdd , "emr");
  793. modal("SPMMO08900", 1, 0, 0, "", "", "", "left:0; right:0; width:0; height:0; sysmenu:hidden; caption:hidden; min:hidden, max:hidden;");
  794. var gmainwnd = getMainViewer();
  795. setParameter("SMMMO04100_ANSWCNT", "");
  796. gmainwnd.javascript.navigate("SMMMR00100");
  797. model.refresh();
  798. }
  799. /**
  800. * @desc 미비의사 조회
  801. */
  802. function fReqGetUnPrepDrSmplList(srchflag, srchdata){
  803. model.removeNodeset("/root/send/reqdata");
  804. model.makeValue("/root/send/reqdata/srchflag", srchflag);
  805. model.makeValue("/root/send/reqdata/srchdata", srchdata);
  806. if(submit("TRMRI02901")){
  807. }
  808. }
  809. /**
  810. * @desc 미비추가된 정보 생성
  811. */
  812. function fCretUnPrepSaveInfo(){
  813. var sCSV = model.getValue("/root/temp/unpreprecinfo");
  814. model.setValue("/root/temp/unpreprecinfo", "");
  815. setCSVToNode("/root/temp/unpreprecinfo", sCSV, "unprepreclist");
  816. fSetUnPrepSaveInfo();
  817. }
  818. /**
  819. * @desc 미비 Excel화일 생성
  820. */
  821. function reqGetUnPrepCreateExcelFile(){
  822. var files = window.fileDialog("save", "|", true, "", "", "Excel Files(*.xls)|*.xls");
  823. if(files != ""){
  824. model.removeNodeset("/root/send/reqdata");
  825. //화일 디렉토리 위치, 화일명을 받는다.
  826. var filesarr= files.split("\\");
  827. var filenm = filesarr[filesarr.length-1];
  828. var filepath= files.split(filenm);
  829. var colref = "pid^hngnm^dschdeptnm^dschdd^indd^medispclnm^unprepstatnm^doctkindflag^unprepdrnm^unprepdeptnm^formnm^unprepitemnm^formrecdd^medirecalertcnts^drcnfmdt^dralertcnts^fstrgstrnm^fstrgstdt^lastupdtrnm^lastupdtdt";
  830. //조회시 조건을 설정하여 CSV형태로 전환하여 조회
  831. model.setValue("/root/main/cond/srchflag", "dr");
  832. var unprepstat = model.getValue("/root/main/cond/unprepdrbase/unprepstat");
  833. if(unprepstat != "-"){
  834. var unprepstatArray = unprepstat.split(' ');
  835. var cond = "";
  836. for(var i = 0; i < unprepstatArray.length; i++){
  837. cond += unprepstatArray[i] + '\',\'';
  838. }
  839. model.setValue("/root/main/cond/unprepdrbase/unprepstatlist", cond.substring(0, cond.length - 3));
  840. }
  841. //미비의사명이 없는 경우, ID를 clear
  842. if(ipt_unprepdrnm.currentText == ""){
  843. model.setValue("/root/main/cond/unprepdrbase/unprepdrid", "");
  844. }
  845. model.removeNodeset("/root/send/reqdata");
  846. model.makeNode("/root/send/reqdata");
  847. model.setValue("/root/main/cond/unprepdrbase/unprepsign", "N");
  848. model.makeValue("/root/main/cond/unprepdrbase/scrnflag" , "unprepdrbase");
  849. //전체조회 월별로 나눠서 file로 다운로드처리
  850. //2008. 12. 22 오지훈
  851. var dayflag = model.getValue("/root/main/cond/unprepdrbase/dayflag");
  852. if(dayflag == "N"){
  853. model.setValue("/root/main/cond/unprepdrbase/dayflag", "Y");
  854. // 2009-07-25 이경희
  855. // 엑셀저장시 2009/07/01로 고정된 부분을 수정.
  856. //var startdate = "20070101";
  857. var opendd = model.getValue("/root/init/openday/M0037M0546/cdid"); // 병원별 오픈일
  858. var startdate = opendd.toDate().getDateFormat("YYYYMM") + "01"; // 오픈한 달의 첫날부터로 설정
  859. var enddate = getCurrentDate();
  860. }else{
  861. model.setValue("/root/main/cond/unprepdrbase/dayflag", "Y");
  862. var startdate = model.getValue("/root/main/cond/unprepdrbase/fromdd");
  863. var enddate = model.getValue("/root/main/cond/unprepdrbase/todd");
  864. var backupflag = "Y";
  865. }
  866. var steps = parseInt(model.getValue("/root/main/cond/excelcond/steps")) - 1;
  867. var lastdd = "";
  868. var enddd = "";
  869. //시작일자와 종료일자가 동일한 달인 경우(monthcnt == 0), 종료일자는 그대로
  870. //동일한 달이 아닌 경우, 그 달의 마지막 날짜를 concat한다.
  871. while(enddate > startdate){
  872. enddd = ((startdate.toDate()).getAddDate(steps, "M")).getDateFormat();
  873. if(enddd.substring(0, 6) >= enddate.substring(0, 6)){
  874. enddd = enddate;
  875. }else{
  876. var dd1 = enddd.substring(0, 6).concat("01");
  877. var dd2 = ((dd1.toDate()).getAddDate(1, "M")).getDateFormat();
  878. lastdd = getDateInterval(dd1, dd2);
  879. enddd = enddd.substring(0, 6).concat(lastdd);
  880. }
  881. model.setValue("/root/main/cond/unprepdrbase/fromdd", startdate);
  882. model.setValue("/root/main/cond/unprepdrbase/todd" , enddd);
  883. var condnode = model.instance1.selectNodes("/root/main/cond/unprepdrbase");
  884. model.makeValue("/root/send/reqdata/colref" , colref);
  885. model.makeValue("/root/send/reqdata/sqlid" , "getUnPrepRecList");
  886. model.makeValue("/root/send/reqdata/srchcond", doSrchCondCSV(condnode, "^", "|"));
  887. var param = "&colref=" + colref +
  888. "&sqlid=" + "getUnPrepRecList" +
  889. "&srchcond=" + model.getValue("/root/send/reqdata/srchcond");
  890. model.download(getActionURL("TRMRI02108")+param, files + "_" + startdate + "_" + enddd + ".xls", false);
  891. startdate = ((startdate.toDate()).getAddDate(steps + 1, "M")).getDateFormat();
  892. }
  893. //원래 기간 조회가 아니었으므로 기간조회를 N으로 처리함
  894. if(backupflag == "Y"){
  895. model.setValue("/root/main/cond/unprepdrbase/dayflag", "N");
  896. }
  897. }else{
  898. return;
  899. }
  900. }
  901. /**
  902. * @desc 미비 정보 저장
  903. */
  904. function fSaveUnPrepInfo(){
  905. var savenodelist = model.instances(0).selectNodes("/root/main/unpreprecinfo/unprepreclist[status!='']");
  906. var srchflag = model.getValue("/root/main/cond/srchflag");
  907. if(srchflag == "pat"){
  908. var srchnodelist = model.instances(0).selectNodes("/root/main/cond/unpreppatbase");
  909. }else{
  910. var srchnodelist = model.instances(0).selectNodes("/root/main/cond/unprepdrbase");
  911. }
  912. //var srchnodelist = model.instances(0).selectNodes("/root/send/reqdata");
  913. if(savenodelist.length == 0){
  914. messageBox("저장할 정보가", "I004");
  915. return;
  916. }else{
  917. grd_patreclist.attribute("visibility") = "hidden";
  918. var savedata = getNodeListCSV(savenodelist);
  919. var srchdata = getNodeListCSV(srchnodelist);
  920. model.removeNodeset("/root/send/savedata");
  921. model.makeNode("/root/send/savedata");
  922. model.makeValue("/root/send/savedata", savedata);
  923. model.makeValue("/root/send/srchdata", srchdata);
  924. if(submit("TXMRI02101")){
  925. fDoMergeUnPrepRecList();
  926. }
  927. }
  928. }
  929. /**
  930. * @desc 기록연동 해제
  931. */
  932. function fCnclFormRecSeq(){
  933. var loopcnt = grd_unprepreclist.selectedRows;
  934. for(var i = 0 ; i < loopcnt ; i++){
  935. grd_unprepreclist.valueMatrix(grd_unprepreclist.selectedRow(i), grd_unprepreclist.colRef("status")) = "f";
  936. }
  937. }
  938. /**
  939. * @desc 미비분과 설정창 open
  940. */
  941. function fOpenUnPrepDeltDeptCD(){
  942. var currow = grd_unprepreclist.row;
  943. if(currow > 0){
  944. group3.attribute("left")= event.targetX;
  945. group3.attribute("top") = event.targetY;
  946. // targetX가 간혹 음수가 나오는 케이스를 수정
  947. //group3.attribute("left")= event.clientX;
  948. //group3.attribute("top") = event.clientY;
  949. group3.attribute("height") = 55;
  950. // grd_unprepreclist.disabled = true;
  951. // btn_requnpreppatbase.disabled = true;
  952. // btn_requnprepdrbase.disabled = true;
  953. // btn_realunprep.disabled = true;
  954. // btn_opinfo.disabled = true;
  955. // btn_totrec.disabled = true;
  956. // btn_unprepcert.disabled = true;
  957. // btn_del.disabled = true;
  958. // btn_ex.disabled = true;
  959. // btn_save.disabled = true;
  960. var orddeptcd = model.getValue(grd_unprepreclist.nodeset + "[" + currow + "]/orddeptcd");
  961. //미비과에 따라 미비분과 combo정보를 변경
  962. if(orddeptcd == "2040000000"){ //외과
  963. cmb_detldeptcd.choices.itemset.attribute("nodeset") = "/root/init/M0501/M0501";
  964. }else if(orddeptcd == "2100000000"){ //산부인과
  965. cmb_detldeptcd.choices.itemset.attribute("nodeset") = "/root/init/M0502/M0502";
  966. }else if(orddeptcd == "2110000000"){ //소아과
  967. cmb_detldeptcd.choices.itemset.attribute("nodeset") = "/root/init/M0503/M0503";
  968. }
  969. else
  970. {
  971. cmb_detldeptcd.choices.itemset.attribute("nodeset") = "/root/init/M0504/M0504";
  972. model.makeValue("/root/main/unprepdeptcd/detldeptcd", "");
  973. cmb_detldeptcd.refresh();
  974. return;
  975. }
  976. cmb_detldeptcd.select(1);
  977. cmb_detldeptcd.refresh();
  978. }
  979. }
  980. /**
  981. * @desc 세부과설정
  982. */
  983. function fSetDetlDeptCD(){
  984. var loopcnt = grd_unprepreclist.selectedRows;
  985. for(var i = 0 ; i < loopcnt ; i++){
  986. grd_unprepreclist.valueMatrix(grd_unprepreclist.selectedRow(i), grd_unprepreclist.colRef("status")) = "l";
  987. grd_unprepreclist.valueMatrix(grd_unprepreclist.selectedRow(i), grd_unprepreclist.colRef("detldeptnm")) = cmb_detldeptcd.label;
  988. grd_unprepreclist.valueMatrix(grd_unprepreclist.selectedRow(i), grd_unprepreclist.colRef("detldeptcd")) = cmb_detldeptcd.value;
  989. }
  990. model.refresh();
  991. }
  992. function fManageAlertCnts()
  993. {
  994. var currow = grd_unprepreclist.row;
  995. var pid = model.getValue(grd_unprepreclist.nodeset + "["+ currow +"]/pid");
  996. var formcd = model.getValue(grd_unprepreclist.nodeset + "["+ currow +"]/formcd");
  997. var formrecdd = model.getValue(grd_unprepreclist.nodeset + "["+ currow +"]/formrecdd");
  998. var unprepdrid = model.getValue(grd_unprepreclist.nodeset + "["+ currow +"]/unprepdrid");
  999. var unprepitemcd = model.getValue(grd_unprepreclist.nodeset + "["+ currow +"]/unprepitemcd");
  1000. var unprepstat = model.getValue(grd_unprepreclist.nodeset + "["+ currow +"]/unprepstat");
  1001. var unprepno = model.getValue(grd_unprepreclist.nodeset + "["+ currow +"]/unprepno");
  1002. model.removeNodeset("/root/send/savedata");
  1003. model.makeNode("/root/send/savedata");
  1004. model.makeValue("/root/send/savedata/pid", pid);
  1005. model.makeValue("/root/send/savedata/formcd", formcd);
  1006. model.makeValue("/root/send/savedata/formrecdd", formrecdd);
  1007. model.makeValue("/root/send/savedata/unprepdrid", unprepdrid);
  1008. model.makeValue("/root/send/savedata/unprepitemcd", unprepitemcd);
  1009. model.makeValue("/root/send/savedata/unprepstat", unprepstat);
  1010. model.makeValue("/root/send/savedata/unprepno", unprepno);
  1011. model.makeValue("/root/send/savedata/gubun", "med"); // 의사 전달사항 구분
  1012. if(submit("TRMRI01706") == true)
  1013. {
  1014. if(grd_medalertlist.rows == 1)
  1015. return;
  1016. var medirecalertcnts = "";
  1017. for(var idx = 1; idx < grd_medalertlist.rows; idx++)
  1018. {
  1019. var tmpDate = model.getValue(grd_medalertlist.nodeset + "[" + idx + "]/lastupdtdt");
  1020. var tmpmedirecalertcnts = model.getValue(grd_medalertlist.nodeset + "[" + idx + "]/medirecalertcnts");
  1021. var tmpstr = tmpDate + "\n" + tmpmedirecalertcnts + "\n";
  1022. medirecalertcnts += tmpstr;
  1023. }
  1024. setParameter("SPMRI02000_scrnflag" , "m");
  1025. setParameter("SPMRI02000_alertcnts", medirecalertcnts);
  1026. modal("SPMRI02000");
  1027. }
  1028. }
  1029. function fManageDrAlertCnts()
  1030. {
  1031. var currow = grd_unprepreclist.row;
  1032. var pid = model.getValue(grd_unprepreclist.nodeset + "["+ currow +"]/pid");
  1033. var formcd = model.getValue(grd_unprepreclist.nodeset + "["+ currow +"]/formcd");
  1034. var formrecdd = model.getValue(grd_unprepreclist.nodeset + "["+ currow +"]/formrecdd");
  1035. var unprepdrid = model.getValue(grd_unprepreclist.nodeset + "["+ currow +"]/unprepdrid");
  1036. var unprepitemcd = model.getValue(grd_unprepreclist.nodeset + "["+ currow +"]/unprepitemcd");
  1037. var unprepstat = model.getValue(grd_unprepreclist.nodeset + "["+ currow +"]/unprepstat");
  1038. var unprepno = model.getValue(grd_unprepreclist.nodeset + "["+ currow +"]/unprepno");
  1039. model.removeNodeset("/root/send/savedata");
  1040. model.makeNode("/root/send/savedata");
  1041. model.makeValue("/root/send/savedata/pid", pid);
  1042. model.makeValue("/root/send/savedata/formcd", formcd);
  1043. model.makeValue("/root/send/savedata/formrecdd", formrecdd);
  1044. model.makeValue("/root/send/savedata/unprepdrid", unprepdrid);
  1045. model.makeValue("/root/send/savedata/unprepitemcd", unprepitemcd);
  1046. model.makeValue("/root/send/savedata/unprepstat", unprepstat);
  1047. model.makeValue("/root/send/savedata/unprepno", unprepno);
  1048. model.makeValue("/root/send/savedata/gubun", "dr"); // 의사 전달사항 구분
  1049. if(submit("TRMRI01707") == true)
  1050. {
  1051. if(grd_dralertlist.rows == 1)
  1052. return;
  1053. var dralertcnts = "";
  1054. for(var idx = 1; idx < grd_dralertlist.rows; idx++)
  1055. {
  1056. var tmpDate = model.getValue(grd_dralertlist.nodeset + "[" + idx + "]/lastupdtdt");
  1057. var tmpDralertcnts = model.getValue(grd_dralertlist.nodeset + "[" + idx + "]/medirecalertcnts");
  1058. var tmpstr = tmpDate + "\n" + tmpDralertcnts + "\n";
  1059. dralertcnts += tmpstr;
  1060. }
  1061. setParameter("SPMRI02000_scrnflag" , "d");
  1062. setParameter("SPMRI02000_alertcnts", dralertcnts);
  1063. modal("SPMRI02000");
  1064. }
  1065. }
  1066. function fManageAlert(){
  1067. }