SPADT62302.js 53 KB

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