SMMRI01700.js 45 KB

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