12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064 |
- /**
- * 파 일 명 : SPADT61300.js
- * 설 명 : (팝업)원내라벨출력 Javascriot
- * 설 계 자 : 공두경
- * 작 성 자 : 공두경
- * 수정이력 : 2007.09.20 / 최초작성 / 공두경
- */
- var sSndMsg = ""; //라벨출력내용
- var iPoint = 0; //라벨출력row
- var iCnt = 0; //라벨출력매수
- var iImageCnt = 0; //라벨그래픽폰트수
- var ordflag = "";
- var iTotalPageNum = 0;
- var iPageCnt = 0;
- var mPoint = 0;
- var nextPage = false;
- var vCnt = 0;
- /**
- * 초기화
- */
- function fInit() {
- var sParam = model.getAttribute("params");
- model.makeValue("/root/send/prcpinfo/drugdd", astfMatrixData(sParam, 1, 0));
- model.makeValue("/root/send/prcpinfo/drugno", astfMatrixData(sParam, 1, 1));
- model.makeValue("/root/send/prcpinfo/ioflag", astfMatrixData(sParam, 1, 2));
- model.makeValue("/root/send/prcpinfo/lblflag", astfMatrixData(sParam, 1, 3));
- model.makeValue("/root/send/prcpinfo/liquidflag", astfMatrixData(sParam, 1, 4));
- model.makeValue("/root/send/prcpinfo/reprintyn", astfMatrixData(sParam, 1, 5));
- model.makeValue("/root/send/prcpinfo/autoinprntyn", astfMatrixData(sParam, 1, 6));
- model.makeValue("/root/send/prcpinfo/lbl5", astfMatrixData(sParam, 1, 7)); // 2010.03.18 pymi
- model.makeValue("/root/send/prcpinfo/atclblyn", astfMatrixData(sParam, 1, 8)); // 2010-12-13 이선경
- model.makeValue("/root/send/prcpinfo/prntflag", "O");
- //model.makeValue("/root/send/prcpinfo/dlblflag", ""); // 2010.03.18 pymi
-
-
- // 2010.03.18 pymi
- /*var sLblflag = model.getValue("/root/send/prcpinfo/lblflag").split("|");
- for(var i = 0 ; i < sLblflag.length; i++) {
- if("D" == sLblflag[i] ) {
- model.setValue("/root/send/prcpinfo/dlblflag", "Y");
- break;
- }
- }
- model.refresh();*/
- // (e)
-
- submit("TRADT61301");
-
- if(model.getValue("/root/main/lbllist/lbllist["+1+"]/drugkindnm") != ""){
- if(model.getValue("/root/send/prcpinfo/liquidflag") == "Y"){
- fLiquidLBLPrint();
- } else {
- fLBLPrint();
- }
- }
-
- model.refresh();
- gTimer = window.setInterval("fStopTimer()",10000);
- window.close();
- }
- /**
- *
- */
- function fStopTimer() {
- window.clearinterval(gTimer);
- }
- function fSleep(numberMillis) {
- var now = new Date();
- var exitTime = now.getTime() + numberMillis;
- while (true) {
- now = new Date();
- if (now.getTime() > exitTime)
- return;
- }
- }
- /**
- * 라벨출력
- */
- function fLBLPrint() {
- /*
- 라벨 Sorting 로직
- //mgt에서 vo로 리턴
- 대분류
- - 내복약, 외용약, 주사, 항암제, TPN, 마약,
- 중분류
- - 방법코드
- 소분류
- - 내복약,외용약(방법코드), 주사,마약,항암제(mix)
-
-
- web js 출력로직
- 1 약종류(내복약/주사약/외용약)
- 1.1 방법코드
- 1.2 처방수량
- */
-
- // Comm 설정
- CommAX.CommPort = "1"; // 출력 Port
- CommAX.Settings = "9600,n,8,1"; // Comm 설정
- //CommAX.Settings = "127.0.0.1"; // Comm 설정
- // zebra 용지부족일때 오류 메시지 2009.10.14 pymi
- /*if(!CommAX.zebra_chk()) {
- return;
- }*/
- // (e)
- var reprint ="";
- //CommAX.PortClose();
- if ( CommAX.PortOpen() == true) {
-
- //alert("라벨 프린트 Open");
- //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");
-
- //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");
- //CommAX.PortClose();
- //return;
- //페이지번호 조회
- //var iPageCnt = 0;
-
- var prcpnum = "";
- var prcpCnt = 14; // 20101030_laboru_경북대병원_라벨 한 페이지에 최고 8개에서 14개 출력되게 변경
- for(iPoint = 1; iPoint <= getNodesetCount("/root/main/lbllist/lbllist") ; iPoint++){
- if ( model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/lblprnttims")>0 ){
- reprint ="(재)";
- }
- var sumcls = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sumcls");
- var mthdcd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcd");
-
- if (mthdcd == "ZZZ" || mthdcd == "A10PQ") { //기타용법이거나 '필요시 복용하십시오' 용법인 경우도 단독라벨출력
- sumcls = mthdcd;
- }
-
- if( fChkSumcls(iPoint)){
- //단독라벨출력
- } else {
- //일반라벨출력
- var drugkind1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
- var dayno1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");
- var mthd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd1");
- var mthd2 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd2");
- var mthd3 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd3");
- var cnt = 0;
- var lblCnt = 0;
- for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
- var drugkind2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/drugkindnm");
- var dayno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
- var mthd4 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd1");
- var mthd5 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd2");
- var mthd6 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd3");
- var lblcnts2 = model.getValue("/root/main/lbllist/lbllist["+ j +"]/lblcnts2");
-
- if((drugkind1 == drugkind2) && (dayno1 == dayno2) && (mthd1 == mthd4 && mthd2 == mthd5 && mthd3 == mthd6)
- && !fChkSumcls(j)){
- if(lblcnts2.length > 0) { lblCnt ++; }
- cnt++;
-
- // 용법 바뀌지 않는 마지막 처방 갯수 2010.02.10 pymi
- if( j == getNodesetCount("/root/main/lbllist/lbllist")) {
- //라벨갯수
- if( lblCnt >= 3 ) {
- iPageCnt += parseInt(lblCnt/3);
- lblCnt = parseInt(lblCnt%3);
-
- }
- // 기준 갯수
- if(lblCnt == 0) prcpCnt = 8;
- if(lblCnt == 1) prcpCnt = 6;
- if(lblCnt == 2) prcpCnt = 2;
-
- // 처방갯수 - 기준갯수
- var reCnt = cnt - prcpCnt;
- if( reCnt > 0 ) {
- iPageCnt ++;
- iPageCnt += parseInt(reCnt/14); // 20101030_laboru_경북대병원_라벨 한 페이지에 최고 8개에서 14개 출력되게 변경
- }
- }
- // (e)
- } else {
-
- //라벨갯수 2010.02.10 pymi
- if( lblCnt >= 3 ) {
- iPageCnt += parseInt(lblCnt/3);
- lblCnt = parseInt(lblCnt%3);
-
- }
- // 기준 갯수
- if(lblCnt == 0) prcpCnt = 8;
- if(lblCnt == 1) prcpCnt = 6;
- if(lblCnt == 2) prcpCnt = 2;
-
- // 처방갯수 - 기준갯수
- var reCnt = cnt - prcpCnt;
- if( reCnt > 0 ) {
- iPageCnt ++;
- iPageCnt += parseInt(reCnt/14); // 20101030_laboru_경북대병원_라벨 한 페이지에 최고 8개에서 14개 출력되게 변경
- }
- // (e)
- break;
- }
-
- /*if(cnt == 8){
- j++;
- break;
- }*/
- }
- if(j != iPoint) {
- iPoint = j-1;
- }
- }
- iPageCnt++;
- } //end for(iPoint)
-
- //var iTotalPageNum = iPageCnt;
- iTotalPageNum = iPageCnt;
- //alert(iTotalPageNum);
- iPageCnt = 0;
-
- for(iPoint = 1; iPoint <= getNodesetCount("/root/main/lbllist/lbllist") ; iPoint++){
- //시작(X, Y)
- sSndMsg += astfStartFormat(0, 0);
- iPageCnt++;
- //////////////////////////////////////////////////
- // 라벨 상단내용 //
- /////////////////////////////////////////////////
- //투약번호
- sSndMsg += astfPrintOut(30, 30, 6, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugno") + reprint ,"");
- //환자명
- sSndMsg += astfPrintOut(180, 30, 6, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/patnm").substring(0,5),"");
- //바코드(변환)
- // 20101030_laboru_경북대병원_atc drugkind 구분자에 의한 바코드 출력 형식
- // t : "ATC" , p : 산제 바코드, e : blank
- if(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/atc_drugkind") == "t" ) {
- sSndMsg += astfPrintOut(390, 40, 6, "ATC","");
- } else if(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/atc_drugkind") == "p") {
- //model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/barcode" , model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/barcode") + iPoint );
- sSndMsg += astfBarCode_Code39(390, 40, "N", 70, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/barcode"));
- } else {
- // 공백
- }
- //sSndMsg += astfBarCode_Code39(390, 40, "N", 70, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/barcode"));
- //환자번호
- sSndMsg += astfPrintOut(30, 80, 3, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/pid"),"");
- //성별나이
- sSndMsg += astfPrintOut(240, 85, 3, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sexage"),"");
- //처방과약어명
- sSndMsg += astfPrintOut(30, 135, 3, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/deptengabbr"),"");
- //의사명
- sSndMsg += astfPrintOut(120, 135, 3, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/orddrnm"),"");
- //처방일자==>수납일자로 변경(20091014 이선경)
- //sSndMsg += astfPrintOut(270, 135, 3, fDateFormat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd")),"");
- sSndMsg += astfPrintOut(270, 135, 3, fDateFormat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/rcptdd")),"");
- //페이지수
- sSndMsg += astfPrintOut(430, 135, 3, iPageCnt+"/"+iTotalPageNum,"");
- //바코드
- // 20101028_laboru_경북대병원_바코드 아래 내용 삭제
- //sSndMsg += astfPrintOut(510, 130, 3, "*"+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/barcode")+"*","");
- //선그리기
- sSndMsg += astfGraphicBox(5, 180, 815, 0, 4);
-
- // 20101026_laboru_경북대병원_라벨 하단 안내문구 삭제
- //sSndMsg += astfPrintOut(20, 600, 2, "*의약품은 그 특성상 보관및관리가 엄격해야하므로, 일단 조제투약된 약은 반납할 수 없습니다.");
- //////////////////////////////////////////////////
- // 라벨 하단내용 //
- /////////////////////////////////////////////////
- var sumcls = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sumcls");
- var mthdcd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcd");
-
- if (mthdcd == "ZZZ" || mthdcd == "A10PQ") { //기타용법이거나 '필요시 복용하십시오' 용법인 경우도 단독라벨출력
- sumcls = mthdcd;
- }
-
- //복용기간 계산시 수납일자를 기준으로 하고 출력
- rcptdd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/rcptdd");
-
- if( fChkSumcls(iPoint)){
- //단독라벨출력
- fIndependPrint();
- } else {
- //일반라벨출력
- fGnrlPrint();
- }
-
- //종료(매수)
- sSndMsg += astfEndFormat(0);
-
- CommAX.SendMessage(sSndMsg);
- fSleep(500);
- sSndMsg = "";
-
- // 2010.02.17 pymi
- if(nextPage) {
- fGnrlPrintnm(vCnt, ordflag);
- nextPage = false;
- vCnt = 0;
- ordflag = "";
- }
- // (e)
-
- if(iPoint == getNodesetCount("/root/main/lbllist/lbllist")) {
- iTotalPageNum = 0;
- iPageCnt = 0;
- }
- }
-
- CommAX.PortClose();
- model.refresh();
- }
- }
- /**
- *
- */
- function fIndependPrint() {
- //약종류(내복약/주사약/외용약)
- sSndMsg += astfPrintOut(30, 230, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm"),"");
- //라벨내용
- var drugkindnm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
- var qty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqty");
- var dayqty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayprcpqty");
- var qtyunit = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqtyunit");
- var tims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
- var dayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno"); //처방일수
- var mthddayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayno"); //용법일수
- var packunit = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/packunit"); //약품마스터의 수량단위
-
- if (drugkindnm == "[주사약]"){
- //용법2
- sSndMsg += astfPrintOut(30, 300, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"),"");
- } else if (drugkindnm == "[외용약]"){
- //sSndMsg += astfPrintOut(210, 230, 7, "1일 "+tims+"회 "+fChkFloat(qty)+"개씩 "+dayno+"일분","");
- //용법1
- ///sSndMsg += astfPrintOut(30, 300, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2")
- ///
- //용법2
- ///sSndMsg += astfPrintOut(30, 370, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"),""); + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3"),"");
-
- //이선경 2008-08-20 start(용법이 짤리지 않고 출력되도록)
- var val = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2")
- + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
- if(val.length > 22) {
- sSndMsg += astfPrintOut(30, 300, 7, val.substring(0, 22),"");
-
- if(val.substring(0, 22).length > 22) {
- sSndMsg += astfPrintOut(30, 370, 7, val.substring(22, 50),"");
- sSndMsg += astfPrintOut(30, 440, 7, val.substring(50, val.length),"");
- } else {
- sSndMsg += astfPrintOut(30, 370, 7, val.substring(22, val.length),"");
- }
- } else {
- sSndMsg += astfPrintOut(30, 300, 7, val.substring(0, 22),"");
- }
-
- //이선경 2008-08-20 end(용법이 짤리지 않고 출력되도록)
-
- } else if (drugkindnm == "[내복약]"){
- var sumcls = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sumcls");
- if( sumcls == "DM" || sumcls == "DS" || sumcls == "DT" || sumcls == "DX"){ //20091110 이선경 수정 : 라벨그룹이 마약(경구), 수제, ptp, 기타약일경우 약품마스터의 수량단위를 출력
- var tmpqty = Math.round(qty * 10) / 10;
- if(packunit == "T" || packunit == "C") {
- sSndMsg += astfPrintOut(210, 230, 7, mthddayno + "일 "+tims+"회 "+fChkFloat(qty)+"정씩 "+(dayno*mthddayno)+"일분","");
- } else {
- //sSndMsg += astfPrintOut(210, 230, 7, mthddayno + "일 "+tims+"회 "+fChkFloat(tmpqty)+ qtyunit +"씩 "+(dayno*mthddayno)+"일분","");
- sSndMsg += astfPrintOut(210, 230, 7, mthddayno + "일 "+tims+"회 "+fChkFloat(tmpqty)+ packunit +"씩 "+(dayno*mthddayno)+"일분","");
- }
- } else {
- sSndMsg += astfPrintOut(210, 230, 7, mthddayno + "일 "+tims+"회 "+fChkFloat(qty)+"포[정]씩 "+(dayno*mthddayno)+"일분","");
- }
- //용법1
- //sSndMsg += astfPrintOut(30, 300, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2")
- // + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3"),"");
- //용법2
- //sSndMsg += astfPrintOut(30, 370, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"),"");
-
- var val = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2")
- + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
-
- if(val.length > 28) {
- sSndMsg += astfPrintOut(30, 300, 7, val.substring(0, 28),"");
-
- if(val.substring(0, 28).length > 28) {
- sSndMsg += astfPrintOut(30, 370, 7, val.substring(28, 56),"");
- sSndMsg += astfPrintOut(30, 440, 7, val.substring(56, val.length),"");
- } else {
- sSndMsg += astfPrintOut(30, 370, 7, val.substring(28, val.length),"");
- }
-
- } else {
- sSndMsg += astfPrintOut(30, 300, 7, val,"");
- }
- }
-
- var lblcnts1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/lblcnts1");
-
- // 2010.03.18 pymi
- if(!fChkSumcls(iPoint) && model.getValue("/root/send/prcpinfo/lbl5") == "Y") {
- var val = "";
- } else {
- // 20101027_laboru_경북대병원_라벨 출력물 처방코드 삭제
- var val = parseFloat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/totdrugqty"))
- +" "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm");
- /*
- var val = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd")
- +" "+parseFloat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/totdrugqty"))
- +" "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm");
- */
- }
- // (e)
-
- /*var val = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd")
- +" "+parseFloat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/totdrugqty"))
- +" "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm");*/
- if(lblcnts1.length > 28){
- //주의사항
- sSndMsg += astfPrintOut(30, 450, 5, lblcnts1.substring(0,28),"");
-
- if(val.substring(0, 28).length > 28) {
- sSndMsg += astfPrintOut(30, 510, 5, lblcnts1.substring(28,56),"");
- sSndMsg += astfPrintOut(30, 570, 5, lblcnts1.substring(56,lblcnts1.length),"");
- } else {
- sSndMsg += astfPrintOut(30, 510, 5, lblcnts1.substring(28,lblcnts1.length),"");
- }
- //약정보
- sSndMsg += astfPrintOut(30, 570, 4, val, "");
- } else {
- //주의사항
- sSndMsg += astfPrintOut(30, 450, 5, lblcnts1,"");
- //약정보
- sSndMsg += astfPrintOut(30, 510, 4, val, "");
- }
-
- /*if(lblcnts1.length > 28){
- //주의사항
- sSndMsg += astfPrintOut(30, 510, 5, lblcnts1.substring(0,24),"");
- sSndMsg += astfPrintOut(30, 570, 5, lblcnts1.substring(24,lblcnts1.length),"");
- //약정보
- sSndMsg += astfPrintOut(30, 630, 4, val, "");
- } else {
- //주의사항
- sSndMsg += astfPrintOut(30, 510, 5, lblcnts1,"");
- //약정보
- sSndMsg += astfPrintOut(30, 570, 4, val, "");
- }*/
- //var s= "복용기간: "+((getCurrentDate()).toDate("YYYYMMDD")).getDateFormat("YYYY/MM/DD") +" - "+ (((getCurrentDate()).toDate("YYYYMMDD")).getAddDate( parseInt(dayno),"D")).getDateFormat("YYYY/MM/DD");
- //2010-07-12 [요청번호:13891] 투약라벨에 복용기간이 출력되지 않도록 삭제 요청
- //var s= "복용기간: "+(rcptdd.toDate("YYYYMMDD")).getDateFormat("YYYY/MM/DD") +" - "+ ((rcptdd.toDate("YYYYMMDD")).getAddDate( parseInt(dayno),"D")).getDateFormat("YYYY/MM/DD");
- //sSndMsg +=astfPrintOut(30, 630, 3, s);
- }
-
- /**
- *
- */
- function fGnrlPrint() {
- var cnt = 0;
- var ordCnt = 0;
- //약종류(내복약/주사약/외용약)
- sSndMsg += astfPrintOut(30, 220, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm"),"");
- //라벨내용
- var drugkindnm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
- var qty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqty");
- var dayqty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayprcpqty");
- var tims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
- var dayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");//처방일수
- var mthddayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayno"); //용법일수
-
- //약코드 출력
- var drugkind1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
- var dayno1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");
- var mthd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd1");
- var mthd2 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd2");
- var mthd3 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd3");
- var mthdcd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcd");
-
-
- if( drugkindnm != "[내복약]") {
- if (drugkindnm == "[주사약]"){
- //용법2
- sSndMsg += astfPrintOut(30, 290, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"),"");
- } else if (drugkindnm == "[외용약]"){
- //sSndMsg += astfPrintOut(210, 220, 7, "1일 "+tims+"회 "+qty+"개씩 "+dayno+"일분","");
- //용법1
- sSndMsg += astfPrintOut(30, 290, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2")
- + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3"),"");
- //용법2
- sSndMsg += astfPrintOut(30, 360, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"),"");
- }
-
- for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
- var drugkind2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/drugkindnm");
- var dayno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
- var mthd4 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd1");
- var mthd5 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd2");
- var mthd6 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd3");
- if((drugkind1 == drugkind2) && (dayno1 == dayno2) && (mthd1 == mthd4 && mthd2 == mthd5 && mthd3 == mthd6)
- && !fChkSumcls(j)){
- //if(model.getValue("/root/main/lbllist/lbllist["+j+"]/fst_prnt") == "Y"){
- var prcpqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty")/model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
- prcpqty = Math.ceil( prcpqty * tims*1000)/1000 ;
- // 2010.03.18 pymi
- if(!fChkSumcls(j) && model.getValue("/root/send/prcpinfo/lbl5") == "Y") {
- var val = "";
- } else {
- // 20101027_laboru_경북대병원_라벨 출력물 처방코드 삭제
- var val = prcpqty
- +" "+model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
- /*
- var val = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd")
- +" "+prcpqty
- +" "+model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
- */
- }
-
- /*var val = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd")
- +" "+prcpqty
- +" "+model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");*/
- sSndMsg += astfPrintOut(30+((cnt%2)*380), 440+((parseInt(cnt/2, 10))*40), 2, val, "");
- //}
- cnt++;
- } else {
- break;
- }
-
- if(cnt == 14){ // 20101030_laboru_경북대병원_라벨 한 페이지에 최고 8개에서 14개 출력되게 변경
- j++;
- break;
- }
- }
- iPoint = j-1;
- //var s ="복용기간: "+((getCurrentDate()).toDate("YYYYMMDD")).getDateFormat("YYYY/MM/DD") +" - "+ (((getCurrentDate()).toDate("YYYYMMDD")).getAddDate( parseInt(dayno),"D")).getDateFormat("YYYY/MM/DD") ;
- //2010-07-12 [요청번호:13891] 투약라벨에 복용기간이 출력되지 않도록 삭제 요청
- //var s ="복용기간: "+(rcptdd.toDate("YYYYMMDD")).getDateFormat("YYYY/MM/DD") +" - "+ ((rcptdd.toDate("YYYYMMDD")).getAddDate( parseInt(dayno),"D")).getDateFormat("YYYY/MM/DD") ;
- //sSndMsg +=astfPrintOut(30, 630, 3, s);
-
- } else if (drugkindnm == "[내복약]"){
- var lbltims =0;
- lbl_tims = mthd2.split(",");
- if ( mthdcd == "ZZZ" ){
- lbltims = tims;
- } else if ( mthd3.indexOf("취침") > -1 ) {
- lbltims = lbl_tims.length +1;
- } else if(mthd2.indexOf("마다") > -1){
- lbltims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
- } else {
- lbltims = lbl_tims.length;
- }
- tims = lbltims;
-
- if(lbltims == 1) {
- if(mthd2.indexOf("마다") == -1) {
- sSndMsg += astfPrintOut(210, 220, 7, mthddayno + "일 "+lbltims+ "회 1포씩 "+dayno+"일분","");
-
- } else {
- sSndMsg += astfPrintOut(210, 220, 7, mthddayno + "일 "+tims+ "회 1포씩 "+dayno+"일분","");
-
- }
- } else {
- sSndMsg += astfPrintOut(210, 220, 7, mthddayno + "일 "+lbltims+ "회 1포씩 "+dayno+"일분","");
- }
-
- sSndMsg += astfPrintOut(30, 290, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd1") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd2")
- + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd3"),"");
- //용법2
- sSndMsg += astfPrintOut(30, 360, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"),"");
-
-
- // 포장 라벨내용찍기
- for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
- var drugkind2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/drugkindnm");
- var dayno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
- var mthd4 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd1");
- var mthd5 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd2");
- var mthd6 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd3");
- if((drugkind1 == drugkind2) && (dayno1 == dayno2) && (mthd1 == mthd4 && mthd2 == mthd5 && mthd3 == mthd6)
- && !fChkSumcls(j)){
-
- //cnt++;
- var lblcnts2 = model.getValue("/root/main/lbllist/lbllist["+ j +"]/lblcnts2");
- ordflag += j + "/"; // 포장라벨 처방코드 순서
-
- if(lblcnts2.length > 0) {
- sSndMsg += astfPrintOut(30, 440 +(60 * ordCnt), 4, lblcnts2, "");
- ordCnt++; // 포장라벨 갯수
- }
-
-
- } else {
- // 용법이 바뀌는 시점 2010.02.10 pymi
- // 약코드 찍기
- fGnrlPrintnm(ordCnt, ordflag);
- ordflag = "";
- // (e)
- break;
- }
-
- if(ordCnt == 3){
- j++;
-
- // 2010.02.18 pymi
- if(j <= getNodesetCount("/root/main/lbllist/lbllist")) {
- var drugkind3 = model.getValue("/root/main/lbllist/lbllist["+j+"]/drugkindnm");
- var dayno3 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
- var mthd7 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd1");
- var mthd8 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd2");
- var mthd9 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd3");
- if((drugkind1 == drugkind3) && (dayno1 == dayno3) && (mthd1 == mthd7 && mthd2 == mthd8 && mthd3 == mthd9)
- && !fChkSumcls(j)){
- // 페이지 넘겨서도 용법 바뀌지 않으면 계속 진행
- } else {
- // 페이지 넘길때 용법이 바뀌면 처방 출력
- nextPage = true;
- vCnt = ordCnt;
- //fGnrlPrintnm(ordCnt, bordflag);
- }
- }
- // (e)
- break;
- }
- }
- iPoint = j-1;
- //2010-07-12 [요청번호:13891] 투약라벨에 복용기간이 출력되지 않도록 삭제 요청
- //var s ="복용기간: "+(rcptdd.toDate("YYYYMMDD")).getDateFormat("YYYY/MM/DD") +" - "+ ((rcptdd.toDate("YYYYMMDD")).getAddDate( parseInt(dayno),"D")).getDateFormat("YYYY/MM/DD") ;
- //sSndMsg +=astfPrintOut(30, 630, 3, s);
-
- // 2010.02.18 pymi
- if(iPoint == getNodesetCount("/root/main/lbllist/lbllist") ) {
- if(ordCnt == 3) {
- nextPage = true;
- vCnt = ordCnt;
- }
- else {
- fGnrlPrintnm(ordCnt, ordflag);
- ordflag = "";
- }
- }
- // (e)
- }
-
- }
- /*
- * 2010.02.18 pymi 처방출력
- */
- function fGnrlPrintnm(linecnt, ordflag) {
- var cnt = 0;
- var xValue = 440;
- var valCnt = 14; // 20101030_laboru_경북대병원_라벨 한 페이지에 최고 8개에서 14개 출력되게 변경
- var lblup = false;
-
- var sordflag = "";
- sordflag = ordflag.split("/");
- if(linecnt == 1) { xValue = 490; valCnt = 6; }
- if(linecnt == 2) { xValue = 540; valCnt = 2; }
- if(linecnt == 3) { xValue = 440; valCnt = 8; lblup = true;}
-
-
- //약종류(내복약/주사약/외용약)
- for(var mPoint = parseInt(sordflag[0]); mPoint <= parseInt(sordflag[sordflag.length - 2]); mPoint++) {
- //for(; ;mPoint++){
- //alert(222);
- if(lblup) {
- //시작(X, Y)
- xValue = 440;
- valCnt = 14; // 20101030_laboru_경북대병원_라벨 한 페이지에 최고 8개에서 14개 출력되게 변경
- cnt = 0;
-
- //
- /*CommAX.CommPort = "1"; // 출력 Port
- CommAX.Settings = "9600,n,8,1"; // Comm 설정
- //
- CommAX.PortOpen();*/
- var reprint ="";
- if ( model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/lblprnttims")>0 ){
- reprint ="(재)";
- }
- sSndMsg += astfStartFormat(0, 0);
- iPageCnt++;
- //////////////////////////////////////////////////
- // 라벨 상단내용 //
- /////////////////////////////////////////////////
- //투약번호
- sSndMsg += astfPrintOut(30, 30, 6, model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/drugno") + reprint ,"");
- //환자명
- sSndMsg += astfPrintOut(180, 30, 6, model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/patnm").substring(0,5),"");
- //바코드(변환)
- // 20101030_laboru_경북대병원_atc drugkind 구분자에 의한 바코드 출력 형식
- // t : "ATC" , p : 산제 바코드, e : blank
- if(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/atc_drugkind") == "t" ) {
- sSndMsg += astfPrintOut(390, 40, 6, "ATC","");
- } else if(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/atc_drugkind") == "p") {
- sSndMsg += astfBarCode_Code39(390, 40, "N", 70, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/barcode"));
- } else {
- // 공백
- }
- //sSndMsg += astfBarCode_Code39(390, 40, "N", 70, model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/barcode"));
- //환자번호
- sSndMsg += astfPrintOut(30, 80, 3, model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/pid"),"");
- //성별나이
- sSndMsg += astfPrintOut(240, 85, 3, model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/sexage"),"");
- //처방과약어명
- sSndMsg += astfPrintOut(30, 135, 3, model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/deptengabbr"),"");
- //의사명
- sSndMsg += astfPrintOut(120, 135, 3, model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/orddrnm"),"");
- //처방일자==>수납일자로 변경(20091014 이선경)
- //sSndMsg += astfPrintOut(270, 135, 3, fDateFormat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd")),"");
- sSndMsg += astfPrintOut(270, 135, 3, fDateFormat(model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/rcptdd")),"");
- //페이지수
- sSndMsg += astfPrintOut(430, 135, 3, iPageCnt+"/"+iTotalPageNum,"");
- //바코드
- // 20101028_laboru_경북대병원_바코드 아래 내용 삭제
- //sSndMsg += astfPrintOut(510, 130, 3, "*"+model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/barcode")+"*","");
- //선그리기
- sSndMsg += astfGraphicBox(5, 180, 815, 0, 4);
-
- // 20101026_laboru_경북대병원_라벨 하단 안내문구 삭제
- //sSndMsg += astfPrintOut(20, 600, 2, "*의약품은 그 특성상 보관및관리가 엄격해야하므로, 일단 조제투약된 약은 반납할 수 없습니다.");
-
- lblup = false;
- }
-
- sSndMsg += astfPrintOut(30, 220, 7, model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/drugkindnm"),"");
- //라벨내용
- var drugkindnm = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/drugkindnm");
- var qty = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/prcpqty");
- var dayqty = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/dayprcpqty");
- var tims = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/prcptims");
- var dayno = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/prcpdayno");//처방일수
- var mthddayno = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/dayno"); //용법일수
-
- //약코드 출력
- var drugkind1 = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/drugkindnm");
- var dayno1 = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/prcpdayno");
- var mthd1 = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/mthd1");
- var mthd2 = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/mthd2");
- var mthd3 = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/mthd3");
- var mthdcd = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/mthdcd");
-
- // 용법 출력
- var lbltims =0;
- lbl_tims = mthd2.split(",");
- if ( mthdcd == "ZZZ" ){
- lbltims = tims;
- } else if ( mthd3.indexOf("취침") > -1 ) {
- lbltims = lbl_tims.length +1;
- } else if(mthd2.indexOf("마다") > -1){
- lbltims = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/prcptims");
- } else {
- lbltims = lbl_tims.length;
- }
- tims = lbltims;
-
- if(lbltims == 1) {
- if(mthd2.indexOf("마다") == -1) {
- sSndMsg += astfPrintOut(210, 220, 7, mthddayno + "일 "+lbltims+ "회 1포씩 "+dayno+"일분","");
-
- } else {
- sSndMsg += astfPrintOut(210, 220, 7, mthddayno + "일 "+tims+ "회 1포씩 "+dayno+"일분","");
-
- }
- } else {
- sSndMsg += astfPrintOut(210, 220, 7, mthddayno + "일 "+lbltims+ "회 1포씩 "+dayno+"일분","");
- }
- sSndMsg += astfPrintOut(30, 290, 7, model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/mthd1") + model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/mthd2")
- + model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/mthd3"),"");
-
- sSndMsg += astfPrintOut(30, 360, 7, model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/mthdcnts4"),"");
-
- for(var j = mPoint; j <= parseInt(sordflag[sordflag.length - 2]) ; j++){
- //var drugkind2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/drugkindnm");
- //var dayno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
- //var mthd4 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd1");
- //var mthd5 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd2");
- //var mthd6 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd3");
- //if((drugkind1 == drugkind2) && (dayno1 == dayno2) && (mthd1 == mthd4 && mthd2 == mthd5 && mthd3 == mthd6)
- // && !fChkSumcls(j)){
- //if(model.getValue("/root/main/lbllist/lbllist["+j+"]/fst_prnt") == "Y"){
- var prcpqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty")/model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
- prcpqty = Math.ceil( prcpqty * tims*1000)/1000 ;
- // 2010.03.18 pymi
- if(!fChkSumcls(j) && model.getValue("/root/send/prcpinfo/lbl5") == "Y") {
- var val = "";
- } else {
- // 20101027_laboru_경북대병원_라벨 출력물 처방코드 삭제
- var val = prcpqty
- +" "+model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
- /*
- var val = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd")
- +" "+prcpqty
- +" "+model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
- */
- }
- /*var val = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd")
- +" "+prcpqty
- +" "+model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");*/
- sSndMsg += astfPrintOut(30+((cnt%2)*380), xValue+((parseInt(cnt/2, 10))*40), 2, val, "");
- //}
- cnt++;
- //} else {
- // break;
- //}
-
- //if(cnt == 8){
- if(cnt == valCnt){
- j++;
- lblup = true;
- break;
- }
- }
-
- mPoint = j-1;
-
- //2010-07-12 [요청번호:13891] 투약라벨에 복용기간이 출력되지 않도록 삭제 요청
- //var s ="복용기간: "+(rcptdd.toDate("YYYYMMDD")).getDateFormat("YYYY/MM/DD") +" - "+ ((rcptdd.toDate("YYYYMMDD")).getAddDate( parseInt(dayno),"D")).getDateFormat("YYYY/MM/DD") ;
- //sSndMsg +=astfPrintOut(30, 630, 3, s);
-
- //종료(매수)
- sSndMsg += astfEndFormat(0);
- CommAX.SendMessage(sSndMsg);
- fSleep(500);
- sSndMsg = "";
- //CommAX.PortClose();
- model.refresh();
-
- }
-
- }
- /**
- *
- */
- function fGetImage() {
- var pImage = "";
- iImageCnt++;
- if(iImageCnt > 99){
- pImage = "GRAPH"+iImageCnt;
- } else if(iImageCnt > 9){
- pImage = "GRAPH0"+iImageCnt;
- } else {
- pImage = "GRAPH00"+iImageCnt;
- }
- return pImage
- }
- /**
- *
- */
- function fDateFormat(sDD) {
-
- return sDD.substr(0,4)+"/"+sDD.substr(4,2)+"/"+sDD.substr(6,2);
- }
- /**
- *
- */
- function fChkFloat(qty) {
- var fQty = parseFloat(qty);
- var fRst = "";
- if(fQty%1 == 0){
- fRst = parseInt(qty);
- } else {
- fRst = qty;
- }
-
- return fRst;
- }
- /**
- *
- */
- function fChkSumcls(cnt) {
- var chk = false;
- var sSumcls = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/sumcls");
- var sSnglyn = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/atcifsnglyn");
- var sDrugindependpackflag = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/drugindependpackflag");
- if(sSumcls == "DI" || sSumcls == "DS"|| sSumcls == "DX"|| sSumcls == "DT" || sSumcls == "DM" || sSumcls == "IH"|| sSumcls == "IO"
- || sSumcls == "IS"|| sSumcls == "IX"|| sSumcls == "X" || sSumcls == "ZZZ" || sSumcls == "A10PQ" || sSumcls == "I"){
- chk = true;
- }
- if ( sSumcls == "D" && sSnglyn =="Y" ) {
- chk = true;
- }
- if ( sDrugindependpackflag =="Y"){
- chk = true;
- }
- return chk;
- }
- /**
- * 물약라벨출력
- */
- function fLiquidLBLPrint() {
- // Comm 설정
- CommAX.CommPort = "1"; // 출력 Port
- CommAX.Settings = "9600,n,8,1"; // Comm 설정
- //CommAX.Settings = "127.0.0.1"; // Comm 설정
- // zebra 용지부족일때 오류 메시지 2009.10.14 pymi
- /*if(!CommAX.zebra_chk()) {
- return;
- }*/
- // (e)
- var reprint="";
-
- //CommAX.PortClose();
- if ( CommAX.PortOpen() == true) {
- for(iPoint = 1; iPoint <= getNodesetCount("/root/main/lbllist/lbllist") ; iPoint++){
- if ( model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/lblprnttims")>0 ){
- reprint ="(재)";
- }
- //시작(X, Y)
- sSndMsg += astfStartFormat(0, 0);
- //////////////////////////////////////////////////
- // 라벨 상단내용 //
- /////////////////////////////////////////////////
- //투약번호
- //sSndMsg += astfPrintOut(50, 30, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugno")+reprint,"");
- //환자명
- //sSndMsg += astfPrintOut(50, 85, 6, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/patnm"),"");
- //내복약
- //sSndMsg += astfPrintOut(250, 30, 3, "내복약","");
- //처방일자
- //sSndMsg += astfPrintOut(250, 70, 3, fDateFormat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd")),"");
- //환자번호
- //sSndMsg += astfPrintOut(250, 110, 3, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/pid"),"");
- //선그리기
- //8sSndMsg += astfGraphicBox(5, 145, 465, 0, 4);
-
- var sDD = getCurrentDate();
- var sTM = getCurrentTime();
-
- //라벨이름(내복약/주사약/마약)
- sSndMsg += astfPrintOut(20, 25, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm"),"");
- //출력일자
- sSndMsg += astfPrintOut(220, 25, 21, "출 력 : "+fPrntTime(sDD, sTM),"");
- //처방일자==>수납일자로 변경(20091014 이선경)
- //sSndMsg += astfPrintOut(220, 55, 21, "처 방 : "+fDateFormat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd"), "MD"),"");
- sSndMsg += astfPrintOut(220, 55, 21, "수 납 : "+fDateFormat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/rcptdd"), "MD"),"");
- //처방과약어명
- sSndMsg += astfPrintOut(20, 80, 31, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/deptengabbr"),"");
- //환자이름
- sSndMsg += astfPrintOut(120, 80, 31, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/patnm"),"");
- //환자번호
- sSndMsg += astfPrintOut(240, 80, 31, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/pid")+" ("+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugno")+reprint+")","");
- //선그리기
- sSndMsg += astfGraphicBox(5, 120, 465, 0, 4);
-
- //////////////////////////////////////////////////
- // 라벨 하단내용 //
- /////////////////////////////////////////////////
- //라벨내용
- var dayqty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayprcpqty");
- var qtyunit = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqtyunit");
- var tims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
- var dayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");
- var qty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqty");
- var totqty = parseInt(dayqty)*parseInt(dayno);
- //1일 X회 Xml씩 X일분
- qty = Math.round(qty*10) / 10;
-
- var mthd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1");
- var mthd2 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2");
- var mthd3 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
- //용법
- if ( mthd1 == "" && mthd2 == "" && mthd3 == "" ){
- //1일 X회 Xml씩 X일분
- sSndMsg += astfPrintOut(40, 126, 27, "1일 "+tims+"회 "+qty+qtyunit+"씩 "+dayno+"일분","");
- var val = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/abbrnm");
- sSndMsg += astfPrintOut(40, 171, 27, val.substring(0,17) ,"");
- sSndMsg += astfPrintOut(40, 210, 27, val.substring(17,val.length) ,"");
- } else {
- //1일 X회 Xml씩 X일분
- sSndMsg += astfPrintOut(40, 165, 27, "1일 "+tims+"회 "+qty+qtyunit+"씩 "+dayno+"일분","");
- sSndMsg += astfPrintOut(40, 210, 27, mthd1 + " " + mthd2 + " " + mthd3 ,"");
- }
-
- //약품코드 + 총용량 + 약품명
- var prcpnm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm");
- if(prcpnm.length > 12) {
- prcpnm = prcpnm.substring(0,12);
- }
- sSndMsg += astfPrintOut(20, 255, 27, "[ "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd")+" ] "+
- parseFloat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/totdrugqty")) + " " +
- prcpnm,"");
-
- //보관방법
- var lblcnts1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/lblcnts1");
- if ( lblcnts1 == "" ) {
- if(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/keepmthd") != ""){
- sSndMsg += astfPrintOut(40, 300, 27, "< "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/keepmthd")+" >","");
- }
- } else {
- if(lblcnts1.length > 28){
- //주의사항
- sSndMsg += astfPrintOut(20, 285, 3, lblcnts1.substring(0,24),"");
- sSndMsg += astfPrintOut(20, 315, 3, lblcnts1.substring(24,lblcnts1.length),"");
- } else {
- //주의사항
- sSndMsg += astfPrintOut(40, 300, 27, lblcnts1,"");
- }
- }
-
- //종료(매수)
- sSndMsg += astfEndFormat(0);
-
- CommAX.SendMessage(sSndMsg);
- fSleep(500);
- sSndMsg = "";
- }
-
- CommAX.PortClose();
- model.refresh();
- }
- }
- function fPrntTime(sDD, sTM) {
-
- return sDD.substr(4,2)+" / "+sDD.substr(6,2)+" "+sTM.substr(0,2)+":"+sTM.substr(2,2)+":"+sTM.substr(4,2);
- }
|