SPADT62304.js 61 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680
  1. /**
  2. * 파 일 명 : SPADT62300.js
  3. * 설 명 : (팝업)병동라벨출력 Javascriot
  4. * 설 계 자 : 공두경
  5. * 작 성 자 : 공두경
  6. * 수정이력 : 2007.09.17 / 최초작성 / 공두경
  7. */
  8. var sSndMsg = ""; //라벨출력내용
  9. var iPoint = 1; //라벨출력row
  10. var iCnt = 0; //라벨출력매수
  11. var iImageCnt = 0; //라벨그래픽폰트수
  12. var gTimer = null;
  13. var pg =0;
  14. var totpg =0;
  15. var totcnt =0;
  16. var ordflag = "";
  17. var bordflag = "";
  18. var vcnt = 0;
  19. var nCnt = 0;
  20. var vlblcnt = false;
  21. var mlblcnt = false;
  22. var nextPage = false;
  23. /**
  24. * 초기화
  25. */
  26. function fInit() {
  27. //window.minimize();
  28. var sParam = model.getAttribute("params");
  29. model.makeValue("/root/send/prcpinfo/drugdd", astfMatrixData(sParam, 1, 0));
  30. model.makeValue("/root/send/prcpinfo/drugno", astfMatrixData(sParam, 1, 1));
  31. model.makeValue("/root/send/prcpinfo/ioflag", astfMatrixData(sParam, 1, 2));
  32. model.makeValue("/root/send/prcpinfo/prcpdd", astfMatrixData(sParam, 1, 3));
  33. model.makeValue("/root/send/prcpinfo/orddd", astfMatrixData(sParam, 1, 4));
  34. model.makeValue("/root/send/prcpinfo/cretno", astfMatrixData(sParam, 1, 5));
  35. model.makeValue("/root/send/prcpinfo/prcpgenrflag", astfMatrixData(sParam, 1, 6));
  36. model.makeValue("/root/send/prcpinfo/pid", astfMatrixData(sParam, 1, 7));
  37. model.makeValue("/root/send/prcpinfo/orddeptcd", astfMatrixData(sParam, 1, 8));
  38. model.makeValue("/root/send/prcpinfo/wardcd", astfMatrixData(sParam, 1, 9));
  39. model.makeValue("/root/send/prcpinfo/lblflag", astfMatrixData(sParam, 1, 10));
  40. model.makeValue("/root/send/prcpinfo/prcpflag", astfMatrixData(sParam, 1, 11));
  41. model.makeValue("/root/send/prcpinfo/prntflag", astfMatrixData(sParam, 1, 12));
  42. model.makeValue("/root/send/prcpinfo/liquidflag", astfMatrixData(sParam, 1, 13));
  43. model.makeValue("/root/send/prcpinfo/etcdescflag", astfMatrixData(sParam, 1, 14));
  44. model.makeValue("/root/send/prcpinfo/lblkind", astfMatrixData(sParam, 1, 15));
  45. model.makeValue("/root/send/prcpinfo/outlblyn", astfMatrixData(sParam, 1, 16));
  46. model.makeValue("/root/send/prcpinfo/ptplblyn", astfMatrixData(sParam, 1, 17));
  47. model.makeValue("/root/send/prcpinfo/reprintyn", astfMatrixData(sParam, 1, 18));
  48. model.makeValue("/root/send/prcpinfo/lbltype", astfMatrixData(sParam, 1, 19));
  49. model.makeValue("/root/send/prcpinfo/drugkind", astfMatrixData(sParam, 1, 20));
  50. model.makeValue("/root/send/prcpinfo/autolblyn", astfMatrixData(sParam, 1, 21));
  51. model.refresh();
  52. submit("TRADT62301");
  53. if(model.getValue("/root/main/lbllist/lbllist["+1+"]/drugkindnm") != ""){
  54. if(model.getValue("/root/send/prcpinfo/liquidflag") == "Y" || model.getValue("/root/send/prcpinfo/outlblyn") == "Y"){
  55. fLiquidLBLPrint();
  56. } else if(model.getValue("/root/main/lbllist/lbllist["+1+"]/drugflag") == "E" || model.getValue("/root/main/lbllist/lbllist["+1+"]/drugflag") == "L"
  57. || model.getValue("/root/main/lbllist/lbllist["+1+"]/drugflag") == "G"){
  58. fBigLBLPrint();
  59. } else {
  60. fSmallLBLPrint();
  61. }
  62. }
  63. model.refresh();
  64. gTimer = window.setInterval("fStopTimer()",10000);
  65. window.close();
  66. }
  67. /**
  68. *
  69. */
  70. function fStopTimer() {
  71. window.clearinterval(gTimer);
  72. }
  73. function fSleep(numberMillis) {
  74. var now = new Date();
  75. var exitTime = now.getTime() + numberMillis;
  76. while (true) {
  77. now = new Date();
  78. if (now.getTime() > exitTime)
  79. return;
  80. }
  81. }
  82. /**
  83. * 병동 라벨출력(작은사이즈)
  84. */
  85. function fSmallLBLPrint() {
  86. /*
  87. 라벨 Sorting 로직
  88. //mgt에서 vo로 리턴
  89. 대분류
  90. - 내복약, 외용약, 주사, 항암제, TPN, 마약,
  91. 중분류
  92. - 방법코드
  93. 소분류
  94. - 내복약,외용약(방법코드), 주사,마약,항암제(mix)
  95. web js 출력로직
  96. 가. 퇴원/외래/응급실/외박/외출 : 큰사이즈라벨
  97. 외래기준
  98. 나. 그외 입원처방
  99. 1. 외용약
  100. 단독출력
  101. 2. 내복약
  102. 단독출력
  103. 따로포장
  104. 복용방법
  105. 3. 주사약
  106. 단독출력
  107. mix끼리
  108. 고가,향정,보관벙법이 실온이 아닌경우 자가주사인 경우 단독
  109. 나머지
  110. */
  111. // Comm 설정
  112. //CommAX.CommPort = "1"; // 출력 Port
  113. //CommAX.Settings = "9600,n,8,1"; // Comm 설정
  114. //CommAX.Settings = "127.0.0.1"; // Comm 설정
  115. PrnKind = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/prntkind");
  116. PrnMarginLeft = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/blank/left");
  117. PrnMarginTop = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/blank/top");
  118. var commkind = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/commkind")
  119. if ( PrnKind ==7 ) {
  120. CommAX.PrnKind =4;
  121. } else {
  122. CommAX.PrnKind =PrnKind;
  123. }
  124. if(commkind == "02") {
  125. CommAX.PortNm = 1;
  126. } else {
  127. CommAX.PortNm = 2;
  128. }
  129. if(commkind == "01") {
  130. CommAX.PrtNm = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/comm01/setupval");
  131. }
  132. //if ( CommAX.PortOpen() == true) {
  133. //alert("라벨 프린트 Open");
  134. //CommAX.SendMessage("^XA^SEE:UHANGUL.DAT^FS^CWQ,E:AAAAA.FNT^FS^CI26^FO100,50^AQN,40,40^FD이훈재ABCDEFGHI1234^FS^FO100,100^AQN,40,40^FD(주)한글인쇄테스트ABCDEFGHI1234^FS^FO100,150^AQN,40,40^FD A B C D E F G H I^FS^CI0^FO100,200^A0,50,50^FDPRINTING TEST^FS^FO100,250^BY2^B3N,N,100,Y,N,N^FD1232423423^FS^XZ");
  135. //CommAX.SendMessage("^XA^LH0,0^PRB^CF0,89^FO10,05^FDSH07^FS^CF0,70^FO260,05^FD10/10^FS^CF0,89^FO50,80^FD- 234567^FS^CFA20,20^FO10,150^FD1234567890^FS~DGGRAPH001,00504,021,0078000000E00000800000F01E000C00201FFC0000003C0000007007FFC00000F01E000C00201FFC000000006000003003000000C0701C00180060180C03000FFFF00FFE3003000000C0701C00180060180C0300061000061C300300000300783C003001E0101800C0007E000018300300C00300783C003001E0101800C000C30000303001FFE006006C6C006003600018006001818000603000180006006C6C006003600018006000C30000C03000180004006C6C00C0066000300020007E0001803000180004006C6C00C006600030002000180003003000181E0C0066CC0180186000600030001800060030FFFFFF0C0066CC018018600060003000181E1800207000000C00638C0300306000C00030FFFFFF0000000000000C00638C0300306000C000307000000000000000000400638C060060600180002000000000FFF00038000400638C0600606001800020007E00006060007E000600610C0C007FFC0180006000C30000006000C3000600610C0C007FFC018000600181800000400181800300600C18000060018000C001818000FFE00181800300600C18000060018000C001818000600001818000C0F03E300001F80180030000C30000600000C30000C0F03E300001F801800300007E00006060007E00000000000000000000000000003800003FF0003800000000000000000000000000^FO140,150^XGGRAPH001,1,1^FS~DGGRAPH002,00216,009,0000700000000001C00000380000000000E00000180000000000600000180000000000600FFF1807FFE0000060060E180300C03FFC60001C180000C0181C60003018000080001C600060180FFFC000186000D018070000001860018C180300000C18600307180300C006106606031801FFE006207F18001800000006006000001801860006036000001800C300061C6000001000C300FFE06000E00000C30070006000300000C31E000060003000FFFFFF000060003000700000000060003018000000000060001FFC000000000060000000000000000040^FO320,150^XGGRAPH002,1,1^FS^CFA20,20^FO10,180^FD2007-04-25^FS~DGGRAPH003,00240,010,002001E00000E0000080002001E000007007FFC0006006380000300300000060063800303003000001E00C1830183003000001E00C181818300300C003600800181BF001FFE0036008001FF830001800066018001818300018000660180018183000180018601BF0181BF000181E18601BF01FF830FFFFFF30601C1810103070000030601C180000200000006060180C0000000000006060180C0007000038007FFC0C0C000FC0007E007FFC0C0C00186000C30000600E1800303001818000600E1800303001818001F803E000303001818001F803E000186000C30000000000000FC0007E0000000000000700003800^FO140,180^XGGRAPH003,1,1^FS^CFE10,10^FO10,210^FDStomach 2/10^FS^CFA20,20^FO10,240^FDBiopsh^FS^PQ1^XZ");
  136. //CommAX.PortClose();
  137. //return;
  138. var sDD = getCurrentDate();
  139. var sTM = getCurrentTime();
  140. var reprint ="";
  141. for ( var i = 1; i <= getNodesetCount("/root/main/lbllist/lbllist") ; i++){
  142. if ( model.getValue("/root/main/lbllist/lbllist["+i+"]/lblgrup") != "DI" && model.getValue("/root/main/lbllist/lbllist["+i+"]/lblgrup") != "DS" ){
  143. totcnt++;
  144. }
  145. }
  146. // 2010.02.12 pymi
  147. if( parseInt(totcnt%6) != 0) totcnt ++; // 라벨찍기 전에 한줄 띄우기
  148. for ( var i = 1; i <= getNodesetCount("/root/main/lbllist/lbllist") ; i++){
  149. if(model.getValue("/root/main/lbllist/lbllist["+ i +"]/lblcnts2").length > 0) { totcnt++; vlblcnt = true;}
  150. }
  151. // (e)
  152. for(iPoint = 1; iPoint <= getNodesetCount("/root/main/lbllist/lbllist") ; iPoint++){
  153. if ( model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/lblprnttims")>0 ){
  154. reprint ="(재)";
  155. }
  156. //시작(X, Y)
  157. sSndMsg += astfStartFormat(0, 0, "S");
  158. //라벨이름(내복약/주사약/마약)
  159. sSndMsg += astfPrintOut(20, 25, 21, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm"),"");
  160. //if(PrnKind == "2" || PrnKind == "7") {
  161. //출력일자
  162. sSndMsg += astfPrintOut(190, 25, 21, "출력:"+fPrntTime(sDD, sTM),"");
  163. //출력일자
  164. sSndMsg += astfPrintOut(190, 55, 21, "처방:"+fDateFormat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd"), "MD"),"");
  165. //} else {
  166. //출력일자
  167. // sSndMsg += astfPrintOut(220, 25, 21, "출 력 : "+fPrntTime(sDD, sTM),"");
  168. //출력일자
  169. // sSndMsg += astfPrintOut(220, 55, 21, "처 방 : "+fDateFormat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd"), "MD"),"");
  170. //}
  171. //병실
  172. sSndMsg += astfPrintOut(20, 80, 31, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/roomcd"),"");
  173. //환자이름
  174. sSndMsg += astfPrintOut(120, 80, 31, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/patnm"),"");
  175. //환자번호
  176. sSndMsg += astfPrintOut(240, 80, 31, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/pid")+" ("+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugno")+reprint+")","");
  177. //선그리기
  178. sSndMsg += astfGraphicBox(5, 120, 465, 0, 4);
  179. var sDrugKindcd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  180. var sMixno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpmixno");
  181. if(sDrugKindcd == "[내복약]"){
  182. if(model.getValue("/root/send/prcpinfo/lbltype") == "Y"){
  183. fInUseDrugLBL2();
  184. // 2010.02.12 pymi
  185. //if((vcnt < 6) && (vlblcnt) && (iPoint == getNodesetCount("/root/main/lbllist/lbllist")) ) {
  186. if( vcnt < 6 && vlblcnt ) {
  187. mlblcnt = true;
  188. fPrntLblCnt2(vcnt, ordflag);
  189. ordflag = "";
  190. vcnt = 0;
  191. }
  192. // (e)
  193. } else {
  194. fInUseDrugLBL();
  195. }
  196. } else if(sDrugKindcd == "[외용약]"){
  197. //fExUseDrugLBL();
  198. if(model.getValue("/root/send/prcpinfo/lbltype") == "Y"){
  199. fInUseDrugLBL2();
  200. //fOutUseDrugLBL2();
  201. } else {
  202. fInUseDrugLBL();
  203. }
  204. } else if(sDrugKindcd == "[주사약]"){
  205. //alert(sMixno);
  206. if(sMixno != "-"){
  207. fMixLBL();
  208. } else {
  209. fInjDrugLBL();
  210. }
  211. }
  212. CommAX.SendMsg(sSndMsg);
  213. fSleep(500);
  214. sSndMsg = "";
  215. // 2010.02.11 pymi
  216. if(sDrugKindcd == "[내복약]") {
  217. if( iPoint == getNodesetCount("/root/main/lbllist/lbllist") ) {
  218. if(model.getValue("/root/send/prcpinfo/lbltype") == "Y"){
  219. if(vlblcnt && (!mlblcnt) && (ordflag.length > 0)) {
  220. fPrntLblCnt2(vcnt, ordflag);
  221. ordflag = "";
  222. vcnt = 0;
  223. }
  224. }
  225. mlblcnt = false;
  226. }
  227. }
  228. // (e)
  229. }
  230. //CommAX.PortClose();
  231. model.refresh();
  232. //}
  233. }
  234. /**
  235. * mix 라벨
  236. */
  237. function fMixLBL() {
  238. var sMixno1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpmixno");
  239. var cnt = 0;
  240. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  241. sMixno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpmixno");
  242. var qty = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqty");
  243. var dayqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/dayprcpqty");
  244. var qtyunit = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqtyunit");
  245. var tims = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
  246. var dayno = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  247. if(PrnKind == "2") {
  248. var prcpnm= model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  249. prcpnm = prcpnm.substr(0,7);
  250. } else {
  251. var prcpnm= model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  252. }
  253. if(sMixno1 == sMixno2){
  254. //
  255. sSndMsg += astfPrintOut(20, 140+(cnt*30), 24, model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd"),"");
  256. //
  257. sSndMsg += astfPrintOut(170, 140+(cnt*30), 11, prcpnm.substr(0,7),"");
  258. //
  259. sSndMsg += astfPrintOut(360, 140+(cnt*30), 2, dayqty+qtyunit,"");
  260. //
  261. sSndMsg += astfPrintOut(430, 140+(cnt*30), 2, tims,"");
  262. //
  263. sSndMsg += astfPrintOut(460, 140+(cnt*30), 2, dayno,"");
  264. cnt++;
  265. } else {
  266. j--;
  267. break;
  268. }
  269. if(cnt == 5){
  270. break;
  271. }
  272. }
  273. iPoint = j;
  274. //종료(매수)
  275. sSndMsg += astfEndFormat(0);
  276. }
  277. /**
  278. * 내복약 라벨
  279. */
  280. function fInUseDrugLBL() {
  281. // var sSumCls1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sumcls");
  282. var sMthdcd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcd");
  283. var qty = "";
  284. var dayqty = "";
  285. var qtyunit = "";
  286. var tims = "";
  287. var dayno = "";
  288. var cnt = 0;
  289. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  290. if(cnt != 0 && fChkIndependDrug(j)){
  291. break;
  292. }
  293. // sSumCls2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/sumcls");
  294. sMthdcd2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthdcd");
  295. qty = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqty");
  296. dayqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/dayprcpqty");
  297. qtyunit = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqtyunit");
  298. tims = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
  299. dayno = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  300. if(PrnKind == "2") {
  301. var prcpnm= model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  302. prcpnm = prcpnm.substr(0,7);
  303. } else {
  304. var prcpnm= model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  305. }
  306. if((sMthdcd1 == sMthdcd2)){
  307. //
  308. sSndMsg += astfPrintOut(20, 140+(cnt*30), 24, model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd"),"");
  309. //
  310. sSndMsg += astfPrintOut(165, 140+(cnt*30), 11, prcpnm.substr(0,7),"");
  311. if( model.getValue("/root/main/lbllist/lbllist["+j+"]/lblgrup") == "DS"){
  312. //
  313. sSndMsg += astfPrintOut(360, 140+(cnt*30), 2, dayqty+qtyunit,"");
  314. //
  315. sSndMsg += astfPrintOut(430, 140+(cnt*30), 2, tims,"");
  316. //
  317. sSndMsg += astfPrintOut(460, 140+(cnt*30), 2, dayno,"");
  318. } else {
  319. //
  320. sSndMsg += astfPrintOut(360, 140+(cnt*30), 2, dayqty,"");
  321. //
  322. sSndMsg += astfPrintOut(430, 140+(cnt*30), 2, tims,"");
  323. //
  324. sSndMsg += astfPrintOut(460, 140+(cnt*30), 2, dayno,"");
  325. }
  326. cnt++;
  327. } else {
  328. break;
  329. }
  330. if(cnt == fMthdnmLength(iPoint) || fChkIndependDrug(j)){
  331. j++;
  332. break;
  333. }
  334. }
  335. iPoint = j-1;
  336. //보관방법 고가 출력
  337. var sKeepmthd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/keepmthd");
  338. var sExpnyn = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/expnyn");
  339. var sExpnnm = "";
  340. if(sExpnyn == "Y") sExpnnm = "고가";
  341. //if(sKeepmthd != "" && sExpnnm != ""){
  342. // sSndMsg += astfPrintOut(20, 180, 3, "<"+sKeepmthd+sExpnnm+">","");
  343. //} else
  344. if(sKeepmthd != ""){
  345. sSndMsg += astfPrintOut(20, 180, 3, "<"+sKeepmthd+">","");
  346. }
  347. if(sExpnnm != ""){
  348. sSndMsg += astfPrintOut(135, 180, 3, "<"+sExpnnm+">","");
  349. }
  350. /*
  351. if(sKeepmthd != "" && sExpnnm != ""){
  352. sSndMsg += astfPrintOut(20, 180, 3, "<"+sKeepmthd+sExpnnm+">","");
  353. } else if(sKeepmthd != ""){
  354. sSndMsg += astfPrintOut(20, 180, 3, "<"+sKeepmthd+">","");
  355. } if(sExpnnm != ""){
  356. sSndMsg += astfPrintOut(20, 180, 3, "<"+sExpnnm+">","");
  357. }*/
  358. //용법의 길이에 따라 찍는 위치를 달리한다(용법찍을 공간을 확보)
  359. var iYPoint = 0;
  360. if( fMthdnmLength(iPoint) == 4){
  361. iYPoint = 280;
  362. } else {
  363. iYPoint = 245;
  364. }
  365. if( model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/lblgrup") == "DS"){
  366. sSndMsg += astfPrintOut(20, iYPoint, 3, "1일 "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims")+"회 "
  367. +qty+qtyunit+" "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno")+"일분","");
  368. } else {
  369. sSndMsg += astfPrintOut(20, iYPoint, 3, "1일 "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims")+"회 "
  370. +model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno")+"일분","");
  371. }
  372. //
  373. sSndMsg += fMthdnm(iPoint);
  374. //종료(매수)
  375. sSndMsg += astfEndFormat(0);
  376. }
  377. /**
  378. * 내복약 라벨 - 한장에 모든 용법 약을 ...
  379. */
  380. function fInUseDrugLBL2() {
  381. // var sSumCls1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sumcls");
  382. var sMthdcd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcd");
  383. var qty = "";
  384. var dayqty = "";
  385. var qtyunit = "";
  386. var tims = "";
  387. var dayno = "";
  388. var cnt = 0;
  389. var chk = false;
  390. totpg = Math.ceil(totcnt / 6 );
  391. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  392. if(cnt != 0 && model.getValue("/root/main/lbllist/lbllist["+j+"]/lblgrup") == "DI" ) {
  393. break;
  394. }
  395. //if(cnt != 0 && fChkIndependDrug(j)){
  396. // break;
  397. //}
  398. // sSumCls2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/sumcls");
  399. sMthdcd2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthdcd");
  400. qty = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqty");
  401. dayqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/dayprcpqty");
  402. qtyunit = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqtyunit");
  403. tims = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
  404. dayno = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  405. if(PrnKind == "2") {
  406. var prcpnm= model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  407. prcpnm = prcpnm.substr(0,7);
  408. } else {
  409. var prcpnm= model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  410. }
  411. //if((sMthdcd1 == sMthdcd2)){
  412. //
  413. if( model.getValue("/root/main/lbllist/lbllist["+j+"]/lblgrup") == "DT"){ //PTP는 * 표시
  414. sSndMsg += astfPrintOut(20, 140+(cnt*30), 24, "*","");
  415. }
  416. sSndMsg += astfPrintOut(30, 140+(cnt*30), 24, model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd"),"");
  417. //
  418. sSndMsg += astfPrintOut(165, 140+(cnt*30), 11, prcpnm.substr(0,7),"");
  419. if( model.getValue("/root/main/lbllist/lbllist["+j+"]/lblgrup") == "DS"){
  420. //
  421. sSndMsg += astfPrintOut(360, 140+(cnt*30), 2, dayqty+qtyunit,"");
  422. //
  423. sSndMsg += astfPrintOut(430, 140+(cnt*30), 2, tims,"");
  424. //
  425. sSndMsg += astfPrintOut(460, 140+(cnt*30), 2, dayno,"");
  426. } else {
  427. //
  428. sSndMsg += astfPrintOut(360, 140+(cnt*30), 2, dayqty,"");
  429. //
  430. sSndMsg += astfPrintOut(430, 140+(cnt*30), 2, tims,"");
  431. //
  432. sSndMsg += astfPrintOut(460, 140+(cnt*30), 2, dayno,"");
  433. }
  434. if(model.getValue("/root/main/lbllist/lbllist["+ j +"]/lblcnts2").length > 0) ordflag += j + "/"; // 2010.02.10 pymi
  435. cnt++;
  436. //} else {
  437. // break;
  438. //}
  439. //if(cnt == fMthdnmLength(iPoint) || fChkIndependDrug(j)){
  440. // j++;
  441. // break;
  442. //}
  443. if(cnt == 6){
  444. pg++;
  445. sSndMsg += astfPrintOut(430,320, 2, pg+ "/" + totpg ,"");
  446. sSndMsg += astfEndFormat(0);
  447. j++;
  448. chk = true;
  449. break;
  450. }
  451. }
  452. // 2010.02 18 pymi
  453. if (chk == false) {
  454. if( model.getValue("/root/main/lbllist/lbllist["+(j-1)+"]/lblgrup") != "DI" ) {
  455. cnt ++; // 라벨내용 찍기 전에 한줄 띄우기
  456. if(!vlblcnt || cnt == 6) {
  457. pg++;
  458. sSndMsg += astfPrintOut(430,320, 2, pg+"/" +totpg ,"");
  459. sSndMsg += astfEndFormat(0);
  460. }
  461. } else {
  462. sSndMsg += astfEndFormat(0);
  463. }
  464. }
  465. iPoint = j-1;
  466. //if( (cnt < 6) && (!vlblcnt)) sSndMsg += astfEndFormat(0);
  467. vcnt = cnt;
  468. // (e)
  469. }
  470. // 포장라벨내용 출력 2010.02.10 pymi
  471. function fPrntLblCnt2(cnt, ordflag) {
  472. var lblcnts2 = "";
  473. var sordflag = ordflag.split("/");
  474. var lblcnt = cnt;
  475. var pgprnt = false;
  476. var sDD = getCurrentDate();
  477. var sTM = getCurrentTime();
  478. var y = 0;
  479. var x = parseInt(sordflag[y]);
  480. //for(var x = parseInt(sordflag[0]); x <= parseInt(sordflag[sordflag.length - 2]); x ++) {
  481. while( x <= parseInt(sordflag[sordflag.length - 2])) {
  482. if(lblcnt == 6 || lblcnt == 0) {
  483. lblcnt = 0;
  484. pgprnt = false;
  485. //
  486. /*PrnKind = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/prntkind");
  487. PrnMarginLeft = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/blank/left");
  488. PrnMarginTop = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/blank/top");
  489. var commkind = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/commkind")
  490. if ( PrnKind ==7 ) {
  491. CommAX.PrnKind =4;
  492. } else {
  493. CommAX.PrnKind =PrnKind;
  494. }
  495. if(commkind == "02") {
  496. CommAX.PortNm = 1;
  497. } else {
  498. CommAX.PortNm = 2;
  499. }
  500. if(commkind == "01") {
  501. CommAX.PrtNm = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/comm01/setupval");
  502. }*/
  503. //
  504. var reprint ="";
  505. if ( model.getValue("/root/main/lbllist/lbllist["+x+"]/lblprnttims")>0 ){
  506. reprint ="(재)";
  507. }
  508. //시작(X, Y)
  509. sSndMsg += astfStartFormat(0, 0, "S");
  510. //라벨이름(내복약/주사약/마약)
  511. sSndMsg += astfPrintOut(20, 25, 21, model.getValue("/root/main/lbllist/lbllist["+x+"]/drugkindnm"),"");
  512. //출력일자
  513. sSndMsg += astfPrintOut(190, 25, 21, "출력:"+fPrntTime(sDD, sTM),"");
  514. //출력일자
  515. sSndMsg += astfPrintOut(190, 55, 21, "처방:"+fDateFormat(model.getValue("/root/main/lbllist/lbllist["+x+"]/prcpdd"), "MD"),"");
  516. //병실
  517. sSndMsg += astfPrintOut(20, 80, 31, model.getValue("/root/main/lbllist/lbllist["+x+"]/roomcd"),"");
  518. //환자이름
  519. sSndMsg += astfPrintOut(120, 80, 31, model.getValue("/root/main/lbllist/lbllist["+x+"]/patnm"),"");
  520. //환자번호
  521. sSndMsg += astfPrintOut(240, 80, 31, model.getValue("/root/main/lbllist/lbllist["+x+"]/pid")+" ("+model.getValue("/root/main/lbllist/lbllist["+x+"]/drugno")+reprint+")","");
  522. //선그리기
  523. sSndMsg += astfGraphicBox(5, 120, 465, 0, 4);
  524. }
  525. //if( !fChkIndependDrug(x) ) {
  526. lblcnts2 = model.getValue("/root/main/lbllist/lbllist["+ x +"]/lblcnts2"); // 2010.02.10 pymi
  527. sSndMsg += astfPrintOut(30, 140+(lblcnt*30), 2, lblcnts2,"");
  528. lblcnt ++;
  529. //}
  530. if(lblcnt == 6){
  531. pg++;
  532. sSndMsg += astfPrintOut(430,320, 2, pg+ "/" + totpg ,"");
  533. lblcnt = 0;
  534. pgprnt = true;
  535. sSndMsg += astfEndFormat(0);
  536. CommAX.SendMsg(sSndMsg);
  537. fSleep(500);
  538. sSndMsg = "";
  539. //break;
  540. }
  541. x = parseInt(sordflag[++y]);
  542. } // end while
  543. if(!pgprnt) {
  544. pg++;
  545. sSndMsg += astfPrintOut(430,320, 2, pg+ "/" + totpg ,"");
  546. sSndMsg += astfEndFormat(0);
  547. }
  548. if(!mlblcnt) {
  549. CommAX.SendMsg(sSndMsg);
  550. fSleep(500);
  551. sSndMsg = "";
  552. }
  553. ordflag = "";
  554. vcnt = 0;
  555. pg = 0;
  556. totpg = 0;
  557. mlblcnt = false;
  558. }
  559. // (e)
  560. /**
  561. * 외용약 라벨
  562. */
  563. function fExUseDrugLBL() {
  564. var qty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqty");
  565. var dayqty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayprcpqty");
  566. var tims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  567. var dayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");
  568. if(PrnKind == "2") {
  569. var prcpnm= model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm");
  570. prcpnm = prcpnm.substr(0,7);
  571. } else {
  572. var prcpnm= model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm");
  573. }
  574. //
  575. sSndMsg += astfPrintOut(20, 140, 24, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd"),"");
  576. //
  577. sSndMsg += astfPrintOut(165, 140, 11, prcpnm.substr(0,7),"");
  578. //
  579. sSndMsg += astfPrintOut(360, 140, 2, dayqty,"");
  580. //
  581. sSndMsg += astfPrintOut(430, 140, 2, tims,"");
  582. //
  583. sSndMsg += astfPrintOut(460, 140, 2, dayno,"");
  584. sSndMsg += astfPrintOut(20, 280, 3, "1일 "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims")+"회 "
  585. +model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno")+"일분","");
  586. //
  587. sSndMsg += fMthdnm(iPoint);
  588. //종료(매수)
  589. sSndMsg += astfEndFormat(0);
  590. }
  591. /**
  592. * 주사약 라벨
  593. */
  594. function fInjDrugLBL() {
  595. var sSumCls1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sumcls");
  596. var cnt = 0;
  597. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  598. if(cnt != 0 && fChkIndependInj(j)){
  599. //주사가 뭉쳐서 나오다가 단독주사를 만날경우 단독주사는 출력하지 아니함.
  600. break;
  601. }
  602. sSumCls2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/sumcls");
  603. var qty = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqty");
  604. var dayqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/dayprcpqty");
  605. var qtyunit = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqtyunit");
  606. var tims = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
  607. var dayno = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  608. if(PrnKind == "2") {
  609. var prcpnm= model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  610. prcpnm = prcpnm.substr(0,7);
  611. } else {
  612. var prcpnm= model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  613. }
  614. //
  615. sSndMsg += astfPrintOut(20, 140+(cnt*30), 24, model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd"),"");
  616. //
  617. sSndMsg += astfPrintOut(165, 140+(cnt*30), 11, prcpnm.substr(0,7),"");
  618. //
  619. sSndMsg += astfPrintOut(360, 140+(cnt*30), 2, fChkFloat(dayqty)+qtyunit,"");
  620. //
  621. sSndMsg += astfPrintOut(430, 140+(cnt*30), 2, tims,"");
  622. //
  623. sSndMsg += astfPrintOut(460, 140+(cnt*30), 2, dayno,"");
  624. cnt++;
  625. if(cnt == 5 || fChkIndependInj(j)){
  626. j++;
  627. break;
  628. }
  629. }
  630. iPoint = j-1;
  631. //보관방법 고가 출력
  632. var sKeepmthd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/keepmthd");
  633. var sExpnyn = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/expnyn");
  634. var sExpnnm = "";
  635. if(sExpnyn == "Y") sExpnnm = "고가";
  636. //if(sKeepmthd != "" && sExpnnm != ""){
  637. // sSndMsg += astfPrintOut(20, 180, 3, "<"+sKeepmthd+sExpnnm+">","");
  638. //} else
  639. if(sKeepmthd != ""){
  640. sSndMsg += astfPrintOut(20, 180, 3, "<"+sKeepmthd+">","");
  641. }
  642. if(sExpnnm != ""){
  643. sSndMsg += astfPrintOut(135, 180, 3, "<"+sExpnnm+">","");
  644. }
  645. //종료(매수)
  646. sSndMsg += astfEndFormat(0);
  647. }
  648. /**
  649. * 내복약 단독라벨 검증작업
  650. */
  651. function fChkIndependDrug(cnt) {
  652. var sLBLGrup = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/lblgrup");
  653. var sSnglyn = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/atcifsnglyn");
  654. var sDrugindependpackflag = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/drugindependpackflag");
  655. var sKeepmthd = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/keepmthd");
  656. var sExpnyn = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/expnyn");
  657. var sRst = false;
  658. if(sLBLGrup == "DS" || sLBLGrup == "DI" || sLBLGrup == "DT" || sLBLGrup == "DX") sRst = true;
  659. if(sSnglyn == "Y") sRst = true;
  660. if(sDrugindependpackflag == "Y") sRst = true;
  661. if(sExpnyn == "Y") sRst = true;
  662. if(sKeepmthd != "") sRst = true;
  663. return sRst;
  664. }
  665. /**
  666. * 주사약 단독라벨 검증작업
  667. */
  668. function fChkIndependInj(cnt) {
  669. var sLBLGrup = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/lblgrup");
  670. var sExp = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/expnyn");
  671. var sKeepmthd = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/keepmthd");
  672. var sSelfprcpflag = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/selfprcpflag");
  673. var sDrugindependpackflag = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/drugindependpackflag");
  674. var sRst = false;
  675. if(sLBLGrup == "IH" || sLBLGrup == "IO" || sLBLGrup == "IS" || sLBLGrup == "IX") sRst = true;
  676. if(sExp == "Y" || sKeepmthd != "" || sSelfprcpflag == "Y") sRst = true;
  677. if(sDrugindependpackflag == "Y") sRst = true;
  678. return sRst;
  679. }
  680. /**
  681. * 용법 생성
  682. */
  683. function fMthdnm(iPoint) {
  684. var sMthd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1");
  685. var sMthd2 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2");
  686. var sMthd3 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  687. var sMthd4 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  688. var sTemp = "";
  689. var sRst = "";
  690. if(sMthd1 != "") sTemp += sMthd1 + " ";
  691. if(sMthd2 != "") sTemp += sMthd2 + " ";
  692. if(sMthd3 != "") sTemp += sMthd3 + " ";
  693. if(sMthd4 != "") sTemp += sMthd4;
  694. if(sTemp.length > 28){
  695. var sTemp1 = sTemp.substr(0, 26);
  696. var sTemp2 = sTemp.substr(26, sTemp.length);
  697. sRst = astfPrintOut(20, 285, 28, sTemp1,"");
  698. sRst += astfPrintOut(20, 320, 28, sTemp2,"");
  699. } else if(sTemp.length > 24){
  700. sRst = astfPrintOut(20, 320, 29, sTemp,"");
  701. } else if(sTemp.length > 22){
  702. sRst = astfPrintOut(20, 320, 3, sTemp,"");
  703. } else if(sTemp.length > 21){
  704. sRst = astfPrintOut(20, 320, 3, sTemp,"");
  705. } else if(sTemp.length <= 21){
  706. sRst = astfPrintOut(20, 320, 3, sTemp,"");
  707. }
  708. return sRst;
  709. }
  710. /**
  711. * 용법 길이
  712. */
  713. function fMthdnmLength(iPoint) {
  714. var sMthd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1");
  715. var sMthd2 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2");
  716. var sMthd3 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  717. var sMthd4 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  718. var sTemp = "";
  719. var sRst = "4"; //병동라벨은 기본 4줄까지 약처방이 출력된다.
  720. if(sMthd1 != "") sTemp += sMthd1 + " ";
  721. if(sMthd2 != "") sTemp += sMthd2 + " ";
  722. if(sMthd3 != "") sTemp += sMthd3 + " ";
  723. if(sMthd4 != "") sTemp += sMthd4;
  724. if(sTemp.length > 28){
  725. sRst = "3"; //복용방법이 길경우 3줄까지 약처방을 출력한다.
  726. }
  727. return sRst;
  728. }
  729. /**
  730. * 응급실/퇴원/외박/외출 라벨출력(큰사이즈)
  731. */
  732. function fBigLBLPrint() {
  733. /*
  734. 라벨 Sorting 로직
  735. //mgt에서 vo로 리턴
  736. 대분류
  737. - 내복약, 외용약, 주사, 항암제, TPN, 마약,
  738. 중분류
  739. - 방법코드
  740. 소분류
  741. - 내복약,외용약(방법코드), 주사,마약,항암제(mix)
  742. web js 출력로직
  743. 1 약종류(내복약/주사약/외용약)
  744. 1.1 방법코드
  745. 1.2 처방수량
  746. */
  747. // Comm 설정
  748. //CommAX.CommPort = "1"; // 출력 Port
  749. //CommAX.Settings = "9600,n,8,1"; // Comm 설정
  750. //CommAX.Settings = "127.0.0.1"; // Comm 설정
  751. PrnKind = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/prntkind");
  752. var commkind = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/commkind")
  753. CommAX.PrnKind =PrnKind;
  754. if(commkind == "02") {
  755. CommAX.PortNm = 1;
  756. } else {
  757. CommAX.PortNm = 2;
  758. }
  759. if(commkind == "01") {
  760. CommAX.PrtNm = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/comm01/setupval");
  761. }
  762. var reprint="";
  763. for(iPoint = 1; iPoint <= getNodesetCount("/root/main/lbllist/lbllist") ; iPoint++){
  764. if ( model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/lblprnttims")>0 ){
  765. reprint ="(재)";
  766. }
  767. //시작(X, Y)
  768. sSndMsg += astfStartFormat(0, 0, "B");
  769. //iPageCnt++;
  770. //////////////////////////////////////////////////
  771. // 라벨 상단내용 //
  772. /////////////////////////////////////////////////
  773. //병실
  774. sSndMsg += astfPrintOut(30, 30, 6, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/roomcd"),"");
  775. //환자명
  776. sSndMsg += astfPrintOut(180, 30, 6, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/patnm").substring(0,5),"");
  777. //바코드(변환)
  778. sSndMsg += astfBarCode_Code39(390, 40, "N", 70, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/barcode"));
  779. //환자번호
  780. sSndMsg += astfPrintOut(30, 85, 3, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/pid") ,"");
  781. //투약번호=>20091014 이선경 : 크고 진하게 변경
  782. sSndMsg += astfPrintOut(130, 85, 6, " (" + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugno") + ")","");
  783. //성별나이
  784. sSndMsg += astfPrintOut(280, 85, 3, reprint+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sexage"),"");
  785. //처방과약어명
  786. sSndMsg += astfPrintOut(30, 135, 3, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/deptengabbr"),"");
  787. //의사명
  788. sSndMsg += astfPrintOut(120, 135, 3, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/orddrnm"),"");
  789. //처방일자
  790. sSndMsg += astfPrintOut(270, 135, 3, fDateFormat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd")),"");
  791. //페이지수
  792. //sSndMsg += astfPrintOut(430, 135, 3, iPageCnt+"/"+iTotalPageNum,"");
  793. //바코드
  794. sSndMsg += astfPrintOut(510, 130, 3, "*"+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/barcode")+"*","");
  795. //선그리기
  796. sSndMsg += astfGraphicBox(5, 180, 815, 0, 4);
  797. sSndMsg += astfPrintOut(20, 600, 2, "*의약품은 그 특성상 보관및관리가 엄격해야하므로, ");
  798. sSndMsg += astfPrintOut(20, 630, 2, " 일단 조제투약된 약은 반납할 수 없습니다.");
  799. //////////////////////////////////////////////////
  800. // 라벨 하단내용 //
  801. /////////////////////////////////////////////////
  802. if( fChkSumcls(iPoint)){
  803. //단독라벨출력
  804. fIndependPrint();
  805. } else {
  806. //일반라벨출력
  807. fGnrlPrint();
  808. }
  809. //종료(매수)
  810. sSndMsg += astfEndFormat(0);
  811. CommAX.SendMsg(sSndMsg);
  812. fSleep(500);
  813. sSndMsg = "";
  814. // 2010.02.17 pymi
  815. if(nextPage) {
  816. fGnrlPrintnm(nCnt, bordflag);
  817. nextPage = false;
  818. nCnt = 0;
  819. bordflag = "";
  820. }
  821. // (e)
  822. }
  823. //CommAX.PortClose();
  824. model.refresh();
  825. //}
  826. }
  827. /**
  828. *
  829. */
  830. function fIndependPrint() {
  831. //약종류(내복약/주사약/외용약)
  832. sSndMsg += astfPrintOut(30, 230, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm"),"");
  833. //라벨내용
  834. var drugkindnm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  835. var qty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqty");
  836. var dayqty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayprcpqty");
  837. var tims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  838. var dayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");
  839. if (drugkindnm == "[주사약]"){
  840. //용법2
  841. sSndMsg += astfPrintOut(30, 300, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"),"");
  842. } else if (drugkindnm == "[외용약]"){
  843. //sSndMsg += astfPrintOut(210, 230, 7, "1일 "+tims+"회 "+fChkFloat(qty)+"개씩 "+dayno+"일분","");
  844. //용법1
  845. sSndMsg += astfPrintOut(30, 300, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2")
  846. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3"),"");
  847. //용법2
  848. sSndMsg += astfPrintOut(30, 370, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"),"");
  849. } else if (drugkindnm == "[내복약]"){
  850. sSndMsg += astfPrintOut(210, 230, 7, "1일 "+tims+"회 "+fChkFloat(qty)+"포[정]씩 "+dayno+"일분","");
  851. //용법1
  852. sSndMsg += astfPrintOut(30, 300, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2")
  853. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3"),"");
  854. //용법2
  855. sSndMsg += astfPrintOut(30, 370, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"),"");
  856. }
  857. var lblcnts1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/lblcnts1");
  858. lblcnts1 = lblcnts1.setReplaceWord("~", "-"); //20090728
  859. var val = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd")
  860. +" "+parseFloat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/totdrugqty"))
  861. +" "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm");
  862. if(lblcnts1.length > 28){
  863. //주의사항
  864. sSndMsg += astfPrintOut(30, 450, 5, lblcnts1.substring(0,24),"");
  865. sSndMsg += astfPrintOut(30, 510, 5, lblcnts1.substring(24,lblcnts1.length),"");
  866. //약정보
  867. sSndMsg += astfPrintOut(30, 570, 4, val, "");
  868. } else {
  869. //주의사항
  870. sSndMsg += astfPrintOut(30, 450, 5, lblcnts1,"");
  871. //약정보
  872. sSndMsg += astfPrintOut(30, 510, 4, val, "");
  873. }
  874. }
  875. /**
  876. *
  877. */
  878. function fGnrlPrint() {
  879. var cnt = 0;
  880. var drugcnt = 0;
  881. var ordCnt = 0; // 2010.02.10 pymi
  882. //약종류(내복약/주사약/외용약)
  883. sSndMsg += astfPrintOut(30, 220, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm"),"");
  884. //라벨내용
  885. var drugkindnm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  886. var qty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqty");
  887. var dayqty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayprcpqty");
  888. var tims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  889. var dayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");
  890. //약코드 출력
  891. var drugkind1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  892. var dayno1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");
  893. var mthd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd1");
  894. var mthd2 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd2");
  895. var mthd3 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd3");
  896. var mthdcd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcd");
  897. if (drugkindnm != "[내복약]"){
  898. if (drugkindnm == "[주사약]"){
  899. //용법2
  900. sSndMsg += astfPrintOut(30, 290, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"),"");
  901. } else if (drugkindnm == "[외용약]"){
  902. //sSndMsg += astfPrintOut(210, 220, 7, "1일 "+tims+"회 "+qty+"개씩 "+dayno+"일분","");
  903. //용법1
  904. sSndMsg += astfPrintOut(30, 290, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2")
  905. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3"),"");
  906. //용법2
  907. sSndMsg += astfPrintOut(30, 360, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"),"");
  908. }
  909. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  910. var drugkind2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/drugkindnm");
  911. var dayno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  912. var mthd4 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd1");
  913. var mthd5 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd2");
  914. var mthd6 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd3");
  915. if((drugkind1 == drugkind2) && (dayno1 == dayno2) && (mthd1 == mthd4 && mthd2 == mthd5 && mthd3 == mthd6)
  916. && !fChkSumcls(j)){
  917. //if(model.getValue("/root/main/lbllist/lbllist["+j+"]/fst_prnt") == "Y"){
  918. var prcpqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty")/model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims") ;
  919. prcpqty = Math.ceil( prcpqty * tims*1000)/1000;
  920. var val = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd")
  921. +" "+prcpqty
  922. +" "+(model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm")).substring(0,6);
  923. sSndMsg += astfPrintOut(30+((cnt%2)*380), 440+((parseInt(cnt/2, 10))*40), 2, val, "");
  924. //}
  925. cnt++;
  926. } else {
  927. break;
  928. }
  929. if(cnt == 8){
  930. j++;
  931. break;
  932. }
  933. }
  934. iPoint = j-1;
  935. } else if (drugkindnm == "[내복약]"){
  936. var lbltims =0;
  937. lbl_tims = mthd2.split(",");
  938. if ( mthdcd == "ZZZ" ){
  939. lbltims = tims;
  940. } else if ( mthd3.indexOf("취침") > -1 ) {
  941. lbltims = lbl_tims.length +1;
  942. } else if(mthd2.indexOf("마다") > -1){
  943. lbltims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  944. } else {
  945. lbltims = lbl_tims.length;
  946. }
  947. tims = lbltims;
  948. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  949. var drugkind2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/drugkindnm");
  950. var dayno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  951. var mthd4 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd1");
  952. var mthd5 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd2");
  953. var mthd6 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd3");
  954. if((drugkind1 == drugkind2) && (dayno1 == dayno2) && (mthd1 == mthd4 && mthd2 == mthd5 && mthd3 == mthd6)
  955. && !fChkSumcls(j)){
  956. drugcnt++;
  957. } else {
  958. break;
  959. }
  960. }
  961. if ( drugcnt == 1 ){
  962. if(lbltims == 1) {
  963. if(mthd2.indexOf("마다") == -1) {
  964. sSndMsg += astfPrintOut(210, 220, 7, "1일 "+lbltims+ "회"+fChkFloat(qty)+"포[정]씩 "+dayno+"일분","");
  965. prcpqty = prcpqty * lbltims;
  966. } else {
  967. sSndMsg += astfPrintOut(210, 220, 7, "1일 "+tims+ "회"+fChkFloat(qty)+"포[정]씩 "+dayno+"일분","");
  968. prcpqty = prcpqty * tims;
  969. }
  970. } else {
  971. sSndMsg += astfPrintOut(210, 220, 7, "1일 "+lbltims+ "회"+fChkFloat(qty)+"포[정]씩 "+dayno+"일분","");
  972. prcpqty = prcpqty * lbltims;
  973. }
  974. } else {
  975. if(lbltims == 1) {
  976. if(mthd2.indexOf("마다") == -1) {
  977. sSndMsg += astfPrintOut(210, 220, 7, "1일 "+lbltims+ "회 1포씩 "+dayno+"일분","");
  978. } else {
  979. sSndMsg += astfPrintOut(210, 220, 7, "1일 "+tims+ "회 1포씩 "+dayno+"일분","");
  980. }
  981. } else {
  982. sSndMsg += astfPrintOut(210, 220, 7, "1일 "+lbltims+ "회 1포씩 "+dayno+"일분","");
  983. }
  984. }
  985. //용법1
  986. //if ( model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3") =="취침전에" ){
  987. // sSndMsg += astfPrintOut(30, 290, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2")
  988. // + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3"),"");
  989. //} else {
  990. sSndMsg += astfPrintOut(30, 290, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd1") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd2")
  991. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd3"),"");
  992. //}
  993. //용법2
  994. sSndMsg += astfPrintOut(30, 360, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"),"");
  995. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  996. var drugkind2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/drugkindnm");
  997. var dayno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  998. var mthd4 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd1");
  999. var mthd5 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd2");
  1000. var mthd6 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd3");
  1001. if((drugkind1 == drugkind2) && (dayno1 == dayno2) && (mthd1 == mthd4 && mthd2 == mthd5 && mthd3 == mthd6)
  1002. && !fChkSumcls(j)){
  1003. //if(model.getValue("/root/main/lbllist/lbllist["+j+"]/fst_prnt") == "Y"){
  1004. /* var prcpqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty")/model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims") ;
  1005. prcpqty = Math.ceil( prcpqty * tims*1000)/1000;
  1006. var val = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd")
  1007. +" "+prcpqty
  1008. +" "+(model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm")).substring(0,6);
  1009. sSndMsg += astfPrintOut(30+((cnt%2)*380), 440+((parseInt(cnt/2, 10))*40), 2, val, "");*/
  1010. //}
  1011. //cnt++;
  1012. // 2010.02.10 pymi
  1013. var lblcnts2 = model.getValue("/root/main/lbllist/lbllist["+ j +"]/lblcnts2");
  1014. bordflag += j + "/"; // 포장라벨 처방코드 순서
  1015. if(lblcnts2.length > 0) {
  1016. sSndMsg += astfPrintOut(30, 440 +(60 * ordCnt), 5, lblcnts2, "");
  1017. //if(ordCnt == 0) {sSndMsg += astfPrintOut(30, 440, 4, lblcnts2, ""); }
  1018. //if(ordCnt == 1) {sSndMsg += astfPrintOut(30, 500, 4, lblcnts2, ""); }
  1019. //if(ordCnt == 2) {sSndMsg += astfPrintOut(30, 560, 4, lblcnts2, ""); }
  1020. ordCnt++; // 포장라벨 갯수
  1021. }
  1022. // (e)
  1023. } else {
  1024. // 용법이 바뀌는 시점 2010.02.10 pymi
  1025. // 처방출력
  1026. fGnrlPrintnm(ordCnt, bordflag);
  1027. bordflag = "";
  1028. // (e)
  1029. break;
  1030. }
  1031. //if(cnt == 8){
  1032. if(ordCnt == 3){ //2010.02.10 pymi
  1033. j++;
  1034. if(j <= getNodesetCount("/root/main/lbllist/lbllist")) {
  1035. var drugkind3 = model.getValue("/root/main/lbllist/lbllist["+j+"]/drugkindnm");
  1036. var dayno3 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  1037. var mthd7 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd1");
  1038. var mthd8 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd2");
  1039. var mthd9 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd3");
  1040. if((drugkind1 == drugkind3) && (dayno1 == dayno3) && (mthd1 == mthd7 && mthd2 == mthd8 && mthd3 == mthd9)
  1041. && !fChkSumcls(j)){
  1042. // 페이지 넘겨서도 용법 바뀌지 않으면 계속 진행
  1043. } else {
  1044. // 페이지 넘길때 용법이 바뀌면 처방 출력
  1045. nextPage = true;
  1046. nCnt = ordCnt;
  1047. //fGnrlPrintnm(ordCnt, bordflag);
  1048. }
  1049. }
  1050. break;
  1051. }
  1052. }
  1053. iPoint = j-1;
  1054. // 용법 바뀌지 않는 마지막 처방 출력 2010.02.10 pymi
  1055. if(iPoint == getNodesetCount("/root/main/lbllist/lbllist") ) {
  1056. if(ordCnt == 3) {
  1057. nextPage = true;
  1058. nCnt = ordCnt;
  1059. }
  1060. else {
  1061. fGnrlPrintnm(ordCnt, bordflag);
  1062. bordflag = "";
  1063. }
  1064. }
  1065. // (e)
  1066. }
  1067. }
  1068. /*
  1069. * 2010.02.10 pymi 처방출력
  1070. */
  1071. function fGnrlPrintnm(linecnt, ordflag) {
  1072. var cnt = 0;
  1073. var xValue = 440;
  1074. var valCnt = 8;
  1075. var lblup = false;
  1076. var sordflag = "";
  1077. sordflag = ordflag.split("/");
  1078. if(linecnt == 1) { xValue = 500; valCnt = 6; }
  1079. if(linecnt == 2) { xValue = 560; valCnt = 2; }
  1080. if(linecnt == 3) { xValue = 440; valCnt = 8; lblup = true;}
  1081. //약종류(내복약/주사약/외용약)
  1082. for(mPoint = parseInt(sordflag[0]); mPoint <= parseInt(sordflag[sordflag.length - 2]); mPoint++) {
  1083. var xtims = 0;
  1084. var drugcnt = 0;
  1085. if(lblup) {
  1086. //시작(X, Y)
  1087. xValue = 440;
  1088. valCnt = 8;
  1089. cnt = 0;
  1090. //
  1091. /*PrnKind = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/prntkind");
  1092. var commkind = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/commkind")
  1093. CommAX.PrnKind =PrnKind;
  1094. if(commkind == "02") {
  1095. CommAX.PortNm = 1;
  1096. } else {
  1097. CommAX.PortNm = 2;
  1098. }
  1099. if(commkind == "01") {
  1100. CommAX.PrtNm = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/comm01/setupval");
  1101. }*/
  1102. //
  1103. var reprint ="";
  1104. if ( model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/lblprnttims")>0 ){
  1105. reprint ="(재)";
  1106. }
  1107. sSndMsg += astfStartFormat(0, 0, "B");
  1108. //iPageCnt++;
  1109. //////////////////////////////////////////////////
  1110. // 라벨 상단내용 //
  1111. /////////////////////////////////////////////////
  1112. //병실
  1113. sSndMsg += astfPrintOut(30, 30, 6, model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/roomcd"),"");
  1114. //환자명
  1115. sSndMsg += astfPrintOut(180, 30, 6, model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/patnm").substring(0,5),"");
  1116. //바코드(변환)
  1117. sSndMsg += astfBarCode_Code39(390, 40, "N", 70, model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/barcode"));
  1118. //환자번호
  1119. sSndMsg += astfPrintOut(30, 85, 3, model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/pid") ,"");
  1120. //투약번호=>20091014 이선경 : 크고 진하게 변경
  1121. sSndMsg += astfPrintOut(130, 85, 6, " (" + model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/drugno") + ")","");
  1122. //성별나이
  1123. sSndMsg += astfPrintOut(280, 85, 3, reprint+model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/sexage"),"");
  1124. //처방과약어명
  1125. sSndMsg += astfPrintOut(30, 135, 3, model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/deptengabbr"),"");
  1126. //의사명
  1127. sSndMsg += astfPrintOut(120, 135, 3, model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/orddrnm"),"");
  1128. //처방일자
  1129. sSndMsg += astfPrintOut(270, 135, 3, fDateFormat(model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/prcpdd")),"");
  1130. //페이지수
  1131. //sSndMsg += astfPrintOut(430, 135, 3, iPageCnt+"/"+iTotalPageNum,"");
  1132. //바코드
  1133. sSndMsg += astfPrintOut(510, 130, 3, "*"+model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/barcode")+"*","");
  1134. //선그리기
  1135. sSndMsg += astfGraphicBox(5, 180, 815, 0, 4);
  1136. sSndMsg += astfPrintOut(20, 600, 2, "*의약품은 그 특성상 보관및관리가 엄격해야하므로, ");
  1137. sSndMsg += astfPrintOut(20, 630, 2, " 일단 조제투약된 약은 반납할 수 없습니다.");
  1138. lblup = false;
  1139. //}
  1140. sSndMsg += astfPrintOut(30, 220, 7, model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/drugkindnm"),"");
  1141. //라벨내용
  1142. var drugkindnm = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/drugkindnm");
  1143. var qty = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/prcpqty");
  1144. var dayqty = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/dayprcpqty");
  1145. var tims = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/prcptims");
  1146. var dayno = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/prcpdayno");//처방일수
  1147. var mthddayno = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/dayno"); //용법일수
  1148. //약코드 출력
  1149. var drugkind1 = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/drugkindnm");
  1150. var dayno1 = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/prcpdayno");
  1151. var mthd1 = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/mthd1");
  1152. var mthd2 = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/mthd2");
  1153. var mthd3 = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/mthd3");
  1154. var mthdcd = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/mthdcd");
  1155. // 용법 출력
  1156. var lbltims =0;
  1157. lbl_tims = mthd2.split(",");
  1158. if ( mthdcd == "ZZZ" ){
  1159. lbltims = tims;
  1160. } else if ( mthd3.indexOf("취침") > -1 ) {
  1161. lbltims = lbl_tims.length +1;
  1162. } else if(mthd2.indexOf("마다") > -1){
  1163. lbltims = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/prcptims");
  1164. } else {
  1165. lbltims = lbl_tims.length;
  1166. }
  1167. tims = lbltims;
  1168. xtims = tims;
  1169. /*for(var j = mPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  1170. var drugkind2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/drugkindnm");
  1171. var dayno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  1172. var mthd4 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd1");
  1173. var mthd5 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd2");
  1174. var mthd6 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd3");
  1175. if((drugkind1 == drugkind2) && (dayno1 == dayno2) && (mthd1 == mthd4 && mthd2 == mthd5 && mthd3 == mthd6)
  1176. && !fChkSumcls(j)){
  1177. drugcnt++;
  1178. } else {
  1179. break;
  1180. }
  1181. }
  1182. if ( drugcnt == 1 ){
  1183. if(lbltims == 1) {
  1184. if(mthd2.indexOf("마다") == -1) {
  1185. sSndMsg += astfPrintOut(210, 220, 7, "1일 "+lbltims+ "회"+fChkFloat(qty)+"포[정]씩 "+dayno+"일분","");
  1186. prcpqty = prcpqty * lbltims;
  1187. } else {
  1188. sSndMsg += astfPrintOut(210, 220, 7, "1일 "+tims+ "회"+fChkFloat(qty)+"포[정]씩 "+dayno+"일분","");
  1189. prcpqty = prcpqty * tims;
  1190. }
  1191. } else {
  1192. sSndMsg += astfPrintOut(210, 220, 7, "1일 "+lbltims+ "회"+fChkFloat(qty)+"포[정]씩 "+dayno+"일분","");
  1193. prcpqty = prcpqty * lbltims;
  1194. }
  1195. } else {*/
  1196. if(lbltims == 1) {
  1197. if(mthd2.indexOf("마다") == -1) {
  1198. sSndMsg += astfPrintOut(210, 220, 7, "1일 "+lbltims+ "회 1포씩 "+dayno+"일분","");
  1199. } else {
  1200. sSndMsg += astfPrintOut(210, 220, 7, "1일 "+tims+ "회 1포씩 "+dayno+"일분","");
  1201. }
  1202. } else {
  1203. sSndMsg += astfPrintOut(210, 220, 7, "1일 "+lbltims+ "회 1포씩 "+dayno+"일분","");
  1204. }
  1205. //}
  1206. //용법1
  1207. var val = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/mthd1") + model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/mthd2")
  1208. + model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/mthd3");
  1209. sSndMsg += astfPrintOut(30, 290, 7, val,"");
  1210. //용법2
  1211. sSndMsg += astfPrintOut(30, 360, 7, model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/mthdcnts4"),"");
  1212. } else{
  1213. var drugkind1 = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/drugkindnm");
  1214. var dayno1 = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/prcpdayno");
  1215. var mthd1 = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/mthd1");
  1216. var mthd2 = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/mthd2");
  1217. var mthd3 = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/mthd3");
  1218. var mthdcd = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/mthdcd");
  1219. var tims = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/prcptims");
  1220. // 용법 출력
  1221. var lbltims =0;
  1222. lbl_tims = mthd2.split(",");
  1223. if ( mthdcd == "ZZZ" ){
  1224. lbltims = tims;
  1225. } else if ( mthd3.indexOf("취침") > -1 ) {
  1226. lbltims = lbl_tims.length +1;
  1227. } else if(mthd2.indexOf("마다") > -1){
  1228. lbltims = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/prcptims");
  1229. } else {
  1230. lbltims = lbl_tims.length;
  1231. }
  1232. tims = lbltims;
  1233. xtims = tims;
  1234. }
  1235. for(var j = mPoint; j <= parseInt(sordflag[sordflag.length - 2]) ; j++){
  1236. //var drugkind2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/drugkindnm");
  1237. //var dayno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  1238. //var mthd4 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd1");
  1239. //var mthd5 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd2");
  1240. //var mthd6 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd3");
  1241. //if((drugkind1 == drugkind2) && (dayno1 == dayno2) && (mthd1 == mthd4 && mthd2 == mthd5 && mthd3 == mthd6)
  1242. // && !fChkSumcls(j)){
  1243. //if(model.getValue("/root/main/lbllist/lbllist["+j+"]/fst_prnt") == "Y"){
  1244. var prcpqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty")/model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
  1245. prcpqty = Math.ceil( prcpqty * xtims*1000)/1000 ;
  1246. var val = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd")
  1247. +" "+prcpqty
  1248. +" "+(model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm")).substring(0,6);
  1249. sSndMsg += astfPrintOut(30+((cnt%2)*380), xValue+((parseInt(cnt/2, 10))*40), 2, val, "");
  1250. //}
  1251. cnt++;
  1252. //} else {
  1253. // break;
  1254. //}
  1255. //if(cnt == 8){
  1256. if(cnt == valCnt){
  1257. j++;
  1258. lblup = true;
  1259. break;
  1260. }
  1261. }
  1262. mPoint = j-1;
  1263. //var s ="복용기간: "+(rcptdd.toDate("YYYYMMDD")).getDateFormat("YYYY/MM/DD") +" - "+ ((rcptdd.toDate("YYYYMMDD")).getAddDate( parseInt(dayno),"D")).getDateFormat("YYYY/MM/DD") ;
  1264. //sSndMsg +=astfPrintOut(30, 630, 3, s);
  1265. //종료(매수)
  1266. sSndMsg += astfEndFormat(0);
  1267. CommAX.SendMsg(sSndMsg);
  1268. fSleep(500);
  1269. sSndMsg = "";
  1270. }
  1271. }
  1272. /**
  1273. *
  1274. */
  1275. function fDateFormat(sDD, sYMD) {
  1276. if(sYMD == "MD"){
  1277. return sDD.substr(4,2)+"/"+sDD.substr(6,2);
  1278. } else {
  1279. return sDD.substr(0,4)+"/"+sDD.substr(4,2)+"/"+sDD.substr(6,2);
  1280. }
  1281. }
  1282. /**
  1283. *
  1284. */
  1285. function fPrntTime(sDD, sTM) {
  1286. //if(PrnKind == "2" || PrnKind == "7" ) {
  1287. return sDD.substr(4,2)+"/"+sDD.substr(6,2)+" "+sTM.substr(0,2)+":"+sTM.substr(2,2);
  1288. //} else {
  1289. // return sDD.substr(4,2)+" / "+sDD.substr(6,2)+" "+sTM.substr(0,2)+":"+sTM.substr(2,2)+":"+sTM.substr(4,2);
  1290. //}
  1291. }
  1292. /**
  1293. *
  1294. */
  1295. function fChkFloat(qty) {
  1296. var fQty = parseFloat(qty);
  1297. var fRst = "";
  1298. if(fQty%1 == 0){
  1299. fRst = parseInt(qty);
  1300. } else {
  1301. fRst = qty;
  1302. }
  1303. return fRst;
  1304. }
  1305. /**
  1306. *
  1307. */
  1308. function fChkSumcls(cnt) {
  1309. var chk = false;
  1310. var sSumcls = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/sumcls");
  1311. var sSnglyn = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/atcifsnglyn");
  1312. var sDrugindependpackflag = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/drugindependpackflag");
  1313. if(sSumcls == "DI" || sSumcls == "DS"|| sSumcls == "DX"|| sSumcls == "DT" || sSumcls == "DM" || sSumcls == "IH"|| sSumcls == "IO"
  1314. || sSumcls == "IS"|| sSumcls == "IX"|| sSumcls == "X" || sSumcls == "I"){
  1315. chk = true;
  1316. }
  1317. if ( sSumcls == "D" && sSnglyn =="Y" ) {
  1318. chk = true;
  1319. }
  1320. if ( sDrugindependpackflag =="Y"){
  1321. chk = true;
  1322. }
  1323. return chk;
  1324. }
  1325. /**
  1326. * 물약라벨출력
  1327. */
  1328. function fLiquidLBLPrint() {
  1329. // Comm 설정
  1330. //CommAX.CommPort = "1"; // 출력 Port
  1331. //CommAX.Settings = "9600,n,8,1"; // Comm 설정
  1332. //CommAX.Settings = "127.0.0.1"; // Comm 설정
  1333. PrnKind = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/prntkind");
  1334. PrnMarginLeft = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/blank/left");
  1335. PrnMarginTop = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/blank/top");
  1336. var commkind = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/commkind")
  1337. if ( PrnKind ==7 ) {
  1338. CommAX.PrnKind =4;
  1339. } else {
  1340. CommAX.PrnKind =PrnKind;
  1341. }
  1342. if(commkind == "02") {
  1343. CommAX.PortNm = 1;
  1344. } else {
  1345. CommAX.PortNm = 2;
  1346. }
  1347. if(commkind == "01") {
  1348. CommAX.PrtNm = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/comm01/setupval");
  1349. }
  1350. var reprint ="";
  1351. //if ( CommAX.PortOpen() == true) {
  1352. for(iPoint = 1; iPoint <= getNodesetCount("/root/main/lbllist/lbllist") ; iPoint++){
  1353. if ( model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/lblprnttims")>0 ){
  1354. reprint ="(재)";
  1355. }
  1356. //시작(X, Y)
  1357. sSndMsg += astfStartFormat(0, 0, "S");
  1358. //////////////////////////////////////////////////
  1359. // 라벨 상단내용 //
  1360. /////////////////////////////////////////////////
  1361. //병실
  1362. //sSndMsg += astfPrintOut(50, 30, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/roomcd"),"");
  1363. //환자명
  1364. //sSndMsg += astfPrintOut(50, 85, 6, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/patnm"),"");
  1365. //내복약
  1366. //sSndMsg += astfPrintOut(250, 30, 3, "내복약","");
  1367. //처방일자
  1368. //sSndMsg += astfPrintOut(250, 70, 3, fDateFormat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd")),"");
  1369. //환자번호(투약번호)
  1370. //sSndMsg += astfPrintOut(250, 110, 3, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/pid")+ " ( "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugno")+reprint+" )","");
  1371. //선그리기
  1372. //sSndMsg += astfGraphicBox(5, 145, 465, 0, 4);
  1373. var sDD = getCurrentDate();
  1374. var sTM = getCurrentTime();
  1375. //라벨이름(내복약/주사약/마약)
  1376. sSndMsg += astfPrintOut(20, 25, 20, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm"),"");
  1377. //if(PrnKind == "2" || PrnKind == "7" ) {
  1378. //출력일자
  1379. sSndMsg += astfPrintOut(190, 25, 21, "출력:"+fPrntTime(sDD, sTM),"");
  1380. //출력일자
  1381. sSndMsg += astfPrintOut(190, 55, 21, "처방:"+fDateFormat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd"), "MD"),"");
  1382. //} else {
  1383. //출력일자
  1384. // sSndMsg += astfPrintOut(220, 25, 21, "출 력 : "+fPrntTime(sDD, sTM),"");
  1385. //출력일자
  1386. // sSndMsg += astfPrintOut(220, 55, 21, "처 방 : "+fDateFormat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd"), "MD"),"");
  1387. //}
  1388. //병실
  1389. sSndMsg += astfPrintOut(20, 80, 31, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/roomcd"),"");
  1390. //환자이름
  1391. sSndMsg += astfPrintOut(120, 80, 31, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/patnm"),"");
  1392. //환자번호
  1393. sSndMsg += astfPrintOut(240, 80, 31, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/pid")+" ("+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugno")+reprint+")","");
  1394. //선그리기
  1395. sSndMsg += astfGraphicBox(5, 120, 465, 0, 4);
  1396. //////////////////////////////////////////////////
  1397. // 라벨 하단내용 //
  1398. /////////////////////////////////////////////////
  1399. //라벨내용
  1400. var dayqty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayprcpqty");
  1401. var qtyunit = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqtyunit");
  1402. var tims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  1403. var dayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");
  1404. var qty = Math.ceil(dayqty / tims * 1000)/1000 ;
  1405. var totqty = parseInt(dayqty)*parseInt(dayno);
  1406. var mthd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1");
  1407. var mthd2 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2");
  1408. var mthd3 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  1409. //용법
  1410. if ( mthd1 == "" && mthd2 == "" && mthd3 == "" ){
  1411. //1일 X회 Xml씩 X일분
  1412. sSndMsg += astfPrintOut(40, 126, 27, "1일 "+tims+"회 "+qty+qtyunit+"씩 "+dayno+"일분","");
  1413. var val = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/abbrnm");
  1414. if (val.length > 17) {
  1415. sSndMsg += astfPrintOut(40, 171, 27, val.substring(0,17) ,"");
  1416. sSndMsg += astfPrintOut(40, 210, 27, val.substring(17,val.length) ,"");
  1417. } else {
  1418. sSndMsg += astfPrintOut(40, 210, 27, val ,"");
  1419. }
  1420. } else {
  1421. //1일 X회 Xml씩 X일분
  1422. var val = mthd1 + " " + mthd2 + " " + mthd3;
  1423. if (val.length > 17) {
  1424. sSndMsg += astfPrintOut(40, 126, 27, "1일 "+tims+"회 "+qty+qtyunit+"씩 "+dayno+"일분","");
  1425. sSndMsg += astfPrintOut(40, 171, 27, val.substring(0,17) ,"");
  1426. sSndMsg += astfPrintOut(40, 210, 27, val.substring(17,val.length) ,"");
  1427. } else {
  1428. sSndMsg += astfPrintOut(40, 165, 27, "1일 "+tims+"회 "+qty+qtyunit+"씩 "+dayno+"일분","");
  1429. sSndMsg += astfPrintOut(40, 210, 27, val ,"");
  1430. }
  1431. }
  1432. //용법
  1433. //sSndMsg += astfPrintOut(40, 210, 27, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/abbrnm"),"");
  1434. //약품코드 + 총용량
  1435. //sSndMsg += astfPrintOut(40, 255, 27, "[ "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd")+" ] "+totqty,"");
  1436. //약품코드 + 총용량 + 약품명
  1437. var prcpnm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm");
  1438. if(PrnKind == "2") {
  1439. var val = "[ "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd")+" ] "+
  1440. parseFloat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/totdrugqty")) + " " +
  1441. prcpnm;
  1442. sSndMsg += astfPrintOut(20, 255, 27, val,"");
  1443. } else {
  1444. if(prcpnm.length > 12) {
  1445. prcpnm = prcpnm.substring(0,12);
  1446. }
  1447. sSndMsg += astfPrintOut(20, 255, 27, "[ "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd")+" ] "+
  1448. parseFloat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/totdrugqty")) + " " +
  1449. prcpnm,"");
  1450. }
  1451. //보관방법
  1452. var lblcnts1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/lblcnts1");
  1453. lblcnts1 = lblcnts1.setReplaceWord("~", "-"); //20090728
  1454. if ( lblcnts1 == "" ) {
  1455. if(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/keepmthd") != ""){
  1456. sSndMsg += astfPrintOut(40, 300, 27, "< "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/keepmthd")+" >","");
  1457. }
  1458. } else {
  1459. if(lblcnts1.length > 17){
  1460. //주의사항
  1461. sSndMsg += astfPrintOut(20, 285, 3, lblcnts1.substring(0,17),"");
  1462. sSndMsg += astfPrintOut(20, 315, 3, lblcnts1.substring(17,lblcnts1.length),"");
  1463. } else {
  1464. //주의사항
  1465. sSndMsg += astfPrintOut(40, 300, 27, lblcnts1,"");
  1466. }
  1467. }
  1468. //종료(매수)
  1469. sSndMsg += astfEndFormat(0);
  1470. CommAX.SendMsg(sSndMsg);
  1471. fSleep(500);
  1472. sSndMsg = "";
  1473. }
  1474. //CommAX.PortClose();
  1475. model.refresh();
  1476. //}
  1477. }