SPADT61400.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599
  1. /**
  2. * 파 일 명 : SPADT61400.js
  3. * 설 명 : (팝업)원내봉투출력 Javascriot
  4. * 설 계 자 : 공두경 * 작 성 자 : 공두경
  5. * 수정이력 : 2007.09.20 / 최초작성 / 공두경
  6. */
  7. var sSndMsg = ""; //라벨출력내용
  8. var iPoint = 0; //라벨출력row
  9. var iCnt = 0; //라벨출력매수
  10. var iPageCnt = 1; //페이지번호 조회
  11. /**
  12. * 초기화
  13. */
  14. function fInit() {
  15. var sParam = model.getAttribute("params");
  16. model.makeValue("/root/send/prcpinfo/drugdd", astfMatrixData(sParam, 1, 0));
  17. model.makeValue("/root/send/prcpinfo/drugno", astfMatrixData(sParam, 1, 1));
  18. model.makeValue("/root/send/prcpinfo/ioflag", astfMatrixData(sParam, 1, 2));
  19. model.makeValue("/root/send/prcpinfo/lblflag", astfMatrixData(sParam, 1, 3));
  20. model.makeValue("/root/send/prcpinfo/liquidflag", astfMatrixData(sParam, 1, 4));
  21. model.makeValue("/root/send/prcpinfo/reprintyn", astfMatrixData(sParam, 1, 5));
  22. model.makeValue("/root/send/prcpinfo/autoinprntyn", astfMatrixData(sParam, 1, 6));
  23. model.makeValue("/root/send/prcpinfo/atclblyn", astfMatrixData(sParam, 1, 8));
  24. model.makeValue("/root/send/prcpinfo/prntflag", "O");
  25. model.refresh();
  26. submit("TRADT61301");
  27. //fLBLPrint_knu("B");
  28. fLBLPrint();
  29. model.refresh();
  30. window.close();
  31. }
  32. /**
  33. *
  34. */
  35. function fStopTimer() {
  36. window.clearinterval(gTimer);
  37. }
  38. function fSleep(numberMillis) {
  39. var now = new Date();
  40. var exitTime = now.getTime() + numberMillis;
  41. while (true) {
  42. now = new Date();
  43. if (now.getTime() > exitTime)
  44. return;
  45. }
  46. }
  47. /**
  48. * 라벨출력
  49. */
  50. function fLBLPrint() {
  51. /*
  52. 라벨 Sorting 로직
  53. //mgt에서 vo로 리턴
  54. 대분류
  55. - 내복약, 외용약, 주사, 항암제, TPN, 마약,
  56. 중분류
  57. - 방법코드
  58. 소분류
  59. - 내복약,외용약(방법코드), 주사,마약,항암제(mix)
  60. web js 출력로직
  61. 1 약종류(내복약/주사약/외용약)
  62. 1.1 방법코드
  63. 1.2 처방수량
  64. */
  65. PrnKind = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/prntkind");
  66. PrnMarginLeft = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/blank/left");
  67. PrnMarginTop = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/blank/top");
  68. var commkind = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/commkind");
  69. for(iPoint = 1; iPoint <= getNodesetCount("/root/main/lbllist/lbllist") ; iPoint++){
  70. // 20110519_laboru_라벨출력여부에 따라
  71. var lblprntyn = model.getValue("/root/main/lbllist/lbllist["+ iPoint+"]/lblprntyn");
  72. if(lblprntyn == "N") {
  73. model.removeNodeset("/root/main/lbllist/lbllist["+ iPoint +"]");
  74. } else {
  75. var sumcls = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sumcls");
  76. var mthdcd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcd");
  77. var prcpmixno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpmixno"); // 20110414_laboru_경북대병원_분리번호가 단독 여부보다 먼저 체크 되어야 함.
  78. //var prcpmixno2 = model.getValue("/root/main/lbllist/lbllist["+parseInt(iPoint) + parseInt(1) +"]/prcpmixno"); // 20110414_laboru_경북대병원_분리번호가 단독 여부보다 먼저 체크 되어야 함.
  79. var atc_kind = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/atc_drugkind");
  80. if (mthdcd == "ZZZ" || mthdcd == "A10PQ") { //기타용법이거나 '필요시 복용하십시오' 용법인 경우도 단독라벨출력
  81. sumcls = mthdcd;
  82. }
  83. //alert(fChkSumcls(iPoint));
  84. if( fChkSumcls(iPoint) ){
  85. //단독라벨출력
  86. fIndependPrint();
  87. } else {
  88. //일반라벨출력
  89. fGnrlPrint();
  90. }
  91. }
  92. }
  93. iPageCnt = 0;
  94. makeReportPreview(0,0,10, 10, "");
  95. model.makeNode("/root/main/barcdprntsetup/prntsetupinfo");
  96. model.copyNode("/root/main/barcdprntsetup/prntsetupinfo","/root/init/barcdprntsetup/prntsetupinfo");
  97. fPrintRexbar("RFADT61400");
  98. model.refresh();
  99. }
  100. /**
  101. *
  102. */
  103. function fIndependPrint() {
  104. model.makeNode("/root/main/prnt/lbllist[" +iPageCnt+ "]");
  105. model.copyNode("/root/main/prnt/lbllist[" +iPageCnt+ "]", "/root/main/lbllist/lbllist["+iPoint+"]");
  106. var drugkindnm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  107. var qty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqty");
  108. var dayqty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayprcpqty");
  109. var qtyunit = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqtyunit");
  110. var tims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  111. var dayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno"); //처방일수
  112. var mthddayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayno"); //용법일수
  113. var packunit = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/packunit"); //약품마스터의 수량단위
  114. var modprcpqty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/modprcpqty"); // 20110425_laboru_수정된 1일 수량
  115. if(mthddayno == "" || mthddayno == 0) { mthddayno = 1;}
  116. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/drugmthd", tims+"회 "+(dayno*mthddayno)+"일분");
  117. if (drugkindnm == "[주사약]"){
  118. model.setValue("/root/main/prnt/lbllist["+iPageCnt+"]/drugkindnm", "주사");
  119. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/drugmthddesc", model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"));
  120. } else if (drugkindnm == "[외용약]"){
  121. model.setValue("/root/main/prnt/lbllist["+iPageCnt+"]/drugkindnm", "외용");
  122. var val = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2")
  123. + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  124. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/drugmthddesc", val);
  125. } else if (drugkindnm == "[내복약]"){
  126. model.setValue("/root/main/prnt/lbllist["+iPageCnt+"]/drugkindnm", "내복");
  127. var val = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2") + " "
  128. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3") ;
  129. var strchk = val.substring(val.length - 1, val.length);
  130. //alert(strchk);
  131. if(strchk == "후" || strchk == "시" || strchk == "간" || strchk == "중" || strchk == "분") {
  132. val += "에 ";
  133. } else {
  134. val += " ";
  135. }
  136. var sumcls = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sumcls");
  137. if(modprcpqty != qty) {
  138. qty = modprcpqty; // 20110425_laboru_경북대병원_원처방 수량과 수정된 처방 수량이 다르면 수정된 것으로 출력함
  139. }
  140. if( sumcls == "DM" || sumcls == "DS" || sumcls == "DT" || sumcls == "DX" || sumcls == "DG" ){ //20091110 이선경 수정 : 라벨그룹이 마약(경구), 수제, ptp, 기타약일경우 약품마스터의 수량단위를 출력 20110512_laboru_pack 추가
  141. var tmpqty = Math.round(qty * 10) / 10;
  142. if(packunit == "T" || packunit == "C") {
  143. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/drugmthddesc", val + " " +fChkFloat(qty)+"정씩 " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"));
  144. } else {
  145. if(packunit == "cap" || packunit == "tab") {
  146. packunit = "알"; // 20110413_laboru_경북대병원_단위가 cap, tab 일때 알로 바꾸기
  147. }
  148. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/drugmthddesc", val + " " +fChkFloat(tmpqty)+ packunit +"씩 " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"));
  149. }
  150. } else {
  151. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/drugmthddesc", val + " " +fChkFloat(qty)+"포[정]씩 " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"));
  152. }
  153. }
  154. var lblcnts1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/lblcnts1");
  155. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/lblcnts1", lblcnts1);
  156. var prcpqty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/totdrugqty")/model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  157. prcpqty = Math.ceil( prcpqty * tims*1000)/1000 ;
  158. var val = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm") + " "
  159. + qty + " " +
  160. + tims + " " +
  161. + dayno + " " +
  162. + Math.round(qty*tims*dayno*1000)/1000 ;
  163. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/drug1", val);
  164. iPageCnt++;
  165. }
  166. /**
  167. *
  168. */
  169. function fGnrlPrint() {
  170. model.makeNode("/root/main/prnt/lbllist[" +iPageCnt+ "]");
  171. model.copyNode("/root/main/prnt/lbllist[" +iPageCnt+ "]", "/root/main/lbllist/lbllist["+iPoint+"]");
  172. var drugkindnm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  173. var qty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqty");//회수량
  174. var dayqty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayprcpqty");//일수량
  175. var qtyunit = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqtyunit");//수량단위
  176. var tims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");//횟수
  177. var dayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno"); //처방일수
  178. var mthddayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayno"); //용법일수
  179. var packunit = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/packunit"); //약품마스터의 수량단위
  180. var drugkind1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  181. var dayno1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");
  182. var mthd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd1");
  183. var mthd2 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd2");
  184. var mthd3 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd3");
  185. var mthdcd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcd");
  186. var mthdcdfive1 = mthdcd1.substring(4,5);
  187. var mthdcdthree1 = 0;
  188. var cntpatt1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/cntpatt");
  189. var mthdcntsno = iPageCnt;
  190. var mthdcnts_end = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  191. var mthdcd5nm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcd5nm"); //약품코드5번째자리명칭 (용법세분류)
  192. var prcpmixno1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpmixno");
  193. if (drugkindnm == "[주사약]"){
  194. model.setValue("/root/main/prnt/lbllist["+iPageCnt+"]/drugkindnm", "주사");
  195. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/drugmthddesc", model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"));
  196. if(mthddayno == "" || mthddayno == 0) { mthddayno = 1;}
  197. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/drugmthd", tims+"회 "+(dayno*mthddayno)+"일분");
  198. } else if (drugkindnm == "[외용약]"){
  199. model.setValue("/root/main/prnt/lbllist["+iPageCnt+"]/drugkindnm", "외용");
  200. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/drugmthddesc", model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2")
  201. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"));
  202. if(mthddayno == "" || mthddayno == 0) { mthddayno = 1;}
  203. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/drugmthd", tims+"회 "+(dayno*mthddayno)+"일분");
  204. } else if (drugkindnm == "[내복약]"){
  205. model.setValue("/root/main/prnt/lbllist["+iPageCnt+"]/drugkindnm", "내복");
  206. var lbltims =0;
  207. var mthdcnts = "";
  208. var mthdcnts1 = 0; //아침
  209. var mthdcnts2 = 0; //점심
  210. var mthdcnts3 = 0; //저녁
  211. var mthdcnts4 = 0; //취침전
  212. var mthdcnts5 = 0; //특수용법
  213. var mthdtims = 0; //용법횟수
  214. lbl_tims = mthd2.split(",");
  215. if ( mthdcd1 == "ZZZ" ){
  216. lbltims = tims;
  217. } else if ( mthd3.indexOf("취침") > -1 ) {
  218. lbltims = lbl_tims.length +1;
  219. } else if(mthd2.indexOf("마다") > -1){
  220. lbltims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  221. } else {
  222. lbltims = lbl_tims.length;
  223. }
  224. tims = lbltims;
  225. if(mthddayno == "" || mthddayno == 0) { mthddayno = 1;};
  226. //var val = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2") + " "
  227. // + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3") ;
  228. if(lbltims == 1) {
  229. if(mthd2.indexOf("마다") == -1) {
  230. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/drugmthd", lbltims+ "회 " +(dayno * mthddayno)+"일분");
  231. } else {
  232. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/drugmthd", tims+ "회 " +(dayno*mthddayno)+"일분");
  233. }
  234. } else {
  235. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/drugmthd", lbltims+ "회 " +(dayno*mthddayno)+"일분");
  236. }
  237. mthdcnts_end = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  238. if(cntpatt1.substring(0,1) == "1" && mthdcnts1 == 0) {//아침
  239. mthdcnts1++;
  240. mthdtims++;
  241. }
  242. if(cntpatt1.substring(1,2) == "1" && mthdcnts2 == 0) {//점심
  243. mthdcnts2++;
  244. mthdtims++;
  245. }
  246. if(cntpatt1.substring(2,3) == "1" && mthdcnts3 == 0) {//저녁
  247. mthdcnts3++;
  248. mthdtims++;
  249. }
  250. if(cntpatt1.substring(3,4) == "1" && mthdcnts4 == 0) {//취침전
  251. mthdcnts4++;
  252. mthdtims++;
  253. }
  254. if(cntpatt1.substring(4,5) == "1") {//특수용법
  255. mthdcnts5++;
  256. }
  257. if(mthdtims == 0) {
  258. mthdtims = tims;
  259. }
  260. var drugcnt = 1;
  261. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  262. var drugkind2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/drugkindnm");
  263. var dayno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  264. var mthd4 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd1");
  265. var mthd5 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd2");
  266. var mthd6 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd3");
  267. var mthdcd2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthdcd");
  268. var atc_drugkind = model.getValue("/root/main/lbllist/lbllist["+j+"]/atc_drugkind");
  269. var mthdcdfive2 = mthdcd2.substring(4,5);
  270. var prcptims = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
  271. var cntpatt2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/cntpatt");
  272. var qty = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqty"); // 20110413_laboru_경북대병원 1 회수량
  273. var prcpmixno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpmixno");
  274. //if((drugkind1 == drugkind2) && (dayno1 == dayno2) && (mthd1 == mthd4 && mthd2 == mthd5 && mthd3 == mthd6)
  275. // && !fChkSumcls(j)){
  276. if( atc_drugkind == "p") {
  277. if(dayno1 == dayno2 && (mthdcd1 == mthdcd2 || (mthdcdfive1 == "P" && (mthdcd2 == "A11D" || mthdcd2 == "A11DI") ) ) && prcpmixno1 == prcpmixno2) {
  278. //20110102 이선경 수정 : 라벨출력시 묶어주는 기준은 용법코드 5번째자리(식후30분후..)와 일수
  279. //예외적으로 일수가 같고 식후30분과 취침전용법은 같이 묶어줌
  280. var prcpqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty")/model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
  281. prcpqty = Math.ceil( prcpqty * tims*1000)/1000 ;
  282. //용법코드의 아침, 점심, 저녁, 취침전 출력
  283. if(cntpatt2.substring(0,1) == "1" && mthdcnts1 == 0) {
  284. mthdcnts1++;
  285. mthdtims++;
  286. }
  287. if(cntpatt2.substring(1,2) == "1" && mthdcnts2 == 0) {
  288. mthdcnts2++;
  289. mthdtims++;
  290. }
  291. if(cntpatt2.substring(2,3) == "1" && mthdcnts3 == 0) {
  292. mthdcnts3++;
  293. mthdtims++;
  294. }
  295. if(cntpatt2.substring(3,4) == "1" && mthdcnts4 == 0) {
  296. mthdcnts4++;
  297. mthdtims++;
  298. }
  299. //용법코드의 최대횟수 출력함
  300. if(mthdtims == 0) { mthdtims = 1;}
  301. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/drugmthd", mthdtims+ "회 " +(dayno*mthddayno)+"일분");
  302. var val = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm") + " "
  303. + qty + " " +
  304. + prcptims + " " +
  305. + dayno2 + " " +
  306. + Math.round(qty*prcptims*dayno2*1000)/1000 ;
  307. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/drug" + drugcnt, val);
  308. drugcnt++;
  309. iPoint = j;
  310. } else {
  311. iPageCnt++;
  312. iPoint = j - 1;
  313. break;
  314. }
  315. } else if((mthdcdfive1 == mthdcdfive2 && dayno1 == dayno2 && !( fChkSumcls(j) && atc_drugkind != "p") && prcpmixno1 == prcpmixno2) // fChkSumcls(j) &&
  316. || (dayno1 == dayno2 && mthdcdfive1 == "P" && (mthdcd2 == "A11D" || mthdcd2 == "A11DI") && prcpmixno1 == prcpmixno2) ) { // 20110412_laboru_경북대병원_아침 식후 30분 + 취침전
  317. // || (dayno1 == dayno2 && mthdcdfive2 == "P" && mthdcd1 == "A11D" && prcpmixno1 == prcpmixno2) ) { // 20110412_laboru_경북대병원_취침전 + 아침 식후 30분
  318. //20110102 이선경 수정 : 라벨출력시 묶어주는 기준은 용법코드 5번째자리(식후30분후..)와 일수
  319. //예외적으로 일수가 같고 식후30분과 취침전용법은 같이 묶어줌
  320. var prcpqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty")/model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
  321. prcpqty = Math.ceil( prcpqty * tims*1000)/1000 ;
  322. //용법코드의 아침, 점심, 저녁, 취침전 출력
  323. if(cntpatt2.substring(0,1) == "1" && mthdcnts1 == 0) {
  324. mthdcnts1++;
  325. mthdtims++;
  326. }
  327. if(cntpatt2.substring(1,2) == "1" && mthdcnts2 == 0) {
  328. mthdcnts2++;
  329. mthdtims++;
  330. }
  331. if(cntpatt2.substring(2,3) == "1" && mthdcnts3 == 0) {
  332. mthdcnts3++;
  333. mthdtims++;
  334. }
  335. if(cntpatt2.substring(3,4) == "1" && mthdcnts4 == 0) {
  336. mthdcnts4++;
  337. mthdtims++;
  338. }
  339. //용법코드의 최대횟수 출력함
  340. if(mthdtims == 0) { mthdtims = 1;}
  341. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/drugmthd", mthdtims+ "회 " +(dayno*mthddayno)+"일분");
  342. var val = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm") + " "
  343. + qty + " " +
  344. + prcptims + " " +
  345. + dayno2 + " " +
  346. + Math.round(qty*prcptims*dayno2*1000)/1000 ;
  347. model.makeValue("/root/main/prnt/lbllist[" +iPageCnt+ "]/drug" + drugcnt, val);
  348. drugcnt++;
  349. iPoint = j;
  350. } else {
  351. iPageCnt++;
  352. iPoint = j - 1;
  353. break;
  354. }
  355. if(drugcnt == 17){
  356. iPageCnt++;
  357. iPoint = j - 1;
  358. break;
  359. }
  360. }
  361. /*
  362. 아침, 점심, 저녁, 취침전 찍지 않는 예외 용법
  363. 1. 횟수 패턴 5번째 자리값이 1인 경우
  364. 2. 용법코드 4번째 자리값이 E (시간마다) 인 경우
  365. 3. 용법코드 4번째 자리값이 D (의사지시대로) 인 경우
  366. 4. 용법코드 5번째 자리값이 Q (의사지시대로) 인 경우
  367. */
  368. if(mthdcnts5 > 0 || mthdcd1.substring(3,4) == "E" || (mthdcd1.substring(3,4) == "D" && mthdcnts4 < 1) || mthdcd1.substring(4,5) == "Q") {
  369. mthdcnts = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2") + " "
  370. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  371. }
  372. /*if(mthdcdfive1 == "P" && prcpmixno1 != "-") {
  373. mthdcnts = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2") + " "
  374. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  375. } */
  376. else {
  377. if(mthdcnts1 > 0) {
  378. mthdcnts = "아침 ";
  379. }
  380. if(mthdcnts2 > 0) {
  381. mthdcnts += "점심 ";
  382. }
  383. if(mthdcnts3 > 0) {
  384. mthdcnts += "저녁 ";
  385. }
  386. if(mthdcdfive1 == "P" ) {
  387. mthdcnts += "식후30분"; // 20110412_laboru_
  388. }
  389. if(mthdcdfive1 == "I" ) {
  390. mthdcnts += "식후즉시"; // 20110412_laboru_
  391. }
  392. if(mthdcdfive1 == "B" ) {
  393. mthdcnts += "식전10분"; // 20110412_laboru_
  394. }
  395. if(mthdcdfive1 == "A" ) {
  396. mthdcnts += "식전30분"; // 20110412_laboru_
  397. }
  398. if(mthdcdfive1 == "C" ) {
  399. mthdcnts += "식전1시간"; // 20110412_laboru_
  400. }
  401. if(mthdcdfive1 == "D" ) {
  402. mthdcnts += "식전2시간"; // 20110412_laboru_
  403. }
  404. if(mthdcdfive1 == "E" ) {
  405. mthdcnts += "공복"; // 20110412_laboru_
  406. }
  407. if(mthdcdfive1 == "M" ) {
  408. mthdcnts += "식사도중"; // 20110412_laboru_
  409. }
  410. if(mthdcdfive1 == "W" ) {
  411. mthdcnts += "식사와 함께"; // 20110412_laboru_
  412. }
  413. if(mthdcdfive1 == "T" ) {
  414. mthdcnts += "식후2시간"; // 20110412_laboru_
  415. }
  416. if(mthdcnts_end == "취침전에") {
  417. //mthdcnts += mthdcd5nm;
  418. } else {
  419. //mthdcnts += mthdcnts_end;
  420. }
  421. if(mthdcnts4 > 0) {
  422. if(mthdcnts != "" ) {
  423. mthdcnts += "과 취침전에 ";
  424. } else {
  425. mthdcnts = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2") + " "
  426. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  427. }
  428. } else {
  429. mthdcnts += "에 ";
  430. }
  431. }
  432. for(var p = mthdcntsno ; p <= getNodesetCount("/root/main/prnt/lbllist") ; p++){
  433. //alert(p + " " + getNodesetCount("/root/main/prnt/lbllist") + "/////" + mthdcnts);
  434. if(mthdcnts == "") {
  435. model.makeValue("/root/main/prnt/lbllist[" +p+ "]/drugmthddesc", model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2") + " "
  436. +model.getValue("/root/main/lbllist/lbllist["+p+"]/mthdcnts3") + model.getValue("/root/main/lbllist/lbllist["+p+"]/mthdcnts4"));
  437. } else {
  438. model.makeValue("/root/main/prnt/lbllist[" +p+ "]/drugmthddesc", mthdcnts + " 1포씩 " + model.getValue("/root/main/lbllist/lbllist["+p+"]/mthdcnts4"));
  439. }
  440. }
  441. mthdcnts = "";
  442. }
  443. }
  444. /**
  445. *
  446. */
  447. function fGetImage() {
  448. var pImage = "";
  449. iImageCnt++;
  450. if(iImageCnt > 99){
  451. pImage = "GRAPH"+iImageCnt;
  452. } else if(iImageCnt > 9){
  453. pImage = "GRAPH0"+iImageCnt;
  454. } else {
  455. pImage = "GRAPH00"+iImageCnt;
  456. }
  457. return pImage
  458. }
  459. /**
  460. *
  461. */
  462. function fDateFormat(sDD) {
  463. return sDD.substr(0,4)+"/"+sDD.substr(4,2)+"/"+sDD.substr(6,2);
  464. }
  465. /**
  466. *
  467. */
  468. function fChkFloat(qty) {
  469. var fQty = parseFloat(qty);
  470. var fRst = "";
  471. if(fQty%1 == 0){
  472. fRst = parseInt(qty);
  473. } else {
  474. fRst = qty;
  475. }
  476. return fRst;
  477. }
  478. /**
  479. *
  480. */
  481. function fChkSumcls(cnt) {
  482. var chk = false;
  483. var sSumcls = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/sumcls");
  484. var sSnglyn = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/atcifsnglyn");
  485. var sDrugindependpackflag = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/drugindependpackflag");
  486. if(sSumcls == "DI" || sSumcls == "DS"|| sSumcls == "DX"|| sSumcls == "DT" || sSumcls == "DM" || sSumcls == "IH"|| sSumcls == "IO" || sSumcls == "DG" //20110512_laboru_pack 추가
  487. || sSumcls == "IS"|| sSumcls == "IX"|| sSumcls == "X" || sSumcls == "ZZZ" || sSumcls == "A10PQ" || sSumcls == "I"){
  488. chk = true;
  489. }
  490. if ( sSumcls == "D" && sSnglyn =="Y" ) {
  491. chk = true;
  492. }
  493. if ( sDrugindependpackflag =="Y"){
  494. chk = true;
  495. }
  496. return chk;
  497. }
  498. function fPrntTime(sDD, sTM) {
  499. if(PrnKind == "2") {
  500. return sDD.substr(4,2)+"/"+sDD.substr(6,2)+" "+sTM.substr(0,2)+":"+sTM.substr(2,2)+":"+sTM.substr(4,2);
  501. } else {
  502. return sDD.substr(4,2)+" / "+sDD.substr(6,2)+" "+sTM.substr(0,2)+":"+sTM.substr(2,2)+":"+sTM.substr(4,2);
  503. }
  504. }