SPMRF05200.js 77 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210
  1. var delayTime = "";
  2. var saveCnt = "";
  3. var saveState = "";
  4. function fInitialize(){
  5. saveCnt = "0";
  6. model.resetInstanceNode("/root/main/grthlist/list/grth");
  7. model.removeNodeset("/root/main/grthlist/list/grth");
  8. model.resetInstanceNode("/root/main/laborlist/list/labor");
  9. model.removeNodeset("/root/main/laborlist/list/labor");
  10. model.removeNodeset("/root/main/paminfo/pamlist");
  11. //20110808
  12. fGetHardCDList("N", 5555, 0 , "/root/init/dept/item"); //성장곡선관련 진료과
  13. //20110808
  14. combo4.select(0);
  15. var sPamInfo = getGlobalVariable("paminfo");
  16. setCSVToNode("/root/main/paminfo",sPamInfo,"pamlist"); //환자정보내리기
  17. var sPID = model.getValue("/root/main/paminfo/pamlist/pid");
  18. var hngnm = model.getValue("/root/main/paminfo/pamlist/hngnm");
  19. var brthdd = model.getValue("/root/main/paminfo/pamlist/brthdd");
  20. var rrgstno1 = model.getValue("/root/main/paminfo/pamlist/rrgstno1");
  21. if(brthdd == ""){
  22. if(sPID != ""){
  23. var temp = rrgstno1.substr(0,2);
  24. if(parseInt(temp) > 50){
  25. brthdd = "19"+rrgstno1;
  26. }
  27. else{
  28. brthdd = "20"+rrgstno1;
  29. }
  30. }
  31. }
  32. var sex = model.getValue("/root/main/paminfo/pamlist/sex");
  33. var orddeptcd = model.getValue("/root/main/paminfo/pamlist/orddeptcd");
  34. model.setValue("/root/send/pid", sPID);
  35. model.setValue("/root/main/cond/hngnm", hngnm);
  36. model.setValue("/root/main/cond/sex", sex);
  37. if(sPID != ""){
  38. model.setValue("/root/main/cond/rrgstno1", rrgstno1+"-*******");
  39. }
  40. model.setValue("/root/send/orgbrthdd", brthdd);
  41. var userid = getUserInfo("userid");
  42. var userDept = getUserInfo("dutplcecd");
  43. //2012/02/20 Start 칠곡 내분비대사센터에서 소아청소년과의 성장곡선을 오픈시 과코드를 변경
  44. if(getUserInfo("dutplceinstcd")=="032" && getUserInfo("dutplcecd")=="2363400000"){ //<-- 칠곡이면서 내분비대사센터로 로그인시
  45. userDept="2110000000"; //<-- 소아청소년과
  46. }
  47. //2012/02/20 End
  48. //2013/05/13 Start 칠곡 어린이병원 외래센터에서 소아청소년과의 성장곡선을 오픈시 과코드를 변경
  49. if(getUserInfo("dutplceinstcd")=="032" && getUserInfo("dutplcecd")=="2880000000"){ //<-- 칠곡이면서 어린이병원외래센터로 로그인시
  50. userDept="2110000000"; //<-- 소아청소년과
  51. }
  52. //2013/05/13 End
  53. //2014/03/06 Start 칠곡 발달재활센터에서 로그인시 과코드를 변경
  54. if(getUserInfo("dutplceinstcd")=="032" && getUserInfo("dutplcecd")=="2990000000"){ //<-- 칠곡이면서 어린이병원외래센터로 로그인시
  55. userDept="2110000000"; //<-- 소아청소년과
  56. }
  57. //2014/04/01 Start
  58. /*
  59. 소아청소년 내분비 2112300000
  60. 소아청소년 소화기영양 2112400000
  61. 소아청소년 신경 2112500000
  62. 신생아 2110500000
  63. 소아청소년 신장 2112600000
  64. 소아청소년 심장 2112700000
  65. 소아 알레르기 호흡기 2112800000
  66. 소아청소년 혈액종양 2112900000
  67. */
  68. if(getUserInfo("dutplceinstcd")=="032" && (getUserInfo("dutplcecd")=="2112300000" || getUserInfo("dutplcecd")=="2112400000" || getUserInfo("dutplcecd")=="2112500000" || getUserInfo("dutplcecd")=="2110500000" ||
  69. getUserInfo("dutplcecd")=="2112600000" || getUserInfo("dutplcecd")=="2112700000" || getUserInfo("dutplcecd")=="2112800000" || getUserInfo("dutplcecd")=="2112900000")){
  70. userDept="2110000000"; //<-- 소아청소년과
  71. }
  72. //2014/04/01 End
  73. //2013/05/13 End
  74. //2012/06/13 주석처리 Start
  75. /*
  76. if(userid == "DEVB08"){
  77. userDept = "2100000000";
  78. model.setValue("/root/send/orddeptcd", "2100000000");
  79. }
  80. */
  81. //2012/06/13 주석처리 End
  82. // 저장 버튼 권한관리
  83. switch(userDept){
  84. case "2110000000":
  85. case "2030000000":
  86. case "2070000000":
  87. case "3050146000":
  88. button7.disabled = false;
  89. button8.disabled = false;
  90. btn_gr.visible = true;
  91. break;
  92. case "2100000000":
  93. button13.disabled = false;
  94. button15.disabled = false;
  95. btn_lb.visible = true;
  96. break;
  97. case "2120000000":
  98. btn_ht.visible = true;
  99. break;
  100. }
  101. if(userDept=="3050146000"){
  102. model.setValue("/root/send/orddeptcd", "2030000000");
  103. }else if(userDept=="2070000000"){
  104. model.setValue("/root/send/orddeptcd", "2070000000");
  105. }else{
  106. model.setValue("/root/send/orddeptcd", userDept);
  107. }
  108. /*if(userid == "EMR" || userid == "DEVB08"){
  109. model.setValue("/root/send/orddeptcd", "2110000000");
  110. }*/
  111. // 미비 Popup시 화면 설정
  112. var unprepflag = opener.javascript.getParameter("unprepflag");
  113. if(unprepflag == "Y"){
  114. model.setValue("/root/send/orddeptcd", "2100000000");
  115. }
  116. // 성장도표, Labor note, 100 Hue test 선택
  117. orddeptcd = model.getValue("/root/send/orddeptcd");
  118. switch(orddeptcd){
  119. case "2110000000":
  120. case "2030000000":
  121. case "2070000000":
  122. model.setValue("/root/send/flag", "1");
  123. group2.visible = true;
  124. group3.visible = false;
  125. break;
  126. case "2100000000":
  127. model.setValue("/root/labor/send/flag", "2");
  128. group2.visible = false;
  129. group3.visible = true;
  130. break;
  131. }
  132. model.setValue("/root/rec/send/formflag", model.getValue("/root/send/flag"));
  133. if(sPID == "" && userid == "DEVB08"){
  134. model.setValue("/root/send/pid", "18942082");
  135. //model.setValue("/root/main/cond/hngnm", "이아이");
  136. //model.setValue("/root/main/cond/sex", "F");
  137. //model.setValue("/root/main/cond/rrgstno1", "030301-3******");
  138. //model.setValue("/root/send/orgbrthdd", "20030301");
  139. }
  140. model.setValue("/root/rec/send/fromdd", getDateAddc(getCurrentDate(), -365));
  141. model.setValue("/root/rec/send/todd", getCurrentDate());
  142. model.removeNodeset("/root/init/orddd");
  143. submit("TRMRF05201");
  144. var nodeCnt = getNodesetCount("/root/init/orddd");
  145. // 상단정보 받았을때 진료일자 선택 부분
  146. if(nodeCnt > 0){
  147. var ioflag = model.getValue("/root/main/paminfo/pamlist/ioflag");
  148. var orddd;
  149. if(ioflag == "I"){
  150. orddd = model.getValue("/root/main/paminfo/pamlist/indd");
  151. }
  152. else if(ioflag == "O"){
  153. orddd = model.getValue("/root/main/paminfo/pamlist/orddd");
  154. }
  155. var rowcnt = "";
  156. for( i = 1; i <= nodeCnt; i++ ){
  157. var ordtype = model.getValue("/root/init/orddd["+i+"]/ordtype");
  158. var dd = model.getValue("/root/init/orddd["+i+"]/orddd");
  159. if( ioflag == ordtype && orddd == dd){
  160. rowcnt = model.getValue("/root/init/orddd["+i+"]/rowcnt");
  161. }
  162. }
  163. if(rowcnt != ""){
  164. model.setValue("/root/send/ordd", rowcnt);
  165. }
  166. else if(rowcnt == "") {
  167. combo2.select(0);
  168. }
  169. }
  170. fCalcAge();
  171. // 그래프 선택
  172. fSelectGraph();
  173. if(orddeptcd == "2110000000" || orddeptcd == "2030000000" || orddeptcd == "2070000000"){
  174. fGetGrphData();
  175. // 행추가
  176. grd_grth.addRow();
  177. var cur_row = grd_grth.row-1;
  178. var curDate = getCurrentDate();
  179. var maskDate = curDate.substr(0, 4) + "-" + curDate.substr(4, 2) + "-" + curDate.substr(6, 2);
  180. model.setValue("/root/main/grthlist/list/grth["+cur_row+"]/recdd", maskDate);
  181. //20110811
  182. var time=getCurrentTime();
  183. model.setValue("/root/main/grthlist/list/grth["+cur_row+"]/rectime", time.substring(0, 4));
  184. //20110811
  185. model.setValue("/root/main/grthlist/list/grth["+cur_row+"]/seq", grd_grth.row-1);
  186. fCalcGrid();
  187. model.refresh();
  188. // 출생 예정일
  189. var saveflag = "";
  190. saveflag = model.getValue("/root/send/saveflag");
  191. var year = model.getValue("/root/main/cond/year");
  192. var month = model.getValue("/root/main/cond/month");
  193. var result = saveflag.indexOf("7");
  194. if(result == "-1"){
  195. model.setValue("/root/send/brthschedd", "");
  196. input21.disabled = true;
  197. }
  198. else {
  199. input21.disabled = false;
  200. }
  201. if(saveflag == ""){
  202. // 25개월 이상 이면 2~18세 그래프 선택
  203. var sMonth = parseInt(year)*12 + parseInt(month);
  204. if(sMonth >24){
  205. model.setValue("/root/main/cond/chart", "2");
  206. model.setValue("/root/send/saveflag", "2");
  207. button1.selected = true;
  208. }
  209. else{
  210. model.setValue("/root/main/cond/chart", "1");
  211. model.setValue("/root/send/saveflag", "1");
  212. button2.selected = true;
  213. }
  214. }
  215. else{
  216. var vResult = saveflag.indexOf("1");
  217. var rslt = saveflag.indexOf("2");
  218. if(vResult != "-1"){
  219. model.setValue("/root/main/cond/chart", "1");
  220. button2.selected = true;
  221. }
  222. if(rslt != "-1"){
  223. model.setValue("/root/main/cond/chart", "2");
  224. button1.selected = true;
  225. }
  226. }
  227. model.refresh();
  228. var index = combo2.value;
  229. if(sPID != "" && nodeCnt > 0){
  230. var orddd = model.getValue("/root/init/orddd["+index+"]/orddd");
  231. var cretno = model.getValue("/root/init/orddd["+index+"]/cretno");
  232. var orddeptcd = model.getValue("/root/init/orddd["+index+"]/orddeptcd");
  233. var orddrid = model.getValue("/root/init/orddd["+index+"]/orddrid");
  234. var ordtype = model.getValue("/root/init/orddd["+index+"]/ordtype");
  235. model.setValue("/root/send/orddd", orddd);
  236. model.setValue("/root/send/cretno", cretno);
  237. model.setValue("/root/send/orddeptcd", orddeptcd);
  238. model.setValue("/root/send/orddrid", orddrid);
  239. model.setValue("/root/send/signgenrflag", ordtype);
  240. }
  241. fMakeChart();
  242. }else if(orddeptcd == "2100000000"){
  243. fGetLaborData();
  244. fMakeLaborGraph();
  245. }
  246. //2014/04/01 Start
  247. /*
  248. 소아청소년 내분비 2112300000
  249. 소아청소년 소화기영양 2112400000
  250. 소아청소년 신경 2112500000
  251. 신생아 2110500000
  252. 소아청소년 신장 2112600000
  253. 소아청소년 심장 2112700000
  254. 소아 알레르기 호흡기 2112800000
  255. 소아청소년 혈액종양 2112900000
  256. */
  257. if(getUserInfo("dutplceinstcd")=="032" && (getUserInfo("dutplcecd")=="2112300000" || getUserInfo("dutplcecd")=="2112400000" || getUserInfo("dutplcecd")=="2112500000" || getUserInfo("dutplcecd")=="2110500000" ||
  258. getUserInfo("dutplcecd")=="2112600000" || getUserInfo("dutplcecd")=="2112700000" || getUserInfo("dutplcecd")=="2112800000" || getUserInfo("dutplcecd")=="2112900000")){
  259. model.setValue("/root/send/orddeptcd", getUserInfo("dutplcecd"));
  260. combo1.refresh();
  261. }
  262. //2014/04/01 End
  263. }
  264. function fMakeChart(){
  265. TChart1.ClearChart();
  266. TChart1.RemoveAllSeries();
  267. TChart1.Axis.RemoveAllCustom();
  268. //TChart1.ClearChart();
  269. var graph = model.getValue("/root/main/cond/chart");
  270. var sex = model.getValue("/root/main/cond/sex");
  271. //margin 값 정하기
  272. TChart1.Panel.MarginTop = 2;
  273. TChart1.Panel.MarginLeft = 5;
  274. TChart1.Panel.MarginRight = 7;
  275. TChart1.Panel.MarginBottom = 3;
  276. // TChart1.Axis.Bottom.TickLength = 1010;
  277. //20110711 이정택 수정
  278. if(graph=="3" && sex=="M"){
  279. TChart1.Panel.MarginTop = 2.8;
  280. TChart1.Panel.MarginLeft = 6;
  281. TChart1.Panel.MarginRight = 7;
  282. TChart1.Panel.MarginBottom = 7.5;
  283. }else if(graph=="3" && sex=="F"){
  284. TChart1.Panel.MarginTop = 2.5;
  285. TChart1.Panel.MarginLeft = 6;
  286. TChart1.Panel.MarginRight = 7.2;
  287. TChart1.Panel.MarginBottom = 10;
  288. }else if(graph=="3" && sex==""){
  289. TChart1.Panel.MarginTop = 2.5;
  290. TChart1.Panel.MarginLeft = 6;
  291. TChart1.Panel.MarginRight = 7.2;
  292. TChart1.Panel.MarginBottom = 10;
  293. }
  294. if(graph=="4" && sex=="M"){
  295. TChart1.Panel.MarginTop = 2.8;
  296. TChart1.Panel.MarginLeft = 6;
  297. TChart1.Panel.MarginRight = 10.6;
  298. TChart1.Panel.MarginBottom = 7;
  299. }else if(graph=="4" && sex=="F"){
  300. TChart1.Panel.MarginTop = 2.5;
  301. TChart1.Panel.MarginLeft = 5.9;
  302. TChart1.Panel.MarginRight = 10.6;
  303. TChart1.Panel.MarginBottom = 8;
  304. }else if(graph=="4" && sex==""){
  305. TChart1.Panel.MarginTop = 2.5;
  306. TChart1.Panel.MarginLeft = 5.9;
  307. TChart1.Panel.MarginRight = 10.6;
  308. TChart1.Panel.MarginBottom = 8;
  309. }
  310. /* 20110808
  311. if(graph=="5" && sex=="M"){
  312. // TChart1.Panel.MarginTop = 2.8;
  313. // TChart1.Panel.MarginLeft = 6;
  314. TChart1.Panel.MarginRight = 9;
  315. TChart1.Panel.MarginBottom = 7.5;
  316. // TChart1.Panel.BevelInner = 0;
  317. // TChart1.Panel.BevelOuter = 0;
  318. }
  319. else if(graph=="5" && sex=="F"){
  320. TChart1.Panel.MarginTop = 2.5;
  321. TChart1.Panel.MarginLeft = 5.9;
  322. TChart1.Panel.MarginRight = 10.6;
  323. TChart1.Panel.MarginBottom = 8;
  324. }
  325. */
  326. //20110711 이정택 수정
  327. //하단축 칸 수 정하기와 눈금 없애기
  328. //TChart1.Axis.Bottom.SetMinMax (0, MinTimeConst * 60 * 24 * 7 - 1); //7일 동안 좌표를 표현
  329. if(graph == "2" || graph == "3" || graph == "5"){
  330. TChart1.Axis.Bottom.SetMinMax (2, 18.5); //7일 동안 좌표를 표현 (하루는 DivPerDay만큼 나눠짐)
  331. TChart1.Axis.Bottom.Increment = 1;
  332. }
  333. else if (graph == "1" || graph == "4"){
  334. TChart1.Axis.Bottom.SetMinMax (0, 36); //7일 동안 좌표를 표현 (하루는 DivPerDay만큼 나눠짐)
  335. TChart1.Axis.Bottom.Increment = 3;
  336. }
  337. TChart1.Axis.Bottom.MinorTickCount = 1;
  338. //TChart1.Axis.Bottom.Title.Caption = "개월";
  339. TChart1.Axis.Bottom.AxisPen.Color = 0x000000;
  340. //TChart1.Axis.Bottom.GridPen.Color = 0x000000; //축 점선의 색 설정
  341. TChart1.Axis.Bottom.Labels.Font.Color = 0x000000; //하단 축 눈금 명칭 색
  342. TChart1.Header.Visible = false;
  343. //TChart1.Header.Text(0)="성장도표"; //헤더제목넣기
  344. TChart1.Header.Font.Bold = true; //헤더 굵게
  345. TChart1.Header.Font.Size = 5; //헤더 사이즈
  346. TChart1.Aspect.View3D = 0; //2d 로 표현하기
  347. //TChart1.Aspect.Chart3DPercent = 2;
  348. TChart1.Zoom.enable = false; // zoom 사용하지 않기
  349. TChart1.Scroll.Enable = false; // scroll 사용하지 않기
  350. TChart1.Legend.Visible = false; // 그래프 참조 박스 띄우지 않기
  351. TChart1.Environment.MouseWheelScroll = false;
  352. //TChart1.Panel.Gradient.Visible = true; // 페널에 그라디언트 적용
  353. var cus_axis1 = TChart1.Axis.AddCustom(false); // 신장축(2-18)
  354. TChart1.Axis.Custom(0).Visible = false;
  355. TChart1.Axis.Custom(0).AxisPen.Color = 0x147814;
  356. TChart1.Axis.Custom(0).Title.Visible = false
  357. TChart1.Axis.Custom(0).Title.Caption = "신장"
  358. TChart1.Axis.Custom(0).Title.Font.Size = 8;
  359. // TChart1.Axis.Custom(0).Title.Font.Bold = true;
  360. TChart1.Axis.Custom(0).Title.Angle = 90;
  361. TChart1.Axis.Custom(0).PositionPercent = 0;
  362. TChart1.Axis.Custom(0).StartPosition = 0;
  363. TChart1.Axis.Custom(0).EndPosition = 100;
  364. TChart1.Axis.Custom(0).Automatic = false;
  365. TChart1.Axis.Custom(0).Maximum = 190;
  366. TChart1.Axis.Custom(0).Minimum = 60;
  367. TChart1.Axis.Custom(0).Increment = 5;
  368. var cus_axis2 = TChart1.Axis.AddCustom(false); // 체중축(2-18)
  369. TChart1.Axis.Custom(1).Visible = false;
  370. TChart1.Axis.Custom(1).AxisPen.Color = 0x00ff00;
  371. TChart1.Axis.Custom(1).Title.Visible = false
  372. TChart1.Axis.Custom(1).Title.Caption = "체중";
  373. TChart1.Axis.Custom(1).Title.Font.Size = 8;
  374. // TChart1.Axis.Custom(1).Title.Font.Bold = true;
  375. TChart1.Axis.Custom(1).Title.Angle = 90;
  376. TChart1.Axis.Custom(1).PositionPercent = 106;
  377. TChart1.Axis.Custom(1).Automatic = false;
  378. TChart1.Axis.Custom(1).Maximum = 135;
  379. TChart1.Axis.Custom(1).Minimum = 5;
  380. TChart1.Axis.Custom(1).Increment = 5;
  381. var cus_axis3 = TChart1.Axis.AddCustom(false); // 신장축(0-36)
  382. TChart1.Axis.Custom(2).Visible = false;
  383. TChart1.Axis.Custom(2).AxisPen.Color = 0x147814;
  384. TChart1.Axis.Custom(2).Title.Visible = false
  385. TChart1.Axis.Custom(2).Title.Caption = "신장";
  386. TChart1.Axis.Custom(2).Title.Font.Size = 8;
  387. // TChart1.Axis.Custom(1).Title.Font.Bold = true;
  388. TChart1.Axis.Custom(2).Title.Angle = 90;
  389. TChart1.Axis.Custom(2).PositionPercent = 0;
  390. TChart1.Axis.Custom(2).Automatic = false;
  391. TChart1.Axis.Custom(2).Maximum = 105;
  392. TChart1.Axis.Custom(2).Minimum = -10;
  393. TChart1.Axis.Custom(2).Increment = 5;
  394. var cus_axis4 = TChart1.Axis.AddCustom(false); // 체중축(0-36)
  395. TChart1.Axis.Custom(3).Visible = false;
  396. TChart1.Axis.Custom(3).AxisPen.Color = 0x00ff00;
  397. TChart1.Axis.Custom(3).Title.Visible = false
  398. TChart1.Axis.Custom(3).Title.Caption = "체중";
  399. TChart1.Axis.Custom(3).Title.Font.Size = 8;
  400. // TChart1.Axis.Custom(1).Title.Font.Bold = true;
  401. TChart1.Axis.Custom(3).Title.Angle = 90;
  402. TChart1.Axis.Custom(3).PositionPercent = 100;
  403. TChart1.Axis.Custom(3).Automatic = false;
  404. TChart1.Axis.Custom(3).Maximum = 25;
  405. TChart1.Axis.Custom(3).Minimum = 2;
  406. TChart1.Axis.Custom(3).Increment = 1;
  407. var cus_axis5 = TChart1.Axis.AddCustom(false); // 체질량축(2-18)
  408. TChart1.Axis.Custom(4).AxisPen.Color = 0x00ff00;
  409. TChart1.Axis.Custom(4).Title.Visible = false
  410. TChart1.Axis.Custom(4).Title.Caption = "체질량";
  411. TChart1.Axis.Custom(4).Title.Font.Size = 8;
  412. // TChart1.Axis.Custom(1).Title.Font.Bold = true;
  413. TChart1.Axis.Custom(4).Title.Angle = 90;
  414. TChart1.Axis.Custom(4).PositionPercent = 0;
  415. TChart1.Axis.Custom(4).Automatic = false;
  416. TChart1.Axis.Custom(4).Maximum = 32;
  417. TChart1.Axis.Custom(4).Minimum = 10;
  418. TChart1.Axis.Custom(4).Increment = 2;
  419. var cus_axis6 = TChart1.Axis.AddCustom(false); // 머리둘레축(0-36)
  420. TChart1.Axis.Custom(5).AxisPen.Color = 0x00ff00;
  421. TChart1.Axis.Custom(5).Title.Visible = false
  422. TChart1.Axis.Custom(5).Title.Caption = "머리둘레";
  423. TChart1.Axis.Custom(5).Title.Font.Size = 8;
  424. // TChart1.Axis.Custom(1).Title.Font.Bold = true;
  425. TChart1.Axis.Custom(5).Title.Angle = 90;
  426. TChart1.Axis.Custom(5).PositionPercent = 0;
  427. TChart1.Axis.Custom(5).Automatic = false;
  428. TChart1.Axis.Custom(5).Maximum = 58;
  429. TChart1.Axis.Custom(5).Minimum = 30;
  430. TChart1.Axis.Custom(5).Increment = 2;
  431. var cus_axis7 = TChart1.Axis.AddCustom(false); // 흉부둘레축
  432. TChart1.Axis.Custom(6).AxisPen.Color = 0x00ff00;
  433. TChart1.Axis.Custom(6).Title.Visible = false
  434. TChart1.Axis.Custom(6).Title.Caption = "머리둘레";
  435. TChart1.Axis.Custom(6).Title.Font.Size = 8;
  436. // TChart1.Axis.Custom(1).Title.Font.Bold = true;
  437. TChart1.Axis.Custom(6).Title.Angle = 90;
  438. TChart1.Axis.Custom(6).PositionPercent = 0;
  439. TChart1.Axis.Custom(6).Automatic = false;
  440. TChart1.Axis.Custom(6).Maximum = 66;
  441. TChart1.Axis.Custom(6).Minimum = 25;
  442. TChart1.Axis.Custom(6).Increment = 1;
  443. TChart1.AddSeries (4);
  444. if(graph == "1"){
  445. TChart1.AddSeries (4);
  446. }
  447. else if(graph == "2"){
  448. TChart1.AddSeries (4);
  449. TChart1.AddSeries (4);
  450. TChart1.AddSeries (4);
  451. TChart1.AddSeries (4);
  452. }
  453. if(graph == "1"){
  454. TChart1.Series(0).VerticalAxisCustom = cus_axis3;
  455. TChart1.Series(1).VerticalAxisCustom = cus_axis4;
  456. }
  457. else if(graph == "2"){
  458. TChart1.Series(0).VerticalAxisCustom = cus_axis1;
  459. TChart1.Series(1).VerticalAxisCustom = cus_axis2;
  460. TChart1.Series(2).VerticalAxisCustom = cus_axis1;
  461. TChart1.Series(3).VerticalAxisCustom = cus_axis1;
  462. TChart1.Series(4).VerticalAxisCustom = cus_axis1;
  463. }
  464. else if(graph == "3"){
  465. TChart1.Series(0).VerticalAxisCustom = cus_axis5;
  466. }
  467. else if(graph == "4" || graph == "5"){
  468. TChart1.Series(0).VerticalAxisCustom = cus_axis6;
  469. }
  470. else if(graph == "6"){
  471. TChart1.Series(0).VerticalAxisCustom = cus_axis7;
  472. }
  473. //라인의 굵기를 정해준다.
  474. if(graph == "1"){
  475. TChart1.Series(0).Color = 0x147814;
  476. TChart1.Series(1).Color = 0x00ff00;
  477. }
  478. else if(graph == "2"){
  479. TChart1.Series(0).Color = 0x147814;
  480. TChart1.Series(1).Color = 0x00ff00;
  481. TChart1.Series(2).Color = 0x0000ff;
  482. TChart1.Series(3).Color = 0xff0000;
  483. TChart1.Series(4).Color = 0x000000;
  484. }
  485. TChart1.Series(0).asPoint.Pointer.Visible = true;
  486. TChart1.Series(0).asPoint.Pointer.Style = 1;
  487. TChart1.Series(0).asPoint.Pointer.VerticalSize = 3;
  488. TChart1.Series(0).asPoint.Pointer.HorizontalSize = 3;
  489. TChart1.Series(0).Marks.visible = false;
  490. TChart1.Series(0).Marks.Style = 0;
  491. TChart1.Series(0).Marks.ArrowLength = 10;
  492. TChart1.Series(0).Marks.Arrow.Style = 0;
  493. TChart1.Series(0).Marks.Arrow.Color = 0x147814;
  494. if(graph == "1"){
  495. TChart1.Series(1).asPoint.Pointer.Visible = true;
  496. TChart1.Series(1).asPoint.Pointer.Style = 1;
  497. TChart1.Series(1).asPoint.Pointer.VerticalSize = 3;
  498. TChart1.Series(1).asPoint.Pointer.HorizontalSize = 3;
  499. TChart1.Series(1).Marks.visible = false;
  500. TChart1.Series(1).Marks.Style = 0;
  501. TChart1.Series(1).Marks.ArrowLength = 10;
  502. TChart1.Series(1).Marks.Arrow.Style = 0;
  503. TChart1.Series(1).Marks.Arrow.Color = 0x00ff00;
  504. }
  505. else if(graph == "2"){
  506. TChart1.Series(1).asPoint.Pointer.Visible = true;
  507. TChart1.Series(1).asPoint.Pointer.Style = 1;
  508. TChart1.Series(1).asPoint.Pointer.VerticalSize = 3;
  509. TChart1.Series(1).asPoint.Pointer.HorizontalSize = 3;
  510. TChart1.Series(1).Marks.visible = false;
  511. TChart1.Series(1).Marks.Style = 0;
  512. TChart1.Series(1).Marks.ArrowLength = 10;
  513. TChart1.Series(1).Marks.Arrow.Style = 0;
  514. TChart1.Series(1).Marks.Arrow.Color = 0x00ff00;
  515. TChart1.Series(2).asPoint.Pointer.Visible = true;
  516. TChart1.Series(2).asPoint.Pointer.Style = 10;
  517. TChart1.Series(2).asPoint.Pointer.VerticalSize = 5;
  518. TChart1.Series(2).asPoint.Pointer.HorizontalSize = 5;
  519. TChart1.Series(2).Marks.visible = false;
  520. TChart1.Series(2).Marks.Style = 0;
  521. TChart1.Series(2).Marks.ArrowLength = -40;
  522. TChart1.Series(2).Marks.Arrow.Style = 0;
  523. TChart1.Series(2).Marks.Arrow.Color = 0xff0000;
  524. TChart1.Series(3).asPoint.Pointer.Visible = true;
  525. TChart1.Series(3).asPoint.Pointer.Style = 10;
  526. TChart1.Series(3).asPoint.Pointer.VerticalSize = 5;
  527. TChart1.Series(3).asPoint.Pointer.HorizontalSize = 5;
  528. TChart1.Series(3).Marks.visible = false;
  529. TChart1.Series(3).Marks.Style = 0;
  530. TChart1.Series(3).Marks.ArrowLength = 40;
  531. TChart1.Series(3).Marks.Arrow.Style = 0;
  532. TChart1.Series(3).Marks.Arrow.Color = 0xff0000;
  533. TChart1.Series(4).asPoint.Pointer.Visible = true;
  534. TChart1.Series(4).asPoint.Pointer.Style = 10;
  535. TChart1.Series(4).asPoint.Pointer.VerticalSize = 5;
  536. TChart1.Series(4).asPoint.Pointer.HorizontalSize = 5;
  537. TChart1.Series(4).Marks.visible = false;
  538. TChart1.Series(4).Marks.Style = 0;
  539. TChart1.Series(4).Marks.ArrowLength = 20;
  540. TChart1.Series(4).Marks.Arrow.Style = 0;
  541. TChart1.Series(4).Marks.Arrow.Color = 0xff0000;
  542. }
  543. //var imgCd = "D:\\CMCOracle\\application\\webapps\\emr\\formmngtweb\\images\\filemenu_bg.jpg";
  544. switch(graph){
  545. case "1":
  546. if(sex == "M"){
  547. var imgCd = getTChartBackgroundImage("boyheight1");
  548. }
  549. else{
  550. var imgCd = getTChartBackgroundImage("girlheight1");
  551. }
  552. break;
  553. case "2":
  554. if(sex == "M"){
  555. var imgCd = getTChartBackgroundImage("boyheight2");
  556. }
  557. else{
  558. var imgCd = getTChartBackgroundImage("girlheight2");
  559. }
  560. break;
  561. case "3":
  562. if(sex == "M"){
  563. var imgCd = getTChartBackgroundImage("boybmi");
  564. }
  565. else{
  566. var imgCd = getTChartBackgroundImage("girlbmi");
  567. }
  568. break;
  569. case "4":
  570. if(sex == "M"){
  571. var imgCd = getTChartBackgroundImage("boyhead1");
  572. }
  573. else{
  574. var imgCd = getTChartBackgroundImage("girlhead1");
  575. }
  576. break;
  577. case "5":
  578. if(sex == "M"){
  579. var imgCd = getTChartBackgroundImage("boyhead2");
  580. }
  581. else{
  582. var imgCd = getTChartBackgroundImage("girlhead2");
  583. }
  584. break;
  585. case "6":
  586. if(sex == "M"){
  587. var imgCd = getTChartBackgroundImage("boychst");
  588. }
  589. else{
  590. var imgCd = getTChartBackgroundImage("girlchst");
  591. }
  592. break;
  593. }
  594. //setBackImageLoad(TChart1, imgCd);
  595. TChart1.Panel.BackImageLoad(imgCd);
  596. //TChart1.Export.SaveToBitmapFile(getTChartBackgroundImage("boyheight1"));
  597. var x,y1,y2, y3, y4, y5, y6, temp;
  598. // 부모님신장 표시
  599. if(graph == "2"){
  600. model.refresh();
  601. var mh = model.getValue("/root/send/mht");
  602. var fh = model.getValue("/root/send/fht");
  603. var mph = model.getValue("/root/send/mpht");
  604. if(sex == "M"){
  605. mh = parseInt(parseFloat(mh) + 13);
  606. }
  607. else if(sex == "F"){
  608. fh = parseInt(parseFloat(fh) - 13);
  609. }
  610. if(mh != ""){
  611. TChart1.Series(2).AddXY (18, mh, "", TChart1.Series(2).Color);
  612. }
  613. if(fh != ""){
  614. TChart1.Series(3).AddXY (18, fh, "", TChart1.Series(3).Color);
  615. }
  616. if(mph != ""){
  617. TChart1.Series(4).AddXY (18, mph, "", TChart1.Series(4).Color);
  618. TChart1.Tools.Add(10);
  619. TChart1.Tools.Items(0).asAnnotation.Text = mph;
  620. TChart1.Tools.Items(0).asAnnotation.Shape.Top = 953-5*mph;
  621. TChart1.Tools.Items(0).asAnnotation.Shape.Left = 517;
  622. var textRow = 1;
  623. }else if(mph == ""){
  624. var textRow = 0;
  625. }
  626. }
  627. var nodeCnt = getNodesetCount("/root/main/grthlist/list/grth");
  628. for( i = 2; i <= nodeCnt+1; i++){
  629. if(graph == "1"){
  630. x = grd_grth.valueMatrix(i, grd_grth.colRef("month")); //월령
  631. y1 = grd_grth.valueMatrix(i, grd_grth.colRef("bdht")); // 신장
  632. y2 = grd_grth.valueMatrix(i, grd_grth.colRef("bdwt")); // 체중
  633. if(x == 0){
  634. x = 0.3
  635. }
  636. if(x != "" && y1 != ""){
  637. if(i==2){
  638. var f1=getDateInterval(model.getValue("/root/send/orgbrthdd"),grd_grth.valueMatrix(i, grd_grth.colRef("recdd")), "dd");
  639. TChart1.Series(0).AddXY (parseFloat(f1/(365*3)*36), y1, "", TChart1.Series(0).Color);
  640. }else{
  641. var f1=getDateInterval(model.getValue("/root/send/orgbrthdd"),grd_grth.valueMatrix(i, grd_grth.colRef("recdd")), "dd");
  642. TChart1.Series(0).AddXY (parseFloat(f1/(365*3)*36), y1, "", TChart1.Series(0).Color);
  643. }
  644. }
  645. if(x != "" && y2 != ""){
  646. if(i==2){
  647. var f2=getDateInterval(model.getValue("/root/send/orgbrthdd"),grd_grth.valueMatrix(i, grd_grth.colRef("recdd")), "dd");
  648. TChart1.Series(1).AddXY (parseFloat(f2/(365*3)*36), y2, "", TChart1.Series(1).Color);
  649. }else{
  650. var f2=getDateInterval(model.getValue("/root/send/orgbrthdd"),grd_grth.valueMatrix(i, grd_grth.colRef("recdd")), "dd");
  651. TChart1.Series(1).AddXY (parseFloat(f2/(365*3)*36), y2, "", TChart1.Series(1).Color);
  652. }
  653. }
  654. }
  655. else if(graph == "2"){
  656. x = grd_grth.valueMatrix(i, grd_grth.colRef("year")); // 연령
  657. temp = grd_grth.valueMatrix(i, grd_grth.colRef("month")); // 월령
  658. temp = parseInt((temp % 12)/12*10);
  659. x = x+"."+temp;
  660. y1 = grd_grth.valueMatrix(i, grd_grth.colRef("bdht")); // 신장
  661. y2 = grd_grth.valueMatrix(i, grd_grth.colRef("bdwt")); // 체중
  662. var text = grd_grth.valueMatrix(i, grd_grth.colRef("remark")); // 비고
  663. if(x != "" && y1 != ""){
  664. var s1=getDateInterval(model.getValue("/root/send/orgbrthdd"),grd_grth.valueMatrix(i, grd_grth.colRef("recdd")), "dd");
  665. TChart1.Series(0).AddXY (parseFloat(s1/(18*365)*18), y1, "", TChart1.Series(0).Color);
  666. }
  667. if(x != "" && y2 != ""){
  668. var s2=getDateInterval(model.getValue("/root/send/orgbrthdd"),grd_grth.valueMatrix(i, grd_grth.colRef("recdd")), "dd");
  669. TChart1.Series(1).AddXY (parseFloat(s2/(18*365)*18), y2, "", TChart1.Series(1).Color);
  670. }
  671. if(text != "" && x>=2){
  672. TChart1.Tools.Add(10);
  673. TChart1.Tools.Items(textRow).asAnnotation.Text = text;
  674. TChart1.Tools.Items(textRow).asAnnotation.Shape.Top = 900-y1*4;
  675. TChart1.Tools.Items(textRow).asAnnotation.Shape.Left = x*29.2 -30;
  676. textRow++;
  677. }
  678. }
  679. //20110804
  680. if(graph == "3"){
  681. x = grd_grth.valueMatrix(i, grd_grth.colRef("year")); //연령
  682. temp = grd_grth.valueMatrix(i, grd_grth.colRef("month")); // 월령
  683. temp = parseInt((temp % 12)/12*10);
  684. x = x+"."+temp;
  685. y3 = grd_grth.valueMatrix(i, grd_grth.colRef("bmi")); // 체질량
  686. var f3=getDateInterval(model.getValue("/root/send/orgbrthdd"),grd_grth.valueMatrix(i, grd_grth.colRef("recdd")), "dd");
  687. if(x != "" && y3 != ""){
  688. TChart1.Series(0).AddXY (parseFloat(f3/(18*365)*18), y3, "", TChart1.Series(0).Color);
  689. }
  690. }
  691. //20110804
  692. if(graph == "4"){
  693. x = grd_grth.valueMatrix(i, grd_grth.colRef("month")); //월령
  694. y4 = grd_grth.valueMatrix(i, grd_grth.colRef("headgirth")); // 머리둘레(0-36)
  695. var f4=getDateInterval(model.getValue("/root/send/orgbrthdd"),grd_grth.valueMatrix(i, grd_grth.colRef("recdd")), "dd");
  696. if(x != "" && y4 != ""){
  697. TChart1.Series(0).AddXY (parseFloat(f4/(365*3)*36), y4, "", TChart1.Series(0).Color);
  698. }
  699. }
  700. if(graph == "5"){
  701. x = grd_grth.valueMatrix(i, grd_grth.colRef("year")); //연령
  702. temp = grd_grth.valueMatrix(i, grd_grth.colRef("month")); // 월령
  703. temp = parseInt((temp % 12)/12*10);
  704. x = x+"."+temp;
  705. y5 = grd_grth.valueMatrix(i, grd_grth.colRef("headgirth")); // 머리둘레()
  706. if(x != "" && y5 != ""){
  707. TChart1.Series(0).AddXY (x, y5, "", TChart1.Series(0).Color);
  708. }
  709. }
  710. if(graph == "6"){
  711. x = grd_grth.valueMatrix(i, grd_grth.colRef("year")); //연령
  712. temp = grd_grth.valueMatrix(i, grd_grth.colRef("month")); // 월령
  713. temp = parseInt((temp % 12)/12*10);
  714. x = x+"."+temp;
  715. y6 = grd_grth.valueMatrix(i, grd_grth.colRef("chstgirth")); // 흉부둘레
  716. if(x != "" && y6 != ""){
  717. TChart1.Series(0).AddXY (x, y6, "", TChart1.Series(0).Color);
  718. }
  719. }
  720. }
  721. //TChart1.Export.SaveToBitmapFile(getTChartBackgroundImage("boyheight2"));
  722. }
  723. function fCalcAge(){
  724. var orgdd = model.getValue("/root/send/orgbrthdd");
  725. var maskDate = orgdd.substr(0, 4) + "-" + orgdd.substr(4, 2) + "-" + orgdd.substr(6, 2);
  726. model.setValue("/root/send/maskbrth", maskDate);
  727. var schedd = model.getValue("/root/send/brthschedd");
  728. var diff = getDateInterval(orgdd, getCurrentDate());
  729. var diffSche = getDateInterval(getCurrentDate(), schedd);
  730. diffSche = 280 - parseInt(diffSche);
  731. var year = parseInt(parseInt(diff) / 365);
  732. var month = parseInt(diff) % 365;
  733. var week = parseInt(parseInt(diffSche) / 7);
  734. var day = parseInt(diffSche) % 7;
  735. if(month > 334){
  736. month = 11;
  737. }
  738. else if(month > 304){
  739. month = 10;
  740. }
  741. else if(month > 273){
  742. month = 9;
  743. }
  744. else if(month > 243){
  745. month = 8;
  746. }
  747. else if(month > 212){
  748. month = 7;
  749. }
  750. else if(month > 181){
  751. month = 6;
  752. }
  753. else if(month > 151){
  754. month = 5;
  755. }
  756. else if(month > 120){
  757. month = 4;
  758. }
  759. else if(month > 90){
  760. month = 3;
  761. }
  762. else if(month > 59){
  763. month = 2;
  764. }
  765. else if(month > 31){
  766. month = 1;
  767. }
  768. else{
  769. month=0;
  770. }
  771. if(orgdd != ""){
  772. model.setValue("/root/main/cond/year", year);
  773. model.setValue("/root/main/cond/month", month);
  774. if(year>0){
  775. var age = year+"년 "+month+"개월";
  776. }else{
  777. var age = month+"개월";
  778. }
  779. model.setValue("/root/send/age", age);
  780. }
  781. if(schedd != ""){
  782. model.setValue("/root/main/cond/week", week);
  783. model.setValue("/root/main/cond/day", day);
  784. }
  785. model.refresh();
  786. var year = model.getValue("/root/main/cond/year");
  787. var month = model.getValue("/root/main/cond/month");
  788. var saveflag = "";
  789. saveflag = model.getValue("/root/send/saveflag");
  790. if(saveflag == ""){
  791. // 24개월 이상 이면 2~18세 그래프 선택
  792. if((year >= 2 && month >=1) || year >2){
  793. model.setValue("/root/main/cond/chart", "2");
  794. model.setValue("/root/send/saveflag", "2");
  795. button1.selected = true;
  796. }
  797. else{
  798. model.setValue("/root/main/cond/chart", "1");
  799. model.setValue("/root/send/saveflag", "1");
  800. button2.selected = true;
  801. }
  802. }
  803. else{
  804. var result = saveflag.indexOf("1");
  805. var rslt = saveflag.indexOf("2");
  806. if(result != "-1"){
  807. model.setValue("/root/main/cond/chart", "1");
  808. button2.selected = true;
  809. }
  810. if(rslt != "-1"){
  811. model.setValue("/root/main/cond/chart", "2");
  812. button1.selected = true;
  813. }
  814. }
  815. model.refresh();
  816. }
  817. function fSelectGraph(){
  818. model.removeNodeset("/root/init/orddd");
  819. submit("TRMRF05201");
  820. var rowcnt = "";
  821. var nodeCnt = getNodesetCount("/root/init/orddd");
  822. if(nodeCnt > 0){
  823. for( i = 1; i <= nodeCnt+1; i++ ){
  824. var ordtype = model.getValue("/root/init/orddd["+i+"]/dschdd");
  825. var dschdd = model.getValue("/root/init/orddd["+i+"]/dschdd");
  826. if( dschdd == "재원중"){
  827. rowcnt = model.getValue("/root/init/orddd["+i+"]/rowcnt");
  828. }
  829. }
  830. if(rowcnt != ""){
  831. model.setValue("/root/send/ordd", rowcnt);
  832. model.setValue("/root/send/orddd", model.getValue("/root/init/orddd["+rowcnt+"]/orddd"));
  833. model.setValue("/root/send/cretno", model.getValue("/root/init/orddd["+rowcnt+"]/cretno"));
  834. model.setValue("/root/send/orddrid", model.getValue("/root/init/orddd["+rowcnt+"]/orddrid"));
  835. model.setValue("/root/send/signgenrflag", model.getValue("/root/init/orddd["+rowcnt+"]/ordtype"));
  836. }
  837. else if(rowcnt == "") {
  838. //combo2.select(0);
  839. }
  840. }
  841. var dept = model.getValue("/root/send/orddeptcd");
  842. if(dept == "2110000000" || dept == "2030000000" || dept == "2070000000"){
  843. model.toggle("case_grth");
  844. model.toggle("case1");
  845. btn_gr.selected = true;
  846. btn_gr.visible = true;
  847. btn_lb.visible = false;
  848. btn_ht.visible = false;
  849. btn_rec.visible = false;
  850. var graph = model.getValue("/root/main/cond/chart");
  851. switch(graph){
  852. case "1":
  853. button2.selected=true;
  854. break;
  855. case "2":
  856. button1.selected=true;
  857. break;
  858. case "3":
  859. button3.selected=true;
  860. break;
  861. case "4":
  862. button4.selected=true;
  863. break;
  864. case "5":
  865. button12.selected=true;
  866. break;
  867. case "6":
  868. button6.selected=true;
  869. break;
  870. }
  871. fMakeChart();
  872. model.setValue("/root/send/flag", "1");
  873. group2.visible = true;
  874. group3.visible = false;
  875. }
  876. else if(dept == "2100000000"){
  877. model.toggle("case_labor");
  878. model.toggle("case2");
  879. btn_lb.selected = true;
  880. btn_gr.visible = false;
  881. btn_lb.visible = true;
  882. btn_ht.visible = false;
  883. btn_rec.visible = false;
  884. button14.selected = true;
  885. model.setValue("/root/labor/send/flag", "2");
  886. group2.visible = false;
  887. group3.visible = true;
  888. }
  889. else if(dept == "2120000000"){
  890. model.toggle("case_hue");
  891. model.toggle("case3");
  892. btn_ht.selected = true;
  893. btn_gr.visible = false;
  894. btn_lb.visible = false;
  895. btn_ht.visible = true;
  896. btn_rec.visible = false;
  897. model.setValue("/root/send/flag", "3");
  898. group2.visible = false;
  899. }
  900. model.refresh();
  901. }
  902. function fGetGrphData(){
  903. submit("TRMRF05202");
  904. model.copyNode("/root/main/sign", "/root/main/grthlist/list");
  905. model.removeNodeset("/root/main/grthlist/list/sign");
  906. var mh = model.getValue("/root/main/grthlist/list/grth[1]/mht");
  907. var fh = model.getValue("/root/main/grthlist/list/grth[1]/fht");
  908. var mph = model.getValue("/root/main/grthlist/list/grth[1]/mpht");
  909. var orgbrth = model.getValue("/root/main/grthlist/list/grth[1]/orgbrthdd");
  910. var brthschedd = model.getValue("/root/main/grthlist/list/grth[1]/brthschedd");
  911. var saveflag = model.getValue("/root/main/grthlist/list/grth[1]/saveflag");
  912. var fstrgstrnm = model.getValue("/root/main/grthlist/list/grth[1]/fstrgstrnm");
  913. var lastupdtrnm = model.getValue("/root/main/grthlist/list/grth[1]/lastupdtrnm");
  914. var signSave = model.getValue("/root/main/grthlist/list/grth[1]/signyn");
  915. saveState = signSave;
  916. if(signSave == "Y"){
  917. output1.value = "현재는 인증저장 상태입니다";
  918. }else if(saveflag != ""){
  919. output1.value = "현재는 임시저장 상태입니다";
  920. }
  921. model.setValue("/root/send/mht", mh);
  922. model.setValue("/root/send/fht", fh);
  923. model.setValue("/root/send/mpht", mph);
  924. model.setValue("/root/send/fstrgstrnm", fstrgstrnm);
  925. model.setValue("/root/send/lastupdtrnm", lastupdtrnm);
  926. if(orgbrth != ""){
  927. model.setValue("/root/send/orgbrthdd", orgbrth);
  928. var maskDate = orgbrth.substr(0, 4) + "-" + orgbrth.substr(4, 2) + "-" + orgbrth.substr(6, 2);
  929. model.setValue("/root/send/maskbrth", maskDate);
  930. var diff = getDateInterval(orgbrth, getCurrentDate());
  931. var year = parseInt(parseInt(diff) / 365);
  932. var month = parseInt(diff) % 365;
  933. if(month > 334){
  934. month = 11;
  935. }
  936. else if(month > 304){
  937. month = 10;
  938. }
  939. else if(month > 273){
  940. month = 9;
  941. }
  942. else if(month > 243){
  943. month = 8;
  944. }
  945. else if(month > 212){
  946. month = 7;
  947. }
  948. else if(month > 181){
  949. month = 6;
  950. }
  951. else if(month > 151){
  952. month = 5;
  953. }
  954. else if(month > 120){
  955. month = 4;
  956. }
  957. else if(month > 90){
  958. month = 3;
  959. }
  960. else if(month > 59){
  961. month = 2;
  962. }
  963. else if(month > 31){
  964. month = 1;
  965. }
  966. else{
  967. month=0;
  968. }
  969. model.setValue("/root/main/cond/year", year);
  970. model.setValue("/root/main/cond/month", month);
  971. if(year>0){
  972. var age = year+"년 "+month+"개월";
  973. }else{
  974. var age = month+"개월";
  975. }
  976. model.setValue("/root/send/age", age);
  977. }
  978. if(brthschedd != ""){
  979. model.setValue("/root/send/brthschedd", brthschedd);
  980. }
  981. //if(saveflag != ""){
  982. model.setValue("/root/send/saveflag", saveflag);
  983. //}
  984. }
  985. function fSetPopupPat(){
  986. model.setValue("/root/send/pid", model.getValue("/root/main/patinfo/patinfolist/pid"));
  987. model.setValue("/root/main/cond/hngnm", model.getValue("/root/main/patinfo/patinfolist/hngnm"));
  988. var rrgstno1 = model.getValue("/root/main/patinfo/patinfolist/rrgstno1");
  989. var rrgstno2 = model.getValue("/root/main/patinfo/patinfolist/rrgstno2");
  990. rrgstno1 = rrgstno1 +"-"+ rrgstno2.substr(0, 1) +"******";
  991. model.setValue("/root/main/cond/rrgstno1", rrgstno1);
  992. model.setValue("/root/main/cond/sex", model.getValue("/root/main/patinfo/patinfolist/sex"));
  993. model.setValue("/root/send/orgbrthdd", model.getValue("/root/main/patinfo/patinfolist/brthdd"));
  994. //model.setValue("/root/send/orddeptcd", model.getValue("/root/main/patinfo/patinfolist/lastorddeptcd"));
  995. }
  996. function fSetPopGraph(){
  997. fSetPopupPat();
  998. saveCnt = "0";
  999. model.removeNodeset("/root/init/orddd");
  1000. submit("TRMRF05201");
  1001. var rowcnt = "", cnt="";
  1002. var nodeCnt = getNodesetCount("/root/init/orddd");
  1003. if(nodeCnt > 0){
  1004. for( i = 1; i <= nodeCnt+1; i++ ){
  1005. var ordtype = model.getValue("/root/init/orddd["+i+"]/dschdd");
  1006. var dschdd = model.getValue("/root/init/orddd["+i+"]/dschdd");
  1007. if( dschdd == "재원중"){
  1008. rowcnt = model.getValue("/root/init/orddd["+i+"]/rowcnt");
  1009. }
  1010. }
  1011. if(rowcnt != ""){
  1012. model.setValue("/root/send/ordd", rowcnt);
  1013. model.setValue("/root/send/orddd", model.getValue("/root/init/orddd["+rowcnt+"]/orddd"));
  1014. model.setValue("/root/send/cretno", model.getValue("/root/init/orddd["+rowcnt+"]/cretno"));
  1015. //model.setValue("/root/send/orddeptcd", model.getValue("/root/init/orddd["+rowcnt+"]/orddeptcd"));
  1016. model.setValue("/root/send/orddrid", model.getValue("/root/init/orddd["+rowcnt+"]/orddrid"));
  1017. model.setValue("/root/send/signgenrflag", model.getValue("/root/init/orddd["+rowcnt+"]/ordtype"));
  1018. }
  1019. else if(rowcnt == "") {
  1020. var lastdd = model.getValue("/root/main/patinfo/patinfolist/lastorddd")
  1021. var lastdept = model.getValue("/root/main/patinfo/patinfolist/lastorddeptcd")
  1022. var orddept = model.getValue("/root/send/orddeptcd")
  1023. for( i = 1; i <= nodeCnt+1; i++ ){
  1024. var torddd = model.getValue("/root/init/orddd["+i+"]/orddd");
  1025. if( torddd == lastdd && lastdept == orddept){
  1026. cnt = model.getValue("/root/init/orddd["+i+"]/rowcnt");
  1027. }
  1028. }
  1029. if( cnt != ""){
  1030. model.setValue("/root/send/ordd", cnt);
  1031. model.setValue("/root/send/orddd", model.getValue("/root/init/orddd["+cnt+"]/orddd"));
  1032. model.setValue("/root/send/cretno", model.getValue("/root/init/orddd["+cnt+"]/cretno"));
  1033. model.setValue("/root/send/orddrid", model.getValue("/root/init/orddd["+cnt+"]/orddrid"));
  1034. model.setValue("/root/send/signgenrflag", model.getValue("/root/init/orddd["+cnt+"]/ordtype"));
  1035. } else if ( cnt == ""){
  1036. combo2.select(0);
  1037. model.setValue("/root/send/ordd", 1);
  1038. model.setValue("/root/send/orddd", model.getValue("/root/init/orddd[1]/orddd"));
  1039. model.setValue("/root/send/cretno", model.getValue("/root/init/orddd[1]/cretno"));
  1040. model.setValue("/root/send/orddrid", model.getValue("/root/init/orddd[1]/orddrid"));
  1041. model.setValue("/root/send/signgenrflag", model.getValue("/root/init/orddd[1]/ordtype"));
  1042. }
  1043. }
  1044. }
  1045. model.refresh();
  1046. var tDept = model.getValue("/root/send/orddeptcd");
  1047. if(tDept == "2110000000" || tDept == "2030000000" || tDept == "2070000000"){
  1048. fGetGrphData();
  1049. fSelectGraph();
  1050. fCalcAge();
  1051. // 행추가
  1052. grd_grth.addRow();
  1053. var cur_row = grd_grth.row-1;
  1054. var curDate = getCurrentDate();
  1055. var maskDate = curDate.substr(0, 4) + "-" + curDate.substr(4, 2) + "-" + curDate.substr(6, 2);
  1056. model.setValue("/root/main/grthlist/list/grth["+cur_row+"]/recdd", maskDate);
  1057. model.setValue("/root/main/grthlist/list/grth["+cur_row+"]/seq", grd_grth.row-1);
  1058. fCalcGrid();
  1059. model.refresh();
  1060. fMakeChart();
  1061. } else if(tDept == "2100000000"){
  1062. fGetLaborData();
  1063. fMakeLaborGraph();
  1064. }
  1065. }
  1066. function fCalcGrid(){
  1067. var cur_row = grd_grth.row-1;
  1068. var recdd = model.getValue("/root/main/grthlist/list/grth["+cur_row+"]/recdd");
  1069. //recdd = curDate.substr(0, 4) + "-" + curDate.substr(4, 2) + "-" + recdd.substr(6, 2);
  1070. var ht = model.getValue("/root/main/grthlist/list/grth["+cur_row+"]/bdht");
  1071. var wt = model.getValue("/root/main/grthlist/list/grth["+cur_row+"]/bdwt");
  1072. var orgdd = model.getValue("/root/send/orgbrthdd");
  1073. var schedd = model.getValue("/root/send/brthschedd");
  1074. var diff = getDateInterval(orgdd, recdd);
  1075. var diffSche = getDateInterval(getCurrentDate(), schedd);
  1076. var year = parseInt(parseInt(diff) / 365);
  1077. var month = parseInt(diff) % 365;
  1078. var week = parseInt(parseInt(diffSche) / 7);
  1079. var day = parseInt(diffSche) % 7;
  1080. if(month > 334){
  1081. month = 11;
  1082. }
  1083. else if(month > 304){
  1084. month = 10;
  1085. }
  1086. else if(month > 273){
  1087. month = 9;
  1088. }
  1089. else if(month > 243){
  1090. month = 8;
  1091. }
  1092. else if(month > 212){
  1093. month = 7;
  1094. }
  1095. else if(month > 181){
  1096. month = 6;
  1097. }
  1098. else if(month > 151){
  1099. month = 5;
  1100. }
  1101. else if(month > 120){
  1102. month = 4;
  1103. }
  1104. else if(month > 90){
  1105. month = 3;
  1106. }
  1107. else if(month > 59){
  1108. month = 2;
  1109. }
  1110. else if(month > 31){
  1111. month = 1;
  1112. }
  1113. else{
  1114. month=0;
  1115. }
  1116. var temp = parseFloat(wt)/((parseFloat(ht)*(parseFloat(ht)*0.0001)));
  1117. var temp2 = Math.pow(( parseFloat(wt) * parseFloat(ht)) / 3600, 0.5 );
  1118. if(ht!="" && wt!=""){
  1119. model.setValue("/root/main/grthlist/list/grth["+cur_row+"]/bmi", parseFloat(temp).toFixed(2));
  1120. model.setValue("/root/main/grthlist/list/grth["+cur_row+"]/bsa", parseFloat(temp2).toFixed(2));
  1121. }
  1122. model.setValue("/root/main/grthlist/list/grth["+cur_row+"]/year", year);
  1123. model.setValue("/root/main/grthlist/list/grth["+cur_row+"]/month", parseInt(year)*12+parseInt(month));
  1124. if(year>0){
  1125. year = year+"년 "+month+"개월";
  1126. }else{
  1127. year = month+"개월";
  1128. }
  1129. model.setValue("/root/main/grthlist/list/grth["+cur_row+"]/yearmonth", year);
  1130. if(schedd != ""){
  1131. model.setValue("/root/main/grthlist/list/grth["+cur_row+"]/week", week);
  1132. var gatext = week + "주" + day + "일";
  1133. model.setValue("/root/main/grthlist/list/grth["+cur_row+"]/gatext", gatext);
  1134. }
  1135. model.refresh();
  1136. }
  1137. function fCalcMph(){
  1138. var mh = parseInt(model.getValue("/root/send/mht"));
  1139. var fh = parseInt(model.getValue("/root/send/fht"));
  1140. var sex = model.getValue("/root/main/cond/sex");
  1141. if(mh != mh || fh != fh){
  1142. }else{
  1143. if(sex == "M"){
  1144. model.setValue("/root/send/mpht", (mh+fh+13)/2);
  1145. }
  1146. if(sex == "F"){
  1147. model.setValue("/root/send/mpht", (mh+fh-13)/2);
  1148. }
  1149. }
  1150. model.refresh();
  1151. }
  1152. function getDateAddc(inputday,addend){
  1153. var backDate ="";
  1154. var rt = 0;
  1155. var yyyy = inputday.substring(0,4) +"";
  1156. var mm = inputday.substring(4,6) +"";
  1157. var dd = inputday.substring(6,8) +"";
  1158. var startDate = new Date(yyyy,(eval(mm)-1),dd);
  1159. startDate.setTime(startDate.getTime()+(86400000*addend));
  1160. NowYear = startDate.getYear();// 년
  1161. NowMonth = startDate.getMonth()+1;// 월
  1162. NowDay = startDate.getDate(); // 일
  1163. backDate += NowYear ; //년도
  1164. if (NowMonth < 10 ) backDate += "0" + NowMonth ;
  1165. else backDate += (startDate.getMonth() + 1);
  1166. if (NowDay < 10 ) backDate += "0" + NowDay ;
  1167. else backDate += (startDate.getDate());
  1168. return backDate ;
  1169. }
  1170. function fCalcGa(){
  1171. var edc = model.getValue("/root/labor/send/edc");
  1172. var admission = model.getValue("/root/labor/send/admission");
  1173. admission = admission.substr(0,4) + admission.substr(5,2) + admission.substr(8,2);
  1174. var index = combo2.value;
  1175. if(index != "" && edc != ""){
  1176. if(admission != ""){
  1177. var orddd = admission;
  1178. }else if(admission == ""){
  1179. var orddd = model.getValue("/root/init/orddd["+index+"]/orddd");
  1180. }
  1181. var tempGa = 280 - getDateInterval(orddd, edc);
  1182. var week = parseInt(tempGa / 7);
  1183. var day = tempGa % 7;
  1184. var ga = week + "+" + day;
  1185. if(week > 43){
  1186. model.setValue("/root/labor/send/ga", "");
  1187. }
  1188. else{
  1189. model.setValue("/root/labor/send/ga", ga);
  1190. }
  1191. }
  1192. model.refresh();
  1193. }
  1194. function fMakeLaborGraph(){
  1195. TChart2.ClearChart();
  1196. TChart2.RemoveAllSeries();
  1197. TChart2.Axis.RemoveAllCustom();
  1198. //margin 값 정하기
  1199. TChart2.Panel.MarginTop = 10;
  1200. TChart2.Panel.MarginLeft = 5;
  1201. TChart2.Panel.MarginRight = 5;
  1202. TChart2.Panel.MarginBottom = 10;
  1203. TChart2.Panel.Color = 0xffffff;
  1204. //하단축 칸 수 정하기와 눈금 없애기
  1205. TChart2.Axis.Bottom.SetMinMax (0, 15);
  1206. TChart2.Axis.Bottom.Increment = 1;
  1207. TChart2.Axis.Bottom.MinorTickCount = 0.5;
  1208. TChart2.Axis.Bottom.Title.Caption = "Time";
  1209. TChart2.Axis.Bottom.Title.Font.bold = true;
  1210. TChart2.Axis.Bottom.AxisPen.Color = 0x000000;
  1211. //TChart2.Axis.Bottom.GridPen.Color = 0x000000; //축 점선의 색 설정
  1212. TChart2.Axis.Bottom.Labels.Font.Color = 0xffffff; //하단 축 눈금 명칭 색
  1213. TChart2.Header.Visible = false;
  1214. //TChart2.Header.Text(0)="성장도표"; //헤더제목넣기
  1215. TChart2.Header.Font.Bold = true; //헤더 굵게
  1216. TChart2.Header.Font.Size = 5; //헤더 사이즈
  1217. TChart2.Aspect.View3D = 0; //2d 로 표현하기
  1218. //TChart2.Aspect.Chart3DPercent = 2;
  1219. TChart2.Zoom.enable = false; // zoom 사용하지 않기
  1220. TChart2.Scroll.Enable = false; // scroll 사용하지 않기
  1221. TChart2.Legend.Visible = false; // 그래프 참조 박스 띄우지 않기
  1222. TChart2.Environment.MouseWheelScroll = false;
  1223. //TChart2.Panel.Gradient.Visible = true; // 페널에 그라디언트 적용
  1224. var cus_axis1 = TChart2.Axis.AddCustom(false); // CxDilat
  1225. TChart2.Axis.Custom(0).Visible = true;
  1226. TChart2.Axis.Custom(0).AxisPen.Color = 0xff0000;
  1227. TChart2.Axis.Custom(0).Title.Visible = false;
  1228. TChart2.Axis.Custom(0).Title.Caption = "CxDilat"
  1229. TChart2.Axis.Custom(0).Title.Font.Size = 9;
  1230. TChart2.Axis.Custom(0).Title.Font.Bold = true;
  1231. TChart2.Axis.Custom(0).Title.Angle = 270;
  1232. TChart2.Axis.Custom(0).PositionPercent = 0;
  1233. TChart2.Axis.Custom(0).StartPosition = 0;
  1234. TChart2.Axis.Custom(0).EndPosition = 100;
  1235. TChart2.Axis.Custom(0).Automatic = false;
  1236. TChart2.Axis.Custom(0).Maximum = 10;
  1237. TChart2.Axis.Custom(0).Minimum = 0;
  1238. TChart2.Axis.Custom(0).Increment = 1;
  1239. var cus_axis2 = TChart2.Axis.AddCustom(false); // Station
  1240. TChart2.Axis.Custom(1).Visible = false;
  1241. TChart2.Axis.Custom(1).AxisPen.Color = 0x00ff00;
  1242. TChart2.Axis.Custom(1).Title.Visible = false
  1243. TChart2.Axis.Custom(1).Title.Caption = "Station";
  1244. TChart2.Axis.Custom(1).Title.Font.Size = 9;
  1245. //TChart2.Axis.Custom(1).Title.Font.Bold = true;
  1246. TChart2.Axis.Custom(1).Title.Angle = 270;
  1247. TChart2.Axis.Custom(1).PositionPercent = 100;
  1248. TChart2.Axis.Custom(1).Automatic = false;
  1249. TChart2.Axis.Custom(1).Maximum = 2.5;
  1250. TChart2.Axis.Custom(1).Minimum = -2.5;
  1251. TChart2.Axis.Custom(1).Increment = 1;
  1252. TChart2.AddSeries (0);
  1253. TChart2.AddSeries (0);
  1254. TChart2.Series(0).VerticalAxisCustom = cus_axis1;
  1255. TChart2.Series(1).VerticalAxisCustom = cus_axis2;
  1256. //라인의 굵기를 정해준다.
  1257. TChart2.Series(0).Color = 0xff0000;
  1258. TChart2.Series(1).Color = 0x00ff00;
  1259. TChart2.Series(0).asLine.Pointer.Visible = true;
  1260. TChart2.Series(0).asLine.Pointer.Style = 5;
  1261. TChart2.Series(0).asLine.Pointer.VerticalSize = 5;
  1262. TChart2.Series(0).asLine.Pointer.HorizontalSize = 5;
  1263. TChart2.Series(0).asLine.LinePen.width = 2;
  1264. TChart2.Series(0).Marks.visible = false;
  1265. TChart2.Series(1).asLine.Pointer.Visible = true;
  1266. TChart2.Series(1).asLine.Pointer.Style = 7;
  1267. TChart2.Series(1).asLine.Pointer.VerticalSize = 5;
  1268. TChart2.Series(1).asLine.Pointer.HorizontalSize = 5;
  1269. TChart2.Series(1).asLine.LinePen.width = 2;
  1270. TChart2.Series(1).Marks.visible = false;
  1271. var imgCd = getTChartBackgroundImage("labor");
  1272. TChart2.Panel.BackImageLoad(imgCd);
  1273. var laborNodeCnt = getNodesetCount("/root/main/laborlist/list/labor");
  1274. var x, y1, y2, stage;
  1275. var textRow = 0;
  1276. if(laborNodeCnt <= 15){
  1277. btn_labor1.visible = false;
  1278. btn_labor2.visible = false;
  1279. btn_labor3.visible = false;
  1280. btn_labor4.visible = false;
  1281. btn_labor5.visible = false;
  1282. } else if(laborNodeCnt > 15 && laborNodeCnt <= 30){
  1283. btn_labor1.visible = true;
  1284. btn_labor2.visible = true;
  1285. btn_labor3.visible = false;
  1286. btn_labor4.visible = false;
  1287. btn_labor5.visible = false;
  1288. } else if(laborNodeCnt > 30 && laborNodeCnt <= 45){
  1289. btn_labor1.visible = true;
  1290. btn_labor2.visible = true;
  1291. btn_labor3.visible = true;
  1292. btn_labor4.visible = false;
  1293. btn_labor5.visible = false;
  1294. } else if(laborNodeCnt > 45 && laborNodeCnt <= 60){
  1295. btn_labor1.visible = true;
  1296. btn_labor2.visible = true;
  1297. btn_labor3.visible = true;
  1298. btn_labor4.visible = true;
  1299. btn_labor5.visible = false;
  1300. } else if(laborNodeCnt > 60 && laborNodeCnt <= 75){
  1301. btn_labor1.visible = true;
  1302. btn_labor2.visible = true;
  1303. btn_labor3.visible = true;
  1304. btn_labor4.visible = true;
  1305. btn_labor5.visible = true;
  1306. }
  1307. var startRow = model.getValue("/root/labor/send/startRow");
  1308. var tempX = 2;
  1309. for( i = startRow; i <= parseInt(laborNodeCnt)+1; i++ ){
  1310. x = grd_labor.valueMatrix(i, 9);
  1311. y1 = grd_labor.valueMatrix(i, 3); // OS
  1312. y2 = grd_labor.valueMatrix(i, 6); // Station
  1313. stage = grd_labor.valueMatrix(i, 7); // Stage
  1314. var text = grd_labor.valueMatrix(i, 1); // time
  1315. if(y2 == 3){
  1316. y2 = 2.5;
  1317. }
  1318. if(y2 == -3){
  1319. y2 = -2.5;
  1320. }
  1321. if(y2 != 0){
  1322. y2 = -y2;
  1323. }
  1324. if(y1 != ""){
  1325. TChart2.Series(0).AddXY (tempX-1, y1, "", TChart2.Series(0).Color);
  1326. }
  1327. if(y2 != ""){
  1328. TChart2.Series(1).AddXY (tempX-1, y2, "", TChart2.Series(1).Color);
  1329. }
  1330. if(text != ""){
  1331. TChart2.Tools.Add(10);
  1332. TChart2.Tools.Items(textRow).asAnnotation.Text = text.substr(0,5);
  1333. TChart2.Tools.Items(textRow).asAnnotation.Shape.Transparent = true;
  1334. TChart2.Tools.Items(textRow).asAnnotation.Shape.Top = 330;
  1335. TChart2.Tools.Items(textRow).asAnnotation.Shape.Left = tempX*39.7-22;
  1336. textRow++;
  1337. }
  1338. if(stage != ""){
  1339. if(stage == "1" || stage == "2"){
  1340. TChart2.Tools.Add(10);
  1341. if(stage == "1"){
  1342. TChart2.Tools.Items(textRow).asAnnotation.Text = "1st start";
  1343. }
  1344. if(stage == "2"){
  1345. TChart2.Tools.Items(textRow).asAnnotation.Text = "2nd start";
  1346. }
  1347. //TChart2.Tools.Items(textRow).asAnnotation.Shape.Transparent = true;
  1348. TChart2.Tools.Items(textRow).asAnnotation.Shape.Top = 340 - y1*29;
  1349. TChart2.Tools.Items(textRow).asAnnotation.Shape.Left = tempX*39.7-22;
  1350. textRow++;
  1351. }
  1352. if(stage == "3" || stage == "4"){
  1353. TChart2.AddSeries (1);
  1354. TChart2.Series(2).VerticalAxisCustom = cus_axis1;
  1355. //TChart2.Series(2).asCandle.CandleStyle = 2;
  1356. TChart2.Series(2).asBar.BarWidth = 3;
  1357. var margin = TChart2.Series(2).asBar.BarMargin;
  1358. TChart2.Series(2).Marks.visible = false;
  1359. TChart2.Series(2).Color = 0x0000ff;
  1360. TChart2.Series(2).AddXY (tempX-1, 10, "", TChart2.Series(2).Color);
  1361. TChart2.Tools.Add(10);
  1362. if(stage == "3"){
  1363. TChart2.Tools.Items(textRow).asAnnotation.Text = "End";
  1364. }
  1365. if(stage == "4"){
  1366. TChart2.Tools.Items(textRow).asAnnotation.Text = "Delivery";
  1367. }
  1368. TChart2.Tools.Items(textRow).asAnnotation.Shape.Transparent = true;
  1369. TChart2.Tools.Items(textRow).asAnnotation.Shape.Top = 350;
  1370. TChart2.Tools.Items(textRow).asAnnotation.Shape.Left = tempX*39.7-17;
  1371. textRow++;
  1372. }
  1373. }
  1374. tempX++;
  1375. }
  1376. }
  1377. function fGetLaborData(){
  1378. if(combo2.value != ""){
  1379. var ordIndex = combo2.value;
  1380. var orddd = model.getValue("/root/init/orddd["+ordIndex+"]/orddd");
  1381. var cretno = model.getValue("/root/init/orddd["+ordIndex+"]/cretno");
  1382. var ordtype = model.getValue("/root/init/orddd["+ordIndex+"]/ordtype");
  1383. var pid = model.getValue("/root/send/pid");
  1384. }
  1385. model.setValue("/root/labor/send/orddd", orddd);
  1386. model.setValue("/root/labor/send/cretno", cretno);
  1387. model.setValue("/root/labor/send/signgenrflag", ordtype);
  1388. model.setValue("/root/labor/send/pid", pid);
  1389. submit("TRMRF05206");
  1390. model.copyNode("/root/main/laborsign", "/root/main/laborlist/list");
  1391. model.removeNodeset("/root/main/laborlist/list/sign");
  1392. var labrCnt = getNodesetCount("/root/main/laborlist/list/labor");
  1393. if(labrCnt == 0){
  1394. var parity = model.getValue("/root/main/laborlist/list/base/parity");
  1395. var nsd = model.getValue("/root/main/laborlist/list/base/nsd");
  1396. var cs = model.getValue("/root/main/laborlist/list/base/cs");
  1397. var edc = model.getValue("/root/main/laborlist/list/base/edc");
  1398. var admission = model.getValue("/root/main/laborlist/list/base/admission");
  1399. model.setValue("/root/labor/send/parity", parity);
  1400. model.setValue("/root/labor/send/nsd", nsd);
  1401. model.setValue("/root/labor/send/cs", cs);
  1402. model.setValue("/root/labor/send/edc", edc);
  1403. model.setValue("/root/labor/send/admission", admission);
  1404. }else{
  1405. var parity = model.getValue("/root/main/laborlist/list/labor[1]/parity");
  1406. var nsd = model.getValue("/root/main/laborlist/list/labor[1]/nsd");
  1407. var cs = model.getValue("/root/main/laborlist/list/labor[1]/cs");
  1408. var edc = model.getValue("/root/main/laborlist/list/labor[1]/edc");
  1409. var ga = model.getValue("/root/main/laborlist/list/labor[1]/ga");
  1410. var admission = model.getValue("/root/main/laborlist/list/labor[1]/admission");
  1411. var cc = model.getValue("/root/main/laborlist/list/labor[1]/cc");
  1412. var pain = model.getValue("/root/main/laborlist/list/labor[1]/pain");
  1413. var prom = model.getValue("/root/main/laborlist/list/labor[1]/prom");
  1414. var afl = model.getValue("/root/main/laborlist/list/labor[1]/afl");
  1415. var induction = model.getValue("/root/main/laborlist/list/labor[1]/induction");
  1416. var oc = model.getValue("/root/main/laborlist/list/labor[1]/oc");
  1417. var cd = model.getValue("/root/main/laborlist/list/labor[1]/cd");
  1418. var fststage = model.getValue("/root/main/laborlist/list/labor[1]/fststage");
  1419. var scndstage = model.getValue("/root/main/laborlist/list/labor[1]/scndstage");
  1420. var total = model.getValue("/root/main/laborlist/list/labor[1]/total");
  1421. var delivery = model.getValue("/root/main/laborlist/list/labor[1]/delivery");
  1422. var other = model.getValue("/root/main/laborlist/list/labor[1]/other");
  1423. var fstrgstrnm = model.getValue("/root/main/laborlist/list/labor[1]/fstrgstrnm");
  1424. var lastupdtrnm = model.getValue("/root/main/laborlist/list/labor[1]/lastupdtrnm");
  1425. var signSave = model.getValue("/root/main/laborlist/list/labor[1]/signyn");
  1426. saveState = signSave;
  1427. if(signSave == "Y"){
  1428. output2.value = "현재는 인증저장 상태입니다";
  1429. }else if(fstrgstrnm != ""){
  1430. output2.value = "현재는 임시저장 상태입니다";
  1431. }
  1432. model.setValue("/root/labor/send/parity", parity);
  1433. model.setValue("/root/labor/send/nsd", nsd);
  1434. model.setValue("/root/labor/send/cs", cs);
  1435. model.setValue("/root/labor/send/edc", edc);
  1436. model.setValue("/root/labor/send/ga", ga);
  1437. model.setValue("/root/labor/send/admission", admission);
  1438. model.setValue("/root/labor/send/cc", cc);
  1439. model.setValue("/root/labor/send/pain", pain);
  1440. model.setValue("/root/labor/send/prom", prom);
  1441. model.setValue("/root/labor/send/afl", afl);
  1442. model.setValue("/root/labor/send/induction", induction);
  1443. model.setValue("/root/labor/send/oc", oc);
  1444. model.setValue("/root/labor/send/cd", cd);
  1445. model.setValue("/root/labor/send/other", other);
  1446. model.setValue("/root/labor/send/fststage", fststage);
  1447. model.setValue("/root/labor/send/scndstage", scndstage);
  1448. model.setValue("/root/labor/send/total", total);
  1449. model.setValue("/root/labor/send/delivery", delivery);
  1450. model.setValue("/root/labor/send/fstrgstrnm", fstrgstrnm);
  1451. model.setValue("/root/labor/send/lastupdtrnm", lastupdtrnm);
  1452. }
  1453. fCalcGa();
  1454. model.refresh();
  1455. }
  1456. function fSentence(){
  1457. setParameter("comn_chosflag", "C") // C : 상용구
  1458. setParameter("comn_formprogflag", "B") // A: Summary, B : 주호소
  1459. setParameter("openmode", "select");
  1460. modal("SPMRF04900");
  1461. var rtn = getParameter("comncnts"); //내용
  1462. setParameter("comncnts", "");
  1463. var mouseRow = grd_labor.mouseRow;
  1464. model.setValue("/root/main/laborlist/list/labor["+(mouseRow-1)+"]/remark", rtn);
  1465. model.refresh();
  1466. }
  1467. function fLaborAddRow(){
  1468. grd_labor.addRow();
  1469. var cur_row = grd_labor.row-1;
  1470. var chkCC = model.getValue("/root/labor/send/cc");
  1471. var rslt = chkCC.indexOf("2");
  1472. // Membrane 값 - 첫째줄이면 C/C 의 PROM 체크여부에 따라 둘째줄부터는 윗줄 값을 선택
  1473. if(cur_row == "1"){
  1474. if(rslt == "-1"){
  1475. model.setValue("/root/main/laborlist/list/labor["+cur_row+"]/memb", "+");
  1476. }else{
  1477. model.setValue("/root/main/laborlist/list/labor["+cur_row+"]/memb", "-");
  1478. }
  1479. }else {
  1480. model.setValue("/root/main/laborlist/list/labor["+cur_row+"]/memb", model.getValue("/root/main/laborlist/list/labor["+(cur_row-1)+"]/memb"));
  1481. }
  1482. var curDate = getCurrentDate();
  1483. var curTime = getCurrentTime();
  1484. var maskDate = curDate.substr(0, 4) + "-" + curDate.substr(4, 2) + "-" + curDate.substr(6, 2);
  1485. var maskTime = curTime.substr(0, 2) + ":" + curTime.substr(2, 4);
  1486. model.setValue("/root/main/laborlist/list/labor["+cur_row+"]/recdd", maskDate);
  1487. model.setValue("/root/main/laborlist/list/labor["+cur_row+"]/rectm", maskTime);
  1488. model.setValue("/root/main/laborlist/list/labor["+cur_row+"]/seq", grd_labor.row-1);
  1489. model.setValue("/root/main/laborlist/list/labor["+cur_row+"]/position", model.getValue("/root/main/laborlist/list/labor["+(cur_row-1)+"]/position"));
  1490. model.refresh();
  1491. }
  1492. function fTempMessage(){
  1493. /*
  1494. body.createChild("xforms:iviewer", "id:ivr_progress; src:../../../com/commonweb/xrw/SPZZZ00400_로딩중화면.xrw; left:435px; top:339px; width:330px; height:120px;");
  1495. var ivrObjt = document.all("ivr_progress");
  1496. var msg = "임시저장하셨네요ㅎㅎㅎ";
  1497. ivrObjt.model.setValue("/root/main/msg", msg);
  1498. ivrObjt.model.refresh();
  1499. event.preventDefault();
  1500. delayTime = window.setInterval("window.close()", 3000); */
  1501. if(saveState == "Y"){
  1502. }else if(saveCnt > 0){
  1503. var closeYn = messageBox("임시저장 상태입니다. 종료", "S003", "인증저장");
  1504. if(closeYn == 6){
  1505. }else if(closeYn == 7){
  1506. var selectedDept = model.getValue("/root/send/orddeptcd");
  1507. if(selectedDept == "2110000000" || selectedDept == "2030000000" || selectedDept == "2070000000"){
  1508. fGrthSignSave();
  1509. }else if(selectedDept == "2100000000"){
  1510. fLaborSignSave();
  1511. }
  1512. }else{
  1513. event.preventDefault();
  1514. }
  1515. }
  1516. }
  1517. function fGrthSignSave(){
  1518. saveCnt = parseInt(saveCnt) + 1;
  1519. // 인증저장 데이터 인스턴스 정리
  1520. var ordIndex = combo2.value;
  1521. var tempOrddd = model.getValue("/root/init/orddd["+ordIndex+"]/orddd");
  1522. var cretno = model.getValue("/root/init/orddd["+ordIndex+"]/cretno");
  1523. var ordtype = model.getValue("/root/init/orddd["+ordIndex+"]/ordtype");
  1524. model.setValue("/root/send/orddd", tempOrddd);
  1525. model.setValue("/root/send/cretno", cretno);
  1526. model.setValue("/root/send/signgenrflag", ordtype);
  1527. model.setValue("/root/send/deptnm", combo1.label); // 진료과 인증데이터 넘김
  1528. var tOrddd = model.getValue("/root/send/orddd");
  1529. var maskord = tOrddd.substr(0, 4) + "-" + tOrddd.substr(4, 2) + "-" + tOrddd.substr(6, 2);
  1530. model.setValue("/root/send/orddate", maskord); // 진료일자 인증데이터 넘김
  1531. var tempY = model.getValue("/root/main/cond/year");
  1532. var tempM = model.getValue("/root/main/cond/month");
  1533. var tempMonth = parseInt(tempY)*12 + parseInt(tempM);
  1534. tempMonth = tempMonth + "개월";
  1535. model.setValue("/root/send/age2", tempMonth);
  1536. var fstnm = model.getValue("/root/send/fstrgstrnm");
  1537. if(fstnm == ""){
  1538. model.setValue("/root/send/fstrgstrnm", getUserInfo("usernm"));
  1539. }
  1540. model.setValue("/root/send/lastupdtrnm", getUserInfo("usernm"));
  1541. var wrtedd = getCurrentDate();
  1542. var wrtetm = getCurrentTime();
  1543. model.setValue("/root/send/wrtedd", wrtedd);
  1544. model.setValue("/root/send/wrtetm", wrtetm);
  1545. model.setValue("/root/send/recdd", wrtedd);
  1546. model.setValue("/root/send/rectm", wrtetm);
  1547. var ht="", wt="", hd="", chst="";
  1548. for (i=grd_grth.fixedRows; i<grd_grth.rows; i++)
  1549. {
  1550. grd_grth.valueMatrix(i, grd_grth.colRef("seq")) = i;
  1551. ht = grd_grth.valueMatrix(i, grd_grth.colRef("bdht")); // 신장
  1552. wt = grd_grth.valueMatrix(i, grd_grth.colRef("bdwt")); // 체중
  1553. hd = grd_grth.valueMatrix(i, grd_grth.colRef("headgirth")); // 머리둘레
  1554. chst = grd_grth.valueMatrix(i, grd_grth.colRef("chstgirth")); // 흉부둘레
  1555. bt = grd_grth.valueMatrix(i, grd_grth.colRef("bt"));
  1556. sbp = grd_grth.valueMatrix(i, grd_grth.colRef("sbp"));
  1557. dbp = grd_grth.valueMatrix(i, grd_grth.colRef("dbp"));
  1558. pr = grd_grth.valueMatrix(i, grd_grth.colRef("pr"));
  1559. if(ht=="" && wt=="" && hd=="" && chst=="" && bt=="" && sbp=="" && dbp=="" && pr=="" ){
  1560. grd_grth.deleteitem(i);
  1561. grd_grth.rowStatus(i) = 4;
  1562. }else{
  1563. grd_grth.rowStatus(i) = 1;
  1564. }
  1565. }
  1566. //model.setValue("/root/send/cond",grd_grth.getUpdateData());
  1567. var csvStr = grd_grth.getUpdateData("insert");
  1568. setCSVToNode("/root/send/grid", csvStr, "list");
  1569. sortNodeList("/root/send/grid/list", "recdd", "asc"); // 그리드 인스턴스 정렬
  1570. var signrecinfo = model.instances(0).selectSingleNode("/root/send").xml;
  1571. //var signrecinfo = "test";
  1572. model.removeNodeset("/root/send/cond");
  1573. model.makeValue("/root/send/cond",csvStr);
  1574. model.removeNodeset("/root/send/grid");
  1575. model.makeNode("/root/send/grid");
  1576. var savef = model.getValue("/root/send/saveflag");
  1577. if( savef.length != 10){
  1578. var len = savef.length/2 +1.5;
  1579. var formcd = "0000001766 0000001651 0000003157 0000001448 0000003174 0000002722";
  1580. for(var i=1; i<len; i++){
  1581. var form = savef.substr(2*i-2, 1);
  1582. model.setValue("/root/main/cond/chart", form); //그래프 설정
  1583. var code = formcd.substr(11*form-11, 10);
  1584. model.setValue("/root/send/formcd"+i, code); //서식코드 설정
  1585. var nodeCnt = getNodesetCount("/root/main/sign/sign");
  1586. var signno = "";
  1587. var odd = model.getValue("/root/send/orddd");
  1588. for(var j = 1; j <= nodeCnt; j++ ){
  1589. var vFormcd = model.getValue("/root/main/sign/sign["+j+"]/formcd");
  1590. var signOrddd = model.getValue("/root/main/sign/sign["+j+"]/orddd");
  1591. if( vFormcd == code && signOrddd == odd){
  1592. signno = model.getValue("/root/main/sign/sign["+j+"]/signno");
  1593. }
  1594. }
  1595. if(signno != ""){
  1596. model.makeValue("/root/send/signno"+i, signno);
  1597. //model.setValue("/root/send/recsaveflag", "Y");
  1598. }else{
  1599. model.makeValue("/root/send/signno"+i, "0");
  1600. //model.setValue("/root/send/recsaveflag", "N");
  1601. }
  1602. fMakeChart();
  1603. //TChart1.Export.SaveToJPEGFile("C:\\dell\\test.jpeg", false, 0, 70, 560, 696);
  1604. //그래프 이미지 특정 폴더에 저장
  1605. var fso, fldr;
  1606. fladr = "C:/Program Files/himed/grthimage";
  1607. fso = new ActiveXObject("Scripting.FileSystemObject");
  1608. if (fso.FolderExists(fladr)) {
  1609. TChart1.Export.SaveToJPEGFile(fladr+"/tchart.jpeg", false, 0, 100, 560, 696 );
  1610. } else {
  1611. fldr = fso.CreateFolder(fladr);
  1612. TChart1.Export.SaveToJPEGFile(fladr+"/tchart.jpeg", false, 0, 100, 560, 696 );
  1613. }
  1614. var file = fladr+"/tchart.jpeg";
  1615. //var f = fso.GetFile(file);
  1616. //fChangeImage(file);
  1617. var pos = file.lastIndexOf("\\");
  1618. var localFileName= file.substring(pos+1, file.length);
  1619. img_tmp.src = "";
  1620. img_tmp.src = file;
  1621. var ldata = img_tmp.getbase64data();
  1622. model.makeValue("/root/send/imgdata"+i, ldata);
  1623. }
  1624. } else{
  1625. fMakeChart();
  1626. //TChart1.Export.SaveToJPEGFile("C:\\dell\\test.jpeg", false, 0, 70, 560, 696);
  1627. //그래프 이미지 특정 폴더에 저장
  1628. var fso, fldr;
  1629. fladr = "C:/Program Files/himed/grthimage";
  1630. fso = new ActiveXObject("Scripting.FileSystemObject");
  1631. if (fso.FolderExists(fladr)) {
  1632. TChart1.Export.SaveToJPEGFile(fladr+"/tchart.jpeg", false, 0, 100, 560, 696 );
  1633. //sChartNum++;
  1634. } else {
  1635. fldr = fso.CreateFolder(fladr);
  1636. TChart1.Export.SaveToJPEGFile(fladr+"/tchart.jpeg", false, 0, 100, 560, 696 );
  1637. //sChartNum++;
  1638. }
  1639. var file = fladr+"/tchart.jpeg";
  1640. //var f = fso.GetFile(file);
  1641. //fChangeImage(file);
  1642. var pos = file.lastIndexOf("\\");
  1643. var localFileName= file.substring(pos+1, file.length);
  1644. img_tmp.src = "";
  1645. img_tmp.src = file;
  1646. var ldata = img_tmp.getbase64data();
  1647. model.setValue("/root/send/imgdata", ldata);
  1648. var nodeCnt = getNodesetCount("/root/main/sign/sign");
  1649. var signno = "";
  1650. var orddd = model.getValue("/root/send/orddd");
  1651. var code = model.getValue("root/send/formcd");
  1652. for( i = 1; i <= nodeCnt; i++ ){
  1653. var formcd = model.getValue("/root/main/sign/sign["+i+"]/formcd");
  1654. var signOrddd = model.getValue("/root/main/sign/sign["+i+"]/orddd");
  1655. if( formcd == code && signOrddd == orddd){
  1656. signno = model.getValue("/root/main/sign/sign["+i+"]/signno");
  1657. }
  1658. }
  1659. if(signno != ""){
  1660. model.setValue("/root/send/signno", signno);
  1661. model.setValue("/root/send/recsaveflag", "Y");
  1662. }else{
  1663. model.setValue("/root/send/signno", "0");
  1664. model.setValue("/root/send/recsaveflag", "N");
  1665. }
  1666. }
  1667. var sUserID = getUserInfo("userid");
  1668. var rowcnt = combo2.value;
  1669. var ordtype = model.getValue("/root/init/orddd["+rowcnt+"]/ordtype");
  1670. // 입원 또는 응급일 경우 // 20111201 knuh 최원돈
  1671. // 기록/처방 직전 인증저장이 정해진 시간(분 단위, 하드코드 401) 이내이면 인증서를 띄우지 않음(1/3)
  1672. // SMMMO00100.js, MMR01300.js, MMR00100.js, SPMRF05200.js
  1673. // 하드코드 값 가져오기 로직
  1674. var ls_emrinptsavetime = fGetHardCDList("Y", 401, 3);
  1675. var ll_emrinptsavetime = ls_emrinptsavetime == "" ? 0 : parseInt(ls_emrinptsavetime) * -1;
  1676. // 인증서 매번 띄우기 위해 주석
  1677. if(ordtype == "O"){
  1678. var signedrecinfo = zesfSignData(signrecinfo, sUserID, false); //외래환자일경우 한번만 인증서 띄움
  1679. }
  1680. // 입원 또는 응급일 경우 // 20111201 knuh 최원돈
  1681. // 기록/처방 직전 인증저장이 정해진 시간(분 단위, 하드코드 401) 이내이면 인증서를 띄우지 않음(2/3)
  1682. // SMMMO00100.js, MMR01300.js, MMR00100.js, SPMRF05200.js
  1683. // 띄우지 않는 로직
  1684. else if ( ( ordtype == "I"
  1685. || ordtype == "E")
  1686. && ll_emrinptsavetime < 0
  1687. && getGlobalVariable("emrinptsavetime") >= getCurrentDateTime().toDate("YYYYMMDD hhmmss").getAddDate(ll_emrinptsavetime, "m").getDateFormat("YYYYMMDD hhmmss"))
  1688. {
  1689. var signedrecinfo = zesfSignData(signrecinfo, sUserID, false); //외래환자일경우 한번만 인증서 띄움
  1690. }
  1691. else{
  1692. var signedrecinfo = zesfSignData(signrecinfo, sUserID, true);
  1693. }
  1694. //var signedrecinfo = zesfSignData(signrecinfo, sUserID, true);
  1695. if (signedrecinfo != ""){
  1696. model.makeValue("/root/send/signaftcnts", signedrecinfo);
  1697. model.makeValue("/root/send/signbfcnts", signrecinfo);
  1698. model.setValue("/root/send/status", "U");
  1699. /*var graph = model.getValue("/root/main/cond/chart");
  1700. if(graph == "1"){
  1701. var formcd = "0000001766";
  1702. }else if(graph == "2"){
  1703. var formcd = "0000001651";
  1704. }
  1705. var nodeCnt = getNodesetCount("/root/main/sign/sign");
  1706. var signno = "";
  1707. var orddd = model.getValue("/root/send/orddd");
  1708. for( i = 1; i <= nodeCnt; i++ ){
  1709. var code = model.getValue("/root/main/sign/sign["+i+"]/formcd");
  1710. var signOrddd = model.getValue("/root/main/sign/sign["+i+"]/orddd");
  1711. if( formcd == code && signOrddd == orddd){
  1712. signno = model.getValue("/root/main/sign/sign["+i+"]/signno");
  1713. }
  1714. }
  1715. if(signno != ""){
  1716. model.setValue("/root/send/signno", signno);
  1717. model.setValue("/root/send/recsaveflag", "Y");
  1718. }else{
  1719. model.setValue("/root/send/signno", "0");
  1720. model.setValue("/root/send/recsaveflag", "N");
  1721. }*/
  1722. if(submit("TXMRF05202")){
  1723. for(var i=1; i<8; i++){
  1724. model.removenode("/root/send/imgdata"+i);
  1725. }
  1726. model.removenode("/root/send/signaftcnts");
  1727. model.removenode("/root/send/signbfcnts");
  1728. model.removenode("/root/send/cond");
  1729. model.setValue("/root/send/wrtedd", "");
  1730. model.setValue("/root/send/wrtetm", "");
  1731. // 입원 또는 응급일 경우 // 20111201 knuh 최원돈
  1732. // 기록/처방 직전 인증저장이 정해진 시간(분 단위, 하드코드 401) 이내이면 인증서를 띄우지 않음(3/3)
  1733. // SMMMO00100.js, MMR01300.js, MMR00100.js, SPMRF05200.js
  1734. // 인증저장된 시간을 저장.
  1735. if (ordtype == "I" || ordtype == "E") {
  1736. setGlobalVariable("emrinptsavetime", getCurrentDateTime());
  1737. }
  1738. }
  1739. }else if (signedrecinfo == ""){
  1740. for(var i=1; i<8; i++){
  1741. model.removenode("/root/send/imgdata"+i);
  1742. }
  1743. model.removenode("/root/send/signaftcnts");
  1744. model.removenode("/root/send/signbfcnts");
  1745. model.removenode("/root/send/cond");
  1746. model.setValue("/root/send/wrtedd", "");
  1747. model.setValue("/root/send/wrtetm", "");
  1748. }
  1749. }
  1750. function fLaborSignSave(){
  1751. saveCnt = parseInt(saveCnt) + 1;
  1752. var ordIndex = combo2.value;
  1753. var orddd = model.getValue("/root/init/orddd["+ordIndex+"]/orddd");
  1754. var cretno = model.getValue("/root/init/orddd["+ordIndex+"]/cretno");
  1755. var ordtype = model.getValue("/root/init/orddd["+ordIndex+"]/ordtype");
  1756. var pid = model.getValue("/root/send/pid");
  1757. model.setValue("/root/labor/send/orddd", orddd);
  1758. model.setValue("/root/labor/send/cretno", cretno);
  1759. model.setValue("/root/labor/send/signgenrflag", ordtype);
  1760. model.setValue("/root/labor/send/pid", pid);
  1761. model.setValue("/root/labor/send/formcd", "0900004436");
  1762. model.setValue("/root/labor/send/deptnm", combo1.label); // 진료과 인증데이터 넘김
  1763. var tOrddd = model.getValue("/root/labor/send/orddd");
  1764. var maskord = tOrddd.substr(0, 4) + "-" + tOrddd.substr(4, 2) + "-" + tOrddd.substr(6, 2);
  1765. model.setValue("/root/labor/send/orddate", maskord); // 진료일자 인증데이터 넘김
  1766. var fstnm = model.getValue("/root/labor/send/fstrgstrnm");
  1767. if(fstnm == ""){
  1768. model.setValue("/root/labor/send/fstrgstrnm", getUserInfo("usernm"));
  1769. }
  1770. model.setValue("/root/labor/send/lastupdtrnm", getUserInfo("usernm"));
  1771. var wrtedd = getCurrentDate();
  1772. var wrtetm = getCurrentTime();
  1773. model.setValue("/root/labor/send/wrtedd", wrtedd);
  1774. model.setValue("/root/labor/send/wrtetm", wrtetm);
  1775. model.setValue("/root/labor/send/recdd", wrtedd);
  1776. model.setValue("/root/labor/send/rectm", wrtetm);
  1777. model.setValue("/root/labor/send/flag", "2");
  1778. grd_labor.gridToInstance();
  1779. var os="", st="";
  1780. for (i=grd_labor.fixedRows; i<grd_labor.rows; i++)
  1781. {
  1782. grd_labor.valueMatrix(i, 9) = i ;
  1783. os = grd_labor.valueMatrix(i, 3); // OS
  1784. st = grd_labor.valueMatrix(i, 6); // Station
  1785. if(os=="" && st==""){
  1786. grd_labor.deleteitem(i);
  1787. grd_labor.rowStatus(i) = 4;
  1788. }else{
  1789. grd_labor.rowStatus(i) = 1;
  1790. }
  1791. }
  1792. var csvLabor = grd_labor.getUpdateData("insert");
  1793. setCSVToNode("/root/labor/send/grid", csvLabor, "list");
  1794. sortNodeList("/root/labor/send/grid/list", "recdd", "asc"); // 그리드 인스턴스 정렬
  1795. var lGridCnt = getNodesetCount("/root/labor/send/grid/list");
  1796. for( i = 1; i <= lGridCnt; i++ ){
  1797. var rectm = model.getValue("/root/labor/send/grid/list["+i+"]/rectm");
  1798. var stage = model.getValue("/root/labor/send/grid/list["+i+"]/stage");
  1799. rectm = rectm.substr(0,5);
  1800. model.setValue("/root/labor/send/grid/list["+i+"]/rectm", rectm);
  1801. if(stage == "1"){
  1802. model.setValue("/root/labor/send/grid/list["+i+"]/stage", "1st Start");
  1803. }else if (stage == "2"){
  1804. model.setValue("/root/labor/send/grid/list["+i+"]/stage", "2nd Start");
  1805. }else if (stage == "3"){
  1806. model.setValue("/root/labor/send/grid/list["+i+"]/stage", "End");
  1807. }else if (stage == "4"){
  1808. model.setValue("/root/labor/send/grid/list["+i+"]/stage", "Delivery");
  1809. }
  1810. }
  1811. var laborNodeCnt = getNodesetCount("/root/main/laborlist/list/labor");
  1812. if(laborNodeCnt <= 15){
  1813. var imgCnt = 1;
  1814. model.setValue("/root/labor/send/imgcnt", "1");
  1815. } else if(laborNodeCnt > 15 && laborNodeCnt <= 30){
  1816. var imgCnt = 2;
  1817. model.setValue("/root/labor/send/imgcnt", "2");
  1818. } else if(laborNodeCnt > 30 && laborNodeCnt <= 45){
  1819. var imgCnt = 3;
  1820. model.setValue("/root/labor/send/imgcnt", "3");
  1821. } else if(laborNodeCnt > 45 && laborNodeCnt <= 60){
  1822. var imgCnt = 4;
  1823. model.setValue("/root/labor/send/imgcnt", "4");
  1824. } else if(laborNodeCnt > 60 && laborNodeCnt <= 75){
  1825. var imgCnt = 5;
  1826. model.setValue("/root/labor/send/imgcnt", "5");
  1827. }
  1828. for(i=1; i<= imgCnt; i++){
  1829. model.makeValue("/root/labor/send/imginfo["+i+"]/seqno", i);
  1830. }
  1831. var chkCC = model.getValue("/root/labor/send/cc");
  1832. var rdInd = model.getValue("/root/labor/send/induction");
  1833. var chkCD = model.getValue("/root/labor/send/cd");
  1834. if(chkCC.indexOf("1") != "-1"){
  1835. model.setValue("/root/labor/send/chpa", "1");
  1836. }else{
  1837. model.setValue("/root/labor/send/chpa", "");
  1838. }
  1839. if(chkCC.indexOf("2") != "-1"){
  1840. model.setValue("/root/labor/send/chpr", "1");
  1841. }else{
  1842. model.setValue("/root/labor/send/chpr", "");
  1843. }
  1844. if(chkCC.indexOf("3") != "-1"){
  1845. model.setValue("/root/labor/send/chaf", "1");
  1846. }else{
  1847. model.setValue("/root/labor/send/chaf", "");
  1848. }
  1849. if(chkCC.indexOf("4") != "-1"){
  1850. model.setValue("/root/labor/send/chfo", "1");
  1851. }else{
  1852. model.setValue("/root/labor/send/chfo", "");
  1853. }
  1854. if(rdInd.indexOf("1") != "-1"){
  1855. model.setValue("/root/labor/send/rdpo", "1");
  1856. }else{
  1857. model.setValue("/root/labor/send/rdpo", "");
  1858. }
  1859. if(rdInd.indexOf("2") != "-1"){
  1860. model.setValue("/root/labor/send/rdob", "1");
  1861. }else{
  1862. model.setValue("/root/labor/send/rdob", "");
  1863. }
  1864. if(chkCD.indexOf("1") != "-1"){
  1865. model.setValue("/root/labor/send/chpi", "1");
  1866. }else{
  1867. model.setValue("/root/labor/send/chpi", "");
  1868. }
  1869. if(chkCD.indexOf("2") != "-1"){
  1870. model.setValue("/root/labor/send/chpr", "1");
  1871. }else{
  1872. model.setValue("/root/labor/send/chpr", "");
  1873. }
  1874. if(chkCD.indexOf("3") != "-1"){
  1875. model.setValue("/root/labor/send/chol", "1");
  1876. }else{
  1877. model.setValue("/root/labor/send/chol", "");
  1878. }
  1879. if(chkCD.indexOf("4") != "-1"){
  1880. model.setValue("/root/labor/send/chiu", "1");
  1881. }else{
  1882. model.setValue("/root/labor/send/chiu", "");
  1883. }
  1884. if(chkCD.indexOf("5") != "-1"){
  1885. model.setValue("/root/labor/send/chof", "1");
  1886. }else{
  1887. model.setValue("/root/labor/send/chof", "");
  1888. }
  1889. var signrecinfo = model.instances(0).selectSingleNode("/root/labor/send").xml;
  1890. //var signrecinfo = "test";
  1891. model.removeNodeset("/root/labor/send/list");
  1892. model.makeValue("/root/labor/send/list",csvLabor);
  1893. model.removeNodeset("/root/labor/send/grid");
  1894. model.makeNode("/root/labor/send/grid");
  1895. for(i=1; i<= imgCnt; i++){
  1896. model.setValue("/root/labor/send/startRow", i*15-13);
  1897. fMakeLaborGraph();
  1898. //그래프 이미지 특정 폴더에 저장
  1899. var fso, fldr;
  1900. fladr = "C:/Program Files/himed/laborimage";
  1901. fso = new ActiveXObject("Scripting.FileSystemObject");
  1902. if (fso.FolderExists(fladr)) {
  1903. TChart2.Export.SaveToJPEGFile(fladr+"/tchart.jpeg", false, 0, 100, 658, 400 );
  1904. //sChartNum++;
  1905. } else {
  1906. fldr = fso.CreateFolder(fladr);
  1907. TChart2.Export.SaveToJPEGFile(fladr+"/tchart.jpeg", false, 0, 100, 658, 400 );
  1908. //sChartNum++;
  1909. }
  1910. var file = fladr+"/tchart.jpeg";
  1911. var pos = file.lastIndexOf("\\");
  1912. var localFileName= file.substring(pos+1, file.length);
  1913. img_tmp.src = "";
  1914. img_tmp.src = file;
  1915. var ldata = img_tmp.getbase64data();
  1916. model.makeValue("/root/labor/send/imgdata"+i, ldata);
  1917. }
  1918. var nodeCnt = getNodesetCount("/root/main/laborsign/sign");
  1919. var signno = "";
  1920. var orddd = model.getValue("/root/labor/send/orddd");
  1921. var code = model.getValue("root/labor/send/formcd");
  1922. for( i = 1; i <= nodeCnt; i++ ){
  1923. var formcd = model.getValue("/root/main/laborsign/sign["+i+"]/formcd");
  1924. var signOrddd = model.getValue("/root/main/laborsign/sign["+i+"]/orddd");
  1925. if( formcd == code && signOrddd == orddd){
  1926. signno = model.getValue("/root/main/laborsign/sign["+i+"]/signno");
  1927. }
  1928. }
  1929. if(signno != ""){
  1930. model.setValue("/root/labor/send/signno", signno);
  1931. model.setValue("/root/labor/send/recsaveflag", "Y");
  1932. }else{
  1933. model.setValue("/root/labor/send/signno", "0");
  1934. model.setValue("/root/labor/send/recsaveflag", "N");
  1935. }
  1936. var sUserID = getUserInfo("userid");
  1937. var rowcnt = combo2.value;
  1938. var ordtype = model.getValue("/root/init/orddd["+rowcnt+"]/ordtype");
  1939. // 인증서 매번 띄우기 위해 주석
  1940. if(ordtype == "O"){
  1941. var signedrecinfo = zesfSignData(signrecinfo, sUserID, false); //외래환자일경우 한번만 인증서 띄움
  1942. }
  1943. else{
  1944. var signedrecinfo = zesfSignData(signrecinfo, sUserID, true);
  1945. }
  1946. //var signedrecinfo = zesfSignData(signrecinfo, sUserID, true);
  1947. if (signedrecinfo != ""){
  1948. model.makeValue("/root/labor/send/signaftcnts", signedrecinfo);
  1949. model.makeValue("/root/labor/send/signbfcnts", signrecinfo);
  1950. model.setValue("/root/labor/send/status", "U");
  1951. if(submit("TXMRF05204")){
  1952. for(var i=1; i<8; i++){
  1953. model.removenode("/root/labor/send/imgdata"+i);
  1954. }
  1955. model.removenode("/root/labor/send/signaftcnts");
  1956. model.removenode("/root/labor/send/signbfcnts");
  1957. model.removenode("/root/labor/send/list");
  1958. model.removeNodeset("/root/labor/send/imginfo");
  1959. model.setValue("/root/labor/send/wrtedd", "");
  1960. model.setValue("/root/labor/send/wrtetm", "");
  1961. }
  1962. }else if (signedrecinfo == ""){
  1963. for(var i=1; i<8; i++){
  1964. model.removenode("/root/labor/send/imgdata"+i);
  1965. }
  1966. model.removenode("/root/labor/send/signaftcnts");
  1967. model.removenode("/root/labor/send/signbfcnts");
  1968. model.removenode("/root/labor/send/cond");
  1969. model.removeNodeset("/root/labor/send/imginfo");
  1970. model.setValue("/root/labor/send/wrtedd", "");
  1971. model.setValue("/root/labor/send/wrtetm", "");
  1972. }
  1973. }
  1974. /**
  1975. * 기록지에서 엔터키 쳤을시에 오른쪽으로 이동하는 이벤트
  1976. */
  1977. function fMoveFocus(){
  1978. grd_grth.col=grd_grth.col+1;
  1979. if(grd_grth.col==4){
  1980. grd_grth.col=grd_grth.col+1;
  1981. }
  1982. grd_grth.editCell();
  1983. model.refresh();
  1984. }
  1985. /**
  1986. * 임시저장 / 인증저장시 환자의 과코드를 다시 확인
  1987. * @return
  1988. */
  1989. function fDeptCheck(){
  1990. var patorddeptcd1 = model.getValue("/root/send/orddeptcd");
  1991. var patorddeptcd2 = model.getValue("/root/main/paminfo/pamlist/orddeptcd");
  1992. if(patorddeptcd1!=patorddeptcd2){
  1993. messageBox("환자의 진료과와 진료일자를 정확하게 선택하여 주시기 바랍니다.", "E");
  1994. return false;
  1995. }else{
  1996. return true;
  1997. }
  1998. }