SPADT61304.js 69 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636
  1. /**
  2. * 파 일 명 : SPADT61300.js
  3. * 설 명 : (팝업)원내라벨출력 Javascriot
  4. * 설 계 자 : 공두경
  5. * 작 성 자 : 공두경
  6. * 수정이력 : 2007.09.20 / 최초작성 / 공두경
  7. */
  8. var sSndMsg = ""; //라벨출력내용
  9. var iPoint = 0; //라벨출력row
  10. var iCnt = 0; //라벨출력매수
  11. var iImageCnt = 0; //라벨그래픽폰트수
  12. var ordflag = "";
  13. var iTotalPageNum = 0;
  14. var mPoint = 0;
  15. //var iPageCnt = 1; //페이지번호 조회
  16. var iPageCnt = 0;
  17. var iPageCntO = 1; //외래 큰라벨출력양식 사용
  18. var nextPage = false;
  19. var vCnt = 0;
  20. /**
  21. * 초기화
  22. */
  23. function fInit() {
  24. var sParam = model.getAttribute("params");
  25. model.makeValue("/root/send/prcpinfo/drugdd", astfMatrixData(sParam, 1, 0));
  26. model.makeValue("/root/send/prcpinfo/drugno", astfMatrixData(sParam, 1, 1));
  27. model.makeValue("/root/send/prcpinfo/ioflag", astfMatrixData(sParam, 1, 2));
  28. model.makeValue("/root/send/prcpinfo/lblflag", astfMatrixData(sParam, 1, 3));
  29. model.makeValue("/root/send/prcpinfo/liquidflag", astfMatrixData(sParam, 1, 4));
  30. model.makeValue("/root/send/prcpinfo/reprintyn", astfMatrixData(sParam, 1, 5));
  31. model.makeValue("/root/send/prcpinfo/autoinprntyn", astfMatrixData(sParam, 1, 6));
  32. model.makeValue("/root/send/prcpinfo/lbl5", astfMatrixData(sParam, 1, 7)); // 2010.03.18 pymi
  33. model.makeValue("/root/send/prcpinfo/atclblyn", astfMatrixData(sParam, 1, 8)); // 2010-12-13 이선경
  34. model.makeValue("/root/send/prcpinfo/lblkindflag", astfMatrixData(sParam, 1, 9)); // 2010-12-31 이선경
  35. model.makeValue("/root/send/prcpinfo/noname", astfMatrixData(sParam, 1, 10)); // 2011.03.22 pymi
  36. model.makeValue("/root/send/prcpinfo/prntflag", "O");
  37. var dutplceinstcd = getUserInfo("dutplceinstcd");
  38. submit("TRADT61301");
  39. if(model.getValue("/root/main/lbllist/lbllist["+1+"]/drugkindnm") != ""){
  40. if(model.getValue("/root/send/prcpinfo/liquidflag") == "Y"){
  41. fLiquidLBLPrint();
  42. } else {
  43. if (model.getValue("/root/send/prcpinfo/lblkindflag") == "S") {
  44. fLBLPrint_knu("S");
  45. } else {
  46. ///2015년 3월11일 김치국 외래 주사약큰라벨 Flag 만듬
  47. var Vdrugkind = model.getValue("/root/main/lbllist/lbllist["+1+"]/drugkindnm")
  48. if ( Vdrugkind == "[주사약]" && dutplceinstcd == '031' ){
  49. fLBLPrint_knu("LJ");
  50. } else {
  51. fLBLPrint_knu("L");
  52. }
  53. }
  54. }
  55. }
  56. model.refresh();
  57. window.close();
  58. }
  59. /**
  60. *
  61. */
  62. function fStopTimer() {
  63. window.clearinterval(gTimer);
  64. }
  65. function fSleep(numberMillis) {
  66. var now = new Date();;
  67. var exitTime = now.getTime() + numberMillis;
  68. while (true) {
  69. now = new Date();
  70. if (now.getTime() > exitTime)
  71. return;
  72. }
  73. }
  74. /**
  75. * 라벨출력
  76. */
  77. function fLBLPrint() {
  78. /*
  79. 라벨 Sorting 로직
  80. //mgt에서 vo로 리턴
  81. 대분류
  82. - 내복약, 외용약, 주사, 항암제, TPN, 마약,
  83. 중분류
  84. - 방법코드
  85. 소분류
  86. - 내복약,외용약(방법코드), 주사,마약,항암제(mix)
  87. web js 출력로직
  88. 1 약종류(내복약/주사약/외용약)
  89. 1.1 방법코드
  90. 1.2 처방수량
  91. */
  92. var prcpnum = "";
  93. var prcpCnt = 14; // 20101030_laboru_경북대병원_라벨 한 페이지에 최고 8개에서 14개 출력되게 변경
  94. // 라벨내용 copy
  95. //model.makeNode("/root/main/lbllist2");
  96. //model.copyNode("/root/main/lbllist2", "/root/main/lbllist");
  97. //iTotalPageNum = iPageCnt;
  98. //iPageCnt = 0;
  99. for(iPoint = 1; iPoint <= getNodesetCount("/root/main/lbllist/lbllist") ; iPoint++){
  100. model.makeNode("/root/main/prnt/lbllist[" +iPageCnt+ "]");
  101. model.copyNode("/root/main/prnt/lbllist[" +iPageCnt+ "]", "/root/main/lbllist/lbllist["+iPoint+"]");
  102. //바코드(변환)
  103. // 20101030_laboru_경북대병원_atc drugkind 구분자에 의한 바코드 출력 형식
  104. // t : "ATC" , p : 산제 바코드, e : blank
  105. if(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/atc_drugkind") == "t" ) {
  106. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/barcode2", "ATC");
  107. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/barcode", "");
  108. } else if(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/atc_drugkind") == "p") {
  109. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/barcode", model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/barcode"));
  110. } else {
  111. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/barcode", "");
  112. }
  113. var sumcls = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sumcls");
  114. var mthdcd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcd");
  115. if (mthdcd == "ZZZ" || mthdcd == "A10PQ") { //기타용법이거나 '필요시 복용하십시오' 용법인 경우도 단독라벨출력
  116. sumcls = mthdcd;
  117. }
  118. //복용기간 계산시 수납일자를 기준으로 하고 출력
  119. rcptdd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/rcptdd");
  120. //20101229 이선경 수정 : atc구분이 산제아닐때만 단독라벨 적용
  121. var atc_drugkind = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/atc_drugkind");
  122. if(atc_drugkind != "p" && fChkSumcls(iPoint)){
  123. //단독라벨출력
  124. if(model.getValue("/root/send/prcpinfo/lblkindflag") == "L1"){//경북대병원 큰라벨(본원)
  125. fIndependPrint2();
  126. } else {
  127. fIndependPrint();
  128. }
  129. } else {
  130. //일반라벨출력
  131. if(model.getValue("/root/send/prcpinfo/lblkindflag") == "L1"){//경북대병원 큰라벨(본원)
  132. fGnrlPrint2();
  133. } else {
  134. fGnrlPrint();
  135. }
  136. }
  137. }
  138. makeReportPreview(0,0,10, 10, "");
  139. model.makeNode("/root/main/barcdprntsetup/prntsetupinfo");
  140. model.copyNode("/root/main/barcdprntsetup/prntsetupinfo","/root/init/barcdprntsetup/prntsetupinfo");
  141. if(model.getValue("/root/send/prcpinfo/lblkindflag") == "L1"){//경북대병원 큰라벨(본원)
  142. model.removeNodeset("/root/main/lbllist/lbllist");
  143. model.makeNode("/root/main/lbllist");
  144. model.copyNode("/root/main/lbllist", "/root/main/prnt");
  145. fPrintRexbar("RFADT62303");
  146. } else {
  147. fPrintRexbar("RFADT61300");
  148. }
  149. }
  150. /**
  151. *
  152. */
  153. function fIndependPrint() {
  154. //라벨내용
  155. var drugkindnm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  156. var qty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqty");
  157. var dayqty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayprcpqty");
  158. var qtyunit = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqtyunit");
  159. var tims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  160. var dayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno"); //처방일수
  161. var mthddayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayno"); //용법일수
  162. var packunit = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/packunit"); //약품마스터의 수량단위
  163. if (drugkindnm == "[주사약]"){
  164. //용법2
  165. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/mthdcnts", model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"));
  166. } else if (drugkindnm == "[외용약]"){
  167. var val = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  168. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/mthdcnts" , val);
  169. } else if (drugkindnm == "[내복약]"){
  170. var sumcls = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sumcls");
  171. if( sumcls == "DM" || sumcls == "DS" || sumcls == "DT" || sumcls == "DX"){ //20091110 이선경 수정 : 라벨그룹이 마약(경구), 수제, ptp, 기타약일경우 약품마스터의 수량단위를 출력
  172. var tmpqty = Math.round(qty * 10) / 10;
  173. if(packunit == "T" || packunit == "C") {
  174. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/unit", mthddayno + "일 "+tims+"회 "+fChkFloat(qty)+"정씩 "+(dayno*mthddayno)+"일분");
  175. } else {
  176. if(packunit == "cap" || packunit == "tab") {
  177. packunit = "알"; // 20110413_laboru_경북대병원_단위가 cap, tab 일때 알로 바꾸기
  178. }
  179. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/unit", mthddayno + "일 "+tims+"회 "+fChkFloat(tmpqty)+ packunit +"씩 "+(dayno*mthddayno)+"일분");
  180. }
  181. } else {
  182. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/unit", mthddayno + "일 "+tims+"회 "+fChkFloat(qty)+"포[정]씩 "+(dayno*mthddayno)+"일분");
  183. }
  184. var mth = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2") + " "
  185. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  186. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/mthdcnts", mth);
  187. }
  188. // 2010.03.18 pymi
  189. if(!fChkSumcls(iPoint) && model.getValue("/root/send/prcpinfo/lbl5") == "Y") {
  190. var val = "";
  191. } else {
  192. // 20101027_laboru_경북대병원_라벨 출력물 처방코드 삭제
  193. var val = parseFloat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/totdrugqty"))
  194. +" "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm");
  195. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/prcpcd", val);
  196. }
  197. // (e)
  198. iPageCnt++;
  199. }
  200. /*
  201. * 20101231 이선경 추가 : 경북대병원 병동약국에서 외래환자처방을 큰라벨(본원)으로 출력함
  202. */
  203. function fIndependPrint2() {
  204. //라벨내용
  205. var drugkindnm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  206. var qty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqty");
  207. var dayqty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayprcpqty");
  208. var qtyunit = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqtyunit");
  209. var tims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  210. var dayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno"); //처방일수
  211. var mthddayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayno"); //용법일수
  212. var packunit = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/packunit"); //약품마스터의 수량단위
  213. if (drugkindnm == "[주사약]"){
  214. //용법2
  215. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/mthdcnts", model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"));
  216. } else if (drugkindnm == "[외용약]"){
  217. var val = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  218. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/mthdcnts" , val);
  219. } else if (drugkindnm == "[내복약]"){
  220. var sumcls = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sumcls");
  221. if( sumcls == "DM" || sumcls == "DS" || sumcls == "DT" || sumcls == "DX"){ //20091110 이선경 수정 : 라벨그룹이 마약(경구), 수제, ptp, 기타약일경우 약품마스터의 수량단위를 출력
  222. var tmpqty = Math.round(qty * 10) / 10;
  223. if(packunit == "T" || packunit == "C") {
  224. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/unit", tims+"회 "+ (dayno*mthddayno)+"일분");
  225. } else {
  226. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/unit", tims+"회 "+ (dayno*mthddayno)+"일분");
  227. }
  228. } else {
  229. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/unit", tims+"회 "+ (dayno*mthddayno)+"일분");
  230. }
  231. var mth = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2") + " "
  232. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  233. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/mthdcnts", mth);
  234. }
  235. model.setValue("/root/main/prnt/lbllist["+iPageCnt+"]/drugno", "<" + model.getValue("/root/main/prnt/lbllist["+iPageCnt+"]/drugno") + ">");
  236. // 2010.03.18 pymi
  237. if(!fChkSumcls(iPoint) && model.getValue("/root/send/prcpinfo/lbl5") == "Y") {
  238. var val = "";
  239. } else {
  240. // 20101027_laboru_경북대병원_라벨 출력물 처방코드 삭제
  241. var val = parseFloat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/totdrugqty"))
  242. +" "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm");
  243. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/prcpcd", val);
  244. }
  245. // (e)
  246. iPageCnt++;
  247. }
  248. /**
  249. *
  250. */
  251. function fGnrlPrint() {
  252. var cnt = 0;
  253. var ordCnt = 0;
  254. var tmppc = "";
  255. var sndprcpcnt = 1;
  256. //라벨내용
  257. var drugkindnm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  258. var qty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqty");
  259. var dayqty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayprcpqty");
  260. var tims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  261. var dayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");//처방일수
  262. var mthddayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayno"); //용법일수
  263. //약코드 출력
  264. var drugkind1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  265. var dayno1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");
  266. var mthd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd1");
  267. var mthd2 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd2");
  268. var mthd3 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd3");
  269. var mthdcd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcd");
  270. if( drugkindnm != "[내복약]") {
  271. if (drugkindnm == "[주사약]"){
  272. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/mthdcnts", model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"));
  273. } else if (drugkindnm == "[외용약]"){
  274. var val = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2")
  275. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  276. val += "\n" + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  277. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/mthdcnts" , val);
  278. }
  279. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  280. var drugkind2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/drugkindnm");
  281. var dayno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  282. var mthd4 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd1");
  283. var mthd5 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd2");
  284. var mthd6 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd3");
  285. if((drugkind1 == drugkind2) && (dayno1 == dayno2) && (mthd1 == mthd4 && mthd2 == mthd5 && mthd3 == mthd6)
  286. && !fChkSumcls(j)){
  287. var prcpqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty")/model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
  288. prcpqty = Math.ceil( prcpqty * tims*1000)/1000 ;
  289. // 2010.03.18 pymi
  290. if(!fChkSumcls(j) && model.getValue("/root/send/prcpinfo/lbl5") == "Y") {
  291. var val = "";
  292. } else {
  293. // 20101027_laboru_경북대병원_라벨 출력물 처방코드 삭제
  294. var val = prcpqty
  295. +" "+model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  296. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/sndprcp"+sndprcpcnt, tmppc);
  297. sndprcpcnt++;
  298. }
  299. cnt++;
  300. iPoint = j ;
  301. } else {
  302. iPageCnt++;
  303. iPoint = j - 1;
  304. break;
  305. }
  306. if(cnt == 12){ // 20101030_laboru_경북대병원_라벨 한 페이지에 최고 8개에서 14개 출력되게 변경
  307. iPageCnt++;
  308. break;
  309. }
  310. }
  311. sndprcpcnt = 1;
  312. } else if (drugkindnm == "[내복약]"){
  313. var lbltims =0;
  314. lbl_tims = mthd2.split(",");
  315. if ( mthdcd == "ZZZ" ){
  316. lbltims = tims;
  317. } else if ( mthd3.indexOf("취침") > -1 ) {
  318. lbltims = lbl_tims.length +1;
  319. } else if(mthd2.indexOf("마다") > -1){
  320. lbltims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  321. } else {
  322. lbltims = lbl_tims.length;
  323. }
  324. tims = lbltims;
  325. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/samedrugflag", "Y");
  326. if(lbltims == 1) {
  327. if(mthd2.indexOf("마다") == -1) {
  328. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/unit", mthddayno + "일 "+lbltims+ "회 1포씩 "+dayno+"일분");
  329. } else {
  330. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/unit", mthddayno + "일 "+tims+ "회 1포씩 "+dayno+"일분");
  331. }
  332. } else {
  333. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/unit", mthddayno + "일 "+lbltims+ "회 1포씩 "+dayno+"일분");
  334. }
  335. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/mthdcnts", model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd1") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd2")
  336. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd3") + "\n" + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"));
  337. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  338. var drugkind2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/drugkindnm");
  339. var dayno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  340. var mthd4 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd1");
  341. var mthd5 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd2");
  342. var mthd6 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd3");
  343. if((drugkind1 == drugkind2) && (dayno1 == dayno2) && (mthd1 == mthd4 && mthd2 == mthd5 && mthd3 == mthd6) && !fChkSumcls(j)){
  344. var lblcnts2 = model.getValue("/root/main/lbllist/lbllist["+ j +"]/lblcnts2");
  345. var prcpqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty")/model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
  346. prcpqty = Math.ceil( prcpqty * tims*1000)/1000 ;
  347. if(lblcnts2.length > 0) {
  348. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/lblcnts2", model.getValue("/root/main/prnt/lbllist["+iPageCnt+"]/lblcnts2") + "\n" + lblcnts2);
  349. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/lblcnts2flag", "Y");
  350. }
  351. if(sndprcpcnt > 12) {
  352. var prePage = iPageCnt;
  353. iPageCnt++;
  354. sndprcpcnt = 1;
  355. model.makeNode("/root/main/prnt/lbllist[" +iPageCnt+ "]");
  356. model.copyNode("/root/main/prnt/lbllist[" +iPageCnt+ "]", "/root/main/prnt/lbllist["+prePage+"]");
  357. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/lblcnts2flag", "N");
  358. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/sndprcp1", "");
  359. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/sndprcp2", "");
  360. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/sndprcp3", "");
  361. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/sndprcp4", "");
  362. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/sndprcp5", "");
  363. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/sndprcp6", "");
  364. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/sndprcp7", "");
  365. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/sndprcp8", "");
  366. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/sndprcp9", "");
  367. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/sndprcp10", "");
  368. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/sndprcp11", "");
  369. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/sndprcp12", "");
  370. }
  371. var val = prcpqty
  372. +" "+model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  373. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/sndprcp"+sndprcpcnt, val);
  374. sndprcpcnt++;
  375. iPoint = j;
  376. } else {
  377. iPageCnt++;
  378. iPoint = j - 1;
  379. break;
  380. }
  381. }
  382. }
  383. }
  384. /**
  385. * 20101231 이선경 추가 : 경북대병원 병동약국에서 외래환자처방을 큰라벨(본원)으로 출력함
  386. */
  387. function fGnrlPrint2() {
  388. var cnt = 0;
  389. var ordCnt = 0;
  390. var tmppc = "";
  391. var sndprcpcnt = 1;
  392. //라벨내용
  393. var drugkindnm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  394. var qty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqty");
  395. var dayqty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayprcpqty");
  396. var tims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  397. var dayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");//처방일수
  398. var mthddayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayno"); //용법일수
  399. //약코드 출력
  400. var drugkind1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  401. var dayno1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");
  402. var mthd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd1");
  403. var mthd2 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd2");
  404. var mthd3 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd3");
  405. var mthdcd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcd");
  406. if( drugkindnm != "[내복약]") {
  407. if (drugkindnm == "[주사약]"){
  408. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/mthdcnts", model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"));
  409. } else if (drugkindnm == "[외용약]"){
  410. var val = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2")
  411. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  412. val += "\n" + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  413. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/mthdcnts" , val);
  414. }
  415. model.setValue("/root/main/prnt/lbllist["+iPageCnt+"]/drugno", "<" + model.getValue("/root/main/prnt/lbllist["+iPageCnt+"]/drugno") + ">");
  416. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  417. var drugkind2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/drugkindnm");
  418. var dayno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  419. var mthd4 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd1");
  420. var mthd5 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd2");
  421. var mthd6 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd3");
  422. if((drugkind1 == drugkind2) && (dayno1 == dayno2) && (mthd1 == mthd4 && mthd2 == mthd5 && mthd3 == mthd6)
  423. && !fChkSumcls(j)){
  424. var prcpqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty")/model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
  425. prcpqty = Math.ceil( prcpqty * tims*1000)/1000 ;
  426. // 2010.03.18 pymi
  427. if(!fChkSumcls(j) && model.getValue("/root/send/prcpinfo/lbl5") == "Y") {
  428. var val = "";
  429. } else {
  430. // 20101027_laboru_경북대병원_라벨 출력물 처방코드 삭제
  431. var val = prcpqty
  432. +" "+model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  433. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/sndprcp"+sndprcpcnt, tmppc);
  434. sndprcpcnt++;
  435. }
  436. cnt++;
  437. iPoint = j ;
  438. } else {
  439. iPageCnt++;
  440. iPoint = j - 1;
  441. break;
  442. }
  443. if(cnt == 12){ // 20101030_laboru_경북대병원_라벨 한 페이지에 최고 8개에서 14개 출력되게 변경
  444. iPageCnt++;
  445. break;
  446. }
  447. }
  448. sndprcpcnt = 1;
  449. } else if (drugkindnm == "[내복약]"){
  450. var lbltims =0;
  451. lbl_tims = mthd2.split(",");
  452. if ( mthdcd == "ZZZ" ){
  453. lbltims = tims;
  454. } else if ( mthd3.indexOf("취침") > -1 ) {
  455. lbltims = lbl_tims.length +1;
  456. } else if(mthd2.indexOf("마다") > -1){
  457. lbltims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  458. } else {
  459. lbltims = lbl_tims.length;
  460. }
  461. tims = lbltims;
  462. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/samedrugflag", "Y");
  463. if(lbltims == 1) {
  464. if(mthd2.indexOf("마다") == -1) {
  465. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/unit", lbltims+ "회 "+dayno+"일분");
  466. } else {
  467. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/unit", tims+ "회 "+dayno+"일분");
  468. }
  469. } else {
  470. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/unit", lbltims+ "회 "+dayno+"일분");
  471. }
  472. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/mthdcnts", model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd1") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd2")
  473. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd3") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"));
  474. model.setValue("/root/main/prnt/lbllist["+iPageCnt+"]/drugno", "<" + model.getValue("/root/main/prnt/lbllist["+iPageCnt+"]/drugno") + ">");
  475. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  476. var drugkind2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/drugkindnm");
  477. var dayno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  478. var mthd4 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd1");
  479. var mthd5 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd2");
  480. var mthd6 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd3");
  481. if((drugkind1 == drugkind2) && (dayno1 == dayno2) && (mthd1 == mthd4 && mthd2 == mthd5 && mthd3 == mthd6) && !fChkSumcls(j)){
  482. var lblcnts2 = model.getValue("/root/main/lbllist/lbllist["+ j +"]/lblcnts2");
  483. var prcpqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty")/model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
  484. prcpqty = Math.ceil( prcpqty * tims*1000)/1000 ;
  485. if(lblcnts2.length > 0) {
  486. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/lblcnts2", model.getValue("/root/main/prnt/lbllist["+iPageCnt+"]/lblcnts2") + "\n" + lblcnts2);
  487. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/lblcnts2flag", "Y");
  488. }
  489. if(sndprcpcnt > 12) {
  490. var prePage = iPageCnt;
  491. iPageCnt++;
  492. sndprcpcnt = 1;
  493. model.makeNode("/root/main/prnt/lbllist[" +iPageCnt+ "]");
  494. model.copyNode("/root/main/prnt/lbllist[" +iPageCnt+ "]", "/root/main/prnt/lbllist["+prePage+"]");
  495. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/lblcnts2flag", "N");
  496. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/sndprcp1", "");
  497. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/sndprcp2", "");
  498. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/sndprcp3", "");
  499. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/sndprcp4", "");
  500. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/sndprcp5", "");
  501. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/sndprcp6", "");
  502. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/sndprcp7", "");
  503. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/sndprcp8", "");
  504. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/sndprcp9", "");
  505. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/sndprcp10", "");
  506. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/sndprcp11", "");
  507. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/sndprcp12", "");
  508. }
  509. var val = prcpqty
  510. +" "+model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  511. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/sndprcp"+sndprcpcnt, val);
  512. sndprcpcnt++;
  513. iPoint = j;
  514. } else {
  515. iPageCnt++;
  516. iPoint = j - 1;
  517. break;
  518. }
  519. }
  520. }
  521. }
  522. /**
  523. *
  524. */
  525. function fGetImage() {
  526. var pImage = "";
  527. iImageCnt++;
  528. if(iImageCnt > 99){
  529. pImage = "GRAPH"+iImageCnt;
  530. } else if(iImageCnt > 9){
  531. pImage = "GRAPH0"+iImageCnt;
  532. } else {
  533. pImage = "GRAPH00"+iImageCnt;
  534. }
  535. return pImage
  536. }
  537. /**
  538. *
  539. */
  540. function fDateFormat(sDD) {
  541. return sDD.substr(0,4)+"/"+sDD.substr(4,2)+"/"+sDD.substr(6,2);
  542. }
  543. /**
  544. *
  545. */
  546. function fChkFloat(qty) {
  547. var fQty = parseFloat(qty);
  548. var fRst = "";
  549. if(fQty%1 == 0){
  550. fRst = parseInt(qty);
  551. } else {
  552. fRst = qty;
  553. }
  554. return fRst;
  555. }
  556. /**
  557. *
  558. */
  559. function fChkSumcls(cnt) {
  560. var chk = false;
  561. var sSumcls = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/sumcls");
  562. var sSnglyn = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/atcifsnglyn");
  563. var sDrugindependpackflag = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/drugindependpackflag");
  564. var atcyn = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/atcyn");
  565. var atc_drugkind = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/atc_drugkind");
  566. var prcpnm = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/prcpnm");
  567. if(sSumcls == "DI" || sSumcls == "DS"|| sSumcls == "DX"|| sSumcls == "DT" || sSumcls == "DM" || sSumcls == "IH"|| sSumcls == "IO" || sSumcls == "DG" // 20110512_laboru_pack 추가
  568. || sSumcls == "IS"|| sSumcls == "IX"|| sSumcls == "X" || sSumcls == "ZZZ" || sSumcls == "A10PQ" || sSumcls == "I"){
  569. chk = true;
  570. }
  571. if ( sSumcls == "D" && sSnglyn =="Y" ) {
  572. chk = true;
  573. }
  574. if ( sDrugindependpackflag =="Y"){
  575. chk = true;
  576. }
  577. //2013년 8월1일 김치국 ATC전송시 키지 않는 믹스 번호 70이하 데이타는 단독 라벨 출력 되게
  578. if ( atcyn =="N" ){
  579. chk = true;
  580. }
  581. // alert(" fChkSumcls : " + prcpnm +" : " + atc_drugkind +" : " + atcyn +" : " + chk )
  582. return chk;
  583. }
  584. /**
  585. * 물약라벨출력
  586. */
  587. function fLiquidLBLPrint() {
  588. var reprint="";
  589. for(iPoint = 1; iPoint <= getNodesetCount("/root/main/lbllist/lbllist") ; iPoint++){
  590. if ( model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/lblprnttims")>0 ){
  591. reprint ="(재)";
  592. }
  593. //시작(X, Y)
  594. sSndMsg += astfStartFormat(0, 0);
  595. var sDD = getCurrentDate();
  596. var sTM = getCurrentTime();
  597. model.makeNode("/root/main/prnt/lbllist[" +iPageCnt+ "]");
  598. model.copyNode("/root/main/prnt/lbllist[" +iPageCnt+ "]", "/root/main/lbllist/lbllist["+iPoint+"]");
  599. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/fprnttime", "출 력 : " + fPrntTime(sDD, sTM));
  600. model.setValue("/root/main/prnt/lbllist["+iPageCnt+"]/rcptdd", "수 납 : " + fDateFormat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/rcptdd"), "MD"));
  601. var tpid = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/pid")+" ("+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugno")+reprint+")" ;
  602. model.setValue("/root/main/prnt/lbllist["+iPageCnt+"]/pid" , tpid);
  603. //라벨내용
  604. var dayqty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayprcpqty");
  605. var qtyunit = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqtyunit");
  606. var tims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  607. var dayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");
  608. var qty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqty");
  609. var totqty = parseInt(dayqty)*parseInt(dayno);
  610. //1일 X회 Xml씩 X일분
  611. qty = Math.round(qty*10) / 10;
  612. var mthd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1");
  613. var mthd2 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2");
  614. var mthd3 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  615. //용법
  616. if ( mthd1 == "" && mthd2 == "" && mthd3 == "" ){
  617. var tunit = "1일 "+tims+"회 "+qty+qtyunit+"씩 "+dayno+"일분" + "\n" + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/abbrnm");
  618. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/unit", tunit);
  619. } else {
  620. var tunit = "1일 "+tims+"회 "+qty+qtyunit+"씩 "+dayno+"일분" + "\n" + mthd1 + " " + mthd2 + " " + mthd3;
  621. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/unit", tunit);
  622. }
  623. //약품코드 + 총용량 + 약품명
  624. var prcpnm = "[ "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd")+" ] "+
  625. parseFloat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/totdrugqty")) + " " +
  626. model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm");
  627. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/prcpcd", prcpnm);
  628. //보관방법
  629. var lblcnts1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/lblcnts1");
  630. if ( lblcnts1 == "" ) {
  631. if(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/keepmthd") != ""){
  632. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/keepmthd", "< "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/keepmthd")+" >","");
  633. }
  634. } else {
  635. //주의사항
  636. model.makeValue("/root/main/prnt/lbllist["+iPageCnt+"]/keepmthd", lblcnts1);
  637. }
  638. iPageCnt++;
  639. }
  640. makeReportPreview(0,0,10, 10, "");
  641. model.makeNode("/root/main/barcdprntsetup/prntsetupinfo");
  642. model.copyNode("/root/main/barcdprntsetup/prntsetupinfo","/root/init/barcdprntsetup/prntsetupinfo");
  643. fPrintRexbar("RFADT61301");
  644. }
  645. function fPrntTime(sDD, sTM) {
  646. return sDD.substr(4,2)+" / "+sDD.substr(6,2)+" "+sTM.substr(0,2)+":"+sTM.substr(2,2)+":"+sTM.substr(4,2);
  647. }
  648. /**
  649. * 20101224 이선경 추가
  650. * 경북대병원 외래 큰라벨 출력 양식
  651. */
  652. function fLBLPrint_knu(type) {
  653. /*
  654. 라벨 Sorting 로직
  655. < 정제 >
  656. 1. 단독조제는 따로 한장으로
  657. 2. 용법코드 5자리인 것중 5번째 자리 값(식후 10분, 식전 10분 등..)이 같은 것끼리 한장으로
  658. 3. 그외 나머지는 용법코드 같은 같은 것끼리 한장으로
  659. < 산제 >
  660. 1.용법코드 전체가 같은 것끼리 한장으로
  661. */
  662. var prcpnum = "";
  663. var prcpCnt = 14; // 20101030_laboru_경북대병원_라벨 한 페이지에 최고 8개에서 14개 출력되게 변경
  664. var sDD = getCurrentDate();
  665. var sTM = getCurrentTime();
  666. for(iPoint = 1; iPoint <= getNodesetCount("/root/main/lbllist/lbllist") ; iPoint++){
  667. var lblprntyn = model.getValue("/root/main/lbllist/lbllist["+ iPoint+"]/lblprntyn");
  668. if(lblprntyn == "N") {
  669. model.removeNodeset("/root/main/lbllist/lbllist["+ iPoint +"]");
  670. } else {
  671. model.makeNode("/root/main/prnt/lbllist[" +iPageCntO+ "]");
  672. model.copyNode("/root/main/prnt/lbllist[" +iPageCntO+ "]", "/root/main/lbllist/lbllist["+iPoint+"]");
  673. if ( model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/lblprnttims")>0 ){
  674. model.setValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/drugno", model.getValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/drugno") + "(재)");
  675. }
  676. //바코드(변환)
  677. // 20101030_laboru_경북대병원_atc drugkind 구분자에 의한 바코드 출력 형식
  678. // t : "ATC" , p : 산제 바코드, e : blank
  679. if(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/atc_drugkind") == "t" && model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/atcyn") == "Y" ) { //2013년 8월1일 김치국
  680. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/barcode2", "ATC");
  681. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/barcode", "");
  682. } else if(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/atc_drugkind") == "p") {
  683. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/barcode", model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/barcode"));
  684. } else {
  685. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/barcode", "");
  686. }
  687. var sumcls = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sumcls");
  688. var mthdcd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcd");
  689. if (mthdcd == "ZZZ" || mthdcd == "A10PQ") { //기타용법이거나 '필요시 복용하십시오' 용법인 경우도 단독라벨출력
  690. sumcls = mthdcd;
  691. }
  692. //복용기간 계산시 수납일자를 기준으로 하고 출력
  693. rcptdd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/rcptdd");
  694. if(type == "S") {
  695. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/fprnttime", "출 력 : " + fPrntTime(sDD, sTM));
  696. model.setValue("/root/main/prnt/lbllist["+iPageCntO+"]/prcpdd", "처 방 : " + fDateFormat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd"), "MD"));
  697. }
  698. //보관방법 고가 출력
  699. var sKeepmthd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/keepmthd");
  700. var sExpnyn = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/expnyn");
  701. var sExpnnm = "";
  702. if(sExpnyn == "Y") sExpnnm = "고가";
  703. if(sKeepmthd != ""){
  704. //sSndMsg += astfPrintOut(20, 180, 3, "<"+sKeepmthd+">","");
  705. model.setValue("/root/main/prnt/lbllist["+iPageCntO+"]/keepmthd", "<"+sKeepmthd+">" );
  706. }
  707. if(sExpnnm != ""){
  708. //sSndMsg += astfPrintOut(135, 180, 3, "<"+sExpnnm+">","");
  709. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/expnnm", "<"+sExpnnm+">" );
  710. }
  711. //20101229 이선경 수정 : atc구분이 산제아닐때만 단독라벨 적용
  712. var atc_drugkind = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/atc_drugkind");
  713. var sDrugKindcd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  714. var sMixno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpmixno");
  715. if(type == "S" && sDrugKindcd == "[주사약]"){
  716. if(sMixno != "-"){
  717. fMixLBL_knu();
  718. } else if(fChkIndependInj(iPoint)){
  719. //alert(iPoint + "단독주사");
  720. fIndependPrint_knu(type);
  721. } else {
  722. //alert(iPoint + "복합주사");
  723. fInjDrugLBL_knu();
  724. }
  725. } else if(atc_drugkind != "p" && fChkSumcls(iPoint)){
  726. //단독라벨출력
  727. // alert(iPoint + " 정제 단독라벨");
  728. fIndependPrint_knu(type);
  729. } else {
  730. //일반라벨출력
  731. // alert(iPoint + " 복합라벨");
  732. fGnrlPrint_knu(type);
  733. }
  734. } // 20110519_laboru
  735. }
  736. model.makeNode("/root/main/barcdprntsetup/prntsetupinfo");
  737. model.copyNode("/root/main/barcdprntsetup/prntsetupinfo","/root/init/barcdprntsetup/prntsetupinfo");
  738. if(getNodesetCount("/root/main/prnt/lbllist") > 0) {
  739. if(type == "L1") { //본원큰라벨
  740. model.removeNodeset("/root/main/lbllist");
  741. model.makeNode("/root/main/lbllist");
  742. model.copyNode("/root/main/lbllist", "/root/main/prnt");
  743. makeReportPreview(0,0,10, 10, "");
  744. fPrintRexbar("RFADT62303");
  745. } else if(type == "L"){ //큰라벨
  746. makeReportPreview(0,0,10, 10, "");
  747. if (model.getValue("/root/send/prcpinfo/lblkindflag") == "L2"){//경북대병원 큰라벨(본원_외래약국 ) 김치국 20120808
  748. fPrintRexbar("RFADT61302");
  749. } else {
  750. fPrintRexbar("RFADT61300")
  751. }
  752. } else if(type == "LJ"){ //주사큰라벨 ///2015년 3월11일 김치국 주사큰라벨 Flag 만듬
  753. // alert("row 917 SPADT61304.js "+ model.getValue("/root/send/prcpinfo/lblkindflag") )
  754. makeReportPreview(0,0,10, 10, "");
  755. if (model.getValue("/root/send/prcpinfo/lblkindflag") == "L2"){//경북대병원 큰라벨(본원_외래약국 ) 김치국 20120808
  756. fPrintRexbar("RFADT61302");
  757. } else {
  758. //fPrintRexbar("RFADT61300")
  759. fPrintRexbar("RFADT61305");
  760. }
  761. } else if(type == "S") { //작은라벨
  762. model.removeNodeset("/root/main/lbllist");
  763. model.makeNode("/root/main/lbllist");
  764. model.copyNode("/root/main/lbllist", "/root/main/prnt");
  765. makeReportPreview(0,0,10, 10, "");
  766. fPrintRexbar("RFADT62302");
  767. }
  768. }
  769. }
  770. /**
  771. * 20101224 이선경 추가
  772. * 외래 큰라벨 출력 양식(단독)
  773. */
  774. function fIndependPrint_knu(type) {
  775. //라벨내용
  776. var drugkindnm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  777. var qty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqty");
  778. var dayqty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayprcpqty");
  779. var qtyunit = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqtyunit");
  780. var tims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  781. var dayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno"); //처방일수
  782. var mthddayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayno"); //용법일수
  783. var packunit = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/packunit"); //약품마스터의 수량단위
  784. //2013년 8월1일 김치국 ATC전송되지 않는 정제약 처리위해 추가 ~~~~ 여기에서
  785. var atcyn = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/atcyn"); //ATC라벨 YN
  786. var prcpnm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm"); //처방 명칭
  787. var prcpmixno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpmixno"); //분리번호
  788. //2013년 8월1일 김치국 ATC전송되지 않는 정제약 처리위해 추가 ~~~ 까지
  789. var mth = ""; //용법내용설명
  790. var mth_qty = ""; // 날수 내용설명 김치국 20120808 'L2' 처리
  791. //경북대병원 큰라벨(본원_외래약국 ) 김치국 20120808 'L2' 처리
  792. var hostype = model.getValue("/root/send/prcpinfo/lblkindflag");
  793. if(mthddayno == "" || mthddayno == 0) {
  794. mthddayno = 1;
  795. }
  796. //alert("type: " + type + " " + prcpnm + " " + hostype + " " + packunit + " " + drugkindnm)
  797. //alert("hostype: " + hostype )
  798. //alert("drugkindnm : " + drugkindnm )
  799. //alert("packunit : " + packunit )
  800. //alert("atcyn : " + atcyn )
  801. //alert("prcpnm : " + prcpnm )
  802. if (drugkindnm == "[주사약]"){
  803. //용법2
  804. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/mthdcnts", model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"));
  805. } else if (drugkindnm == "[외용약]"){
  806. var val = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  807. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/mthdcnts" , val);
  808. } else if (drugkindnm == "[내복약]"){
  809. var sumcls = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sumcls");
  810. // alert("sumcls : " + sumcls )
  811. if( sumcls == "DM" || sumcls == "DS" || sumcls == "DT" || sumcls == "DX" || sumcls == "DG" ){ //20091110 이선경 수정 : 라벨그룹이 마약(경구), 수제, ptp, 기타약일경우 약품마스터의 수량단위를 출력 20110512_laboru_pack 추가
  812. var tmpqty = Math.round(qty * 10) / 10;
  813. if(packunit == "T" || packunit == "C") {
  814. if(type == "L1") {
  815. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", tims+"회 "+(dayno*mthddayno)+"일분");
  816. mth = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2") + " "
  817. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3") + " " +fChkFloat(qty)+"정씩 "+ model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  818. } else if(type == "L") {
  819. if (hostype == "L2") {
  820. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+tims+"회 "+(dayno*mthddayno)+"일분");
  821. mth_qty = fChkFloat(qty)+"정씩 " ;
  822. } else {
  823. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+tims+"회 "+fChkFloat(qty)+"정씩 "+(dayno*mthddayno)+"일분");
  824. }
  825. } else if(type == "S") {
  826. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+tims+"회 "+fChkFloat(qty)+"정씩 "+(dayno*mthddayno)+"일분");
  827. }
  828. } else {
  829. if(packunit == "cap" || packunit == "tab" ) {
  830. packunit = "알"; // 20110413_laboru_경북대병원_단위가 cap, tab 일때 알로 바꾸기
  831. }
  832. // alert(" prcpnm : " + packunit )
  833. if(type == "L1") {
  834. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", tims+"회 "+(dayno*mthddayno)+"일분");
  835. mth = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2") + " "
  836. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3") + " " +fChkFloat(tmpqty)+ packunit +"씩 "+ model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  837. } else if(type == "L") {
  838. if (hostype == "L2") {
  839. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+tims+"회 "+(dayno*mthddayno)+"일분");
  840. mth_qty = fChkFloat(tmpqty)+ packunit +"씩 " ;
  841. } else {
  842. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+tims+"회 "+fChkFloat(tmpqty)+ packunit +"씩 "+(dayno*mthddayno)+"일분");
  843. }
  844. } else if(type == "S") {
  845. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+tims+"회 "+fChkFloat(tmpqty)+ packunit +"씩 "+(dayno*mthddayno)+"일분");
  846. }
  847. }
  848. } else {
  849. if(type == "L1") {
  850. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", tims+"회 "+(dayno*mthddayno)+"일분");
  851. mth = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2") + " "
  852. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3") + " " +fChkFloat(qty)+"포[정]씩 "+ model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  853. } else if(type == "L"){
  854. if (hostype == "L2") {
  855. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+tims+"회 "+(dayno*mthddayno)+"일분");
  856. //2013년 8월1일 김치국 ATC전송되지 않는 정제약 중 믹스 번호 70이하 처리위해 추가
  857. if (atcyn == "N" && prcpmixno <= 70 ) {
  858. mth_qty = fChkFloat(qty)+"알씩 " ;
  859. }else{
  860. mth_qty = fChkFloat(qty)+"포[정]씩 " ;
  861. }
  862. // alert(" mth_qty: " + mth_qty );
  863. } else {
  864. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+tims+"회 "+fChkFloat(qty)+"포[정]씩 "+(dayno*mthddayno)+"일분");
  865. }
  866. } else if(type == "S"){
  867. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+tims+"회 "+fChkFloat(qty)+"포[정]씩 "+(dayno*mthddayno)+"일분");
  868. }
  869. }
  870. if(type == "L" || type == "S") {
  871. mth = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2") + " "
  872. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  873. // alert("마자막 mth : " + mth);
  874. //if(mth.replace(/ /g,"") != "" ) { mth += "에 "; };
  875. var strchk = mth.substring(mth.length - 1, mth.length);
  876. //alert(strchk);
  877. if(strchk == "후" || strchk == "시" || strchk == "간" || strchk == "중" || strchk == "분") {
  878. mth += "에 ";
  879. } else {
  880. mth += " ";
  881. }
  882. /////본원 외래 약국 큰라벨은 수량을 후에 별도로 나타내기 2012.8.29 김치국
  883. if (hostype == "L2") {
  884. mth += mth_qty ;
  885. }
  886. // alert(" 10: " + mth);
  887. mth += model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  888. }
  889. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/mthdcnts", mth);
  890. // alert("마지막 둥: " + mth);
  891. }
  892. // 2010.03.18 pymi
  893. if(!fChkSumcls(iPoint) && model.getValue("/root/send/prcpinfo/lbl5") == "Y") {
  894. var val = "";
  895. } else {
  896. // 20101027_laboru_경북대병원_라벨 출력물 처방코드 삭제
  897. var val = parseFloat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/totdrugqty"))
  898. +" "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm");
  899. if(sumcls == "DT" ) { //20100707_ laboru_PTP 라벨 표시
  900. val += " (PTP)";
  901. }
  902. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/prcpcd", val);
  903. }
  904. // (e)
  905. iPageCntO++;
  906. }
  907. /**
  908. * 20101224 이선경 추가
  909. * 외래 큰라벨 출력 양식(일반)
  910. */
  911. function fGnrlPrint_knu(type) {
  912. var cnt = 0;
  913. var ordCnt = 0;
  914. var tmppc = "";
  915. var sndprcpcnt = 1;
  916. //라벨내용
  917. var drugkindnm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  918. var qty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqty");
  919. var dayqty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayprcpqty");
  920. var tims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  921. var dayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");//처방일수
  922. var mthddayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayno"); //용법일수
  923. //약코드 출력
  924. var drugkind1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  925. var dayno1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");
  926. var mthd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd1");
  927. var mthd2 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd2");
  928. var mthd3 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd3");
  929. var mthdcd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcd");
  930. var mthdcdfive1 = mthdcd1.substring(4,5);
  931. var mthdcdthree1 = mthdcd1.substring(2,3);
  932. var cntpatt1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/cntpatt");
  933. var mthdcntsno = iPageCntO;
  934. var mthdcnts_end = ""; //용법내용설명
  935. var mthdcd5nm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcd5nm"); //약품코드5번째자리명칭 (용법세분류)
  936. var prcpmixno1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpmixno");
  937. //경북대병원 큰라벨(본원_외래약국 ) 김치국 20120808 'L2' 처리
  938. var hostype = model.getValue("/root/send/prcpinfo/lblkindflag");
  939. if(mthddayno == "" || mthddayno == 0) {
  940. mthddayno = 1;
  941. }
  942. //alert(drugkindnm + " " + mthdcd + " " + mthdcdfive1);
  943. if( drugkindnm != "[내복약]") {
  944. if (drugkindnm == "[주사약]"){
  945. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/mthdcnts", model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"));
  946. } else if (drugkindnm == "[외용약]"){
  947. var val = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2")
  948. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  949. if(type == "L1") {
  950. val += model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  951. } else {
  952. val += "\n" + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  953. }
  954. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/mthdcnts" , val);
  955. }
  956. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  957. var drugkind2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/drugkindnm");
  958. var dayno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  959. var mthd4 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd1");
  960. var mthd5 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd2");
  961. var mthd6 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd3");
  962. //20101229 이선경 수정 : atc구분이 산제아닐때만 단독라벨 적용
  963. var atc_drugkind = model.getValue("/root/main/lbllist/lbllist["+j+"]/atc_drugkind");
  964. if((drugkind1 == drugkind2) && (dayno1 == dayno2) && (mthd1 == mthd4 && mthd2 == mthd5 && mthd3 == mthd6)
  965. && !(fChkSumcls(j) && atc_drugkind != "p") ){
  966. var prcpqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty")/model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
  967. prcpqty = Math.ceil( prcpqty * tims*1000)/1000 ;
  968. // 2010.03.18 pymi
  969. if(!fChkSumcls(j) && model.getValue("/root/send/prcpinfo/lbl5") == "Y") {
  970. var val = "";
  971. } else {
  972. // 20101027_laboru_경북대병원_라벨 출력물 처방코드 삭제
  973. var val = prcpqty
  974. +" "+model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  975. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/sndprcp"+sndprcpcnt, tmppc);
  976. sndprcpcnt++;
  977. }
  978. cnt++;
  979. iPoint = j ;
  980. } else {
  981. iPageCntO++;
  982. iPoint = j - 1;
  983. break;
  984. }
  985. if(cnt == 12){ // 20101030_laboru_경북대병원_라벨 한 페이지에 최고 8개에서 14개 출력되게 변경
  986. iPageCntO++;
  987. break;
  988. }
  989. }
  990. sndprcpcnt = 1;
  991. } else if (drugkindnm == "[내복약]"){
  992. var lbltims =0;
  993. var unit = "";
  994. var mthdcnts = ""; //용법내용
  995. var mthdcnts1 = 0; //아침
  996. var mthdcnts2 = 0; //점심
  997. var mthdcnts3 = 0; //저녁
  998. var mthdcnts4 = 0; //취침전
  999. var mthdcnts5 = 0; //특수용법
  1000. var mthdtims = 0; //용법횟수
  1001. lbl_tims = mthd2.split(",");
  1002. if ( mthdcd1 == "ZZZ" ){
  1003. lbltims = tims;
  1004. } else if ( mthd3.indexOf("취침") > -1 ) {
  1005. lbltims = lbl_tims.length +1;
  1006. } else if(mthd2.indexOf("마다") > -1){
  1007. lbltims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  1008. } else {
  1009. lbltims = lbl_tims.length;
  1010. }
  1011. tims = lbltims;
  1012. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/samedrugflag", "Y");
  1013. // alert("시작");
  1014. if(lbltims == 1) {
  1015. if(mthd2.indexOf("마다") == -1) {
  1016. if(type == "L1") {
  1017. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthdcdthree1+ "회 "+dayno+"일분");
  1018. mthdcnts_end = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3") + "에" + " 1포씩"; // 20110411_laboru_에 추가
  1019. //+ model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  1020. } else if(type == "L") {
  1021. if (hostype == "L2") {
  1022. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+mthdcdthree1+ "회 "+dayno+"일분");
  1023. mthdcnts_end = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3") + " 1포씩";
  1024. } else {
  1025. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+mthdcdthree1+ "회 1포씩 "+dayno+"일분");
  1026. mthdcnts_end = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  1027. }
  1028. //if(mthdcnts_end != "") { mthdcnts_end += "에 ";}
  1029. //mthdcnts_end +="\n" + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  1030. } else if(type == "S") {
  1031. unit = mthddayno + "일 "+mthdcdthree1+ "회 "+dayno+"일분" + "\n";
  1032. mthdcnts_end = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  1033. //+ model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  1034. }
  1035. } else {
  1036. if(type == "L1") {
  1037. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthdcdthree1+ "회 "+dayno+"일분");
  1038. mthdcnts_end = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3")+ "에" + " 1포씩"; // 20110411_laboru_에 추가
  1039. //+ model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  1040. } else if(type == "L") {
  1041. if (hostype == "L2") {
  1042. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+mthdcdthree1+ "회 "+dayno+"일분");
  1043. mthdcnts_end = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3") + " 1포씩";
  1044. } else {
  1045. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+mthdcdthree1+ "회 1포씩 "+dayno+"일분");
  1046. mthdcnts_end = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  1047. }
  1048. //if(mthdcnts_end != ""){ mthdcnts_end += "에";}
  1049. //mthdncts_end += "\n" + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  1050. } else if(type == "S") {
  1051. unit = mthddayno + "일 "+mthdcdthree1+ "회 "+dayno+"일분" + "\n";
  1052. mthdcnts_end = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  1053. //+ model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  1054. }
  1055. }
  1056. } else {
  1057. if(type == "L1") {
  1058. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthdcdthree1+ "회 "+dayno+"일분");
  1059. mthdcnts_end = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3")+ "에" + " 1포씩"; // 20110411_laboru_에 추가
  1060. //+ model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  1061. } else if(type == "L") {
  1062. if (hostype == "L2") {
  1063. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+mthdcdthree1+ "회 "+dayno+"일분");
  1064. mthdcnts_end = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3") + " 1포씩";
  1065. } else {
  1066. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+mthdcdthree1+ "회 1포씩 "+dayno+"일분");
  1067. mthdcnts_end = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  1068. }
  1069. //if(mthdcnts_end != "") {mthdcnts_end += "에";}
  1070. //mthdcnts_end += "\n" + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  1071. } else if(type == "S") {
  1072. unit = mthddayno + "일 "+mthdcdthree1+ "회 "+dayno+"일분" + "\n";
  1073. mthdcnts_end = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  1074. //+ model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  1075. }
  1076. }
  1077. //alert("cntpatt1 " + cntpatt1);
  1078. if(cntpatt1.substring(0,1) == "1" && mthdcnts1 == 0) {
  1079. mthdcnts1++;
  1080. mthdtims++;
  1081. }
  1082. if(cntpatt1.substring(1,2) == "1" && mthdcnts2 == 0) {
  1083. mthdcnts2++;
  1084. mthdtims++;
  1085. }
  1086. if(cntpatt1.substring(2,3) == "1" && mthdcnts3 == 0) {
  1087. mthdcnts3++;
  1088. mthdtims++;
  1089. }
  1090. if(cntpatt1.substring(3,4) == "1" && mthdcnts4 == 0) {
  1091. mthdcnts4++;
  1092. mthdtims++;
  1093. }
  1094. if(cntpatt1.substring(4,5) == "1") {
  1095. mthdcnts5++;
  1096. }
  1097. if(mthdtims == 0) {
  1098. mthdtims = mthdcdthree1;
  1099. }
  1100. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  1101. var drugkind2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/drugkindnm");
  1102. var dayno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  1103. var mthd4 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd1");
  1104. var mthd5 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd2");
  1105. var mthd6 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd3");
  1106. //20101229 이선경 수정 : atc구분이 산제아닐때만 단독라벨 적용
  1107. var atc_drugkind = model.getValue("/root/main/lbllist/lbllist["+j+"]/atc_drugkind");
  1108. var mthdcd2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthdcd");
  1109. var mthdcdfive2 = mthdcd2.substring(4,5);
  1110. var cntpatt2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/cntpatt");
  1111. var prcpmixno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpmixno");
  1112. //alert("cntpatt2 : " + cntpatt2);
  1113. //20110102 이선경 수정 : 라벨출력시 묶어주는 기준은 용법코드 5번째자리(식후30분후..)와 일수
  1114. //if((drugkind1 == drugkind2) && (dayno1 == dayno2) && (mthd1 == mthd4 && mthd2 == mthd5 && mthd3 == mthd6)
  1115. // && !(fChkSumcls(j) && atc_drugkind != "p")){
  1116. if(atc_drugkind == "p") {
  1117. if(dayno1 == dayno2 && (mthdcd1 == mthdcd2 || (mthdcdfive1 == "P" && (mthdcd2 == "A11D" || mthdcd2 == "A11DI") ) ) && prcpmixno1 == prcpmixno2) {
  1118. var lblcnts2 = model.getValue("/root/main/lbllist/lbllist["+ j +"]/lblcnts2");
  1119. var totdrugqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty");
  1120. var prcpqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty")/model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
  1121. prcpqty = Math.ceil( prcpqty * tims*1000)/1000 ;
  1122. //alert(model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd")+ " " + model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty")+ " " + model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims" + " " + prcpqty));
  1123. if(lblcnts2.length > 0) {
  1124. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/lblcnts2", model.getValue("/root/main/prnt/lbllist["+iPageCntO+"]/lblcnts2") + "\n" + lblcnts2);
  1125. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/lblcnts2flag", "Y");
  1126. }
  1127. //용법코드의 아침, 점심, 저녁, 취침전 출력
  1128. if(cntpatt2.substring(0,1) == "1" && mthdcnts1 == 0) {
  1129. mthdcnts1++;
  1130. mthdtims++;
  1131. }
  1132. if(cntpatt2.substring(1,2) == "1" && mthdcnts2 == 0) {
  1133. mthdcnts2++;
  1134. mthdtims++;
  1135. }
  1136. if(cntpatt2.substring(2,3) == "1" && mthdcnts3 == 0) {
  1137. mthdcnts3++;
  1138. mthdtims++;
  1139. }
  1140. if(cntpatt2.substring(3,4) == "1" && mthdcnts4 == 0) {
  1141. mthdcnts4++;
  1142. mthdtims++;
  1143. }
  1144. if(cntpatt2.substring(4,5) == "1") {
  1145. mthdcnts5++;
  1146. }
  1147. //용법코드의 최대횟수 출력함
  1148. if(mthdtims == 0) { mthdtims = 1;}
  1149. if(type == "L1") {
  1150. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthdtims+ "회 "+dayno2+"일분");
  1151. } else if(type == "L"){
  1152. if (hostype == "L2") {
  1153. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+mthdtims+ "회 "+dayno2+"일분");
  1154. } else {
  1155. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+mthdtims+ "회 1포씩 "+dayno2+"일분");
  1156. }
  1157. } else if(type == "S") {
  1158. unit = mthddayno + "일 "+mthdtims+ "회 "+dayno+"일분" + "\n";
  1159. }
  1160. var val = totdrugqty
  1161. +" "+model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  1162. if(type == "L1" || type == "L") {
  1163. if(sndprcpcnt > 12) {
  1164. var prePage = iPageCntO;
  1165. iPageCntO++;
  1166. sndprcpcnt = 1;
  1167. model.makeNode("/root/main/prnt/lbllist[" +iPageCntO+ "]");
  1168. model.copyNode("/root/main/prnt/lbllist[" +iPageCntO+ "]", "/root/main/prnt/lbllist["+prePage+"]");
  1169. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/lblcnts2flag", "N");
  1170. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp1", "");
  1171. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp2", "");
  1172. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp3", "");
  1173. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp4", "");
  1174. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp5", "");
  1175. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp6", "");
  1176. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp7", "");
  1177. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp8", "");
  1178. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp9", "");
  1179. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp10", "");
  1180. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp11", "");
  1181. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp12", "");
  1182. }
  1183. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/sndprcp"+sndprcpcnt, val);
  1184. } else if(type == "S") {
  1185. if(sndprcpcnt > 4){
  1186. var prePage = iPageCntO;
  1187. iPageCntO++;
  1188. sndprcpcnt = 1;
  1189. model.makeNode("/root/main/prnt/lbllist[" +iPageCntO+ "]");
  1190. model.copyNode("/root/main/prnt/lbllist[" +iPageCntO+ "]", "/root/main/prnt/lbllist["+prePage+"]");
  1191. }
  1192. if(sndprcpcnt == 1) {
  1193. model.setValue("/root/main/prnt/lbllist["+iPageCntO+"]/prcpnm", val);
  1194. } else {
  1195. model.setValue("/root/main/prnt/lbllist["+iPageCntO+"]/prcpnm", model.getValue("/root/main/prnt/lbllist["+iPageCntO+"]/prcpnm") + "\n" + val);
  1196. }
  1197. }
  1198. sndprcpcnt++;
  1199. iPoint = j;
  1200. } else {
  1201. iPageCntO++;
  1202. iPoint = j - 1;
  1203. break;
  1204. }
  1205. } else if((mthdcdfive1 == mthdcdfive2 && dayno1 == dayno2 && !(fChkSumcls(j) && atc_drugkind != "p") && prcpmixno1 == prcpmixno2)
  1206. || (dayno1 == dayno2 && mthdcdfive1 == "P" && (mthdcd2 == "A11D" || mthdcd2 == "A11DI") && prcpmixno1 == prcpmixno2 ) ) {
  1207. //20110102 이선경 수정 : 라벨출력시 묶어주는 기준은 용법코드 5번째자리(식후30분후..)와 일수
  1208. //예외적으로 일수가 같고 식후30분과 취침전용법은 같이 묶어줌
  1209. var lblcnts2 = model.getValue("/root/main/lbllist/lbllist["+ j +"]/lblcnts2");
  1210. var totdrugqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty");
  1211. var prcpqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty")/model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
  1212. prcpqty = Math.ceil( prcpqty * tims*1000)/1000 ;
  1213. //alert(model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd")+ " " + model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty")+ " " + model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims" + " " + prcpqty));
  1214. if(lblcnts2.length > 0) {
  1215. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/lblcnts2", model.getValue("/root/main/prnt/lbllist["+iPageCntO+"]/lblcnts2") + "\n" + lblcnts2);
  1216. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/lblcnts2flag", "Y");
  1217. }
  1218. //용법코드의 아침, 점심, 저녁, 취침전 출력
  1219. if(cntpatt2.substring(0,1) == "1" && mthdcnts1 == 0) {
  1220. mthdcnts1++;
  1221. mthdtims++;
  1222. }
  1223. if(cntpatt2.substring(1,2) == "1" && mthdcnts2 == 0) {
  1224. mthdcnts2++;
  1225. mthdtims++;
  1226. }
  1227. if(cntpatt2.substring(2,3) == "1" && mthdcnts3 == 0) {
  1228. mthdcnts3++;
  1229. mthdtims++;
  1230. }
  1231. if(cntpatt2.substring(3,4) == "1" && mthdcnts4 == 0) {
  1232. mthdcnts4++;
  1233. mthdtims++;
  1234. }
  1235. //용법코드의 최대횟수 출력함
  1236. if(mthdtims == 0) { mthdtims = 1;}
  1237. if(type == "L1") {
  1238. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthdtims+ "회 "+dayno2+"일분");
  1239. } else if(type == "L"){
  1240. if (hostype == "L2") {
  1241. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+mthdtims+ "회 "+dayno2+"일분");
  1242. } else {
  1243. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+mthdtims+ "회 1포씩 "+dayno2+"일분");
  1244. }
  1245. } else if(type == "S") {
  1246. unit = mthddayno + "일 "+mthdtims+ "회 "+dayno+"일분" + "\n";
  1247. }
  1248. var val = totdrugqty
  1249. +" "+model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  1250. if(type == "L1" || type == "L") {
  1251. if(sndprcpcnt > 12) {
  1252. var prePage = iPageCntO;
  1253. iPageCntO++;
  1254. sndprcpcnt = 1;
  1255. model.makeNode("/root/main/prnt/lbllist[" +iPageCntO+ "]");
  1256. model.copyNode("/root/main/prnt/lbllist[" +iPageCntO+ "]", "/root/main/prnt/lbllist["+prePage+"]");
  1257. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/lblcnts2flag", "N");
  1258. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp1", "");
  1259. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp2", "");
  1260. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp3", "");
  1261. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp4", "");
  1262. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp5", "");
  1263. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp6", "");
  1264. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp7", "");
  1265. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp8", "");
  1266. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp9", "");
  1267. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp10", "");
  1268. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp11", "");
  1269. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp12", "");
  1270. }
  1271. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/sndprcp"+sndprcpcnt, val);
  1272. } else if(type == "S") {
  1273. if(sndprcpcnt > 4){
  1274. var prePage = iPageCntO;
  1275. iPageCntO++;
  1276. sndprcpcnt = 1;
  1277. model.makeNode("/root/main/prnt/lbllist[" +iPageCntO+ "]");
  1278. model.copyNode("/root/main/prnt/lbllist[" +iPageCntO+ "]", "/root/main/prnt/lbllist["+prePage+"]");
  1279. }
  1280. if(sndprcpcnt == 1) {
  1281. model.setValue("/root/main/prnt/lbllist["+iPageCntO+"]/prcpnm", val);
  1282. } else {
  1283. model.setValue("/root/main/prnt/lbllist["+iPageCntO+"]/prcpnm", model.getValue("/root/main/prnt/lbllist["+iPageCntO+"]/prcpnm") + "\n" + val);
  1284. }
  1285. }
  1286. sndprcpcnt++;
  1287. iPoint = j;
  1288. } else {
  1289. iPageCntO++;
  1290. iPoint = j - 1;
  1291. break;
  1292. }
  1293. }
  1294. /*
  1295. 아침, 점심, 저녁, 취침전 찍지 않는 예외 용법
  1296. 1. 횟수 패턴 5번째 자리값이 1인 경우
  1297. 2. 용법코드 4번째 자리값이 E (시간마다) 인 경우
  1298. 3. 용법코드 4번째 자리값이 D (의사지시대로) 인 경우
  1299. 4. 용법코드 5번째 자리값이 Q (의사지시대로) 인 경우
  1300. */
  1301. if(mthdcnts5 > 0 || mthdcd1.substring(3,4) == "E" || (mthdcd1.substring(3,4) == "D" && mthdcnts4 < 1) || mthdcd1.substring(4,5) == "Q") {
  1302. mthdcnts = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2") + " "
  1303. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  1304. } else {
  1305. if(mthdcnts1 > 0) {
  1306. mthdcnts = "아침 ";
  1307. }
  1308. if(mthdcnts2 > 0) {
  1309. mthdcnts += "점심 ";
  1310. }
  1311. if(mthdcnts3 > 0) {
  1312. mthdcnts += "저녁 ";
  1313. }
  1314. if(mthdcdfive1 == "P" ) {
  1315. mthdcnts += "식후30분"; // 20110412_laboru_
  1316. }
  1317. if(mthdcdfive1 == "I" ) {
  1318. mthdcnts += "식후즉시"; // 20110412_laboru_
  1319. }
  1320. if(mthdcdfive1 == "B" ) {
  1321. mthdcnts += "식전10분"; // 20110412_laboru_
  1322. }
  1323. if(mthdcdfive1 == "A" ) {
  1324. mthdcnts += "식전30분"; // 20110412_laboru_
  1325. }
  1326. if(mthdcdfive1 == "C" ) {
  1327. mthdcnts += "식전1시간"; // 20110412_laboru_
  1328. }
  1329. if(mthdcdfive1 == "D" ) {
  1330. mthdcnts += "식전2시간"; // 20110412_laboru_
  1331. }
  1332. if(mthdcdfive1 == "E" ) {
  1333. mthdcnts += "공복"; // 20110412_laboru_
  1334. }
  1335. if(mthdcdfive1 == "M" ) {
  1336. mthdcnts += "식사도중"; // 20110412_laboru_
  1337. }
  1338. if(mthdcdfive1 == "W" ) {
  1339. mthdcnts += "식사와 함께"; // 20110412_laboru_
  1340. }
  1341. if(mthdcdfive1 == "T" ) {
  1342. mthdcnts += "식후2시간"; // 20110412_laboru_
  1343. }
  1344. if(mthdcdfive1 == "F" ) {
  1345. mthdcnts += "식후1시간"; // 20120725_laboru_
  1346. }
  1347. if(mthdcdfive1 == "H" ) {
  1348. mthdcnts += "일어난 직후"; // 20120725_laboru_
  1349. }
  1350. if(mthdcdfive1 == "Q" ) {
  1351. mthdcnts += "의사지시대로"; // 20120725_laboru_
  1352. }
  1353. if(mthdcnts_end == "취침전에") {
  1354. //mthdcnts += mthdcd5nm;
  1355. } else {
  1356. //mthdcnts += mthdcnts_end;
  1357. }
  1358. if(mthdcnts4 > 0) {
  1359. if(mthdcnts != "" ) {
  1360. mthdcnts += "과 취침전에 ";
  1361. } else {
  1362. mthdcnts = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2") + " "
  1363. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  1364. }
  1365. } else {
  1366. mthdcnts += "에 ";
  1367. }
  1368. }
  1369. for(var p = mthdcntsno ; p <= getNodesetCount("/root/main/prnt/lbllist") ; p++){
  1370. if (hostype == "L2") {
  1371. mthdcnts = mthdcnts + " 1포씩 " ;
  1372. }
  1373. model.makeValue("/root/main/prnt/lbllist["+p+"]/mthdcnts", unit + mthdcnts + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"));
  1374. }
  1375. }
  1376. }