123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680 |
- /**
- * 파 일 명 : SPADT62300.js
- * 설 명 : (팝업)병동라벨출력 Javascriot
- * 설 계 자 : 공두경
- * 작 성 자 : 공두경
- * 수정이력 : 2007.09.17 / 최초작성 / 공두경
- */
- var sSndMsg = ""; //라벨출력내용
- var iPoint = 1; //라벨출력row
- var iCnt = 0; //라벨출력매수
- var iImageCnt = 0; //라벨그래픽폰트수
- var gTimer = null;
- var pg =0;
- var totpg =0;
- var totcnt =0;
- var ordflag = "";
- var bordflag = "";
- var vcnt = 0;
- var nCnt = 0;
- var vlblcnt = false;
- var mlblcnt = false;
- var nextPage = false;
- /**
- * 초기화
- */
- function fInit() {
- //window.minimize();
- 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/prcpdd", astfMatrixData(sParam, 1, 3));
- model.makeValue("/root/send/prcpinfo/orddd", astfMatrixData(sParam, 1, 4));
- model.makeValue("/root/send/prcpinfo/cretno", astfMatrixData(sParam, 1, 5));
- model.makeValue("/root/send/prcpinfo/prcpgenrflag", astfMatrixData(sParam, 1, 6));
- model.makeValue("/root/send/prcpinfo/pid", astfMatrixData(sParam, 1, 7));
- model.makeValue("/root/send/prcpinfo/orddeptcd", astfMatrixData(sParam, 1, 8));
- model.makeValue("/root/send/prcpinfo/wardcd", astfMatrixData(sParam, 1, 9));
- model.makeValue("/root/send/prcpinfo/lblflag", astfMatrixData(sParam, 1, 10));
- model.makeValue("/root/send/prcpinfo/prcpflag", astfMatrixData(sParam, 1, 11));
- model.makeValue("/root/send/prcpinfo/prntflag", astfMatrixData(sParam, 1, 12));
- model.makeValue("/root/send/prcpinfo/liquidflag", astfMatrixData(sParam, 1, 13));
- model.makeValue("/root/send/prcpinfo/etcdescflag", astfMatrixData(sParam, 1, 14));
- model.makeValue("/root/send/prcpinfo/lblkind", astfMatrixData(sParam, 1, 15));
- model.makeValue("/root/send/prcpinfo/outlblyn", astfMatrixData(sParam, 1, 16));
- model.makeValue("/root/send/prcpinfo/ptplblyn", astfMatrixData(sParam, 1, 17));
- model.makeValue("/root/send/prcpinfo/reprintyn", astfMatrixData(sParam, 1, 18));
- model.makeValue("/root/send/prcpinfo/lbltype", astfMatrixData(sParam, 1, 19));
- model.makeValue("/root/send/prcpinfo/drugkind", astfMatrixData(sParam, 1, 20));
- model.makeValue("/root/send/prcpinfo/autolblyn", astfMatrixData(sParam, 1, 21));
- model.refresh();
- submit("TRADT62301");
-
-
- if(model.getValue("/root/main/lbllist/lbllist["+1+"]/drugkindnm") != ""){
- if(model.getValue("/root/send/prcpinfo/liquidflag") == "Y" || model.getValue("/root/send/prcpinfo/outlblyn") == "Y"){
- fLiquidLBLPrint();
- } else if(model.getValue("/root/main/lbllist/lbllist["+1+"]/drugflag") == "E" || model.getValue("/root/main/lbllist/lbllist["+1+"]/drugflag") == "L"
- || model.getValue("/root/main/lbllist/lbllist["+1+"]/drugflag") == "G"){
- fBigLBLPrint();
- } else {
- fSmallLBLPrint();
- }
- }
-
- 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 fSmallLBLPrint() {
- /*
- 라벨 Sorting 로직
- //mgt에서 vo로 리턴
- 대분류
- - 내복약, 외용약, 주사, 항암제, TPN, 마약,
- 중분류
- - 방법코드
- 소분류
- - 내복약,외용약(방법코드), 주사,마약,항암제(mix)
-
-
- web js 출력로직
- 가. 퇴원/외래/응급실/외박/외출 : 큰사이즈라벨
- 외래기준
- 나. 그외 입원처방
- 1. 외용약
- 단독출력
- 2. 내복약
- 단독출력
- 따로포장
- 복용방법
- 3. 주사약
- 단독출력
- mix끼리
- 고가,향정,보관벙법이 실온이 아닌경우 자가주사인 경우 단독
- 나머지
- */
- // Comm 설정
- //CommAX.CommPort = "1"; // 출력 Port
- //CommAX.Settings = "9600,n,8,1"; // Comm 설정
- //CommAX.Settings = "127.0.0.1"; // Comm 설정
- PrnKind = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/prntkind");
- PrnMarginLeft = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/blank/left");
- PrnMarginTop = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/blank/top");
- var commkind = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/commkind")
- if ( PrnKind ==7 ) {
- CommAX.PrnKind =4;
- } else {
- CommAX.PrnKind =PrnKind;
- }
-
- if(commkind == "02") {
- CommAX.PortNm = 1;
- } else {
- CommAX.PortNm = 2;
- }
-
- if(commkind == "01") {
- CommAX.PrtNm = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/comm01/setupval");
- }
-
- //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 sDD = getCurrentDate();
- var sTM = getCurrentTime();
- var reprint ="";
-
- for ( var i = 1; i <= getNodesetCount("/root/main/lbllist/lbllist") ; i++){
- if ( model.getValue("/root/main/lbllist/lbllist["+i+"]/lblgrup") != "DI" && model.getValue("/root/main/lbllist/lbllist["+i+"]/lblgrup") != "DS" ){
- totcnt++;
- }
- }
-
- // 2010.02.12 pymi
- if( parseInt(totcnt%6) != 0) totcnt ++; // 라벨찍기 전에 한줄 띄우기
- for ( var i = 1; i <= getNodesetCount("/root/main/lbllist/lbllist") ; i++){
- if(model.getValue("/root/main/lbllist/lbllist["+ i +"]/lblcnts2").length > 0) { totcnt++; vlblcnt = true;}
- }
- // (e)
-
- 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, "S");
- //라벨이름(내복약/주사약/마약)
- sSndMsg += astfPrintOut(20, 25, 21, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm"),"");
-
- //if(PrnKind == "2" || PrnKind == "7") {
- //출력일자
- sSndMsg += astfPrintOut(190, 25, 21, "출력:"+fPrntTime(sDD, sTM),"");
- //출력일자
- sSndMsg += astfPrintOut(190, 55, 21, "처방:"+fDateFormat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd"), "MD"),"");
- //} else {
- //출력일자
- // sSndMsg += astfPrintOut(220, 25, 21, "출 력 : "+fPrntTime(sDD, sTM),"");
- //출력일자
- // sSndMsg += astfPrintOut(220, 55, 21, "처 방 : "+fDateFormat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd"), "MD"),"");
- //}
-
- //병실
- sSndMsg += astfPrintOut(20, 80, 31, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/roomcd"),"");
- //환자이름
- 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 sDrugKindcd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
- var sMixno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpmixno");
- if(sDrugKindcd == "[내복약]"){
- if(model.getValue("/root/send/prcpinfo/lbltype") == "Y"){
- fInUseDrugLBL2();
-
- // 2010.02.12 pymi
- //if((vcnt < 6) && (vlblcnt) && (iPoint == getNodesetCount("/root/main/lbllist/lbllist")) ) {
- if( vcnt < 6 && vlblcnt ) {
- mlblcnt = true;
- fPrntLblCnt2(vcnt, ordflag);
- ordflag = "";
- vcnt = 0;
- }
- // (e)
- } else {
- fInUseDrugLBL();
- }
- } else if(sDrugKindcd == "[외용약]"){
- //fExUseDrugLBL();
- if(model.getValue("/root/send/prcpinfo/lbltype") == "Y"){
- fInUseDrugLBL2();
- //fOutUseDrugLBL2();
- } else {
- fInUseDrugLBL();
- }
- } else if(sDrugKindcd == "[주사약]"){
- //alert(sMixno);
- if(sMixno != "-"){
- fMixLBL();
- } else {
- fInjDrugLBL();
- }
- }
- CommAX.SendMsg(sSndMsg);
- fSleep(500);
- sSndMsg = "";
-
- // 2010.02.11 pymi
- if(sDrugKindcd == "[내복약]") {
- if( iPoint == getNodesetCount("/root/main/lbllist/lbllist") ) {
- if(model.getValue("/root/send/prcpinfo/lbltype") == "Y"){
- if(vlblcnt && (!mlblcnt) && (ordflag.length > 0)) {
- fPrntLblCnt2(vcnt, ordflag);
- ordflag = "";
- vcnt = 0;
- }
- }
- mlblcnt = false;
- }
- }
- // (e)
- }
-
- //CommAX.PortClose();
- model.refresh();
- //}
- }
- /**
- * mix 라벨
- */
- function fMixLBL() {
- var sMixno1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpmixno");
- var cnt = 0;
- for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
-
- sMixno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpmixno");
- var qty = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqty");
- var dayqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/dayprcpqty");
- var qtyunit = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqtyunit");
- var tims = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
- var dayno = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
- if(PrnKind == "2") {
- var prcpnm= model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
- prcpnm = prcpnm.substr(0,7);
- } else {
- var prcpnm= model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
- }
-
- if(sMixno1 == sMixno2){
- //
- sSndMsg += astfPrintOut(20, 140+(cnt*30), 24, model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd"),"");
- //
- sSndMsg += astfPrintOut(170, 140+(cnt*30), 11, prcpnm.substr(0,7),"");
- //
- sSndMsg += astfPrintOut(360, 140+(cnt*30), 2, dayqty+qtyunit,"");
- //
- sSndMsg += astfPrintOut(430, 140+(cnt*30), 2, tims,"");
- //
- sSndMsg += astfPrintOut(460, 140+(cnt*30), 2, dayno,"");
-
- cnt++;
- } else {
- j--;
- break;
- }
-
- if(cnt == 5){
- break;
- }
- }
- iPoint = j;
- //종료(매수)
- sSndMsg += astfEndFormat(0);
- }
- /**
- * 내복약 라벨
- */
- function fInUseDrugLBL() {
- // var sSumCls1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sumcls");
- var sMthdcd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcd");
- var qty = "";
- var dayqty = "";
- var qtyunit = "";
- var tims = "";
- var dayno = "";
- var cnt = 0;
- for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
- if(cnt != 0 && fChkIndependDrug(j)){
- break;
- }
- // sSumCls2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/sumcls");
- sMthdcd2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthdcd");
- qty = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqty");
- dayqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/dayprcpqty");
- qtyunit = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqtyunit");
- tims = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
- dayno = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
- if(PrnKind == "2") {
- var prcpnm= model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
- prcpnm = prcpnm.substr(0,7);
- } else {
- var prcpnm= model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
- }
- if((sMthdcd1 == sMthdcd2)){
- //
- sSndMsg += astfPrintOut(20, 140+(cnt*30), 24, model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd"),"");
- //
- sSndMsg += astfPrintOut(165, 140+(cnt*30), 11, prcpnm.substr(0,7),"");
- if( model.getValue("/root/main/lbllist/lbllist["+j+"]/lblgrup") == "DS"){
- //
- sSndMsg += astfPrintOut(360, 140+(cnt*30), 2, dayqty+qtyunit,"");
- //
- sSndMsg += astfPrintOut(430, 140+(cnt*30), 2, tims,"");
- //
- sSndMsg += astfPrintOut(460, 140+(cnt*30), 2, dayno,"");
- } else {
- //
- sSndMsg += astfPrintOut(360, 140+(cnt*30), 2, dayqty,"");
- //
- sSndMsg += astfPrintOut(430, 140+(cnt*30), 2, tims,"");
- //
- sSndMsg += astfPrintOut(460, 140+(cnt*30), 2, dayno,"");
- }
-
-
- cnt++;
- } else {
- break;
- }
-
- if(cnt == fMthdnmLength(iPoint) || fChkIndependDrug(j)){
- j++;
- break;
- }
- }
- iPoint = j-1;
- //보관방법 고가 출력
- var sKeepmthd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/keepmthd");
- var sExpnyn = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/expnyn");
- var sExpnnm = "";
- if(sExpnyn == "Y") sExpnnm = "고가";
- //if(sKeepmthd != "" && sExpnnm != ""){
- // sSndMsg += astfPrintOut(20, 180, 3, "<"+sKeepmthd+sExpnnm+">","");
- //} else
- if(sKeepmthd != ""){
- sSndMsg += astfPrintOut(20, 180, 3, "<"+sKeepmthd+">","");
- }
- if(sExpnnm != ""){
- sSndMsg += astfPrintOut(135, 180, 3, "<"+sExpnnm+">","");
- }
- /*
- if(sKeepmthd != "" && sExpnnm != ""){
- sSndMsg += astfPrintOut(20, 180, 3, "<"+sKeepmthd+sExpnnm+">","");
- } else if(sKeepmthd != ""){
- sSndMsg += astfPrintOut(20, 180, 3, "<"+sKeepmthd+">","");
- } if(sExpnnm != ""){
- sSndMsg += astfPrintOut(20, 180, 3, "<"+sExpnnm+">","");
- }*/
- //용법의 길이에 따라 찍는 위치를 달리한다(용법찍을 공간을 확보)
- var iYPoint = 0;
- if( fMthdnmLength(iPoint) == 4){
- iYPoint = 280;
- } else {
- iYPoint = 245;
- }
- if( model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/lblgrup") == "DS"){
- sSndMsg += astfPrintOut(20, iYPoint, 3, "1일 "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims")+"회 "
- +qty+qtyunit+" "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno")+"일분","");
- } else {
- sSndMsg += astfPrintOut(20, iYPoint, 3, "1일 "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims")+"회 "
- +model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno")+"일분","");
- }
- //
- sSndMsg += fMthdnm(iPoint);
- //종료(매수)
- sSndMsg += astfEndFormat(0);
-
- }
- /**
- * 내복약 라벨 - 한장에 모든 용법 약을 ...
- */
- function fInUseDrugLBL2() {
- // var sSumCls1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sumcls");
- var sMthdcd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcd");
- var qty = "";
- var dayqty = "";
- var qtyunit = "";
- var tims = "";
- var dayno = "";
- var cnt = 0;
- var chk = false;
-
- totpg = Math.ceil(totcnt / 6 );
- for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
-
- if(cnt != 0 && model.getValue("/root/main/lbllist/lbllist["+j+"]/lblgrup") == "DI" ) {
- break;
- }
- //if(cnt != 0 && fChkIndependDrug(j)){
- // break;
- //}
- // sSumCls2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/sumcls");
- sMthdcd2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthdcd");
- qty = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqty");
- dayqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/dayprcpqty");
- qtyunit = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqtyunit");
- tims = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
- dayno = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
-
- if(PrnKind == "2") {
- var prcpnm= model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
- prcpnm = prcpnm.substr(0,7);
- } else {
- var prcpnm= model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
- }
- //if((sMthdcd1 == sMthdcd2)){
- //
- if( model.getValue("/root/main/lbllist/lbllist["+j+"]/lblgrup") == "DT"){ //PTP는 * 표시
- sSndMsg += astfPrintOut(20, 140+(cnt*30), 24, "*","");
- }
- sSndMsg += astfPrintOut(30, 140+(cnt*30), 24, model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd"),"");
- //
- sSndMsg += astfPrintOut(165, 140+(cnt*30), 11, prcpnm.substr(0,7),"");
- if( model.getValue("/root/main/lbllist/lbllist["+j+"]/lblgrup") == "DS"){
- //
- sSndMsg += astfPrintOut(360, 140+(cnt*30), 2, dayqty+qtyunit,"");
- //
- sSndMsg += astfPrintOut(430, 140+(cnt*30), 2, tims,"");
- //
- sSndMsg += astfPrintOut(460, 140+(cnt*30), 2, dayno,"");
- } else {
- //
- sSndMsg += astfPrintOut(360, 140+(cnt*30), 2, dayqty,"");
- //
- sSndMsg += astfPrintOut(430, 140+(cnt*30), 2, tims,"");
- //
- sSndMsg += astfPrintOut(460, 140+(cnt*30), 2, dayno,"");
- }
-
- if(model.getValue("/root/main/lbllist/lbllist["+ j +"]/lblcnts2").length > 0) ordflag += j + "/"; // 2010.02.10 pymi
- cnt++;
- //} else {
- // break;
- //}
-
-
- //if(cnt == fMthdnmLength(iPoint) || fChkIndependDrug(j)){
- // j++;
- // break;
- //}
-
- if(cnt == 6){
- pg++;
-
- sSndMsg += astfPrintOut(430,320, 2, pg+ "/" + totpg ,"");
- sSndMsg += astfEndFormat(0);
- j++;
- chk = true;
- break;
- }
- }
-
- // 2010.02 18 pymi
- if (chk == false) {
- if( model.getValue("/root/main/lbllist/lbllist["+(j-1)+"]/lblgrup") != "DI" ) {
- cnt ++; // 라벨내용 찍기 전에 한줄 띄우기
- if(!vlblcnt || cnt == 6) {
- pg++;
- sSndMsg += astfPrintOut(430,320, 2, pg+"/" +totpg ,"");
- sSndMsg += astfEndFormat(0);
- }
- } else {
- sSndMsg += astfEndFormat(0);
- }
- }
- iPoint = j-1;
- //if( (cnt < 6) && (!vlblcnt)) sSndMsg += astfEndFormat(0);
- vcnt = cnt;
- // (e)
-
- }
- // 포장라벨내용 출력 2010.02.10 pymi
- function fPrntLblCnt2(cnt, ordflag) {
-
- var lblcnts2 = "";
- var sordflag = ordflag.split("/");
- var lblcnt = cnt;
- var pgprnt = false;
- var sDD = getCurrentDate();
- var sTM = getCurrentTime();
- var y = 0;
- var x = parseInt(sordflag[y]);
- //for(var x = parseInt(sordflag[0]); x <= parseInt(sordflag[sordflag.length - 2]); x ++) {
-
- while( x <= parseInt(sordflag[sordflag.length - 2])) {
- if(lblcnt == 6 || lblcnt == 0) {
- lblcnt = 0;
- pgprnt = false;
-
- //
- /*PrnKind = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/prntkind");
- PrnMarginLeft = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/blank/left");
- PrnMarginTop = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/blank/top");
- var commkind = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/commkind")
-
- if ( PrnKind ==7 ) {
- CommAX.PrnKind =4;
- } else {
- CommAX.PrnKind =PrnKind;
- }
-
- if(commkind == "02") {
- CommAX.PortNm = 1;
- } else {
- CommAX.PortNm = 2;
- }
-
- if(commkind == "01") {
- CommAX.PrtNm = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/comm01/setupval");
- }*/
- //
-
- var reprint ="";
- if ( model.getValue("/root/main/lbllist/lbllist["+x+"]/lblprnttims")>0 ){
- reprint ="(재)";
- }
- //시작(X, Y)
- sSndMsg += astfStartFormat(0, 0, "S");
- //라벨이름(내복약/주사약/마약)
- sSndMsg += astfPrintOut(20, 25, 21, model.getValue("/root/main/lbllist/lbllist["+x+"]/drugkindnm"),"");
-
- //출력일자
- sSndMsg += astfPrintOut(190, 25, 21, "출력:"+fPrntTime(sDD, sTM),"");
- //출력일자
- sSndMsg += astfPrintOut(190, 55, 21, "처방:"+fDateFormat(model.getValue("/root/main/lbllist/lbllist["+x+"]/prcpdd"), "MD"),"");
-
- //병실
- sSndMsg += astfPrintOut(20, 80, 31, model.getValue("/root/main/lbllist/lbllist["+x+"]/roomcd"),"");
- //환자이름
- sSndMsg += astfPrintOut(120, 80, 31, model.getValue("/root/main/lbllist/lbllist["+x+"]/patnm"),"");
- //환자번호
- sSndMsg += astfPrintOut(240, 80, 31, model.getValue("/root/main/lbllist/lbllist["+x+"]/pid")+" ("+model.getValue("/root/main/lbllist/lbllist["+x+"]/drugno")+reprint+")","");
- //선그리기
- sSndMsg += astfGraphicBox(5, 120, 465, 0, 4);
- }
-
- //if( !fChkIndependDrug(x) ) {
- lblcnts2 = model.getValue("/root/main/lbllist/lbllist["+ x +"]/lblcnts2"); // 2010.02.10 pymi
- sSndMsg += astfPrintOut(30, 140+(lblcnt*30), 2, lblcnts2,"");
- lblcnt ++;
- //}
-
- if(lblcnt == 6){
- pg++;
- sSndMsg += astfPrintOut(430,320, 2, pg+ "/" + totpg ,"");
- lblcnt = 0;
- pgprnt = true;
- sSndMsg += astfEndFormat(0);
- CommAX.SendMsg(sSndMsg);
- fSleep(500);
- sSndMsg = "";
- //break;
- }
- x = parseInt(sordflag[++y]);
- } // end while
-
- if(!pgprnt) {
- pg++;
- sSndMsg += astfPrintOut(430,320, 2, pg+ "/" + totpg ,"");
- sSndMsg += astfEndFormat(0);
- }
-
- if(!mlblcnt) {
- CommAX.SendMsg(sSndMsg);
- fSleep(500);
- sSndMsg = "";
- }
- ordflag = "";
- vcnt = 0;
- pg = 0;
- totpg = 0;
- mlblcnt = false;
-
- }
- // (e)
- /**
- * 외용약 라벨
- */
- function fExUseDrugLBL() {
- 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");
- if(PrnKind == "2") {
- var prcpnm= model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm");
- prcpnm = prcpnm.substr(0,7);
- } else {
- var prcpnm= model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm");
- }
- //
- sSndMsg += astfPrintOut(20, 140, 24, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd"),"");
- //
- sSndMsg += astfPrintOut(165, 140, 11, prcpnm.substr(0,7),"");
- //
- sSndMsg += astfPrintOut(360, 140, 2, dayqty,"");
- //
- sSndMsg += astfPrintOut(430, 140, 2, tims,"");
- //
- sSndMsg += astfPrintOut(460, 140, 2, dayno,"");
-
- sSndMsg += astfPrintOut(20, 280, 3, "1일 "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims")+"회 "
- +model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno")+"일분","");
- //
- sSndMsg += fMthdnm(iPoint);
- //종료(매수)
- sSndMsg += astfEndFormat(0);
- }
- /**
- * 주사약 라벨
- */
- function fInjDrugLBL() {
- var sSumCls1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sumcls");
- var cnt = 0;
- for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
- if(cnt != 0 && fChkIndependInj(j)){
- //주사가 뭉쳐서 나오다가 단독주사를 만날경우 단독주사는 출력하지 아니함.
- break;
- }
- sSumCls2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/sumcls");
- var qty = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqty");
- var dayqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/dayprcpqty");
- var qtyunit = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqtyunit");
- var tims = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
- var dayno = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
- if(PrnKind == "2") {
- var prcpnm= model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
- prcpnm = prcpnm.substr(0,7);
- } else {
- var prcpnm= model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
- }
- //
- sSndMsg += astfPrintOut(20, 140+(cnt*30), 24, model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd"),"");
- //
- sSndMsg += astfPrintOut(165, 140+(cnt*30), 11, prcpnm.substr(0,7),"");
- //
- sSndMsg += astfPrintOut(360, 140+(cnt*30), 2, fChkFloat(dayqty)+qtyunit,"");
- //
- sSndMsg += astfPrintOut(430, 140+(cnt*30), 2, tims,"");
- //
- sSndMsg += astfPrintOut(460, 140+(cnt*30), 2, dayno,"");
-
- cnt++;
-
- if(cnt == 5 || fChkIndependInj(j)){
- j++;
- break;
- }
- }
- iPoint = j-1;
- //보관방법 고가 출력
- var sKeepmthd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/keepmthd");
- var sExpnyn = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/expnyn");
- var sExpnnm = "";
- if(sExpnyn == "Y") sExpnnm = "고가";
- //if(sKeepmthd != "" && sExpnnm != ""){
- // sSndMsg += astfPrintOut(20, 180, 3, "<"+sKeepmthd+sExpnnm+">","");
- //} else
- if(sKeepmthd != ""){
- sSndMsg += astfPrintOut(20, 180, 3, "<"+sKeepmthd+">","");
- }
- if(sExpnnm != ""){
- sSndMsg += astfPrintOut(135, 180, 3, "<"+sExpnnm+">","");
- }
- //종료(매수)
- sSndMsg += astfEndFormat(0);
- }
- /**
- * 내복약 단독라벨 검증작업
- */
- function fChkIndependDrug(cnt) {
- var sLBLGrup = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/lblgrup");
- var sSnglyn = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/atcifsnglyn");
- var sDrugindependpackflag = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/drugindependpackflag");
- var sKeepmthd = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/keepmthd");
- var sExpnyn = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/expnyn");
- var sRst = false;
- if(sLBLGrup == "DS" || sLBLGrup == "DI" || sLBLGrup == "DT" || sLBLGrup == "DX") sRst = true;
- if(sSnglyn == "Y") sRst = true;
- if(sDrugindependpackflag == "Y") sRst = true;
- if(sExpnyn == "Y") sRst = true;
- if(sKeepmthd != "") sRst = true;
- return sRst;
- }
- /**
- * 주사약 단독라벨 검증작업
- */
- function fChkIndependInj(cnt) {
- var sLBLGrup = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/lblgrup");
- var sExp = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/expnyn");
- var sKeepmthd = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/keepmthd");
- var sSelfprcpflag = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/selfprcpflag");
- var sDrugindependpackflag = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/drugindependpackflag");
- var sRst = false;
- if(sLBLGrup == "IH" || sLBLGrup == "IO" || sLBLGrup == "IS" || sLBLGrup == "IX") sRst = true;
- if(sExp == "Y" || sKeepmthd != "" || sSelfprcpflag == "Y") sRst = true;
- if(sDrugindependpackflag == "Y") sRst = true;
-
- return sRst;
- }
- /**
- * 용법 생성
- */
- function fMthdnm(iPoint) {
- var sMthd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1");
- var sMthd2 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2");
- var sMthd3 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
- var sMthd4 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
- var sTemp = "";
- var sRst = "";
- if(sMthd1 != "") sTemp += sMthd1 + " ";
- if(sMthd2 != "") sTemp += sMthd2 + " ";
- if(sMthd3 != "") sTemp += sMthd3 + " ";
- if(sMthd4 != "") sTemp += sMthd4;
- if(sTemp.length > 28){
- var sTemp1 = sTemp.substr(0, 26);
- var sTemp2 = sTemp.substr(26, sTemp.length);
- sRst = astfPrintOut(20, 285, 28, sTemp1,"");
- sRst += astfPrintOut(20, 320, 28, sTemp2,"");
- } else if(sTemp.length > 24){
- sRst = astfPrintOut(20, 320, 29, sTemp,"");
- } else if(sTemp.length > 22){
- sRst = astfPrintOut(20, 320, 3, sTemp,"");
- } else if(sTemp.length > 21){
- sRst = astfPrintOut(20, 320, 3, sTemp,"");
- } else if(sTemp.length <= 21){
- sRst = astfPrintOut(20, 320, 3, sTemp,"");
- }
- return sRst;
- }
- /**
- * 용법 길이
- */
- function fMthdnmLength(iPoint) {
- var sMthd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1");
- var sMthd2 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2");
- var sMthd3 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
- var sMthd4 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
- var sTemp = "";
- var sRst = "4"; //병동라벨은 기본 4줄까지 약처방이 출력된다.
- if(sMthd1 != "") sTemp += sMthd1 + " ";
- if(sMthd2 != "") sTemp += sMthd2 + " ";
- if(sMthd3 != "") sTemp += sMthd3 + " ";
- if(sMthd4 != "") sTemp += sMthd4;
- if(sTemp.length > 28){
- sRst = "3"; //복용방법이 길경우 3줄까지 약처방을 출력한다.
- }
- return sRst;
- }
- /**
- * 응급실/퇴원/외박/외출 라벨출력(큰사이즈)
- */
- function fBigLBLPrint() {
- /*
- 라벨 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 설정
- PrnKind = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/prntkind");
- var commkind = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/commkind")
- CommAX.PrnKind =PrnKind;
-
- if(commkind == "02") {
- CommAX.PortNm = 1;
- } else {
- CommAX.PortNm = 2;
- }
-
- if(commkind == "01") {
- CommAX.PrtNm = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/comm01/setupval");
- }
- var reprint="";
-
- 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, "B");
- //iPageCnt++;
- //////////////////////////////////////////////////
- // 라벨 상단내용 //
- /////////////////////////////////////////////////
- //병실
- sSndMsg += astfPrintOut(30, 30, 6, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/roomcd"),"");
- //환자명
- sSndMsg += astfPrintOut(180, 30, 6, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/patnm").substring(0,5),"");
- //바코드(변환)
- sSndMsg += astfBarCode_Code39(390, 40, "N", 70, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/barcode"));
- //환자번호
- sSndMsg += astfPrintOut(30, 85, 3, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/pid") ,"");
- //투약번호=>20091014 이선경 : 크고 진하게 변경
- sSndMsg += astfPrintOut(130, 85, 6, " (" + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugno") + ")","");
- //성별나이
- sSndMsg += astfPrintOut(280, 85, 3, reprint+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"),"");
- //처방일자
- sSndMsg += astfPrintOut(270, 135, 3, fDateFormat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd")),"");
- //페이지수
- //sSndMsg += astfPrintOut(430, 135, 3, iPageCnt+"/"+iTotalPageNum,"");
- //바코드
- sSndMsg += astfPrintOut(510, 130, 3, "*"+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/barcode")+"*","");
- //선그리기
- sSndMsg += astfGraphicBox(5, 180, 815, 0, 4);
- sSndMsg += astfPrintOut(20, 600, 2, "*의약품은 그 특성상 보관및관리가 엄격해야하므로, ");
- sSndMsg += astfPrintOut(20, 630, 2, " 일단 조제투약된 약은 반납할 수 없습니다.");
- //////////////////////////////////////////////////
- // 라벨 하단내용 //
- /////////////////////////////////////////////////
- if( fChkSumcls(iPoint)){
- //단독라벨출력
- fIndependPrint();
- } else {
- //일반라벨출력
- fGnrlPrint();
- }
-
- //종료(매수)
- sSndMsg += astfEndFormat(0);
- CommAX.SendMsg(sSndMsg);
- fSleep(500);
- sSndMsg = "";
-
- // 2010.02.17 pymi
- if(nextPage) {
- fGnrlPrintnm(nCnt, bordflag);
- nextPage = false;
- nCnt = 0;
- bordflag = "";
- }
- // (e)
- }
-
- //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 tims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
- var dayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");
-
- 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")
- + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3"),"");
- //용법2
- sSndMsg += astfPrintOut(30, 370, 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")
- + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3"),"");
- //용법2
- sSndMsg += astfPrintOut(30, 370, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"),"");
- }
-
- var lblcnts1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/lblcnts1");
- lblcnts1 = lblcnts1.setReplaceWord("~", "-"); //20090728
- 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,24),"");
- sSndMsg += astfPrintOut(30, 510, 5, lblcnts1.substring(24,lblcnts1.length),"");
- //약정보
- sSndMsg += astfPrintOut(30, 570, 4, val, "");
- } else {
- //주의사항
- sSndMsg += astfPrintOut(30, 450, 5, lblcnts1,"");
- //약정보
- sSndMsg += astfPrintOut(30, 510, 4, val, "");
- }
- }
- /**
- *
- */
- function fGnrlPrint() {
- var cnt = 0;
- var drugcnt = 0;
- var ordCnt = 0; // 2010.02.10 pymi
-
- //약종류(내복약/주사약/외용약)
- 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 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;
- var val = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd")
- +" "+prcpqty
- +" "+(model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm")).substring(0,6);
- sSndMsg += astfPrintOut(30+((cnt%2)*380), 440+((parseInt(cnt/2, 10))*40), 2, val, "");
- //}
- cnt++;
- } else {
- break;
- }
-
- if(cnt == 8){
- j++;
- break;
- }
- }
- iPoint = j-1;
-
-
- } 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;
-
- 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)){
- drugcnt++;
- } else {
- break;
- }
-
- }
-
- if ( drugcnt == 1 ){
- if(lbltims == 1) {
- if(mthd2.indexOf("마다") == -1) {
- sSndMsg += astfPrintOut(210, 220, 7, "1일 "+lbltims+ "회"+fChkFloat(qty)+"포[정]씩 "+dayno+"일분","");
- prcpqty = prcpqty * lbltims;
- } else {
- sSndMsg += astfPrintOut(210, 220, 7, "1일 "+tims+ "회"+fChkFloat(qty)+"포[정]씩 "+dayno+"일분","");
- prcpqty = prcpqty * tims;
- }
- } else {
- sSndMsg += astfPrintOut(210, 220, 7, "1일 "+lbltims+ "회"+fChkFloat(qty)+"포[정]씩 "+dayno+"일분","");
- prcpqty = prcpqty * lbltims;
- }
- } else {
- if(lbltims == 1) {
- if(mthd2.indexOf("마다") == -1) {
- sSndMsg += astfPrintOut(210, 220, 7, "1일 "+lbltims+ "회 1포씩 "+dayno+"일분","");
- } else {
- sSndMsg += astfPrintOut(210, 220, 7, "1일 "+tims+ "회 1포씩 "+dayno+"일분","");
-
- }
- } else {
- sSndMsg += astfPrintOut(210, 220, 7, "1일 "+lbltims+ "회 1포씩 "+dayno+"일분","");
- }
- }
-
- //용법1
- //if ( model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3") =="취침전에" ){
- // 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"),"");
- //} else {
- 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)){
- //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;
- var val = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd")
- +" "+prcpqty
- +" "+(model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm")).substring(0,6);
- sSndMsg += astfPrintOut(30+((cnt%2)*380), 440+((parseInt(cnt/2, 10))*40), 2, val, "");*/
- //}
- //cnt++;
-
- // 2010.02.10 pymi
- var lblcnts2 = model.getValue("/root/main/lbllist/lbllist["+ j +"]/lblcnts2");
- bordflag += j + "/"; // 포장라벨 처방코드 순서
-
- if(lblcnts2.length > 0) {
- sSndMsg += astfPrintOut(30, 440 +(60 * ordCnt), 5, lblcnts2, "");
- //if(ordCnt == 0) {sSndMsg += astfPrintOut(30, 440, 4, lblcnts2, ""); }
- //if(ordCnt == 1) {sSndMsg += astfPrintOut(30, 500, 4, lblcnts2, ""); }
- //if(ordCnt == 2) {sSndMsg += astfPrintOut(30, 560, 4, lblcnts2, ""); }
- ordCnt++; // 포장라벨 갯수
- }
- // (e)
-
- } else {
-
- // 용법이 바뀌는 시점 2010.02.10 pymi
- // 처방출력
- fGnrlPrintnm(ordCnt, bordflag);
- bordflag = "";
- // (e)
-
- break;
- }
-
- //if(cnt == 8){
- if(ordCnt == 3){ //2010.02.10 pymi
- j++;
-
- 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;
- nCnt = ordCnt;
- //fGnrlPrintnm(ordCnt, bordflag);
- }
- }
- break;
- }
- }
- iPoint = j-1;
-
- // 용법 바뀌지 않는 마지막 처방 출력 2010.02.10 pymi
- if(iPoint == getNodesetCount("/root/main/lbllist/lbllist") ) {
- if(ordCnt == 3) {
- nextPage = true;
- nCnt = ordCnt;
- }
- else {
- fGnrlPrintnm(ordCnt, bordflag);
- bordflag = "";
- }
- }
- // (e)
- }
-
- }
- /*
- * 2010.02.10 pymi 처방출력
- */
- function fGnrlPrintnm(linecnt, ordflag) {
- var cnt = 0;
- var xValue = 440;
- var valCnt = 8;
- var lblup = false;
-
- var sordflag = "";
- sordflag = ordflag.split("/");
- if(linecnt == 1) { xValue = 500; valCnt = 6; }
- if(linecnt == 2) { xValue = 560; valCnt = 2; }
- if(linecnt == 3) { xValue = 440; valCnt = 8; lblup = true;}
-
-
- //약종류(내복약/주사약/외용약)
- for(mPoint = parseInt(sordflag[0]); mPoint <= parseInt(sordflag[sordflag.length - 2]); mPoint++) {
- var xtims = 0;
- var drugcnt = 0;
- if(lblup) {
- //시작(X, Y)
- xValue = 440;
- valCnt = 8;
- cnt = 0;
-
- //
- /*PrnKind = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/prntkind");
- var commkind = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/commkind")
-
- CommAX.PrnKind =PrnKind;
-
- if(commkind == "02") {
- CommAX.PortNm = 1;
- } else {
- CommAX.PortNm = 2;
- }
-
- if(commkind == "01") {
- CommAX.PrtNm = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/comm01/setupval");
- }*/
- //
- var reprint ="";
- if ( model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/lblprnttims")>0 ){
- reprint ="(재)";
- }
- sSndMsg += astfStartFormat(0, 0, "B");
- //iPageCnt++;
- //////////////////////////////////////////////////
- // 라벨 상단내용 //
- /////////////////////////////////////////////////
- //병실
- sSndMsg += astfPrintOut(30, 30, 6, model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/roomcd"),"");
- //환자명
- sSndMsg += astfPrintOut(180, 30, 6, model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/patnm").substring(0,5),"");
- //바코드(변환)
- sSndMsg += astfBarCode_Code39(390, 40, "N", 70, model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/barcode"));
- //환자번호
- sSndMsg += astfPrintOut(30, 85, 3, model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/pid") ,"");
- //투약번호=>20091014 이선경 : 크고 진하게 변경
- sSndMsg += astfPrintOut(130, 85, 6, " (" + model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/drugno") + ")","");
- //성별나이
- sSndMsg += astfPrintOut(280, 85, 3, reprint+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"),"");
- //처방일자
- sSndMsg += astfPrintOut(270, 135, 3, fDateFormat(model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/prcpdd")),"");
- //페이지수
- //sSndMsg += astfPrintOut(430, 135, 3, iPageCnt+"/"+iTotalPageNum,"");
- //바코드
- sSndMsg += astfPrintOut(510, 130, 3, "*"+model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/barcode")+"*","");
- //선그리기
- sSndMsg += astfGraphicBox(5, 180, 815, 0, 4);
- sSndMsg += astfPrintOut(20, 600, 2, "*의약품은 그 특성상 보관및관리가 엄격해야하므로, ");
- sSndMsg += astfPrintOut(20, 630, 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;
- xtims = tims;
-
- /*for(var j = mPoint; 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)){
- drugcnt++;
- } else {
- break;
- }
-
- }
-
- if ( drugcnt == 1 ){
- if(lbltims == 1) {
- if(mthd2.indexOf("마다") == -1) {
- sSndMsg += astfPrintOut(210, 220, 7, "1일 "+lbltims+ "회"+fChkFloat(qty)+"포[정]씩 "+dayno+"일분","");
- prcpqty = prcpqty * lbltims;
- } else {
- sSndMsg += astfPrintOut(210, 220, 7, "1일 "+tims+ "회"+fChkFloat(qty)+"포[정]씩 "+dayno+"일분","");
- prcpqty = prcpqty * tims;
- }
- } else {
- sSndMsg += astfPrintOut(210, 220, 7, "1일 "+lbltims+ "회"+fChkFloat(qty)+"포[정]씩 "+dayno+"일분","");
- prcpqty = prcpqty * lbltims;
- }
- } else {*/
- if(lbltims == 1) {
- if(mthd2.indexOf("마다") == -1) {
- sSndMsg += astfPrintOut(210, 220, 7, "1일 "+lbltims+ "회 1포씩 "+dayno+"일분","");
-
- } else {
- sSndMsg += astfPrintOut(210, 220, 7, "1일 "+tims+ "회 1포씩 "+dayno+"일분","");
-
- }
- } else {
- sSndMsg += astfPrintOut(210, 220, 7, "1일 "+lbltims+ "회 1포씩 "+dayno+"일분","");
-
- }
- //}
-
- //용법1
- var val = 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, 290, 7, val,"");
-
- //용법2
- sSndMsg += astfPrintOut(30, 360, 7, model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/mthdcnts4"),"");
- } else{
-
- 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 tims = model.getValue("/root/main/lbllist/lbllist["+mPoint+"]/prcptims");
-
- // 용법 출력
- 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;
- xtims = tims;
- }
-
- 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 * xtims*1000)/1000 ;
- var val = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd")
- +" "+prcpqty
- +" "+(model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm")).substring(0,6);
-
- 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;
-
- //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.SendMsg(sSndMsg);
- fSleep(500);
- sSndMsg = "";
-
- }
-
- }
- /**
- *
- */
- function fDateFormat(sDD, sYMD) {
- if(sYMD == "MD"){
- return sDD.substr(4,2)+"/"+sDD.substr(6,2);
- } else {
- return sDD.substr(0,4)+"/"+sDD.substr(4,2)+"/"+sDD.substr(6,2);
- }
- }
- /**
- *
- */
- function fPrntTime(sDD, sTM) {
- //if(PrnKind == "2" || PrnKind == "7" ) {
- return sDD.substr(4,2)+"/"+sDD.substr(6,2)+" "+sTM.substr(0,2)+":"+sTM.substr(2,2);
- //} else {
- // return sDD.substr(4,2)+" / "+sDD.substr(6,2)+" "+sTM.substr(0,2)+":"+sTM.substr(2,2)+":"+sTM.substr(4,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 == "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 설정
-
- PrnKind = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/prntkind");
- PrnMarginLeft = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/blank/left");
- PrnMarginTop = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/blank/top");
- var commkind = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/commkind")
- if ( PrnKind ==7 ) {
- CommAX.PrnKind =4;
- } else {
- CommAX.PrnKind =PrnKind;
- }
-
- if(commkind == "02") {
- CommAX.PortNm = 1;
- } else {
- CommAX.PortNm = 2;
- }
-
- if(commkind == "01") {
- CommAX.PrtNm = model.getvalue("/root/init/barcdprntsetup/prntsetupinfo/setupinfo/comm01/setupval");
- }
-
-
- var reprint ="";
- //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, "S");
- //////////////////////////////////////////////////
- // 라벨 상단내용 //
- /////////////////////////////////////////////////
- //병실
- //sSndMsg += astfPrintOut(50, 30, 7, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/roomcd"),"");
- //환자명
- //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")+ " ( "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugno")+reprint+" )","");
- //선그리기
- //sSndMsg += astfGraphicBox(5, 145, 465, 0, 4);
-
- var sDD = getCurrentDate();
- var sTM = getCurrentTime();
-
- //라벨이름(내복약/주사약/마약)
- sSndMsg += astfPrintOut(20, 25, 20, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm"),"");
- //if(PrnKind == "2" || PrnKind == "7" ) {
- //출력일자
- sSndMsg += astfPrintOut(190, 25, 21, "출력:"+fPrntTime(sDD, sTM),"");
- //출력일자
- sSndMsg += astfPrintOut(190, 55, 21, "처방:"+fDateFormat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd"), "MD"),"");
- //} else {
- //출력일자
- // sSndMsg += astfPrintOut(220, 25, 21, "출 력 : "+fPrntTime(sDD, sTM),"");
- //출력일자
- // sSndMsg += astfPrintOut(220, 55, 21, "처 방 : "+fDateFormat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd"), "MD"),"");
- //}
-
- //병실
- sSndMsg += astfPrintOut(20, 80, 31, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/roomcd"),"");
- //환자이름
- 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 = Math.ceil(dayqty / tims * 1000)/1000 ;
- var totqty = parseInt(dayqty)*parseInt(dayno);
-
- 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");
- if (val.length > 17) {
- sSndMsg += astfPrintOut(40, 171, 27, val.substring(0,17) ,"");
- sSndMsg += astfPrintOut(40, 210, 27, val.substring(17,val.length) ,"");
- } else {
- sSndMsg += astfPrintOut(40, 210, 27, val ,"");
- }
- } else {
- //1일 X회 Xml씩 X일분
- var val = mthd1 + " " + mthd2 + " " + mthd3;
-
- if (val.length > 17) {
- sSndMsg += astfPrintOut(40, 126, 27, "1일 "+tims+"회 "+qty+qtyunit+"씩 "+dayno+"일분","");
- sSndMsg += astfPrintOut(40, 171, 27, val.substring(0,17) ,"");
- sSndMsg += astfPrintOut(40, 210, 27, val.substring(17,val.length) ,"");
- } else {
- sSndMsg += astfPrintOut(40, 165, 27, "1일 "+tims+"회 "+qty+qtyunit+"씩 "+dayno+"일분","");
- sSndMsg += astfPrintOut(40, 210, 27, val ,"");
- }
- }
-
- //용법
- //sSndMsg += astfPrintOut(40, 210, 27, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/abbrnm"),"");
- //약품코드 + 총용량
- //sSndMsg += astfPrintOut(40, 255, 27, "[ "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd")+" ] "+totqty,"");
- //약품코드 + 총용량 + 약품명
- var prcpnm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm");
- if(PrnKind == "2") {
- var val = "[ "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd")+" ] "+
- parseFloat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/totdrugqty")) + " " +
- prcpnm;
- sSndMsg += astfPrintOut(20, 255, 27, val,"");
- } else {
- 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");
- lblcnts1 = lblcnts1.setReplaceWord("~", "-"); //20090728
- 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 > 17){
- //주의사항
- sSndMsg += astfPrintOut(20, 285, 3, lblcnts1.substring(0,17),"");
- sSndMsg += astfPrintOut(20, 315, 3, lblcnts1.substring(17,lblcnts1.length),"");
- } else {
- //주의사항
- sSndMsg += astfPrintOut(40, 300, 27, lblcnts1,"");
- }
- }
- //종료(매수)
- sSndMsg += astfEndFormat(0);
-
- CommAX.SendMsg(sSndMsg);
- fSleep(500);
- sSndMsg = "";
- }
-
- //CommAX.PortClose();
- model.refresh();
- //}
- }
|