SPADT62305.js 167 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351
  1. /**
  2. * 파 일 명 : SPADT62300.js
  3. * 설 명 : (팝업)병동라벨출력 Javascriot
  4. * 설 계 자 : 공두경
  5. * 작 성 자 : 공두경
  6. * 수정이력 : 2007.09.17 / 최초작성 / 공두경
  7. */
  8. var sSndMsg = ""; //라벨출력내용
  9. var iPoint = 1; //라벨출력row
  10. var iCnt = 0; //라벨출력매수
  11. var iImageCnt = 0; //라벨그래픽폰트수
  12. var gTimer = null;
  13. var pg =0;
  14. var totpg =0;
  15. var totcnt =0;
  16. var ordflag = "";
  17. var bordflag = "";
  18. var vcnt = 0;
  19. var nCnt = 0;
  20. var vlblcnt = false;
  21. var mlblcnt2 = false;
  22. var mlblcnt1 = false;
  23. var nextPage = false;
  24. var prntflag = false;
  25. var NBflag = false; // 큰라벨 일반라벨 내복약 flag
  26. var iTotalPageNum = 0;
  27. var iPageCnt = 0;
  28. var iPageCntO = 1; //외래 큰라벨출력양식 사용
  29. var lblsz = ""; // 큰라벨 1,2 구분
  30. //var BarOCX ;
  31. /**
  32. * 초기화
  33. */
  34. function fInit_lbl() {
  35. model.removeNode("/root/main/lbllist2");
  36. model.removeNode("/root/main/lbllist");
  37. var lblitem = null; //라벨구분
  38. var lblstr = "";
  39. var lblsize = ""; //라벨출력크기
  40. var lblgrupAD = "N"; //정제라벨 체크여부
  41. var lblgrupDT = "N"; //PTP라벨 체크여부
  42. var flag = model.getValue("/root/hidden/srchinfo/flagtmp");
  43. var lblitem = model.getValue("/root/hidden/srchinfo/tmplblitem");
  44. // alert("row:53 SPADT62305.js- 1 " + flag );
  45. if(flag == "A") {//자동출력
  46. lblstr = model.getValue("/root/hidden/srchinfo/autolblflag");
  47. //lblitem = model.getValue("/root/hidden/srchinfo/autolblflag").split("|");
  48. lblsize = model.getValue("/root/hidden/srchinfo/autolblsize");
  49. if(lblstr.indexOf("AD") >= 0){
  50. lblgrupAD = "Y";
  51. }
  52. if(lblstr.indexOf("DT") >= 0){
  53. lblgrupDT = "Y";
  54. }
  55. } else if(flag == "M") {//수동출력
  56. lblstr = model.getValue("/root/hidden/srchinfo/manllblflag");
  57. //lblitem = model.getValue("/root/hidden/srchinfo/manllblflag").split("|");
  58. lblsize = model.getValue("/root/hidden/srchinfo/lblsizeflag");
  59. if(lblstr.indexOf("AD") >= 0){
  60. lblgrupAD = "Y";
  61. }
  62. if(lblstr.indexOf("DT") >= 0){
  63. lblgrupDT = "Y";
  64. }
  65. }
  66. /* model.makeValue("/root/send/prcpinfo/etcdescflag", model.getValue("/root/hidden/srchinfo/etcdescflag"));
  67. model.makeValue("/root/send/prcpinfo/lblkind", model.getValue("/root/hidden/srchinfo/lblkind"));
  68. model.makeValue("/root/send/prcpinfo/lbltype", model.getValue("/root/init/lbltype/item/lbltype"));
  69. model.makeValue("/root/send/prcpinfo/drugkind", model.getValue("/root/hidden/srchinfo/drugkind"));
  70. model.makeValue("/root/send/prcpinfo/autoyn", model.getValue("/root/hidden/srchinfo/autoyn"));
  71. model.makeValue("/root/send/prcpinfo/version", "new");*/
  72. model.makeValue("/root/send/prcpinfo/noname", model.getValue("/root/hidden/srchinfo/noname")); // 2011.03.28 pymi
  73. // alert("row:85 SPADT62305.js- 1 " + lblsize );
  74. if(lblsize == "L") {//자동출력에 큰라벨 출력이면 환자별로 한꺼번에 뽑아야 라벨총장수와 페이지 번호 찍음
  75. var lblstr2 = lblstr.setReplaceWord("AD", "D|DX|DH|DP");
  76. lblstr2 = lblstr2.setReplaceWord("AI", "I|IO|IX|IH|IS"); // 20120628_일반수액도 추가(퇴원의 경우)
  77. model.makeValue("/root/send/prcpinfo/lblflag", lblstr2);
  78. model.makeValue("/root/send/prcpinfo/lblsizeflag", "L");
  79. //fInit_lbl();
  80. submit("TRADT62301");
  81. //fBigLBLPrint("L");
  82. fBigLBLPrint_knu("L");//20101224 이선경 수정 : 외래 큰라벨 양식으로 출력하는 부분 새로 작성
  83. } else if(lblsize == "S") {
  84. model.makeValue("/root/send/prcpinfo/lblsizeflag", "S");
  85. //for (var i = 0; i < lblitem.length; i++) {
  86. if (lblitem =="AD"){
  87. //20100405 이선경 추가 : 라벨그룹의 PTP가 체크되어 있고 정제 작은라벨(리스트형식) 출력시 ptp 함께 출력하는 옵션일때 PTP함께 출력
  88. if(lblgrupDT == "Y" && model.getValue("/root/init/sumprcpflagyn/flagyn/lbl6yn") == "Y") {
  89. model.makeValue("/root/send/prcpinfo/lblflag", "D|DX|DH|DP|DT");
  90. } else {
  91. model.makeValue("/root/send/prcpinfo/lblflag", "D|DX|DH|DP");
  92. }
  93. //fInit_lbl();
  94. submit("TRADT62301");
  95. //fSmallLBLPrint();
  96. fBigLBLPrint_knu("S");
  97. }
  98. //주사
  99. if (lblitem =="AI"){
  100. model.makeValue("/root/send/prcpinfo/lblflag", "I|IO|IX|IH|IS"); // 20120628_일반수액도 추가(퇴원의 경우)
  101. //fInit_lbl();
  102. submit("TRADT62301");
  103. //fSmallLBLPrint();
  104. fBigLBLPrint_knu("S");
  105. }
  106. //PTP
  107. if (lblitem=="DT"){
  108. model.makeValue("/root/send/prcpinfo/lblflag", "DT");
  109. //fInit_lbl();
  110. submit("TRADT62301");
  111. //fSmallLBLPrint();
  112. fBigLBLPrint_knu("S");
  113. }
  114. //외용
  115. if (lblitem=="DI"){
  116. model.makeValue("/root/send/prcpinfo/lblflag", "DI");
  117. //fInit_lbl();
  118. submit("TRADT62301");
  119. fLiquidLBLPrint();
  120. }
  121. //수제
  122. if (lblitem=="DS"){
  123. model.makeValue("/root/send/prcpinfo/lblflag", "DS");
  124. //fInit_lbl();
  125. submit("TRADT62301");
  126. fLiquidLBLPrint();
  127. }
  128. //PACK 20110922_laboru_pack 류도 작은 라벨 출력되게 수정
  129. if (lblitem=="DG"){
  130. model.makeValue("/root/send/prcpinfo/lblflag", "DG");
  131. //fInit_lbl();
  132. submit("TRADT62301");
  133. fLiquidLBLPrint();
  134. }
  135. //PTP단독처방
  136. if (lblitem=="PTS"){
  137. model.makeValue("/root/send/prcpinfo/lblflag", "PTS");
  138. //fInit_lbl();
  139. submit("TRADT62301");
  140. //fSmallLBLPrint();
  141. fBigLBLPrint_knu("S");
  142. }
  143. //산제용법별
  144. if (lblitem=="DP"){
  145. model.makeValue("/root/send/prcpinfo/lblflag", "DP");
  146. //fInit_lbl();
  147. submit("TRADT62301");
  148. fPowderlLBLPrint();
  149. }
  150. //2010-06-29 [보관방법:냉장주사] 단독출력
  151. if (lblitem =="LBL_INJ_I"){
  152. model.makeValue("/root/send/prcpinfo/lblflag", "LBL_INJ_I");
  153. submit("TRADT62301");
  154. //fSmallLBLPrint();
  155. fBigLBLPrint_knu("S");
  156. }
  157. //2010-06-29 [보관방법:고위험주사] 단독출력
  158. if (lblitem =="LBL_INJ_D"){
  159. model.makeValue("/root/send/prcpinfo/lblflag", "LBL_INJ_D");
  160. submit("TRADT62301");
  161. //fSmallLBLPrint();
  162. fBigLBLPrint_knu("S");
  163. }
  164. //}
  165. } else if(lblsize == "L1") {// 20101222_laboru_경북대병원_경대 본원 라벨(큰라벨 2)
  166. var lblstr2 = lblstr.setReplaceWord("AD", "D|DX|DH|DP");
  167. lblstr2 = lblstr2.setReplaceWord("AI", "I|IO|IX|IH|IS"); // 20120628_일반수액도 추가(퇴원의 경우)
  168. model.makeValue("/root/send/prcpinfo/lblflag", lblstr2);
  169. model.makeValue("/root/send/prcpinfo/lblsizeflag", "L");
  170. //fInit_lbl();
  171. submit("TRADT62301");
  172. //fBigLBLPrint("L1");
  173. // alert(" lblsize : " + lblsize )
  174. // alert(" fBigLBLPrint_knu Call" )
  175. fBigLBLPrint_knu("L1");
  176. }
  177. window.close();
  178. }
  179. /**
  180. *
  181. */
  182. function fStopTimer() {
  183. window.clearinterval(gTimer);
  184. }
  185. function fSleep(numberMillis) {
  186. var now = new Date();
  187. var exitTime = now.getTime() + numberMillis;
  188. while (true) {
  189. now = new Date();
  190. if (now.getTime() > exitTime)
  191. return;
  192. }
  193. }
  194. /**
  195. * 병동 라벨출력(작은사이즈)
  196. */
  197. function fSmallLBLPrint() {
  198. /*
  199. 라벨 Sorting 로직
  200. //mgt에서 vo로 리턴
  201. 대분류
  202. - 내복약, 외용약, 주사, 항암제, TPN, 마약,
  203. 중분류
  204. - 방법코드
  205. 소분류
  206. - 내복약,외용약(방법코드), 주사,마약,항암제(mix)
  207. web js 출력로직
  208. 가. 퇴원/외래/응급실/외박/외출 : 큰사이즈라벨
  209. 외래기준
  210. 나. 그외 입원처방
  211. 1. 외용약
  212. 단독출력
  213. 2. 내복약
  214. 단독출력
  215. 따로포장
  216. 복용방법
  217. 3. 주사약
  218. 단독출력
  219. mix끼리
  220. 고가,향정,보관벙법이 실온이 아닌경우 자가주사인 경우 단독
  221. 나머지
  222. */
  223. var sDD = getCurrentDate();
  224. var sTM = getCurrentTime();
  225. var reprint ="";
  226. totcnt = 0;
  227. pg = 0;
  228. totpg = 0;
  229. // 라벨내용 copy
  230. model.makeNode("/root/main/lbllist2");
  231. model.copyNode("/root/main/lbllist2", "/root/main/lbllist");
  232. for ( var i = 1; i <= getNodesetCount("/root/main/lbllist/lbllist") ; i++){
  233. if(model.getValue("/root/main/lbllist/lbllist["+i+"]/pid") == "") {
  234. return;
  235. }
  236. if ( model.getValue("/root/main/lbllist/lbllist["+i+"]/lblgrup") != "DI" && model.getValue("/root/main/lbllist/lbllist["+i+"]/lblgrup") != "DS" ){
  237. totcnt++;
  238. }
  239. }
  240. // 2010.02.12 pymi
  241. if( (totcnt%6) != 0) totcnt ++; // 라벨찍기 전에 한줄 띄우기
  242. for ( var i = 1; i <= getNodesetCount("/root/main/lbllist/lbllist") ; i++){
  243. if(model.getValue("/root/main/lbllist/lbllist["+ i +"]/lblcnts2").length > 0) { totcnt++; vlblcnt = true;}
  244. }
  245. // (e)
  246. for(iPoint = 1; iPoint <= getNodesetCount("/root/main/lbllist/lbllist") ; iPoint++){
  247. if ( model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/lblprnttims")>0 ){
  248. reprint ="(재)";
  249. }
  250. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/fprnttime", "출 력 : " + fPrntTime(sDD, sTM));
  251. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd", "처 방 : " + fDateFormat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd"), "MD"));
  252. //병실
  253. //환자이름
  254. var patnm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/patnm")
  255. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/patnm", patnm.substr(0,6));
  256. //환자번호
  257. var tpid = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/pid")+" ("+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugno")+reprint+")" ;
  258. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/pid" , tpid);
  259. var sDrugKindcd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  260. var sMixno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpmixno");
  261. if(sDrugKindcd == "[내복약]"){
  262. if(model.getValue("/root/send/prcpinfo/lbltype") == "Y"){
  263. fInUseDrugLBL2();
  264. } else {
  265. fInUseDrugLBL();
  266. }
  267. } else if(sDrugKindcd == "[외용약]"){
  268. if(model.getValue("/root/send/prcpinfo/lbltype") == "Y"){
  269. fInUseDrugLBL2();
  270. } else {
  271. fInUseDrugLBL();
  272. }
  273. } else if(sDrugKindcd == "[주사약]"){
  274. if(sMixno != "-"){
  275. fMixLBL();
  276. } else {
  277. fInjDrugLBL();
  278. }
  279. }
  280. }
  281. if(getNodesetCount("/root/main/lbllist/lbllist") > 0 ) {
  282. // 20100429_laboru_병동 작은라벨 .
  283. makeReportPreview(0,0,10, 10, "");
  284. fPrintRexbar("RFADT62302");
  285. }
  286. model.refresh();
  287. }
  288. /**
  289. * mix 라벨
  290. */
  291. function fMixLBL() {
  292. var sMixno1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpmixno");
  293. var cnt = 0;
  294. var unit = "";
  295. var tprcpcd = "";
  296. var tprcpnm = "";
  297. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  298. sMixno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpmixno");
  299. var qty = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqty");
  300. var dayqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/dayprcpqty");
  301. var qtyunit = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqtyunit");
  302. var tims = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
  303. var dayno = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  304. var prcpnm= model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  305. var prcpcd = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd");
  306. //prcpnm = prcpnm.substr(0,7);
  307. if(sMixno1 == sMixno2){
  308. if(cnt == 0) {
  309. tprcpcd = prcpcd;
  310. tprcpnm = prcpnm;
  311. unit = fChkFloat(dayqty)+qtyunit+ " "+tims+ " "+dayno;
  312. } else {
  313. tprcpcd += "\n" + prcpcd;
  314. tprcpnm += "\n" + prcpnm;
  315. unit += "\n" + fChkFloat(dayqty)+qtyunit+ " "+tims+ " "+dayno;
  316. }
  317. if(cnt != 0) {
  318. model.removeNode("/root/main/lbllist/lbllist["+j+"]");
  319. j--
  320. }
  321. cnt++;
  322. } else {
  323. j--;
  324. break;
  325. }
  326. if(cnt == 5){
  327. break;
  328. }
  329. }
  330. //iPoint = j;
  331. // 20101101_laboru_경북대병원_라벨 출력물 처방코드 삭제
  332. //model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd" , tprcpcd );
  333. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm" , tprcpnm );
  334. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/unit" , unit );
  335. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts", "N6");
  336. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/lblcnts2", "");
  337. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/pageflag", "N");
  338. }
  339. /**
  340. * 내복약 라벨
  341. */
  342. function fInUseDrugLBL() {
  343. // var sSumCls1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sumcls");
  344. var sMthdcd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcd");
  345. var qty = "";
  346. var dayqty = "";
  347. var qtyunit = "";
  348. var tims = "";
  349. var dayno = "";
  350. var cnt = 0;
  351. var chgMth = false; // 2010.02.17 pymi
  352. var unit = "";
  353. var tprcpnm = "";
  354. var tprcpcd = "";
  355. var tlblcnts2 = "";
  356. //var tj = iPoint+1;
  357. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  358. if(cnt != 0 && fChkIndependDrug(j)){ // 내복약 단독라벨 검증작업
  359. break;
  360. }
  361. // sSumCls2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/sumcls");
  362. sMthdcd2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthdcd");
  363. qty = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqty");
  364. dayqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/dayprcpqty");
  365. qtyunit = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqtyunit");
  366. tims = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
  367. dayno = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  368. var prcpnm= model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  369. var prcpcd= model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd");
  370. var lblcnts2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/lblcnts2");
  371. model.makeValue("/root/main/lbllist/lbllist["+j+"]/inusedrugflag", "Y");
  372. var val = parseFloat(model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty"));
  373. if((sMthdcd1 == sMthdcd2)){
  374. // 2010.02.17 pymi
  375. if(model.getValue("/root/main/lbllist/lbllist["+ j +"]/lblcnts2").length > 0 ) {ordflag += j + "/";}
  376. //prcpnm = prcpnm.substr(0,7);
  377. if(cnt == 0) {
  378. tprcpnm = val + " " + prcpnm;
  379. tprcpcd = prcpcd;
  380. tlblcnts2 = lblcnts2;
  381. } else {
  382. tprcpnm += "\n" + val + " " +prcpnm;
  383. tprcpcd += "\n" + prcpcd;
  384. tlblcnts2 += "\n" + lblcnts2;
  385. }
  386. if( model.getValue("/root/main/lbllist/lbllist["+j+"]/lblgrup") == "DS"){
  387. if(cnt == 0) {
  388. unit = dayqty+qtyunit+ " "+tims+ " "+dayno;
  389. } else {
  390. unit += "\n" + dayqty+qtyunit+ " "+tims+ " "+dayno;
  391. }
  392. } else {
  393. if(cnt == 0) {
  394. unit = dayqty+ " "+tims+ " "+dayno;
  395. } else {
  396. unit += "\n" + dayqty+ " "+tims+ " "+dayno;
  397. }
  398. }
  399. // 20100421_laboru_rex 중복 출력 막기 위해
  400. if(cnt != 0) {
  401. model.removeNode("/root/main/lbllist/lbllist["+j+"]");
  402. model.removeNode("/root/main/lbllist2/lbllist["+j+"]");
  403. j--;
  404. }
  405. cnt++;
  406. } else {
  407. // 용법바뀔때 2010.02.17 pymi
  408. chgMth = true;
  409. // (e)
  410. break;
  411. }
  412. if(cnt == fMthdnmLength(iPoint) || fChkIndependDrug(j)){
  413. j++;
  414. // 다음 용법이 다를때 2010.02.17 pymi
  415. sMthdcd3 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthdcd");
  416. if((sMthdcd1 != sMthdcd3) && (ordflag.length > 0) ){
  417. prntflag = true;
  418. }
  419. //
  420. break;
  421. }
  422. }
  423. // 20101101_laboru_경북대병원_라벨 출력물 처방코드 삭제
  424. //model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd", tprcpcd);
  425. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm", tprcpnm);
  426. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/unit", unit);
  427. if(ordflag.length > 0) {
  428. model.makeValue("/root/main/lbllist2/lbllist["+iPoint+"]/lblcnts2", tlblcnts2);
  429. }
  430. //iPoint = j-1;
  431. //보관방법 고가 출력
  432. var sKeepmthd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/keepmthd");
  433. var sExpnyn = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/expnyn");
  434. var sExpnnm = "";
  435. if(sExpnyn == "Y") sExpnnm = "고가";
  436. if(sKeepmthd != ""){
  437. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/keepmthd", "<"+sKeepmthd+">" );
  438. }
  439. if(sExpnnm != ""){
  440. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/expnnm", "<"+sExpnnm+">" );
  441. }
  442. //용법의 길이에 따라 찍는 위치를 달리한다(용법찍을 공간을 확보)
  443. var iYPoint = 0;
  444. if( fMthdnmLength(iPoint) == 4){
  445. iYPoint = 280;
  446. } else {
  447. iYPoint = 245;
  448. }
  449. var tmth = "";
  450. if( model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/lblgrup") == "DS"){
  451. var tmth = "1일 "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims")+"회 "+qty+qtyunit+" "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno")+"일분";
  452. } else {
  453. var tmth = "1일 "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims")+"회 " +model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno")+"일분";
  454. }
  455. // 용법 생성
  456. var sMthd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1");
  457. var sMthd2 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2");
  458. var sMthd3 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  459. var sMthd4 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  460. var sTemp = "";
  461. if(sMthd1 != "") sTemp += sMthd1 + " ";
  462. if(sMthd2 != "") sTemp += sMthd2 + " ";
  463. if(sMthd3 != "") sTemp += sMthd3 + " ";
  464. if(sMthd4 != "") sTemp += sMthd4;
  465. tmth += "\n" + sTemp;
  466. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts" , tmth);
  467. vcnt = cnt;
  468. }
  469. /**
  470. * 내복약 라벨 - 한장에 모든 용법 약을 ...
  471. */
  472. function fInUseDrugLBL2() {
  473. // var sSumCls1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sumcls");
  474. var sMthdcd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcd");
  475. var qty = "";
  476. var dayqty = "";
  477. var qtyunit = "";
  478. var tims = "";
  479. var dayno = "";
  480. var cnt = 0;
  481. var chk = false;
  482. var tprcpcd = "";
  483. var tprcpnm = "";
  484. var tlblcnts2 = "";
  485. var unit = "";
  486. totpg = Math.ceil(totcnt / 6 );
  487. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  488. if(cnt != 0 && model.getValue("/root/main/lbllist/lbllist["+j+"]/lblgrup") == "DI" ) {
  489. break;
  490. }
  491. sMthdcd2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthdcd");
  492. qty = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqty");
  493. dayqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/dayprcpqty");
  494. qtyunit = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqtyunit");
  495. tims = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
  496. dayno = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  497. var prcpcd = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd");
  498. var prcpnm = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  499. var lblcnts2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/lblcnts2");
  500. //prcpnm = prcpnm.substr(0,7);
  501. if(cnt == 0) {
  502. if( model.getValue("/root/main/lbllist/lbllist["+j+"]/lblgrup") == "DT"){ //PTP는 * 표시
  503. tprcpcd += "* " + prcpcd;
  504. } else {
  505. tprcpcd =prcpcd;
  506. }
  507. tprcpnm = prcpnm;
  508. tlblcnts2 = lblcnts2;
  509. } else {
  510. if( model.getValue("/root/main/lbllist/lbllist["+j+"]/lblgrup") == "DT"){ //PTP는 * 표시
  511. tprcpcd += "\n" + "* " + prcpcd;
  512. } else {
  513. tprcpcd +="\n" + prcpcd;
  514. }
  515. tprcpnm += "\n" + prcpnm;
  516. tlblcnts2 += "\n" + lblcnts2;
  517. }
  518. if( model.getValue("/root/main/lbllist/lbllist["+j+"]/lblgrup") == "DS"){
  519. if(cnt == 0) {
  520. unit = dayqty+qtyunit+ " "+tims+ " "+dayno;
  521. } else {
  522. unit += "\n" + dayqty+qtyunit+ " "+tims+ " "+dayno;
  523. }
  524. } else {
  525. if(cnt == 0) {
  526. unit = dayqty+ " "+tims+ " "+dayno;
  527. } else {
  528. unit += "\n" + dayqty+ " "+tims+ " "+dayno;
  529. }
  530. }
  531. if(model.getValue("/root/main/lbllist/lbllist["+ j +"]/lblcnts2").length > 0) ordflag += j + "/"; // 2010.02.10 pymi
  532. // 20100421_laboru_rex 중복 출력 막기 위해
  533. if(cnt != 0) {
  534. model.removeNode("/root/main/lbllist/lbllist["+j+"]");
  535. model.removeNode("/root/main/lbllist2/lbllist["+j+"]");
  536. j--;
  537. }
  538. cnt++;
  539. if(cnt == 6){
  540. pg++;
  541. j++;
  542. chk=true;
  543. break;
  544. }
  545. }
  546. // 20101101_laboru_경북대병원_라벨 출력물 처방코드 삭제
  547. //model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd", tprcpcd);
  548. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm", tprcpnm);
  549. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/unit", unit);
  550. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts", "N6");
  551. if(ordflag.length > 0) {
  552. model.makeValue("/root/main/lbllist2/lbllist["+iPoint+"]/lblcnts2", tlblcnts2);
  553. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/lblcnts2", "");
  554. }
  555. // 2010.02 18 pymi
  556. if (chk == false) {
  557. if( model.getValue("/root/main/lbllist/lbllist["+(j-1)+"]/lblgrup") != "DI" ) {
  558. cnt ++; // 라벨내용 찍기 전에 한줄 띄우기
  559. if(!vlblcnt || cnt == 6) {
  560. pg++;
  561. }
  562. }
  563. }
  564. vcnt = cnt;
  565. }
  566. // 20100503_laboru_포장라벨내용 출력
  567. function fPrntLblCnt2New() {
  568. var tPoint = 1;
  569. var reprint = "";
  570. for(var t = 1 ; t <= getNodesetCount("/root/main/lbllist2/lbllist") ; t++) {
  571. var sDD = getCurrentDate();
  572. var sTM = getCurrentTime();
  573. if(model.getValue("/root/main/lbllist2/lbllist["+t+"]/pid") =="" ) {
  574. return;
  575. }
  576. if ( model.getValue("/root/main/lbllist2/lbllist["+t+"]/lblprnttims")>0 ){
  577. reprint ="(재)";
  578. }
  579. model.makeValue("/root/main/lbllist2/lbllist["+t+"]/fprnttime", "출 력 : " + fPrntTime(sDD, sTM));
  580. model.setValue("/root/main/lbllist2/lbllist["+t+"]/prcpdd", "처 방 : " + fDateFormat(model.getValue("/root/main/lbllist2/lbllist["+t+"]/prcpdd"), "MD"));
  581. var tpid = model.getValue("/root/main/lbllist2/lbllist["+t+"]/pid")+" ("+model.getValue("/root/main/lbllist2/lbllist["+t+"]/drugno")+reprint+")" ;
  582. model.setValue("/root/main/lbllist2/lbllist["+t+"]/pid" , tpid);
  583. for(var y = tPoint ; y <= getNodesetCount("/root/main/lbllist/lbllist") ; y++) {
  584. if(y == getNodesetCount("/root/main/lbllist/lbllist")) {
  585. model.makeNode("root/main/lbllist/lbllist[" + (y+1) + "]");
  586. model.copyNode("root/main/lbllist/lbllist[" + (y+1) + "]", "root/main/lbllist2/lbllist[" + t + "]");
  587. model.makeValue("/root/main/lbllist/lbllist["+ (y+1) +"]/mthdcnts", "N6");
  588. model.setValue("/root/main/lbllist/lbllist["+ (y+1) +"]/prcpcd" , "");
  589. model.setValue("/root/main/lbllist/lbllist["+ (y+1) +"]/prcpnm" , "");
  590. break;
  591. }
  592. }
  593. }
  594. ordflag = "";
  595. vcnt = 0;
  596. pg = 0;
  597. totpg = 0;
  598. mlblcnt2 = false;
  599. }
  600. /**
  601. * 외용약 라벨
  602. */
  603. function fExUseDrugLBL() {
  604. }
  605. /**
  606. * 주사약 라벨
  607. */
  608. function fInjDrugLBL() {
  609. var sSumCls1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sumcls");
  610. var cnt = 0;
  611. var unit = "";
  612. var tprcpcd = "";
  613. var tprcpnm = "";
  614. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  615. if(cnt != 0 && fChkIndependInj(j)){
  616. //주사가 뭉쳐서 나오다가 단독주사를 만날경우 단독주사는 출력하지 아니함.
  617. break;
  618. }
  619. sSumCls2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/sumcls");
  620. var qty = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqty");
  621. var dayqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/dayprcpqty");
  622. var qtyunit = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqtyunit");
  623. var tims = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
  624. var dayno = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  625. var prcpnm = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  626. var prcpcd = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd");
  627. var val = parseFloat(model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty"));
  628. //prcpnm = prcpnm.substr(0,7);
  629. if(cnt == 0) {
  630. tprcpcd = prcpcd;
  631. tprcpnm = val + " " + prcpnm;
  632. unit = fChkFloat(dayqty)+qtyunit+ " "+tims+ " "+dayno;
  633. } else {
  634. tprcpcd += "\n" + prcpcd;
  635. tprcpnm += "\n" + val + " " + prcpnm;
  636. unit += "\n" + fChkFloat(dayqty)+qtyunit+ " "+tims+ " "+dayno;
  637. }
  638. if(cnt != 0) {
  639. model.removeNode("/root/main/lbllist/lbllist["+j+"]");
  640. j--
  641. }
  642. cnt++;
  643. if(cnt == 5 || fChkIndependInj(j)){
  644. j++;
  645. break;
  646. }
  647. }
  648. // 20101101_laboru_경북대병원_라벨 출력물 처방코드 삭제
  649. //model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd" , tprcpcd );
  650. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm" , tprcpnm );
  651. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/unit" , unit );
  652. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/lblcnts2", "");
  653. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/pageflag", "N");
  654. if(!fChkIndependInj(iPoint)) {
  655. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts", "N6");
  656. } else {
  657. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/inusedrugflag", "Y");
  658. }
  659. //iPoint = j-1;
  660. //보관방법 고가 출력
  661. var sKeepmthd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/keepmthd");
  662. var sExpnyn = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/expnyn");
  663. var sExpnnm = "";
  664. if(sExpnyn == "Y") sExpnnm = "고가";
  665. if(sKeepmthd != ""){
  666. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/keepmthd", "<"+sKeepmthd+">" );
  667. }
  668. if(sExpnnm != ""){
  669. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/expnnm", "<"+sExpnnm+">" );
  670. }
  671. }
  672. /**
  673. * 내복약 단독라벨 검증작업
  674. */
  675. function fChkIndependDrug(cnt) {
  676. var sLBLGrup = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/lblgrup");
  677. var sSnglyn = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/atcifsnglyn");
  678. var sDrugindependpackflag = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/drugindependpackflag");
  679. var sKeepmthd = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/keepmthd");
  680. var sExpnyn = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/expnyn");
  681. var sRst = false;
  682. if(sLBLGrup == "DS" || sLBLGrup == "DI" || sLBLGrup == "DT" || sLBLGrup == "DX") sRst = true;
  683. if(sSnglyn == "Y") sRst = true;
  684. if(sDrugindependpackflag == "Y") sRst = true;
  685. if(sExpnyn == "Y") sRst = true;
  686. if(sKeepmthd != "") sRst = true;
  687. return sRst;
  688. }
  689. /**
  690. * 주사약 단독라벨 검증작업
  691. */
  692. function fChkIndependInj(cnt) {
  693. var sLBLGrup = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/lblgrup");
  694. var sExp = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/expnyn");
  695. var sKeepmthd = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/keepmthd");
  696. var sSelfprcpflag = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/selfprcpflag");
  697. var sDrugindependpackflag = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/drugindependpackflag");
  698. var sRst = false;
  699. if(sLBLGrup == "IH" || sLBLGrup == "IO" || sLBLGrup == "IS" || sLBLGrup == "IX") sRst = true;
  700. if(sExp == "Y" || sKeepmthd != "" || sSelfprcpflag == "Y") sRst = true;
  701. if(sDrugindependpackflag == "Y") sRst = true;
  702. //2010-06-29 [보관방법:냉장주사/고위험주사] 단독출력
  703. var sDngryn = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/dngryn"); //고위험주사 여부
  704. var sKeepmthdyn = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/keepmthdyn"); //냉장주사 여부
  705. if(sDngryn == "Y" || sKeepmthdyn=="Y" ) sRst = true;
  706. return sRst;
  707. }
  708. /**
  709. * 용법 생성
  710. */
  711. function fMthdnm(iPoint) {
  712. var sMthd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1");
  713. var sMthd2 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2");
  714. var sMthd3 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  715. var sMthd4 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  716. var sTemp = "";
  717. var sRst = "";
  718. if(sMthd1 != "") sTemp += sMthd1 + " ";
  719. if(sMthd2 != "") sTemp += sMthd2 + " ";
  720. if(sMthd3 != "") sTemp += sMthd3 + " ";
  721. if(sMthd4 != "") sTemp += sMthd4;
  722. if(sTemp.length > 28){
  723. var sTemp1 = sTemp.substr(0, 26);
  724. var sTemp2 = sTemp.substr(26, sTemp.length);
  725. sRst = astfPrintOut(20, 285, 28, sTemp1,"");
  726. sRst += astfPrintOut(20, 320, 28, sTemp2,"");
  727. } else if(sTemp.length > 24){
  728. sRst = astfPrintOut(20, 320, 29, sTemp,"");
  729. } else if(sTemp.length > 22){
  730. sRst = astfPrintOut(20, 320, 3, sTemp,"");
  731. } else if(sTemp.length > 21){
  732. sRst = astfPrintOut(20, 320, 3, sTemp,"");
  733. } else if(sTemp.length <= 21){
  734. sRst = astfPrintOut(20, 320, 3, sTemp,"");
  735. }
  736. return sRst;
  737. }
  738. /**
  739. * 용법 길이
  740. */
  741. function fMthdnmLength(iPoint) {
  742. var sMthd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1");
  743. var sMthd2 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2");
  744. var sMthd3 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  745. var sMthd4 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  746. var sTemp = "";
  747. var sRst = "4"; //병동라벨은 기본 4줄까지 약처방이 출력된다.
  748. if(sMthd1 != "") sTemp += sMthd1 + " ";
  749. if(sMthd2 != "") sTemp += sMthd2 + " ";
  750. if(sMthd3 != "") sTemp += sMthd3 + " ";
  751. if(sMthd4 != "") sTemp += sMthd4;
  752. if(sTemp.length > 28){
  753. sRst = "3"; //복용방법이 길경우 3줄까지 약처방을 출력한다.
  754. }
  755. return sRst;
  756. }
  757. /**
  758. * 응급실/퇴원/외박/외출 라벨출력(큰사이즈)
  759. */
  760. function fBigLBLPrint(lblsz) {
  761. /*
  762. 라벨 Sorting 로직
  763. //mgt에서 vo로 리턴
  764. 대분류
  765. - 내복약, 외용약, 주사, 항암제, TPN, 마약,
  766. 중분류
  767. - 방법코드
  768. 소분류
  769. - 내복약,외용약(방법코드), 주사,마약,항암제(mix)
  770. web js 출력로직
  771. 1 약종류(내복약/주사약/외용약)
  772. 1.1 방법코드
  773. 1.2 처방수량
  774. */
  775. // 라벨내용 copy
  776. model.removeNodeset("/root/main/lbllist2");
  777. model.makeNode("/root/main/lbllist2");
  778. model.copyNode("/root/main/lbllist2", "/root/main/lbllist");
  779. // 20100427_laboru_큰라벨 일반라벨 내복약 처방코드 출력
  780. for(mPoint = 1; mPoint <= getNodesetCount("/root/main/lbllist2/lbllist") ; mPoint++){
  781. if( fChkSumcls2(mPoint) ) {
  782. model.removeNode("/root/main/lbllist2/lbllist["+parseInt(mPoint)+"]");
  783. mPoint--;
  784. } else {
  785. //일반라벨출력
  786. fGnrlPrintnmNew();
  787. }
  788. }
  789. var reprint="";
  790. for(iPoint = 1; iPoint <= getNodesetCount("/root/main/lbllist/lbllist") ; iPoint++){
  791. if(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/pid") =="" ) {
  792. return;
  793. }
  794. if ( model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/lblprnttims")>0 ){
  795. reprint ="(재)";
  796. }
  797. iPageCnt++;
  798. // roomcd
  799. if(lblsz == "L1") {
  800. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/roomcd", model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/roomcd") + " 호실");
  801. }
  802. // patnm.substring(0,5)
  803. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/patnm", model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/patnm"));
  804. // barcode
  805. // 20101101_laboru_경북대병원_atc drugkind 구분자에 의한 바코드 출력 형식
  806. // t : "ATC" , p : 산제 바코드, e : blank
  807. if(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/atc_drugkind") == "t" ) {
  808. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/barcode", "ATC");
  809. //sSndMsg += astfPrintOut(390, 40, 6, "ATC","");
  810. } else if(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/atc_drugkind") == "p") {
  811. //model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/barcode" , model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/barcode") + iPoint );
  812. //sSndMsg += astfBarCode_Code39(390, 40, "N", 70, model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/barcode"));
  813. } else {
  814. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/barcode", "");
  815. // 공백
  816. }
  817. // pid
  818. // ( drugno )
  819. if(lblsz == "L") {
  820. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/drugno", "(" + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugno") + ")" );
  821. } else if(lblsz == "L1") {
  822. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/drugno", "<" + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugno") + ">" );
  823. }
  824. // (재) sexage
  825. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/sexage", reprint + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sexage"));
  826. // deptengabbr
  827. // orddrnm
  828. // prcpdd (형식 : 2010/04/15)
  829. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd", fDateFormat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd")));
  830. // iPageCnt / iTotalPageNum
  831. //model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/pagecnt", iPageCnt + "/" + iTotalPageNum);
  832. // 선 한줄.. 필요한가?
  833. // 가운데 약품 정보 들어가고...
  834. // 하단 정보 들어감.
  835. // *의약품은 그 특성상 보관및관리가 엄격해야하므로, 일단 조제투약된 약은 반납할 수 없습니다.
  836. // 20100712_laboru_출력일시 추가
  837. //var sDD = getCurrentDate();
  838. //var sTM = getCurrentTime();
  839. //model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/caution","*의약품은 그 특성상 보관및관리가 엄격해야하므로, 일단 조제투약된 약은 반납할 수 없습니다." + " ( 출력 : " + fPrntTime(sDD, sTM) + " )");
  840. // 처방구분
  841. var drugflag = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugflag");
  842. var tdfname = "";
  843. if(drugflag == "L") {
  844. tdfname = "퇴원";
  845. } else {
  846. tdfname = "입원";
  847. }
  848. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/drugflag", tdfname);
  849. //alert(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd"));
  850. if( fChkSumcls(iPoint)){
  851. //단독라벨출력
  852. if(lblsz == "L") {
  853. fIndependPrint();
  854. } else if(lblsz == "L1") {
  855. fIndependPrintL1();
  856. }
  857. } else {
  858. //일반라벨출력
  859. if(lblsz == "L") {
  860. fGnrlPrint();
  861. } else if(lblsz == "L1") {
  862. fGnrlPrintL1(); // 20101222_laboru_경북대병원_경북대본원용 라벨 크기
  863. }
  864. }
  865. // 2010.02.17 pymi
  866. if(nextPage) {
  867. //fGnrlPrintnm_Old(nCnt, bordflag);
  868. nextPage = false;
  869. nCnt = 0;
  870. bordflag = "";
  871. }
  872. if(iPoint == getNodesetCount("/root/main/lbllist/lbllist")) {
  873. iTotalPageNum = 0;
  874. iPageCnt = 0;
  875. }
  876. }
  877. if(NBflag) {
  878. // 큰라벨 일반라벨 내복약이 있을 때만.
  879. if(lblsz == "L") {
  880. fGnrlNbPrint();
  881. } else if(lblsz == "L1") {
  882. fGnrlNbPrintL1();
  883. }
  884. NBflag = false;
  885. }
  886. if(getNodesetCount("/root/main/lbllist/lbllist") > 0) {
  887. // 20100419_laboru_병동 큰라벨 주사.
  888. makeReportPreview(0,0,10, 10, "");
  889. // 20101222_laboru_경북대병원_경대본원용 라벨 사이즈 L1 추가
  890. if(lblsz == "L") {
  891. fPrintRexbar("RFADT62301");
  892. } else if(lblsz == "L1") {
  893. fPrintRexbar("RFADT62303");
  894. }
  895. //removeReportPreview("RFADT62301");
  896. }
  897. model.refresh();
  898. }
  899. /*
  900. * 20100427_laboru_큰라벨 일반라벨 내복약 처방 출력.
  901. */
  902. function fGnrlNbPrint() {
  903. var tPoint = 1;
  904. var reprint = "";
  905. for(var t = 1 ; t <= getNodesetCount("/root/main/lbllist2/lbllist") ; t++) {
  906. if(model.getValue("/root/main/lbllist2/lbllist["+t+"]/pid") =="" ) {
  907. return;
  908. }
  909. if ( model.getValue("/root/main/lbllist2/lbllist["+t+"]/lblprnttims")>0 ){
  910. reprint ="(재)";
  911. }
  912. var drugkind3 = model.getValue("/root/main/lbllist2/lbllist["+t+"]/drugkindnm");
  913. var dayno3 = model.getValue("/root/main/lbllist2/lbllist["+t+"]/prcpdayno");
  914. var mthd7 = model.getValue("/root/main/lbllist2/lbllist["+t+"]/mthd1");
  915. var mthd8 = model.getValue("/root/main/lbllist2/lbllist["+t+"]/mthd2");
  916. var mthd9 = model.getValue("/root/main/lbllist2/lbllist["+t+"]/mthd3");
  917. var mthdcd = model.getValue("/root/main/lbllist2/lbllist["+t+"]/mthdcd");
  918. //라벨내용
  919. var drugkindnm = model.getValue("/root/main/lbllist2/lbllist["+t+"]/drugkindnm");
  920. var qty = model.getValue("/root/main/lbllist2/lbllist["+t+"]/prcpqty");
  921. var dayqty = model.getValue("/root/main/lbllist2/lbllist["+t+"]/dayprcpqty");
  922. var tims = model.getValue("/root/main/lbllist2/lbllist["+t+"]/prcptims");
  923. var dayno = model.getValue("/root/main/lbllist2/lbllist["+t+"]/prcpdayno");//처방일수
  924. var mthddayno = model.getValue("/root/main/lbllist2/lbllist["+t+"]/dayno"); //용법일수
  925. var packunit = model.getValue("/root/main/lbllist2/lbllist["+t+"]/packunit"); //약품마스터의 수량단위
  926. // patnm.substring(0,5)
  927. model.setValue("/root/main/lbllist2/lbllist["+t+"]/patnm", model.getValue("/root/main/lbllist2/lbllist["+t+"]/patnm"));
  928. // barcode
  929. // pid
  930. // ( drugno )
  931. model.setValue("/root/main/lbllist2/lbllist["+t+"]/drugno", "(" + model.getValue("/root/main/lbllist2/lbllist["+t+"]/drugno") + ")" );
  932. // (재) sexage
  933. model.setValue("/root/main/lbllist2/lbllist["+t+"]/sexage", reprint + model.getValue("/root/main/lbllist2/lbllist["+t+"]/sexage"));
  934. // deptengabbr
  935. // orddrnm
  936. // prcpdd (형식 : 2010/04/15)
  937. model.setValue("/root/main/lbllist2/lbllist["+t+"]/prcpdd", fDateFormat(model.getValue("/root/main/lbllist2/lbllist["+t+"]/prcpdd")));
  938. // 선 한줄.. 필요한가?
  939. // 가운데 약품 정보 들어가고...
  940. // 하단 정보 들어감.
  941. // *의약품은 그 특성상 보관및관리가 엄격해야하므로, 일단 조제투약된 약은 반납할 수 없습니다.
  942. //model.makeValue("/root/main/lbllist2/lbllist["+t+"]/caution","*의약품은 그 특성상 보관및관리가 엄격해야하므로, 일단 조제투약된 약은 반납할 수 없습니다.");
  943. // 처방구분
  944. var drugflag = model.getValue("/root/main/lbllist2/lbllist["+t+"]/drugflag");
  945. var tdfname = "";
  946. if(drugflag == "L") {
  947. tdfname = "퇴원";
  948. } else {
  949. tdfname = "입원";
  950. }
  951. model.setValue("/root/main/lbllist2/lbllist["+t+"]/drugflag", tdfname);
  952. var lbltims =0;
  953. lbl_tims = mthd8.split(",");
  954. if ( mthdcd == "ZZZ" ){
  955. lbltims = tims;
  956. } else if ( mthd9.indexOf("취침") > -1 ) {
  957. lbltims = lbl_tims.length +1;
  958. } else if(mthd8.indexOf("마다") > -1){
  959. lbltims = model.getValue("/root/main/lbllist2/lbllist["+t+"]/prcptims");
  960. } else if(mthd7.indexOf("의사지시") > -1){
  961. lbltims = tims;
  962. } else {
  963. lbltims = lbl_tims.length;
  964. }
  965. tims = lbltims;
  966. for(var y = tPoint ; y <= getNodesetCount("/root/main/lbllist/lbllist") ; y++) {
  967. var drugkind1 = model.getValue("/root/main/lbllist/lbllist["+y+"]/drugkindnm");
  968. var dayno1 = model.getValue("/root/main/lbllist/lbllist["+y+"]/prcpdayno");
  969. var mthd1 = model.getValue("/root/main/lbllist/lbllist["+y+"]/mthd1");
  970. var mthd2 = model.getValue("/root/main/lbllist/lbllist["+y+"]/mthd2");
  971. var mthd3 = model.getValue("/root/main/lbllist/lbllist["+y+"]/mthd3");
  972. var lblcnts2 = model.getValue("/root/main/lbllist/lbllist["+y+"]/lblcnts2");
  973. if( !(fChkSumcls(y)) && drugkind1 == "[내복약]" ) {
  974. if((drugkind1 == drugkind3) && (dayno1 == dayno3) && (mthd1 == mthd7 && mthd2 == mthd8 && mthd3 == mthd9) && !fChkSumcls(y)){
  975. if(y == getNodesetCount("/root/main/lbllist/lbllist")) {
  976. model.makeNode("root/main/lbllist/lbllist[" + (y+1) + "]");
  977. model.copyNode("root/main/lbllist/lbllist[" + (y+1) + "]", "root/main/lbllist2/lbllist[" + t + "]");
  978. model.makeValue("root/main/lbllist/lbllist[" + (y+1) + "]/cntflag2", "Y");
  979. if(lbltims == 1) {
  980. if(mthd8.indexOf("마다") == -1) {
  981. model.makeValue("/root/main/lbllist/lbllist["+(y+1)+"]/unit", mthddayno + "일 "+lbltims+ "회 1포씩 "+(dayno * mthddayno)+"일분" );
  982. } else {
  983. model.makeValue("/root/main/lbllist/lbllist["+(y+1)+"]/unit", mthddayno + "일 "+tims+ "회 1포씩 "+(dayno * mthddayno)+"일분" );
  984. }
  985. } else {
  986. model.makeValue("/root/main/lbllist/lbllist["+(y+1)+"]/unit", mthddayno + "일 "+lbltims+ "회 1포씩 "+(dayno * mthddayno)+"일분" );
  987. }
  988. var val = model.getValue("/root/main/lbllist2/lbllist["+t+"]/mthd1") + model.getValue("/root/main/lbllist2/lbllist["+t+"]/mthd2")
  989. + model.getValue("/root/main/lbllist2/lbllist["+t+"]/mthd3");
  990. val += "\n" + model.getValue("/root/main/lbllist2/lbllist["+t+"]/mthdcnts4");
  991. model.makeValue("/root/main/lbllist/lbllist["+(y+1)+"]/mthdcnts" , val);
  992. if(model.getValue("/root/main/lbllist/lbllist["+ (y+1) +"]/drugflag") == "L" && model.getValue("/root/hidden/srchinfo/lbl5") == "Y") {
  993. model.setValue("/root/main/lbllist/lbllist["+ (y+1) +"]/prcpcd", "");
  994. model.setValue("/root/main/lbllist/lbllist["+ (y+1) +"]/samedrugflag", "N");
  995. }
  996. if( (lblcnts2.length <= 0) && (model.getValue("root/main/lbllist/lbllist[" + y + "]/cntflag2") != "Y") ) {
  997. model.removeNode("/root/main/lbllist/lbllist["+y+"]");
  998. y--;
  999. }
  1000. break;
  1001. }
  1002. } else {
  1003. tPoint = y+1;
  1004. // 기존 라벨 정보 shift
  1005. var tTotalCnt = getNodesetCount("/root/main/lbllist/lbllist");
  1006. model.makeValue("/root/main/lbllist/lbllist["+(parseInt(tTotalCnt)+1)+"]", "Y");
  1007. for(var x = tTotalCnt ; x >= y ; x--) {
  1008. model.copyNode("/root/main/lbllist/lbllist[" + (parseInt(x) + 1) + "]", "/root/main/lbllist/lbllist[" + x + "]" );
  1009. }
  1010. model.copyNode("root/main/lbllist/lbllist[" + y + "]", "root/main/lbllist2/lbllist[" + t + "]");
  1011. model.makeValue("root/main/lbllist/lbllist[" + y + "]/cntflag2", "Y");
  1012. if(lbltims == 1) {
  1013. if(mthd8.indexOf("마다") == -1) {
  1014. model.makeValue("/root/main/lbllist/lbllist["+y+"]/unit", mthddayno + "일 "+lbltims+ "회 1포씩 "+(dayno * mthddayno)+"일분" );
  1015. } else {
  1016. model.makeValue("/root/main/lbllist/lbllist["+y+"]/unit", mthddayno + "일 "+tims+ "회 1포씩 "+(dayno * mthddayno)+"일분" );
  1017. }
  1018. } else {
  1019. model.makeValue("/root/main/lbllist/lbllist["+y+"]/unit", mthddayno + "일 "+lbltims+ "회 1포씩 "+(dayno * mthddayno)+"일분" );
  1020. }
  1021. var val = model.getValue("/root/main/lbllist2/lbllist["+t+"]/mthd1") + model.getValue("/root/main/lbllist2/lbllist["+t+"]/mthd2")
  1022. + model.getValue("/root/main/lbllist2/lbllist["+t+"]/mthd3");
  1023. val += "\n" + model.getValue("/root/main/lbllist2/lbllist["+t+"]/mthdcnts4");
  1024. model.makeValue("/root/main/lbllist/lbllist["+y+"]/mthdcnts" , val);
  1025. if(model.getValue("/root/main/lbllist/lbllist["+ y +"]/drugflag") == "L" && model.getValue("/root/hidden/srchinfo/lbl5") == "Y") {
  1026. model.setValue("/root/main/lbllist/lbllist["+ y +"]/prcpcd", "");
  1027. model.setValue("/root/main/lbllist/lbllist["+ y +"]/samedrugflag", "N");
  1028. }
  1029. if( (lblcnts2.length <= 0) && (model.getValue("root/main/lbllist/lbllist[" + (y-1) + "]/cntflag2") != "Y") ) {
  1030. model.removeNode("/root/main/lbllist/lbllist["+(y-1)+"]");
  1031. y--;
  1032. }
  1033. if( (t +1) == y) {
  1034. tPoint--;
  1035. }
  1036. break;
  1037. }
  1038. }
  1039. }
  1040. }
  1041. }
  1042. /*
  1043. * 20100427_laboru_큰라벨 일반라벨 내복약 처방 출력.
  1044. */
  1045. function fGnrlNbPrintL1() {
  1046. var tPoint = 1;
  1047. var reprint = "";
  1048. for(var t = 1 ; t <= getNodesetCount("/root/main/lbllist2/lbllist") ; t++) {
  1049. if(model.getValue("/root/main/lbllist2/lbllist["+t+"]/pid") =="" ) {
  1050. return;
  1051. }
  1052. if ( model.getValue("/root/main/lbllist2/lbllist["+t+"]/lblprnttims")>0 ){
  1053. reprint ="(재)";
  1054. }
  1055. var drugkind3 = model.getValue("/root/main/lbllist2/lbllist["+t+"]/drugkindnm");
  1056. var dayno3 = model.getValue("/root/main/lbllist2/lbllist["+t+"]/prcpdayno");
  1057. var mthd7 = model.getValue("/root/main/lbllist2/lbllist["+t+"]/mthd1");
  1058. var mthd8 = model.getValue("/root/main/lbllist2/lbllist["+t+"]/mthd2");
  1059. var mthd9 = model.getValue("/root/main/lbllist2/lbllist["+t+"]/mthd3");
  1060. var mthdcd = model.getValue("/root/main/lbllist2/lbllist["+t+"]/mthdcd");
  1061. //라벨내용
  1062. var drugkindnm = model.getValue("/root/main/lbllist2/lbllist["+t+"]/drugkindnm");
  1063. var qty = model.getValue("/root/main/lbllist2/lbllist["+t+"]/prcpqty");
  1064. var dayqty = model.getValue("/root/main/lbllist2/lbllist["+t+"]/dayprcpqty");
  1065. var tims = model.getValue("/root/main/lbllist2/lbllist["+t+"]/prcptims");
  1066. var dayno = model.getValue("/root/main/lbllist2/lbllist["+t+"]/prcpdayno");//처방일수
  1067. var mthddayno = model.getValue("/root/main/lbllist2/lbllist["+t+"]/dayno"); //용법일수
  1068. var packunit = model.getValue("/root/main/lbllist2/lbllist["+t+"]/packunit"); //약품마스터의 수량단위
  1069. // roomcd
  1070. model.setValue("/root/main/lbllist2/lbllist["+t+"]/roomcd", model.getValue("/root/main/lbllist2/lbllist["+t+"]/roomcd") + " 호실");
  1071. // patnm.substring(0,5)
  1072. model.setValue("/root/main/lbllist2/lbllist["+t+"]/patnm", model.getValue("/root/main/lbllist2/lbllist["+t+"]/patnm"));
  1073. // barcode
  1074. // pid
  1075. // ( drugno )
  1076. model.setValue("/root/main/lbllist2/lbllist["+t+"]/drugno", "<" + model.getValue("/root/main/lbllist2/lbllist["+t+"]/drugno") + ">" );
  1077. // (재) sexage
  1078. model.setValue("/root/main/lbllist2/lbllist["+t+"]/sexage", reprint + model.getValue("/root/main/lbllist2/lbllist["+t+"]/sexage"));
  1079. // deptengabbr
  1080. // orddrnm
  1081. // prcpdd (형식 : 2010/04/15)
  1082. model.setValue("/root/main/lbllist2/lbllist["+t+"]/prcpdd", fDateFormat(model.getValue("/root/main/lbllist2/lbllist["+t+"]/prcpdd")));
  1083. // 선 한줄.. 필요한가?
  1084. // 가운데 약품 정보 들어가고...
  1085. // 하단 정보 들어감.
  1086. // *의약품은 그 특성상 보관및관리가 엄격해야하므로, 일단 조제투약된 약은 반납할 수 없습니다.
  1087. //model.makeValue("/root/main/lbllist2/lbllist["+t+"]/caution","*의약품은 그 특성상 보관및관리가 엄격해야하므로, 일단 조제투약된 약은 반납할 수 없습니다.");
  1088. // 처방구분
  1089. var drugflag = model.getValue("/root/main/lbllist2/lbllist["+t+"]/drugflag");
  1090. var tdfname = "";
  1091. if(drugflag == "L") {
  1092. tdfname = "퇴원";
  1093. } else {
  1094. tdfname = "입원";
  1095. }
  1096. model.setValue("/root/main/lbllist2/lbllist["+t+"]/drugflag", tdfname);
  1097. var lbltims =0;
  1098. lbl_tims = mthd8.split(",");
  1099. if ( mthdcd == "ZZZ" ){
  1100. lbltims = tims;
  1101. } else if ( mthd9.indexOf("취침") > -1 ) {
  1102. lbltims = lbl_tims.length +1;
  1103. } else if(mthd8.indexOf("마다") > -1){
  1104. lbltims = model.getValue("/root/main/lbllist2/lbllist["+t+"]/prcptims");
  1105. } else if(mthd7.indexOf("의사지시") > -1){
  1106. lbltims = tims;
  1107. } else {
  1108. lbltims = lbl_tims.length;
  1109. }
  1110. tims = lbltims;
  1111. for(var y = tPoint ; y <= getNodesetCount("/root/main/lbllist/lbllist") ; y++) {
  1112. var drugkind1 = model.getValue("/root/main/lbllist/lbllist["+y+"]/drugkindnm");
  1113. var dayno1 = model.getValue("/root/main/lbllist/lbllist["+y+"]/prcpdayno");
  1114. var mthd1 = model.getValue("/root/main/lbllist/lbllist["+y+"]/mthd1");
  1115. var mthd2 = model.getValue("/root/main/lbllist/lbllist["+y+"]/mthd2");
  1116. var mthd3 = model.getValue("/root/main/lbllist/lbllist["+y+"]/mthd3");
  1117. var lblcnts2 = model.getValue("/root/main/lbllist/lbllist["+y+"]/lblcnts2");
  1118. if( !(fChkSumcls(y)) && drugkind1 == "[내복약]" ) {
  1119. if((drugkind1 == drugkind3) && (dayno1 == dayno3) && (mthd1 == mthd7 && mthd2 == mthd8 && mthd3 == mthd9) && !fChkSumcls(y)){
  1120. if(y == getNodesetCount("/root/main/lbllist/lbllist")) {
  1121. model.makeNode("root/main/lbllist/lbllist[" + (y+1) + "]");
  1122. model.copyNode("root/main/lbllist/lbllist[" + (y+1) + "]", "root/main/lbllist2/lbllist[" + t + "]");
  1123. model.makeValue("root/main/lbllist/lbllist[" + (y+1) + "]/cntflag2", "Y");
  1124. var val = model.getValue("/root/main/lbllist2/lbllist["+t+"]/mthd1") + model.getValue("/root/main/lbllist2/lbllist["+t+"]/mthd2")
  1125. + model.getValue("/root/main/lbllist2/lbllist["+t+"]/mthd3");
  1126. if(lbltims == 1) {
  1127. if(mthd8.indexOf("마다") == -1) {
  1128. model.makeValue("/root/main/lbllist/lbllist["+(y+1)+"]/unit", lbltims+ "회 "+(dayno * mthddayno)+"일분" );
  1129. val += "1포씩 ";
  1130. } else {
  1131. model.makeValue("/root/main/lbllist/lbllist["+(y+1)+"]/unit", tims+ "회 "+(dayno * mthddayno)+"일분" );
  1132. val += "1포씩 ";
  1133. }
  1134. } else {
  1135. model.makeValue("/root/main/lbllist/lbllist["+(y+1)+"]/unit", lbltims+ "회 "+(dayno * mthddayno)+"일분" );
  1136. val += "1포씩 ";
  1137. }
  1138. val += model.getValue("/root/main/lbllist2/lbllist["+t+"]/mthdcnts4");
  1139. model.makeValue("/root/main/lbllist/lbllist["+(y+1)+"]/mthdcnts" , val);
  1140. if(model.getValue("/root/main/lbllist/lbllist["+ (y+1) +"]/drugflag") == "L" && model.getValue("/root/hidden/srchinfo/lbl5") == "Y") {
  1141. model.setValue("/root/main/lbllist/lbllist["+ (y+1) +"]/prcpcd", "");
  1142. model.setValue("/root/main/lbllist/lbllist["+ (y+1) +"]/samedrugflag", "N");
  1143. }
  1144. if( (lblcnts2.length <= 0) && (model.getValue("root/main/lbllist/lbllist[" + y + "]/cntflag2") != "Y") ) {
  1145. model.removeNode("/root/main/lbllist/lbllist["+y+"]");
  1146. y--;
  1147. }
  1148. break;
  1149. }
  1150. } else {
  1151. tPoint = y+1;
  1152. // 기존 라벨 정보 shift
  1153. var tTotalCnt = getNodesetCount("/root/main/lbllist/lbllist");
  1154. model.makeValue("/root/main/lbllist/lbllist["+(parseInt(tTotalCnt)+1)+"]", "Y");
  1155. for(var x = tTotalCnt ; x >= y ; x--) {
  1156. model.copyNode("/root/main/lbllist/lbllist[" + (parseInt(x) + 1) + "]", "/root/main/lbllist/lbllist[" + x + "]" );
  1157. }
  1158. model.copyNode("root/main/lbllist/lbllist[" + y + "]", "root/main/lbllist2/lbllist[" + t + "]");
  1159. model.makeValue("root/main/lbllist/lbllist[" + y + "]/cntflag2", "Y");
  1160. var val = model.getValue("/root/main/lbllist2/lbllist["+t+"]/mthd1") + model.getValue("/root/main/lbllist2/lbllist["+t+"]/mthd2")
  1161. + model.getValue("/root/main/lbllist2/lbllist["+t+"]/mthd3");
  1162. if(lbltims == 1) {
  1163. if(mthd8.indexOf("마다") == -1) {
  1164. model.makeValue("/root/main/lbllist/lbllist["+y+"]/unit",lbltims+ "회 "+(dayno * mthddayno)+"일분" );
  1165. val += "1포씩 ";
  1166. } else {
  1167. model.makeValue("/root/main/lbllist/lbllist["+y+"]/unit", tims+ "회 "+(dayno * mthddayno)+"일분" );
  1168. val += "1포씩 ";
  1169. }
  1170. } else {
  1171. model.makeValue("/root/main/lbllist/lbllist["+y+"]/unit", lbltims+ "회 "+(dayno * mthddayno)+"일분" );
  1172. val += "1포씩 ";
  1173. }
  1174. val += model.getValue("/root/main/lbllist2/lbllist["+t+"]/mthdcnts4");
  1175. model.makeValue("/root/main/lbllist/lbllist["+y+"]/mthdcnts" , val);
  1176. if(model.getValue("/root/main/lbllist/lbllist["+ y +"]/drugflag") == "L" && model.getValue("/root/hidden/srchinfo/lbl5") == "Y") {
  1177. model.setValue("/root/main/lbllist/lbllist["+ y +"]/prcpcd", "");
  1178. model.setValue("/root/main/lbllist/lbllist["+ y +"]/samedrugflag", "N");
  1179. }
  1180. if( (lblcnts2.length <= 0) && (model.getValue("root/main/lbllist/lbllist[" + (y-1) + "]/cntflag2") != "Y") ) {
  1181. model.removeNode("/root/main/lbllist/lbllist["+(y-1)+"]");
  1182. y--;
  1183. }
  1184. break;
  1185. }
  1186. }
  1187. }
  1188. }
  1189. }
  1190. /**
  1191. *
  1192. */
  1193. function fIndependPrint() {
  1194. //라벨내용
  1195. var drugkindnm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  1196. var qty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqty");
  1197. var dayqty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayprcpqty");
  1198. var tims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  1199. var dayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");//처방일수
  1200. var mthddayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayno"); //용법일수
  1201. var packunit = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/packunit"); //약품마스터의 수량단위
  1202. var powdflag = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/powdflag"); //처방쪽 산제 여부
  1203. if (drugkindnm == "[주사약]"){
  1204. //용법2
  1205. //alert("큰라벨+단독라벨+주사약");
  1206. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts", model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"));
  1207. } else if (drugkindnm == "[외용약]"){
  1208. //alert("큰라벨+단독라벨+외용약");
  1209. 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");
  1210. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts" , val);
  1211. } else if (drugkindnm == "[내복약]"){
  1212. //alert("큰라벨+단독라벨+내복약");
  1213. var sumcls = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sumcls");
  1214. if( sumcls == "DM" || sumcls == "DS" || sumcls == "DT" || sumcls == "DX"){ //20091110 이선경 수정 : 라벨그룹이 마약(경구), 수제, ptp, 기타약일경우 약품마스터의 수량단위를 출력
  1215. var tmpqty = Math.round(qty * 1000) / 1000; // 20100803_laboru_소수점 넷째 자리에서 반올림
  1216. if(packunit == "T" || packunit == "C") {
  1217. var unit = mthddayno + "일 "+tims+"회 "+fChkFloat(qty)+"정씩 "+(dayno*mthddayno)+"일분";
  1218. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/unit", unit);
  1219. } else {
  1220. var unit = mthddayno + "일 "+tims+"회 "+fChkFloat(tmpqty)+ packunit +"씩 "+(dayno*mthddayno)+"일분";
  1221. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/unit", unit);
  1222. }
  1223. } else {
  1224. var unit = mthddayno + "일 "+tims+"회 "+fChkFloat(qty)+"포[정]씩 "+(dayno*mthddayno)+"일분";
  1225. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/unit", unit);
  1226. }
  1227. var mth = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2")
  1228. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  1229. mth += "\n" + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  1230. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts", mth);
  1231. }
  1232. // 2010.03.22 pymi
  1233. if(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugflag") == "L" && !fChkSumcls(iPoint) && model.getValue("/root/hidden/srchinfo/lbl5") == "Y") {
  1234. var val = "";
  1235. } else {
  1236. // 20101101_laboru_경북대병원_라벨 출력물 처방코드 삭제
  1237. var val = parseFloat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/totdrugqty"))
  1238. +" "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm");
  1239. /* var val = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd")
  1240. +" "+parseFloat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/totdrugqty"))
  1241. +" "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm");*/
  1242. if(sumcls == "DT" ) { //20100707_ laboru_PTP 라벨 표시
  1243. val += " (PTP)";
  1244. }
  1245. //var tmpv += val;
  1246. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd", val)
  1247. }
  1248. }
  1249. function fIndependPrintL1() {
  1250. //라벨내용
  1251. var drugkindnm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  1252. var qty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqty");
  1253. var dayqty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayprcpqty");
  1254. var tims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  1255. var dayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");//처방일수
  1256. var mthddayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayno"); //용법일수
  1257. var packunit = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/packunit"); //약품마스터의 수량단위
  1258. var powdflag = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/powdflag"); //처방쪽 산제 여부
  1259. if (drugkindnm == "[주사약]"){
  1260. //용법2
  1261. //alert("큰라벨+단독라벨+주사약");
  1262. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts", model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"));
  1263. } else if (drugkindnm == "[외용약]"){
  1264. //alert("큰라벨+단독라벨+외용약");
  1265. 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");
  1266. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts" , val);
  1267. } else if (drugkindnm == "[내복약]"){
  1268. //alert("큰라벨+단독라벨+내복약");
  1269. var sumcls = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sumcls");
  1270. var mth = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2")
  1271. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  1272. if( sumcls == "DM" || sumcls == "DS" || sumcls == "DT" || sumcls == "DX"){ //20091110 이선경 수정 : 라벨그룹이 마약(경구), 수제, ptp, 기타약일경우 약품마스터의 수량단위를 출력
  1273. var tmpqty = Math.round(qty * 1000) / 1000; // 20100803_laboru_소수점 넷째 자리에서 반올림
  1274. if(packunit == "T" || packunit == "C") {
  1275. var unit = tims+"회 "+(dayno*mthddayno)+"일분";
  1276. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/unit", unit);
  1277. mth += fChkFloat(qty)+"정씩 ";
  1278. } else {
  1279. var unit = tims+"회 "+(dayno*mthddayno)+"일분";
  1280. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/unit", unit);
  1281. mth += fChkFloat(tmpqty)+ packunit +"씩 ";
  1282. }
  1283. } else {
  1284. var unit = tims+"회 "+(dayno*mthddayno)+"일분";
  1285. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/unit", unit);
  1286. mth += fChkFloat(qty)+"포[정]씩 ";
  1287. }
  1288. mth += model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  1289. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts", mth);
  1290. }
  1291. // 2010.03.22 pymi
  1292. if(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugflag") == "L" && !fChkSumcls(iPoint) && model.getValue("/root/hidden/srchinfo/lbl5") == "Y") {
  1293. var val = "";
  1294. } else {
  1295. // 20101101_laboru_경북대병원_라벨 출력물 처방코드 삭제
  1296. var val = parseFloat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/totdrugqty"))
  1297. +" "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm");
  1298. /* var val = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd")
  1299. +" "+parseFloat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/totdrugqty"))
  1300. +" "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm");*/
  1301. if(sumcls == "DT" ) { //20100707_ laboru_PTP 라벨 표시
  1302. val += " (PTP)";
  1303. }
  1304. //var tmpv += val;
  1305. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd", val)
  1306. }
  1307. }
  1308. /**
  1309. *
  1310. */
  1311. function fGnrlPrint() {
  1312. var cnt = 0;
  1313. var drugcnt = 0;
  1314. var ordCnt = 0; // 2010.02.10 pymi
  1315. //라벨내용
  1316. var drugkindnm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  1317. var qty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqty");
  1318. var dayqty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayprcpqty");
  1319. var tims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  1320. var dayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");//처방일수
  1321. var mthddayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayno"); //용법일수
  1322. //약코드 출력
  1323. var drugkind1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  1324. var dayno1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");
  1325. var mthd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd1");
  1326. var mthd2 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd2");
  1327. var mthd3 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd3");
  1328. var mthdcd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcd");
  1329. if (drugkindnm != "[내복약]"){
  1330. if (drugkindnm == "[주사약]"){
  1331. //용법2
  1332. //alert("일반라벨+주사약");
  1333. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts", model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"));
  1334. } else if (drugkindnm == "[외용약]"){
  1335. //alert("일반라벨+외용약");
  1336. //용법1
  1337. //용법2
  1338. var val = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2")
  1339. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  1340. val += "\n" + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  1341. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts" , val);
  1342. }
  1343. var tmppc = "";
  1344. var sndprcpcnt = 1;
  1345. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  1346. var drugkind2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/drugkindnm");
  1347. var dayno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno"); // 처방일수
  1348. var mthd4 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd1");
  1349. var mthd5 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd2");
  1350. var mthd6 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd3");
  1351. if((drugkind1 == drugkind2) && (dayno1 == dayno2) && (mthd1 == mthd4 && mthd2 == mthd5 && mthd3 == mthd6)
  1352. && !fChkSumcls(j)){
  1353. //alert("완전 같은 처방이 복수개일때 같은 라벨지에 출력.");
  1354. //if(model.getValue("/root/main/lbllist/lbllist["+j+"]/fst_prnt") == "Y"){
  1355. var prcpqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty")/model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims") ;
  1356. prcpqty = Math.ceil( prcpqty * tims*1000)/1000;
  1357. // 20101101_laboru_경북대병원_라벨 출력물 처방코드 삭제
  1358. tmppc = prcpqty
  1359. +" "+(model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm")) + " ";
  1360. /* tmppc = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd")
  1361. +" "+prcpqty
  1362. +" "+(model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm")).substring(0,6) + " ";
  1363. */
  1364. //alert(tmppc);
  1365. // 20100607_laboru_처방내용 출력하지 않음.(추후 공통 코드로 빼야함)
  1366. //model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/sndprcp"+sndprcpcnt, tmppc);
  1367. sndprcpcnt++;
  1368. // 20100421_laboru_rex 중복 출력 막기 위해
  1369. if(cnt != 0) {
  1370. model.removeNode("/root/main/lbllist/lbllist["+j+"]");
  1371. j--;
  1372. }
  1373. //}
  1374. cnt++;
  1375. } else {
  1376. break;
  1377. }
  1378. // 20100607_laboru_처방내용 출력하지 않음.(추후 공통 코드로 빼야함)
  1379. if(cnt == 12){
  1380. j++;
  1381. break;
  1382. }
  1383. }
  1384. // 20100420_laboru
  1385. //if( sndprcpcnt > 2 ) {
  1386. if( model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sndprcp1") != "" ) {
  1387. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/samedrugflag", "Y");
  1388. } else {
  1389. // 20100607_laboru_처방내용 출력하지 않음.(추후 공통 코드로 빼야함)
  1390. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd", tmppc);
  1391. //model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd", "총 " + (sndprcpcnt-1) + " 개 약");
  1392. //model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd", "");
  1393. }
  1394. } else if (drugkindnm == "[내복약]"){
  1395. //alert("일반라벨+내복약");
  1396. NBflag = true;
  1397. var lbltims =0;
  1398. lbl_tims = mthd2.split(",");
  1399. if ( mthdcd == "ZZZ" ){
  1400. lbltims = tims;
  1401. } else if ( mthd3.indexOf("취침") > -1 ) {
  1402. lbltims = lbl_tims.length +1;
  1403. } else if(mthd2.indexOf("마다") > -1){
  1404. lbltims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  1405. } else if(mthd1.indexOf("의사지시") > -1){
  1406. lbltims = tims;
  1407. } else {
  1408. lbltims = lbl_tims.length;
  1409. }
  1410. tims = lbltims;
  1411. // 라벨주의사항2 출력
  1412. var tmplblcnts2 = "";
  1413. var tmppc = "";
  1414. var sndprcpcnt = 1;
  1415. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  1416. var drugkind2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/drugkindnm");
  1417. var dayno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  1418. var mthd4 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd1");
  1419. var mthd5 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd2");
  1420. var mthd6 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd3");
  1421. if((drugkind1 == drugkind2) && (dayno1 == dayno2) && (mthd1 == mthd4 && mthd2 == mthd5 && mthd3 == mthd6)
  1422. && !fChkSumcls(j)){
  1423. // 2010.02.17 pymi
  1424. var lblcnts2 = model.getValue("/root/main/lbllist/lbllist["+ j +"]/lblcnts2");
  1425. bordflag += j + "/"; // 포장라벨 처방코드 순서
  1426. if(lblcnts2.length > 0) {
  1427. //sSndMsg += astfPrintOut(30, 440 +(60 * ordCnt), 4, lblcnts2, "");
  1428. // 20100421_laboru_라벨주의사항2 내용 유무 flag
  1429. model.makeValue("/root/main/lbllist/lbllist["+iPoint +"]/lblcnts2flag", "Y");
  1430. tmplblcnts2 += lblcnts2 + "\n";
  1431. ordCnt++; // 포장라벨 갯수
  1432. }
  1433. // 20100421_laboru_rex 중복 출력 막기 위해
  1434. if(drugcnt != 0) {
  1435. model.removeNode("/root/main/lbllist/lbllist["+j+"]");
  1436. j--;
  1437. }
  1438. drugcnt++;
  1439. } else {
  1440. // 용법이 바뀌는 시점 2010.02.10 pymi
  1441. bordflag = "";
  1442. break;
  1443. }
  1444. if(ordCnt == 3){ //2010.02.17 pymi
  1445. j++;
  1446. if(j <= getNodesetCount("/root/main/lbllist/lbllist")) {
  1447. var drugkind3 = model.getValue("/root/main/lbllist/lbllist["+j+"]/drugkindnm");
  1448. var dayno3 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  1449. var mthd7 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd1");
  1450. var mthd8 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd2");
  1451. var mthd9 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd3");
  1452. if((drugkind1 == drugkind3) && (dayno1 == dayno3) && (mthd1 == mthd7 && mthd2 == mthd8 && mthd3 == mthd9)
  1453. && !fChkSumcls(j)){
  1454. // 페이지 넘겨서도 용법 바뀌지 않으면 계속 진행
  1455. } else {
  1456. // 페이지 넘길때 용법이 바뀌면 처방 출력
  1457. //종료(매수)
  1458. nextPage = true;
  1459. nCnt = ordCnt;
  1460. //fGnrlPrintnm(ordCnt, bordflag);
  1461. }
  1462. }
  1463. // (e)
  1464. break;
  1465. }
  1466. }
  1467. if(lbltims == 1) {
  1468. if(mthd2.indexOf("마다") == -1) {
  1469. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/unit", mthddayno + "일 "+lbltims+ "회 1포씩 "+(dayno * mthddayno)+"일분" );
  1470. } else {
  1471. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/unit", mthddayno + "일 "+tims+ "회 1포씩 "+(dayno * mthddayno)+"일분" );
  1472. }
  1473. } else {
  1474. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/unit", mthddayno + "일 "+lbltims+ "회 1포씩 "+(dayno * mthddayno)+"일분" );
  1475. }
  1476. //용법1
  1477. var val = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd1") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd2")
  1478. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd3");
  1479. //용법2
  1480. val += "\n" + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  1481. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts" , val);
  1482. // 20100420_laboru_약품코드 출력 X
  1483. //model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd", "");
  1484. // 20100420_laboru_라벨주의사항2 출력
  1485. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/lblcnts2", tmplblcnts2);
  1486. }
  1487. }
  1488. function fGnrlPrintL1() {
  1489. var cnt = 0;
  1490. var drugcnt = 0;
  1491. var ordCnt = 0; // 2010.02.10 pymi
  1492. //라벨내용
  1493. var drugkindnm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  1494. var qty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqty");
  1495. var dayqty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayprcpqty");
  1496. var tims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  1497. var dayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");//처방일수
  1498. var mthddayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayno"); //용법일수
  1499. //약코드 출력
  1500. var drugkind1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  1501. var dayno1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");
  1502. var mthd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd1");
  1503. var mthd2 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd2");
  1504. var mthd3 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd3");
  1505. var mthdcd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcd");
  1506. if (drugkindnm != "[내복약]"){
  1507. if (drugkindnm == "[주사약]"){
  1508. //용법2
  1509. //alert("일반라벨+주사약");
  1510. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts", model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"));
  1511. } else if (drugkindnm == "[외용약]"){
  1512. //alert("일반라벨+외용약");
  1513. //용법1
  1514. //용법2
  1515. var val = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2")
  1516. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  1517. val += model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  1518. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts" , val);
  1519. }
  1520. var tmppc = "";
  1521. var sndprcpcnt = 1;
  1522. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  1523. var drugkind2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/drugkindnm");
  1524. var dayno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno"); // 처방일수
  1525. var mthd4 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd1");
  1526. var mthd5 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd2");
  1527. var mthd6 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd3");
  1528. if((drugkind1 == drugkind2) && (dayno1 == dayno2) && (mthd1 == mthd4 && mthd2 == mthd5 && mthd3 == mthd6)
  1529. && !fChkSumcls(j)){
  1530. //alert("완전 같은 처방이 복수개일때 같은 라벨지에 출력.");
  1531. //if(model.getValue("/root/main/lbllist/lbllist["+j+"]/fst_prnt") == "Y"){
  1532. var prcpqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty")/model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims") ;
  1533. prcpqty = Math.ceil( prcpqty * tims*1000)/1000;
  1534. // 20101101_laboru_경북대병원_라벨 출력물 처방코드 삭제
  1535. tmppc = prcpqty
  1536. +" "+(model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm")) + " ";
  1537. /* tmppc = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd")
  1538. +" "+prcpqty
  1539. +" "+(model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm")).substring(0,6) + " ";
  1540. */
  1541. //alert(tmppc);
  1542. // 20100607_laboru_처방내용 출력하지 않음.(추후 공통 코드로 빼야함)
  1543. //model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/sndprcp"+sndprcpcnt, tmppc);
  1544. sndprcpcnt++;
  1545. // 20100421_laboru_rex 중복 출력 막기 위해
  1546. if(cnt != 0) {
  1547. model.removeNode("/root/main/lbllist/lbllist["+j+"]");
  1548. j--;
  1549. }
  1550. //}
  1551. cnt++;
  1552. } else {
  1553. break;
  1554. }
  1555. // 20100607_laboru_처방내용 출력하지 않음.(추후 공통 코드로 빼야함)
  1556. if(cnt == 12){
  1557. j++;
  1558. break;
  1559. }
  1560. }
  1561. // 20100420_laboru
  1562. //if( sndprcpcnt > 2 ) {
  1563. if( model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sndprcp1") != "" ) {
  1564. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/samedrugflag", "Y");
  1565. } else {
  1566. // 20100607_laboru_처방내용 출력하지 않음.(추후 공통 코드로 빼야함)
  1567. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd", tmppc);
  1568. //model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd", "총 " + (sndprcpcnt-1) + " 개 약");
  1569. //model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd", "");
  1570. }
  1571. } else if (drugkindnm == "[내복약]"){
  1572. //alert("일반라벨+내복약");
  1573. NBflag = true;
  1574. var lbltims =0;
  1575. lbl_tims = mthd2.split(",");
  1576. if ( mthdcd == "ZZZ" ){
  1577. lbltims = tims;
  1578. } else if ( mthd3.indexOf("취침") > -1 ) {
  1579. lbltims = lbl_tims.length +1;
  1580. } else if(mthd2.indexOf("마다") > -1){
  1581. lbltims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  1582. } else if(mthd1.indexOf("의사지시") > -1){
  1583. lbltims = tims;
  1584. } else {
  1585. lbltims = lbl_tims.length;
  1586. }
  1587. tims = lbltims;
  1588. // 라벨주의사항2 출력
  1589. var tmplblcnts2 = "";
  1590. var tmppc = "";
  1591. var sndprcpcnt = 1;
  1592. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  1593. var drugkind2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/drugkindnm");
  1594. var dayno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  1595. var mthd4 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd1");
  1596. var mthd5 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd2");
  1597. var mthd6 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd3");
  1598. if((drugkind1 == drugkind2) && (dayno1 == dayno2) && (mthd1 == mthd4 && mthd2 == mthd5 && mthd3 == mthd6)
  1599. && !fChkSumcls(j)){
  1600. // 2010.02.17 pymi
  1601. var lblcnts2 = model.getValue("/root/main/lbllist/lbllist["+ j +"]/lblcnts2");
  1602. bordflag += j + "/"; // 포장라벨 처방코드 순서
  1603. if(lblcnts2.length > 0) {
  1604. //sSndMsg += astfPrintOut(30, 440 +(60 * ordCnt), 4, lblcnts2, "");
  1605. // 20100421_laboru_라벨주의사항2 내용 유무 flag
  1606. model.makeValue("/root/main/lbllist/lbllist["+iPoint +"]/lblcnts2flag", "Y");
  1607. tmplblcnts2 += lblcnts2 + "\n";
  1608. ordCnt++; // 포장라벨 갯수
  1609. }
  1610. // 20100421_laboru_rex 중복 출력 막기 위해
  1611. if(drugcnt != 0) {
  1612. model.removeNode("/root/main/lbllist/lbllist["+j+"]");
  1613. j--;
  1614. }
  1615. drugcnt++;
  1616. } else {
  1617. // 용법이 바뀌는 시점 2010.02.10 pymi
  1618. bordflag = "";
  1619. break;
  1620. }
  1621. if(ordCnt == 3){ //2010.02.17 pymi
  1622. j++;
  1623. if(j <= getNodesetCount("/root/main/lbllist/lbllist")) {
  1624. var drugkind3 = model.getValue("/root/main/lbllist/lbllist["+j+"]/drugkindnm");
  1625. var dayno3 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  1626. var mthd7 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd1");
  1627. var mthd8 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd2");
  1628. var mthd9 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd3");
  1629. if((drugkind1 == drugkind3) && (dayno1 == dayno3) && (mthd1 == mthd7 && mthd2 == mthd8 && mthd3 == mthd9)
  1630. && !fChkSumcls(j)){
  1631. // 페이지 넘겨서도 용법 바뀌지 않으면 계속 진행
  1632. } else {
  1633. // 페이지 넘길때 용법이 바뀌면 처방 출력
  1634. //종료(매수)
  1635. nextPage = true;
  1636. nCnt = ordCnt;
  1637. //fGnrlPrintnm(ordCnt, bordflag);
  1638. }
  1639. }
  1640. // (e)
  1641. break;
  1642. }
  1643. }
  1644. //용법1
  1645. var val = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd1") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd2")
  1646. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd3");
  1647. if(lbltims == 1) {
  1648. if(mthd2.indexOf("마다") == -1) {
  1649. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/unit", lbltims+ "회 "+(dayno * mthddayno)+"일분" );
  1650. val += "1포씩 ";
  1651. } else {
  1652. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/unit", tims+ "회 "+(dayno * mthddayno)+"일분" );
  1653. val += "1포씩 ";
  1654. }
  1655. } else {
  1656. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/unit", lbltims+ "회 "+(dayno * mthddayno)+"일분" );
  1657. val += "1포씩 ";
  1658. }
  1659. //용법2
  1660. val += model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  1661. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts" , val);
  1662. // 20100420_laboru_약품코드 출력 X
  1663. //model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd", "");
  1664. // 20100420_laboru_라벨주의사항2 출력
  1665. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/lblcnts2", tmplblcnts2);
  1666. }
  1667. }
  1668. /*
  1669. * 20100426_laboru_라벨주의사항 출력 후 처방코드를 출력
  1670. */
  1671. function fGnrlPrintnmNew() {
  1672. var cnt = 0;
  1673. var drugcnt = 0;
  1674. var ordCnt = 0; // 2010.02.10 pymi
  1675. //mPoint = iPoint;
  1676. var reprint="";
  1677. //for(mPoint = 1; mPoint <= getNodesetCount("/root/main/lbllist2/lbllist") ; mPoint++){
  1678. //라벨내용
  1679. var drugkindnm = model.getValue("/root/main/lbllist2/lbllist["+mPoint+"]/drugkindnm");
  1680. var qty = model.getValue("/root/main/lbllist2/lbllist["+mPoint+"]/prcpqty");
  1681. var dayqty = model.getValue("/root/main/lbllist2/lbllist["+mPoint+"]/dayprcpqty");
  1682. var tims = model.getValue("/root/main/lbllist2/lbllist["+mPoint+"]/prcptims");
  1683. var dayno = model.getValue("/root/main/lbllist2/lbllist["+mPoint+"]/prcpdayno");//처방일수
  1684. var mthddayno = model.getValue("/root/main/lbllist2/lbllist["+mPoint+"]/dayno"); //용법일수
  1685. //약코드 출력
  1686. var drugkind1 = model.getValue("/root/main/lbllist2/lbllist["+mPoint+"]/drugkindnm");
  1687. var dayno1 = model.getValue("/root/main/lbllist2/lbllist["+mPoint+"]/prcpdayno");
  1688. var mthd1 = model.getValue("/root/main/lbllist2/lbllist["+mPoint+"]/mthd1");
  1689. var mthd2 = model.getValue("/root/main/lbllist2/lbllist["+mPoint+"]/mthd2");
  1690. var mthd3 = model.getValue("/root/main/lbllist2/lbllist["+mPoint+"]/mthd3");
  1691. var mthdcd = model.getValue("/root/main/lbllist2/lbllist["+mPoint+"]/mthdcd");
  1692. if(drugkindnm == "[내복약]" ) {
  1693. var lbltims =0;
  1694. lbl_tims = mthd2.split(",");
  1695. if ( mthdcd == "ZZZ" ){
  1696. lbltims = tims;
  1697. } else if ( mthd3.indexOf("취침") > -1 ) {
  1698. lbltims = lbl_tims.length +1;
  1699. } else if(mthd2.indexOf("마다") > -1){
  1700. lbltims = model.getValue("/root/main/lbllist2/lbllist["+mPoint+"]/prcptims");
  1701. } else if(mthd1.indexOf("의사지시") > -1){
  1702. lbltims = tims;
  1703. } else {
  1704. lbltims = lbl_tims.length;
  1705. }
  1706. tims = lbltims;
  1707. var tmppc = "";
  1708. var sndprcpcnt = 1;
  1709. for(var j = mPoint; j <= getNodesetCount("/root/main/lbllist2/lbllist") ; j++){
  1710. var drugkind2 = model.getValue("/root/main/lbllist2/lbllist["+j+"]/drugkindnm");
  1711. var dayno2 = model.getValue("/root/main/lbllist2/lbllist["+j+"]/prcpdayno"); // 처방일수
  1712. var mthd4 = model.getValue("/root/main/lbllist2/lbllist["+j+"]/mthd1");
  1713. var mthd5 = model.getValue("/root/main/lbllist2/lbllist["+j+"]/mthd2");
  1714. var mthd6 = model.getValue("/root/main/lbllist2/lbllist["+j+"]/mthd3");
  1715. if((drugkind1 == drugkind2) && (dayno1 == dayno2) && (mthd1 == mthd4 && mthd2 == mthd5 && mthd3 == mthd6)
  1716. && !fChkSumcls2(j)){
  1717. //alert("완전 같은 처방이 복수개일때 같은 라벨지에 출력.");
  1718. //if(model.getValue("/root/main/lbllist/lbllist["+j+"]/fst_prnt") == "Y"){
  1719. var prcpqty = model.getValue("/root/main/lbllist2/lbllist["+j+"]/totdrugqty")/model.getValue("/root/main/lbllist2/lbllist["+j+"]/prcptims") ;
  1720. prcpqty = Math.ceil( prcpqty * tims*1000)/1000;
  1721. // 20101101_laboru_경북대병원_라벨 출력물 처방코드 삭제
  1722. tmppc = prcpqty
  1723. +" "+(model.getValue("/root/main/lbllist2/lbllist["+j+"]/prcpnm")) + " ";
  1724. /* tmppc = model.getValue("/root/main/lbllist2/lbllist["+j+"]/prcpcd")
  1725. +" "+prcpqty
  1726. +" "+(model.getValue("/root/main/lbllist2/lbllist["+j+"]/prcpnm")).substring(0,6) + " ";
  1727. */
  1728. //alert(tmppc);
  1729. model.makeValue("/root/main/lbllist2/lbllist["+mPoint+"]/sndprcp"+sndprcpcnt, tmppc);
  1730. sndprcpcnt++;
  1731. // 20100421_laboru_rex 중복 출력 막기 위해
  1732. if(cnt != 0) {
  1733. model.removeNode("/root/main/lbllist2/lbllist["+j+"]");
  1734. j--;
  1735. }
  1736. //}
  1737. cnt++;
  1738. } else {
  1739. break;
  1740. }
  1741. if(cnt == 12){
  1742. j++;
  1743. break;
  1744. }
  1745. }
  1746. // 20100420_laboru
  1747. //if( sndprcpcnt > 2 ) {
  1748. if( model.getValue("/root/main/lbllist2/lbllist["+mPoint+"]/sndprcp1") != "" ) {
  1749. model.makeValue("/root/main/lbllist2/lbllist["+mPoint+"]/samedrugflag", "Y");
  1750. } else {
  1751. model.makeValue("/root/main/lbllist2/lbllist["+mPoint+"]/prcpcd", tmppc);
  1752. }
  1753. } else {
  1754. model.removeNode("/root/main/lbllist2/lbllist["+mPoint+"]");
  1755. mPoint--;
  1756. }
  1757. }
  1758. /**
  1759. *
  1760. */
  1761. function fDateFormat(sDD, sYMD) {
  1762. if(sYMD == "MD"){
  1763. return sDD.substr(4,2)+"/"+sDD.substr(6,2);
  1764. } else {
  1765. return sDD.substr(0,4)+"/"+sDD.substr(4,2)+"/"+sDD.substr(6,2);
  1766. }
  1767. }
  1768. /**
  1769. *
  1770. */
  1771. function fPrntTime(sDD, sTM) {
  1772. if(PrnKind == "2" || PrnKind == "7" ) {
  1773. return sDD.substr(4,2)+"/"+sDD.substr(6,2)+" "+sTM.substr(0,2)+":"+sTM.substr(2,2);
  1774. } else {
  1775. return sDD.substr(4,2)+" / "+sDD.substr(6,2)+" "+sTM.substr(0,2)+":"+sTM.substr(2,2)+":"+sTM.substr(4,2);
  1776. }
  1777. }
  1778. /**
  1779. *
  1780. */
  1781. function fChkFloat(qty) {
  1782. var fQty = parseFloat(qty);
  1783. var fRst = "";
  1784. if(fQty%1 == 0){
  1785. fRst = parseInt(qty);
  1786. } else {
  1787. fRst = qty;
  1788. }
  1789. return fRst;
  1790. }
  1791. /**
  1792. *
  1793. */
  1794. function fChkSumcls(cnt) {
  1795. var chk = false;
  1796. var sSumcls = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/sumcls");
  1797. var sSnglyn = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/atcifsnglyn");
  1798. var atcyn = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/atcyn");
  1799. var sDrugindependpackflag = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/drugindependpackflag");
  1800. if(sSumcls == "DI" || sSumcls == "DS"|| sSumcls == "DX"|| sSumcls == "DT" || sSumcls == "DM" || sSumcls == "DP" || sSumcls == "DG" //20110511_laboru_pack 류도 수제처럼 단독으로
  1801. || sSumcls == "IH"|| sSumcls == "IO" || sSumcls == "IS"|| sSumcls == "IX"|| sSumcls == "X" || sSumcls == "I"){
  1802. chk = true;
  1803. }
  1804. if ( sSumcls == "D" && sSnglyn =="Y" ) {
  1805. chk = true;
  1806. }
  1807. if ( sDrugindependpackflag =="Y"){
  1808. chk = true;
  1809. }
  1810. //2013년 8월22일 김치국 ATC전송시 키지 않는 믹스 번호 70이하 데이타는 단독 라벨 출력 되게
  1811. if ( atcyn =="N" ){
  1812. chk = true;
  1813. }
  1814. //2010-06-29 [보관방법:냉장주사/고위험주사] 단독출력
  1815. var sDngryn = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/dngryn"); //고위험주사 여부
  1816. var sKeepmthdyn = model.getValue("/root/main/lbllist/lbllist["+cnt+"]/keepmthdyn"); //냉장주사 여부
  1817. if(sDngryn == "Y" || sKeepmthdyn=="Y" ) chk = true;
  1818. return chk;
  1819. }
  1820. function fChkSumcls2(cnt) {
  1821. var chk = false;
  1822. var sSumcls = model.getValue("/root/main/lbllist2/lbllist["+cnt+"]/sumcls");
  1823. var sSnglyn = model.getValue("/root/main/lbllist2/lbllist["+cnt+"]/atcifsnglyn");
  1824. var sDrugindependpackflag = model.getValue("/root/main/lbllist2/lbllist["+cnt+"]/drugindependpackflag");
  1825. if(sSumcls == "DI" || sSumcls == "DS"|| sSumcls == "DX"|| sSumcls == "DT" || sSumcls == "DM" || sSumcls == "DP"
  1826. || sSumcls == "IH"|| sSumcls == "IO" || sSumcls == "IS"|| sSumcls == "IX"|| sSumcls == "X" || sSumcls == "I"){
  1827. chk = true;
  1828. }
  1829. if ( sSumcls == "D" && sSnglyn =="Y" ) {
  1830. chk = true;
  1831. }
  1832. if ( sDrugindependpackflag =="Y"){
  1833. chk = true;
  1834. }
  1835. return chk;
  1836. }
  1837. /**
  1838. * 물약라벨출력
  1839. */
  1840. function fLiquidLBLPrint() {
  1841. var reprint ="";
  1842. for(iPoint = 1; iPoint <= getNodesetCount("/root/main/lbllist/lbllist") ; iPoint++){
  1843. if(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/pid") == "") {
  1844. return;
  1845. }
  1846. if ( model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/lblprnttims")>0 ){
  1847. reprint ="(재)";
  1848. }
  1849. //////////////////////////////////////////////////
  1850. // 라벨 상단내용 //
  1851. /////////////////////////////////////////////////
  1852. var sDD = getCurrentDate();
  1853. var sTM = getCurrentTime();
  1854. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/fprnttime", "출 력 : " + fPrntTime(sDD, sTM));
  1855. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd", "처 방 : " + fDateFormat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd"), "MD"));
  1856. //병실
  1857. //환자이름
  1858. //환자번호
  1859. var tpid = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/pid")
  1860. var drugno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugno")+reprint ;
  1861. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/pid" , tpid);
  1862. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/drugno" , drugno);
  1863. // 20100618_laboru_작은 라벨 외용, 수제 처방구분
  1864. var drugflag = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugflag");
  1865. var tdfname = "";
  1866. /*if(drugflag == "L") {
  1867. tdfname = "퇴원";
  1868. } else {
  1869. tdfname = "입원";
  1870. }*///20110121 이선경 수정 : 병동작은 라벨과 동일하게 찍도록 함(칠곡병원 김은영 약사님 요청)
  1871. //model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/drugflag", tdfname);
  1872. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/drugflag", drugflag);
  1873. //////////////////////////////////////////////////
  1874. // 라벨 하단내용 //
  1875. /////////////////////////////////////////////////
  1876. //라벨내용
  1877. var dayqty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayprcpqty");
  1878. var qtyunit = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqtyunit");
  1879. var tims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  1880. var dayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");
  1881. var qty = Math.ceil(dayqty / tims * 1000)/1000 ;
  1882. var totqty = parseInt(dayqty)*parseInt(dayno);
  1883. var mthd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1");
  1884. var mthd2 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2");
  1885. var mthd3 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  1886. //용법
  1887. if ( mthd1 == "" && mthd2 == "" && mthd3 == "" ){
  1888. //1일 X회 Xml씩 X일분
  1889. var tunit = "1일 "+tims+"회 "+qty+qtyunit+"씩 "+dayno+"일분" + "\n" + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/abbrnm");
  1890. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/unit", tunit);
  1891. } else {
  1892. //1일 X회 Xml씩 X일분
  1893. var tunit = "1일 "+tims+"회 "+qty+qtyunit+"씩 "+dayno+"일분" + "\n" + mthd1 + " " + mthd2 + " " + mthd3;
  1894. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/unit", tunit);
  1895. }
  1896. //용법
  1897. //약품코드 + 총용량
  1898. //약품코드 + 총용량 + 약품명
  1899. var prcpnm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm");
  1900. // 20101101_laboru_경북대병원_라벨 출력물 처방코드 삭제
  1901. var val = parseFloat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/totdrugqty")) + " " +
  1902. prcpnm;
  1903. /* var val = "[ "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd")+" ] "+
  1904. parseFloat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/totdrugqty")) + " " +
  1905. prcpnm;*/
  1906. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd" , val);
  1907. //보관방법
  1908. var lblcnts1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/lblcnts1");
  1909. //lblcnts1 = lblcnts1.setReplaceWord("~", "-"); //20090728
  1910. if ( lblcnts1 == "" ) {
  1911. if(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/keepmthd") != ""){
  1912. //sSndMsg += astfPrintOut(40, 300, 27, "< "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/keepmthd")+" >","");
  1913. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/keepmthd", "< "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/keepmthd")+" >" );
  1914. }
  1915. } else {
  1916. }
  1917. }
  1918. if(getNodesetCount("/root/main/lbllist/lbllist") > 0) {
  1919. // 20100427_laboru_물약라벨 rex 출력
  1920. makeReportPreview(0,0,10, 10, "");
  1921. fPrintRexbar("RFADT62302");
  1922. }
  1923. model.refresh();
  1924. }
  1925. /*
  1926. * 산제처방을 용법코드별로 라벨출력
  1927. */
  1928. function fPowderlLBLPrint() {
  1929. // 라벨내용 copy
  1930. model.makeNode("/root/main/lbllist2");
  1931. model.copyNode("/root/main/lbllist2", "/root/main/lbllist");
  1932. var sDD = getCurrentDate();
  1933. var sTM = getCurrentTime();
  1934. var reprint ="";
  1935. totcnt = 0;
  1936. pg = 0;
  1937. totpg = 0;
  1938. for ( var i = 1; i <= getNodesetCount("/root/main/lbllist/lbllist") ; i++){
  1939. if(model.getValue("/root/main/lbllist/lbllist["+i+"]/pid") == "") {
  1940. return;
  1941. }
  1942. if ( model.getValue("/root/main/lbllist/lbllist["+i+"]/lblgrup") != "DI" && model.getValue("/root/main/lbllist/lbllist["+i+"]/lblgrup") != "DS" ){
  1943. totcnt++;
  1944. }
  1945. }
  1946. // 2010.02.12 pymi
  1947. if( (totcnt%6) != 0) totcnt ++; // 라벨찍기 전에 한줄 띄우기
  1948. for ( var i = 1; i <= getNodesetCount("/root/main/lbllist/lbllist") ; i++){
  1949. if(model.getValue("/root/main/lbllist/lbllist["+ i +"]/lblcnts2").length > 0) { totcnt++; vlblcnt = true;}
  1950. }
  1951. for(iPoint = 1; iPoint <= getNodesetCount("/root/main/lbllist/lbllist") ; iPoint++){
  1952. if ( model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/lblprnttims")>0 ){
  1953. reprint ="(재)";
  1954. }
  1955. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/fprnttime", "출 력 : " + fPrntTime(sDD, sTM));
  1956. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd", "처 방 : " + fDateFormat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd"), "MD"));
  1957. var patnm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/patnm")
  1958. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/patnm", patnm.substr(0,6));
  1959. //환자번호
  1960. var tpid = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/pid")+" ("+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugno")+reprint+")" ;
  1961. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/pid" , tpid);
  1962. var sDrugKindcd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  1963. var sMixno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpmixno");
  1964. if(sDrugKindcd == "[내복약]"){
  1965. fInPwdDrugLBL();
  1966. }
  1967. }
  1968. if(vlblcnt && (!mlblcnt1) && (ordflag.length > 0)) {
  1969. fPrntLblCnt1New();
  1970. ordflag = "";
  1971. vcnt = 0;
  1972. }
  1973. mlblcnt1= false;
  1974. if(getNodesetCount("/root/main/lbllist/lbllist") > 0) {
  1975. // 20100429_laboru_병동 작은라벨 산제용법별
  1976. makeReportPreview(0,0,10, 10, "");
  1977. fPrintRexbar("RFADT62302");
  1978. }
  1979. model.refresh();
  1980. }
  1981. /**
  1982. * 산제 용법코드별 라벨상세(용법코드별 분류)
  1983. */
  1984. function fInPwdDrugLBL() {
  1985. var sMthdcd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcd");
  1986. var qty = "";
  1987. var dayqty = "";
  1988. var qtyunit = "";
  1989. var tims = "";
  1990. var dayno = "";
  1991. var cnt = 0;
  1992. var tprcpnm = "";
  1993. var tprcpcd = ""
  1994. var tlblcnts2 = "";
  1995. var chgMth = false; // 2010.02.17 pymi
  1996. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  1997. sMthdcd2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthdcd");
  1998. qty = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqty");
  1999. dayqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/dayprcpqty");
  2000. qtyunit = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqtyunit");
  2001. tims = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
  2002. dayno = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  2003. var prcpnm= model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  2004. var prcpcd= model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd");
  2005. var lblcnts2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/lblcnts2");
  2006. model.makeValue("/root/main/lbllist/lbllist["+j+"]/inusedrugflag", "Y");
  2007. //model.setValue("/root/main/lbllist/lbllist["+j+"]/prcpnm", prcpnm.substr(0,6));
  2008. //prcpnm = prcpnm.substr(0,7);
  2009. if((sMthdcd1 == sMthdcd2)){
  2010. if(model.getValue("/root/main/lbllist/lbllist["+ j +"]/lblcnts2").length > 0 ) {ordflag += j + "/";}
  2011. if(cnt == 0) {
  2012. tprcpnm = prcpnm;
  2013. tprcpcd = prcpcd;
  2014. tlblcnts2 = lblcnts2;
  2015. } else {
  2016. tprcpnm += "\n" + prcpnm;
  2017. tprcpcd += "\n" + prcpcd;
  2018. tlblcnts2 += "\n" + lblcnts2;
  2019. }
  2020. if(cnt == 0) {
  2021. unit = dayqty + " "+tims+ " "+dayno;
  2022. } else {
  2023. unit += "\n" + dayqty + " "+tims+ " "+dayno;
  2024. }
  2025. // 20100421_laboru_rex 중복 출력 막기 위해
  2026. if(cnt != 0) {
  2027. model.removeNode("/root/main/lbllist/lbllist["+j+"]");
  2028. model.removeNode("/root/main/lbllist2/lbllist["+j+"]");
  2029. j--;
  2030. }
  2031. cnt++;
  2032. } else {
  2033. // 용법바뀔때 2010.02.17 pymi
  2034. chgMth = true;
  2035. // (e)
  2036. break;
  2037. }
  2038. if(cnt == fMthdnmLength(iPoint)){
  2039. j++;
  2040. // 다음 용법이 다를때 2010.02.17 pymi
  2041. sMthdcd3 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthdcd");
  2042. if((sMthdcd1 != sMthdcd3) && (ordflag.length > 0) ){
  2043. prntflag = true;
  2044. }
  2045. break;
  2046. }
  2047. }
  2048. // 20101101_laboru_경북대병원_라벨 출력물 처방코드 삭제
  2049. //model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd", tprcpcd);
  2050. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm", tprcpnm);
  2051. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/unit", unit);
  2052. if(ordflag.length > 0) {
  2053. model.makeValue("/root/main/lbllist2/lbllist["+iPoint+"]/lblcnts2", tlblcnts2);
  2054. }
  2055. //iPoint = j-1;
  2056. //보관방법 고가 출력
  2057. var sKeepmthd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/keepmthd");
  2058. var sExpnyn = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/expnyn");
  2059. var sExpnnm = "";
  2060. if(sExpnyn == "Y") sExpnnm = "고가";
  2061. if(sKeepmthd != ""){
  2062. //sSndMsg += astfPrintOut(20, 180, 3, "<"+sKeepmthd+">","");
  2063. model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/keepmthd", "<"+sKeepmthd+">" );
  2064. }
  2065. if(sExpnnm != ""){
  2066. //sSndMsg += astfPrintOut(135, 180, 3, "<"+sExpnnm+">","");
  2067. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/expnnm", "<"+sExpnnm+">" );
  2068. }
  2069. //용법의 길이에 따라 찍는 위치를 달리한다(용법찍을 공간을 확보)
  2070. var iYPoint = 0;
  2071. if( fMthdnmLength(iPoint) == 4){
  2072. iYPoint = 280;
  2073. } else {
  2074. iYPoint = 245;
  2075. }
  2076. //sSndMsg += astfPrintOut(20, iYPoint, 3, "1일 "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims")+"회 "
  2077. // +model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno")+"일분","");
  2078. var tmth = "1일 "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims")+"회 " +model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno")+"일분";
  2079. //sSndMsg += fMthdnm(iPoint);
  2080. var sMthd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1");
  2081. var sMthd2 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2");
  2082. var sMthd3 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  2083. var sMthd4 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  2084. var sTemp = "";
  2085. if(sMthd1 != "") sTemp += sMthd1 + " ";
  2086. if(sMthd2 != "") sTemp += sMthd2 + " ";
  2087. if(sMthd3 != "") sTemp += sMthd3 + " ";
  2088. if(sMthd4 != "") sTemp += sMthd4;
  2089. tmth += "\n" + sTemp;
  2090. model.makeValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts" , tmth);
  2091. // 용법바뀔때 2010.02.17 pymi
  2092. if(ordflag.length > 0) {
  2093. cnt++; //라벨내용찍기전 한줄 띄우기
  2094. if(cnt >= 4) sSndMsg += astfEndFormat(0);
  2095. } else {
  2096. sSndMsg += astfEndFormat(0);
  2097. }
  2098. vcnt = cnt;
  2099. }
  2100. /*
  2101. * 20100427_laboru_작은라벨 내복약 처방 출력.
  2102. */
  2103. function fPrntLblCnt1New() {
  2104. var tPoint = 1;
  2105. var reprint = "";
  2106. for(var t = 1 ; t <= getNodesetCount("/root/main/lbllist2/lbllist") ; t++) {
  2107. var sDD = getCurrentDate();
  2108. var sTM = getCurrentTime();
  2109. if(model.getValue("/root/main/lbllist2/lbllist["+t+"]/pid") =="" ) {
  2110. return;
  2111. }
  2112. if ( model.getValue("/root/main/lbllist2/lbllist["+t+"]/lblprnttims")>0 ){
  2113. reprint ="(재)";
  2114. }
  2115. var mthdcd1 = model.getValue("/root/main/lbllist2/lbllist["+t+"]/mthdcd");
  2116. model.makeValue("/root/main/lbllist2/lbllist["+t+"]/fprnttime", "출 력 : " + fPrntTime(sDD, sTM));
  2117. model.setValue("/root/main/lbllist2/lbllist["+t+"]/prcpdd", "처 방 : " + fDateFormat(model.getValue("/root/main/lbllist2/lbllist["+t+"]/prcpdd"), "MD"));
  2118. var tpid = model.getValue("/root/main/lbllist2/lbllist["+t+"]/pid")+" ("+model.getValue("/root/main/lbllist2/lbllist["+t+"]/drugno")+reprint+")" ;
  2119. model.setValue("/root/main/lbllist2/lbllist["+t+"]/pid" , tpid);
  2120. for(var y = tPoint ; y <= getNodesetCount("/root/main/lbllist/lbllist") ; y++) {
  2121. var mthdcd2 = model.getValue("/root/main/lbllist/lbllist["+y+"]/mthdcd");
  2122. if(!fChkIndependDrug(y)) {
  2123. if((mthdcd1 == mthdcd2)){
  2124. if(y == getNodesetCount("/root/main/lbllist/lbllist")) {
  2125. model.makeNode("root/main/lbllist/lbllist[" + (y+1) + "]");
  2126. model.copyNode("root/main/lbllist/lbllist[" + (y+1) + "]", "root/main/lbllist2/lbllist[" + t + "]");
  2127. model.makeValue("/root/main/lbllist/lbllist["+ (y+1) +"]/samedrugflag", "Y");
  2128. var tmth = "";
  2129. if( model.getValue("/root/main/lbllist/lbllist["+(y+1)+"]/lblgrup") == "DS"){
  2130. var tmth = "1일 "+model.getValue("/root/main/lbllist/lbllist["+(y+1)+"]/prcptims")+"회 "+qty+qtyunit+" "+model.getValue("/root/main/lbllist/lbllist["+(y+1)+"]/prcpdayno")+"일분";
  2131. } else {
  2132. var tmth = "1일 "+model.getValue("/root/main/lbllist/lbllist["+(y+1)+"]/prcptims")+"회 " +model.getValue("/root/main/lbllist/lbllist["+(y+1)+"]/prcpdayno")+"일분";
  2133. }
  2134. // 용법 생성
  2135. var sMthd1 = model.getValue("/root/main/lbllist/lbllist["+(y+1)+"]/mthdcnts1");
  2136. var sMthd2 = model.getValue("/root/main/lbllist/lbllist["+(y+1)+"]/mthdcnts2");
  2137. var sMthd3 = model.getValue("/root/main/lbllist/lbllist["+(y+1)+"]/mthdcnts3");
  2138. var sMthd4 = model.getValue("/root/main/lbllist/lbllist["+(y+1)+"]/mthdcnts4");
  2139. var sTemp = "";
  2140. if(sMthd1 != "") sTemp += sMthd1 + " ";
  2141. if(sMthd2 != "") sTemp += sMthd2 + " ";
  2142. if(sMthd3 != "") sTemp += sMthd3 + " ";
  2143. if(sMthd4 != "") sTemp += sMthd4;
  2144. tmth += "\n" + sTemp;
  2145. model.makeValue("/root/main/lbllist/lbllist["+(y+1)+"]/mthdcnts" , tmth);
  2146. break;
  2147. }
  2148. } else {
  2149. tPoint = y+1;
  2150. // 기존 라벨 정보 shift
  2151. var tTotalCnt = getNodesetCount("/root/main/lbllist/lbllist");
  2152. model.makeValue("/root/main/lbllist/lbllist["+(parseInt(tTotalCnt)+1)+"]", "Y");
  2153. for(var x = tTotalCnt ; x >= y ; x--) {
  2154. model.copyNode("/root/main/lbllist/lbllist[" + (parseInt(x) + 1) + "]", "/root/main/lbllist/lbllist[" + x + "]" );
  2155. }
  2156. model.copyNode("root/main/lbllist/lbllist[" + y + "]", "root/main/lbllist2/lbllist[" + t + "]");
  2157. model.makeValue("/root/main/lbllist/lbllist["+ y +"]/samedrugflag", "Y");
  2158. var tmth = "";
  2159. if( model.getValue("/root/main/lbllist/lbllist["+y+"]/lblgrup") == "DS"){
  2160. var tmth = "1일 "+model.getValue("/root/main/lbllist/lbllist["+y+"]/prcptims")+"회 "+qty+qtyunit+" "+model.getValue("/root/main/lbllist/lbllist["+y+"]/prcpdayno")+"일분";
  2161. } else {
  2162. var tmth = "1일 "+model.getValue("/root/main/lbllist/lbllist["+y+"]/prcptims")+"회 " +model.getValue("/root/main/lbllist/lbllist["+y+"]/prcpdayno")+"일분";
  2163. }
  2164. //sSndMsg += fMthdnm(iPoint); // 용법 생성
  2165. var sMthd1 = model.getValue("/root/main/lbllist/lbllist["+y+"]/mthdcnts1");
  2166. var sMthd2 = model.getValue("/root/main/lbllist/lbllist["+y+"]/mthdcnts2");
  2167. var sMthd3 = model.getValue("/root/main/lbllist/lbllist["+y+"]/mthdcnts3");
  2168. var sMthd4 = model.getValue("/root/main/lbllist/lbllist["+y+"]/mthdcnts4");
  2169. var sTemp = "";
  2170. if(sMthd1 != "") sTemp += sMthd1 + " ";
  2171. if(sMthd2 != "") sTemp += sMthd2 + " ";
  2172. if(sMthd3 != "") sTemp += sMthd3 + " ";
  2173. if(sMthd4 != "") sTemp += sMthd4;
  2174. tmth += "\n" + sTemp;
  2175. model.makeValue("/root/main/lbllist/lbllist["+y+"]/mthdcnts" , tmth);
  2176. break;
  2177. }
  2178. }
  2179. }
  2180. }
  2181. }
  2182. function fChkIpwdDrug() {
  2183. }
  2184. /**
  2185. * 20101224 이선경 추가
  2186. * 외래 큰라벨 출력 양식
  2187. */
  2188. function fBigLBLPrint_Out() {
  2189. /*
  2190. 라벨 Sorting 로직
  2191. //mgt에서 vo로 리턴
  2192. 대분류
  2193. - 내복약, 외용약, 주사, 항암제, TPN, 마약,
  2194. 중분류
  2195. - 방법코드
  2196. 소분류
  2197. - 내복약,외용약(방법코드), 주사,마약,항암제(mix)
  2198. web js 출력로직
  2199. 1 약종류(내복약/주사약/외용약)
  2200. 1.1 방법코드
  2201. 1.2 처방수량
  2202. */
  2203. var prcpnum = "";
  2204. var prcpCnt = 14; // 20101030_laboru_경북대병원_라벨 한 페이지에 최고 8개에서 14개 출력되게 변경
  2205. for(iPoint = 1; iPoint <= getNodesetCount("/root/main/lbllist/lbllist") ; iPoint++){
  2206. model.makeNode("/root/main/prnt/lbllist[" +iPageCntO+ "]");
  2207. model.copyNode("/root/main/prnt/lbllist[" +iPageCntO+ "]", "/root/main/lbllist/lbllist["+iPoint+"]");
  2208. //바코드(변환)
  2209. // 20101030_laboru_경북대병원_atc drugkind 구분자에 의한 바코드 출력 형식
  2210. // t : "ATC" , p : 산제 바코드, e : blank
  2211. if(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/atc_drugkind") == "t" ) {
  2212. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/barcode2", "ATC");
  2213. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/barcode", "");
  2214. } else if(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/atc_drugkind") == "p") {
  2215. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/barcode", model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/barcode"));
  2216. } else {
  2217. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/barcode", "");
  2218. }
  2219. var sumcls = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sumcls");
  2220. var mthdcd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcd");
  2221. if (mthdcd == "ZZZ" || mthdcd == "A10PQ") { //기타용법이거나 '필요시 복용하십시오' 용법인 경우도 단독라벨출력
  2222. sumcls = mthdcd;
  2223. }
  2224. //복용기간 계산시 수납일자를 기준으로 하고 출력(퇴원은 적용일자로)
  2225. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/rcptdd" , model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd"));
  2226. //20101229 이선경 수정 : atc구분이 산제아닐때만 단독라벨 적용
  2227. var atc_drugkind = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/atc_drugkind");
  2228. if(atc_drugkind != "p" && fChkSumcls(iPoint)){
  2229. //단독라벨출력
  2230. fIndependPrint_Out();
  2231. } else {
  2232. //일반라벨출력
  2233. fGnrlPrint_Out();
  2234. }
  2235. }
  2236. if(getNodesetCount("/root/main/prnt/lbllist") > 0) {
  2237. makeReportPreview(0,0,10, 10, "");
  2238. //model.makeNode("/root/main/barcdprntsetup/prntsetupinfo");
  2239. //model.copyNode("/root/main/barcdprntsetup/prntsetupinfo","/root/init/barcdprntsetup/prntsetupinfo");
  2240. fPrintRexbar("RFADT61300");
  2241. //alert("enD");
  2242. }
  2243. }
  2244. /**
  2245. * 20101224 이선경 추가
  2246. * 외래 큰라벨 출력 양식(단독)
  2247. */
  2248. function fIndependPrint_Out() {
  2249. //라벨내용
  2250. var drugkindnm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  2251. var qty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqty");
  2252. var dayqty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayprcpqty");
  2253. var qtyunit = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqtyunit");
  2254. var tims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  2255. var dayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno"); //처방일수
  2256. var mthddayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayno"); //용법일수
  2257. var packunit = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/packunit"); //약품마스터의 수량단위
  2258. if (drugkindnm == "[주사약]"){
  2259. //용법2
  2260. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/mthdcnts", model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"));
  2261. } else if (drugkindnm == "[외용약]"){
  2262. 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");
  2263. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/mthdcnts" , val);
  2264. } else if (drugkindnm == "[내복약]"){
  2265. var sumcls = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sumcls");
  2266. if( sumcls == "DM" || sumcls == "DS" || sumcls == "DT" || sumcls == "DX"){ //20091110 이선경 수정 : 라벨그룹이 마약(경구), 수제, ptp, 기타약일경우 약품마스터의 수량단위를 출력
  2267. var tmpqty = Math.round(qty * 10) / 10;
  2268. if(packunit == "T" || packunit == "C") {
  2269. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+tims+"회 "+fChkFloat(qty)+"정씩 "+(dayno*mthddayno)+"일분");
  2270. } else {
  2271. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+tims+"회 "+fChkFloat(tmpqty)+ packunit +"씩 "+(dayno*mthddayno)+"일분");
  2272. }
  2273. } else {
  2274. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+tims+"회 "+fChkFloat(qty)+"포[정]씩 "+(dayno*mthddayno)+"일분");
  2275. }
  2276. var mth = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2") + " "
  2277. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  2278. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/mthdcnts", mth);
  2279. }
  2280. // 2010.03.18 pymi
  2281. if(!fChkSumcls(iPoint) && model.getValue("/root/send/prcpinfo/lbl5") == "Y") {
  2282. var val = "";
  2283. } else {
  2284. // 20101027_laboru_경북대병원_라벨 출력물 처방코드 삭제
  2285. var val = parseFloat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/totdrugqty"))
  2286. +" "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm");
  2287. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/prcpcd", val);
  2288. }
  2289. // (e)
  2290. iPageCntO++;
  2291. }
  2292. /**
  2293. * 20101224 이선경 추가
  2294. * 외래 큰라벨 출력 양식(일반)
  2295. */
  2296. function fGnrlPrint_Out() {
  2297. var cnt = 0;
  2298. var ordCnt = 0;
  2299. var tmppc = "";
  2300. var sndprcpcnt = 1;
  2301. //라벨내용
  2302. var drugkindnm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  2303. var qty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqty");
  2304. var dayqty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayprcpqty");
  2305. var tims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  2306. var dayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");//처방일수
  2307. var mthddayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayno"); //용법일수
  2308. //약코드 출력
  2309. var drugkind1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  2310. var dayno1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");
  2311. var mthd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd1");
  2312. var mthd2 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd2");
  2313. var mthd3 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd3");
  2314. var mthdcd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcd");
  2315. if( drugkindnm != "[내복약]") {
  2316. if (drugkindnm == "[주사약]"){
  2317. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/mthdcnts", model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"));
  2318. } else if (drugkindnm == "[외용약]"){
  2319. var val = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2")
  2320. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  2321. val += "\n" + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  2322. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/mthdcnts" , val);
  2323. }
  2324. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  2325. var drugkind2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/drugkindnm");
  2326. var dayno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  2327. var mthd4 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd1");
  2328. var mthd5 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd2");
  2329. var mthd6 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd3");
  2330. //20101229 이선경 수정 : atc구분이 산제아닐때만 단독라벨 적용
  2331. var atc_drugkind = model.getValue("/root/main/lbllist/lbllist["+j+"]/atc_drugkind");
  2332. if((drugkind1 == drugkind2) && (dayno1 == dayno2) && (mthd1 == mthd4 && mthd2 == mthd5 && mthd3 == mthd6)
  2333. && !(fChkSumcls(j) && atc_drugkind != "p") ){
  2334. var prcpqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty")/model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
  2335. prcpqty = Math.ceil( prcpqty * tims*1000)/1000 ;
  2336. // 2010.03.18 pymi
  2337. if(!fChkSumcls(j) && model.getValue("/root/send/prcpinfo/lbl5") == "Y") {
  2338. var val = "";
  2339. } else {
  2340. // 20101027_laboru_경북대병원_라벨 출력물 처방코드 삭제
  2341. var val = prcpqty
  2342. +" "+model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  2343. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/sndprcp"+sndprcpcnt, tmppc);
  2344. sndprcpcnt++;
  2345. }
  2346. cnt++;
  2347. iPoint = j ;
  2348. } else {
  2349. iPageCntO++;
  2350. iPoint = j - 1;
  2351. break;
  2352. }
  2353. if(cnt == 12){ // 20101030_laboru_경북대병원_라벨 한 페이지에 최고 8개에서 14개 출력되게 변경
  2354. iPageCntO++;
  2355. break;
  2356. }
  2357. }
  2358. sndprcpcnt = 1;
  2359. } else if (drugkindnm == "[내복약]"){
  2360. var lbltims =0;
  2361. lbl_tims = mthd2.split(",");
  2362. if ( mthdcd == "ZZZ" ){
  2363. lbltims = tims;
  2364. } else if ( mthd3.indexOf("취침") > -1 ) {
  2365. lbltims = lbl_tims.length +1;
  2366. } else if(mthd2.indexOf("마다") > -1){
  2367. lbltims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  2368. } else {
  2369. lbltims = lbl_tims.length;
  2370. }
  2371. tims = lbltims;
  2372. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/samedrugflag", "Y");
  2373. if(lbltims == 1) {
  2374. if(mthd2.indexOf("마다") == -1) {
  2375. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+lbltims+ "회 1포씩 "+dayno+"일분");
  2376. } else {
  2377. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+tims+ "회 1포씩 "+dayno+"일분");
  2378. }
  2379. } else {
  2380. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+lbltims+ "회 1포씩 "+dayno+"일분");
  2381. }
  2382. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/mthdcnts", model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd1") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd2")
  2383. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd3") + "\n" + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"));
  2384. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  2385. var drugkind2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/drugkindnm");
  2386. var dayno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  2387. var mthd4 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd1");
  2388. var mthd5 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd2");
  2389. var mthd6 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd3");
  2390. //20101229 이선경 수정 : atc구분이 산제아닐때만 단독라벨 적용
  2391. var atc_drugkind = model.getValue("/root/main/lbllist/lbllist["+j+"]/atc_drugkind");
  2392. if((drugkind1 == drugkind2) && (dayno1 == dayno2) && (mthd1 == mthd4 && mthd2 == mthd5 && mthd3 == mthd6)
  2393. && !(fChkSumcls(j) && atc_drugkind != "p")){
  2394. var lblcnts2 = model.getValue("/root/main/lbllist/lbllist["+ j +"]/lblcnts2");
  2395. var prcpqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty")/model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
  2396. prcpqty = Math.ceil( prcpqty * tims*1000)/1000 ;
  2397. //alert(model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd")+ " " + model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty")+ " " + model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims" + " " + prcpqty));
  2398. if(lblcnts2.length > 0) {
  2399. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/lblcnts2", model.getValue("/root/main/prnt/lbllist["+iPageCntO+"]/lblcnts2") + "\n" + lblcnts2);
  2400. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/lblcnts2flag", "Y");
  2401. }
  2402. if(sndprcpcnt > 12) {
  2403. var prePage = iPageCntO;
  2404. iPageCntO++;
  2405. sndprcpcnt = 1;
  2406. model.makeNode("/root/main/prnt/lbllist[" +iPageCntO+ "]");
  2407. model.copyNode("/root/main/prnt/lbllist[" +iPageCntO+ "]", "/root/main/prnt/lbllist["+prePage+"]");
  2408. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/lblcnts2flag", "N");
  2409. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp1", "");
  2410. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp2", "");
  2411. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp3", "");
  2412. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp4", "");
  2413. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp5", "");
  2414. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp6", "");
  2415. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp7", "");
  2416. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp8", "");
  2417. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp9", "");
  2418. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp10", "");
  2419. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp11", "");
  2420. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp12", "");
  2421. }
  2422. var val = prcpqty
  2423. +" "+model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  2424. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/sndprcp"+sndprcpcnt, val);
  2425. sndprcpcnt++;
  2426. iPoint = j;
  2427. } else {
  2428. iPageCntO++;
  2429. iPoint = j - 1;
  2430. break;
  2431. }
  2432. }
  2433. }
  2434. }
  2435. /**
  2436. * 20101224 이선경 추가
  2437. * 경북대병원 외래 큰라벨 출력 양식
  2438. */
  2439. function fBigLBLPrint_knu(type) {
  2440. /*
  2441. 라벨 Sorting 로직
  2442. < 정제 >
  2443. 1. 단독조제는 따로 한장으로
  2444. 2. 용법코드 5자리인 것중 5번째 자리 값(식후 10분, 식전 10분 등..)이 같은 것끼리 한장으로
  2445. 3. 그외 나머지는 용법코드 같은 같은 것끼리 한장으로
  2446. < 산제 >
  2447. 1.용법코드 전체가 같은 것끼리 한장으로
  2448. */
  2449. var prcpnum = "";
  2450. var prcpCnt = 14; // 20101030_laboru_경북대병원_라벨 한 페이지에 최고 8개에서 14개 출력되게 변경
  2451. var sDD = getCurrentDate();
  2452. var sTM = getCurrentTime();
  2453. for(iPoint = 1; iPoint <= getNodesetCount("/root/main/lbllist/lbllist") ; iPoint++){
  2454. //alert(model.getValue("/root/main/lbllist/lbllist["+ iPoint+"]/lblprntyn"));
  2455. // 20110519_laboru_라벨출력여부에 따라
  2456. var lblprntyn = model.getValue("/root/main/lbllist/lbllist["+ iPoint+"]/lblprntyn");
  2457. if(lblprntyn == "N") {
  2458. model.removeNodeset("/root/main/lbllist/lbllist["+ iPoint +"]");
  2459. } else {
  2460. model.makeNode("/root/main/prnt/lbllist[" +iPageCntO+ "]");
  2461. model.copyNode("/root/main/prnt/lbllist[" +iPageCntO+ "]", "/root/main/lbllist/lbllist["+iPoint+"]");
  2462. if ( model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/lblprnttims")>0 ){
  2463. model.setValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/drugno", model.getValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/drugno") + "(재)");
  2464. }
  2465. //바코드(변환)
  2466. // 20101030_laboru_경북대병원_atc drugkind 구분자에 의한 바코드 출력 형식
  2467. // t : "ATC" , p : 산제 바코드, e : blank
  2468. if(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/atc_drugkind") == "t" ) {
  2469. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/barcode2", "ATC");
  2470. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/barcode", "");
  2471. } else if(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/atc_drugkind") == "p") {
  2472. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/barcode", model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/barcode"));
  2473. } else {
  2474. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/barcode", "");
  2475. }
  2476. // 20110415_laboru_경북대병원
  2477. if ( model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/patnm").length > 3 ){
  2478. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/patnmlength", "Y");
  2479. }
  2480. var sumcls = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sumcls");
  2481. var mthdcd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcd");
  2482. if (mthdcd == "ZZZ" || mthdcd == "A10PQ") { //기타용법이거나 '필요시 복용하십시오' 용법인 경우도 단독라벨출력
  2483. sumcls = mthdcd;
  2484. }
  2485. //복용기간 계산시 수납일자를 기준으로 하고 출력
  2486. rcptdd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/rcptdd");
  2487. if(type == "S") {
  2488. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/fprnttime", "출 력 : " + fPrntTime(sDD, sTM));
  2489. model.setValue("/root/main/prnt/lbllist["+iPageCntO+"]/prcpdd", "처 방 : " + fDateFormat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd"), "MD"));
  2490. }
  2491. //보관방법 고가 출력
  2492. var sKeepmthd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/keepmthd");
  2493. var sExpnyn = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/expnyn");
  2494. var sExpnnm = "";
  2495. if(sExpnyn == "Y") sExpnnm = "고가";
  2496. if(sKeepmthd != ""){
  2497. //sSndMsg += astfPrintOut(20, 180, 3, "<"+sKeepmthd+">","");
  2498. model.setValue("/root/main/prnt/lbllist["+iPageCntO+"]/keepmthd", "<"+sKeepmthd+">" );
  2499. }
  2500. if(sExpnnm != ""){
  2501. //sSndMsg += astfPrintOut(135, 180, 3, "<"+sExpnnm+">","");
  2502. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/expnnm", "<"+sExpnnm+">" );
  2503. }
  2504. //병동에서 출력하는 큰라벨일 경우 수납일자대신 처방일자를 출력
  2505. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/rcptdd", model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdd"));
  2506. //20101229 이선경 수정 : atc구분이 산제아닐때만 단독라벨 적용
  2507. var atc_drugkind = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/atc_drugkind");
  2508. var sDrugKindcd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  2509. var sMixno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpmixno");
  2510. var sMthdcd = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcd"); // 20120216
  2511. //2013.08.22 김치국
  2512. var sprcpnm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm"); // 20120216
  2513. if(type == "S" && sDrugKindcd == "[주사약]"){
  2514. if(sMixno != "-"){
  2515. fMixLBL_knu();
  2516. } else if(fChkIndependInj(iPoint)){
  2517. //alert(iPoint + "단독주사");
  2518. fIndependPrint_knu(type);
  2519. } else {
  2520. //alert(iPoint + "복합주사");
  2521. fInjDrugLBL_knu();
  2522. }
  2523. } else if(atc_drugkind != "p" && fChkSumcls(iPoint) && sDrugKindcd != "[주사약]" && sMthdcd != 'O10DE'){ // && sMthdcd != 'O10DE'
  2524. // alert(" 단독라벨출력 fIndependPrint_knu(type) Call" + sprcpnm )
  2525. //단독라벨출력
  2526. fIndependPrint_knu(type);
  2527. } else {
  2528. // alert(" 일반라벨출력 fGnrlPrint_knu(type) Call" + sprcpnm )
  2529. //일반라벨출력
  2530. fGnrlPrint_knu(type);
  2531. }
  2532. }
  2533. }
  2534. // alert("row:3076 SPADT62305.js- 1 " + type );
  2535. ///2015년 3월11일 김치국 주사큰라벨 Flag 만듬
  2536. //if(type == "L" && sDrugKindcd == "[주사약]"){
  2537. // type = "LJ"
  2538. // }
  2539. if(getNodesetCount("/root/main/prnt/lbllist") > 0) {
  2540. if(type == "L1") { //본원큰라벨
  2541. model.removeNodeset("/root/main/lbllist");
  2542. model.makeNode("/root/main/lbllist");
  2543. model.copyNode("/root/main/lbllist", "/root/main/prnt");
  2544. makeReportPreview(0,0,10, 10, "");
  2545. fPrintRexbar("RFADT62303");
  2546. } else if(type == "L"){ //큰라벨
  2547. makeReportPreview(0,0,10, 10, "");
  2548. fPrintRexbar("RFADT61300");
  2549. } else if(type == "S") { //작은라벨
  2550. model.removeNodeset("/root/main/lbllist");
  2551. model.makeNode("/root/main/lbllist");
  2552. model.copyNode("/root/main/lbllist", "/root/main/prnt");
  2553. makeReportPreview(0,0,10, 10, "");
  2554. fPrintRexbar("RFADT62302");
  2555. } else if(type == "LJ"){ //주사큰라벨 ///2015년 3월11일 김치국 주사큰라벨 Flag 만듬
  2556. makeReportPreview(0,0,10, 10, "");
  2557. fPrintRexbar("RFADT61305");
  2558. }
  2559. }
  2560. }
  2561. /**
  2562. * 20101224 이선경 추가
  2563. * 외래 큰라벨 출력 양식(단독)
  2564. */
  2565. function fIndependPrint_knu(type) {
  2566. //라벨내용
  2567. var drugkindnm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  2568. var qty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqty");
  2569. var dayqty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayprcpqty");
  2570. var qtyunit = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqtyunit");
  2571. var tims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  2572. var dayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno"); //처방일수
  2573. var mthddayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayno"); //용법일수
  2574. var packunit = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/packunit"); //약품마스터의 수량단위
  2575. //2013년 8월22일 김치국 ATC전송되지 않는 정제약 처리위해 추가 ~~~~ 여기에서
  2576. var atcyn = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/atcyn"); //ATC라벨 YN
  2577. var prcpmixno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpmixno"); //분리번호
  2578. // alert("atcyn : " + atcyn )
  2579. // alert("prcpmixno : " + prcpmixno )
  2580. var mth = ""; //용법내용설명
  2581. if (drugkindnm == "[주사약]"){
  2582. //용법2
  2583. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/mthdcnts", model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"));
  2584. } else if (drugkindnm == "[외용약]"){
  2585. 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");
  2586. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/mthdcnts" , val);
  2587. } else if (drugkindnm == "[내복약]"){
  2588. // alert(" 내복약 1 Call " )
  2589. var sumcls = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/sumcls");
  2590. if( sumcls == "DM" || sumcls == "DS" || sumcls == "DT" || sumcls == "DX" || sumcls == "DG"){ //20091110 이선경 수정 : 라벨그룹이 마약(경구), 수제, ptp, 기타약일경우 약품마스터의 수량단위를 출력 20110511_laboru_pack 추가
  2591. var tmpqty = Math.round(qty * 1000) / 1000; // 20110705_laboru_소수 둘째 자리 반올림서 넷째자리 반올림으로 변경
  2592. if(packunit == "T" || packunit == "C") {
  2593. // alert(" 내복약 2 Call " )
  2594. if(type == "L1") {
  2595. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", tims+"회 "+(dayno*mthddayno)+"일분");
  2596. mth = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2") + " "
  2597. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3") + " " +fChkFloat(qty)+"정씩 "+ model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  2598. } else if(type == "L") {
  2599. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+tims+"회 "+fChkFloat(qty)+"정씩 "+(dayno*mthddayno)+"일분");
  2600. } else if(type == "S") {
  2601. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+tims+"회 "+fChkFloat(qty)+"정씩 "+(dayno*mthddayno)+"일분");
  2602. }
  2603. } else {
  2604. // alert(" 내복약 3 Call " )
  2605. if(type == "L1") {
  2606. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", tims+"회 "+(dayno*mthddayno)+"일분");
  2607. mth = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2") + " "
  2608. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3") + " " +fChkFloat(tmpqty)+ packunit +"씩 "+ model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  2609. } else if(type == "L") {
  2610. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+tims+"회 "+fChkFloat(tmpqty)+ packunit +"씩 "+(dayno*mthddayno)+"일분");
  2611. } else if(type == "S") {
  2612. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+tims+"회 "+fChkFloat(tmpqty)+ packunit +"씩 "+(dayno*mthddayno)+"일분");
  2613. }
  2614. }
  2615. } else {
  2616. // alert(" 내복약 4 Call " )
  2617. if(type == "L1") {
  2618. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", tims+"회 "+(dayno*mthddayno)+"일분");
  2619. //2013년 8월22일 김치국 ATC전송되지 않는 정제약 처리위해 추가 ~~~~ 여기에서
  2620. if( atcyn == "N" && prcpmixno <= 70 ) {
  2621. mth = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2") + " "
  2622. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3") + " " +fChkFloat(qty)+"알씩 "+ model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  2623. } else {
  2624. mth = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2") + " "
  2625. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3") + " " +fChkFloat(qty)+"포[정]씩 "+ model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  2626. }
  2627. // mth = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2") + " "
  2628. // + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3") + " " +fChkFloat(qty)+"포[정]씩 "+ model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  2629. // alert(" L 11 Call + " + mth)
  2630. } else if(type == "L"){
  2631. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+tims+"회 "+fChkFloat(qty)+"포[정]씩 "+(dayno*mthddayno)+"일분");
  2632. } else if(type == "S"){
  2633. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+tims+"회 "+fChkFloat(qty)+"포[정]씩 "+(dayno*mthddayno)+"일분");
  2634. }
  2635. }
  2636. //20110201 이선경 수정 (경북대)
  2637. //if(type == "L" || type == "S") {
  2638. if(type == "S") {
  2639. // alert(" 내복약 5 Call " )
  2640. mth = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2") + " "
  2641. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  2642. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", model.getValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit") + "\n" + mth);
  2643. } else {
  2644. // alert(" 내복약 6 Call " )
  2645. mth = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2") + " "
  2646. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  2647. //alert(mth.length);
  2648. var strchk = mth.substring(mth.length - 1, mth.length);
  2649. //alert(strchk);
  2650. if(strchk == "후" || strchk == "시" || strchk == "간" || strchk == "중" || strchk == "분") {
  2651. mth += "에 ";
  2652. } else {
  2653. mth += " ";
  2654. }
  2655. // 20110415_laboru_경북대병원_추가
  2656. if( sumcls == "DM" || sumcls == "DS" || sumcls == "DT" || sumcls == "DX" || sumcls == "DG"){ //20091110 이선경 수정 : 라벨그룹이 마약(경구), 수제, ptp, 기타약일경우 약품마스터의 수량단위를 출력
  2657. // alert(" 내복약 7 Call " )
  2658. var tmpqty = Math.round(qty * 1000) / 1000; // 20110705_laboru_소수 둘째 자리 반올림서 넷째자리 반올림으로 변경
  2659. if(packunit == "T" || packunit == "C") {
  2660. // alert(" 내복약 8 Call " )
  2661. mth += fChkFloat(qty)+"정씩 ";
  2662. } else {
  2663. // alert(" 내복약 9 Call " )
  2664. // if(packunit == "cap" || packunit == "tab" ) {
  2665. if( (packunit == "cap" || packunit == "tab" ) && atcyn == "N" ) {
  2666. packunit = "알"; // 20110413_laboru_경북대병원_단위가 cap, tab 일때 알로 바꾸기
  2667. }
  2668. mth += fChkFloat(tmpqty)+ packunit +"씩 " ;
  2669. // alert(" mth :l " + mth )
  2670. }
  2671. } else {
  2672. //2013년 9월 5일 김치국 ATC전송되지 않는 정제약 처리위해 추가 ~~~~ 여기에서
  2673. if (atcyn == "N") {
  2674. if ( packunit == "cap" || packunit == "tab" ) {
  2675. mth += fChkFloat(qty)+"알씩 ";
  2676. } else {
  2677. mth += fChkFloat(tmpqty)+ packunit +"씩 " ;
  2678. }
  2679. } else {
  2680. mth += fChkFloat(qty)+"포[정]씩 ";
  2681. }
  2682. // alert(" 내복약 11 Call " + mth )
  2683. }
  2684. mth += model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  2685. }
  2686. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/mthdcnts", mth);
  2687. }
  2688. // 2010.03.18 pymi
  2689. if(!fChkSumcls(iPoint) && model.getValue("/root/send/prcpinfo/lbl5") == "Y") {
  2690. var val = "";
  2691. } else {
  2692. // 20101027_laboru_경북대병원_라벨 출력물 처방코드 삭제
  2693. var val = parseFloat(model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/totdrugqty"))
  2694. +" "+model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpnm");
  2695. if(sumcls == "DT" && type != "S") { //20100707_ laboru_PTP 라벨 표시 //20110307 칠곡 김은영약사님 요청(작은라벨일때는 (PTP) 출력하지 않도록
  2696. val += " (PTP)";
  2697. }
  2698. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/prcpcd", val);
  2699. }
  2700. // (e)
  2701. //alert("iPageCntO 단독: " + iPageCntO);
  2702. iPageCntO++;
  2703. }
  2704. /**
  2705. * 20101224 이선경 추가
  2706. * 외래 큰라벨 출력 양식(일반)
  2707. */
  2708. function fGnrlPrint_knu(type) {
  2709. var cnt = 0;
  2710. var ordCnt = 0;
  2711. var tmppc = "";
  2712. var sndprcpcnt = 1;
  2713. //라벨내용
  2714. var drugkindnm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  2715. var qty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpqty");
  2716. var dayqty = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayprcpqty");
  2717. var tims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  2718. var dayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");//처방일수
  2719. var mthddayno = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/dayno"); //용법일수
  2720. //약코드 출력
  2721. var drugkind1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/drugkindnm");
  2722. var dayno1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpdayno");
  2723. var mthd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd1");
  2724. var mthd2 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd2");
  2725. var mthd3 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthd3");
  2726. var mthdcd1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcd");
  2727. var mthdcdfive1 = mthdcd1.substring(4,5);
  2728. var mthdcdthree1 = 0;
  2729. var cntpatt1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/cntpatt");
  2730. var mthdcntsno = iPageCntO;
  2731. var mthdcnts_end = ""; //용법내용설명
  2732. var mthdcd5nm = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcd5nm"); //약품코드5번째자리명칭 (용법세분류)
  2733. var prcpmixno1 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpmixno");
  2734. //alert(drugkindnm + " " + mthdcd + " " + mthdcdfive1);
  2735. if( drugkindnm != "[내복약]" ) { // 20120216
  2736. if (drugkindnm == "[주사약]"){
  2737. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/mthdcnts", model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"));
  2738. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  2739. var totdrugqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty");
  2740. var mthdcnts4 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  2741. var sDngryn = model.getValue("/root/main/lbllist/lbllist["+j+"]/dngryn"); //고위험주사 여부
  2742. var sKeepmthdyn = model.getValue("/root/main/lbllist/lbllist["+j+"]/keepmthdyn"); //냉장주사 여부
  2743. var sAtcifsnglyn = model.getValue("/root/main/lbllist/lbllist["+j+"]/atcifsnglyn"); //단독주사 여부
  2744. if(sndprcpcnt > 6) {
  2745. var prePage = iPageCntO;
  2746. iPageCntO++;
  2747. sndprcpcnt = 1;
  2748. model.makeNode("/root/main/prnt/lbllist[" +iPageCntO+ "]");
  2749. model.copyNode("/root/main/prnt/lbllist[" +iPageCntO+ "]", "/root/main/prnt/lbllist["+prePage+"]");
  2750. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/lblcnts2flag", "N");
  2751. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp1", "");
  2752. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp2", "");
  2753. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp3", "");
  2754. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp4", "");
  2755. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp5", "");
  2756. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp6", "");
  2757. /* model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp7", "");
  2758. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp8", "");
  2759. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp9", "");
  2760. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp10", "");
  2761. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp11", "");
  2762. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp12", "");*/
  2763. }
  2764. // 20110608_laboru
  2765. if(cnt == 0 && (sDngryn == "Y" || sKeepmthdyn == "Y" || sAtcifsnglyn == "Y") ){
  2766. //주사가 뭉쳐서 나오다가 단독주사를 만날경우 단독주사 출력.
  2767. var prcpcd = totdrugqty
  2768. +" "+model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm") ;
  2769. var lblcnts1 = model.getValue("/root/main/lbllist/lbllist["+j+"]/lblcnts1");
  2770. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/lblcnts1", lblcnts1);
  2771. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/prcpcd", prcpcd);
  2772. // 20110608_laboru_주사단독일때
  2773. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/snglflag", "Y");
  2774. iPageCntO++;
  2775. iPoint = j;
  2776. break;
  2777. } else if(cnt != 0 && (sDngryn == "Y" || sKeepmthdyn == "Y" || sAtcifsnglyn == "Y")) {
  2778. iPageCntO++;
  2779. iPoint = j - 1;
  2780. break;
  2781. } else {
  2782. var val = totdrugqty
  2783. +" "+model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm") + " " + mthdcnts4;
  2784. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/sndprcp"+sndprcpcnt, val);
  2785. // 20110531_laboru_본원 큰라벨 크기로 주사 라벨 출력할 때 묶어서 출력
  2786. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/injsamedrugflag", "Y");
  2787. sndprcpcnt++;
  2788. iPoint = j;
  2789. cnt++;
  2790. }
  2791. }
  2792. } else if (drugkindnm == "[외용약]" && mthdcd1 == "O10DE"){
  2793. var val = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2")
  2794. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  2795. if(type == "L1") {
  2796. val += model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  2797. } else {
  2798. val += "\n" + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  2799. }
  2800. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/mthdcnts" , val);
  2801. if(mthdcd1 != "O10DE") {
  2802. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  2803. var totdrugqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty");
  2804. var mthdcnts4 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  2805. var sDngryn = model.getValue("/root/main/lbllist/lbllist["+j+"]/dngryn"); //고위험주사 여부
  2806. var sKeepmthdyn = model.getValue("/root/main/lbllist/lbllist["+j+"]/keepmthdyn"); //냉장주사 여부
  2807. var sAtcifsnglyn = model.getValue("/root/main/lbllist/lbllist["+j+"]/atcifsnglyn"); //단독주사 여부
  2808. if(sndprcpcnt > 6) {
  2809. var prePage = iPageCntO;
  2810. iPageCntO++;
  2811. sndprcpcnt = 1;
  2812. model.makeNode("/root/main/prnt/lbllist[" +iPageCntO+ "]");
  2813. model.copyNode("/root/main/prnt/lbllist[" +iPageCntO+ "]", "/root/main/prnt/lbllist["+prePage+"]");
  2814. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/lblcnts2flag", "N");
  2815. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp1", "");
  2816. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp2", "");
  2817. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp3", "");
  2818. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp4", "");
  2819. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp5", "");
  2820. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp6", "");
  2821. /* model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp7", "");
  2822. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp8", "");
  2823. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp9", "");
  2824. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp10", "");
  2825. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp11", "");
  2826. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp12", "");*/
  2827. }
  2828. // 20110608_laboru
  2829. if(cnt == 0 && (sDngryn == "Y" || sKeepmthdyn == "Y" || sAtcifsnglyn == "Y") ){
  2830. //주사가 뭉쳐서 나오다가 단독주사를 만날경우 단독주사 출력.
  2831. var prcpcd = totdrugqty
  2832. +" "+model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm") ;
  2833. var lblcnts1 = model.getValue("/root/main/lbllist/lbllist["+j+"]/lblcnts1");
  2834. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/lblcnts1", lblcnts1);
  2835. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/prcpcd", prcpcd);
  2836. // 20110608_laboru_주사단독일때
  2837. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/snglflag", "Y");
  2838. iPageCntO++;
  2839. iPoint = j;
  2840. break;
  2841. } else if(cnt != 0 && (sDngryn == "Y" || sKeepmthdyn == "Y" || sAtcifsnglyn == "Y")) {
  2842. iPageCntO++;
  2843. iPoint = j - 1;
  2844. break;
  2845. } else {
  2846. var val = totdrugqty
  2847. +" "+model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm") + " " + mthdcnts4;
  2848. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/sndprcp"+sndprcpcnt, val);
  2849. // 20110531_laboru_본원 큰라벨 크기로 주사 라벨 출력할 때 묶어서 출력
  2850. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/injsamedrugflag", "Y");
  2851. sndprcpcnt++;
  2852. iPoint = j;
  2853. cnt++;
  2854. }
  2855. }
  2856. } else {
  2857. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  2858. var mthdcdcheck = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthdcd");
  2859. if(mthdcdcheck == "O10DE") {
  2860. var totdrugqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty");
  2861. var mthdcnts4 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  2862. var sDngryn = model.getValue("/root/main/lbllist/lbllist["+j+"]/dngryn"); //고위험주사 여부
  2863. var sKeepmthdyn = model.getValue("/root/main/lbllist/lbllist["+j+"]/keepmthdyn"); //냉장주사 여부
  2864. var sAtcifsnglyn = model.getValue("/root/main/lbllist/lbllist["+j+"]/atcifsnglyn"); //단독주사 여부
  2865. if(sndprcpcnt > 12) {
  2866. var prePage = iPageCntO;
  2867. iPageCntO++;
  2868. sndprcpcnt = 1;
  2869. model.makeNode("/root/main/prnt/lbllist[" +iPageCntO+ "]");
  2870. model.copyNode("/root/main/prnt/lbllist[" +iPageCntO+ "]", "/root/main/prnt/lbllist["+prePage+"]");
  2871. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/lblcnts2flag", "N");
  2872. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp1", "");
  2873. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp2", "");
  2874. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp3", "");
  2875. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp4", "");
  2876. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp5", "");
  2877. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp6", "");
  2878. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp7", "");
  2879. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp8", "");
  2880. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp9", "");
  2881. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp10", "");
  2882. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp11", "");
  2883. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp12", "");
  2884. }
  2885. // 20110608_laboru
  2886. /* if(cnt == 0 && (sDngryn == "Y" || sKeepmthdyn == "Y" || sAtcifsnglyn == "Y") ){
  2887. //주사가 뭉쳐서 나오다가 단독주사를 만날경우 단독주사 출력.
  2888. var prcpcd = totdrugqty
  2889. +" "+model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm") ;
  2890. var lblcnts1 = model.getValue("/root/main/lbllist/lbllist["+j+"]/lblcnts1");
  2891. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/lblcnts1", lblcnts1);
  2892. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/prcpcd", prcpcd);
  2893. // 20110608_laboru_주사단독일때
  2894. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/snglflag", "Y");
  2895. iPageCntO++;
  2896. iPoint = j;
  2897. break;
  2898. } else if(cnt != 0 && (sDngryn == "Y" || sKeepmthdyn == "Y" || sAtcifsnglyn == "Y")) {
  2899. iPageCntO++;
  2900. iPoint = j - 1;
  2901. break;
  2902. } else {
  2903. */
  2904. var val = totdrugqty
  2905. +" "+model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm"); //+ " " + mthdcnts4;
  2906. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/sndprcp"+sndprcpcnt, val);
  2907. // 20110531_laboru_본원 큰라벨 크기로 주사 라벨 출력할 때 묶어서 출력
  2908. //model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/injsamedrugflag", "Y");
  2909. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/samedrugflag", "Y");
  2910. //alert(iPageCntO + " " + model.getValue("/root/main/prnt/lbllist["+iPageCntO+"]/samedrugflag"));
  2911. sndprcpcnt++;
  2912. iPoint = j;
  2913. cnt++;
  2914. //}
  2915. }
  2916. }
  2917. iPageCntO++;
  2918. }
  2919. } else if (drugkindnm == "[외용약]" && mthdcd1 != "O10DE"){
  2920. var val = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2")
  2921. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  2922. if(type == "L1") {
  2923. val += model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  2924. } else {
  2925. val += "\n" + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  2926. }
  2927. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/mthdcnts" , val);
  2928. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  2929. var totdrugqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty");
  2930. var mthdcnts4 = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  2931. var sDngryn = model.getValue("/root/main/lbllist/lbllist["+j+"]/dngryn"); //고위험주사 여부
  2932. var sKeepmthdyn = model.getValue("/root/main/lbllist/lbllist["+j+"]/keepmthdyn"); //냉장주사 여부
  2933. var sAtcifsnglyn = model.getValue("/root/main/lbllist/lbllist["+j+"]/atcifsnglyn"); //단독주사 여부
  2934. if(sndprcpcnt > 6) {
  2935. var prePage = iPageCntO;
  2936. iPageCntO++;
  2937. sndprcpcnt = 1;
  2938. model.makeNode("/root/main/prnt/lbllist[" +iPageCntO+ "]");
  2939. model.copyNode("/root/main/prnt/lbllist[" +iPageCntO+ "]", "/root/main/prnt/lbllist["+prePage+"]");
  2940. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/lblcnts2flag", "N");
  2941. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp1", "");
  2942. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp2", "");
  2943. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp3", "");
  2944. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp4", "");
  2945. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp5", "");
  2946. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp6", "");
  2947. /* model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp7", "");
  2948. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp8", "");
  2949. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp9", "");
  2950. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp10", "");
  2951. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp11", "");
  2952. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp12", "");*/
  2953. }
  2954. // 20110608_laboru
  2955. if(cnt == 0 && (sDngryn == "Y" || sKeepmthdyn == "Y" || sAtcifsnglyn == "Y") ){
  2956. //주사가 뭉쳐서 나오다가 단독주사를 만날경우 단독주사 출력.
  2957. var prcpcd = totdrugqty
  2958. +" "+model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm") ;
  2959. var lblcnts1 = model.getValue("/root/main/lbllist/lbllist["+j+"]/lblcnts1");
  2960. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/lblcnts1", lblcnts1);
  2961. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/prcpcd", prcpcd);
  2962. // 20110608_laboru_주사단독일때
  2963. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/snglflag", "Y");
  2964. iPageCntO++;
  2965. iPoint = j;
  2966. break;
  2967. } else if(cnt != 0 && (sDngryn == "Y" || sKeepmthdyn == "Y" || sAtcifsnglyn == "Y")) {
  2968. iPageCntO++;
  2969. iPoint = j - 1;
  2970. break;
  2971. } else {
  2972. var val = totdrugqty
  2973. +" "+model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm") + " " + mthdcnts4;
  2974. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/sndprcp"+sndprcpcnt, val);
  2975. // 20110531_laboru_본원 큰라벨 크기로 주사 라벨 출력할 때 묶어서 출력
  2976. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/injsamedrugflag", "Y");
  2977. sndprcpcnt++;
  2978. iPoint = j;
  2979. cnt++;
  2980. }
  2981. }
  2982. }
  2983. /* if(sDngryn == "Y" || sKeepmthdyn == "Y" || sAtcifsnglyn == "Y" ){
  2984. // 20110608_laboru_주사단독일때
  2985. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/snglflag", "Y");
  2986. } else {
  2987. // 20110531_laboru_본원 큰라벨 크기로 주사 라벨 출력할 때 묶어서 출력
  2988. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/injsamedrugflag", "Y");
  2989. }*/
  2990. /* var sSumCls1 = model.getValue("/root/main/prnt/lbllist["+iPageCntO+"]/sumcls");
  2991. var cnt = 0;
  2992. var unit = "";
  2993. var tprcpcd = "";
  2994. var tprcpnm = "";
  2995. var prePage = iPageCntO;
  2996. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/samedrugflag", "Y");
  2997. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++) {
  2998. //sSumCls2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/sumcls");
  2999. var qty = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqty");
  3000. var dayqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/dayprcpqty");
  3001. var qtyunit = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqtyunit");
  3002. var tims = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
  3003. var dayno = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  3004. var prcpnm = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  3005. var prcpcd = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd");
  3006. var val = parseFloat(model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty"));
  3007. if(cnt != 0 && fChkIndependInj(j)){
  3008. //주사가 뭉쳐서 나오다가 단독주사를 만날경우 단독주사는 출력하지 아니함.
  3009. iPageCntO++;
  3010. break;
  3011. }
  3012. if(cnt == 0) {
  3013. tprcpcd = prcpcd;
  3014. tprcpnm = val + " " + prcpnm;
  3015. unit = fChkFloat(dayqty)+qtyunit+ " "+tims+ " "+dayno;
  3016. } else {
  3017. tprcpcd += "\n" + prcpcd;
  3018. tprcpnm += "\n" + val + " " + prcpnm;
  3019. unit += "\n" + fChkFloat(dayqty)+qtyunit+ " "+tims+ " "+dayno;
  3020. }
  3021. if(cnt != 0) {
  3022. model.removeNode("/root/main/lbllist/lbllist["+j+"]");
  3023. j--
  3024. }
  3025. cnt++;
  3026. if(cnt == 5 || fChkIndependInj(j)){
  3027. j++;
  3028. iPageCntO++;
  3029. break;
  3030. }
  3031. }
  3032. // 20101101_laboru_경북대병원_라벨 출력물 처방코드 삭제
  3033. //model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd" , tprcpcd );
  3034. model.setValue("/root/main/prnt/lbllist["+prePage+"]/prcpnm" , tprcpnm );
  3035. model.makeValue("/root/main/prnt/lbllist["+prePage+"]/unit" , unit );
  3036. model.setValue("/root/main/prnt/lbllist["+prePage+"]/lblcnts2", "");
  3037. model.makeValue("/root/main/prnt/lbllist["+prePage+"]/pageflag", "N");
  3038. //iPoint = j-1;
  3039. //보관방법 고가 출력
  3040. var sKeepmthd = model.getValue("/root/main/prnt/lbllist["+prePage+"]/keepmthd");
  3041. var sExpnyn = model.getValue("/root/main/prnt/lbllist["+prePage+"]/expnyn");
  3042. var sExpnnm = "";
  3043. if(sExpnyn == "Y") sExpnnm = "고가";
  3044. if(sKeepmthd != ""){
  3045. model.setValue("/root/main/prnt/lbllist["+prePage+"]/keepmthd", "<"+sKeepmthd+">" );
  3046. }
  3047. if(sExpnnm != ""){
  3048. model.makeValue("/root/main/prnt/lbllist["+prePage+"]/expnnm", "<"+sExpnnm+">" );
  3049. }
  3050. */
  3051. /* alert("dd"); // 20110531_laboru
  3052. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  3053. var drugkind2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/drugkindnm");
  3054. var dayno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  3055. var mthd4 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd1");
  3056. var mthd5 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd2");
  3057. var mthd6 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd3");
  3058. //20101229 이선경 수정 : atc구분이 산제아닐때만 단독라벨 적용
  3059. var atc_drugkind = model.getValue("/root/main/lbllist/lbllist["+j+"]/atc_drugkind");
  3060. if((drugkind1 == drugkind2) && (dayno1 == dayno2) && (mthd1 == mthd4 && mthd2 == mthd5 && mthd3 == mthd6)
  3061. && !(fChkSumcls(j) && atc_drugkind != "p") ){
  3062. var prcpqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty")/model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
  3063. prcpqty = Math.ceil( prcpqty * tims*1000)/1000 ;
  3064. // 2010.03.18 pymi
  3065. if(!fChkSumcls(j) && model.getValue("/root/send/prcpinfo/lbl5") == "Y") {
  3066. var val = "";
  3067. } else {
  3068. // 20101027_laboru_경북대병원_라벨 출력물 처방코드 삭제
  3069. var val = prcpqty
  3070. +" "+model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  3071. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/sndprcp"+sndprcpcnt, tmppc);
  3072. sndprcpcnt++;
  3073. }
  3074. cnt++;
  3075. iPoint = j ;
  3076. } else {
  3077. iPageCntO++;
  3078. iPoint = j - 1;
  3079. break;
  3080. }
  3081. if(cnt == 12){ // 20101030_laboru_경북대병원_라벨 한 페이지에 최고 8개에서 14개 출력되게 변경
  3082. iPageCntO++;
  3083. break;
  3084. }
  3085. }
  3086. sndprcpcnt = 1;*/
  3087. } else if (drugkindnm == "[내복약]" ){ // 20120216
  3088. var lbltims =0;
  3089. var unit = "";
  3090. var mthdcnts = "";
  3091. var mthdcnts1 = 0; //아침
  3092. var mthdcnts2 = 0; //점심
  3093. var mthdcnts3 = 0; //저녁
  3094. var mthdcnts4 = 0; //취침전
  3095. var mthdcnts5 = 0; //특수용법
  3096. var mthdtims = 0; //용법횟수
  3097. lbl_tims = mthd2.split(",");
  3098. if ( mthdcd1 == "ZZZ" ){
  3099. lbltims = tims;
  3100. } else if ( mthd3.indexOf("취침") > -1 ) {
  3101. lbltims = lbl_tims.length +1;
  3102. } else if(mthd2.indexOf("마다") > -1){
  3103. lbltims = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/prcptims");
  3104. } else {
  3105. lbltims = lbl_tims.length;
  3106. }
  3107. tims = lbltims;
  3108. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/samedrugflag", "Y");
  3109. if(lbltims == 1) {
  3110. if(mthd2.indexOf("마다") == -1) {
  3111. if(type == "L1") {
  3112. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthdcdthree1+ "회 "+dayno+"일분");
  3113. mthdcnts_end = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3") + "에" + " 1포씩"; // 20110411_laboru_에 추가
  3114. //+ model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  3115. } else if(type == "L") {
  3116. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+mthdcdthree1+ "회 1포씩 "+dayno+"일분");
  3117. mthdcnts_end = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  3118. //if(mthdcnts_end != "") { mthdcnts_end += "에 ";}
  3119. //mthdcnts_end +="\n" + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  3120. } else if(type == "S") {
  3121. unit = mthddayno + "일 "+mthdcdthree1+ "회 1포씩 "+dayno+"일분" + "\n";
  3122. mthdcnts_end = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  3123. //if(mthdcnts_end != "") { mthdcnts_end += "에 ";}
  3124. //mthdcnts_end += model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  3125. }
  3126. } else {
  3127. if(type == "L1") {
  3128. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthdcdthree1+ "회 "+dayno+"일분");
  3129. mthdcnts_end = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3") + "에" + " 1포씩"; // 20110411_laboru_에 추가
  3130. //+ model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  3131. } else if(type == "L") {
  3132. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+mthdcdthree1+ "회 1포씩 "+dayno+"일분");
  3133. mthdcnts_end = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  3134. //if(mthdcnts_end != "") { mthdcnts_end += "에 ";}
  3135. //mthdcnts_end +="\n" + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  3136. } else if(type == "S") {
  3137. unit = mthddayno + "일 "+mthdcdthree1+ "회 1포씩 "+dayno+"일분" + "\n";
  3138. mthdcnts_end = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  3139. //if(mthdcnts_end != "") { mthdcnts_end += "에 ";}
  3140. //mthdcnts_end += model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  3141. }
  3142. }
  3143. } else {
  3144. if(type == "L1") {
  3145. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthdcdthree1+ "회 "+dayno+"일분");
  3146. mthdcnts_end = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3") + "에" + " 1포씩"; // 20110411_laboru_에 추가
  3147. //+ model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  3148. } else if(type == "L") {
  3149. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+mthdcdthree1+ "회 1포씩 "+dayno+"일분");
  3150. mthdcnts_end = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  3151. //if(mthdcnts_end != "") { mthdcnts_end += "에 ";}
  3152. //mthdcnts_end +="\n" + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  3153. } else if(type == "S") {
  3154. unit = mthddayno + "일 "+mthdcdthree1+ "회 1포씩 "+dayno+"일분" + "\n";
  3155. mthdcnts_end = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  3156. //if(mthdcnts_end != "") { mthdcnts_end += "에 ";}
  3157. //mthdcnts_end += model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4");
  3158. }
  3159. }
  3160. if(cntpatt1.substring(0,1) == "1" && mthdcnts1 == 0) {//아침
  3161. mthdcnts1++;
  3162. mthdtims++;
  3163. }
  3164. if(cntpatt1.substring(1,2) == "1" && mthdcnts2 == 0) {//점심
  3165. mthdcnts2++;
  3166. mthdtims++;
  3167. }
  3168. if(cntpatt1.substring(2,3) == "1" && mthdcnts3 == 0) {//저녁
  3169. mthdcnts3++;
  3170. mthdtims++;
  3171. }
  3172. if(cntpatt1.substring(3,4) == "1" && mthdcnts4 == 0) {//취침전
  3173. mthdcnts4++;
  3174. mthdtims++;
  3175. }
  3176. if(cntpatt1.substring(4,5) == "1") {//특수용법
  3177. mthdcnts5++;
  3178. }
  3179. if(mthdtims == 0) {
  3180. mthdtims = tims;
  3181. }
  3182. //alert(mthdcnts);
  3183. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  3184. var drugkind2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/drugkindnm");
  3185. var dayno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  3186. var mthd4 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd1");
  3187. var mthd5 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd2");
  3188. var mthd6 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthd3");
  3189. //20101229 이선경 수정 : atc구분이 산제아닐때만 단독라벨 적용
  3190. var atc_drugkind = model.getValue("/root/main/lbllist/lbllist["+j+"]/atc_drugkind");
  3191. var mthdcd2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/mthdcd");
  3192. var mthdcdfive2 = mthdcd2.substring(4,5);
  3193. var cntpatt2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/cntpatt");
  3194. var prcpmixno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpmixno");
  3195. //alert("cntpatt2 : " + cntpatt2);
  3196. //alert(prcpmixno1 + " " + prcpmixno2 + " " + model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm"));
  3197. //20110102 이선경 수정 : 라벨출력시 묶어주는 기준은 용법코드 5번째자리(식후30분후..)와 일수
  3198. //if((drugkind1 == drugkind2) && (dayno1 == dayno2) && (mthd1 == mthd4 && mthd2 == mthd5 && mthd3 == mthd6)
  3199. // && !(fChkSumcls(j) && atc_drugkind != "p")){
  3200. if(atc_drugkind == "p") {
  3201. if(dayno1 == dayno2 && (mthdcd1 == mthdcd2 || (mthdcdfive1 == "P" && (mthdcd2 == "A11D" || mthdcd2 == "A11DI") ) ) && prcpmixno1 == prcpmixno2) {
  3202. var lblcnts2 = model.getValue("/root/main/lbllist/lbllist["+ j +"]/lblcnts2");
  3203. var totdrugqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty");
  3204. var prcpqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty")/model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
  3205. prcpqty = Math.ceil( prcpqty * tims*1000)/1000 ;
  3206. //alert(model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd")+ " " + model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty")+ " " + model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims" + " " + prcpqty));
  3207. if(lblcnts2.length > 0) {
  3208. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/lblcnts2", model.getValue("/root/main/prnt/lbllist["+iPageCntO+"]/lblcnts2") + "\n" + lblcnts2);
  3209. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/lblcnts2flag", "Y");
  3210. }
  3211. //용법코드의 아침, 점심, 저녁, 취침전 출력
  3212. if(cntpatt2.substring(0,1) == "1" && mthdcnts1 == 0) {
  3213. mthdcnts1++;
  3214. mthdtims++;
  3215. }
  3216. if(cntpatt2.substring(1,2) == "1" && mthdcnts2 == 0) {
  3217. mthdcnts2++;
  3218. mthdtims++;
  3219. }
  3220. if(cntpatt2.substring(2,3) == "1" && mthdcnts3 == 0) {
  3221. mthdcnts3++;
  3222. mthdtims++;
  3223. }
  3224. if(cntpatt2.substring(3,4) == "1" && mthdcnts4 == 0) {
  3225. mthdcnts4++;
  3226. mthdtims++;
  3227. }
  3228. //용법코드의 최대횟수 출력함
  3229. if(mthdtims == 0) { mthdtims = 1;}
  3230. if(type == "L1") {
  3231. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthdtims+ "회 "+dayno2+"일분");
  3232. } else if(type == "L"){
  3233. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+mthdtims+ "회 1포씩 "+dayno2+"일분");
  3234. } else if(type == "S") {
  3235. unit = mthddayno + "일 "+mthdtims+ "회 1포씩 "+dayno+"일분" + "\n";
  3236. }
  3237. var val = totdrugqty
  3238. +" "+model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  3239. if(type == "L1" || type == "L") {
  3240. if(sndprcpcnt > 12) {
  3241. var prePage = iPageCntO;
  3242. iPageCntO++;
  3243. sndprcpcnt = 1;
  3244. model.makeNode("/root/main/prnt/lbllist[" +iPageCntO+ "]");
  3245. model.copyNode("/root/main/prnt/lbllist[" +iPageCntO+ "]", "/root/main/prnt/lbllist["+prePage+"]");
  3246. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/lblcnts2flag", "N");
  3247. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp1", "");
  3248. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp2", "");
  3249. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp3", "");
  3250. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp4", "");
  3251. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp5", "");
  3252. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp6", "");
  3253. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp7", "");
  3254. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp8", "");
  3255. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp9", "");
  3256. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp10", "");
  3257. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp11", "");
  3258. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp12", "");
  3259. }
  3260. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/sndprcp"+sndprcpcnt, val);
  3261. } else if(type == "S") {
  3262. if(sndprcpcnt > 4){
  3263. var prePage = iPageCntO;
  3264. iPageCntO++;
  3265. sndprcpcnt = 1;
  3266. model.makeNode("/root/main/prnt/lbllist[" +iPageCntO+ "]");
  3267. model.copyNode("/root/main/prnt/lbllist[" +iPageCntO+ "]", "/root/main/prnt/lbllist["+prePage+"]");
  3268. }
  3269. if(sndprcpcnt == 1) {
  3270. model.setValue("/root/main/prnt/lbllist["+iPageCntO+"]/prcpnm", val);
  3271. } else {
  3272. model.setValue("/root/main/prnt/lbllist["+iPageCntO+"]/prcpnm", model.getValue("/root/main/prnt/lbllist["+iPageCntO+"]/prcpnm") + "\n" + val);
  3273. }
  3274. }
  3275. sndprcpcnt++;
  3276. iPoint = j;
  3277. } else {
  3278. iPageCntO++;
  3279. iPoint = j - 1;
  3280. break;
  3281. }
  3282. } else if((mthdcdfive1 == mthdcdfive2 && dayno1 == dayno2 && !(fChkSumcls(j) && atc_drugkind != "p") && prcpmixno1 == prcpmixno2)
  3283. || (dayno1 == dayno2 && mthdcdfive1 == "P" && (mthdcd2 == "A11D" || mthdcd2 == "A11DI") && prcpmixno1 == prcpmixno2 ) ) {
  3284. //20110102 이선경 수정 : 라벨출력시 묶어주는 기준은 용법코드 5번째자리(식후30분후..)와 일수
  3285. //예외적으로 일수가 같고 식후30분과 취침전용법은 같이 묶어줌
  3286. //20110221 이선경 수정 : 믹스번호 체크함.
  3287. var lblcnts2 = model.getValue("/root/main/lbllist/lbllist["+ j +"]/lblcnts2");
  3288. var totdrugqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty");
  3289. var prcpqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty")/model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
  3290. prcpqty = Math.ceil( prcpqty * tims*1000)/1000 ;
  3291. //alert(model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd")+ " " + model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty")+ " " + model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims" + " " + prcpqty));
  3292. if(lblcnts2.length > 0) {
  3293. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/lblcnts2", model.getValue("/root/main/prnt/lbllist["+iPageCntO+"]/lblcnts2") + "\n" + lblcnts2);
  3294. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/lblcnts2flag", "Y");
  3295. }
  3296. //용법코드의 아침, 점심, 저녁, 취침전 출력
  3297. if(cntpatt2.substring(0,1) == "1" && mthdcnts1 == 0) {
  3298. mthdcnts1++;
  3299. mthdtims++;
  3300. }
  3301. if(cntpatt2.substring(1,2) == "1" && mthdcnts2 == 0) {
  3302. mthdcnts2++;
  3303. mthdtims++;
  3304. }
  3305. if(cntpatt2.substring(2,3) == "1" && mthdcnts3 == 0) {
  3306. mthdcnts3++;
  3307. mthdtims++;
  3308. }
  3309. if(cntpatt2.substring(3,4) == "1" && mthdcnts4 == 0) {
  3310. mthdcnts4++;
  3311. mthdtims++;
  3312. }
  3313. //용법코드의 최대횟수 출력함
  3314. if(mthdtims == 0) { mthdtims = 1;}
  3315. if(type == "L1") {
  3316. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthdtims+ "회 "+dayno2+"일분");
  3317. } else if(type == "L"){
  3318. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/unit", mthddayno + "일 "+mthdtims+ "회 1포씩 "+dayno2+"일분");
  3319. } else if(type == "S") {
  3320. unit = mthddayno + "일 "+mthdtims+ "회 1포씩 "+dayno+"일분" + "\n";
  3321. }
  3322. var val = totdrugqty
  3323. +" "+model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  3324. if(type == "L1" || type == "L") {
  3325. if(sndprcpcnt > 12) {
  3326. var prePage = iPageCntO;
  3327. iPageCntO++;
  3328. sndprcpcnt = 1;
  3329. model.makeNode("/root/main/prnt/lbllist[" +iPageCntO+ "]");
  3330. model.copyNode("/root/main/prnt/lbllist[" +iPageCntO+ "]", "/root/main/prnt/lbllist["+prePage+"]");
  3331. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/lblcnts2flag", "N");
  3332. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp1", "");
  3333. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp2", "");
  3334. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp3", "");
  3335. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp4", "");
  3336. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp5", "");
  3337. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp6", "");
  3338. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp7", "");
  3339. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp8", "");
  3340. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp9", "");
  3341. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp10", "");
  3342. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp11", "");
  3343. model.makeValue("/root/main/prnt/lbllist[" +iPageCntO+ "]/sndprcp12", "");
  3344. }
  3345. model.makeValue("/root/main/prnt/lbllist["+iPageCntO+"]/sndprcp"+sndprcpcnt, val);
  3346. } else if(type == "S") {
  3347. if(sndprcpcnt > 4){
  3348. var prePage = iPageCntO;
  3349. iPageCntO++;
  3350. sndprcpcnt = 1;
  3351. model.makeNode("/root/main/prnt/lbllist[" +iPageCntO+ "]");
  3352. model.copyNode("/root/main/prnt/lbllist[" +iPageCntO+ "]", "/root/main/prnt/lbllist["+prePage+"]");
  3353. }
  3354. if(sndprcpcnt == 1) {
  3355. model.setValue("/root/main/prnt/lbllist["+iPageCntO+"]/prcpnm", val);
  3356. } else {
  3357. model.setValue("/root/main/prnt/lbllist["+iPageCntO+"]/prcpnm", model.getValue("/root/main/prnt/lbllist["+iPageCntO+"]/prcpnm") + "\n" + val);
  3358. }
  3359. }
  3360. sndprcpcnt++;
  3361. iPoint = j;
  3362. } else {
  3363. iPageCntO++;
  3364. iPoint = j - 1;
  3365. break;
  3366. }
  3367. }
  3368. /*
  3369. 아침, 점심, 저녁, 취침전 찍지 않는 예외 용법
  3370. 1. 횟수 패턴 5번째 자리값이 1인 경우
  3371. 2. 용법코드 4번째 자리값이 E (시간마다) 인 경우
  3372. 3. 용법코드 4번째 자리값이 D (의사지시대로) 인 경우
  3373. 4. 용법코드 5번째 자리값이 Q (의사지시대로) 인 경우
  3374. */
  3375. if(mthdcnts5 > 0 || mthdcd1.substring(3,4) == "E" || (mthdcd1.substring(3,4) == "D" && mthdcnts4 < 1)|| mthdcd1.substring(4,5) == "Q"
  3376. ) { // 20110411_laboru_경북대병원_mthdcnts3 가 취침전에 일때 || model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3") == "취침전에"
  3377. mthdcnts = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2") + " "
  3378. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  3379. } else {
  3380. if(mthdcnts1 > 0) {
  3381. mthdcnts = "아침 ";
  3382. }
  3383. if(mthdcnts2 > 0) {
  3384. mthdcnts += "점심 ";
  3385. }
  3386. if(mthdcnts3 > 0) {
  3387. mthdcnts += "저녁 ";
  3388. }
  3389. if(mthdcdfive1 == "P" ) {
  3390. mthdcnts += "식후30분"; // 20110412_laboru_
  3391. }
  3392. if(mthdcdfive1 == "I" ) {
  3393. mthdcnts += "식후즉시"; // 20110412_laboru_
  3394. }
  3395. if(mthdcdfive1 == "B" ) {
  3396. mthdcnts += "식전10분"; // 20110412_laboru_
  3397. }
  3398. if(mthdcdfive1 == "A" ) {
  3399. mthdcnts += "식전30분"; // 20110412_laboru_
  3400. }
  3401. if(mthdcdfive1 == "C" ) {
  3402. mthdcnts += "식전1시간"; // 20110412_laboru_
  3403. }
  3404. if(mthdcdfive1 == "D" ) {
  3405. mthdcnts += "식전2시간"; // 20110412_laboru_
  3406. }
  3407. if(mthdcdfive1 == "E" ) {
  3408. mthdcnts += "공복"; // 20110412_laboru_
  3409. }
  3410. if(mthdcdfive1 == "M" ) {
  3411. mthdcnts += "식사도중"; // 20110412_laboru_
  3412. }
  3413. if(mthdcdfive1 == "W" ) {
  3414. mthdcnts += "식사와 함께"; // 20110412_laboru_
  3415. }
  3416. if(mthdcdfive1 == "T" ) {
  3417. mthdcnts += "식후2시간"; // 20110412_laboru_
  3418. }
  3419. if(mthdcdfive1 == "F" ) {
  3420. mthdcnts += "식후1시간"; // 20110412_laboru_
  3421. }
  3422. if(mthdcdfive1 == "H" ) {
  3423. mthdcnts += "일어난 직후"; // 20120725_laboru_
  3424. }
  3425. if(mthdcdfive1 == "Q" ) {
  3426. mthdcnts += "의사지시대로"; // 20120725_laboru_
  3427. }
  3428. if(mthdcnts_end == "취침전에") {
  3429. //mthdcnts += mthdcd5nm;
  3430. } else {
  3431. //mthdcnts += mthdcnts_end;
  3432. }
  3433. if(mthdcnts4 > 0) {
  3434. if(mthdcnts != "" ) {
  3435. mthdcnts += "과 ";
  3436. }
  3437. if(type != "S") {
  3438. mthdcnts += "취침전에 ";
  3439. } else {
  3440. mthdcnts += "취침전";
  3441. }
  3442. if(mthdcnts == "") {
  3443. mthdcnts = model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2") + " "
  3444. + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts3");
  3445. }
  3446. } else {
  3447. if(type != "S") {
  3448. mthdcnts += "에 "; // 20110411_laboru_에 삭제
  3449. }
  3450. }
  3451. }
  3452. if(type == "S") {
  3453. for(var p = mthdcntsno ; p <= getNodesetCount("/root/main/prnt/lbllist") ; p++){
  3454. model.makeValue("/root/main/prnt/lbllist["+p+"]/mthdcnts", unit + mthdcnts);
  3455. }
  3456. } else {
  3457. for(var p = mthdcntsno ; p <= getNodesetCount("/root/main/prnt/lbllist") ; p++){
  3458. if(mthdcnts == "") {
  3459. model.makeValue("/root/main/prnt/lbllist[" +p+ "]/drugmthddesc", model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts1") + " " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts2") + " "
  3460. +model.getValue("/root/main/lbllist/lbllist["+p+"]/mthdcnts3") + model.getValue("/root/main/lbllist/lbllist["+p+"]/mthdcnts4"));
  3461. } else {
  3462. model.makeValue("/root/main/prnt/lbllist["+p+"]/mthdcnts", unit + mthdcnts + " 1포씩 " + model.getValue("/root/main/lbllist/lbllist["+iPoint+"]/mthdcnts4"));
  3463. }
  3464. }
  3465. }
  3466. }
  3467. }
  3468. /**
  3469. * 병동작은라벨 mix 라벨 (경북대병원)
  3470. */
  3471. function fMixLBL_knu() {
  3472. var sMixno1 = model.getValue("/root/main/prnt/lbllist["+iPageCntO+"]/prcpmixno");
  3473. var cnt = 0;
  3474. var unit = "";
  3475. var tprcpcd = "";
  3476. var tprcpnm = "";
  3477. var prePage = iPageCntO;
  3478. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  3479. sMixno2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpmixno");
  3480. var qty = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqty");
  3481. var dayqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/dayprcpqty");
  3482. var qtyunit = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqtyunit");
  3483. var tims = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
  3484. var dayno = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  3485. var prcpnm= model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  3486. var prcpcd = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd");
  3487. //prcpnm = prcpnm.substr(0,7);
  3488. if(sMixno1 == sMixno2){
  3489. if(cnt == 0) {
  3490. tprcpcd = prcpcd;
  3491. tprcpnm = fChkFloat(dayqty);
  3492. tprcpnm += " " + prcpnm;
  3493. unit = fChkFloat(dayqty)+qtyunit+ " "+tims+ " "+dayno;
  3494. } else {
  3495. tprcpcd += "\n" + prcpcd;
  3496. tprcpnm += "\n" + fChkFloat(dayqty) + " " + prcpnm;
  3497. unit += "\n" + fChkFloat(dayqty)+qtyunit+ " "+tims+ " "+dayno;
  3498. }
  3499. if(cnt != 0) {
  3500. model.removeNode("/root/main/lbllist/lbllist["+j+"]");
  3501. j--
  3502. }
  3503. cnt++;
  3504. } else {
  3505. iPageCntO++;
  3506. j--;
  3507. break;
  3508. }
  3509. if(cnt == 5){
  3510. iPageCntO++;
  3511. break;
  3512. }
  3513. }
  3514. //alert(model.getValue("/root/main/prnt/lbllist["+prePage+"]/prcpnm" ));
  3515. //iPoint = j;
  3516. // 20101101_laboru_경북대병원_라벨 출력물 처방코드 삭제
  3517. //model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd" , tprcpcd );
  3518. model.setValue("/root/main/prnt/lbllist["+prePage+"]/prcpnm" , tprcpnm );
  3519. model.makeValue("/root/main/prnt/lbllist["+prePage+"]/unit" , unit );
  3520. model.makeValue("/root/main/prnt/lbllist["+prePage+"]/mthdcnts", "N6");
  3521. model.setValue("/root/main/prnt/lbllist["+prePage+"]/lblcnts2", "");
  3522. model.makeValue("/root/main/prnt/lbllist["+prePage+"]/pageflag", "N");
  3523. }
  3524. /**
  3525. * 병동작은라벨 주사약 라벨(경북대병원)
  3526. */
  3527. function fInjDrugLBL_knu() {
  3528. var sSumCls1 = model.getValue("/root/main/prnt/lbllist["+iPageCntO+"]/sumcls");
  3529. var cnt = 0;
  3530. var unit = "";
  3531. var tprcpcd = "";
  3532. var tprcpnm = "";
  3533. var prePage = iPageCntO;
  3534. for(var j = iPoint; j <= getNodesetCount("/root/main/lbllist/lbllist") ; j++){
  3535. if(cnt != 0 && fChkIndependInj(j)){
  3536. //주사가 뭉쳐서 나오다가 단독주사를 만날경우 단독주사는 출력하지 아니함.
  3537. iPageCntO++;
  3538. break;
  3539. }
  3540. sSumCls2 = model.getValue("/root/main/lbllist/lbllist["+j+"]/sumcls");
  3541. var qty = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqty");
  3542. var dayqty = model.getValue("/root/main/lbllist/lbllist["+j+"]/dayprcpqty");
  3543. var qtyunit = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpqtyunit");
  3544. var tims = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcptims");
  3545. var dayno = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpdayno");
  3546. var prcpnm = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpnm");
  3547. var prcpcd = model.getValue("/root/main/lbllist/lbllist["+j+"]/prcpcd");
  3548. var val = parseFloat(model.getValue("/root/main/lbllist/lbllist["+j+"]/totdrugqty"));
  3549. //alert(val+ "\n" + prcpnm);
  3550. //prcpnm = prcpnm.substr(0,7);
  3551. if(cnt == 0) {
  3552. tprcpcd = prcpcd;
  3553. tprcpnm = val + " " + prcpnm;
  3554. unit = fChkFloat(dayqty)+qtyunit+ " "+tims+ " "+dayno;
  3555. } else {
  3556. tprcpcd += "\n" + prcpcd;
  3557. tprcpnm += "\n" + val + " " + prcpnm;
  3558. unit += "\n" + fChkFloat(dayqty)+qtyunit+ " "+tims+ " "+dayno;
  3559. }
  3560. if(cnt != 0) {
  3561. model.removeNode("/root/main/lbllist/lbllist["+j+"]");
  3562. j--
  3563. }
  3564. cnt++;
  3565. if(cnt == 5 || fChkIndependInj(j)){
  3566. j++;
  3567. iPageCntO++;
  3568. break;
  3569. }
  3570. }
  3571. // 20101101_laboru_경북대병원_라벨 출력물 처방코드 삭제
  3572. //model.setValue("/root/main/lbllist/lbllist["+iPoint+"]/prcpcd" , tprcpcd );
  3573. model.setValue("/root/main/prnt/lbllist["+prePage+"]/prcpnm" , tprcpnm );
  3574. model.makeValue("/root/main/prnt/lbllist["+prePage+"]/unit" , unit );
  3575. model.setValue("/root/main/prnt/lbllist["+prePage+"]/lblcnts2", "");
  3576. model.makeValue("/root/main/prnt/lbllist["+prePage+"]/pageflag", "N");
  3577. if(!fChkIndependInj(iPoint)) {
  3578. model.makeValue("/root/main/prnt/lbllist["+prePage+"]/mthdcnts", "N6");
  3579. } else {
  3580. model.makeValue("/root/main/prnt/lbllist["+prePage+"]/inusedrugflag", "Y");
  3581. }
  3582. //iPoint = j-1;
  3583. //보관방법 고가 출력
  3584. var sKeepmthd = model.getValue("/root/main/prnt/lbllist["+prePage+"]/keepmthd");
  3585. var sExpnyn = model.getValue("/root/main/prnt/lbllist["+prePage+"]/expnyn");
  3586. var sExpnnm = "";
  3587. if(sExpnyn == "Y") sExpnnm = "고가";
  3588. if(sKeepmthd != ""){
  3589. model.setValue("/root/main/prnt/lbllist["+prePage+"]/keepmthd", "<"+sKeepmthd+">" );
  3590. }
  3591. if(sExpnnm != ""){
  3592. model.makeValue("/root/main/prnt/lbllist["+prePage+"]/expnnm", "<"+sExpnnm+">" );
  3593. }
  3594. }