clinic.js 296 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878
  1. //@ sourceURL=clinic.js
  2. //判断病人列表是否在加载中,防止重复加载
  3. var msg_list_loading = false;
  4. //挂号卡片列表页面下标
  5. var pageIndex = 0;
  6. //药品使用方法,天数和频次的集合
  7. var groupIdMap = null;
  8. var LODOP; //声明为全局变量
  9. //默认打印机下标
  10. var printIndex = -1;
  11. $(function () {
  12. initGenderSelect();
  13. iniAdmissStatus();
  14. initListDeptSelect();
  15. initResponceTypeSelect();
  16. initTemplateTypeSelect();
  17. initZyClassTypeSelect();
  18. initInstructionSelect();
  19. setSelectSize();
  20. $('#editUserBirthDayGroup').datetimepicker({
  21. format: 'yyyy-mm-dd',
  22. language: 'zh-CN',
  23. minView: "month",
  24. });
  25. initDaterangepickerWithId('reportrange', "right");
  26. formatCheck();
  27. //数据校验
  28. init_validator();
  29. //初始频次下拉选
  30. initOrderFrequencys("orderFrequency", true);
  31. //初始用药方式下拉选
  32. initSupplyTypes();
  33. //加载候诊患者列表
  34. loadUnClinicTableList();
  35. //加载接诊中患者列表
  36. loadInClinicTableList();
  37. //加载已接诊患者列表
  38. loadClinicTableList();
  39. //每隔一分钟秒读加载候诊患者列表
  40. setInterval(function () {
  41. //加载候诊患者列表
  42. loadUnClinicTableList();
  43. //加载已接诊患者列表 病人会缴费,需要刷新状态
  44. loadClinicTableList();
  45. }, 60000);
  46. //初始化快速接诊病人姓名栏事件
  47. initUserList();
  48. //初始化主诉弹出层
  49. initRecommendList();
  50. //卡号输入改变事件
  51. cardNoChange();
  52. /**
  53. * 患者信息修改
  54. */
  55. $("#saveEditUser").on("click", function (t) {
  56. modifyPatient();
  57. });
  58. // /**
  59. // * 保存入院证
  60. // */
  61. // $("#saveBeHospitalized").on("click", function (t) {
  62. // saveBeHospitalized();
  63. // });
  64. /**
  65. * 打印入院证
  66. */
  67. $("#printBeHospitalized").on("click", function (t) {
  68. modifyPatient();
  69. });
  70. //折叠按钮初始化
  71. $('.collapse-link').on('click', function () {
  72. var $BOX_PANEL = $(this).closest('.x_panel_mine'),
  73. $ICON = $(this).find('i'),
  74. $BOX_CONTENT = $BOX_PANEL.find('.x_content');
  75. // fix for some div with hardcoded fix class
  76. if ($BOX_PANEL.attr('style')) {
  77. $BOX_CONTENT.slideToggle(200, function () {
  78. $BOX_PANEL.removeAttr('style');
  79. });
  80. } else {
  81. $BOX_CONTENT.slideToggle(200);
  82. $BOX_PANEL.css('height', 'auto');
  83. }
  84. $ICON.toggleClass('fa-chevron-up fa-chevron-down');
  85. });
  86. /**
  87. * 接诊
  88. */
  89. $("#clinicalReception").on("click", function (t) {
  90. var patientIdDb = $("#patientIdDb").val();
  91. if (patientIdDb == null || patientIdDb == "") {
  92. errorMesageSimaple("当前未选择病人,无法接诊");
  93. return;
  94. }
  95. $.ajax({
  96. type: "GET",
  97. url: '/thmz/getMzfzPatientOrderByPatientId?patientId=' + patientIdDb,
  98. contentType: "application/json;charset=UTF-8",
  99. dataType: "json",
  100. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  101. success: function (res) {
  102. if (res == '401' || res == 401) {
  103. window.location.href = '/thmz/login/view'
  104. return;
  105. }
  106. if (res.code == 0) {
  107. if (res.data != null && res.data.length > 0) {
  108. if (res.data.length == 1) {
  109. //快速接诊的时候不知道分诊号
  110. clinicalReception(patientIdDb, res.data[0].serialNo);
  111. } else {
  112. $("#mzfzPatientOrderModal").modal();
  113. $("#mzfzPatientOrderTable").html(null);
  114. for (var i = 0; i < res.data.length; i++) {
  115. var roomCode = res.data[i].roomCode;
  116. if (roomCode == null || roomCode == "null") {
  117. roomCode = "";
  118. }
  119. $("<tr data-target='" + res.data[i].serialNo + "'><td>" + res.data[i].patientId + "</td><td>" + res.data[i].name + "</td><td>" + res.data[i].deptCode + "</td><td>" + res.data[i].doctorCode + "</td><td>" + roomCode + "</td></tr>").appendTo("#mzfzPatientOrderTable").bind('click', function () {
  120. $("#mzfzPatientOrderModal").modal("hide");
  121. clinicalReception(patientIdDb, $(this).attr("data-target"));
  122. });
  123. }
  124. }
  125. clearRapidAcceptsModal();
  126. $("#rapidAcceptsModal").modal("hide");
  127. } else {
  128. errorMesageSimaple("当前病人没有分诊信息");
  129. }
  130. } else {
  131. errorMesage(res);
  132. }
  133. }
  134. });
  135. });
  136. /**
  137. * 存为范本
  138. */
  139. $("#saveapidAccepts").on("click", function (t) {
  140. var symptom = $("#symptom").val();
  141. if (symptom == null || symptom == "") {
  142. errorMesageSimaple("主诉不能为空!");
  143. return;
  144. }
  145. var emrHpi = $("#emrHpi").val();
  146. if (emrHpi == null || emrHpi == "") {
  147. errorMesageSimaple("现病史不能为空!");
  148. return;
  149. }
  150. var diagnoseValue = $("#diagnoseValue").val();
  151. var tentativeDiagnosis = $("#tentativeDiagnosis").val();
  152. if (diagnoseValue != null) {
  153. var reg = new RegExp(',', "g")
  154. diagnoseValue = diagnoseValue.replace(reg, '');
  155. }
  156. if ((diagnoseValue == null || diagnoseValue == "") && (tentativeDiagnosis == null || tentativeDiagnosis == "")) {
  157. errorMesageSimaple("诊断和初步诊断不能同时为空!");
  158. return;
  159. }
  160. $("#saveapidAcceptsModal").modal("show");
  161. });
  162. /**
  163. * 实例化智能问诊弹窗
  164. */
  165. // $("[data-toggle='popover']").popover();
  166. $("#box-arrow-left").popover({
  167. html: 'true',
  168. content: '<div id="smartAssistPopoverContent"></div>'
  169. });
  170. //初始化药品分组下拉选
  171. initGroupOrder();
  172. // 初始化用药天数下拉选
  173. initDayNum();
  174. //页面加载完成初始化西药处方
  175. //initNavTabs(0);
  176. //页面加载完成初始化住院处方
  177. //initNavTabs(3);
  178. //初始医生工作太配置
  179. initWorkspaceConfigForCurrent();
  180. /**
  181. * 西药点击事件
  182. */
  183. $("#western_medicine_name").on("click", function (t) {
  184. var obj = $("#westernMedicinePopoverContent").parent().parent().parent();
  185. if ($(obj).hasClass("in") || $(obj).css("display") == "block") {
  186. $('#western_medicine_name').webuiPopover('hide');
  187. $("#treeButton").webuiPopover('hide');
  188. return;
  189. }
  190. $('#western_medicine_name').webuiPopover('show');
  191. loadYpList(0);
  192. });
  193. /**
  194. * 项目点击事件
  195. */
  196. $("#jcJyItem").on("click", function (t) {
  197. if ($("#jcJyItemPopoverContent").parent().parent().parent().hasClass("in")) {
  198. $('#jcJyItem').webuiPopover('hide');
  199. $("#treeButton").webuiPopover('hide');
  200. return;
  201. }
  202. $('#jcJyItem').webuiPopover('show');
  203. loadjcJyItemList();
  204. });
  205. initYshPart();
  206. initJyZdSample();
  207. setTimeout(function () {
  208. getLodop();
  209. }, 800);
  210. });
  211. /**
  212. * 打开配置页面
  213. */
  214. function configWorkspaceModal() {
  215. initWorkspaceConfigForCurrent();
  216. $("#configWorkspaceModal").modal("show");
  217. }
  218. /**
  219. * 初始化用药天数下拉选
  220. */
  221. function initDayNum() {
  222. var html = '<option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option>';
  223. $('#dayNum').html(html);
  224. $('#dayNum').selectpicker('refresh');
  225. }
  226. /**
  227. * 初始化药品分组下拉选
  228. */
  229. function initGroupOrder() {
  230. var html = '<option value="1">1</option>';
  231. $('#groupId').html(html);
  232. $('#groupId').selectpicker('refresh');
  233. $("#groupId").selectpicker('val', 1);
  234. $('#groupId').selectpicker('refresh');
  235. groupIdMap = new Map();
  236. }
  237. /**
  238. * 追加分组
  239. */
  240. function appendGroupOrder() {
  241. var last = parseInt($("#groupId > option:last").val());
  242. last++;
  243. var html = '<option value="' + last + '">' + last + '</option>';
  244. $('#groupId').append(html);
  245. $('#groupId').selectpicker('refresh');
  246. }
  247. /**
  248. * 组号改变事件
  249. */
  250. function groupIdChange() {
  251. var last = parseInt($("#groupId > option:last").val());
  252. var groupId = $("#groupId").val();
  253. if (groupId == last) {
  254. //是新增药品清空药品输入区域
  255. var updateFlag = $("#update_flag").val();
  256. var currentCode = $("#current_code").val();
  257. //当前时新增药品,而且没有选择药品的时候,组号变更,清空区域
  258. if ((updateFlag == undefined || updateFlag == null || updateFlag == "false" || updateFlag == false) && (currentCode == null || currentCode == "")) {
  259. clearWesternMedicine(true);
  260. }
  261. } else {
  262. var map = groupIdMap.get(groupId);
  263. if (map != null) {
  264. var supplyType = map.get("supplyType");
  265. var orderFrequency = map.get("orderFrequency");
  266. var dayNum = map.get("dayNum");
  267. //用法编码
  268. $("#supplyType").selectpicker('val', supplyType);
  269. $('#supplyType').selectpicker('refresh');
  270. //$("#supplyType").attr("disabled", "disabled");
  271. //天数
  272. $("#dayNum").selectpicker('val', dayNum);
  273. $('#dayNum').selectpicker('refresh');
  274. // $("#dayNum").attr("disabled", "disabled");
  275. //频次编码
  276. $("#orderFrequency").selectpicker('val', orderFrequency);
  277. $('#orderFrequency').selectpicker('refresh');
  278. // $("#orderFrequency").attr("disabled", "disabled");
  279. }
  280. }
  281. }
  282. /**
  283. * 关闭智能问诊弹框
  284. */
  285. function closePopover() {
  286. //$(".popover").popover('hide');
  287. $("#box-arrow-left").click();
  288. }
  289. /**
  290. * 加载智能问诊弹框内容
  291. */
  292. function contentMethod() {
  293. setTimeout(function () {
  294. $(".popover div.arrow").css("display", "none");
  295. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  296. if (popoverId == undefined) {
  297. return;
  298. }
  299. var left = $("#" + popoverId).css("left");
  300. left = left.replace("px", "");
  301. left = parseInt(left);
  302. left = left + 55;
  303. $("#" + popoverId).css("height", "100%").css("top", "0px").css("left", left + "px").css("border-radius", "0px").css("z-index", "11");
  304. $("#" + popoverId + " .popover-content").css("height", "100%");
  305. $("#smartAssistPopoverContent").css("height", "100%");
  306. var html = ' <div style="height: 34%;padding-left: 15px;width: 100%;">' +
  307. ' <button type="button" style="cursor: default;margin-bottom: 0px;margin-right: 0px; font-size: 12px;"' +
  308. ' class="btn btn-primary">' +
  309. ' <span id="patientHisData"></span>就医轨迹' +
  310. ' </button>' +
  311. ' <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true" onclick="closePopover()">×</span>' +
  312. ' </button>' +
  313. ' <div style="height: calc(100% - 39px);border: 1px solid #DDDDDD;margin-top: 5px;width: 100%;">' +
  314. ' <form class="form-horizontal form-label-left mz-fixed-form" novalidate autocomplete="off"' +
  315. ' style="height: 100%;overflow-y: auto;width: 100%;text-align: -webkit-center;position: relative;" id="patientHisDataForm">' +
  316. ' </form>' +
  317. ' </div>' +
  318. ' </div>' +
  319. ' <div style="height: 33%;padding-left: 15px;">' +
  320. ' <button type="button" style="cursor: default;margin-bottom: 0px;margin-right: 0px;margin-top: 5px;"' +
  321. ' class="btn btn-primary">' +
  322. ' <span id="recommendType"></span>推荐' +
  323. ' </button>' +
  324. ' <div style="height: calc(100% - 44px);border: 1px solid #DDDDDD;overflow-y: auto;margin-top: 5px;width: 100%;">' +
  325. ' <form class="form-horizontal form-label-left mz-fixed-form" novalidate autocomplete="off"' +
  326. ' style="height: 100%;overflow-y: auto;width: 100%;text-align: -webkit-center;position: relative;" id="recommendForm">' +
  327. ' <img src="/thmz/images/no-recommend.png" style="height: 120px;position: absolute;top: 50%;transform: translateY(-50%);margin-left: -30px;">' +
  328. ' </form>' +
  329. ' </div>' +
  330. ' </div>' +
  331. ' <div style="height: 33%;padding-left: 15px;">' +
  332. ' <button type="button"' +
  333. ' style="cursor: default;margin-bottom: 0px;margin-right: 0px;margin-top: 5px; font-size: 12px;"' +
  334. ' class="btn btn-primary">' +
  335. ' 医疗范本' +
  336. ' </button>' +
  337. ' <div style="height: calc(100% - 44px);border: 1px solid #DDDDDD;overflow-y: auto;margin-top: 5px;width: 100%;position: relative;">' +
  338. ' <form class="form-horizontal form-label-left mz-fixed-form" novalidate autocomplete="off"' +
  339. ' style="height: 100%;overflow-y: auto;width: 100%;" id="TemplateData">' +
  340. ' </form>' +
  341. ' </div>' +
  342. ' </div>';
  343. $("#smartAssistPopoverContent").html(html);
  344. fitPatientHisData();
  345. fitSymptomData();
  346. fitEmrHpiData();
  347. fitEmrPsData();
  348. fitDiagnoseData();
  349. fitTemplateData();
  350. }, 100);
  351. // setTimeout(function () {
  352. // $("#patientHisDataForm").html("aadsasfasdfasdfasdfasdfsdfasdfasdfasdfdfafda");
  353. // },1000);
  354. }
  355. /**
  356. * 设置患者的就诊轨迹
  357. */
  358. function fitPatientHisData() {
  359. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  360. if (!$("#" + popoverId).hasClass("in")) {
  361. return;
  362. }
  363. var emptyHtml = '<img src="/thmz/images/locus.png" style="height: 120px;position: absolute;top: 50%;transform: translateY(-50%);margin-left: -30px;">';
  364. if ($("#patientId").val() == null || $("#patientId").val() == "") {
  365. $("#patientHisDataForm").html(emptyHtml);
  366. return;
  367. }
  368. $.ajax({
  369. type: "POST",
  370. url: '/thmz/getClinicWithPage',
  371. contentType: "application/json;charset=UTF-8",
  372. dataType: "json",
  373. data: JSON.stringify({
  374. "patientId": $("#patientId").val(),
  375. //"clinicStatuses": [5, 6],
  376. "clinicStatuses": [6],
  377. "pageSize": 10000,
  378. "offset": 0,
  379. "beginDate": "2012-02-01 00:00:00",
  380. "endDate": format(new Date(), "yyyy-MM-dd HH:mm:ss"),
  381. "doctorCode": "-1"
  382. }),
  383. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  384. success: function (res) {
  385. if (res == '401' || res == 401) {
  386. window.location.href = '/thmz/login/view'
  387. return;
  388. }
  389. if (res.code == 0) {
  390. var html = '';
  391. var data = res.data;
  392. if (data == null || data.length == 0) {
  393. html += emptyHtml;
  394. } else {
  395. for (var i = 0; i < data.length; i++) {
  396. var icdText = data[i].icdText;
  397. if (icdText == null) {
  398. // continue;
  399. icdText = "空白诊断";
  400. }
  401. icdText = icdText.trim();
  402. html += ' <div class="item form-group thmz_alert" style="padding: 10px 0;width: 100%;">';
  403. html += ' <div style="float: left;width: 172px;">';
  404. html += ' <img src="/thmz/css/bootstrap/bootstrap-icons-1.5.0/stopwatch.svg"';
  405. html += ' style="margin-left: 10px!important;vertical-align: -.15em;margin-right: 10px!important;"/>';
  406. html += ' <span style="width: 120px;margin-right: 20px!important;">' + format(data[i].opDay, "yyyy-MM-dd HH:mm") + '</span>';
  407. html += ' </div>';
  408. html += ' <div style="text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 172px);"';
  409. html += ' title="' + icdText + '">诊断:<a style="cursor: pointer; color: #2e69eb;"';
  410. html += ' onclick="visitingDetailModal(\'' + data[i].patientId + '\',' + data[i].times + ',' + data[i].id + ',' + data[i].clinicStatus + ')">' + icdText + '</a>';
  411. html += ' </div>';
  412. html += ' </div>';
  413. }
  414. }
  415. $("#patientHisData").text($("#patientName").text() + "的");
  416. if ($("#patientId").val() == null || $("#patientId").val() == "") {
  417. $("#patientHisDataForm").html(emptyHtml);
  418. } else {
  419. $("#patientHisDataForm").html(html);
  420. }
  421. } else {
  422. errorMesage(res);
  423. }
  424. }
  425. });
  426. }
  427. /**
  428. * 设置主诉推荐
  429. */
  430. function fitSymptomData() {
  431. fitRecommendData(12);
  432. }
  433. /**
  434. * 设置现病史推荐
  435. */
  436. function fitEmrHpiData() {
  437. fitRecommendData(5);
  438. }
  439. /**
  440. * 设置既往史推荐
  441. */
  442. function fitEmrPsData() {
  443. fitRecommendData(6);
  444. }
  445. /**
  446. * 设置诊断推荐
  447. */
  448. function fitDiagnoseData() {
  449. fitRecommendData(13);
  450. }
  451. /**
  452. * 设置推荐通用方法
  453. */
  454. function fitRecommendData(paramsType) {
  455. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  456. if (!$("#" + popoverId).hasClass("in")) {
  457. return;
  458. }
  459. var inputId = "symptom";
  460. var text = "主诉";
  461. if (paramsType == 5) {
  462. inputId = "emrHpi";
  463. text = "现病史";
  464. } else if (paramsType == 6) {
  465. inputId = "emrPs";
  466. text = "既往史";
  467. } else if (paramsType == 13) {
  468. inputId = "diagnose";
  469. text = "诊断";
  470. }
  471. //光标不在现病史上
  472. if (document.activeElement.id != inputId) {
  473. return;
  474. }
  475. $("#recommendType").html(text);
  476. var emptyHtml = '<img src="/thmz/images/no-recommend.png" style="height: 120px;position: absolute;top: 50%;transform: translateY(-50%);margin-left: -30px;">';
  477. $.ajax({
  478. type: "GET",
  479. url: '/thmz/getTCommonParamsByParamsType?paramsType=' + paramsType + '&commonParams=&pageSize=10',
  480. contentType: "application/json;charset=UTF-8",
  481. dataType: "json",
  482. async: false,
  483. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  484. success: function (res) {
  485. if (res == '401' || res == 401) {
  486. window.location.href = '/thmz/login/view'
  487. return;
  488. }
  489. if (res.code == 0) {
  490. var html = '';
  491. var data = res.data;
  492. if (data == null || data.length == 0) {
  493. html += emptyHtml;
  494. } else {
  495. for (var i = 0; i < data.length; i++) {
  496. var paramsContent = data[i].paramsContent;
  497. html += ' <div class="item form-group thmz_alert" style="padding: 10px 0;width: 100%;">';
  498. html += ' <div style="margin-left: 10px;float: left;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 60px);" title="' + paramsContent + '">';
  499. html += paramsContent;
  500. html += ' </div>';
  501. html += ' <div style="float: left;width: 36px;cursor: pointer;"';
  502. html += ' onclick="fitAppeal(\'' + paramsContent + '\',' + paramsType + ',' + data[i].id + ')">';
  503. html += ' <img';
  504. html += ' src="/thmz/css/bootstrap/bootstrap-icons-1.5.0/cursor-fill.svg"';
  505. html += ' style="margin-left: 10px!important;vertical-align: -.15em;margin-right: 10px!important;"/>';
  506. html += ' </div>';
  507. html += ' </div>';
  508. }
  509. }
  510. $("#recommendForm").html(html);
  511. } else {
  512. errorMesage(res);
  513. }
  514. }
  515. });
  516. }
  517. /**
  518. * 设置医疗范文方法
  519. */
  520. function fitTemplateData() {
  521. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  522. if (!$("#" + popoverId).hasClass("in")) {
  523. return;
  524. }
  525. var emptyHtml = '<img src="/thmz/images/no-recommend.png" style="height: 120px;position: absolute;top: 50%;transform: translateY(-50%);margin-left: -30px;margin-left: 145px;">';
  526. $.ajax({
  527. type: "GET",
  528. url: '/thmz/getTemplate',
  529. contentType: "application/json;charset=UTF-8",
  530. dataType: "json",
  531. async: false,
  532. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  533. success: function (res) {
  534. if (res == '401' || res == 401) {
  535. window.location.href = '/thmz/login/view'
  536. return;
  537. }
  538. if (res.code == 0) {
  539. var html = '';
  540. var data = res.data;
  541. if (data == null || data.length == 0) {
  542. html += emptyHtml;
  543. } else {
  544. for (var i = 0; i < data.length; i++) {
  545. var template = data[i];
  546. html += ' <div class="item form-group thmz_alert" style="padding: 10px 0;width: 100%;">';
  547. html += ' <div title="' + template.name + '"';
  548. html += ' style="margin-left: 10px!important;float: left;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: 100px;">';
  549. html += template.name;
  550. html += ' </div>';
  551. html += ' <div style="float: left;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 160px);"';
  552. html += ' title="' + template.icdText + '">诊断:<a';
  553. html += ' style="cursor: pointer; color: #2e69eb;"';
  554. html += ' onclick="medicalModelModal(' + template.id + ')">' + template.icdText + '</a>';
  555. html += ' </div>';
  556. html += ' <div style="float: left;width: 36px;cursor: pointer;" onclick="medicalModelModal(' + template.id + ')"><img';
  557. html += ' src="/thmz/css/bootstrap/bootstrap-icons-1.5.0/cursor-fill.svg"';
  558. html += ' style="margin-left: 10px!important;vertical-align: -.15em;margin-right: 10px!important;"/>';
  559. html += ' </div>';
  560. html += ' </div>';
  561. }
  562. }
  563. $("#TemplateData").html(html);
  564. } else {
  565. errorMesage(res);
  566. }
  567. }
  568. });
  569. }
  570. /**
  571. * 清空快速接诊弹窗
  572. */
  573. function clearRapidAcceptsModal() {
  574. $("#rapidAcceptsUserName").val(null);
  575. $("#rapidAcceptsUserCode").val(null);
  576. $("#patientIdDb").val(null);
  577. $("#rapidAcceptsUserCardNo").val(null);
  578. $("#rapidAcceptsUserGender").selectpicker('val', 0);
  579. $("#rapidAcceptsUserGender").selectpicker('refresh');
  580. $("#rapidAcceptsUserPhoneNum").val(null);
  581. $("#rapidAcceptsUserIdCard").val(null);
  582. $("#rapidAcceptsUserIdCard").attr("title", null);
  583. $("#rapidAcceptsUserPhoneNum").attr("title", null);
  584. }
  585. /**
  586. * 清空接诊台用户信息
  587. * @param flag 是否清空分诊流水哈 true 清空
  588. */
  589. function clearUser(flag) {
  590. $("#patientName").html("");
  591. $("#patientAge").html("");
  592. $("#patientGender").html("");
  593. $("#patientId").val(null);
  594. $("#editUser").css("display", "none");
  595. $("#clearUser").css("display", "none");
  596. $("#patientPhone").html("");
  597. $("#patientPhoneLabel").hide();
  598. $("#patientResponseType").html("");
  599. $("#first").next().click();
  600. $("#patientHisData").text("");
  601. if (flag) {
  602. $("#mzfzSerialNoInClick").val(null);
  603. }
  604. }
  605. /**
  606. * 卡号输入改变事件
  607. */
  608. function cardNoChange() {
  609. if (window.ActiveXObject || "ActiveXObject" in window) {
  610. $("#rapidAcceptsUserCardNo").on('input propertychange', function () {
  611. queryUserInfoByCardNo();
  612. });
  613. } else {
  614. $("#rapidAcceptsUserCardNo").on('input οninput', function () {
  615. queryUserInfoByCardNo();
  616. });
  617. }
  618. }
  619. /**
  620. * 刷新就诊列表
  621. */
  622. function refreshClinic() {
  623. loadInClinicTableList();
  624. loadClinicTableList();
  625. }
  626. /**
  627. * 加载已接诊患者列表
  628. */
  629. function loadClinicTableList() {
  630. //loadCommonClinicTableList("tb_table_clinic","/thmz/getClinicWithPage");
  631. loadCommonClinicTableList("tb_table_clinic", queryParamsClinic);
  632. }
  633. /**
  634. * 加载患者列表通用方法
  635. * @param id
  636. * @param queryParams
  637. */
  638. function loadCommonClinicTableList(id, queryParams) {
  639. $('#' + id).bootstrapTable('refresh');
  640. $('#' + id).bootstrapTable({
  641. url: "/thmz/getClinicWithPage", //请求后台的URL(*)
  642. method: 'post', //请求方式(*)
  643. toolbar: '#toolbar', //工具按钮用哪个容器
  644. striped: true, //是否显示行间隔色
  645. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  646. pagination: true, //是否显示分页(*)
  647. sortable: true, //是否启用排序
  648. sortOrder: "asc", //排序方式
  649. queryParams: queryParams, //传递参数(*)
  650. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  651. pageNumber: 1, //初始化加载第一页,默认第一页
  652. pageSize: 5, //每页的记录行数(*)
  653. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  654. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  655. strictSearch: true,
  656. showColumns: false, //是否显示所有的列
  657. showRefresh: false, //是否显示刷新按钮
  658. minimumCountColumns: 2, //最少允许的列数
  659. clickToSelect: true, //是否启用点击选中行
  660. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  661. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  662. cardView: false, //是否显示详细视图
  663. detailView: false,
  664. //rowStyle:rowStyle,//通过自定义函数设置行样式
  665. ajaxOptions: {
  666. headers: {
  667. 'Accept': 'application/json',
  668. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  669. }
  670. },
  671. columns: [
  672. {
  673. field: 'patientName',
  674. title: '姓名/性别/年龄',
  675. align: "center",
  676. valign: 'middle',
  677. // sortable: true
  678. formatter: function (value, row, index) {
  679. return value + "/" + row.gender + "/" + row.age + "岁";
  680. }
  681. }, {
  682. field: 'opDay',
  683. title: '接诊时间',
  684. align: "center",
  685. valign: 'middle',
  686. // sortable: true
  687. formatter: function (value, row, index) {
  688. return format(value, "MM/dd HH:mm");
  689. }
  690. }
  691. , {
  692. title: '操作',
  693. align: "center",
  694. valign: 'middle',
  695. // sortable: true,
  696. formatter: function (value, row, index) {
  697. if (row.clinicStatus == 5) {
  698. return '<a title="修改" style="cursor: pointer" onclick="getMzPrescriptionVoUnPaid(\'' + row.patientId + '\',' + row.times + ',' + row.id + ')">修改</a>&nbsp;<a title="详情" style="cursor: pointer" onclick="prescriptionDetail(\'' + row.patientId + '\',' + row.times + ',' + row.id + ',5)">详情</a>';
  699. // return '<a title="修改" style="cursor: pointer" onclick="getMzPrescriptionVoUnPaid(\'' + row.patientId + '\',' + row.times + ',' + row.id + ')">修改</a>&nbsp;<a title="接诊" style="cursor: pointer" onclick="repeatAccepts(\'' + row.patientId + '\',' + row.times + ',' + row.id + ',\'' + row.deptCode + '\')">接诊</a>&nbsp;<a title="详情" style="cursor: pointer" onclick="prescriptionDetail(\'' + row.patientId + '\',' + row.times + ',' + row.id + ',5)">详情</a>';
  700. } else if (row.clinicStatus == 6) {
  701. return '<a title="接诊" style="cursor: pointer" onclick="repeatAccepts(\'' + row.patientId + '\',' + row.times + ',' + row.id + ',\'' + row.deptCode + '\')">接诊</a>&nbsp;<a title="详情" style="cursor: pointer" onclick="prescriptionDetail(\'' + row.patientId + '\',' + row.times + ',' + row.id + ',0)">详情</a>';
  702. } else if (row.clinicStatus == 7) {
  703. return '<a title="接诊" style="cursor: pointer" onclick="repeatAccepts(\'' + row.patientId + '\',' + row.times + ',' + row.id + ',\'' + row.deptCode + '\')">接诊</a>&nbsp;<a title="详情" style="cursor: pointer" onclick="prescriptionDetail(\'' + row.patientId + '\',' + row.times + ',' + row.id + ',1)">详情</a>';
  704. }
  705. }
  706. }
  707. ],
  708. responseHandler: function (res) {
  709. if (res == '401' || res == 401) {
  710. window.location.href = '/thmz/login/view'
  711. return;
  712. }
  713. var ress = eval(res);
  714. if (ress.code == -1) {
  715. new PNotify({
  716. title: '错误提示',
  717. text: ress.message,
  718. type: 'error',
  719. hide: false,
  720. styling: 'bootstrap3'
  721. });
  722. return {
  723. "total": 0,//总页数
  724. "rows": {} //数据
  725. };
  726. }
  727. return {
  728. "total": ress.total,//总页数
  729. "rows": ress.data //数据
  730. };
  731. },
  732. onLoadSuccess: function (data) {
  733. $(".pagination-detail").css("display", "none");
  734. if (id == "tb_table_clinic") {
  735. $("#ClinicNum").html(data.total);
  736. } else {
  737. $("#inClinicNum").html(data.total);
  738. }
  739. }
  740. });
  741. }
  742. /**
  743. * 得到查询的参数 接诊中
  744. * @param params
  745. * @returns {{mzyReqrec: {unitCode: string | number | string[] | undefined | jQuery, doctorCode: string | number | string[] | undefined | jQuery, name: string | number | string[] | undefined | jQuery}, beginTime: Date, endTime: Date, pageSize: *, pageIndex: number}}
  746. */
  747. function queryParamsInClinic(params) {
  748. var temp = {
  749. pageSize: params.limit,
  750. pageIndex: params.offset / params.limit, //页码
  751. statusFlagList: [8]
  752. };
  753. return temp;
  754. };
  755. /**
  756. * 得到查询的参数
  757. * @param params
  758. * @returns {{mzyReqrec: {unitCode: string | number | string[] | undefined | jQuery, doctorCode: string | number | string[] | undefined | jQuery, name: string | number | string[] | undefined | jQuery}, beginTime: Date, endTime: Date, pageSize: *, pageIndex: number}}
  759. */
  760. function queryParamsClinic(params) {
  761. var rePortRangeArr = getRePortRangeArr();
  762. var temp = {
  763. beginDate: rePortRangeArr[0],
  764. endDate: rePortRangeArr[1],
  765. commonParams: $("#userName").val(),
  766. clinicStatuses: [5, 6, 7],
  767. pageSize: params.limit,
  768. offset: params.offset
  769. };
  770. return temp;
  771. };
  772. /**
  773. * 加载待诊患者列表方法
  774. */
  775. function loadUnClinicTableList() {
  776. loadCanClinicTableList("tb_table_un_clinic", queryParamsUnClinic);
  777. }
  778. /**
  779. * 加载接诊中患者列表方法
  780. */
  781. function loadInClinicTableList() {
  782. loadCanClinicTableList("tb_table_in_clinic", queryParamsInClinic);
  783. }
  784. /**
  785. * 加载待诊和接诊中患者列表通用方法方法
  786. */
  787. function loadCanClinicTableList(id, queryParams) {
  788. $('#' + id).bootstrapTable('refresh');
  789. $('#' + id).bootstrapTable({
  790. url: "/thmz/getUnClinicWithPage", //请求后台的URL(*)
  791. method: 'post', //请求方式(*)
  792. toolbar: '#toolbar', //工具按钮用哪个容器
  793. striped: true, //是否显示行间隔色
  794. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  795. pagination: true, //是否显示分页(*)
  796. sortable: true, //是否启用排序
  797. sortOrder: "asc", //排序方式
  798. queryParams: queryParams, //传递参数(*)
  799. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  800. pageNumber: 1, //初始化加载第一页,默认第一页
  801. pageSize: 5, //每页的记录行数(*)
  802. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  803. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  804. strictSearch: true,
  805. showColumns: false, //是否显示所有的列
  806. showRefresh: false, //是否显示刷新按钮
  807. minimumCountColumns: 2, //最少允许的列数
  808. clickToSelect: true, //是否启用点击选中行
  809. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  810. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  811. cardView: false, //是否显示详细视图
  812. detailView: false,
  813. //rowStyle:rowStyle,//通过自定义函数设置行样式
  814. ajaxOptions: {
  815. headers: {
  816. 'Accept': 'application/json',
  817. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  818. }
  819. },
  820. columns: [
  821. {
  822. field: 'name',
  823. title: '姓名/性别/年龄',
  824. align: "center",
  825. valign: 'middle',
  826. // sortable: true
  827. formatter: function (value, row, index) {
  828. return value + "/" + row.gender + "/" + row.age + "岁";
  829. }
  830. }, {
  831. field: 'visitDate',
  832. title: '分诊时间',
  833. align: "center",
  834. valign: 'middle',
  835. // sortable: true
  836. formatter: function (value, row, index) {
  837. return format(value, "MM/dd HH:mm");
  838. }
  839. }
  840. , {
  841. title: '操作',
  842. align: "center",
  843. valign: 'middle',
  844. // sortable: true,
  845. formatter: function (value, row, index) {
  846. if (row.statusFlag == 0) {
  847. return '<a title="接诊" onclick="clinicalReception(\'' + row.patientId + '\',\'' + row.serialNo + '\')" style="cursor: pointer">接诊</a>';
  848. } else if (row.statusFlag == 8) {
  849. //TODO 继续接诊需要新方法
  850. return '<a title="继续接诊" onclick="clinicalReception(\'' + row.patientId + '\',\'' + row.serialNo + '\')" style="cursor: pointer">继续接诊</a>';
  851. } else if (row.statusFlag == 1 || row.statusFlag == 2 || row.statusFlag == 3) {
  852. return '<a title="通知" onclick="clinicCallNumber(\'' + row.serialNo + '\')" style="cursor: pointer">通知</a>&nbsp;<a title="接诊" onclick="clinicalReception(\'' + row.patientId + '\',\'' + row.serialNo + '\')" style="cursor: pointer">接诊</a>';
  853. }
  854. }
  855. }
  856. ],
  857. responseHandler: function (res) {
  858. if (res == '401' || res == 401) {
  859. window.location.href = '/thmz/login/view'
  860. return;
  861. }
  862. var ress = eval(res);
  863. if (ress.code == -1) {
  864. new PNotify({
  865. title: '错误提示',
  866. text: ress.message,
  867. type: 'error',
  868. hide: false,
  869. styling: 'bootstrap3'
  870. });
  871. return {
  872. "total": 0,//总页数
  873. "rows": {} //数据
  874. };
  875. }
  876. return {
  877. "total": ress.total,//总页数
  878. "rows": ress.data //数据
  879. };
  880. },
  881. onLoadSuccess: function (data) {
  882. $(".pagination-detail").css("display", "none");
  883. $("#unClinicNum").html(data.total);
  884. }
  885. });
  886. }
  887. /**
  888. * 得到查询的参数
  889. * @param params
  890. * @returns {{mzyReqrec: {unitCode: string | number | string[] | undefined | jQuery, doctorCode: string | number | string[] | undefined | jQuery, name: string | number | string[] | undefined | jQuery}, beginTime: Date, endTime: Date, pageSize: *, pageIndex: number}}
  891. */
  892. function queryParamsUnClinic(params) {
  893. var temp = {
  894. pageSize: params.limit,
  895. pageIndex: params.offset / params.limit, //页码
  896. statusFlagList: [0, 1, 2, 3]
  897. };
  898. return temp;
  899. };
  900. /**
  901. * 通知叫号
  902. * @param serialNo
  903. */
  904. function clinicCallNumber(serialNo) {
  905. $.ajax({
  906. type: "GET",
  907. url: '/thmz/clinicCallNumber?serialNo=' + serialNo,
  908. contentType: "application/json;charset=UTF-8",
  909. dataType: "json",
  910. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  911. success: function (res) {
  912. if (res == '401' || res == 401) {
  913. window.location.href = '/thmz/login/view'
  914. return;
  915. }
  916. if (res.code == 0) {
  917. successMesage(res);
  918. } else {
  919. errorMesage(res);
  920. }
  921. }
  922. });
  923. }
  924. /**
  925. * 接诊方法
  926. * @param patientId 门诊id
  927. * @param serialNo 分诊流水号
  928. */
  929. function clinicalReception(patientId, serialNo) {
  930. var existPatientId = $("#patientId").val();
  931. if (existPatientId != null && existPatientId != "" && existPatientId != patientId) {
  932. $("#messageModal").modal();
  933. $("#messageContent").html("当前有病人正在接诊,是否切换?");
  934. $("#messageButton").off("click").on("click", function (t) {
  935. $("#messageModal").modal("hide");
  936. //当前有人在接诊,提示是否需要切换和保存
  937. $("#messagePrescriptionModal").modal();
  938. $("#confirmPrescriptionButton").off("click").on("click", function (t) {
  939. $("#messagePrescriptionModal").modal("hide");
  940. //先保存目前接诊信息,再切换就诊人
  941. var jsonData = getParamsForpPrescription();
  942. $.ajax({
  943. type: "POST",
  944. url: '/thmz/savePrescription',
  945. contentType: "application/json;charset=UTF-8",
  946. dataType: "json",
  947. data: JSON.stringify(jsonData),
  948. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  949. success: function (res) {
  950. if (res == '401' || res == 401) {
  951. window.location.href = '/thmz/login/view'
  952. return;
  953. }
  954. if (res.code == 0) {
  955. clearWorkSpace();
  956. realClinicalReception(patientId, serialNo);
  957. //加载已接诊患者列表
  958. loadClinicTableList();
  959. } else {
  960. errorMesage(res);
  961. }
  962. }
  963. });
  964. });
  965. $("#cancelPrescriptionButton").off("click").on("click", function (t) {
  966. $("#messagePrescriptionModal").modal("hide");
  967. clearWorkSpace();
  968. realClinicalReception(patientId, serialNo);
  969. });
  970. });
  971. } else {
  972. realClinicalReception(patientId, serialNo);
  973. }
  974. }
  975. /**
  976. * 设置当前接诊病人信息
  977. * @param mzPatientMi
  978. */
  979. function setMzPatientInfo(mzPatientMi) {
  980. $("#patientName").html(mzPatientMi.name);
  981. $("#patientAge").html(mzPatientMi.age);
  982. $("#patientGender").html(mzPatientMi.gender);
  983. $("#patientId").val(mzPatientMi.patientId);
  984. $("#editUser").css("display", "inline-block");
  985. $("#clearUser").css("display", "inline-block");
  986. if (mzPatientMi.phoneNo != null && mzPatientMi.phoneNo != '') {
  987. $("#patientPhone").html(mzPatientMi.phoneNo);
  988. $("#patientPhoneLabel").show();
  989. } else {
  990. $("#patientPhoneLabel").hide();
  991. }
  992. $("#patientResponseType").html(mzPatientMi.responseTypeName);
  993. if (mzPatientMi.times == 1) {
  994. $("#first").next().click();
  995. } else {
  996. $("#not").next().click();
  997. }
  998. $("#patientHisData").text(mzPatientMi.name);
  999. fitPatientHisData();
  1000. }
  1001. /**
  1002. * 真实的接诊方法
  1003. * @param patientId
  1004. * @param serialNo 分诊流水号
  1005. */
  1006. function realClinicalReception(patientId, serialNo) {
  1007. $.ajax({
  1008. type: "GET",
  1009. url: '/thmz/saveClinic?patientId=' + patientId + "&serialNo=" + serialNo,
  1010. contentType: "application/json;charset=UTF-8",
  1011. dataType: "json",
  1012. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1013. success: function (res) {
  1014. if (res == '401' || res == 401) {
  1015. window.location.href = '/thmz/login/view'
  1016. return;
  1017. }
  1018. if (res.code == 0) {
  1019. if (res.data != null) {
  1020. var mzPatientMi = res.data;
  1021. setMzPatientInfo(mzPatientMi);
  1022. $("#mzfzSerialNoInClick").val(serialNo);
  1023. //加载候诊患者列表
  1024. loadUnClinicTableList();
  1025. //加载接诊中患者列表
  1026. loadInClinicTableList();
  1027. }
  1028. } else {
  1029. errorMesage(res);
  1030. }
  1031. }
  1032. });
  1033. }
  1034. /**
  1035. * 清空工作台
  1036. */
  1037. function clearWorkSpace() {
  1038. clearUser(true);
  1039. clearWorkSpaceExcludeUser();
  1040. }
  1041. /**
  1042. * 清空工作台除了用户信息
  1043. */
  1044. function clearWorkSpaceExcludeUser() {
  1045. $("#symptom").val(null);
  1046. $("#emrHpi").val(null);
  1047. $("#emrPs").val(null);
  1048. $("#personalHistory").val(null);
  1049. $("#familyHistory").val(null);
  1050. $("#obstericalHistory").val(null);
  1051. $("#weight").val(null);
  1052. $("#temperature").val(null);
  1053. $("#sphygmus").val(null);
  1054. $("#breathe").val(null);
  1055. $("#pressure_high").val(null);
  1056. $("#pressure_floor").val(null);
  1057. $("#pressure_high_left").val(null);
  1058. $("#pressure_floor_left").val(null);
  1059. $("#tentativeDiagnosis").val(null);
  1060. $("#otherCheck").val(null);
  1061. $("#diagnoseValue").val(null);
  1062. $("#diagnoseTags").html(null);
  1063. $("#healthEducation").html(null);
  1064. clearWesternMedicine(true);
  1065. clearChineseMedicine();
  1066. clearJyJcItem();
  1067. clearZyReq();
  1068. //initNavTabs(0);
  1069. clearNavTabs(0);
  1070. clearNavTabs(1);
  1071. clearNavTabs(2);
  1072. clearNavTabs(3);
  1073. clearApidAcceptsModal();
  1074. $("#totalAmount").text(0);
  1075. }
  1076. /**
  1077. * 医疗范文详情预览
  1078. * @param id
  1079. */
  1080. function medicalModelModal(id) {
  1081. $.ajax({
  1082. type: "GET",
  1083. url: '/thmz/getTemplateById?id=' + id,
  1084. contentType: "application/json;charset=UTF-8",
  1085. dataType: "json",
  1086. async: false,
  1087. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1088. success: function (res) {
  1089. if (res == '401' || res == 401) {
  1090. window.location.href = '/thmz/login/view'
  1091. return;
  1092. }
  1093. if (res.code == 0) {
  1094. var jsonData = JSON.parse(res.data.templateData);
  1095. $("#vmedicalModelName").text(res.data.name);
  1096. $("#idTemplate").val(res.data.id);
  1097. $("#zsTemplate").html(jsonData.mzBlRecord.emrChiefComplaint);
  1098. $("#xbsTemplate").html(jsonData.mzBlRecord.emrHpi);
  1099. var icdText = res.data.icdText;
  1100. $("#zdTemplate").html("");
  1101. $("#xyzlContent").html("");
  1102. $("#zyzlContent").html("");
  1103. $("#zlyjContent").html("");
  1104. if (icdText != null) {
  1105. var arr = icdText.split(",");
  1106. var html = "";
  1107. for (var i = 0; i < arr.length; i++) {
  1108. if (i == 0) {
  1109. html += ' <div class="tagZdy tagZdy-back">';
  1110. } else {
  1111. html += ' <div class="tagZdy tagZdy-back-green">';
  1112. }
  1113. html += arr[i];
  1114. html += '</div>';
  1115. }
  1116. $("#zdTemplate").html(html);
  1117. }
  1118. var emrProcess = jsonData.mzBlRecord.emrProcess;
  1119. if (emrProcess != null) {
  1120. var xy = null;
  1121. if (emrProcess.indexOf("西药治疗:") >= 0) {
  1122. if (emrProcess.indexOf("中药治疗:") >= 0) {
  1123. xy = emrProcess.substring(emrProcess.indexOf("西药治疗:") + 5, emrProcess.indexOf("中药治疗:"));
  1124. } else if (emrProcess.indexOf("医技与诊疗:") >= 0) {
  1125. xy = emrProcess.substring(emrProcess.indexOf("西药治疗:") + 5, emrProcess.indexOf("医技与诊疗:"));
  1126. } else {
  1127. xy = emrProcess.substring(emrProcess.indexOf("西药治疗:") + 5);
  1128. }
  1129. var arr = xy.split("_");
  1130. if (arr != null && arr.length > 0) {
  1131. var xyhtml = "";
  1132. for (var i = 0; i < arr.length; i++) {
  1133. xyhtml += "<div>";
  1134. xyhtml += arr[i];
  1135. xyhtml += "</div>";
  1136. }
  1137. $("#xyzlContent").html(xyhtml);
  1138. $("#xyzlTitle").removeClass("hide").addClass("in");
  1139. } else {
  1140. $("#xyzlTitle").removeClass("in").addClass("hide");
  1141. }
  1142. } else {
  1143. $("#xyzlTitle").removeClass("in").addClass("hide");
  1144. }
  1145. var zy = null;
  1146. if (emrProcess.indexOf("中药治疗:") >= 0) {
  1147. if (emrProcess.indexOf("医技与诊疗:") >= 0) {
  1148. zy = emrProcess.substring(emrProcess.indexOf("中药治疗:") + 5, emrProcess.indexOf("医技与诊疗:"));
  1149. } else {
  1150. zy = emrProcess.substring(emrProcess.indexOf("中药治疗:") + 5);
  1151. }
  1152. var zyArr = zy.split("_");
  1153. if (zyArr != null && zyArr.length > 0) {
  1154. var zyhtml = "";
  1155. for (var i = 1; i < zyArr.length; i++) {
  1156. zyhtml += "<div>";
  1157. zyhtml += zyArr[i];
  1158. zyhtml += "</div>";
  1159. }
  1160. var zyfs = zyArr[0].substring(zyArr[0].indexOf("付数:") + 3);
  1161. if (zyfs != null && zyfs != "") {
  1162. zyhtml += " <div>";
  1163. zyhtml += ' <div style="text-indent: 2em;">';
  1164. zyhtml += ' <div>';
  1165. zyhtml += 'x<span>';
  1166. zyhtml += zyfs;
  1167. zyhtml += '</span> 付</div></div></div>';
  1168. }
  1169. $("#zyzlContent").html(zyhtml);
  1170. $("#zyzlTitle").removeClass("hide").addClass("in");
  1171. } else {
  1172. $("#zyzlTitle").removeClass("in").addClass("hide");
  1173. }
  1174. } else {
  1175. $("#zyzlTitle").removeClass("in").addClass("hide");
  1176. }
  1177. if (emrProcess.indexOf("医技与诊疗:") >= 0) {
  1178. var zlyj = emrProcess.substring(emrProcess.indexOf("医技与诊疗:") + 6);
  1179. var zlyjArr = zlyj.split("_");
  1180. if (zlyjArr != null && zlyjArr.length > 0) {
  1181. var zlyjhtml = "";
  1182. for (var i = 0; i < zlyjArr.length; i++) {
  1183. zlyjhtml += "<div>";
  1184. zlyjhtml += zlyjArr[i];
  1185. zlyjhtml += "</div>";
  1186. }
  1187. $("#zlyjContent").html(zlyjhtml);
  1188. $("#zlyjTitle").removeClass("hide").addClass("in");
  1189. } else {
  1190. $("#zlyjTitle").removeClass("in").addClass("hide");
  1191. }
  1192. } else {
  1193. $("#zlyjTitle").removeClass("in").addClass("hide");
  1194. }
  1195. }
  1196. } else {
  1197. errorMesage(res);
  1198. }
  1199. }
  1200. });
  1201. $("#medicalModelModal").modal();
  1202. }
  1203. /**
  1204. * 诊疗项目回写
  1205. * @param code
  1206. * @param mzChargeDetail
  1207. */
  1208. function callBackZlDetail(code, mzChargeDetail) {
  1209. //诊疗项目
  1210. $.ajax({
  1211. type: "GET",
  1212. url: '/thmz/getJcJyItemByCommonParams?commonParams=' + code,
  1213. contentType: "application/json;charset=UTF-8",
  1214. dataType: "json",
  1215. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1216. async: false,
  1217. success: function (res) {
  1218. if (res == '401' || res == 401) {
  1219. window.location.href = '/thmz/login/view'
  1220. return;
  1221. }
  1222. if (res.code == 0) {
  1223. if (res.data != null && res.data.length > 0) {
  1224. //如果
  1225. if ($("#zlTab").find("li") == null || $("#zlTab").find("li").length == 0) {
  1226. initNavTabs(2);
  1227. }
  1228. var row = res.data[0];
  1229. $("#jcJyItem").val(row.name);
  1230. $("#jcJyItem").blur();
  1231. $("#jcjyItemPrice").val(row.chargeAmount);
  1232. $("#chargeUnit").val(row.specification);
  1233. $("#current_code").val(row.code);
  1234. $("#remark").val(mzChargeDetail.instructionText);
  1235. $("#jcJyZltype").val(row.type);
  1236. saveJyJcItem(false);
  1237. }
  1238. } else {
  1239. errorMesage(res);
  1240. }
  1241. }
  1242. });
  1243. }
  1244. /**
  1245. * 处方回写
  1246. * @param jsonData 处方数据
  1247. * @param type 回写类型 0 全部回写 1 医疗范文 2 就诊详情
  1248. */
  1249. function editPrescription(jsonData, type) {
  1250. var firstOrNot = jsonData.firstOrNot;
  1251. var conciseRecordsFlagYlfw = $("#conciseRecordsYlfw").parent().hasClass("checked");
  1252. var prescriptionSubsidiaryFlagYlfw = $("#prescriptionSubsidiaryYlfw").parent().hasClass("checked");
  1253. var conciseRecordsFlagJzxq = $("#conciseRecordsJzxq").parent().hasClass("checked");
  1254. var prescriptionSubsidiaryFlagJzxq = $("#prescriptionSubsidiaryJzxq").parent().hasClass("checked");
  1255. if (firstOrNot == 0) {
  1256. $("#first").next().click();
  1257. } else if (firstOrNot == 1) {
  1258. $("#not").next().click();
  1259. }
  1260. if (type == 0 || (type == 1 && conciseRecordsFlagYlfw == true) || (type == 2 && conciseRecordsFlagJzxq == true)) {
  1261. $("#symptom").val(jsonData.mzBlRecord.emrChiefComplaint);
  1262. $("#emrHpi").val(jsonData.mzBlRecord.emrHpi);
  1263. $("#emrPs").val(jsonData.mzBlRecord.emrPs);
  1264. $("#personalHistory").val(jsonData.mzBlRecord.personalHistory);
  1265. $("#familyHistory").val(jsonData.mzBlRecord.familyHistory);
  1266. $("#obstericalHistory").val(jsonData.mzBlRecord.obstericalHistory);
  1267. $("#weight").val(jsonData.mzBlRecord.weight);
  1268. $("#temperature").val(jsonData.mzBlRecord.temperature);
  1269. $("#sphygmus").val(jsonData.mzBlRecord.sphygmus);
  1270. $("#breathe").val(jsonData.mzBlRecord.breathe);
  1271. $("#pressure_high").val(jsonData.mzBlRecord.pressureHigh);
  1272. $("#pressure_floor").val(jsonData.mzBlRecord.pressureFloor);
  1273. $("#pressure_high_left").val(jsonData.mzBlRecord.pressureHighLeft);
  1274. $("#pressure_floor_left").val(jsonData.mzBlRecord.pressureFloorLeft);
  1275. $("#tentativeDiagnosis").val(jsonData.mzBlRecord.tentativeDiagnosis);
  1276. $("#otherCheck").val(jsonData.mzBlRecord.emrPe);
  1277. var icdCode = jsonData.icdCode;
  1278. var icdText = jsonData.icdText;
  1279. var icdCodeArr = icdCode != null ? icdCode.split(",") : null;
  1280. var icdTextArr = icdText != null ? icdText.split(",") : null;
  1281. if (icdCodeArr != null && icdCodeArr.length > 0 && icdTextArr != null && icdTextArr.length > 0) {
  1282. for (var i = 0; i < icdCodeArr.length; i++) {
  1283. fitDiagnoseValue(icdTextArr[i], icdCodeArr[i]);
  1284. }
  1285. }
  1286. $("#healthEducation").val(jsonData.mzBlRecord.emrJkjy);
  1287. }
  1288. if (type == 0 || (type == 1 && prescriptionSubsidiaryFlagYlfw == true) || (type == 2 && prescriptionSubsidiaryFlagJzxq == true)) {
  1289. var mzChargeDetailList = jsonData.mzChargeDetailList;
  1290. var mzZyReq = jsonData.mzZyReq;
  1291. //中药的公共参数是否已经设置了
  1292. var hadSetZyFullParams = false;
  1293. //西药,成药,医材,麻精,中药,诊疗
  1294. if (mzChargeDetailList != null && mzChargeDetailList.length > 0) {
  1295. for (var i = 0; i < mzChargeDetailList.length; i++) {
  1296. var mzChargeDetail = mzChargeDetailList[i];
  1297. var groupNo = mzChargeDetail.groupNo;
  1298. var code = mzChargeDetail.chargeItemCode;
  1299. var serial = mzChargeDetail.serial;
  1300. if (groupNo == "00") {
  1301. callBackZlDetail(code, mzChargeDetail);
  1302. } else if (groupNo == "71" || groupNo == "91" || groupNo == "111" || groupNo == "131") {
  1303. // 71 西成药 91 医材 111 精一 131 精二
  1304. checkYpInfo(code, serial, groupNo, false);
  1305. $("#groupId").selectpicker('val', mzChargeDetail.groupOrder);
  1306. $('#groupId').selectpicker('refresh');
  1307. // 给药方式 同组药品给药方式相同
  1308. $("#supplyType").selectpicker('val', mzChargeDetail.supplyCode);
  1309. $('#supplyType').selectpicker('refresh');
  1310. $("#drugWin").val(mzChargeDetail.drugQuan);
  1311. $("#drugWinUnit").selectpicker('val', mzChargeDetail.drugUnit);
  1312. $('#drugWinUnit').selectpicker('refresh');
  1313. //天数 同组药品天数相同
  1314. $("#dayNum").selectpicker('val', mzChargeDetail.orderDays);
  1315. $('#dayNum').selectpicker('refresh');
  1316. //频次编码 同组药品频次编码相同
  1317. $("#orderFrequency").selectpicker('val', mzChargeDetail.frequency);
  1318. $('#orderFrequency').selectpicker('refresh');
  1319. if (mzChargeDetail.tryFlag == 1 || mzChargeDetail.tryFlag == "1") {
  1320. $("#tryFlag").parent().addClass("checked");
  1321. } else {
  1322. $("#tryFlag").parent().removeClass("checked");
  1323. }
  1324. $("#gross").val(mzChargeDetail.quantity);
  1325. $("#totalRetprice").val(Multiply(mzChargeDetail.quantity, $("#packRetprice").val()).toFixed(2));
  1326. $("#medicalAdvice").selectpicker('val', mzChargeDetail.instructionCode);
  1327. $('#medicalAdvice').selectpicker('refresh');
  1328. saveWesternMedicine(false);
  1329. } else {
  1330. //中药与颗粒剂
  1331. checkZyInfo(code, serial, false);
  1332. //类型
  1333. $("#zyClassType").selectpicker('val', groupNo);
  1334. $('#zyClassType').selectpicker('refresh');
  1335. $("#zy_drugWin").val(mzChargeDetail.quantity);
  1336. $("#zyInstruction").selectpicker('val', mzChargeDetail.instructionCode);
  1337. $('#zyInstruction').selectpicker('refresh');
  1338. saveChineseMedicine(false);
  1339. if (!hadSetZyFullParams) {
  1340. hadSetZyFullParams = true;
  1341. $("input.zyfs").val(mzChargeDetail.drugWin);
  1342. $("#zy_orderFrequency_1").selectpicker('val', mzChargeDetail.frequency);
  1343. $('#zy_orderFrequency_1').selectpicker('refresh');
  1344. $("#useType_1").selectpicker('val', mzChargeDetail.cyFysm);
  1345. $('#useType_1').selectpicker('refresh');
  1346. $("#cyJssm").selectpicker('val', mzChargeDetail.cyJssm);
  1347. $('#cyJssm').selectpicker('refresh');
  1348. $("#zy_supplyType_1").selectpicker('val', mzChargeDetail.cyDj);
  1349. $('#zy_supplyType_1').selectpicker('refresh');
  1350. }
  1351. }
  1352. }
  1353. }
  1354. //检验与检查
  1355. var mzYjReqList = jsonData.mzYjReqList;
  1356. if (mzYjReqList != null && mzYjReqList.length > 0) {
  1357. for (var i = 0; i < mzYjReqList.length; i++) {
  1358. var mzYjReq = mzYjReqList[i];
  1359. var code = mzYjReq.orderCode;
  1360. if (mzYjReq.reqType == 2) {
  1361. $("#jcJyZltype").val(1);
  1362. } else if (mzYjReq.reqType == 3) {
  1363. $("#jcJyZltype").val(2);
  1364. }
  1365. checkJcJyItemInfo(code, null, false);
  1366. $("#remark").val(mzYjReq.jyRemark);
  1367. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  1368. saveJyJcItem(false);
  1369. $("#jcJyItemChargeDetail").removeClass("in").addClass("hide");
  1370. }
  1371. }
  1372. //入院证
  1373. if (mzZyReq != null && mzZyReq.reqDept != null && mzZyReq.reqDept != "") {
  1374. $("#inpatientWardBeHospitalized").selectpicker('val', mzZyReq.reqDept);
  1375. $('#inpatientWardBeHospitalized').selectpicker('refresh');
  1376. initSmallDeptByDept();
  1377. $("#admissStatus").selectpicker('val', mzZyReq.admissStatus);
  1378. $('#admissStatus').selectpicker('refresh');
  1379. setTimeout(function () {
  1380. $("#smallWardBeHospitalized").selectpicker('val', mzZyReq.smallDept);
  1381. $('#smallWardBeHospitalized').selectpicker('refresh');
  1382. saveZyReq(false);
  1383. }, 500);
  1384. }
  1385. }
  1386. //设置总金额
  1387. calculateTotalAmount();
  1388. }
  1389. /**
  1390. * 调用医疗范文
  1391. */
  1392. function callTemplate() {
  1393. clearWorkSpaceExcludeUser();
  1394. $.ajax({
  1395. type: "GET",
  1396. url: '/thmz/increaseNumber?id=' + $("#idTemplate").val(),
  1397. contentType: "application/json;charset=UTF-8",
  1398. dataType: "json",
  1399. async: false,
  1400. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1401. success: function (res) {
  1402. if (res == '401' || res == 401) {
  1403. window.location.href = '/thmz/login/view'
  1404. return;
  1405. }
  1406. if (res.code == 0) {
  1407. var jsonData = JSON.parse(res.data.templateData);
  1408. editPrescription(jsonData, 1);
  1409. $("#templateId").val(res.data.id);
  1410. $("#templateName").val(res.data.name);
  1411. $("#medicalModelModal").modal("hide");
  1412. closePopover();
  1413. } else {
  1414. errorMesage(res);
  1415. }
  1416. }
  1417. });
  1418. }
  1419. /**
  1420. * 底层填充推荐方法
  1421. * @param paramsType
  1422. * @param appeal
  1423. * @param inputId
  1424. */
  1425. function extracted(paramsType, appeal, inputId) {
  1426. if (paramsType == 13) {
  1427. var contentArr = appeal.split(",");
  1428. if (contentArr != null && contentArr.length > 0) {
  1429. for (var i = 0; i < contentArr.length; i++) {
  1430. var content = contentArr[i].replace(")", "").replace("(", "-");
  1431. var diagnoseArr = content.split("-");
  1432. if (diagnoseArr == null || diagnoseArr.length == 0) {
  1433. continue;
  1434. }
  1435. fitDiagnoseValue(diagnoseArr[0], diagnoseArr[1]);
  1436. }
  1437. }
  1438. } else {
  1439. $("#" + inputId).val(appeal);
  1440. }
  1441. }
  1442. /**
  1443. * 填充推荐
  1444. * @param appeal
  1445. * @param paramsType
  1446. * @param id
  1447. */
  1448. function fitAppeal(appeal, paramsType, id) {
  1449. var inputId = "symptom";
  1450. var text = "主诉项已经录入,是否覆盖?";
  1451. if (paramsType == 5) {
  1452. inputId = "emrHpi";
  1453. text = "现病史项已经录入,是否覆盖?";
  1454. } else if (paramsType == 6) {
  1455. inputId = "emrPs";
  1456. text = "既往史项已经录入,是否覆盖?";
  1457. } else if (paramsType == 13) {
  1458. inputId = "diagnoseValue";
  1459. text = "诊断项已经录入,是否覆盖?";
  1460. }
  1461. var symptom = $("#" + inputId).val();
  1462. if (paramsType == 13 && (symptom == ",," || symptom == ",")) {
  1463. symptom = null;
  1464. }
  1465. if (symptom != null && symptom != "") {
  1466. $("#messageModal").modal();
  1467. $("#messageContent").html(text);
  1468. $("#messageButton").off("click").on("click", function (t) {
  1469. $("#messageModal").modal("hide");
  1470. if (paramsType == 13) {
  1471. $("#" + inputId).val(null);
  1472. $("#diagnoseTags").html(null);
  1473. }
  1474. extracted(paramsType, appeal, inputId);
  1475. });
  1476. } else {
  1477. extracted(paramsType, appeal, inputId);
  1478. }
  1479. $.ajax({
  1480. type: "GET",
  1481. url: '/thmz/increaseTcCommonParamsNumber?id=' + id,
  1482. contentType: "application/json;charset=UTF-8",
  1483. dataType: "json",
  1484. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1485. success: function (res) {
  1486. }
  1487. });
  1488. }
  1489. /**
  1490. * 初始嘱托下拉选
  1491. */
  1492. function initInstructionSelect() {
  1493. //西药医嘱
  1494. $.ajax({
  1495. type: "GET",
  1496. url: '/thmz/getMzZdInstructionByType?instructionType=0',
  1497. contentType: "application/json;charset=UTF-8",
  1498. dataType: "json",
  1499. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1500. success: function (res) {
  1501. if (res == '401' || res == 401) {
  1502. window.location.href = '/thmz/login/view'
  1503. return;
  1504. }
  1505. if (res.code == 0) {
  1506. res.data.forEach(function (item, index) {
  1507. var html = '<option value="' + item.code + '">' + item.instructionText + '</option>';
  1508. $('#medicalAdvice').append(html);
  1509. });
  1510. $('#medicalAdvice').selectpicker('refresh');
  1511. } else {
  1512. errorMesage(res);
  1513. }
  1514. }
  1515. });
  1516. //中药医嘱
  1517. $.ajax({
  1518. type: "GET",
  1519. url: '/thmz/getMzZdInstructionByType?instructionType=1',
  1520. contentType: "application/json;charset=UTF-8",
  1521. dataType: "json",
  1522. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1523. success: function (res) {
  1524. if (res == '401' || res == 401) {
  1525. window.location.href = '/thmz/login/view'
  1526. return;
  1527. }
  1528. if (res.code == 0) {
  1529. res.data.forEach(function (item, index) {
  1530. var html = '<option value="' + item.code + '">' + item.instructionText.trim() + '</option>';
  1531. $('#zyInstruction').append(html);
  1532. });
  1533. $('#zyInstruction').selectpicker('refresh');
  1534. } else {
  1535. errorMesage(res);
  1536. }
  1537. }
  1538. });
  1539. }
  1540. /**
  1541. * 设置下拉选的尺寸
  1542. */
  1543. function setSelectSize() {
  1544. $(".selectpicker").selectpicker({
  1545. dropuAuto: false,
  1546. size: 10
  1547. });
  1548. //$('#icdCodeBeHospitalized').parent().addClass("hide");
  1549. }
  1550. /**
  1551. * 初始化性别下拉选
  1552. */
  1553. function initGenderSelect() {
  1554. var gender = '<option value="1">男</option><option value="2">女</option><option value="0">未知</option>';
  1555. $('#rapidAcceptsUserGender').html(gender);
  1556. $('#rapidAcceptsUserGender').selectpicker('refresh');
  1557. $('#editUserGender').html(gender);
  1558. $('#editUserGender').selectpicker('refresh');
  1559. //医疗范文状态
  1560. var templateStatus = '<option value="0">启用</option><option value="1">停用</option>';
  1561. $('#templateStatus').html(templateStatus);
  1562. $('#templateStatus').selectpicker('refresh');
  1563. }
  1564. /**
  1565. * 初始化中药类型下拉选
  1566. */
  1567. function initZyClassTypeSelect() {
  1568. var gender = '<option value="81">普通</option><option value="82">颗粒剂</option>';
  1569. $('#zyClassType').html(gender);
  1570. $('#zyClassType').selectpicker('refresh');
  1571. //$('#zyClassType').selectpicker('val', "81");
  1572. // $('#zyClassType').selectpicker('refresh');
  1573. }
  1574. /**
  1575. * 初始化病人身份类别下拉选
  1576. */
  1577. function initResponceTypeSelect() {
  1578. $.ajax({
  1579. type: "GET",
  1580. url: '/thmz/getMzResponceType',
  1581. contentType: "application/json;charset=UTF-8",
  1582. dataType: "json",
  1583. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1584. success: function (res) {
  1585. if (res == '401' || res == 401) {
  1586. window.location.href = '/thmz/login/view'
  1587. return;
  1588. }
  1589. if (res.code == 0) {
  1590. res.data.forEach(function (item, index) {
  1591. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  1592. $('#patientsNature').append(html);
  1593. $('#editUserPatientsNature').append(html);
  1594. // $('#responeTypeBeHospitalized').append(html);
  1595. });
  1596. $('#patientsNature').selectpicker('refresh');
  1597. $('#editUserPatientsNature').selectpicker('refresh');
  1598. } else {
  1599. errorMesage(res);
  1600. }
  1601. }
  1602. });
  1603. }
  1604. /**
  1605. * 所有的入院状态
  1606. */
  1607. function iniAdmissStatus() {
  1608. $.ajax({
  1609. type: "GET",
  1610. url: '/thmz/getAdmissStatus',
  1611. dataType: "json",
  1612. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1613. success: function (res) {
  1614. if (res == '401' || res == 401) {
  1615. window.location.href = '/thmz/login/view'
  1616. return;
  1617. }
  1618. var html = '';
  1619. $.each(res.data, function (commentIndex, comment) {
  1620. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  1621. });
  1622. $('#admissStatus').empty();
  1623. $('#admissStatus').html(html);
  1624. $('#admissStatus').selectpicker('destroy').selectpicker('refresh');
  1625. }
  1626. });
  1627. }
  1628. /**
  1629. * 入院登记的病区列表
  1630. */
  1631. function initListDeptSelect() {
  1632. //科室列表
  1633. $.ajax({
  1634. type: "GET",
  1635. url: '/thmz/allInpatientWard',
  1636. dataType: "json",
  1637. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1638. success: function (data) {
  1639. if (data == '401' || data == 401) {
  1640. window.location.href = '/thmz/login/view'
  1641. return;
  1642. }
  1643. var html = '';
  1644. $.each(data.data, function (commentIndex, comment) {
  1645. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';
  1646. });
  1647. $('#inpatientWardBeHospitalized').empty();
  1648. $('#inpatientWardBeHospitalized').html(html);
  1649. $('#inpatientWardBeHospitalized').selectpicker('refresh');
  1650. initSmallDeptByDept();
  1651. }
  1652. });
  1653. }
  1654. /**
  1655. * 小科室列表
  1656. */
  1657. function initSmallDeptByDept() {
  1658. //小科室列表
  1659. $.ajax({
  1660. type: "GET",
  1661. url: '/thmz/getSmallDeptByDept?code=' + $('#inpatientWardBeHospitalized').val(),
  1662. dataType: "json",
  1663. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1664. success: function (res) {
  1665. if (res == '401' || res == 401) {
  1666. window.location.href = '/thmz/login/view'
  1667. return;
  1668. }
  1669. var html = '';
  1670. $.each(res.data, function (commentIndex, comment) {
  1671. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  1672. });
  1673. $('#smallWardBeHospitalized').empty();
  1674. $('#smallWardBeHospitalized').html(html);
  1675. $('#smallWardBeHospitalized').selectpicker('destroy').selectpicker('refresh');
  1676. }
  1677. });
  1678. //病床数
  1679. $.ajax({
  1680. type: "GET",
  1681. url: '/thmz/getBedStatusNumByDept?code=' + $('#inpatientWardBeHospitalized').val(),
  1682. dataType: "json",
  1683. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1684. success: function (res) {
  1685. if (res == '401' || res == 401) {
  1686. window.location.href = '/thmz/login/view'
  1687. return;
  1688. }
  1689. if (res.code == 0) {
  1690. var data = res.data;
  1691. if (data == null) {
  1692. $("#totalBedNum").val(0);
  1693. $("#freeBedNum").val(0);
  1694. $("#occupationBedNum").val(0);
  1695. } else {
  1696. $("#totalBedNum").val(data.total);
  1697. $("#freeBedNum").val(data.free);
  1698. $("#occupationBedNum").val(data.occupation);
  1699. }
  1700. } else {
  1701. errorMesage(res);
  1702. }
  1703. }
  1704. });
  1705. }
  1706. //
  1707. // /**
  1708. // * 初始化诊断下拉选
  1709. // */
  1710. // function initIcdSelect() {
  1711. // var icdCodeInputBeHospitalized = $("#icdCodeInputBeHospitalized").val()
  1712. // $.ajax({
  1713. // type: "GET",
  1714. // url: '/thmz/getTCommonParamsByParamsType?paramsType=4&commonParams=' + icdCodeInputBeHospitalized + '&pageSize=100',
  1715. // contentType: "application/json;charset=UTF-8",
  1716. // dataType: "json",
  1717. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1718. // success: function (res) {
  1719. // if (res == '401' || res == 401) {
  1720. // window.location.href = '/thmz/login/view'
  1721. // return;
  1722. // }
  1723. // var html = '';
  1724. // if (res.code == 0) {
  1725. // if (res.data != null && res.data.length > 0) {
  1726. // var html = '';
  1727. // for (var i = 0; i < res.data.length; i++) {
  1728. // html += '<option value="' + res.data[i].paramsCode + '">' + res.data[i].paramsName + '(' + res.data[i].paramsCode + ')</option>';
  1729. // }
  1730. // $('#icdCodeBeHospitalized').empty();
  1731. // $('#icdCodeBeHospitalized').html(html);
  1732. // $('#icdCodeBeHospitalized').selectpicker('destroy').selectpicker('refresh');
  1733. // $('#icdCodeBeHospitalized').parent().addClass("open");
  1734. // $('#icdCodeBeHospitalized').next().addClass("hide");
  1735. // $('#icdCodeBeHospitalized').next().next().css("margin-top", "-34px");
  1736. // }
  1737. // } else {
  1738. // errorMesage(res);
  1739. // }
  1740. // }
  1741. // });
  1742. // }
  1743. //
  1744. // /**
  1745. // * 设置诊断内容
  1746. // */
  1747. // function setIcdText() {
  1748. // var icdCodeBeHospitalized = $('#icdCodeBeHospitalized option:selected').text();
  1749. // if (icdCodeBeHospitalized != null) {
  1750. // var icdText = icdCodeBeHospitalized.substring(0, icdCodeBeHospitalized.indexOf("("));
  1751. // $("#icdTextBeHospitalized").val(icdText);
  1752. // $("#icdCodeInputBeHospitalized").val($('#icdCodeBeHospitalized').val());
  1753. // $("#icdTextBeHospitalized").attr("title", icdText);
  1754. // } else {
  1755. // $("#icdTextBeHospitalized").val("");
  1756. // $("#icdCodeInputBeHospitalized").val("");
  1757. // $("#icdTextBeHospitalized").attr("title", "");
  1758. // }
  1759. // $('#icdCodeBeHospitalized').parent().addClass("hide");
  1760. // }
  1761. /**
  1762. * 初始化医疗范文类型下拉选
  1763. */
  1764. function initTemplateTypeSelect() {
  1765. $.ajax({
  1766. type: "GET",
  1767. url: '/thmz/getTemplateTypes',
  1768. contentType: "application/json;charset=UTF-8",
  1769. dataType: "json",
  1770. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1771. success: function (res) {
  1772. if (res == '401' || res == 401) {
  1773. window.location.href = '/thmz/login/view'
  1774. return;
  1775. }
  1776. if (res.code == 0) {
  1777. res.data.forEach(function (item) {
  1778. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  1779. $('#templateType').append(html);
  1780. });
  1781. $('#templateType').selectpicker('refresh');
  1782. } else {
  1783. errorMesage(res);
  1784. }
  1785. }
  1786. });
  1787. }
  1788. /**
  1789. * 初始频次下拉选
  1790. * @param id
  1791. * @param async 是否是异步 true 异步 false 同步
  1792. */
  1793. function initOrderFrequencys(id, async) {
  1794. $.ajax({
  1795. type: "GET",
  1796. url: '/thmz/getOrderFrequencys',
  1797. dataType: "json",
  1798. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1799. async: async,
  1800. success: function (res) {
  1801. if (res == '401' || res == 401) {
  1802. window.location.href = '/thmz/login/view'
  1803. return;
  1804. }
  1805. var html = '';
  1806. $.each(res.data, function (commentIndex, comment) {
  1807. html += '<option value="' + comment.code + '" desc="' + comment.times + '">' + comment.name + '(' + comment.code + ')' + '</option>';
  1808. });
  1809. $('#' + id).empty();
  1810. $('#' + id).html(html);
  1811. $('#' + id).selectpicker('refresh');
  1812. }
  1813. });
  1814. }
  1815. /**
  1816. * 初始用药方式下拉选
  1817. */
  1818. function initSupplyTypes() {
  1819. $.ajax({
  1820. type: "GET",
  1821. url: '/thmz/getSupplyTypes',
  1822. dataType: "json",
  1823. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1824. success: function (res) {
  1825. if (res == '401' || res == 401) {
  1826. window.location.href = '/thmz/login/view'
  1827. return;
  1828. }
  1829. var html = '';
  1830. $.each(res.data, function (commentIndex, comment) {
  1831. if (comment.groupNo === "71") {
  1832. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')' + '</option>';
  1833. }
  1834. });
  1835. $('#supplyType').empty();
  1836. $('#supplyType').html(html);
  1837. $('#supplyType').selectpicker('refresh');
  1838. }
  1839. });
  1840. }
  1841. /**
  1842. * 初始煎药方式下拉选
  1843. * @param async 是否是异步 true 异步 false 同步
  1844. */
  1845. function initZySupplyTypes(id, async) {
  1846. setSelectSize();
  1847. $.ajax({
  1848. type: "GET",
  1849. url: '/thmz/getSupplyTypes',
  1850. dataType: "json",
  1851. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1852. async: async,
  1853. success: function (res) {
  1854. if (res == '401' || res == 401) {
  1855. window.location.href = '/thmz/login/view'
  1856. return;
  1857. }
  1858. var html = '';
  1859. $.each(res.data, function (commentIndex, comment) {
  1860. if (comment.groupNo === "81") {
  1861. // html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  1862. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')' + '</option>';
  1863. }
  1864. });
  1865. $('#' + id).empty();
  1866. $('#' + id).html(html);
  1867. $('#' + id).selectpicker('refresh');
  1868. }
  1869. });
  1870. }
  1871. /**
  1872. * 初始查检查部位
  1873. */
  1874. function initYshPart() {
  1875. setSelectSize();
  1876. $.ajax({
  1877. type: "GET",
  1878. url: '/thmz/getYshPart',
  1879. dataType: "json",
  1880. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1881. success: function (res) {
  1882. if (res == '401' || res == 401) {
  1883. window.location.href = '/thmz/login/view'
  1884. return;
  1885. }
  1886. var html = '';
  1887. $.each(res.data, function (commentIndex, comment) {
  1888. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')' + '</option>';
  1889. });
  1890. $('#yshPart').empty();
  1891. $('#yshPart').html(html);
  1892. $('#yshPart').selectpicker('refresh');
  1893. }
  1894. });
  1895. }
  1896. /**
  1897. * 初始化验物下拉选
  1898. */
  1899. function initJyZdSample() {
  1900. setSelectSize();
  1901. $.ajax({
  1902. type: "GET",
  1903. url: '/thmz/getJyZdSample',
  1904. dataType: "json",
  1905. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1906. success: function (res) {
  1907. if (res == '401' || res == 401) {
  1908. window.location.href = '/thmz/login/view'
  1909. return;
  1910. }
  1911. var html = '';
  1912. $.each(res.data, function (commentIndex, comment) {
  1913. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')' + '</option>';
  1914. });
  1915. $('#jyZdSample').empty();
  1916. $('#jyZdSample').html(html);
  1917. $('#jyZdSample').selectpicker('refresh');
  1918. }
  1919. });
  1920. }
  1921. /**
  1922. * 保存当前药品到右边处方区域
  1923. * @param index 0 西药 1中药 2 诊疗和社备
  1924. */
  1925. function saveMedicine(index) {
  1926. if (index == 0) {
  1927. // //每个处方不能超过5个药品
  1928. // var tableId = $("#xyTab li.active").find("a").attr("href");
  1929. // var childrens = $(tableId).find("div:eq(0)").children().length;
  1930. // if (childrens === 5) {
  1931. // $("#messageModal").modal();
  1932. // $("#messageContent").html("单张处方最多只能开具5个药品,是否需要新增处方?");
  1933. // $("#messageButton").off("click").on("click", function (t) {
  1934. // $("#messageModal").modal("hide");
  1935. // refreshNavTabs(index);
  1936. // saveWesternMedicine();
  1937. // });
  1938. // } else {
  1939. // saveWesternMedicine();
  1940. // }
  1941. saveWesternMedicine(true);
  1942. } else if (index == 1) {
  1943. saveChineseMedicine(true);
  1944. }
  1945. }
  1946. /**
  1947. * 保存当前药品到右边处方区域 西药
  1948. * calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  1949. */
  1950. function saveWesternMedicine(calculateTotalAmountFlag) {
  1951. //组号
  1952. var groupId = $("#groupId").val();
  1953. //药品名称
  1954. var westernMedicineNamme = $("#western_medicine_name").val();
  1955. //当前药品编码
  1956. var currentCode = $("#current_code").val();
  1957. //当前药品规格
  1958. var currentSerial = $("#current_serial").val();
  1959. //当前药房编码
  1960. var currentGroupNo = $("#current_groupNo").val();
  1961. //用法编码
  1962. var supplyType = $("#supplyType").val();
  1963. //用法描述
  1964. var supplyTypeText = $('#supplyType option:selected').text();
  1965. //药品默认单次使用剂量
  1966. var drugWinDb = $("#drugWinDb").val();
  1967. //处方实际单次使用剂量
  1968. var drugWin = $("#drugWin").val();
  1969. //剂量单位
  1970. var drugWinUnit = $('#drugWinUnit option:selected').text();
  1971. //天数
  1972. var dayNum = $("#dayNum").val();
  1973. //频次编码
  1974. var orderFrequency = $("#orderFrequency").val();
  1975. //频次描述
  1976. var orderFrequencyText = $('#orderFrequency option:selected').text();
  1977. //总量
  1978. var gross = $("#gross").val();
  1979. //包装单位
  1980. var packUnit = $("#packUnit").val();
  1981. if (packUnit == null) {
  1982. packUnit = "";
  1983. }
  1984. //医嘱码
  1985. var medicalAdvice = $("#medicalAdvice").val();
  1986. //医嘱内容
  1987. var medicalAdviceText = $('#medicalAdvice option:selected').text();
  1988. //金额
  1989. var totalRetprice = parseFloat($("#totalRetprice").val());
  1990. //单价
  1991. var packRetprice = $("#packRetprice").val();
  1992. //皮试
  1993. var tryFlag = $("#tryFlag").parent().hasClass("checked");
  1994. if (currentCode == null || currentCode == '') {
  1995. errorMesageSimaple("未选择任何药品!");
  1996. return;
  1997. }
  1998. if (currentGroupNo != '91') {
  1999. if (supplyType == null || supplyType == "") {
  2000. errorMesageSimaple("用法为空!");
  2001. return;
  2002. }
  2003. if (drugWin == null || drugWin == "") {
  2004. errorMesageSimaple("剂量为空!");
  2005. return;
  2006. }
  2007. if (dayNum == null || dayNum == "") {
  2008. errorMesageSimaple("天数为空!");
  2009. return;
  2010. }
  2011. if (orderFrequency == null || orderFrequency == "") {
  2012. errorMesageSimaple("频次为空!");
  2013. return;
  2014. }
  2015. }
  2016. if (gross == null || gross == "") {
  2017. errorMesageSimaple("总量为空!");
  2018. return;
  2019. }
  2020. var html = '<div class="form-group">';
  2021. html += groupId + '.<span style="margin-left: 5px"></span>';
  2022. html += westernMedicineNamme + ' ';
  2023. html += drugWinDb + drugWinUnit + ' ';
  2024. html += drugWin + drugWinUnit + ' 共';
  2025. html += gross + packUnit + " " + '<br/><span style="margin-left: 15px"></span>';
  2026. html += '用法:' + supplyTypeText + ' ';
  2027. html += '频次:' + orderFrequencyText + ' ';
  2028. html += dayNum + '天 ';
  2029. if (tryFlag == "true" || tryFlag == true) {
  2030. html += '皮试 ';
  2031. }
  2032. if (medicalAdvice != null && medicalAdvice != '') {
  2033. html += '医嘱:' + medicalAdviceText;
  2034. }
  2035. html += ' <i class="fa fa-long-arrow-left" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;margin-left: 10px;" onclick="editWesternMedicine(this)"></i>';
  2036. html += '<i class="fa fa-remove" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;margin-left: 10px;" onclick="removeYpOrProject(0,this)"></i>';
  2037. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  2038. html += '<input type="hidden" class="temporary_items_serial" value="' + currentSerial + '"/>';
  2039. html += '<input type="hidden" class="temporary_items_amount" value="' + totalRetprice + '"/>';
  2040. html += '<input type="hidden" class="temporary_items_groupId" value="' + groupId + '"/>';
  2041. html += '<input type="hidden" class="temporary_items_westernMedicineNamme" value="' + westernMedicineNamme + '"/>';
  2042. html += '<input type="hidden" class="temporary_items_drugWinDb" value="' + drugWinDb + '"/>';
  2043. html += '<input type="hidden" class="temporary_items_drugWin" value="' + drugWin + '"/>';
  2044. html += '<input type="hidden" class="temporary_items_drugWinUnit" value="' + $("#drugWinUnit").val() + '"/>';
  2045. html += '<input type="hidden" class="temporary_items_gross" value="' + gross + '"/>';
  2046. html += '<input type="hidden" class="temporary_items_packUnit" value="' + packUnit + '"/>';
  2047. html += '<input type="hidden" class="temporary_items_supplyType" value="' + supplyType + '"/>';
  2048. html += '<input type="hidden" class="temporary_items_orderFrequency" value="' + orderFrequency + '"/>';
  2049. html += '<input type="hidden" class="temporary_items_dayNum" value="' + dayNum + '"/>';
  2050. html += '<input type="hidden" class="temporary_items_medicalAdvice" value="' + medicalAdvice + '"/>';
  2051. html += '<input type="hidden" class="temporary_items_medicalAdviceText" value="' + medicalAdviceText + '"/>';
  2052. html += '<input type="hidden" class="temporary_items_packRetprice" value="' + packRetprice + '"/>';
  2053. html += '<input type="hidden" class="temporary_items_tryFlag" value="' + tryFlag + '"/>';
  2054. html += '</div>';
  2055. var tableId = $("#xyTab li.active").find("a").attr("href");
  2056. //是新增药品还是编辑 true 修改 默认false
  2057. var updateFlag = $("#update_flag").val();
  2058. if (updateFlag == undefined || updateFlag == null) {
  2059. updateFlag = false;
  2060. }
  2061. // //原药品金额 如果是修改则需要设置
  2062. // var temporaryItemsAmount = 0;
  2063. //当前需要被移除元素的下个兄弟节点
  2064. var nextObj = null;
  2065. //当前修改的药品是不是最后一个
  2066. var isLast = false;
  2067. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  2068. if (formGroups != null && formGroups.length > 0) {
  2069. //如果是修改,需要减去原来的费用
  2070. if (updateFlag == "true" || updateFlag == true) {
  2071. for (var i = 0; i < formGroups.length; i++) {
  2072. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  2073. var temporaryItemsSerial = $(formGroups[i]).find("input.temporary_items_serial").val();
  2074. if (temporaryItemsCode === currentCode && temporaryItemsSerial === currentSerial) {
  2075. //temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  2076. if (formGroups.length > 1) {
  2077. nextObj = $(formGroups[i]).next();
  2078. }
  2079. isLast = (i + 1) === formGroups.length;
  2080. $(formGroups[i]).remove();
  2081. break;
  2082. }
  2083. }
  2084. } else {
  2085. //因为药品可以换组号,要保证相同组号的在一起
  2086. for (var i = 0; i < formGroups.length; i++) {
  2087. var temporaryItemsGroupId = parseInt($(formGroups[i]).find("input.temporary_items_groupId").val());
  2088. //如果当前的组号小与遍历到的组号,说明是原组号的下一个兄弟节点,新的药品插入到兄弟节点前就可以了
  2089. if (temporaryItemsGroupId > groupId) {
  2090. nextObj = $(formGroups[i]);
  2091. break;
  2092. }
  2093. }
  2094. }
  2095. }
  2096. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  2097. if (nextObj == null || isLast) {
  2098. $(tableId).find("div:eq(0)").append(html);
  2099. } else {
  2100. $(nextObj).before(html);
  2101. }
  2102. //设置当前处方金额
  2103. //calculateCfAmount(tableId, totalRetprice, temporaryItemsAmount, 0, 0);
  2104. if (calculateTotalAmountFlag) {
  2105. //设置总金额
  2106. calculateTotalAmount();
  2107. }
  2108. //判断当前组号是不是最后一个,是最后一个组号,就需要新增组号
  2109. var groupIdLast = $("#groupId option:last-child").text();
  2110. if (groupId === groupIdLast) {
  2111. appendGroupOrder();
  2112. }
  2113. //设置药品的用法,频次,天数
  2114. var map = groupIdMap.get(groupId);
  2115. if (map == null) {
  2116. map = new Map();
  2117. map.put("supplyType", supplyType);
  2118. map.put("orderFrequency", orderFrequency);
  2119. map.put("dayNum", dayNum);
  2120. groupIdMap.put(groupId, map);
  2121. }
  2122. //设置当前药品的品类
  2123. $(tableId).find("input.current_groupNo").val($("#current_groupNo").val());
  2124. clearWesternMedicine(false);
  2125. }
  2126. /**
  2127. * 上移
  2128. * @param obj
  2129. */
  2130. function arrowUp(obj) {
  2131. var parentObject = $(obj).parent();
  2132. if ($(parentObject).prev() == null) {
  2133. return;
  2134. }
  2135. //当前元素的序号
  2136. var thisJcjyItemGroupId = null;
  2137. //前一个兄弟节点的序号
  2138. var prevJcjyItemGroupId = null;
  2139. //当是项目时有序号,进行序号调整
  2140. if ($(parentObject).find("span.jcjyItemGroupId") != null) {
  2141. thisJcjyItemGroupId = $(parentObject).find("span.jcjyItemGroupId").html();
  2142. prevJcjyItemGroupId = $(parentObject).prev().find("span.jcjyItemGroupId").html();
  2143. $(parentObject).find("span.jcjyItemGroupId").html(prevJcjyItemGroupId);
  2144. $(parentObject).prev().find("span.jcjyItemGroupId").html(thisJcjyItemGroupId);
  2145. }
  2146. $(parentObject).prev().before($(parentObject));
  2147. }
  2148. /**
  2149. * 下移
  2150. * @param obj
  2151. */
  2152. function arrowDown(obj) {
  2153. var parentObject = $(obj).parent();
  2154. if ($(parentObject).next() == null) {
  2155. return;
  2156. }
  2157. //当前元素的序号
  2158. var thisJcjyItemGroupId = null;
  2159. //后一个兄弟节点的序号
  2160. var afterJcjyItemGroupId = null;
  2161. //当是项目时有序号,进行序号调整
  2162. if ($(parentObject).find("span.jcjyItemGroupId") != null) {
  2163. thisJcjyItemGroupId = $(parentObject).find("span.jcjyItemGroupId").html();
  2164. afterJcjyItemGroupId = $(parentObject).after().find("span.jcjyItemGroupId").html();
  2165. $(parentObject).find("span.jcjyItemGroupId").html(afterJcjyItemGroupId);
  2166. $(parentObject).after().find("span.jcjyItemGroupId").html(thisJcjyItemGroupId);
  2167. }
  2168. $(parentObject).next().after($(parentObject));
  2169. }
  2170. /**
  2171. * 修改西药
  2172. * @param obj
  2173. */
  2174. function editWesternMedicine(obj) {
  2175. //是新增药品还是编辑 true 修改 默认false
  2176. $("#update_flag").val(true);
  2177. var parentObject = $(obj).parent();
  2178. //组号
  2179. $("#groupId").val($(parentObject).find("input.temporary_items_groupId").val());
  2180. $('#groupId').selectpicker('refresh');
  2181. //药品名称
  2182. $("#western_medicine_name").val($(parentObject).find("input.temporary_items_westernMedicineNamme").val());
  2183. var code = $(parentObject).find("input.temporary_items_code").val();
  2184. var serial = $(parentObject).find("input.temporary_items_serial").val();
  2185. //当前药品编码
  2186. $("#current_code").val(code);
  2187. //当前药品规格
  2188. $("#current_serial").val(serial);
  2189. //用法编码
  2190. $("#supplyType").val($(parentObject).find("input.temporary_items_supplyType").val());
  2191. $('#supplyType').selectpicker('refresh');
  2192. //药品默认单次使用剂量
  2193. $("#drugWinDb").val($(parentObject).find("input.temporary_items_drugWinDb").val());
  2194. //处方实际单次使用剂量
  2195. $("#drugWin").val($(parentObject).find("input.temporary_items_drugWin").val());
  2196. //天数
  2197. $("#dayNum").val($(parentObject).find("input.temporary_items_dayNum").val());
  2198. $('#dayNum').selectpicker('refresh');
  2199. //频次编码
  2200. $("#orderFrequency").val($(parentObject).find("input.temporary_items_orderFrequency").val());
  2201. $('#orderFrequency').selectpicker('refresh');
  2202. //总量
  2203. $("#gross").val($(parentObject).find("input.temporary_items_gross").val());
  2204. //医嘱
  2205. $("#medicalAdvice").val($(parentObject).find("input.temporary_items_medicalAdvice").val());
  2206. $('#medicalAdvice').selectpicker('refresh');
  2207. //金额
  2208. $("#totalRetprice").val($(parentObject).find("input.temporary_items_amount").val());
  2209. //单价
  2210. $("#packRetprice").val($(parentObject).find("input.temporary_items_packRetprice").val());
  2211. //皮试
  2212. var tryFlag = $(parentObject).find("input.temporary_items_tryFlag").val();
  2213. if (tryFlag == true || tryFlag == "true") {
  2214. $("#tryFlag").parent().addClass("checked");
  2215. $("#tryFlag").parent().parent().parent().removeClass("hide").addClass("in");
  2216. }
  2217. $.ajax({
  2218. type: "GET",
  2219. url: '/thmz/getYpZdDictByCodeAndSerial?code=' + code + "&serial=" + serial,
  2220. contentType: "application/json;charset=UTF-8",
  2221. dataType: "json",
  2222. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2223. success: function (res) {
  2224. if (res == '401' || res == 401) {
  2225. window.location.href = '/thmz/login/view'
  2226. return;
  2227. }
  2228. if (res.code == 0) {
  2229. if (res.data != null) {
  2230. var drugWinHtml = '';
  2231. if (res.data.weight != null) {
  2232. $("#drugWin").val(res.data.weight);
  2233. $("#drugWinDb").val(res.data.weight);
  2234. drugWinHtml = '<option value="' + res.data.weighUnit + '" desc="' + res.data.weight + '">' + res.data.weighUnitDesc + '</option>';
  2235. }
  2236. if (res.data.volum != null) {
  2237. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  2238. $("#drugWin").val(res.data.volum);
  2239. $("#drugWinDb").val(res.data.volum);
  2240. }
  2241. drugWinHtml += '<option value="' + res.data.volUnit + '" desc="' + res.data.volum + '">' + res.data.volUnitDesc + '</option>';
  2242. }
  2243. if (res.data.miniUnit != null && res.data.miniUnit != "") {
  2244. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  2245. $("#drugWin").val(1);
  2246. $("#drugWinDb").val(1);
  2247. }
  2248. drugWinHtml += '<option value="' + res.data.miniUnit + '" desc="1">' + res.data.miniUnitDesc + '</option>';
  2249. }
  2250. $('#drugWinUnit').html(drugWinHtml);
  2251. $('#drugWinUnit').selectpicker('refresh');
  2252. //剂量单位
  2253. $("#drugWinUnit").val($(parentObject).find("input.temporary_items_drugWinUnit").val());
  2254. $('#drugWinUnit').selectpicker('refresh');
  2255. if (res.data.packUnitDesc != null && res.data.packUnitDesc != "") {
  2256. var html = '<option value="' + res.data.packUnitDesc + '" >' + res.data.packUnitDesc + '</option>';
  2257. $('#packUnit').html(html);
  2258. $('#packUnit').selectpicker('refresh');
  2259. //包装单位
  2260. $("#packUnit").val($(parentObject).find("input.temporary_items_packUnit").val());
  2261. $('#packUnit').selectpicker('refresh');
  2262. }
  2263. if (res.data.psFlag != null && (res.data.psFlag == 1 || res.data.psFlag == "1")) {
  2264. $("#tryFlag").parent().parent().parent().removeClass("hide").addClass("in");
  2265. } else {
  2266. $("#tryFlag").parent().parent().parent().removeClass("in").addClass("hide");
  2267. }
  2268. }
  2269. } else {
  2270. errorMesage(res);
  2271. }
  2272. }
  2273. });
  2274. }
  2275. /**
  2276. * 修改中药
  2277. * @param obj
  2278. */
  2279. function editChineseMedicine(obj) {
  2280. //是新增药品还是编辑 true 修改 默认false
  2281. $("#update_flag").val(true);
  2282. var parentObject = $(obj).parent();
  2283. //当前药品编码
  2284. $("#current_code").val($(parentObject).find("input.temporary_items_code").val());
  2285. //当前药品规格
  2286. $("#current_serial").val($(parentObject).find("input.temporary_items_serial").val());
  2287. //中药类型
  2288. $("#zyClassType").val($(parentObject).find("input.temporary_items_zyClassType").val());
  2289. $('#zyClassType').selectpicker('refresh');
  2290. //药品名称
  2291. $("#chinese_medicine_name").val($(parentObject).find("input.temporary_items_chineseMedicineNamme").val());
  2292. //单价
  2293. $("#zy_packRetprice").val($(parentObject).find("input.temporary_items_zyPackRetprice").val());
  2294. //处方实际单次使用剂量
  2295. $("#zy_drugWin").val($(parentObject).find("input.temporary_items_drugWin").val());
  2296. //医嘱码
  2297. $("#zyInstruction").val($(parentObject).find("input.temporary_items_zyInstruction").val());
  2298. $('#zyInstruction').selectpicker('refresh');
  2299. }
  2300. /**
  2301. * 修改项目
  2302. * @param obj
  2303. */
  2304. function editJyJcItem(obj) {
  2305. //是新增药品还是编辑 true 修改 默认false
  2306. $("#update_flag").val(true);
  2307. var parentObject = $(obj).parent();
  2308. //当前项目编码
  2309. $("#current_code").val($(parentObject).find("input.temporary_items_code").val());
  2310. //项目名称
  2311. $("#jcJyItem").val($(parentObject).find("input.temporary_items_jcJyItemName").val());
  2312. //单价
  2313. $("#jcjyItemPrice").val($(parentObject).find("input.temporary_items_amount").val());
  2314. //备注
  2315. $("#remark").val($(parentObject).find("input.temporary_items_remark").val());
  2316. var chargeUnit = $(parentObject).find("input.temporary_items_desc_value").val();
  2317. var jcJyZltype = $(parentObject).find("input.temporary_items_type").val();
  2318. if (jcJyZltype == 1 || jcJyZltype == "1") {
  2319. $("#jyZdSample").selectpicker('val', chargeUnit);
  2320. $('#jyZdSample').selectpicker('refresh');
  2321. $("#jyZdSampleDiv").removeClass("hide").addClass("in");
  2322. $("#chargeUnitDiv").removeClass("in").addClass("hide");
  2323. $("#yshPartDiv").removeClass("in").addClass("hide");
  2324. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  2325. } else if (jcJyZltype == 2 || jcJyZltype == "2") {
  2326. $("#yshPart").selectpicker('val', chargeUnit);
  2327. $('#yshPart').selectpicker('refresh');
  2328. $("#yshPartDiv").removeClass("hide").addClass("in");
  2329. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  2330. $("#chargeUnitDiv").removeClass("in").addClass("hide");
  2331. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  2332. } else if (jcJyZltype == 3 || jcJyZltype == "3") {
  2333. //描述
  2334. $("#chargeUnit").val(chargeUnit);
  2335. $("#chargeUnitDiv").removeClass("hide").addClass("in");
  2336. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  2337. $("#yshPartDiv").removeClass("in").addClass("hide");
  2338. $("#jcJyItemChargeDetail").removeClass("in").addClass("hide");
  2339. }
  2340. $("#jcJyZltype").val(jcJyZltype);
  2341. }
  2342. /**
  2343. * 保存当前项目到右边处方区域 需要提示加价
  2344. * @param calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  2345. */
  2346. function saveJyJcItem(calculateTotalAmountFlag) {
  2347. //6岁内提示加价
  2348. var patientAge = $("#patientAge").text();
  2349. if (patientAge != null && patientAge != "" && patientAge < 6) {
  2350. $.ajax({
  2351. type: "GET",
  2352. url: '/thmz/checkAdditionally?code=' + $("#current_code").val(),
  2353. contentType: "application/json;charset=UTF-8",
  2354. dataType: "json",
  2355. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2356. success: function (res) {
  2357. if (res == '401' || res == 401) {
  2358. window.location.href = '/thmz/login/view'
  2359. return;
  2360. }
  2361. if (res.code == 0) {
  2362. if (res.data != undefined && res.data != null && res.data.co != null && res.data.co == 1 && res.data.xlCode != null && res.data.xlCode != "") {
  2363. var xlCode = res.data.xlCode;
  2364. xlCode = Multiply(100, xlCode);
  2365. $("#messageModal").modal();
  2366. $("#messageContent").html("根据【湘医保发〔2020〕51 号】价格通知,6岁以内的小朋友诊疗费上调" + xlCode + "%,是否需要继续添加该项目?");
  2367. $("#messageButton").off("click").on("click", function (t) {
  2368. $("#messageModal").modal("hide");
  2369. saveJyJcItemReal(true);
  2370. });
  2371. } else {
  2372. //虽然是不满6岁,但是也没有需要加收的项目,直接保存
  2373. saveJyJcItemReal(calculateTotalAmountFlag);
  2374. }
  2375. } else {
  2376. errorMesage(res);
  2377. }
  2378. }
  2379. });
  2380. } else {
  2381. saveJyJcItemReal(calculateTotalAmountFlag);
  2382. }
  2383. }
  2384. /**
  2385. * 保存当前项目到右边处方区域
  2386. * @param calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  2387. */
  2388. function saveJyJcItemReal(calculateTotalAmountFlag) {
  2389. var tableId = $("#zlTab li.active").find("a").attr("href");
  2390. //组号
  2391. var groupId = $(tableId).find("div:eq(0)").children().length + 1;
  2392. //项目名称
  2393. var jcJyItem = $("#jcJyItem").val();
  2394. //当前项目编码
  2395. var currentCode = $("#current_code").val();
  2396. //当前项目价格
  2397. var jcjyItemPrice = $("#jcjyItemPrice").val();
  2398. //描述
  2399. var chargeUnit = $("#chargeUnit").val();
  2400. //描述编码
  2401. var chargeUnitCode = chargeUnit;
  2402. var chargeUnitName = "描述:";
  2403. //备注
  2404. var remark = $("#remark").val();
  2405. //项目类型
  2406. var jcJyZltype = $("#jcJyZltype").val();
  2407. if (jcJyZltype == "1" || jcJyZltype == 1) {
  2408. //检验
  2409. chargeUnit = $('#jyZdSample option:selected').text();
  2410. chargeUnitCode = $('#jyZdSample').val();
  2411. chargeUnitName = "检验物:";
  2412. } else if (jcJyZltype == "2" || jcJyZltype == 2) {
  2413. //检查
  2414. chargeUnit = $('#yshPart option:selected').text();
  2415. chargeUnitCode = $('#yshPart').val();
  2416. chargeUnitName = "检查部位:";
  2417. }
  2418. if (currentCode == null || currentCode == '') {
  2419. if (calculateTotalAmountFlag == true) {
  2420. errorMesageSimaple("未选择任何项目!");
  2421. }
  2422. return;
  2423. }
  2424. //原药品金额 如果是修改则需要设置
  2425. var temporaryItemsAmount = 0;
  2426. //当前需要被移除元素的下个兄弟节点
  2427. var nextObj = null;
  2428. //当前修改的药品是不是最后一个
  2429. var isLast = false;
  2430. //是新增药品还是编辑 true 修改 默认false
  2431. var updateFlag = $("#update_flag").val();
  2432. if (updateFlag == undefined || updateFlag == null) {
  2433. updateFlag = false;
  2434. }
  2435. //如果是修改,需要减去原来的费用
  2436. //原组号
  2437. var oriGroupId = null;
  2438. if (updateFlag == "true" || updateFlag == true) {
  2439. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  2440. if (formGroups != null && formGroups.length > 0) {
  2441. for (var i = 0; i < formGroups.length; i++) {
  2442. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  2443. if (temporaryItemsCode === currentCode) {
  2444. temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  2445. if (formGroups.length > 1) {
  2446. nextObj = $(formGroups[i]).next();
  2447. }
  2448. isLast = (i + 1) === formGroups.length;
  2449. oriGroupId = $(formGroups[i]).find("span.jcjyItemGroupId").text();
  2450. $(formGroups[i]).remove();
  2451. break;
  2452. }
  2453. }
  2454. }
  2455. }
  2456. if (oriGroupId != null) {
  2457. groupId = oriGroupId;
  2458. }
  2459. var html = '<div class="form-group">';
  2460. html += '<span class="jcjyItemGroupId">' + groupId + '</span>.<span style="margin-left: 5px"></span>'
  2461. html += jcJyItem + ' ';
  2462. if (chargeUnit != null && chargeUnit != '') {
  2463. html += chargeUnitName + chargeUnit;
  2464. }
  2465. if (remark != null && remark != '') {
  2466. html += ' 备注:' + remark;
  2467. }
  2468. html += ' <i class="fa fa-long-arrow-up" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;margin-left: 10px;" onclick="arrowUp(this)"></i>';
  2469. html += '<i class="fa fa-long-arrow-down" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;" onclick="arrowDown(this)"></i>';
  2470. html += ' <i class="fa fa-long-arrow-left" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;" onclick="editJyJcItem(this)"></i>';
  2471. if ($("#jcJyItemChargeDetail").hasClass("in")) {
  2472. html += '<i class="fa fa-eye" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;margin-left: 10px;" onclick="getJcJyItemChargeByCode(\'' + currentCode + '\')"></i>';
  2473. }
  2474. html += '<i class="fa fa-remove" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;margin-left: 10px;" onclick="removeYpOrProject(2,this)"></i>';
  2475. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  2476. html += '<input type="hidden" class="temporary_items_jcJyItemName" value="' + jcJyItem + '"/>';
  2477. html += '<input type="hidden" class="temporary_items_amount" value="' + jcjyItemPrice + '"/>';
  2478. html += '<input type="hidden" class="temporary_items_remark" value="' + remark + '"/>';
  2479. html += '<input type="hidden" class="temporary_items_type" value="' + jcJyZltype + '"/>';
  2480. html += '<input type="hidden" class="temporary_items_desc_value" value="' + chargeUnitCode + '"/>';
  2481. html += '</div>';
  2482. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  2483. if (nextObj == null || isLast) {
  2484. $(tableId).find("div:eq(0)").append(html);
  2485. } else {
  2486. $(nextObj).before(html);
  2487. }
  2488. //设置当前处方金额
  2489. //calculateCfAmount(tableId, jcjyItemPrice, temporaryItemsAmount, 2, 0);
  2490. if (calculateTotalAmountFlag) {
  2491. //设置总金额
  2492. calculateTotalAmount();
  2493. }
  2494. clearJyJcItem();
  2495. }
  2496. /**
  2497. * 临时保存住院证
  2498. * @param messageFlag 是否需要提醒已经存在的入院申请 true 提示
  2499. */
  2500. function saveZyReq(messageFlag) {
  2501. //如果
  2502. if ($("#zyReqTab").find("li") == null || $("#zyReqTab").find("li").length == 0) {
  2503. initNavTabs(3);
  2504. }
  2505. var tableId = $("#zyReqTab li.active").find("a").attr("href");
  2506. //病区编码
  2507. var inpatientWardBeHospitalized = $("#inpatientWardBeHospitalized").val();
  2508. //小病室编码
  2509. var smallWardBeHospitalized = $("#smallWardBeHospitalized").val();
  2510. //入院状态编码
  2511. var admissStatus = $("#admissStatus").val();
  2512. //病区名称
  2513. var inpatientWardText = $('#inpatientWardBeHospitalized option:selected').text();
  2514. //小科室名称
  2515. var smallWardText = $('#smallWardBeHospitalized option:selected').text();
  2516. //入院状态名称
  2517. var admissStatusText = $('#admissStatus option:selected').text();
  2518. if (inpatientWardBeHospitalized == null || inpatientWardBeHospitalized == '') {
  2519. errorMesageSimaple("未选择入院病区!");
  2520. return;
  2521. }
  2522. if (admissStatus == null || admissStatus == '') {
  2523. errorMesageSimaple("未选择入院状态!");
  2524. return;
  2525. }
  2526. if (messageFlag == "true" || messageFlag == true) {
  2527. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  2528. if (formGroups != null && formGroups.length > 0) {
  2529. $("#messageModal").modal();
  2530. $("#messageContent").html("当前病人已经有一个暂存的入院申请,是否需要替换该申请?");
  2531. $("#messageButton").off("click").on("click", function (t) {
  2532. $("#messageModal").modal("hide");
  2533. saveZyReq(false);
  2534. });
  2535. return;
  2536. }
  2537. }
  2538. var html = '<div class="form-group"> 收住院';
  2539. if (inpatientWardText != null) {
  2540. html += " [" + inpatientWardText;
  2541. }
  2542. if (smallWardText != null) {
  2543. html += " (" + smallWardText + ") ";
  2544. }
  2545. if (inpatientWardText != null) {
  2546. html += "] ";
  2547. }
  2548. if (admissStatusText != null) {
  2549. html += admissStatusText;
  2550. }
  2551. html += ' 侯床';
  2552. //html += ' <i class="fa fa-long-arrow-left" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;" onclick="editJyJcItem(this)"></i>';
  2553. html += '<i class="fa fa-remove" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;margin-left: 10px;" onclick="removeYpOrProject(3,this)"></i>';
  2554. html += '<input type="hidden" class="temporary_inpatient_ward" value="' + inpatientWardBeHospitalized + '"/>';
  2555. html += '<input type="hidden" class="temporary_items_small_ward" value="' + smallWardBeHospitalized + '"/>';
  2556. html += '<input type="hidden" class="temporary_items_admiss_status" value="' + admissStatus + '"/>';
  2557. html += '</div>';
  2558. $(tableId).find("div:eq(0)").html(html);
  2559. clearZyReq();
  2560. }
  2561. /**
  2562. * 删除药品或者项目
  2563. * @param index 0 西药 1 中药 2 项目
  2564. * @param obj 当前点击的对象
  2565. */
  2566. function removeYpOrProject(index, obj) {
  2567. var tabId = null;
  2568. //西药
  2569. if (index == 0) {
  2570. tabId = "xyTab";
  2571. } else if (index == 1) {
  2572. //中成药
  2573. tabId = "zyTab";
  2574. } else if (index == 2) {
  2575. //医技与诊疗
  2576. tabId = "zlTab";
  2577. } else if (index == 3) {
  2578. //入院
  2579. tabId = "zyReqTab";
  2580. }
  2581. var tableId = $("#" + tabId + " li.active").find("a").attr("href");
  2582. //var totalRetprice = $(obj).parent().find("input.temporary_items_amount").val();
  2583. //calculateCfAmount(tableId, totalRetprice, null, index, 1);
  2584. //医技的序号调整一下
  2585. if (index == 2) {
  2586. var nextAll = $(obj).parent().nextAll();
  2587. if (nextAll != null && nextAll.length > 0) {
  2588. for (var i = 0; i < nextAll.length; i++) {
  2589. var index = $(nextAll[i]).find(".jcjyItemGroupId").text();
  2590. $(nextAll[i]).find(".jcjyItemGroupId").text(index - 1);
  2591. }
  2592. }
  2593. }
  2594. $(obj).parent().remove();
  2595. if (index != 3) {
  2596. calculateTotalAmount();
  2597. }
  2598. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  2599. if (formGroups == null || formGroups.length == 0) {
  2600. if (index == 0) {
  2601. //西药被清空后,重置药房类型编码
  2602. $(tableId).find("input.current_groupNo").val(null);
  2603. //当本处方内容都被删除完后,也删除处方table
  2604. $("#" + tabId).find("a[href=\"" + tableId + "\"]").parent().remove();
  2605. $(tableId).remove();
  2606. //切换处方 最后一个被选中
  2607. $("#" + tabId).find("li:last > a").off("click").tab('show');
  2608. } else if (index == 1) {
  2609. //当中药处方被清空完后,重置当前中药类型为空
  2610. $("#current_zyClassType").val(null);
  2611. }
  2612. }
  2613. }
  2614. /**
  2615. * 清空西药
  2616. * @param flag 是否全部清空 因为 西药有分组,同一组的药品用药方式和频率以及天数一样,不能改变。所以不换组是不能改变 并且设置成不可编辑
  2617. */
  2618. function clearWesternMedicine(flag) {
  2619. $("#update_flag").val(false);
  2620. //药品名称
  2621. $("#western_medicine_name").val(null);
  2622. //当前药品编码
  2623. $("#current_code").val(null);
  2624. //当前药品规格
  2625. $("#current_serial").val(null);
  2626. //当前药房编码
  2627. $("#current_groupNo").val(null);
  2628. if (flag) {
  2629. //用法编码
  2630. $("#supplyType").selectpicker('val', null);
  2631. $('#supplyType').selectpicker('refresh');
  2632. //$("#supplyType").removeAttr("disabled");
  2633. //天数
  2634. $("#dayNum").selectpicker('val', null);
  2635. $('#dayNum').selectpicker('refresh');
  2636. // $("#dayNum").removeAttr("disabled");
  2637. //频次编码
  2638. $("#orderFrequency").selectpicker('val', null);
  2639. $('#orderFrequency').selectpicker('refresh');
  2640. // $("#orderFrequency").removeAttr("disabled");
  2641. }
  2642. //药品默认单次使用剂量
  2643. $("#drugWinDb").val(null);
  2644. //处方实际单次使用剂量
  2645. $("#drugWin").val(null);
  2646. //剂量单位
  2647. $("#drugWinUnit").selectpicker('val', null);
  2648. $('#drugWinUnit').selectpicker('refresh');
  2649. //总量
  2650. $("#gross").val(null);
  2651. //包装单位
  2652. $("#packUnit").selectpicker('val', null);
  2653. $('#packUnit').selectpicker('refresh');
  2654. //单价
  2655. $("#packRetprice").val(null);
  2656. //金额
  2657. $("#totalRetprice").val(null);
  2658. //医嘱
  2659. $("#medicalAdvice").selectpicker('val', null);
  2660. $('#medicalAdvice').selectpicker('refresh');
  2661. //皮试
  2662. $("#tryFlag").parent().removeClass('checked');
  2663. $("#tryFlag").parent().parent().parent().removeClass("in").addClass("hide");
  2664. $("#gross").attr("readonly", "readonly");
  2665. }
  2666. /**
  2667. * 保存当前药品到右边处方区域 中药
  2668. * calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  2669. */
  2670. function saveChineseMedicine(calculateTotalAmountFlag) {
  2671. //药品名称
  2672. var chineseMedicineNamme = $("#chinese_medicine_name").val();
  2673. //当前药品编码
  2674. var currentCode = $("#current_code").val();
  2675. //当前药品规格
  2676. var currentSerial = $("#current_serial").val();
  2677. //处方实际单次使用剂量
  2678. var drugWin = $("#zy_drugWin").val();
  2679. //医嘱码
  2680. var zyInstruction = $("#zyInstruction").val();
  2681. //医嘱
  2682. var zyInstructionText = $('#zyInstruction option:selected').text();
  2683. //单价
  2684. var zyPackRetprice = parseFloat($("#zy_packRetprice").val());
  2685. //当前中药的总价
  2686. var totalRetprice = Multiply(drugWin, zyPackRetprice);
  2687. //中药类型
  2688. var zyClassType = $("#zyClassType").val();
  2689. //已经选中的药品类型, 中药不允许一个处方里有普通中药和颗粒剂
  2690. var currentYyClassType = $("#current_zyClassType").val();
  2691. if (currentYyClassType == null || currentYyClassType == "") {
  2692. //中药此时是第一次选择药品,不控制类型
  2693. $("#current_zyClassType").val(zyClassType);
  2694. } else if (currentYyClassType != zyClassType) {
  2695. errorMesageSimaple("同一个中药处方不允许同时出现普通中药和颗粒剂中药!");
  2696. return;
  2697. }
  2698. if (currentCode == null || currentCode == '') {
  2699. errorMesageSimaple("未选择任何药品!");
  2700. return;
  2701. }
  2702. var html = '<div class="form-group" style="float: left;">';
  2703. html += chineseMedicineNamme;
  2704. if (zyInstruction != null && zyInstruction != '') {
  2705. html += '[' + zyInstructionText + ']';
  2706. }
  2707. html += '<span style="margin-left: 5px"></span>';
  2708. html += drugWin + 'g';
  2709. html += ' <i class="fa fa-long-arrow-up" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;margin-left: 10px;" onclick="arrowUp(this)"></i>';
  2710. html += '<i class="fa fa-long-arrow-down" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;" onclick="arrowDown(this)"></i>';
  2711. html += ' <i class="fa fa-long-arrow-left" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;" onclick="editChineseMedicine(this)"></i>';
  2712. html += '<i class="fa fa-remove" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;margin-left:10px;" onclick="removeYpOrProject(1,this)"></i>';
  2713. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  2714. html += '<input type="hidden" class="temporary_items_serial" value="' + currentSerial + '"/>';
  2715. html += '<input type="hidden" class="temporary_items_amount" value="' + totalRetprice + '"/>';
  2716. html += '<input type="hidden" class="temporary_items_zyClassType" value="' + zyClassType + '"/>';
  2717. html += '<input type="hidden" class="temporary_items_chineseMedicineNamme" value="' + chineseMedicineNamme + '"/>';
  2718. html += '<input type="hidden" class="temporary_items_zyPackRetprice" value="' + zyPackRetprice + '"/>';
  2719. html += '<input type="hidden" class="temporary_items_drugWin" value="' + drugWin + '"/>';
  2720. html += '<input type="hidden" class="temporary_items_zyInstruction" value="' + zyInstruction + '"/>';
  2721. html += '<input type="hidden" class="temporary_items_zyInstructionText" value="' + zyInstructionText + '"/>';
  2722. html += '</div>';
  2723. var tableId = $("#zyTab li.active").find("a").attr("href");
  2724. //原药品金额 如果是修改则需要设置
  2725. var temporaryItemsAmount = 0;
  2726. //当前需要被移除元素的下个兄弟节点
  2727. var nextObj = null;
  2728. //当前修改的药品是不是最后一个
  2729. var isLast = false;
  2730. //是新增药品还是编辑 true 修改 默认false
  2731. var updateFlag = $("#update_flag").val();
  2732. if (updateFlag == undefined || updateFlag == null) {
  2733. updateFlag = false;
  2734. }
  2735. //如果是修改,需要减去原来的费用
  2736. if (updateFlag == "true" || updateFlag == true) {
  2737. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  2738. if (formGroups != null && formGroups.length > 0) {
  2739. for (var i = 0; i < formGroups.length; i++) {
  2740. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  2741. var temporaryItemsSerial = $(formGroups[i]).find("input.temporary_items_serial").val();
  2742. if (temporaryItemsCode === currentCode && temporaryItemsSerial === currentSerial) {
  2743. temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  2744. if (formGroups.length > 1) {
  2745. nextObj = $(formGroups[i]).next();
  2746. }
  2747. isLast = (i + 1) === formGroups.length;
  2748. $(formGroups[i]).remove();
  2749. break;
  2750. }
  2751. }
  2752. }
  2753. }
  2754. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  2755. if (nextObj == null || isLast) {
  2756. $(tableId).find("div:eq(0)").append(html);
  2757. } else {
  2758. $(nextObj).before(html);
  2759. }
  2760. //设置当前处方金额
  2761. // calculateCfAmount(tableId, totalRetprice, temporaryItemsAmount, 1, 0);
  2762. if (calculateTotalAmountFlag) {
  2763. //设置总金额
  2764. calculateTotalAmount();
  2765. }
  2766. clearChineseMedicine();
  2767. }
  2768. /**
  2769. * 清空中药
  2770. */
  2771. function clearChineseMedicine() {
  2772. $("#update_flag").val(false);
  2773. //药品名称
  2774. $("#chinese_medicine_name").val(null);
  2775. //当前药品编码
  2776. $("#current_code").val(null);
  2777. //当前药品规格
  2778. $("#current_serial").val(null);
  2779. //医嘱
  2780. $("#zyInstruction").selectpicker('val', null);
  2781. $('#zyInstruction').selectpicker('refresh');
  2782. //剂量
  2783. $("#zy_drugWin").val(null);
  2784. //单价
  2785. $("#zy_packRetprice").val(null);
  2786. }
  2787. /**
  2788. * 清空项目
  2789. */
  2790. function clearJyJcItem() {
  2791. $("#update_flag").val(false);
  2792. //项目名称
  2793. $("#jcJyItem").val(null);
  2794. //当前项目编码
  2795. $("#current_code").val(null);
  2796. //单价
  2797. $("#jcjyItemPrice").val(null);
  2798. //备注
  2799. $("#remark").val(null);
  2800. //描述
  2801. $("#chargeUnit").val(null);
  2802. $("#jcJyZltype").val(null);
  2803. $("#jyZdSample").selectpicker('val', null);
  2804. $('#jyZdSample').selectpicker('refresh');
  2805. $("#yshPart").selectpicker('val', null);
  2806. $('#yshPart').selectpicker('refresh');
  2807. $("#jcJyItemChargeDetail").removeClass("in").addClass("hide");
  2808. $("#chargeUnitDiv").removeClass("in").addClass("hide");
  2809. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  2810. $("#yshPartDiv").removeClass("in").addClass("hide");
  2811. }
  2812. /**
  2813. * 清空入院证输入框
  2814. */
  2815. function clearZyReq() {
  2816. $("#inpatientWardBeHospitalized").selectpicker('val', null);
  2817. $('#inpatientWardBeHospitalized').selectpicker('refresh');
  2818. $("#smallWardBeHospitalized").selectpicker('val', null);
  2819. $('#smallWardBeHospitalized').selectpicker('refresh');
  2820. $("#admissStatus").selectpicker('val', null);
  2821. $('#admissStatus').selectpicker('refresh');
  2822. $("#totalBedNum").val(null);
  2823. $("#freeBedNum").val(null);
  2824. $("#occupationBedNum").val(null);
  2825. initSmallDeptByDept();
  2826. }
  2827. /**
  2828. * 计算总金额
  2829. */
  2830. function calculateTotalAmount() {
  2831. var jsonData = getParamsForpPrescription();
  2832. $.ajax({
  2833. type: "POST",
  2834. url: '/thmz/getAmountForTempPrescription',
  2835. contentType: "application/json;charset=UTF-8",
  2836. dataType: "json",
  2837. data: JSON.stringify(jsonData),
  2838. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2839. success: function (res) {
  2840. if (res == '401' || res == 401) {
  2841. window.location.href = '/thmz/login/view'
  2842. return;
  2843. }
  2844. if (res.code == 0) {
  2845. $("#totalAmount").html(res.data.amount.toFixed(1));
  2846. var arrs = $("span.cf_amount");
  2847. for (var i = 0; i < arrs.length; i++) {
  2848. if (res.data.amountList[i] != undefined && res.data.amountList[i] != null) {
  2849. $(arrs[i]).html(res.data.amountList[i].toFixed(1));
  2850. }
  2851. }
  2852. // var arrs = $("#xyTabContent").find("span.cf_amount");
  2853. // for (var i = 0; i < arrs.length; i++) {
  2854. // $(arrs[i]).html(res.data.xyAmount.toFixed(1));
  2855. // }
  2856. // $("#zyTabContent").find("span.cf_amount").html(res.data.zyAmount.toFixed(1));
  2857. // if (res.data.yjAmount != null) {
  2858. // //如果
  2859. // if ($("#zlTab").find("li") == null || $("#zlTab").find("li").length == 0) {
  2860. // initNavTabs(2);
  2861. // }
  2862. // $("#zlTabContent").find("span.cf_amount").html(res.data.yjAmount.toFixed(1));
  2863. // }
  2864. } else {
  2865. errorMesage(res);
  2866. }
  2867. }
  2868. });
  2869. }
  2870. // /**
  2871. // * 打开住院处理窗口
  2872. // * @param data
  2873. // */
  2874. // function beHospitalized() {
  2875. // $("#beHospitalizedModal").modal();
  2876. // //根据病人门诊id查询病人的入院申请
  2877. // $.ajax({
  2878. // type: "GET",
  2879. // url: '/thmz/getMzZyReqByPatientId?patientId=' + $("#patientId").val(),
  2880. // contentType: "application/json;charset=UTF-8",
  2881. // dataType: "json",
  2882. // headers: {
  2883. // 'Accept': 'application/json',
  2884. // 'Authorization': 'Bearer ' + localStorage.getItem("token")
  2885. // },
  2886. // success: function (resZyz) {
  2887. // if (resZyz == '401' || resZyz == 401) {
  2888. // window.location.href = '/thmz/login/view'
  2889. // return;
  2890. // }
  2891. // if (resZyz.code == 0) {
  2892. // $("#icdCodeInputBeHospitalized").val(resZyz.data.icdCode);
  2893. // $("#icdTextBeHospitalized").val(resZyz.data.icdText);
  2894. // $("#icdTextBeHospitalized").attr("title", resZyz.data.icdText);
  2895. // $("#inpatientWardBeHospitalized").selectpicker('val', resZyz.data.reqDept);
  2896. // $("#inpatientWardBeHospitalized").selectpicker('refresh');
  2897. // initSmallDeptByDept();
  2898. // $("#smallWardBeHospitalized").selectpicker('val', resZyz.data.smallDept);
  2899. // $("#smallWardBeHospitalized").selectpicker('refresh');
  2900. // $("#admissStatus").selectpicker('val', resZyz.data.admissStatus);
  2901. // $("#admissStatus").selectpicker('refresh');
  2902. // $("#zyReqVisitDate").val(format(resZyz.data.visitDate, "yyyy-MM-dd HH:mm:ss"));
  2903. // }
  2904. // }
  2905. // });
  2906. // }
  2907. /**
  2908. * 打开编辑用户信息窗口
  2909. * @param data
  2910. */
  2911. function editUserModal() {
  2912. $("#editUserModal").modal();
  2913. $.ajax({
  2914. type: "GET",
  2915. url: '/thmz/getByPatientId?patientId=' + $("#patientId").val(),
  2916. contentType: "application/json;charset=UTF-8",
  2917. dataType: "json",
  2918. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2919. success: function (res) {
  2920. if (res == '401' || res == 401) {
  2921. window.location.href = '/thmz/login/view'
  2922. return;
  2923. }
  2924. if (res.code == 0) {
  2925. if (res.data != null) {
  2926. //延时调用,因为当前弹框还没有加载出来,校验规则无法获取光标与模拟光标丢失事件,延时可以等弹框加载出来后模拟事件
  2927. setTimeout(function () {
  2928. fillPlusPatinet(res.data);
  2929. }, 400);
  2930. }
  2931. } else {
  2932. errorMesage(res);
  2933. }
  2934. }
  2935. });
  2936. }
  2937. /**
  2938. * 处方类型按钮切换事件
  2939. * @param object
  2940. * @param objectIndex
  2941. */
  2942. function billItemButtonChange(object, objectIndex) {
  2943. $(".nav-tabs").removeClass("in").addClass("hide");
  2944. $(".tab-content").removeClass("in").addClass("hide");
  2945. $(".nav-tabs:eq(" + objectIndex + ")").removeClass("hide").addClass("in");
  2946. $(".tab-content:eq(" + objectIndex + ")").removeClass("hide").addClass("in");
  2947. // initNavTabs(objectIndex);
  2948. $("#bill_item_group").find("button").each(function (index, element) {
  2949. if ($(element).hasClass("btn-primary")) {
  2950. $(element).removeClass("btn-primary").addClass("btn-default");
  2951. }
  2952. $("#rp_form" + index).removeClass("show").addClass("hide");
  2953. });
  2954. $("#rp_form" + objectIndex).removeClass("hide").addClass("show");
  2955. $(object).removeClass("btn-default").addClass("btn-primary");
  2956. $("#western_medicine_name").webuiPopover('hide');
  2957. $("#jcJyItem").webuiPopover('hide');
  2958. }
  2959. /**
  2960. * 打开快速接诊窗口
  2961. * @param data
  2962. */
  2963. function rapidAcceptsModal() {
  2964. $("#rapidAcceptsModal").modal();
  2965. //延迟触发 默认光标在卡号输入框
  2966. setTimeout('$("#rapidAcceptsUserCardNo").focus();', 500);
  2967. }
  2968. /**
  2969. * checkBox样式
  2970. */
  2971. function formatCheck() {
  2972. if ($("input.flat")[0]) {
  2973. $(document).ready(function () {
  2974. $('input.flat').iCheck({
  2975. checkboxClass: 'icheckbox_flat-blue',
  2976. radioClass: 'iradio_flat-blue'
  2977. });
  2978. });
  2979. }
  2980. }
  2981. /**
  2982. * 卡号有变化后查询病人信息
  2983. */
  2984. function queryUserInfoByCardNo() {
  2985. //当反写的id不存在,说明不是查询后的改变事件,触发查询
  2986. var rapidAcceptsUserCardNo = $("#rapidAcceptsUserCardNo").val();
  2987. var index = rapidAcceptsUserCardNo.indexOf("-");
  2988. if (($("#patientIdDb").val() == null || $("#patientIdDb").val() == "") && ((index > 0 && index == rapidAcceptsUserCardNo.length - 2) || rapidAcceptsUserCardNo.length == 8)) {
  2989. $("#cardNo").attr("title", rapidAcceptsUserCardNo);
  2990. $.ajax({
  2991. type: "GET",
  2992. url: '/thmz/getByIcCardNo?icCardNo=' + rapidAcceptsUserCardNo,
  2993. contentType: "application/json;charset=UTF-8",
  2994. dataType: "json",
  2995. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2996. success: function (res) {
  2997. if (res == '401' || res == 401) {
  2998. window.location.href = '/thmz/login/view'
  2999. return;
  3000. }
  3001. if (res.code == 0) {
  3002. if (res.data != null) {
  3003. $("#rapidAcceptsUserName").val(res.data.name);
  3004. $("#rapidAcceptsUserCode").val(res.data.patientId);
  3005. $("#patientIdDb").val(res.data.patientId);
  3006. $("#rapidAcceptsUserCardNo").val(res.data.icCardNo);
  3007. $("#rapidAcceptsUserGender").selectpicker('val', res.data.sex);
  3008. $("#rapidAcceptsUserGender").selectpicker('refresh');
  3009. $("#rapidAcceptsUserPhoneNum").val(res.data.phoneNo);
  3010. $("#rapidAcceptsUserIdCard").val(res.data.socialNo);
  3011. $("#rapidAcceptsUserIdCard").attr("title", res.data.socialNo);
  3012. $("#rapidAcceptsUserPhoneNum").attr("title", res.data.phoneNo);
  3013. //查询分诊号
  3014. $.ajax({
  3015. type: "POST",
  3016. url: '/thmz/getUnClinicWithPage',
  3017. contentType: "application/json;charset=UTF-8",
  3018. dataType: "json",
  3019. data: JSON.stringify({"patientId": res.data.patientId}),
  3020. headers: {
  3021. 'Accept': 'application/json',
  3022. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  3023. },
  3024. success: function (resFz) {
  3025. if (resFz == '401' || resFz == 401) {
  3026. window.location.href = '/thmz/login/view'
  3027. return;
  3028. }
  3029. if (resFz.code == 0) {
  3030. if (resFz.data == null || resFz.data.length == 0) {
  3031. errorMesageSimaple("没有查询到符合条件的分诊记录!");
  3032. clearRapidAcceptsModal();
  3033. return;
  3034. }
  3035. $("#mzfzSerialNo").val(resFz.data[0].serialNo);
  3036. }
  3037. }
  3038. });
  3039. } else {
  3040. errorMesageSimaple("病人信息不存在!");
  3041. }
  3042. } else {
  3043. errorMesage(res);
  3044. }
  3045. }
  3046. });
  3047. }
  3048. }
  3049. /**
  3050. * 清空快速接诊查询框
  3051. */
  3052. function clearRapidAccepts() {
  3053. $("#rapidAcceptsUserName").val(null);
  3054. $("#rapidAcceptsUserCode").val(null);
  3055. $("#patientIdDb").val(null);
  3056. $("#rapidAcceptsUserCardNo").val(null);
  3057. $("#rapidAcceptsUserGender").selectpicker('val', 0);
  3058. $("#rapidAcceptsUserGender").selectpicker('refresh');
  3059. $("#rapidAcceptsUserPhoneNum").val(null);
  3060. $("#rapidAcceptsUserIdCard").val(null);
  3061. $("#rapidAcceptsUserIdCard").attr("title", null);
  3062. $("#rapidAcceptsUserPhoneNum").attr("title", null);
  3063. $("#mzfzSerialNo").val(null);
  3064. $("#rapidAcceptsUserCardNo").focus();
  3065. }
  3066. /**
  3067. * 根据病人姓名输入框内容动态加载病人列表
  3068. */
  3069. function initUserList() {
  3070. //var width=$("#userName").css("width");
  3071. var settings = {
  3072. trigger: 'click',
  3073. content: '',
  3074. width: 170,
  3075. multi: true,
  3076. closeable: false,
  3077. style: '',
  3078. delay: 300,
  3079. padding: true,
  3080. height: 300,
  3081. };
  3082. var webuiPopover = $('#rapidAcceptsUserName').webuiPopover('destroy').webuiPopover(settings);
  3083. //用户姓名选中事件
  3084. $("#rapidAcceptsUserName").on("click", function (t) {
  3085. if ($(webuiPopover).css("display") == "block") {
  3086. refeshPatinetList(true);
  3087. }
  3088. });
  3089. }
  3090. /**
  3091. * 刷新候诊病人列表
  3092. */
  3093. function refeshPatinetList(flag) {
  3094. //如果是重新加载病人列表,需要重置下标
  3095. if (flag) {
  3096. //重置下标
  3097. pageIndex = 0;
  3098. msg_list_loading = true;
  3099. }
  3100. var userName = $('#rapidAcceptsUserName').val();
  3101. if (!(userName == null || userName == "" || isChinese(userName))) {
  3102. return;
  3103. }
  3104. $.ajax({
  3105. type: "POST",
  3106. url: '/thmz/getUnClinicWithPage',
  3107. contentType: "application/json;charset=UTF-8",
  3108. dataType: "json",
  3109. data: JSON.stringify({"name": userName, "pageIndex": pageIndex}),
  3110. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3111. success: function (res) {
  3112. if (res == '401' || res == 401) {
  3113. window.location.href = '/thmz/login/view'
  3114. return;
  3115. }
  3116. if (res.code == 0) {
  3117. if (res.data != null && res.data.length > 0) {
  3118. $("#webuiPopover0").css("display", "block");
  3119. $("#webuiPopover0 .webui-popover-content").css("max-height", "300px").css("height", "auto");
  3120. var html = '<div class="list-group">';
  3121. for (var i = 0; i < res.data.length; i++) {
  3122. var mzPatientMi = res.data[i];
  3123. html += '<a href="#" class="list-group-item list-group-item-action" onclick="fillUnClinicPatinet(\'' + mzPatientMi.patientId + '\')">';
  3124. if (mzPatientMi.gender == "男") {
  3125. html += '<img src="/thmz/images/boy.png"/>'
  3126. } else if (mzPatientMi.gender == "女") {
  3127. html += '<img src="/thmz/images/girl.png"/>'
  3128. } else if (mzPatientMi.gender == "未知" || mzPatientMi.gender == null) {
  3129. html += '<img src="/thmz/images/girl_or_boy.png"/>'
  3130. }
  3131. html += '<div>' + mzPatientMi.name + '&nbsp;' + mzPatientMi.gender + '&nbsp;';
  3132. if (mzPatientMi.age != null && mzPatientMi.age != "") {
  3133. html += mzPatientMi.age + '岁';
  3134. } else {
  3135. html += '**岁';
  3136. }
  3137. if (mzPatientMi.phoneNo != null && mzPatientMi.phoneNo != "") {
  3138. html += '<span>' + mzPatientMi.phoneNo + '</span>';
  3139. }
  3140. html += '</div></a>';
  3141. }
  3142. html += '</div>';
  3143. if (flag) {
  3144. $("#webuiPopover0 div.webui-popover-content").html("");
  3145. }
  3146. $("#webuiPopover0 div.webui-popover-content").append(html);
  3147. $("#webuiPopover0 div.arrow").css("left", "23px");
  3148. refeshPatinetListScrollEvent();
  3149. } else {
  3150. $("#webuiPopover0").css("display", "none");
  3151. }
  3152. }
  3153. //查询完成,设置加载完成
  3154. msg_list_loading = false;
  3155. }
  3156. });
  3157. }
  3158. /**
  3159. * 病人下拉列表滚动条滚动到底部时继续加载新纪录
  3160. */
  3161. function refeshPatinetListScrollEvent() {
  3162. $('.webui-popover-content').scroll(function (event) {
  3163. var top = $(this).scrollTop();
  3164. var height = $(this).height();
  3165. var scrollHeight = $(this).get(0).scrollHeight;
  3166. if (scrollHeight <= top + height) {
  3167. if (!msg_list_loading) {
  3168. msg_list_loading = true;
  3169. pageIndex = pageIndex + 1;
  3170. refeshPatinetList(false);
  3171. }
  3172. }
  3173. });
  3174. }
  3175. /**
  3176. * 按照病人id查询病人信息
  3177. * @param patientId
  3178. */
  3179. function fillUnClinicPatinet(patientId) {
  3180. $("#rapidAcceptsUserCardNo").val(patientId);
  3181. $("#webuiPopover0").css("display", "none");
  3182. queryUserInfoByCardNo();
  3183. }
  3184. /**
  3185. * 加载主诉,体格检查,诊断窗口
  3186. */
  3187. function initRecommendList() {
  3188. var width = $("#symptom").parent().css("width");
  3189. var settings = {
  3190. placement: 'bottom-right',//值: auto,top,right,bottom,left,top-right,top-left,bottom-right,bottom-left 要显示的位置
  3191. trigger: 'click', //值:click,hover 触发方式 manual 手动
  3192. content: '',//内容,内容可以是函数
  3193. width: width,
  3194. //arrow:false,//是否显示箭头
  3195. multi: true,//在页面允许其他弹出层
  3196. closeable: true,//显示关闭按钮
  3197. style: '', //值:'',inverse
  3198. delay: 300,//延迟时间, 悬浮属性才执行
  3199. padding: true,//内容填充
  3200. height: 320,
  3201. //offsetTop:10,
  3202. cache: true,//如果缓存设置为false,则popover将销毁并重新创建
  3203. };
  3204. //主诉弹窗
  3205. var symptomWebuiPopover = $('#symptom').webuiPopover('destroy').webuiPopover(settings);
  3206. //体格检查弹窗
  3207. settings.height = 260;
  3208. $('#weight').webuiPopover('destroy').webuiPopover(settings);
  3209. //诊断弹窗
  3210. settings.height = 320;
  3211. var diagnoseWebuiPopover = $('#diagnose').webuiPopover('destroy').webuiPopover(settings);
  3212. //西药弹窗
  3213. settings.width = 680;
  3214. settings.closeable = false;
  3215. settings.arrow = false;//显示箭头或不显示箭头
  3216. settings.content = '<div id="westernMedicinePopoverContent"><table id="tb_table_western_medicine"></table></div>';
  3217. //手动触发
  3218. settings.trigger = 'manual';
  3219. var westernMedicineWebuiPopover = $('#western_medicine_name').webuiPopover('destroy').webuiPopover(settings);
  3220. //中药弹窗
  3221. settings.trigger = 'click';
  3222. settings.content = '<div id="chineseMedicinePopoverContent"><table id="tb_table_chinese_medicine"></table></div>';
  3223. var chineseMedicineWebuiPopover = $('#chinese_medicine_name').webuiPopover('destroy').webuiPopover(settings);
  3224. //诊疗与医技弹窗
  3225. settings.trigger = 'manual';
  3226. settings.content = '<div id="jcJyItemPopoverContent"><table id="tb_table_jc_jy_item"></table></div>';
  3227. var jcJyItemWebuiPopover = $('#jcJyItem').webuiPopover('destroy').webuiPopover(settings);
  3228. //主诉选中事件
  3229. $("#symptom").on("click", function (t) {
  3230. if ($(symptomWebuiPopover).css("display") == "block") {
  3231. $("#webuiPopover1 div.arrow").css("left", "23px");
  3232. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">主诉</span>';
  3233. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='contentHtml'>";
  3234. html += "</div>";
  3235. html += '<div style="height: 60px; line-height: 60px; font-size: 14px;">' +
  3236. '<div style="float: left">' +
  3237. '<span style="margin-left: 20px;">内容:</span> ' +
  3238. '</div>' +
  3239. '<div style="float: left;">' +
  3240. '<select class="form-control selectpicker show-tick" id="paramsType" dropupAuto="true">' +
  3241. '<option label="常用症状" value="0">常用症状</option>' +
  3242. '<option label="常用时间" value="1">常用时间</option>' +
  3243. '<option label="常用标点" value="2">常用标点</option>' +
  3244. '<option label="常用词" value="3">常用词</option>' +
  3245. '</select> ' +
  3246. '</div>' +
  3247. '<div style="width: 200px;float: left;margin-left: 10px;">' +
  3248. '<input id="paramsNameInput" class="form-control" type="text" style="position: relative;top: 13px;height: 34px;">' +
  3249. '</div>' +
  3250. '<div style="float: left;margin-left: 10px;">' +
  3251. ' <button type="button" class="btn" onclick="saveParams();"' +
  3252. ' style="height: 30px;line-height: 15px;border-color: #2e69eb!important;color: #2e69eb;background-color: white;">' +
  3253. ' <svg class="bi" width="1em" height="1em" fill="currentColor" style="vertical-align: -.15em;margin-right: 10px!important;color: #2e69eb;">' +
  3254. ' <use xlink:href="/thmz/css/bootstrap/bootstrap-icons-1.5.0/bootstrap-icons.svg#plus-circle"></use>' +
  3255. ' </svg>' +
  3256. '新增' +
  3257. ' </button>' +
  3258. ' </div>' +
  3259. '</div>';
  3260. $("#webuiPopover1 div.webui-popover-content").html(html);
  3261. $('#paramsType').selectpicker('refresh');
  3262. $("#paramsType").parent().css("width", "140px").css("height", "34px");
  3263. $("#webuiPopover1").css("z-index", "10");
  3264. if ($("#webuiPopover1").hasClass("in")) {
  3265. loadSymptom();
  3266. }
  3267. }
  3268. //加载智能接诊模块的主诉推荐
  3269. fitSymptomData();
  3270. });
  3271. //体格检查各输入框选中事件
  3272. $("#weight,#temperature,#sphygmus,#breathe,#pressure_high,#pressure_floor,#pressure_high_left,#pressure_floor_left").on("click", function (t) {
  3273. if ($("#webuiPopover2").css("display") == "block") {
  3274. $("#webuiPopover2").css("left", $("#webuiPopover1").css("left"));
  3275. if ($("#healthCheckupContentHtml").html() == null || $("#healthCheckupContentHtml").html() == "") {
  3276. $("#webuiPopover2 div.arrow").css("left", "23px");
  3277. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">体格检查</span>';
  3278. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='healthCheckupContentHtml'>";
  3279. html += "</div>";
  3280. $("#webuiPopover2 div.webui-popover-content").html(html);
  3281. $("#webuiPopover2").css("z-index", "10");
  3282. if ($("#webuiPopover2").hasClass("in")) {
  3283. loadHealthCheckup();
  3284. }
  3285. }
  3286. //loadSymptom();
  3287. } else {
  3288. $('#weight').webuiPopover('show');
  3289. $("#webuiPopover2").css("left", $("#webuiPopover1").css("left"));
  3290. if ($("#healthCheckupContentHtml").html() == null || $("#healthCheckupContentHtml").html() != "") {
  3291. $("#webuiPopover2 div.arrow").css("left", "23px");
  3292. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">体格检查</span>';
  3293. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='healthCheckupContentHtml'>";
  3294. html += "</div>";
  3295. $("#webuiPopover2 div.webui-popover-content").html(html);
  3296. $("#webuiPopover2").css("z-index", "10");
  3297. if ($("#webuiPopover2").hasClass("in")) {
  3298. loadHealthCheckup();
  3299. }
  3300. }
  3301. }
  3302. return false;
  3303. });
  3304. //诊断选中事件
  3305. $("#diagnose").on("click", function (t) {
  3306. if ($(diagnoseWebuiPopover).css("display") == "block") {
  3307. $("#webuiPopover3 div.arrow").css("left", "23px");
  3308. $("#webuiPopover3 a.close").css("margin-top", "15px");
  3309. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">诊断</span>';
  3310. html += '<div class="form-group has-feedback" style="float: right;width: 300px;margin-right: 20px;margin-top: 10px;">' +
  3311. ' <input type="text" class="form-control has-feedback-left" ' +
  3312. ' placeholder="搜索" style="padding-left: 10px;" oninput="loadDiagnose(this.value)" id="paramsDiagnose">' +
  3313. ' <span class="fa fa-search form-control-feedback right" aria-hidden="true" style="right: 0px;"></span>' +
  3314. ' </div>';
  3315. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='diagnoseContentHtml'>";
  3316. html += "</div>";
  3317. $("#webuiPopover3 div.webui-popover-content").html(html);
  3318. $("#webuiPopover3").css("z-index", "10");
  3319. //$("#paramsDiagnose").on('input propertychange', loadDiagnose($("#paramsDiagnose").val()));
  3320. loadDiagnose("");
  3321. }
  3322. //加载智能接诊模块的诊断推荐推荐
  3323. fitDiagnoseData();
  3324. });
  3325. //现病史选中事件
  3326. $("#emrHpi").on("click", function (t) {
  3327. //加载智能接诊模块的现病史推荐推荐
  3328. fitEmrHpiData();
  3329. });
  3330. //既往史选中事件
  3331. $("#emrPs").on("click", function (t) {
  3332. //加载智能接诊模块的既往史推荐推荐
  3333. fitEmrPsData();
  3334. });
  3335. // //西药选中事件
  3336. // $("#western_medicine_name").on("click", function (t) {
  3337. // if ($(westernMedicineWebuiPopover).css("display") == "block") {
  3338. // $("#westernMedicinePopoverContent").parent().parent().prev().css("left", "23px");
  3339. // loadYpList(0);
  3340. // }
  3341. // });
  3342. //中药选中事件
  3343. $("#chinese_medicine_name").on("click", function (t) {
  3344. if ($(chineseMedicineWebuiPopover).css("display") == "block") {
  3345. $("#chineseMedicinePopoverContent").parent().parent().prev().css("left", "23px");
  3346. loadYpList(1);
  3347. }
  3348. });
  3349. // //诊疗与医技弹窗选中事件
  3350. // $("#jcJyItem").on("click", function (t) {
  3351. // if ($(jcJyItemWebuiPopover).css("display") == "block") {
  3352. // $("#jcJyItemPopoverContent").parent().parent().prev().css("left", "23px");
  3353. // loadjcJyItemList();
  3354. // }
  3355. // });
  3356. //帮助字典弹窗
  3357. settings.width = 450;
  3358. settings.height = 200;
  3359. settings.placement = 'right';//值: auto,top,right,bottom,left,top-right,top-left,bottom-right,bottom-left 要显示的位置
  3360. settings.content = '<div id="treePopoverContent"><div><ul id="treeDemo" class="ztree"></ul></div></div>';
  3361. settings.trigger = 'click';
  3362. var treeWebuiPopover = $('#treeButton').webuiPopover('destroy').webuiPopover(settings);
  3363. $("#treeButton").on("click", function (t) {
  3364. // $("#treePopoverContent").parent().parent().prev().css("left", "23px");
  3365. //初始化药品,检查检验菜单树
  3366. initzTree();
  3367. });
  3368. }
  3369. /**
  3370. * 新增通用参数
  3371. */
  3372. function saveParams() {
  3373. $.ajax({
  3374. type: "POST",
  3375. url: '/thmz/saveTCommonParams',
  3376. contentType: "application/json;charset=UTF-8",
  3377. dataType: "json",
  3378. data: JSON.stringify({
  3379. "paramsType": $("#paramsType").val(),
  3380. "paramsName": $("#paramsNameInput").val()
  3381. }),
  3382. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3383. success: function (res) {
  3384. if (res == '401' || res == 401) {
  3385. window.location.href = '/thmz/login/view'
  3386. return;
  3387. }
  3388. if (res.code == 0) {
  3389. successMesage(res);
  3390. loadSymptom();
  3391. $("#paramsNameInput").val(null);
  3392. // $("#paramsType").selectpicker('val', 0);
  3393. // $("#paramsType").selectpicker('refresh');
  3394. } else {
  3395. errorMesage(res);
  3396. }
  3397. }
  3398. });
  3399. }
  3400. /**
  3401. * 加载主诉参数列表
  3402. */
  3403. function loadSymptom() {
  3404. $.ajax({
  3405. type: "GET",
  3406. url: '/thmz/loadSymptom',
  3407. contentType: "application/json;charset=UTF-8",
  3408. dataType: "json",
  3409. async: false,
  3410. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3411. success: function (res) {
  3412. if (res == '401' || res == 401) {
  3413. window.location.href = '/thmz/login/view'
  3414. return;
  3415. }
  3416. var html = '';
  3417. if (res.code == 0) {
  3418. if (res.featureList != null && res.featureList.length > 0) {
  3419. html += '<div id="feature">';
  3420. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用症状:</div>';
  3421. html += '<div style="width: calc(100% - 80px); float: left;">';
  3422. for (var i = 0; i < res.featureList.length; i++) {
  3423. html += '<button type="button" class="button_color" style="background-color: rgb(255, 255, 255);border: none;" onclick="fitValue(\'' + res.featureList[i].paramsName + '\',\'symptom\')"><span style="padding: 0px 5px;">';
  3424. html += res.featureList[i].paramsName;
  3425. html += '</span></button>';
  3426. }
  3427. html += '</div><div style="clear:both"></div></div>';
  3428. }
  3429. if (res.timeList != null && res.timeList.length > 0) {
  3430. html += '<div id="time">';
  3431. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用时间:</div>';
  3432. html += '<div style="width: calc(100% - 80px); float: left;">';
  3433. for (var i = 0; i < res.timeList.length; i++) {
  3434. html += '<button type="button" class="button_color" style="background-color: rgb(255, 255, 255);border: none;" onclick="fitValue(\'' + res.timeList[i].paramsName + '\',\'symptom\')"><span style="padding: 0px 5px;">';
  3435. html += res.timeList[i].paramsName;
  3436. html += '</span></button>';
  3437. }
  3438. html += '</div><div style="clear:both"></div></div>';
  3439. }
  3440. if (res.characterList != null && res.characterList.length > 0) {
  3441. html += '<div id="character">';
  3442. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用标点:</div>';
  3443. html += '<div style="width: calc(100% - 80px); float: left;">';
  3444. for (var i = 0; i < res.characterList.length; i++) {
  3445. html += '<button type="button" class="button_color" style="background-color: rgb(255, 255, 255);border: none;" onclick="fitValue(\'' + res.characterList[i].paramsName + '\',\'symptom\')"><span style="padding: 0px 5px;">';
  3446. html += res.characterList[i].paramsName;
  3447. html += '</span></button>';
  3448. }
  3449. html += '</div><div style="clear:both"></div></div>';
  3450. }
  3451. if (res.wordsList != null && res.wordsList.length > 0) {
  3452. html += '<div id="words">';
  3453. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用词:</div>';
  3454. html += '<div style="width: calc(100% - 80px); float: left;">';
  3455. for (var i = 0; i < res.wordsList.length; i++) {
  3456. html += '<button type="button" class="button_color" style="background-color: rgb(255, 255, 255);border: none;" onclick="fitValue(\'' + res.wordsList[i].paramsName + '\',\'symptom\')"><span style="padding: 0px 5px;">';
  3457. html += res.wordsList[i].paramsName;
  3458. html += '</span></button>';
  3459. }
  3460. html += '</div><div style="clear:both"></div></div>';
  3461. }
  3462. } else {
  3463. errorMesage(res);
  3464. }
  3465. $("#contentHtml").html(html);
  3466. }
  3467. });
  3468. }
  3469. /**
  3470. * 加载体格检查参数列表
  3471. */
  3472. function loadHealthCheckup() {
  3473. $.ajax({
  3474. type: "GET",
  3475. url: '/thmz/loadHealthCheckup',
  3476. contentType: "application/json;charset=UTF-8",
  3477. dataType: "json",
  3478. async: false,
  3479. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3480. success: function (res) {
  3481. if (res == '401' || res == 401) {
  3482. window.location.href = '/thmz/login/view'
  3483. return;
  3484. }
  3485. var html = '';
  3486. if (res.code == 0) {
  3487. if (res.weightList != null && res.weightList.length > 0) {
  3488. html += '<div id="weightDiv">';
  3489. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">体重:</div>';
  3490. html += '<div style="width: calc(100% - 80px); float: left;">';
  3491. for (var i = 0; i < res.weightList.length; i++) {
  3492. html += '<button type="button" class="button_color" style="background-color: rgb(255, 255, 255);border: none;" onclick="fitValue(\'' + res.weightList[i].paramsName + '\',\'weight\')"><span style="padding: 0px 5px;">';
  3493. html += res.weightList[i].paramsName;
  3494. html += '</span></button>';
  3495. }
  3496. html += '</div><div style="clear:both"></div></div>';
  3497. }
  3498. if (res.temperatureList != null && res.temperatureList.length > 0) {
  3499. html += '<div id="temperatureDiv">';
  3500. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">体温:</div>';
  3501. html += '<div style="width: calc(100% - 80px); float: left;">';
  3502. for (var i = 0; i < res.temperatureList.length; i++) {
  3503. html += '<button type="button" class="button_color" style="background-color: rgb(255, 255, 255);border: none;" onclick="fitValue(\'' + res.temperatureList[i].paramsName + '\',\'temperature\')"><span style="padding: 0px 5px;">';
  3504. html += res.temperatureList[i].paramsName;
  3505. html += '</span></button>';
  3506. }
  3507. html += '</div><div style="clear:both"></div></div>';
  3508. }
  3509. if (res.sphygmusList != null && res.sphygmusList.length > 0) {
  3510. html += '<div id="sphygmusDiv">';
  3511. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">脉搏:</div>';
  3512. html += '<div style="width: calc(100% - 80px); float: left;">';
  3513. for (var i = 0; i < res.sphygmusList.length; i++) {
  3514. html += '<button type="button" class="button_color" style="background-color: rgb(255, 255, 255);border: none;" onclick="fitValue(\'' + res.sphygmusList[i].paramsName + '\',\'sphygmus\')"><span style="padding: 0px 5px;">';
  3515. html += res.sphygmusList[i].paramsName;
  3516. html += '</span></button>';
  3517. }
  3518. html += '</div><div style="clear:both"></div></div>';
  3519. }
  3520. if (res.breatheList != null && res.breatheList.length > 0) {
  3521. html += '<div id="breatheDiv">';
  3522. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">呼吸:</div>';
  3523. html += '<div style="width: calc(100% - 80px); float: left;">';
  3524. for (var i = 0; i < res.breatheList.length; i++) {
  3525. html += '<button type="button" class="button_color" style="background-color: rgb(255, 255, 255);border: none;" onclick="fitValue(\'' + res.breatheList[i].paramsName + '\',\'breathe\')"><span style="padding: 0px 5px;">';
  3526. html += res.breatheList[i].paramsName;
  3527. html += '</span></button>';
  3528. }
  3529. html += '</div><div style="clear:both"></div></div>';
  3530. }
  3531. if (res.pressureList != null && res.pressureList.length > 0) {
  3532. html += '<div id="pressureDiv">';
  3533. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">血压:</div>';
  3534. html += '<div style="width: calc(100% - 80px); float: left;">';
  3535. for (var i = 0; i < res.pressureList.length; i++) {
  3536. html += '<button type="button" class="button_color" style="background-color: rgb(255, 255, 255);border: none;" onclick="fitValue(\'' + res.pressureList[i].paramsName + '\',\'pressure_\')"><span style="padding: 0px 5px;">';
  3537. html += res.pressureList[i].paramsName;
  3538. html += '</span></button>';
  3539. }
  3540. html += '</div><div style="clear:both"></div></div>';
  3541. }
  3542. } else {
  3543. errorMesage(res);
  3544. }
  3545. $("#healthCheckupContentHtml").html(html);
  3546. }
  3547. });
  3548. }
  3549. /**
  3550. * 加载诊断参数列表
  3551. * @param value
  3552. */
  3553. function loadDiagnose(value) {
  3554. if (!$("#webuiPopover3").hasClass("in")) {
  3555. return;
  3556. }
  3557. $.ajax({
  3558. type: "GET",
  3559. url: '/thmz/getTCommonParamsByParamsType?paramsType=4&commonParams=' + value + '&pageSize=100',
  3560. contentType: "application/json;charset=UTF-8",
  3561. dataType: "json",
  3562. async: false,
  3563. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3564. success: function (res) {
  3565. if (res == '401' || res == 401) {
  3566. window.location.href = '/thmz/login/view'
  3567. return;
  3568. }
  3569. var html = '';
  3570. if (res.code == 0) {
  3571. if (res.data != null && res.data.length > 0) {
  3572. html += '<div>';
  3573. for (var i = 0; i < res.data.length; i++) {
  3574. html += '<button type="button" class="button_color" style="background-color: rgb(255, 255, 255);border: none;" onclick="fitDiagnoseValue(\'' + res.data[i].paramsName + '\',\'' + res.data[i].paramsCode + '\')"><span style="padding: 0px 5px;font-size: 20px;">';
  3575. html += res.data[i].paramsName;
  3576. html += '<small>&nbsp;&nbsp;(' + res.data[i].paramsCode + ')</small>';
  3577. html += '</span></button>';
  3578. }
  3579. html += '</div>';
  3580. }
  3581. } else {
  3582. errorMesage(res);
  3583. }
  3584. $("#diagnoseContentHtml").html(html);
  3585. }
  3586. });
  3587. }
  3588. /**
  3589. * 填充诊断
  3590. * @param value
  3591. * @param code
  3592. */
  3593. function fitDiagnoseValue(value, code) {
  3594. if (code === null || code === "") {
  3595. return;
  3596. }
  3597. var html = '';
  3598. var childrenNum = $("#diagnoseTags").children().length;
  3599. if (childrenNum == 2) {
  3600. errorMesageSimaple("最多填写两个诊断!");
  3601. return;
  3602. }
  3603. var diagnoseValue = $("#diagnoseValue").val();
  3604. if (diagnoseValue == null || diagnoseValue == "") {
  3605. diagnoseValue = code;
  3606. } else {
  3607. if (diagnoseValue.indexOf(code) != -1) {
  3608. errorMesageSimaple("诊断已存在,请勿重复添加!");
  3609. return;
  3610. }
  3611. diagnoseValue += "," + code;
  3612. }
  3613. $("#diagnoseValue").val(diagnoseValue);
  3614. if (childrenNum == 0) {
  3615. html += '<span class="el-tag--mainDiagnosis" ';
  3616. } else {
  3617. html += '<span class="el-tag--secondaryDiagnosis" ';
  3618. }
  3619. html += ' title="' + value + '(' + code + ')" id="' + code + '"><span class="el-select__tags-text">' + value + '</span><i class="fa fa-remove .el-icon-close" style="margin-left: 10px;height: 16px;width: 16px;cursor: pointer;" onclick="removeDiagnoseValue(\'' + code + '\')"></i><span style="clear: both"></span></span>';
  3620. $("#diagnoseTags").append(html);
  3621. }
  3622. /**
  3623. * 移除诊断
  3624. * @param code
  3625. */
  3626. function removeDiagnoseValue(code) {
  3627. var childrenIndex = 0;
  3628. var children = $("#diagnoseTags").children();
  3629. for (var i = 0; i < children.length; i++) {
  3630. if ($(children[i]).attr("id") == code) {
  3631. childrenIndex = i;
  3632. break;
  3633. }
  3634. }
  3635. $($("#diagnoseTags").children("span")[childrenIndex]).remove();
  3636. if (childrenIndex == 0) {
  3637. $($("#diagnoseTags").children("span")[childrenIndex]).removeClass("el-tag--secondaryDiagnosis").addClass("el-tag--mainDiagnosis");
  3638. }
  3639. var diagnoseValue = $("#diagnoseValue").val();
  3640. $("#diagnoseValue").val(diagnoseValue.replace(code, ""));
  3641. }
  3642. /**
  3643. * 点击通用参数属性值时设置值到对应的区域
  3644. * @param value
  3645. * @param id
  3646. */
  3647. function fitValue(value, id) {
  3648. //当选择的是血压时
  3649. if (id == "pressure_") {
  3650. var arr = value.split("/");
  3651. $("#pressure_high").val(arr[0]);
  3652. $("#pressure_floor").val(arr[1]);
  3653. if ($("#pressureLeftFlag").hasClass("in")) {
  3654. $("#pressure_high_left").val(arr[0]);
  3655. $("#pressure_floor_left").val(arr[1]);
  3656. }
  3657. //当选的是体重,体温,脉搏和呼吸时
  3658. } else if (id == "weight" || id == "temperature" || id == "sphygmus" || id == "breathe") {
  3659. $("#" + id).val(value);
  3660. } else {
  3661. //主诉拼写时
  3662. var valueExist = $("#" + id).val();
  3663. if (valueExist != null && valueExist != "") {
  3664. value = valueExist + value;
  3665. }
  3666. $("#" + id).val(value);
  3667. }
  3668. }
  3669. /**
  3670. * 加载药品列表数列表
  3671. * @param index
  3672. */
  3673. function loadYpList(index) {
  3674. //var medicinePopoverContent = null;
  3675. var tableMedicine = null;
  3676. var MedicineName = null;
  3677. //var groupNo=null;
  3678. if (index == 0) {
  3679. // medicinePopoverContent = "westernMedicinePopoverContent";
  3680. tableMedicine = "tb_table_western_medicine";
  3681. MedicineName = "western_medicine_name";
  3682. // groupNo=71;
  3683. }
  3684. if (index == 1) {
  3685. // medicinePopoverContent = "chineseMedicinePopoverContent";
  3686. tableMedicine = "tb_table_chinese_medicine";
  3687. MedicineName = "chinese_medicine_name";
  3688. // groupNo=$("#zyClassType").val();
  3689. }
  3690. // if (!$("#" + medicinePopoverContent).parent().parent().parent().hasClass("in")) {
  3691. // return;
  3692. // }
  3693. $('#' + tableMedicine).bootstrapTable('refresh');
  3694. $('#' + tableMedicine).bootstrapTable({
  3695. url: '/thmz/getYpListByCommonParams', //请求后台的URL(*)
  3696. method: 'GET', //请求方式(*)
  3697. toolbar: '#toolbar', //工具按钮用哪个容器
  3698. striped: true, //是否显示行间隔色
  3699. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  3700. pagination: false, //是否显示分页(*)
  3701. sortable: true, //是否启用排序
  3702. sortOrder: "asc", //排序方式
  3703. queryParams: function (params) {
  3704. var groupNo = null;
  3705. if (index == 0) {
  3706. groupNo = 71;
  3707. }
  3708. if (index == 1) {
  3709. groupNo = $("#zyClassType").val();
  3710. }
  3711. var temp = {
  3712. groupNo: groupNo,
  3713. commonParams: $("#" + MedicineName).val()
  3714. };
  3715. return temp;
  3716. }, //传递参数(*)
  3717. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  3718. pageNumber: 1, //初始化加载第一页,默认第一页
  3719. pageSize: 5, //每页的记录行数(*)
  3720. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  3721. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  3722. strictSearch: true,
  3723. showColumns: false, //是否显示所有的列
  3724. showRefresh: false, //是否显示刷新按钮
  3725. minimumCountColumns: 2, //最少允许的列数
  3726. clickToSelect: true, //是否启用点击选中行
  3727. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  3728. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  3729. cardView: false, //是否显示详细视图
  3730. detailView: false,
  3731. //rowStyle:rowStyle,//通过自定义函数设置行样式
  3732. ajaxOptions: {
  3733. headers: {
  3734. 'Accept': 'application/json',
  3735. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  3736. }
  3737. },
  3738. columns: [
  3739. {
  3740. field: 'code',
  3741. title: '编码',
  3742. align: "center",
  3743. valign: 'middle',
  3744. // sortable: true
  3745. }, {
  3746. field: 'name',
  3747. title: '药品名称',
  3748. align: "center",
  3749. valign: 'middle',
  3750. // sortable: true
  3751. }
  3752. , {
  3753. field: 'specification',
  3754. title: '规格',
  3755. align: "center",
  3756. valign: 'middle',
  3757. // sortable: true
  3758. }, {
  3759. field: 'manufactory',
  3760. title: '生产厂家',
  3761. align: "center",
  3762. valign: 'middle',
  3763. // sortable: true
  3764. }, {
  3765. field: 'miniUnitName',
  3766. title: '单位',
  3767. align: "center",
  3768. valign: 'middle',
  3769. // sortable: true
  3770. }, {
  3771. field: 'chargeAmount',
  3772. title: '零售价',
  3773. align: "center",
  3774. valign: 'middle',
  3775. // sortable: true
  3776. formatter: function (value, row, index) {
  3777. if (value == null) {
  3778. return '0.0元';
  3779. }
  3780. return value.toFixed(2) + "元";
  3781. }
  3782. }, {
  3783. field: 'drugWinDesc',
  3784. title: '剂量',
  3785. align: "center",
  3786. valign: 'middle',
  3787. // sortable: true
  3788. }, {
  3789. field: 'stockAmountVirtual',
  3790. title: '库存数量',
  3791. align: "center",
  3792. valign: 'middle',
  3793. // sortable: true
  3794. }
  3795. ],
  3796. responseHandler: function (res) {
  3797. if (res == '401' || res == 401) {
  3798. window.location.href = '/thmz/login/view'
  3799. return;
  3800. }
  3801. var ress = eval(res);
  3802. if (ress.code == -1) {
  3803. errorMesage(res);
  3804. return {
  3805. "total": 0,//总页数
  3806. "rows": {} //数据
  3807. };
  3808. }
  3809. return {
  3810. "total": ress.data.length,//总页数
  3811. "rows": ress.data //数据
  3812. };
  3813. },
  3814. onClickRow: function (row, $element) {
  3815. $('#' + MedicineName).webuiPopover('hide');
  3816. if (index == 0) {
  3817. checkYpInfo(row.code, row.serial, row.ypType, true);
  3818. }
  3819. if (index == 1) {
  3820. checkZyInfo(row.code, row.serial, true);
  3821. }
  3822. }
  3823. });
  3824. }
  3825. /**
  3826. * 按照药品的编码 和药品拆零规格查询药品信息 西药
  3827. * @param code
  3828. * @param serial
  3829. * @param groupNo
  3830. * @param needNotice 是否需要提示 当用户操作的时候 true 需要提示, 范文和处方回写的时候false不需要提示
  3831. */
  3832. function checkYpInfo(code, serial, groupNo, needNotice) {
  3833. //判断是否有重复的项目 返回true 说明有重复的
  3834. if (verifyRepeat(code, serial, 0)) {
  3835. return;
  3836. }
  3837. $("#current_groupNo").val(groupNo);
  3838. $("#treeButton").webuiPopover('hide');
  3839. $.ajax({
  3840. type: "GET",
  3841. url: '/thmz/getYpZdDictByCodeAndSerial?code=' + code + "&serial=" + serial,
  3842. contentType: "application/json;charset=UTF-8",
  3843. dataType: "json",
  3844. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3845. async: needNotice,//当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  3846. success: function (res) {
  3847. if (res == '401' || res == 401) {
  3848. window.location.href = '/thmz/login/view'
  3849. return;
  3850. }
  3851. if (res.code == 0) {
  3852. if (res.data != null) {
  3853. //如果
  3854. if ($("#xyTab").find("li") == null || $("#xyTab").find("li").length == 0) {
  3855. initNavTabs(0);
  3856. }
  3857. var cfdesc = '普药';
  3858. if (groupNo == '91') {
  3859. cfdesc = '医材';
  3860. } else if (groupNo == '111') {
  3861. cfdesc = '麻、精一';
  3862. } else if (groupNo == '131') {
  3863. cfdesc = '精二';
  3864. }
  3865. // else if(groupNo=='151'){
  3866. // cfdesc='诊疗';
  3867. // }
  3868. $("#xyTab li.active").find("a").find("small.cfdesc").text("(" + cfdesc + ")");
  3869. //每个处方不能超过5个药品
  3870. var tableId = $("#xyTab li.active").find("a").attr("href");
  3871. var childrens = $(tableId).find("div:eq(0)").children().length;
  3872. var currentGroupNo = $(tableId).find("input.current_groupNo").val();
  3873. if (childrens === 5) {
  3874. if (needNotice) {
  3875. $("#messageModal").modal();
  3876. $("#messageContent").html("单张处方最多只能开具5个药品,是否需要新增处方?");
  3877. $("#messageButton").off("click").on("click", function (t) {
  3878. $("#messageModal").modal("hide");
  3879. refreshNavTabs(0, groupNo);
  3880. fitWesternMedicine(res, groupNo);
  3881. });
  3882. } else {
  3883. refreshNavTabs(0, groupNo);
  3884. fitWesternMedicine(res, groupNo);
  3885. }
  3886. } else if (currentGroupNo != null && currentGroupNo != '' && groupNo != currentGroupNo) {
  3887. //当前编辑的处方与选中的品类非同一处方能保存的
  3888. var currentGroupNos = $("#xyTabContent").find("input.current_groupNo");
  3889. //是否需要新增处方页,以保存医材处方
  3890. var needAddTable = true;
  3891. for (var i = 0; i < currentGroupNos.length; i++) {
  3892. if ($(currentGroupNos[i]).val() == groupNo) {
  3893. var next = $(currentGroupNos[i]).next();
  3894. if ($(next).children().length < 5) {
  3895. var parentId = $(currentGroupNos[i]).parent().attr("id");
  3896. //切换处方
  3897. $("#xyTab").find("a[href='#" + parentId + "']").off("click").tab('show');
  3898. //因为存在没有满5个的处方页,直接保存到该页
  3899. needAddTable = false;
  3900. fitWesternMedicine(res, groupNo);
  3901. }
  3902. }
  3903. }
  3904. if (needAddTable) {
  3905. //91 医材
  3906. var message = "医材需要单独处方,是否需要新增医材处方?";
  3907. if (groupNo == '71') {
  3908. message = "普通西成药需要单独处方,是否需要新增处方?"
  3909. } else if (groupNo == '111') {
  3910. message = "麻、精一药物需要单独处方,是否需要新增处方?"
  3911. } else if (groupNo == '131') {
  3912. message = "精二药物需要单独处方,是否需要新增处方?"
  3913. }
  3914. if (needNotice) {
  3915. $("#messageModal").modal();
  3916. $("#messageContent").html(message);
  3917. $("#messageButton").off("click").on("click", function (t) {
  3918. $("#messageModal").modal("hide");
  3919. refreshNavTabs(0, groupNo);
  3920. fitWesternMedicine(res, groupNo);
  3921. });
  3922. } else {
  3923. refreshNavTabs(0, groupNo);
  3924. fitWesternMedicine(res, groupNo);
  3925. }
  3926. }
  3927. //当前编辑的处方非普通西药处方
  3928. } else {
  3929. fitWesternMedicine(res, groupNo);
  3930. }
  3931. }
  3932. } else {
  3933. errorMesage(res);
  3934. }
  3935. }
  3936. });
  3937. }
  3938. /**
  3939. * 按照药品的编码 和药品拆零规格查询药品信息 中药
  3940. * @param code
  3941. * @param serial
  3942. * @param async 当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  3943. */
  3944. function checkZyInfo(code, serial, async) {
  3945. //判断是否有重复的项目 返回true 说明有重复的
  3946. if (verifyRepeat(code, serial, 1)) {
  3947. return;
  3948. }
  3949. $.ajax({
  3950. type: "GET",
  3951. url: '/thmz/getYpZdDictByCodeAndSerial?code=' + code + "&serial=" + serial,
  3952. contentType: "application/json;charset=UTF-8",
  3953. dataType: "json",
  3954. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3955. async: async,//当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  3956. success: function (res) {
  3957. if (res == '401' || res == 401) {
  3958. window.location.href = '/thmz/login/view'
  3959. return;
  3960. }
  3961. if (res.code == 0) {
  3962. if (res.data != null) {
  3963. //如果
  3964. if ($("#zyTab").find("li") == null || $("#zyTab").find("li").length == 0) {
  3965. initNavTabs(1);
  3966. }
  3967. $("#chinese_medicine_name").val(res.data.name);
  3968. $("#chinese_medicine_name").blur();
  3969. $("#zy_drugWin").val(res.data.weight);
  3970. $("#zy_packRetprice").val(res.data.packRetprice);
  3971. $("#current_code").val(res.data.code);
  3972. $("#current_serial").val(res.data.serial);
  3973. }
  3974. } else {
  3975. errorMesage(res);
  3976. }
  3977. }
  3978. });
  3979. }
  3980. /**
  3981. * 加载医技与诊疗列表
  3982. * @param index
  3983. */
  3984. function loadjcJyItemList() {
  3985. // if (!$("#jcJyItemPopoverContent").parent().parent().parent().hasClass("in")) {
  3986. // return;
  3987. // }
  3988. $('#tb_table_jc_jy_item').bootstrapTable('refresh');
  3989. $('#tb_table_jc_jy_item').bootstrapTable({
  3990. url: '/thmz/getJcJyItemByCommonParams', //请求后台的URL(*)
  3991. method: 'GET', //请求方式(*)
  3992. toolbar: '#toolbar', //工具按钮用哪个容器
  3993. striped: true, //是否显示行间隔色
  3994. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  3995. pagination: false, //是否显示分页(*)
  3996. sortable: true, //是否启用排序
  3997. sortOrder: "asc", //排序方式
  3998. queryParams: function (params) {
  3999. var temp = {
  4000. commonParams: $("#jcJyItem").val()
  4001. };
  4002. return temp;
  4003. }, //传递参数(*)
  4004. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  4005. pageNumber: 1, //初始化加载第一页,默认第一页
  4006. pageSize: 5, //每页的记录行数(*)
  4007. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  4008. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  4009. strictSearch: true,
  4010. showColumns: false, //是否显示所有的列
  4011. showRefresh: false, //是否显示刷新按钮
  4012. minimumCountColumns: 2, //最少允许的列数
  4013. clickToSelect: true, //是否启用点击选中行
  4014. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  4015. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  4016. cardView: false, //是否显示详细视图
  4017. detailView: false,
  4018. //rowStyle:rowStyle,//通过自定义函数设置行样式
  4019. ajaxOptions: {
  4020. headers: {
  4021. 'Accept': 'application/json',
  4022. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  4023. }
  4024. },
  4025. columns: [
  4026. {
  4027. field: 'code',
  4028. title: '编码',
  4029. align: "center",
  4030. valign: 'middle',
  4031. // sortable: true
  4032. }, {
  4033. field: 'name',
  4034. title: '名称',
  4035. align: "center",
  4036. valign: 'middle',
  4037. // sortable: true
  4038. }
  4039. , {
  4040. field: 'execUnitName',
  4041. title: '执行科室',
  4042. align: "center",
  4043. valign: 'middle',
  4044. // sortable: true
  4045. }
  4046. ],
  4047. responseHandler: function (res) {
  4048. if (res == '401' || res == 401) {
  4049. window.location.href = '/thmz/login/view'
  4050. return;
  4051. }
  4052. var ress = eval(res);
  4053. if (ress.code == -1) {
  4054. errorMesage(res);
  4055. return {
  4056. "total": 0,//总页数
  4057. "rows": {} //数据
  4058. };
  4059. }
  4060. return {
  4061. "total": ress.data.length,//总页数
  4062. "rows": ress.data //数据
  4063. };
  4064. },
  4065. onClickRow: function (row, $element) {
  4066. $('#jcJyItem').webuiPopover('hide');
  4067. $("#jcJyZltype").val(row.type);
  4068. if (row.type == 3) {
  4069. //诊疗
  4070. if ($("#zlTab").find("li") == null || $("#zlTab").find("li").length == 0) {
  4071. initNavTabs(2);
  4072. }
  4073. $("#jcJyItem").val(row.name);
  4074. $("#jcJyItem").blur();
  4075. $("#jcjyItemPrice").val(row.chargeAmount);
  4076. $("#chargeUnit").val(row.specification);
  4077. $("#current_code").val(row.code);
  4078. $("#jcJyItemChargeDetail").removeClass("in").addClass("hide");
  4079. $("#chargeUnitDiv").removeClass("hide").addClass("in");
  4080. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  4081. $("#yshPartDiv").removeClass("in").addClass("hide");
  4082. return;
  4083. }
  4084. if (row.type == 1) {
  4085. //检验
  4086. $("#jyZdSampleDiv").removeClass("hide").addClass("in");
  4087. $("#chargeUnitDiv").removeClass("in").addClass("hide");
  4088. $("#yshPartDiv").removeClass("in").addClass("hide");
  4089. if (row.sampleCode != null && row.sampleCode != "") {
  4090. $("#jyZdSample").selectpicker('val', row.sampleCode);
  4091. $('#jyZdSample').selectpicker('refresh');
  4092. }
  4093. } else if (row.type == 2) {
  4094. //检查
  4095. $("#yshPartDiv").removeClass("hide").addClass("in");
  4096. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  4097. $("#chargeUnitDiv").removeClass("in").addClass("hide");
  4098. if (row.bwCode != null && row.bwCode != "") {
  4099. $("#yshPart").selectpicker('val', row.bwCode);
  4100. $('#yshPart').selectpicker('refresh');
  4101. }
  4102. }
  4103. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  4104. checkJcJyItemInfo(row.code, row.name, true);
  4105. }
  4106. });
  4107. }
  4108. /**
  4109. * 诊疗与医技选中
  4110. * @param code
  4111. * @param name 回写的时候可以设置null
  4112. * @param type 1 检验 2 检查 3 诊疗
  4113. * @param async 当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  4114. */
  4115. //function checkJcJyItemInfo(code, name, type) {
  4116. function checkJcJyItemInfo(code, name, async) {
  4117. //判断是否有重复的项目 返回true 说明有重复的
  4118. if (verifyRepeat(code, null, 2)) {
  4119. return;
  4120. }
  4121. $("#treeButton").webuiPopover('hide');
  4122. $.ajax({
  4123. type: "GET",
  4124. url: '/thmz/getJcJyItemChargeByCode?code=' + code,
  4125. contentType: "application/json;charset=UTF-8",
  4126. dataType: "json",
  4127. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4128. async: async,//当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  4129. success: function (res) {
  4130. if (res == '401' || res == 401) {
  4131. window.location.href = '/thmz/login/view'
  4132. return;
  4133. }
  4134. if (res.code == 0) {
  4135. if (res.data != null) {
  4136. //如果
  4137. if ($("#zlTab").find("li") == null || $("#zlTab").find("li").length == 0) {
  4138. initNavTabs(2);
  4139. }
  4140. if (name == null) {
  4141. name = res.name;
  4142. }
  4143. $("#jcJyItem").val(name);
  4144. $("#jcJyItem").blur();
  4145. $("#jcjyItemPrice").val(res.totalAmount);
  4146. $("#current_code").val(code);
  4147. }
  4148. } else {
  4149. errorMesage(res);
  4150. }
  4151. }
  4152. });
  4153. }
  4154. /**
  4155. * 查询诊疗与医技项目明细
  4156. * @param code 编码
  4157. */
  4158. function getJcJyItemChargeByCode(code) {
  4159. if (code != null) {
  4160. $("#itemCodeSearch").val(code);
  4161. } else if ($("#current_code").val() == null || $("#current_code").val() == '') {
  4162. errorMesageSimaple("未选中任何项目!");
  4163. return;
  4164. }
  4165. $("#jcJyItemModal").modal("show");
  4166. $('#jcJyItemTable').bootstrapTable('refresh');
  4167. $('#jcJyItemTable').bootstrapTable({
  4168. url: '/thmz/getJcJyItemChargeByCode', //请求后台的URL(*)
  4169. method: 'GET', //请求方式(*)
  4170. toolbar: '#toolbar', //工具按钮用哪个容器
  4171. striped: true, //是否显示行间隔色
  4172. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  4173. pagination: false, //是否显示分页(*)
  4174. sortable: true, //是否启用排序
  4175. sortOrder: "asc", //排序方式
  4176. queryParams: function (params) {
  4177. var itemCodeSearch = $("#itemCodeSearch").val();
  4178. if (itemCodeSearch == null || itemCodeSearch == "") {
  4179. itemCodeSearch = $("#current_code").val();
  4180. }
  4181. var temp = {
  4182. code: itemCodeSearch
  4183. };
  4184. return temp;
  4185. }, //传递参数(*)
  4186. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  4187. pageNumber: 1, //初始化加载第一页,默认第一页
  4188. pageSize: 5, //每页的记录行数(*)
  4189. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  4190. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  4191. strictSearch: true,
  4192. showColumns: false, //是否显示所有的列
  4193. showRefresh: false, //是否显示刷新按钮
  4194. minimumCountColumns: 2, //最少允许的列数
  4195. clickToSelect: true, //是否启用点击选中行
  4196. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  4197. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  4198. cardView: false, //是否显示详细视图
  4199. detailView: false,
  4200. //rowStyle:rowStyle,//通过自定义函数设置行样式
  4201. ajaxOptions: {
  4202. headers: {
  4203. 'Accept': 'application/json',
  4204. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  4205. }
  4206. },
  4207. columns: [
  4208. {
  4209. field: 'tcCode',
  4210. title: '项目编码',
  4211. align: "center",
  4212. valign: 'middle',
  4213. // sortable: true
  4214. }, {
  4215. field: 'code',
  4216. title: '收费编码',
  4217. align: "center",
  4218. valign: 'middle',
  4219. // sortable: true
  4220. }
  4221. , {
  4222. field: 'name',
  4223. title: '收费名称',
  4224. align: "center",
  4225. valign: 'middle',
  4226. // sortable: true
  4227. }, {
  4228. field: 'num',
  4229. title: '数量',
  4230. align: "center",
  4231. valign: 'middle',
  4232. // sortable: true
  4233. }, {
  4234. field: 'chargeAmount',
  4235. title: '单价',
  4236. align: "center",
  4237. valign: 'middle',
  4238. // sortable: true
  4239. formatter: function (value, row, index) {
  4240. if (value == null || value == "") {
  4241. return 0;
  4242. }
  4243. return value.toFixed(2);
  4244. }
  4245. }, {
  4246. field: 'totalAmount',
  4247. title: '总金额',
  4248. align: "center",
  4249. valign: 'middle',
  4250. // sortable: true
  4251. formatter: function (value, row, index) {
  4252. if (value == null || value == "") {
  4253. return 0;
  4254. }
  4255. return value.toFixed(2);
  4256. }
  4257. }
  4258. ],
  4259. responseHandler: function (res) {
  4260. if (res == '401' || res == 401) {
  4261. window.location.href = '/thmz/login/view'
  4262. return;
  4263. }
  4264. $("#itemCodeSearch").val(null);
  4265. var ress = eval(res);
  4266. if (ress.code == -1) {
  4267. errorMesage(res);
  4268. return {
  4269. "total": 0,//总页数
  4270. "rows": {} //数据
  4271. };
  4272. }
  4273. return {
  4274. "total": ress.data.length,//总页数
  4275. "rows": ress.data //数据
  4276. };
  4277. }
  4278. });
  4279. }
  4280. /**
  4281. * 判断是否有重复的项目 返回true 说明有重复的
  4282. * @param code
  4283. * @param serial
  4284. * @param index
  4285. */
  4286. function verifyRepeat(code, serial, index) {
  4287. //是新增药品还是编辑 true 修改 默认false
  4288. var updateFlag = $("#update_flag").val();
  4289. if (updateFlag == undefined || updateFlag == null) {
  4290. updateFlag = false;
  4291. }
  4292. if (updateFlag == "true" || updateFlag == true) {
  4293. return false;
  4294. }
  4295. var tabId = null;
  4296. //西药
  4297. if (index == 0) {
  4298. tabId = "xyTab";
  4299. } else if (index == 1) {
  4300. //中成药
  4301. tabId = "zyTab";
  4302. } else if (index == 2) {
  4303. //医技与诊疗
  4304. tabId = "zlTab";
  4305. } else if (index == 3) {
  4306. //入院
  4307. tabId = "zyReqTab";
  4308. }
  4309. var tableId = $("#" + tabId + " li.active").find("a").attr("href");
  4310. var items = $(tableId).find("div:eq(0)").find("div.form-group");
  4311. if (items != null && items.length > 0) {
  4312. for (var i = 0; i < items.length; i++) {
  4313. if (serial == null) {
  4314. var temporary_items_code = $(items[i]).find("input.temporary_items_code").val();
  4315. if (code === temporary_items_code) {
  4316. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  4317. return true;
  4318. }
  4319. } else {
  4320. var temporary_items_code = $(items[i]).find("input.temporary_items_code").val();
  4321. var temporary_items_serial = $(items[i]).find("input.temporary_items_serial").val();
  4322. if (code === temporary_items_code && serial === temporary_items_serial) {
  4323. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  4324. return true;
  4325. }
  4326. }
  4327. }
  4328. }
  4329. return false;
  4330. }
  4331. /**
  4332. * 初始化处方分页
  4333. * @param index 0 西药 1 中药 2 诊疗 3 入院
  4334. */
  4335. function initNavTabs(index) {
  4336. var tabId = null;
  4337. var tabContentId = null;
  4338. var paneId = null;
  4339. var cfdesc = '普药';
  4340. //西药
  4341. if (index == 0) {
  4342. tabId = "xyTab";
  4343. tabContentId = "xyTabContent";
  4344. paneId = "xycf_" + getUID();
  4345. } else if (index == 1) {
  4346. //中草药
  4347. tabId = "zyTab";
  4348. tabContentId = "zyTabContent";
  4349. paneId = "zycf_" + getUID();
  4350. cfdesc = '中草药';
  4351. } else if (index == 2) {
  4352. //医技
  4353. tabId = "zlTab";
  4354. tabContentId = "zlTabContent";
  4355. paneId = "zlcf_" + getUID();
  4356. cfdesc = '医技与诊疗';
  4357. } else if (index == 3) {
  4358. //医技
  4359. tabId = "zyReqTab";
  4360. tabContentId = "zyReqTabContent";
  4361. paneId = "zyReqcf_" + getUID();
  4362. cfdesc = '入院';
  4363. }
  4364. $("#" + tabId).html('<li class="active"><a href="#' + paneId + '" role="tab" data-toggle="tab">处方 <small class="cfdesc">(' + cfdesc + ')</small></a></li>');
  4365. var html = '<div class="tab-pane fade in active" id="' + paneId + '" style="height: 100%;min-height: 285px;position: relative;">';
  4366. html += '<img src="/thmz/images/prescription.png" style="margin-top: 5px;"/>';
  4367. html += '<input class="current_groupNo" type="hidden"/>';
  4368. html += ' <div class="cf_content rb_item" style="height: 230px;padding-top: 5px;overflow-y: auto;"></div>' +
  4369. ' <div style="height: 30px;border-top: 1px solid #ddd;width: 100%;position: absolute;bottom:0;padding-top: 10px;">';
  4370. html += '<div style="width: 460px;">'
  4371. if (index == 1) {
  4372. html += ' <div style="width: 130px;float: left;">' +
  4373. ' <label class="my_label_2">付数:</label>' +
  4374. ' <input type="text" class="form-control my_label_input_2 zyfs"' +
  4375. ' placeholder="请输入" style="padding-left: 10px;" onchange="calculateZyAmount()" value="1">' +
  4376. ' </div>';
  4377. html += '<div style="width: 130px;float: left;">' +
  4378. ' <label class="my_label_2">频次:</label>' +
  4379. ' <div style="width: 85px;float: right;">' +
  4380. ' <select class="form-control selectpicker show-tick zy_orderFrequency"' +
  4381. ' title="请选择" data-live-search="true" onchange="calculate()" id="zy_orderFrequency_1">' +
  4382. ' </select>' +
  4383. ' </div>' +
  4384. ' </div>';
  4385. html += '<div style="width: 180px;float: left;">' +
  4386. ' <label class="my_label_2">用法:</label>' +
  4387. ' <div style="width: 135px;float: left;">' +
  4388. ' <select class="form-control selectpicker show-tick useType"' +
  4389. ' title="请选择" id="useType_1">' +
  4390. ' </select>' +
  4391. ' </div>' +
  4392. ' </div>';
  4393. html += '</div><div style="width: 460px;">'
  4394. html += '<input id="singleAmount" type="hidden"/>';
  4395. }
  4396. html += '<div style="width: 130px;float: left;padding-left: 7px;padding-top: 8px;">金额:<span class="cf_amount">0.0</span><span>元</span></div>';
  4397. //html += '<div style="width: 130px;float: left;padding-left: 7px;padding-top: 8px;"></div>';
  4398. if (index == 1) {
  4399. html += '<div style="width: 130px;float: left;">' +
  4400. ' <label class="my_label_2">液型:</label>' +
  4401. ' <div style="width: 85px;float: right;">' +
  4402. ' <select class="form-control selectpicker show-tick water" id="cyJssm">' +
  4403. ' </select>' +
  4404. ' </div>' +
  4405. ' </div>';
  4406. html += ' <div style="width: 180px;float: left;">' +
  4407. ' <label class="my_label_2">煎法:</label>' +
  4408. ' <div style="width: 135px;float: left;">' +
  4409. ' <select class="form-control selectpicker show-tick zy_supplyType"' +
  4410. ' title="请选择" id="zy_supplyType_1" onchange="calculateTotalAmount()">' +
  4411. ' </select>' +
  4412. ' </div>' +
  4413. ' </div>';
  4414. }
  4415. if (index == 0) {
  4416. html += '<div style="width: 310px;float: left;color: red;padding-top: 8px;">说明:此费用包含药品给药方式所产生的费用!</div>';
  4417. }
  4418. // else if (index == 1) {
  4419. // html += '<div style="width: 310px;float: left;color: red;padding-top: 8px;">说明:此费用包含药品代煎所产生的费用!</div>';
  4420. // }
  4421. html += '</div></div></div>';
  4422. $("#" + tabContentId).html(html);
  4423. if (index == 1) {
  4424. var useType = '<option value="1">饭前温服</option><option value="2">饭后温服</option><option value="3">饭前凉服</option><option value="4">饭后凉服</option><option value="5">顿服</option><option value="6">冲服</option><option value="7">外用</option>';
  4425. $('.useType').html(useType);
  4426. $('.useType').selectpicker('refresh');
  4427. var water = '<option value="加凉水">加凉水</option><option value="加温水">加温水</option><option value="加开水">加开水</option><option value="加冰水">加冰水</option><option value="加糖水">加糖水</option>';
  4428. $('.water').html(water);
  4429. $('.water').selectpicker('refresh');
  4430. initOrderFrequencys("zy_orderFrequency_1", false);
  4431. initZySupplyTypes("zy_supplyType_1", false);
  4432. }
  4433. }
  4434. /**
  4435. * 清空处方分页
  4436. * @param index 0 西药 1 中药 2 诊疗 3 入院
  4437. */
  4438. function clearNavTabs(index) {
  4439. var tabId = null;
  4440. var tabContentId = null;
  4441. //西药
  4442. if (index == 0) {
  4443. tabId = "xyTab";
  4444. tabContentId = "xyTabContent";
  4445. } else if (index == 1) {
  4446. //中草药
  4447. tabId = "zyTab";
  4448. tabContentId = "zyTabContent";
  4449. } else if (index == 2) {
  4450. //医技
  4451. tabId = "zlTab";
  4452. tabContentId = "zlTabContent";
  4453. } else if (index == 3) {
  4454. //医技
  4455. tabId = "zyReqTab";
  4456. tabContentId = "zyReqTabContent";
  4457. }
  4458. $("#" + tabId).html(null);
  4459. $("#" + tabContentId).html(null);
  4460. }
  4461. /**
  4462. * 添加处方分页
  4463. * @param index 0 西药 1 中药 2 诊疗 3 入院
  4464. * @param groupNo 71 普通西药 91 医材 111 麻、精一 131 精二 151 诊疗
  4465. */
  4466. function refreshNavTabs(index, groupNo) {
  4467. var tabId = null;
  4468. var tabContentId = null;
  4469. var paneIdPrfix = null;
  4470. var cfdesc = '普药';
  4471. //西药
  4472. if (index == 0) {
  4473. tabId = "xyTab";
  4474. tabContentId = "xyTabContent";
  4475. paneIdPrfix = "xycf_";
  4476. if (groupNo == '91') {
  4477. cfdesc = '医材';
  4478. } else if (groupNo == '111') {
  4479. cfdesc = '麻、精一';
  4480. } else if (groupNo == '131') {
  4481. cfdesc = '精二';
  4482. }
  4483. // else if(groupNo=='151'){
  4484. // cfdesc='诊疗';
  4485. // }
  4486. } else if (index == 1) {
  4487. //中草药
  4488. tabId = "zyTab";
  4489. tabContentId = "zyTabContent";
  4490. paneIdPrfix = "zycf_";
  4491. cfdesc = '中草药';
  4492. } else if (index == 2) {
  4493. //医技
  4494. tabId = "zlTab";
  4495. tabContentId = "zlTabContent";
  4496. paneIdPrfix = "zlcf_";
  4497. cfdesc = '医技与诊疗';
  4498. } else if (index == 3) {
  4499. //入院
  4500. tabId = "zyReqTab";
  4501. tabContentId = "zyReqTabContent";
  4502. paneIdPrfix = "zyReqcf_";
  4503. cfdesc = '入院';
  4504. }
  4505. // var tableId = $("#"+tabId+" li.active").find("a").attr("href");
  4506. // var length = $(tableId).find("div:eq(0)").children().length;
  4507. // if(length==0){
  4508. // //当前处方是空白的,不需要新增处方
  4509. // return;
  4510. // }
  4511. var cfTitle = "处方" + " <small class=\"cfdesc\">(" + cfdesc + ")</small>";
  4512. var paneId = paneIdPrfix + getUID();
  4513. //清除选中的样式
  4514. $("#" + tabId).find("li.active").removeClass("active");
  4515. $("#" + tabId).append('<li><a href="#' + paneId + '" role="tab" data-toggle="tab">' + cfTitle + '</a></li>');
  4516. var html = '<div class="tab-pane fade in active" id="' + paneId + '" style="height: 100%;min-height: 285px;position: relative;">' +
  4517. '<img src="/thmz/images/prescription.png" style="margin-top: 5px;"/>' +
  4518. '<input class="current_groupNo" type="hidden"/>' +
  4519. ' <div class="cf_content rb_item" style="height: 230px;padding-top: 5px;overflow-y: auto;"></div>' +
  4520. ' <div style="height: 30px;border-top: 1px solid #ddd;width: 100%;position: absolute;bottom:0;">' +
  4521. '<div style="width: 460px;">' +
  4522. '<div style="width: 130px;float: left;padding-left: 7px;padding-top: 8px;">金额:<span class="cf_amount">0.0</span><span>元</span></div>';
  4523. if (index == 0) {
  4524. html += '<div style="width: 310px;float: left;color: red;padding-top: 8px;">说明:此费用包含药品给药方式所产生的费用!</div>';
  4525. }
  4526. html += '</div></div>';
  4527. $("#" + tabContentId).append(html);
  4528. //切换处方
  4529. $("#" + tabId).find("a[href='#" + paneId + "']").off("click").tab('show');
  4530. }
  4531. /**
  4532. * 填充西药选中的内容
  4533. * @param res
  4534. * @param groupNo
  4535. */
  4536. function fitWesternMedicine(res, groupNo) {
  4537. $("#western_medicine_name").val(res.data.name);
  4538. $("#western_medicine_name").blur();
  4539. var drugWinHtml = '';
  4540. var index = null;
  4541. if (res.data.weight != null) {
  4542. $("#drugWin").val(res.data.weight);
  4543. $("#drugWinDb").val(res.data.weight);
  4544. drugWinHtml = '<option value="' + res.data.weighUnit + '" desc="' + res.data.weight + '">' + res.data.weighUnitDesc + '</option>';
  4545. index = res.data.weighUnit;
  4546. }
  4547. if (res.data.volum != null) {
  4548. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  4549. $("#drugWin").val(res.data.volum);
  4550. $("#drugWinDb").val(res.data.volum);
  4551. }
  4552. drugWinHtml += '<option value="' + res.data.volUnit + '" desc="' + res.data.volum + '">' + res.data.volUnitDesc + '</option>';
  4553. if (index == null) {
  4554. index = res.data.volUnit;
  4555. }
  4556. }
  4557. if (res.data.miniUnit != null && res.data.miniUnit != "") {
  4558. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  4559. $("#drugWin").val(1);
  4560. $("#drugWinDb").val(1);
  4561. }
  4562. drugWinHtml += '<option value="' + res.data.miniUnit + '" desc="1">' + res.data.miniUnitDesc + '</option>';
  4563. if (index == null) {
  4564. index = res.data.miniUnit;
  4565. }
  4566. }
  4567. $('#drugWinUnit').html(drugWinHtml);
  4568. $('#drugWinUnit').selectpicker('refresh');
  4569. $("#drugWinUnit").selectpicker('val', index);
  4570. $('#drugWinUnit').selectpicker('refresh');
  4571. if (res.data.packUnitDesc != null && res.data.packUnitDesc != "") {
  4572. var html = '<option value="' + res.data.packUnitDesc + '" >' + res.data.packUnitDesc + '</option>';
  4573. $('#packUnit').html(html);
  4574. $('#packUnit').selectpicker('refresh');
  4575. $("#packUnit").selectpicker('val', res.data.packUnitDesc);
  4576. $('#packUnit').selectpicker('refresh');
  4577. }
  4578. $("#packRetprice").val(res.data.packRetprice);
  4579. $("#packSize").val(res.data.packSize);
  4580. $("#current_code").val(res.data.code);
  4581. $("#current_serial").val(res.data.serial);
  4582. if ($("#dayNum").val() == null) {
  4583. //天数 同组药品天数相同
  4584. $("#dayNum").selectpicker('val', 1);
  4585. $('#dayNum').selectpicker('refresh');
  4586. }
  4587. if ($("#supplyType").val() == null && res.data.supplyType != null) {
  4588. // 给药方式 同组药品给药方式相同
  4589. $("#supplyType").selectpicker('val', res.data.supplyType);
  4590. $('#supplyType').selectpicker('refresh');
  4591. }
  4592. if ($("#orderFrequency").val() == null && res.data.frequency != null) {
  4593. //频次编码 同组药品频次编码相同
  4594. $("#orderFrequency").selectpicker('val', res.data.frequency);
  4595. $('#orderFrequency').selectpicker('refresh');
  4596. }
  4597. if ($("#orderFrequency").val() == null) {
  4598. //频次编码 防止频次为空
  4599. $("#orderFrequency").selectpicker('val', "ONCE");
  4600. $('#orderFrequency').selectpicker('refresh');
  4601. }
  4602. if (res.data.psFlag != null && (res.data.psFlag == 1 || res.data.psFlag == "1")) {
  4603. $("#tryFlag").parent().addClass("checked");
  4604. $("#tryFlag").parent().parent().parent().removeClass("hide").addClass("in");
  4605. } else {
  4606. $("#tryFlag").parent().removeClass("checked");
  4607. $("#tryFlag").parent().parent().parent().removeClass("in").addClass("hide");
  4608. }
  4609. if (groupNo == "91") {
  4610. //医材
  4611. $("#gross").removeAttr("readonly")
  4612. } else {
  4613. $("#gross").attr("readonly", "readonly");
  4614. }
  4615. calculate();
  4616. }
  4617. /**
  4618. * 剂量单位改变事件
  4619. */
  4620. function drugWinUnitChange() {
  4621. var desc = $('#drugWinUnit').find("option:selected").attr('desc');
  4622. $("#drugWin").val(desc);
  4623. $("#drugWinDb").val(desc);
  4624. calculate();
  4625. }
  4626. /**
  4627. * 根据选择的内容计算总的用药量
  4628. */
  4629. function calculate() {
  4630. //最小规格剂量
  4631. var drugWinDb = $("#drugWinDb").val();
  4632. //天数
  4633. var dayNum = $("#dayNum").val();
  4634. //当前使用的最小剂量
  4635. var drugWin = $("#drugWin").val();
  4636. //频率
  4637. var times = $('#orderFrequency').find("option:selected").attr('desc');
  4638. //包装规格数量
  4639. var packSize = $("#packSize").val();
  4640. //单价
  4641. var packRetprice = $("#packRetprice").val();
  4642. //当前药房编码
  4643. var currentGroupNo = $("#current_groupNo").val();
  4644. if (drugWinDb == null || drugWinDb === "") {
  4645. if (currentGroupNo == '71') {
  4646. return;
  4647. }
  4648. drugWinDb = 1;
  4649. }
  4650. if (dayNum == null || dayNum === "") {
  4651. if (currentGroupNo == '71') {
  4652. return;
  4653. }
  4654. dayNum = 1;
  4655. }
  4656. if (drugWin == null || drugWin === "") {
  4657. if (currentGroupNo == '71') {
  4658. return;
  4659. }
  4660. drugWin = 1;
  4661. }
  4662. if (times == null || times === "") {
  4663. if (currentGroupNo == '71') {
  4664. return;
  4665. }
  4666. times = 1;
  4667. }
  4668. if (packSize == null || packSize === "") {
  4669. return;
  4670. }
  4671. //拆零总量
  4672. var scatteredTotalNum = Multiply(Multiply(dayNum, drugWin), times);
  4673. //整包装的数量
  4674. var totalNum = Math.ceil(Division(scatteredTotalNum, Multiply(packSize, drugWinDb)));
  4675. $("#gross").val(totalNum);
  4676. $("#totalRetprice").val(Multiply(totalNum, packRetprice).toFixed(2));
  4677. }
  4678. /**
  4679. * 根据选择的总量计算金额 只有医材的时候需要计算
  4680. */
  4681. function calculateSimple() {
  4682. //总量
  4683. var gross = $("#gross").val();
  4684. //单价
  4685. var packRetprice = $("#packRetprice").val();
  4686. //当前药房编码
  4687. var currentGroupNo = $("#current_groupNo").val();
  4688. if (currentGroupNo != '91') {
  4689. return;
  4690. }
  4691. $("#totalRetprice").val(Multiply(gross, packRetprice).toFixed(2));
  4692. //医材默认天数为1
  4693. $("#dayNum").selectpicker('val', 1);
  4694. $('#dayNum').selectpicker('refresh');
  4695. $("#orderFrequency").selectpicker('val', "ONCE");
  4696. $('#orderFrequency').selectpicker('refresh');
  4697. }
  4698. /**
  4699. * 根据中药付数计算金额
  4700. */
  4701. function calculateZyAmount() {
  4702. var singleAmount = $("#singleAmount").val();
  4703. var tableId = $("#zyTab li.active").find("a").attr("href");
  4704. //获取中药付数
  4705. var zyfs = $(tableId).find("input.zyfs").val();
  4706. var cfAmount = Multiply(zyfs, singleAmount);
  4707. $(tableId).find("span.cf_amount").html(cfAmount);
  4708. calculateTotalAmount();
  4709. }
  4710. /**
  4711. * 将病人信息填入患者信息修改form
  4712. * @param patinet
  4713. */
  4714. function fillPlusPatinet(patinet) {
  4715. if (patinet != null) {
  4716. $("#editUserCode").val(patinet.patientId);
  4717. $("#editUserName").val(patinet.name);
  4718. $("#editUserName").blur();
  4719. $("#editUserAge").val(patinet.age);
  4720. $("#editUserAge").blur();
  4721. $("#editUserGender").selectpicker('val', patinet.sex);
  4722. $("#editUserGender").selectpicker('refresh');
  4723. $("#editUserGender").blur();
  4724. $("#editUserBirthDay").val(patinet.birthDayStr);
  4725. $("#editUserBirthDay").blur();
  4726. $("#editUserCardNo").val(patinet.icCardNo);
  4727. $("#editUserCardNo").attr("title", patinet.icCardNo);
  4728. $("#editUserCardNo").blur();
  4729. $("#editUserPhoneNum").val(patinet.phoneNo);
  4730. $("#editUserPhoneNum").attr("title", patinet.phoneNo);
  4731. $("#editUserPhoneNum").blur();
  4732. $("#editUserPatientsNature").selectpicker('val', patinet.responseType);//默认选中
  4733. $('#editUserPatientsNature').selectpicker('refresh');
  4734. $("#editUserPatientsNature").blur();
  4735. $("#editUserIdCard").val(patinet.socialNo);
  4736. $("#editUserIdCard").attr("title", patinet.socialNo);
  4737. $("#editUserIdCard").blur();
  4738. $("#editUserAddress").val(patinet.address);
  4739. $("#editUserAddress").blur();
  4740. $("#editUserContact").val(patinet.relName);
  4741. $("#editUserContactPhone").val(patinet.contractName);
  4742. }
  4743. }
  4744. /**
  4745. * 修改病人信息
  4746. */
  4747. function modifyPatient() {
  4748. $.ajax({
  4749. type: "POST",
  4750. url: '/thmz/modifyPatient',
  4751. contentType: "application/json;charset=UTF-8",
  4752. dataType: "json",
  4753. data: JSON.stringify({
  4754. "name": $("#editUserName").val(),
  4755. "age": $("#editUserAge").val(),
  4756. "sex": $("#editUserGender").val(),
  4757. "birthDay": $("#editUserBirthDay").val(),
  4758. "icCardNo": $("#editUserCardNo").val(),
  4759. "phoneNo": $("#editUserPhoneNum").val(),
  4760. "responseType": $("#editUserPatientsNature").val(),
  4761. "socialNo": $("#editUserIdCard").val(),
  4762. "address": $("#editUserAddress").val(),
  4763. "patientId": $("#editUserCode").val(),
  4764. "relName": $("#editUserContact").val(),
  4765. "contractName": $("#editUserContactPhone").val()
  4766. }),
  4767. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4768. success: function (res) {
  4769. if (res == '401' || res == 401) {
  4770. window.location.href = '/thmz/login/view'
  4771. return;
  4772. }
  4773. if (res.code == 0) {
  4774. $('#editUserModal').modal('hide');
  4775. realClinicalReception($("#patientId").val(), $("#mzfzSerialNoInClick").val());
  4776. } else {
  4777. errorMesage(res);
  4778. }
  4779. }
  4780. });
  4781. }
  4782. // /**
  4783. // * 保存入院证
  4784. // */
  4785. // function saveBeHospitalized() {
  4786. // $.ajax({
  4787. // type: "POST",
  4788. // url: '/thmz/saveMzZyReq',
  4789. // contentType: "application/json;charset=UTF-8",
  4790. // dataType: "json",
  4791. // data: JSON.stringify({
  4792. // "patientId": $("#patientId").val(),
  4793. // "icdCode": $("#icdCodeBeHospitalized").val(),
  4794. // "icdText": $("#icdTextBeHospitalized").val(),
  4795. // "reqDept": $("#inpatientWardBeHospitalized").val(),
  4796. // "smallDept": $("#smallWardBeHospitalized").val(),
  4797. // "admissStatus": $("#admissStatus").val()
  4798. // }),
  4799. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4800. // success: function (res) {
  4801. // if (res == '401' || res == 401) {
  4802. // window.location.href = '/thmz/login/view'
  4803. // return;
  4804. // }
  4805. // if (res.code == 0) {
  4806. // successMesage(res);
  4807. // $('#beHospitalizedModal').modal('hide');
  4808. // loadInClinicTableList();
  4809. // loadClinicTableList();
  4810. // clearWorkSpace();
  4811. // } else {
  4812. // errorMesage(res);
  4813. // }
  4814. // }
  4815. // });
  4816. // }
  4817. /**
  4818. * 获取按钮组选择的下标
  4819. * @param id
  4820. * @returns {number}
  4821. */
  4822. function getIndex(id) {
  4823. var index = 0;
  4824. var item = $("#" + id).find("button");
  4825. for (var i = 0; i <= item.length; i++) {
  4826. if ($(item[i]).hasClass("btn-primary")) {
  4827. index = i;
  4828. break;
  4829. }
  4830. }
  4831. return index;
  4832. }
  4833. /**
  4834. * 获取时间选择器的时间数组
  4835. * @returns {string[]}
  4836. */
  4837. function getRePortRangeArr() {
  4838. var rePortRange = $('#reportrange span').html();
  4839. var rePortRangeArr = rePortRange.split(" - ");
  4840. rePortRangeArr[0] = rePortRangeArr[0] + " 00:00:00"
  4841. rePortRangeArr[1] = rePortRangeArr[1] + " 23:59:59"
  4842. return rePortRangeArr;
  4843. }
  4844. /**
  4845. * 初始医生工作太配置
  4846. */
  4847. function initWorkspaceConfigForCurrent() {
  4848. $.ajax({
  4849. type: "GET",
  4850. url: '/thmz/getWorkspaceConfigForCurrent',
  4851. dataType: "json",
  4852. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4853. success: function (res) {
  4854. if (res == '401' || res == 401) {
  4855. window.location.href = '/thmz/login/view'
  4856. return;
  4857. }
  4858. if (res.code == 0) {
  4859. if (res.data.symptomFlag == 1) {
  4860. $("#symptomFlag").removeClass("in").addClass("hide");
  4861. if ($("#symptomFlagCheck").parent().hasClass("checked")) {
  4862. $("#symptomFlagCheck").parent().parent().click();//当前选中改为不选中
  4863. }
  4864. } else if (res.data.symptomFlag == 0) {
  4865. $("#symptomFlag").removeClass("hide").addClass("in");
  4866. if (!$("#symptomFlagCheck").parent().hasClass("checked")) {
  4867. $("#symptomFlagCheck").parent().parent().click();//当前不选中改为选中
  4868. }
  4869. }
  4870. if (res.data.emrHpiFlag == 1) {
  4871. $("#emrHpiFlag").removeClass("in").addClass("hide");
  4872. if ($("#emrHpiFlagCheck").parent().hasClass("checked")) {
  4873. $("#emrHpiFlagCheck").parent().parent().click();//当前选中改为不选中
  4874. }
  4875. } else if (res.data.emrHpiFlag == 0) {
  4876. $("#emrHpiFlag").removeClass("hide").addClass("in");
  4877. if (!$("#emrHpiFlagCheck").parent().hasClass("checked")) {
  4878. $("#emrHpiFlagCheck").parent().parent().click();//当前不选中改为选中
  4879. }
  4880. }
  4881. if (res.data.emrPsFlag == 1) {
  4882. $("#emrPsFlag").removeClass("in").addClass("hide");
  4883. if ($("#emrPsFlagCheck").parent().hasClass("checked")) {
  4884. $("#emrPsFlagCheck").parent().parent().click();//当前选中改为不选中
  4885. }
  4886. } else if (res.data.emrPsFlag == 0) {
  4887. $("#emrPsFlag").removeClass("hide").addClass("in");
  4888. if (!$("#emrPsFlagCheck").parent().hasClass("checked")) {
  4889. $("#emrPsFlagCheck").parent().parent().click();//当前不选中改为选中
  4890. }
  4891. }
  4892. if (res.data.personalHistoryFlag == 1) {
  4893. $("#personalHistoryFlag").removeClass("in").addClass("hide");
  4894. if ($("#personalHistoryFlagCheck").parent().hasClass("checked")) {
  4895. $("#personalHistoryFlagCheck").parent().parent().click();//当前选中改为不选中
  4896. }
  4897. } else if (res.data.personalHistoryFlag == 0) {
  4898. $("#personalHistoryFlag").removeClass("hide").addClass("in");
  4899. if (!$("#personalHistoryFlagCheck").parent().hasClass("checked")) {
  4900. $("#personalHistoryFlagCheck").parent().parent().click();//当前不选中改为选中
  4901. }
  4902. }
  4903. if (res.data.familyHistoryFlag == 1) {
  4904. $("#familyHistoryFlag").removeClass("in").addClass("hide");
  4905. if ($("#familyHistoryFlagCheck").parent().hasClass("checked")) {
  4906. $("#familyHistoryFlagCheck").parent().parent().click();//当前选中改为不选中
  4907. }
  4908. } else if (res.data.familyHistoryFlag == 0) {
  4909. $("#familyHistoryFlag").removeClass("hide").addClass("in");
  4910. if (!$("#familyHistoryFlagCheck").parent().hasClass("checked")) {
  4911. $("#familyHistoryFlagCheck").parent().parent().click();//当前不选中改为选中
  4912. }
  4913. }
  4914. if (res.data.obstericalHistoryFlag == 1) {
  4915. $("#obstericalHistoryFlag").removeClass("in").addClass("hide");
  4916. if ($("#obstericalHistoryFlagCheck").parent().hasClass("checked")) {
  4917. $("#obstericalHistoryFlagCheck").parent().parent().click();//当前选中改为不选中
  4918. }
  4919. } else if (res.data.obstericalHistoryFlag == 0) {
  4920. $("#obstericalHistoryFlag").removeClass("hide").addClass("in");
  4921. if (!$("#obstericalHistoryFlagCheck").parent().hasClass("checked")) {
  4922. $("#obstericalHistoryFlagCheck").parent().parent().click();//当前不选中改为选中
  4923. }
  4924. }
  4925. if (res.data.pressureLeftFlag == 1) {
  4926. $("#pressureLeftFlag").removeClass("in").addClass("hide");
  4927. if ($("#pressureLeftFlagCheck").parent().hasClass("checked")) {
  4928. $("#pressureLeftFlagCheck").parent().parent().click();//当前选中改为不选中
  4929. }
  4930. } else if (res.data.pressureLeftFlag == 0) {
  4931. $("#pressureLeftFlag").removeClass("hide").addClass("in");
  4932. if (!$("#pressureLeftFlagCheck").parent().hasClass("checked")) {
  4933. $("#pressureLeftFlagCheck").parent().parent().click();//当前不选中改为选中
  4934. }
  4935. }
  4936. if (res.data.tentativeDiagnosisFlag == 1) {
  4937. $("#tentativeDiagnosisFlag").removeClass("in").addClass("hide");
  4938. if ($("#tentativeDiagnosisFlagCheck").parent().hasClass("checked")) {
  4939. $("#tentativeDiagnosisFlagCheck").parent().parent().click();//当前选中改为不选中
  4940. }
  4941. } else if (res.data.tentativeDiagnosisFlag == 0) {
  4942. $("#tentativeDiagnosisFlag").removeClass("hide").addClass("in");
  4943. if (!$("#tentativeDiagnosisFlagCheck").parent().hasClass("checked")) {
  4944. $("#tentativeDiagnosisFlagCheck").parent().parent().click();//当前不选中改为选中
  4945. }
  4946. }
  4947. } else {
  4948. errorMesage(res);
  4949. }
  4950. }
  4951. });
  4952. }
  4953. /**
  4954. * 保存医生工作台配置
  4955. */
  4956. function saveWorkspaceConfig() {
  4957. var symptomFlag = $("#symptomFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  4958. var emrHpiFlag = $("#emrHpiFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  4959. var emrPsFlag = $("#emrPsFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  4960. var personalHistoryFlag = $("#personalHistoryFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  4961. var familyHistoryFlag = $("#familyHistoryFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  4962. var obstericalHistoryFlag = $("#obstericalHistoryFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  4963. var pressureLeftFlag = $("#pressureLeftFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  4964. var tentativeDiagnosisFlag = $("#tentativeDiagnosisFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  4965. $.ajax({
  4966. type: "POST",
  4967. url: '/thmz/saveWorkspaceConfig',
  4968. contentType: "application/json;charset=UTF-8",
  4969. dataType: "json",
  4970. data: JSON.stringify({
  4971. "symptomFlag": symptomFlag,
  4972. "emrHpiFlag": emrHpiFlag,
  4973. "emrPsFlag": emrPsFlag,
  4974. "personalHistoryFlag": personalHistoryFlag,
  4975. "familyHistoryFlag": familyHistoryFlag,
  4976. "obstericalHistoryFlag": obstericalHistoryFlag,
  4977. "pressureLeftFlag": pressureLeftFlag,
  4978. "tentativeDiagnosisFlag": tentativeDiagnosisFlag
  4979. }),
  4980. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4981. success: function (res) {
  4982. if (res == '401' || res == 401) {
  4983. window.location.href = '/thmz/login/view'
  4984. return;
  4985. }
  4986. if (res.code == 0) {
  4987. //successMesage(res);
  4988. initWorkspaceConfigForCurrent();
  4989. $("#configWorkspaceModal").modal("hide");
  4990. } else {
  4991. errorMesage(res);
  4992. }
  4993. }
  4994. });
  4995. }
  4996. /**
  4997. * 初始化药品,检查检验菜单树
  4998. */
  4999. function initzTree() {
  5000. var index = getIndex("bill_item_group");
  5001. if (index == 0) {
  5002. $("#western_medicine_name").webuiPopover('hide');
  5003. $.ajax({
  5004. type: "GET",
  5005. url: '/thmz/getYpZdClasses',
  5006. contentType: "application/json;charset=UTF-8",
  5007. dataType: "json",
  5008. async: false,
  5009. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5010. success: function (res) {
  5011. if (res == '401' || res == 401) {
  5012. window.location.href = '/thmz/login/view'
  5013. return;
  5014. }
  5015. if (res.code == 0) {
  5016. // zTree 的参数配置,深入使用请参考 API 文档(setting 配置详解)
  5017. var setting = {
  5018. callback: {
  5019. onClick: zTreeOnClick
  5020. }
  5021. };
  5022. $.fn.zTree.init($("#treeDemo"), setting, res.data);
  5023. } else {
  5024. errorMesage(res);
  5025. }
  5026. }
  5027. });
  5028. } else if (index == 2) {
  5029. $("#jcJyItem").webuiPopover('hide');
  5030. $.ajax({
  5031. type: "GET",
  5032. url: '/thmz/getJyJcZdClasses',
  5033. contentType: "application/json;charset=UTF-8",
  5034. dataType: "json",
  5035. async: false,
  5036. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5037. success: function (res) {
  5038. if (res == '401' || res == 401) {
  5039. window.location.href = '/thmz/login/view'
  5040. return;
  5041. }
  5042. if (res.code == 0) {
  5043. // zTree 的参数配置,深入使用请参考 API 文档(setting 配置详解)
  5044. var setting = {
  5045. callback: {
  5046. onClick: zTreeOnClick
  5047. }
  5048. };
  5049. $.fn.zTree.init($("#treeDemo"), setting, res.data);
  5050. } else {
  5051. errorMesage(res);
  5052. }
  5053. }
  5054. });
  5055. } else if (index == 1) {
  5056. $("#treeButton").webuiPopover('hide');
  5057. warningMesageSimaple("中药暂无帮助字典");
  5058. } else {
  5059. $("#treeButton").webuiPopover('hide');
  5060. warningMesageSimaple("入院暂无帮助字典");
  5061. }
  5062. }
  5063. /**
  5064. * 节点点击事件
  5065. * @param event
  5066. * @param treeId
  5067. * @param treeNode
  5068. */
  5069. function zTreeOnClick(event, treeId, treeNode) {
  5070. var index = getIndex("bill_item_group");
  5071. if (index == 0) {
  5072. $("#western_medicine_name").val(treeNode.id);
  5073. $('#western_medicine_name').webuiPopover('show');
  5074. loadYpList(0);
  5075. } else if (index == 2) {
  5076. $("#jcJyItem").val(treeNode.id);
  5077. $('#jcJyItem').webuiPopover('show');
  5078. loadjcJyItemList();
  5079. }
  5080. }
  5081. /**
  5082. * 构建处方参数
  5083. * @returns {any}
  5084. */
  5085. function getParamsForpPrescription() {
  5086. var codes = $("#diagnoseValue").val();
  5087. var icdCode = null;
  5088. if (codes != null && codes.length > 0) {
  5089. var arr = codes.split(",");
  5090. if (arr != null) {
  5091. for (i = 0; i < arr.length; i++) {
  5092. if (arr[i] != "") {
  5093. if (icdCode == null) {
  5094. icdCode = arr[i];
  5095. } else {
  5096. icdCode += "," + arr[i];
  5097. }
  5098. }
  5099. }
  5100. }
  5101. }
  5102. var jsonData = JSON.parse('{"patientId": "","firstOrNot":"","icdCode": "","icdText": null,"jzFlag": "0","serialNo":"","mzBlRecord": {"firstOrNot": "","emrChiefComplaint": "","emrHpi": "","emrPs": "","emrPe": "","emrFzjc": null,"emrProcess": null,"emrXyy": "无","emrYypg": "无","emrGnpg": "无","emrJkjy": "","personalHistory": "","familyHistory": "","obstericalHistory": "","weight": "","temperature": "","sphygmus": "","breathe": "","pressureHigh": "","pressureFloor": "","pressureHighLeft": "","pressureFloorLeft": "","tentativeDiagnosis":"","prescriptionDetail":""},"mzChargeDetailList": [],"mzYjReqList": [],"mzZyReq": {"reqDept": "","smallDept": "","admissStatus": ""}}');
  5103. jsonData.patientId = $("#patientId").val();
  5104. jsonData.firstOrNot = $("input[name='firstOrNot']:checked").val();
  5105. jsonData.icdCode = icdCode;
  5106. jsonData.serialNo = $("#mzfzSerialNoInClick").val();
  5107. jsonData.mzBlRecord.firstOrNot = jsonData.firstOrNot;
  5108. jsonData.mzBlRecord.emrChiefComplaint = $("#symptom").val();
  5109. jsonData.mzBlRecord.emrHpi = $("#emrHpi").val();
  5110. jsonData.mzBlRecord.emrPs = $("#emrPs").val();
  5111. jsonData.mzBlRecord.emrPe = $("#otherCheck").val();
  5112. jsonData.mzBlRecord.emrJkjy = $("#healthEducation").val();
  5113. jsonData.mzBlRecord.personalHistory = $("#personalHistory").val();
  5114. jsonData.mzBlRecord.familyHistory = $("#familyHistory").val();
  5115. jsonData.mzBlRecord.obstericalHistory = $("#obstericalHistory").val();
  5116. jsonData.mzBlRecord.weight = $("#weight").val();
  5117. jsonData.mzBlRecord.temperature = $("#temperature").val();
  5118. jsonData.mzBlRecord.sphygmus = $("#sphygmus").val();
  5119. jsonData.mzBlRecord.breathe = $("#breathe").val();
  5120. jsonData.mzBlRecord.pressureHigh = $("#pressure_high").val();
  5121. jsonData.mzBlRecord.pressureFloor = $("#pressure_floor").val();
  5122. jsonData.mzBlRecord.pressureHighLeft = $("#pressure_high_left").val();
  5123. jsonData.mzBlRecord.pressureFloorLeft = $("#pressure_floor_left").val();
  5124. jsonData.mzBlRecord.tentativeDiagnosis = $("#tentativeDiagnosis").val();
  5125. //设置处方详情
  5126. var emrFzjc = null;
  5127. var xyTabContents = $("#xyTabContent").find("div.tab-pane");
  5128. //处方号
  5129. var orderNo = 0;
  5130. var arrs = $("span.cf_amount");
  5131. //西药设置
  5132. if (xyTabContents != null && xyTabContents.length > 0) {
  5133. for (var i = 0; i < xyTabContents.length; i++) {
  5134. //当前药品类型
  5135. var currentGroupNo = $(xyTabContents[i]).find("input.current_groupNo").val();
  5136. var formGroups = $(xyTabContents[i]).find("div.form-group");
  5137. if (formGroups != null && formGroups.length > 0) {
  5138. for (var j = 0; j < formGroups.length; j++) {
  5139. var tempJson = JSON.parse('{"chargeItemCode": "","serial": "","quantity": "","drugQuan": "","drugUnit": "","frequency": "","orderDays": "","paySelf": "0","drugWin": "1","instructionCode":"","instructionText":"","orderNo":"","groupOrder":"","supplyCode":"","cyJssm":"","cyDj":"","cyFysm":"","tryFlag":"0","groupNo":""}');
  5140. tempJson.chargeItemCode = $(formGroups[j]).find("input.temporary_items_code").val();
  5141. tempJson.serial = $(formGroups[j]).find("input.temporary_items_serial").val();
  5142. tempJson.quantity = $(formGroups[j]).find("input.temporary_items_gross").val();
  5143. tempJson.drugQuan = $(formGroups[j]).find("input.temporary_items_drugWin").val();
  5144. tempJson.drugUnit = $(formGroups[j]).find("input.temporary_items_drugWinUnit").val();
  5145. tempJson.frequency = $(formGroups[j]).find("input.temporary_items_orderFrequency").val();
  5146. tempJson.orderDays = $(formGroups[j]).find("input.temporary_items_dayNum").val();
  5147. tempJson.instructionCode = $(formGroups[j]).find("input.temporary_items_medicalAdvice").val();
  5148. tempJson.instructionText = $(formGroups[j]).find("input.temporary_items_medicalAdviceText").val();
  5149. tempJson.supplyCode = $(formGroups[j]).find("input.temporary_items_supplyType").val();
  5150. orderNo = i + 1;
  5151. tempJson.orderNo = orderNo;
  5152. tempJson.groupOrder = $(formGroups[j]).find("input.temporary_items_groupId").val();
  5153. tempJson.groupNo = currentGroupNo;
  5154. var tryFlag = $(formGroups[j]).find("input.temporary_items_tryFlag").val();
  5155. if (tryFlag == true || tryFlag == "true") {
  5156. tempJson.tryFlag = 1;
  5157. }
  5158. jsonData.mzChargeDetailList[jsonData.mzChargeDetailList.length] = tempJson;
  5159. }
  5160. }
  5161. }
  5162. }
  5163. //中草药
  5164. var zyTabContents = $("#zyTabContent").find("div.form-group");
  5165. if (zyTabContents != null && zyTabContents.length > 0) {
  5166. orderNo++;
  5167. var zyfs = $("input.zyfs").val();
  5168. //中药的类型
  5169. var currentZyClassType = $("#current_zyClassType").val();
  5170. for (var i = 0; i < zyTabContents.length; i++) {
  5171. var tempJson = JSON.parse('{"chargeItemCode": "","serial": "","quantity": "","drugQuan": "","drugUnit": "g","frequency": "","orderDays": "1","paySelf": "0","drugWin": "","instructionCode":"","instructionText":"","orderNo":"1","groupOrder":"1","supplyCode":"","cyJssm":"","cyDj":"","cyFysm":"","tryFlag":"0","groupNo":""}');
  5172. tempJson.chargeItemCode = $(zyTabContents[i]).find("input.temporary_items_code").val();
  5173. tempJson.serial = $(zyTabContents[i]).find("input.temporary_items_serial").val();
  5174. tempJson.quantity = $(zyTabContents[i]).find("input.temporary_items_drugWin").val();
  5175. tempJson.drugQuan = $(zyTabContents[i]).find("input.temporary_items_drugWin").val();
  5176. tempJson.drugWin = zyfs;
  5177. tempJson.frequency = $("#zy_orderFrequency_1").val();
  5178. tempJson.instructionCode = $(zyTabContents[i]).find("input.temporary_items_zyInstruction").val();
  5179. tempJson.instructionText = $(zyTabContents[i]).find("input.temporary_items_zyInstructionText").val();
  5180. tempJson.cyFysm = $("#useType_1").val();
  5181. tempJson.cyJssm = $("#cyJssm").val();
  5182. tempJson.cyDj = $("#zy_supplyType_1").val();
  5183. tempJson.orderNo = orderNo;
  5184. tempJson.groupNo = currentZyClassType;
  5185. jsonData.mzChargeDetailList[jsonData.mzChargeDetailList.length] = tempJson;
  5186. }
  5187. }
  5188. //设置诊疗与医技
  5189. var zlTabContents = $("#zlTabContent").find("div.form-group");
  5190. if (zlTabContents != null && zlTabContents.length > 0) {
  5191. orderNo++;
  5192. for (var i = 0; i < zlTabContents.length; i++) {
  5193. if (emrFzjc == null) {
  5194. emrFzjc = $(zlTabContents[i]).text();
  5195. } else {
  5196. emrFzjc += "," + $(zlTabContents[i]).text();
  5197. }
  5198. var tempJson = null;
  5199. //项目类型
  5200. var itemsType = $(zlTabContents[i]).find("input.temporary_items_type").val();
  5201. if (itemsType == "3" || itemsType == 3) {
  5202. //诊疗,放入药品类型中入库,因为诊疗是与药品一样直接入明细库,但是是与医技在同一处方开立页面开立
  5203. tempJson = JSON.parse('{"chargeItemCode": "","serial": "","quantity": "1","drugQuan": "1","drugUnit": "","frequency": "","orderDays": "1","paySelf": "0","drugWin": "1","instructionCode":"","instructionText":"","orderNo":"","groupOrder":"","supplyCode":"","cyJssm":"","cyDj":"","cyFysm":"","tryFlag":"0","groupNo":"00"}');
  5204. tempJson.chargeItemCode = $(zlTabContents[i]).find("input.temporary_items_code").val();
  5205. tempJson.instructionText = $(zlTabContents[i]).find("input.temporary_items_remark").val();
  5206. tempJson.orderNo = orderNo;
  5207. jsonData.mzChargeDetailList[jsonData.mzChargeDetailList.length] = tempJson;
  5208. } else {
  5209. tempJson = JSON.parse('{"orderCode":"","inspectPart":"","inspectStuff":"","jyRemark":"","orderNo":"1"}');
  5210. tempJson.orderCode = $(zlTabContents[i]).find("input.temporary_items_code").val();
  5211. if (itemsType == "1" || itemsType == 1) {
  5212. //检验
  5213. tempJson.inspectStuff = $(zlTabContents[i]).find("input.temporary_items_desc_value").val();
  5214. } else if (itemsType == "2" || itemsType == 2) {
  5215. //检查
  5216. tempJson.inspectPart = $(zlTabContents[i]).find("input.temporary_items_desc_value").val();
  5217. }
  5218. tempJson.jyRemark = $(zlTabContents[i]).find("input.temporary_items_remark").val();
  5219. tempJson.orderNo = orderNo;
  5220. jsonData.mzYjReqList[jsonData.mzYjReqList.length] = tempJson;
  5221. }
  5222. }
  5223. }
  5224. //入院
  5225. var zyReqTabContents = $("#zyReqTabContent").find("div.form-group");
  5226. if (zyReqTabContents != null && zyReqTabContents.length > 0) {
  5227. jsonData.mzZyReq.reqDept = $(zyReqTabContents[0]).find("input.temporary_inpatient_ward").val();
  5228. jsonData.mzZyReq.smallDept = $(zyReqTabContents[0]).find("input.temporary_items_small_ward").val();
  5229. jsonData.mzZyReq.admissStatus = $(zyReqTabContents[0]).find("input.temporary_items_admiss_status").val();
  5230. }
  5231. //设置诊断名称
  5232. var icdText = null;
  5233. var tagsTexts = $("span.el-select__tags-text");
  5234. if (tagsTexts != null && tagsTexts.length > 0) {
  5235. for (var i = 0; i < tagsTexts.length; i++) {
  5236. if (icdText == null) {
  5237. icdText = $(tagsTexts[i]).text();
  5238. } else {
  5239. icdText += "," + $(tagsTexts[i]).text();
  5240. }
  5241. }
  5242. }
  5243. jsonData.icdText = icdText;
  5244. jsonData.mzBlRecord.emrFzjc = emrFzjc;
  5245. return jsonData;
  5246. }
  5247. /**
  5248. * 保存处方
  5249. */
  5250. function savePrescription() {
  5251. $("#messageModal").modal();
  5252. $("#messageContent").html("确认保存处方吗?");
  5253. $("#messageButton").off("click").on("click", function (t) {
  5254. //$("#messageModal").modal("hide");
  5255. var jsonData = getParamsForpPrescription();
  5256. $.ajax({
  5257. type: "POST",
  5258. url: '/thmz/savePrescription',
  5259. contentType: "application/json;charset=UTF-8",
  5260. dataType: "json",
  5261. data: JSON.stringify(jsonData),
  5262. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5263. success: function (res) {
  5264. if (res == '401' || res == 401) {
  5265. window.location.href = '/thmz/login/view'
  5266. return;
  5267. }
  5268. if (res.code == 0) {
  5269. successMesage(res);
  5270. clearWorkSpace();
  5271. loadInClinicTableList();
  5272. loadClinicTableList();
  5273. //$("#messageModal").modal();
  5274. $("#messageContent").html("门诊处方保存成功,是否打印处方和门诊指引单?");
  5275. $("#messageButton").off("click").on("click", function (t) {
  5276. $("#messageModal").modal("hide");
  5277. printPrescription(res.data.patientId, res.data.times, res.data.id, 5);
  5278. });
  5279. } else {
  5280. $("#messageModal").modal("hide");
  5281. errorMesage(res);
  5282. }
  5283. }
  5284. });
  5285. });
  5286. }
  5287. /**
  5288. * 保存医疗范文
  5289. */
  5290. function saveapidAccepts() {
  5291. var templateName = $("#templateName").val();
  5292. if (templateName == null || templateName == "") {
  5293. errorMesageSimaple("范文名称不能为空!");
  5294. return;
  5295. }
  5296. var templateType = $("#templateType").val();
  5297. if (templateType == null || templateType == "") {
  5298. errorMesageSimaple("范文类型不能为空!");
  5299. return;
  5300. }
  5301. var templateStatus = $("#templateStatus").val();
  5302. if (templateStatus == null || templateStatus == "") {
  5303. errorMesageSimaple("范文状态不能为空!");
  5304. return;
  5305. }
  5306. $("#saveapidAcceptsModal").modal("hide");
  5307. $("#messageModal").modal();
  5308. $("#messageContent").html("确认保存医疗范文吗?");
  5309. $("#messageButton").off("click").on("click", function (t) {
  5310. $("#messageModal").modal("hide");
  5311. var jsonData = getParamsForpPrescription();
  5312. $.ajax({
  5313. type: "POST",
  5314. url: '/thmz/saveTemplate',
  5315. contentType: "application/json;charset=UTF-8",
  5316. dataType: "json",
  5317. data: JSON.stringify({
  5318. "id": $("#templateId").val(),
  5319. "name": templateName,
  5320. "icdText": jsonData.icdText != null ? jsonData.icdText : jsonData.mzBlRecord.tentativeDiagnosis,
  5321. "templateType": templateType,
  5322. "templateStatus": templateStatus,
  5323. "templateData": JSON.stringify(jsonData),
  5324. "emrChiefComplaint": $("#symptom").val(),
  5325. "emrHpi": $("#emrHpi").val(),
  5326. "emrPs": $("#emrPs").val(),
  5327. "icdCode": $("#diagnoseValue").val()
  5328. }),
  5329. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5330. success: function (res) {
  5331. if (res == '401' || res == 401) {
  5332. window.location.href = '/thmz/login/view'
  5333. return;
  5334. }
  5335. if (res.code == 0) {
  5336. successMesage(res);
  5337. clearWorkSpace();
  5338. } else {
  5339. $("#saveapidAcceptsModal").modal();
  5340. errorMesage(res);
  5341. }
  5342. }
  5343. });
  5344. });
  5345. }
  5346. /**
  5347. * 停用医疗范文
  5348. */
  5349. function removeTemplate() {
  5350. $("#messageModal").modal();
  5351. $("#messageContent").html("确认停用医疗范文吗?");
  5352. $("#messageButton").off("click").on("click", function (t) {
  5353. $("#messageModal").modal("hide");
  5354. $.ajax({
  5355. type: "POST",
  5356. url: '/thmz/removeTemplate',
  5357. contentType: "application/json;charset=UTF-8",
  5358. dataType: "json",
  5359. data: JSON.stringify({
  5360. "id": $("#idTemplate").val()
  5361. }),
  5362. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5363. success: function (res) {
  5364. if (res == '401' || res == 401) {
  5365. window.location.href = '/thmz/login/view'
  5366. return;
  5367. }
  5368. if (res.code == 0) {
  5369. successMesage(res);
  5370. $("#medicalModelModal").modal("hide");
  5371. fitTemplateData();
  5372. } else {
  5373. errorMesage(res);
  5374. }
  5375. }
  5376. });
  5377. });
  5378. }
  5379. /**
  5380. * 清空医疗范文模块内容
  5381. */
  5382. function clearApidAcceptsModal() {
  5383. $("#templateId").val(null);
  5384. $("#templateName").val(null);
  5385. $("#templateType").selectpicker('val', 0);
  5386. $("#templateType").selectpicker('refresh');
  5387. $("#templateStatus").selectpicker('val', 0);
  5388. $("#templateStatus").selectpicker('refresh');
  5389. }
  5390. /**
  5391. * 查询病人未缴费处方信息 加载到处方修改
  5392. * @param patientId
  5393. * @param times
  5394. * @param clnicId 就诊记录id
  5395. */
  5396. function getMzPrescriptionVoUnPaid(patientId, times, clnicId) {
  5397. var currentPatientId = $("#patientId").val();
  5398. //当前接诊的用户和操作接诊的是同一个人,不做任何操作
  5399. if (currentPatientId == patientId) {
  5400. warningMesageSimaple("当前病人正在接诊中,请勿重复操作!");
  5401. return;
  5402. }
  5403. if (currentPatientId == null || currentPatientId == "") {
  5404. //当前没有人接诊,直接接诊
  5405. getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId);
  5406. } else {
  5407. //当前有人在接诊,提示是否需要切换和保存
  5408. $("#messagePrescriptionModal").modal();
  5409. $("#confirmPrescriptionButton").off("click").on("click", function (t) {
  5410. $("#messagePrescriptionModal").modal("hide");
  5411. //先保存目前接诊信息,再切换就诊人
  5412. var jsonData = getParamsForpPrescription();
  5413. $.ajax({
  5414. type: "POST",
  5415. url: '/thmz/savePrescription',
  5416. contentType: "application/json;charset=UTF-8",
  5417. dataType: "json",
  5418. data: JSON.stringify(jsonData),
  5419. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5420. success: function (res) {
  5421. if (res == '401' || res == 401) {
  5422. window.location.href = '/thmz/login/view'
  5423. return;
  5424. }
  5425. if (res.code == 0) {
  5426. loadInClinicTableList();
  5427. loadClinicTableList();
  5428. getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId);
  5429. } else {
  5430. errorMesage(res);
  5431. }
  5432. }
  5433. });
  5434. });
  5435. $("#cancelPrescriptionButton").off("click").on("click", function (t) {
  5436. $("#messagePrescriptionModal").modal("hide");
  5437. getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId);
  5438. });
  5439. }
  5440. }
  5441. /**
  5442. * 查询病人未缴费处方信息 加载到处方修改 通用方法
  5443. * @param patientId
  5444. * @param times
  5445. * @param clnicId 就诊记录id
  5446. */
  5447. function getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId) {
  5448. $.ajax({
  5449. type: "GET",
  5450. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + "&times=" + times + "&MzBlRecordFlag=false&payMark=5&clnicId=null",
  5451. contentType: "application/json;charset=UTF-8",
  5452. dataType: "json",
  5453. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5454. success: function (res) {
  5455. if (res == '401' || res == 401) {
  5456. window.location.href = '/thmz/login/view'
  5457. return;
  5458. }
  5459. if (res.code == 0) {
  5460. clearWorkSpace();
  5461. setMzPatientInfo(res.mzPatientMi);
  5462. editPrescription(res.data, 0)
  5463. //修改患者的时候,将原纪录的就诊记录id带上,并借用分诊流水号字段传参
  5464. $("#mzfzSerialNoInClick").val("clnicId_" + clnicId);
  5465. } else {
  5466. errorMesage(res);
  5467. }
  5468. }
  5469. });
  5470. }
  5471. /**
  5472. * 查询病人已缴费处方信息 调用处方
  5473. * @param patientId
  5474. * @param times
  5475. * @param clnicId 就诊记录id
  5476. */
  5477. function getMzPrescriptionVoPaid(patientId, times, clnicId) {
  5478. $("#visitingDetailModal").modal("hide");
  5479. $("#messageModal").modal();
  5480. $("#messageContent").html("确认调用选中处方吗?将会覆盖当前处方。");
  5481. $("#messageButton").off("click").on("click", function (t) {
  5482. $("#messageModal").modal("hide");
  5483. $.ajax({
  5484. type: "GET",
  5485. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + "&times=" + times + "&MzBlRecordFlag=false&payMark=0&clnicId=null",
  5486. contentType: "application/json;charset=UTF-8",
  5487. dataType: "json",
  5488. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5489. success: function (res) {
  5490. if (res == '401' || res == 401) {
  5491. window.location.href = '/thmz/login/view'
  5492. return;
  5493. }
  5494. if (res.code == 0) {
  5495. var mzfzSerialNoInClick = $("#mzfzSerialNoInClick").val();
  5496. clearUser(false);
  5497. clearWorkSpaceExcludeUser();
  5498. setMzPatientInfo(res.mzPatientMi);
  5499. editPrescription(res.data, 2)
  5500. $("#mzfzSerialNoInClick").val(mzfzSerialNoInClick);
  5501. } else {
  5502. errorMesage(res);
  5503. }
  5504. }
  5505. });
  5506. });
  5507. }
  5508. /**
  5509. * 重复接诊
  5510. * @param patientId
  5511. * @param times
  5512. * @param clnicId
  5513. * @param deptCode 就诊科室编码
  5514. */
  5515. function repeatAccepts(patientId, times, clnicId, deptCode) {
  5516. $.ajax({
  5517. type: "GET",
  5518. url: '/thmz/validMzyReqrec?patientId=' + patientId + "&deptCode=" + deptCode,
  5519. contentType: "application/json;charset=UTF-8",
  5520. dataType: "json",
  5521. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5522. success: function (res) {
  5523. if (res == '401' || res == 401) {
  5524. window.location.href = '/thmz/login/view'
  5525. return;
  5526. }
  5527. if (res.code == 0) {
  5528. if (res.data == 0) {
  5529. $("#messageModal").modal();
  5530. $("#messageContent").html("挂号失效,确定继续就诊?");
  5531. $("#messageButton").off("click").on("click", function (t) {
  5532. $("#messageModal").modal("hide");
  5533. repeatAcceptsConfirm(patientId, times, clnicId);
  5534. });
  5535. return;
  5536. }
  5537. repeatAcceptsConfirm(patientId, times, clnicId);
  5538. } else {
  5539. errorMesage(res);
  5540. }
  5541. }
  5542. });
  5543. }
  5544. /**
  5545. * 重复接诊提示方法
  5546. * @param patientId
  5547. * @param times
  5548. * @param clnicId
  5549. */
  5550. function repeatAcceptsConfirm(patientId, times, clnicId) {
  5551. var currentPatientId = $("#patientId").val();
  5552. //当前接诊的用户和操作接诊的是同一个人,不做任何操作
  5553. if (currentPatientId == patientId) {
  5554. return;
  5555. }
  5556. if (currentPatientId == null || currentPatientId == "") {
  5557. //当前没有人接诊,直接接诊
  5558. repeatAcceptsCommon(patientId, times, clnicId);
  5559. } else {
  5560. //当前有人在接诊,提示是否需要切换和保存
  5561. $("#messagePrescriptionModal").modal();
  5562. $("#confirmPrescriptionButton").off("click").on("click", function (t) {
  5563. $("#messagePrescriptionModal").modal("hide");
  5564. //先保存目前接诊信息,再切换就诊人
  5565. var jsonData = getParamsForpPrescription();
  5566. $.ajax({
  5567. type: "POST",
  5568. url: '/thmz/savePrescription',
  5569. contentType: "application/json;charset=UTF-8",
  5570. dataType: "json",
  5571. data: JSON.stringify(jsonData),
  5572. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5573. success: function (res) {
  5574. if (res == '401' || res == 401) {
  5575. window.location.href = '/thmz/login/view'
  5576. return;
  5577. }
  5578. if (res.code == 0) {
  5579. repeatAcceptsCommon(patientId, times, clnicId);
  5580. //加载已接诊患者列表
  5581. loadClinicTableList();
  5582. } else {
  5583. errorMesage(res);
  5584. }
  5585. }
  5586. });
  5587. });
  5588. $("#cancelPrescriptionButton").off("click").on("click", function (t) {
  5589. $("#messagePrescriptionModal").modal("hide");
  5590. repeatAcceptsCommon(patientId, times, clnicId);
  5591. });
  5592. }
  5593. }
  5594. /**
  5595. * 重复接诊通用方法
  5596. * @param patientId
  5597. * @param times
  5598. * @param clnicId
  5599. */
  5600. function repeatAcceptsCommon(patientId, times, clnicId) {
  5601. $.ajax({
  5602. type: "GET",
  5603. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + "&times=" + times + "&MzBlRecordFlag=true&payMark=null&clnicId=null",
  5604. contentType: "application/json;charset=UTF-8",
  5605. dataType: "json",
  5606. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5607. success: function (res) {
  5608. if (res == '401' || res == 401) {
  5609. window.location.href = '/thmz/login/view'
  5610. return;
  5611. }
  5612. if (res.code == 0) {
  5613. clearWorkSpace();
  5614. setMzPatientInfo(res.mzPatientMi);
  5615. editPrescription(res.data, 0)
  5616. //修改患者的时候,将原纪录的就诊记录id带上,并借用分诊流水号字段传参
  5617. $("#mzfzSerialNoInClick").val("clnicId_" + clnicId);
  5618. } else {
  5619. errorMesage(res);
  5620. }
  5621. }
  5622. });
  5623. }
  5624. /**
  5625. * 就诊详情 已诊患者列表发起
  5626. * @param patientId
  5627. * @param times
  5628. * @param clnicId
  5629. * @param payMark
  5630. */
  5631. function prescriptionDetail(patientId, times, clnicId, payMark) {
  5632. prescriptionDetailCommon(patientId, times, clnicId, payMark, 0);
  5633. }
  5634. /**
  5635. * 就诊详情 历史轨迹发起
  5636. * @param patientId
  5637. * @param times
  5638. * @param clnicId
  5639. * @param clinicStatus
  5640. */
  5641. function visitingDetailModal(patientId, times, clnicId, clinicStatus) {
  5642. var payMark = null;
  5643. if (clinicStatus == 5) {
  5644. payMark = 5;
  5645. } else {
  5646. payMark = 0;
  5647. }
  5648. prescriptionDetailCommon(patientId, times, clnicId, payMark, 1);
  5649. }
  5650. /**
  5651. * 就诊详情通用方法
  5652. * @param patientId
  5653. * @param times
  5654. * @param clnicId
  5655. * @param payMark
  5656. * @param type 0 已诊患者列表发起 1 历史轨迹发起
  5657. */
  5658. function prescriptionDetailCommon(patientId, times, clnicId, payMark, type) {
  5659. var oriPayMark = payMark;
  5660. if (payMark == 1) {
  5661. //退费时,查看的明细还是处方开立的情况
  5662. payMark = 0;
  5663. }
  5664. $.ajax({
  5665. type: "GET",
  5666. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + '&times=' + times + '&MzBlRecordFlag=false&payMark=' + payMark + '&clnicId=' + clnicId,
  5667. contentType: "application/json;charset=UTF-8",
  5668. dataType: "json",
  5669. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5670. success: function (res) {
  5671. if (res == '401' || res == 401) {
  5672. window.location.href = '/thmz/login/view'
  5673. return;
  5674. }
  5675. if (res.code == 0) {
  5676. $("#visitingDetailModal").modal();
  5677. var jsonData = res.data;
  5678. var mzPatientMi = res.mzPatientMi;
  5679. $("#visitingDetailPatientName").text(mzPatientMi.name);
  5680. $("#visitingDetailPatientAge").text(mzPatientMi.age);
  5681. $("#visitingDetailPatientGender").val(mzPatientMi.gender);
  5682. $("#prescriptionDetail_zd").html("");
  5683. $("#prescriptionDetail_xyzlContent").html("");
  5684. $("#prescriptionDetail_zyzlContent").html("");
  5685. $("#prescriptionDetail_zlyjContent").html("");
  5686. if (res.opDate != null) {
  5687. $("#visitingDetailDate").text(res.opDate);
  5688. }
  5689. if (res.deptName != null) {
  5690. $("#visitingDetailDept").text(res.deptName);
  5691. }
  5692. if (res.doctorName != null) {
  5693. $("#visitingDetailDoctor").text(res.doctorName);
  5694. }
  5695. var firstOrNot = jsonData.mzBlRecord.firstOrNot;
  5696. if (firstOrNot == 0) {
  5697. $("#visitFlag").html("初诊");
  5698. $("#first").next().click();
  5699. } else if (firstOrNot == 1) {
  5700. $("#visitFlag").html("复诊");
  5701. $("#not").next().click();
  5702. }
  5703. if (oriPayMark == 0) {
  5704. $("#chargeImage").attr("src", "/thmz/images/charge.png");
  5705. } else if (oriPayMark == 1) {
  5706. $("#chargeImage").attr("src", "/thmz/images/refund.png");
  5707. } else if (oriPayMark == 5) {
  5708. $("#chargeImage").attr("src", "/thmz/images/nocharge.png");
  5709. }
  5710. var icdText = jsonData.icdText;
  5711. if (icdText != null) {
  5712. var arr = icdText.split(",");
  5713. var html = "";
  5714. for (var i = 0; i < arr.length; i++) {
  5715. if (i == 0) {
  5716. html += ' <div class="tagZdy tagZdy-back">';
  5717. } else {
  5718. html += ' <div class="tagZdy tagZdy-back-green">';
  5719. }
  5720. html += arr[i];
  5721. html += '</div>';
  5722. }
  5723. $("#prescriptionDetail_zd").html(html);
  5724. } else {
  5725. $("#prescriptionDetail_zd").html(jsonData.mzBlRecord.tentativeDiagnosis);
  5726. }
  5727. var emrProcess = jsonData.mzBlRecord.emrProcess;
  5728. if (emrProcess != null) {
  5729. var xy = null;
  5730. if (emrProcess.indexOf("西药治疗:") >= 0) {
  5731. if (emrProcess.indexOf("中药治疗:") >= 0) {
  5732. xy = emrProcess.substring(emrProcess.indexOf("西药治疗:") + 5, emrProcess.indexOf("中药治疗:"));
  5733. } else if (emrProcess.indexOf("医技与诊疗:") >= 0) {
  5734. xy = emrProcess.substring(emrProcess.indexOf("西药治疗:") + 5, emrProcess.indexOf("医技与诊疗:"));
  5735. } else if (emrProcess.indexOf("入院处理:") >= 0) {
  5736. xy = emrProcess.substring(emrProcess.indexOf("西药治疗:") + 5, emrProcess.indexOf("入院处理:"));
  5737. } else {
  5738. xy = emrProcess.substring(emrProcess.indexOf("西药治疗:") + 5);
  5739. }
  5740. var arr = xy.split("_");
  5741. if (arr != null && arr.length > 0) {
  5742. var xyhtml = "";
  5743. for (var i = 0; i < arr.length; i++) {
  5744. xyhtml += "<div style='margin-bottom: 5px;padding-left: 10px;'>";
  5745. xyhtml += arr[i];
  5746. xyhtml += "</div>";
  5747. }
  5748. $("#prescriptionDetail_xyzlContent").html(xyhtml);
  5749. $("#prescriptionDetail_xyzlTitle").removeClass("hide").addClass("in");
  5750. } else {
  5751. $("#prescriptionDetail_xyzlTitle").removeClass("in").addClass("hide");
  5752. }
  5753. } else {
  5754. $("#prescriptionDetail_xyzlTitle").removeClass("in").addClass("hide");
  5755. }
  5756. var zy = null;
  5757. if (emrProcess.indexOf("中药治疗:") >= 0) {
  5758. if (emrProcess.indexOf("医技与诊疗:") >= 0) {
  5759. zy = emrProcess.substring(emrProcess.indexOf("中药治疗:") + 5, emrProcess.indexOf("医技与诊疗:"));
  5760. } else if (emrProcess.indexOf("入院处理:") >= 0) {
  5761. zy = emrProcess.substring(emrProcess.indexOf("中药治疗:") + 5, emrProcess.indexOf("入院处理:"));
  5762. } else {
  5763. zy = emrProcess.substring(emrProcess.indexOf("中药治疗:") + 5);
  5764. }
  5765. var zyArr = zy.split("_");
  5766. if (zyArr != null && zyArr.length > 0) {
  5767. var zyhtml = "";
  5768. for (var i = 1; i < zyArr.length; i++) {
  5769. if (i % 4 == 1) {
  5770. zyhtml += '<div class="item form-group" style="margin-bottom: -5px;">';
  5771. }
  5772. zyhtml += '<div class="col-md-3 col-sm-3 col-xs-12">';
  5773. zyhtml += zyArr[i];
  5774. zyhtml += "</div>";
  5775. if (i % 4 == 0) {
  5776. zyhtml += '</div>';
  5777. }
  5778. }
  5779. var zyfs = zyArr[0].substring(zyArr[0].indexOf("付数:") + 3);
  5780. if (zyfs != null && zyfs != "") {
  5781. if (zyArr.length % 4 == 1) {
  5782. zyhtml += '<div class="item form-group" style="margin-bottom: -5px;">';
  5783. }
  5784. zyhtml += '<div class="col-md-3 col-sm-3 col-xs-12">';
  5785. zyhtml += ' <div style="text-indent: 2em;">';
  5786. zyhtml += ' <div>';
  5787. zyhtml += 'X<span>';
  5788. zyhtml += zyfs;
  5789. zyhtml += '</span> 付</div></div>';
  5790. zyhtml += '</div>';
  5791. }
  5792. $("#prescriptionDetail_zyzlContent").html(zyhtml);
  5793. $("#prescriptionDetail_zyzlTitle").removeClass("hide").addClass("in");
  5794. } else {
  5795. $("#prescriptionDetail_zyzlTitle").removeClass("in").addClass("hide");
  5796. }
  5797. } else {
  5798. $("#prescriptionDetail_zyzlTitle").removeClass("in").addClass("hide");
  5799. }
  5800. if (emrProcess.indexOf("医技与诊疗:") >= 0) {
  5801. var zlyj = null;
  5802. if (emrProcess.indexOf("入院处理:") >= 0) {
  5803. zlyj = emrProcess.substring(emrProcess.indexOf("医技与诊疗:") + 6, emrProcess.indexOf("入院处理:"));
  5804. } else {
  5805. zlyj = emrProcess.substring(emrProcess.indexOf("医技与诊疗:") + 6);
  5806. }
  5807. var zlyjArr = zlyj.split("_");
  5808. if (zlyjArr != null && zlyjArr.length > 0) {
  5809. var zlyjhtml = "";
  5810. for (var i = 0; i < zlyjArr.length; i++) {
  5811. zlyjhtml += "<div style='margin-bottom: 5px;padding-left: 10px;'>";
  5812. zlyjhtml += zlyjArr[i];
  5813. zlyjhtml += "</div>";
  5814. }
  5815. $("#prescriptionDetail_zlyjContent").html(zlyjhtml);
  5816. $("#prescriptionDetail_zlyjTitle").removeClass("hide").addClass("in");
  5817. } else {
  5818. $("#prescriptionDetail_zlyjTitle").removeClass("in").addClass("hide");
  5819. }
  5820. } else {
  5821. $("#prescriptionDetail_zlyjTitle").removeClass("in").addClass("hide");
  5822. }
  5823. if (emrProcess.indexOf("入院处理:") >= 0) {
  5824. var zyReq = emrProcess.substring(emrProcess.indexOf("入院处理:") + 5);
  5825. if (zyReq != null && zyReq != "") {
  5826. var zyReqhtml = "<div style='margin-bottom: 5px;padding-left: 10px;'>";
  5827. zyReqhtml += zyReq;
  5828. zyReqhtml += "</div>";
  5829. $("#prescriptionDetail_zyReqContent").html(zyReqhtml);
  5830. $("#prescriptionDetail_zyReqTitle").removeClass("hide").addClass("in");
  5831. } else {
  5832. $("#prescriptionDetail_zyReqTitle").removeClass("in").addClass("hide");
  5833. }
  5834. } else {
  5835. $("#prescriptionDetail_zyReqTitle").removeClass("in").addClass("hide");
  5836. }
  5837. }
  5838. if (type == 0) {
  5839. $("#callPrescription").removeClass("in").addClass("hide");
  5840. if ((jsonData.mzChargeDetailList == null || jsonData.mzChargeDetailList.length == 0) && (jsonData.mzYjReqList == null || jsonData.mzYjReqList.length == 0)) {
  5841. $("#printPrescription").removeClass("in").addClass("hide");
  5842. } else {
  5843. $("#printPrescription").removeClass("hide").addClass("in");
  5844. $("#printPrescription").off("click").on("click", function (t) {
  5845. printPrescription(patientId, times, clnicId, payMark);
  5846. });
  5847. }
  5848. if (jsonData.mzYjReqList == null || jsonData.mzYjReqList.length == 0) {
  5849. $("#printYjReq").removeClass("in").addClass("hide");
  5850. $("#printYjReq").off("click");
  5851. } else {
  5852. $("#printYjReq").removeClass("hide").addClass("in");
  5853. $("#printYjReq").off("click").on("click", function (t) {
  5854. printYjReq(patientId, times);
  5855. });
  5856. }
  5857. $("#printBlRecord").removeClass("hide").addClass("in");
  5858. $("#printBlRecord").off("click").on("click", function (t) {
  5859. printBlRecord(patientId, times);
  5860. });
  5861. if (jsonData.mzZyReq == null || jsonData.mzZyReq.reqDept == null || jsonData.mzZyReq.reqDept == "") {
  5862. $("#printZyReq").removeClass("in").addClass("hide");
  5863. $("#printZyReq").off("click");
  5864. } else {
  5865. $("#printZyReq").removeClass("hide").addClass("in");
  5866. $("#printZyReq").off("click").on("click", function (t) {
  5867. printZyReq(patientId);
  5868. });
  5869. }
  5870. } else {
  5871. $("#printPrescription").removeClass("in").addClass("hide");
  5872. $("#callPrescription").removeClass("hide").addClass("in");
  5873. $("#callPrescription").off("click").on("click", function (t) {
  5874. getMzPrescriptionVoPaid(patientId, times, clnicId);
  5875. });
  5876. }
  5877. if (oriPayMark == 1) {
  5878. $("#printPrescription").removeClass("in").addClass("hide");
  5879. } else {
  5880. if ((jsonData.mzChargeDetailList == null || jsonData.mzChargeDetailList.length == 0) && (jsonData.mzYjReqList == null || jsonData.mzYjReqList.length == 0)) {
  5881. $("#printPrescription").removeClass("in").addClass("hide");
  5882. } else {
  5883. $("#printPrescription").removeClass("hide").addClass("in");
  5884. $("#printPrescription").off("click").on("click", function (t) {
  5885. printPrescription(patientId, times, clnicId, payMark);
  5886. });
  5887. }
  5888. }
  5889. } else {
  5890. errorMesage(res);
  5891. }
  5892. }
  5893. });
  5894. }
  5895. /**
  5896. * 查询默认打印机
  5897. */
  5898. function setPrint() {
  5899. if (printIndex >= 0) {
  5900. return;
  5901. }
  5902. $.ajax({
  5903. type: "GET",
  5904. url: '/thmz/getLastWindowsByCurrentUser',
  5905. contentType: "application/json;charset=UTF-8",
  5906. dataType: "json",
  5907. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5908. async: false,
  5909. success: function (res) {
  5910. if (res == '401' || res == 401) {
  5911. window.location.href = '/thmz/login/view'
  5912. return;
  5913. }
  5914. if (res.code == 0) {
  5915. printIndex = res.data.cgPrintIndex;
  5916. } else {
  5917. printIndex = -1;
  5918. }
  5919. }
  5920. });
  5921. }
  5922. function setTableHtml(prescriptionDetail) {
  5923. var html = "";
  5924. for (var j = 0; j < prescriptionDetail.length; j++) {
  5925. html += "<tr><td>";
  5926. html += prescriptionDetail[j].substring(0, prescriptionDetail[j].indexOf("用法"));
  5927. html += "</td></tr>";
  5928. html += "<tr><td>";
  5929. html += prescriptionDetail[j].substring(prescriptionDetail[j].indexOf("用法"));
  5930. html += "</td></tr>";
  5931. }
  5932. return {html: html, j: j};
  5933. }
  5934. // /**
  5935. // * 打印门诊指引单
  5936. // * @param patientId
  5937. // * @param times
  5938. // */
  5939. // function printGuideCard(patientId, times) {
  5940. //
  5941. // }
  5942. /**
  5943. * 打印门诊处方
  5944. * @param patientId
  5945. * @param times
  5946. * @param clnicId
  5947. * @param payMark
  5948. */
  5949. function printPrescription(patientId, times, clnicId, payMark) {
  5950. $.ajax({
  5951. type: "GET",
  5952. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + '&times=' + times + '&MzBlRecordFlag=false&payMark=' + payMark + '&clnicId=' + clnicId,
  5953. contentType: "application/json;charset=UTF-8",
  5954. dataType: "json",
  5955. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5956. success: function (res) {
  5957. if (res == '401' || res == 401) {
  5958. window.location.href = '/thmz/login/view'
  5959. return;
  5960. }
  5961. if (res.code == 0) {
  5962. var prescriptionDetail = res.data.mzBlRecord.prescriptionDetail;
  5963. if (prescriptionDetail != null && prescriptionDetail != "") {
  5964. var prescriptionDetailJson = JSON.parse(prescriptionDetail);
  5965. //当前处方只开了住院证则只打印住院证
  5966. if (prescriptionDetailJson.xyPrescription.jePrescription.length == 0 && prescriptionDetailJson.xyPrescription.mjPrescription.length == 0 && prescriptionDetailJson.xyPrescription.pyPrescription.length == 0 && prescriptionDetailJson.xyPrescription.ycPrescription.length == 0 && prescriptionDetailJson.zlPrescription.length == 0 && prescriptionDetailJson.zyPrescription.length == 0 && prescriptionDetailJson.zyReqPrescription.length > 0) {
  5967. printZyReq(patientId);
  5968. return;
  5969. }
  5970. var index = 0;
  5971. setPrint();
  5972. LODOP = getLodop();
  5973. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "湖南泰和医院处方笺");
  5974. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  5975. //设置默认打印机
  5976. LODOP.SET_PRINTER_INDEX(printIndex);
  5977. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  5978. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  5979. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  5980. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊处方笺");//对新建的纸张重命名
  5981. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  5982. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  5983. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  5984. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  5985. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  5986. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  5987. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  5988. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  5989. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  5990. var mzPatientMi = res.mzPatientMi;
  5991. $("#patientNamePrescription").text(mzPatientMi.name);
  5992. $("#patientGenderPrescription").text(mzPatientMi.gender);
  5993. $("#patientAgePrescription").text(mzPatientMi.age);
  5994. $("#patientIdPrescription").text(mzPatientMi.patientId);
  5995. $("#deptPrescription").text(res.deptName);
  5996. $("#doctorPrescription").text(res.doctorName);
  5997. $("#cfTime").text(res.opDate);
  5998. $("#zdPrescription").text(res.data.icdText);
  5999. $("#patientIdGuideCard").text(mzPatientMi.patientId);
  6000. $("#patientNameGuideCard").text(mzPatientMi.name);
  6001. $("#patientDateGuideCard").text(format(new Date(), "yyyy-MM-dd"));
  6002. //普药处方
  6003. var pyPrescription = prescriptionDetailJson.xyPrescription.pyPrescription;
  6004. if (pyPrescription != null && pyPrescription.length > 0) {
  6005. for (var i = 0; i < pyPrescription.length; i++) {
  6006. if (index > 0) {
  6007. LODOP.NewPageA();
  6008. }
  6009. var prescriptionDetail = pyPrescription[i].detail;
  6010. var __ret = setTableHtml(prescriptionDetail);
  6011. var html = __ret.html;
  6012. var j = __ret.j;
  6013. if (res.deptName.indexOf("儿") > 0) {
  6014. $("#typePrescription").text("儿科");
  6015. $("#cfTitle").text("儿科");
  6016. } else if (res.deptName.indexOf("急诊科") > 0) {
  6017. $("#typePrescription").text("急诊");
  6018. $("#cfTitle").text("急诊");
  6019. } else {
  6020. $("#typePrescription").text("普通处方");
  6021. $("#cfTitle").text("普通");
  6022. }
  6023. $("#prescriptionDetail").html(html);
  6024. $("#cfAmountPrint").text(pyPrescription[i].amount + "元 (不含注射费)");
  6025. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  6026. index++;
  6027. }
  6028. }
  6029. //医材处方
  6030. var ycPrescription = prescriptionDetailJson.xyPrescription.ycPrescription;
  6031. if (ycPrescription != null && ycPrescription.length > 0) {
  6032. for (var i = 0; i < ycPrescription.length; i++) {
  6033. if (index > 0) {
  6034. LODOP.NewPageA();
  6035. }
  6036. var prescriptionDetail = ycPrescription[i].detail;
  6037. var __ret = setTableHtml(prescriptionDetail);
  6038. var html = __ret.html;
  6039. var j = __ret.j;
  6040. if (res.deptName.indexOf("儿") > 0) {
  6041. $("#typePrescription").text("儿科");
  6042. $("#cfTitle").text("儿科");
  6043. } else if (res.deptName.indexOf("急诊科") > 0) {
  6044. $("#typePrescription").text("急诊");
  6045. $("#cfTitle").text("急诊");
  6046. } else {
  6047. $("#typePrescription").text("医材处方");
  6048. $("#cfTitle").text("普通");
  6049. }
  6050. $("#prescriptionDetail").html(html);
  6051. $("#cfAmountPrint").text(ycPrescription[i].amount + "元 ");
  6052. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  6053. index++;
  6054. }
  6055. }
  6056. //麻精处方
  6057. var mjPrescription = prescriptionDetailJson.xyPrescription.mjPrescription;
  6058. if (mjPrescription != null && mjPrescription.length > 0) {
  6059. for (var i = 0; i < mjPrescription.length; i++) {
  6060. if (index > 0) {
  6061. LODOP.NewPageA();
  6062. }
  6063. var prescriptionDetail = mjPrescription[i].detail;
  6064. var __ret = setTableHtml(prescriptionDetail);
  6065. var html = __ret.html;
  6066. var j = __ret.j;
  6067. $("#typePrescription").text("麻、精一处方");
  6068. $("#cfTitle").text("麻、精一");
  6069. $("#prescriptionDetail").html(html);
  6070. $("#cfAmountPrint").text(mjPrescription[i].amount + "元 (不含注射费)");
  6071. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  6072. index++;
  6073. }
  6074. }
  6075. //精二处方
  6076. var jePrescription = prescriptionDetailJson.xyPrescription.jePrescription;
  6077. if (jePrescription != null && jePrescription.length > 0) {
  6078. for (var i = 0; i < jePrescription.length; i++) {
  6079. if (index > 0) {
  6080. LODOP.NewPageA();
  6081. }
  6082. var prescriptionDetail = jePrescription[i].detail;
  6083. var __ret = setTableHtml(prescriptionDetail);
  6084. var html = __ret.html;
  6085. var j = __ret.j;
  6086. $("#typePrescription").text("精二处方");
  6087. $("#cfTitle").text("精二");
  6088. $("#prescriptionDetail").html(html);
  6089. $("#cfAmountPrint").text(jePrescription[i].amount + "元 (不含注射费)");
  6090. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  6091. index++;
  6092. }
  6093. }
  6094. //中药处方
  6095. if (prescriptionDetailJson.zyPrescription != null && prescriptionDetailJson.zyPrescription.length > 0) {
  6096. var zyPrescription = prescriptionDetailJson.zyPrescription[0].detail;
  6097. if (zyPrescription != null && zyPrescription.length > 0) {
  6098. var html = "";
  6099. for (var i = 0; i < zyPrescription.length; i++) {
  6100. if (i % 3 == 0) {
  6101. html += "<tr>";
  6102. }
  6103. html += "<td>";
  6104. html += zyPrescription[i].trim();
  6105. if (i % 3 == 2) {
  6106. html += "</td></tr>";
  6107. } else {
  6108. html += "</td>";
  6109. }
  6110. }
  6111. if (zyPrescription.length % 3 != 0) {
  6112. html += "</tr>";
  6113. }
  6114. html += "<tr><td>X " + prescriptionDetailJson.zyPrescription[0].zyfs + "付</td>";
  6115. var colNum = 1;
  6116. var frequency = prescriptionDetailJson.zyPrescription[0].frequency;
  6117. if (frequency != null && frequency != "") {
  6118. html += "<td>频率:" + frequency + "</td>";
  6119. colNum++;
  6120. }
  6121. var cyJssm = prescriptionDetailJson.zyPrescription[0].cyJssm;
  6122. if (cyJssm != null && cyJssm != "") {
  6123. html += "<td>加水说明:" + cyJssm + "</td>";
  6124. colNum++;
  6125. if (colNum % 3 == 0) {
  6126. html += "</tr>";
  6127. }
  6128. }
  6129. var cyFysm = prescriptionDetailJson.zyPrescription[0].cyFysm;
  6130. if (cyFysm != null && cyFysm != "") {
  6131. colNum++;
  6132. if (colNum % 3 == 1) {
  6133. html += "<tr>";
  6134. }
  6135. html += "<td>服用说明:" + cyFysm + "</td>";
  6136. if (colNum % 3 == 0) {
  6137. html += "</tr>";
  6138. }
  6139. }
  6140. var cyDj = prescriptionDetailJson.zyPrescription[0].cyDj;
  6141. if (cyDj != null && cyDj != "") {
  6142. colNum++;
  6143. if (colNum % 3 == 1) {
  6144. html += "<tr>";
  6145. }
  6146. html += "<td>" + cyDj + "</td>";
  6147. if (colNum % 3 == 0) {
  6148. html += "</tr>";
  6149. }
  6150. }
  6151. if (index > 0) {
  6152. LODOP.NewPageA();
  6153. }
  6154. if (res.deptName.indexOf("儿") > 0) {
  6155. $("#typePrescription").text("儿科");
  6156. $("#cfTitle").text("儿科");
  6157. } else if (res.deptName.indexOf("急诊科") > 0) {
  6158. $("#typePrescription").text("急诊");
  6159. $("#cfTitle").text("急诊");
  6160. } else {
  6161. $("#typePrescription").text("中药处方");
  6162. $("#cfTitle").text("普通");
  6163. }
  6164. $("#prescriptionDetail").html(html);
  6165. $("#cfAmountPrint").text(prescriptionDetailJson.zyPrescription[0].amount + "元 (不含代煎费)");
  6166. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  6167. index++;
  6168. }
  6169. }
  6170. if (prescriptionDetailJson.zlPrescription != null && prescriptionDetailJson.zlPrescription.length > 0) {
  6171. //诊疗处方
  6172. var zlPrescription = prescriptionDetailJson.zlPrescription[0].detail;
  6173. if (zlPrescription != null && zlPrescription.length > 0) {
  6174. var html = "";
  6175. for (var i = 0; i < zlPrescription.length; i++) {
  6176. html += "<tr><td>";
  6177. html += zlPrescription[i];
  6178. html += "</td></tr>";
  6179. }
  6180. if (index > 0) {
  6181. LODOP.NewPageA();
  6182. }
  6183. if (res.deptName.indexOf("儿") > 0) {
  6184. $("#typePrescription").text("儿科");
  6185. $("#cfTitle").text("儿科");
  6186. } else if (res.deptName.indexOf("急诊科") > 0) {
  6187. $("#typePrescription").text("急诊");
  6188. $("#cfTitle").text("急诊");
  6189. } else {
  6190. $("#typePrescription").text("诊疗处方");
  6191. $("#cfTitle").text("普通");
  6192. }
  6193. $("#prescriptionDetail").html(html);
  6194. $("#cfAmountPrint").text(prescriptionDetailJson.zlPrescription[0].amount + "元 ");
  6195. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  6196. index++;
  6197. }
  6198. }
  6199. $.ajax({
  6200. type: "GET",
  6201. url: '/thmz/getChargeDetailForGuideCard?patientId=' + patientId + '&times=' + times,
  6202. contentType: "application/json;charset=UTF-8",
  6203. dataType: "json",
  6204. headers: {
  6205. 'Accept': 'application/json',
  6206. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  6207. },
  6208. success: function (res) {
  6209. if (res == '401' || res == 401) {
  6210. window.location.href = '/thmz/login/view'
  6211. return;
  6212. }
  6213. if (res.code == 0) {
  6214. if (res.data != null && res.data.length > 0) {
  6215. var html = "";
  6216. for (var i = 0; i < res.data.length; i++) {
  6217. html += "<tr><td>" + res.data[i].itemType + "</td><td>" + Division(res.data[i].itemTotalFee, 100).toFixed(2) + "</td><td>" + res.data[i].execDeptName + "</td><td>" + res.data[i].execDeptAddress + "</td></tr>"
  6218. }
  6219. $("#guideCardDetail").html(html);
  6220. }
  6221. if (res.payQrcode != null && res.payQrcode != "") {
  6222. $("#payQrcodeGuideCard").html(null);
  6223. new QRCode(document.getElementById("payQrcodeGuideCard"), res.payQrcode); // 设置要生成二维码的链接
  6224. $("canvas").attr("id", "erw");
  6225. var canvas = document.getElementById('erw');
  6226. var src = canvas.toDataURL("image/png");
  6227. //var strDataURI =canvas.toDataURL("image/png");
  6228. $("#payQrcodeGuideCard").html("<img src='" + src + "' style='width:100px;height:100px;'/><div style='width: 100px;margin-top: 10px;text-align: center;'>微信支付</div>");
  6229. }
  6230. $("#totalAmountGuideCard").text("¥" + res.totalAmount);
  6231. // $("#imgcode").JsBarcode(patientId);
  6232. console.log(patientId);
  6233. JsBarcode('#imgcode', patientId, {
  6234. lineColor: '#333', //线条颜色
  6235. width: 2, //线宽
  6236. height: 60, //条码高度
  6237. displayValue: false, //是否显示文字信息
  6238. });
  6239. if (index > 0) {
  6240. LODOP.NewPageA();
  6241. }
  6242. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("guide_card_table").innerHTML);
  6243. //LODOP.PRINT();
  6244. LODOP.PREVIEW();
  6245. } else if (res.code == -2) {
  6246. LODOP.PREVIEW();
  6247. } else {
  6248. errorMesage(res);
  6249. }
  6250. }
  6251. });
  6252. // printGuideCard(patientId, times);
  6253. }
  6254. } else {
  6255. errorMesage(res);
  6256. }
  6257. }
  6258. });
  6259. }
  6260. /**
  6261. * 构建体征描述
  6262. * @param mzBlRecord
  6263. * @returns {*}
  6264. */
  6265. function getTz(mzBlRecord) {
  6266. var tz = null;
  6267. if (mzBlRecord.weight != null) {
  6268. var temp = "体重:" + mzBlRecord.weight + "kg ";
  6269. if (tz == null) {
  6270. tz = temp;
  6271. } else {
  6272. tz += " " + temp;
  6273. }
  6274. }
  6275. if (mzBlRecord.temperature != null) {
  6276. var temp = "体温:" + mzBlRecord.temperature + "℃ ";
  6277. if (tz == null) {
  6278. tz = temp;
  6279. } else {
  6280. tz += " " + temp;
  6281. }
  6282. }
  6283. if (mzBlRecord.sphygmus != null) {
  6284. var temp = "脉搏:" + mzBlRecord.sphygmus + "次/分 ";
  6285. if (tz == null) {
  6286. tz = temp;
  6287. } else {
  6288. tz += " " + temp;
  6289. }
  6290. }
  6291. if (mzBlRecord.breathe != null) {
  6292. var temp = "呼吸:" + mzBlRecord.breathe + "次/分 ";
  6293. if (tz == null) {
  6294. tz = temp;
  6295. } else {
  6296. tz += " " + temp;
  6297. }
  6298. }
  6299. if (mzBlRecord.pressureHigh != null && mzBlRecord.pressureFloor != null) {
  6300. var temp = "血压:" + mzBlRecord.pressureHigh + "/" + mzBlRecord.pressureFloor;
  6301. if (tz == null) {
  6302. tz = temp;
  6303. } else {
  6304. tz += " " + temp;
  6305. }
  6306. }
  6307. if (mzBlRecord.pressureHighLeft != null && mzBlRecord.pressureFloorLeft != null) {
  6308. var temp = "左血压:" + mzBlRecord.pressureHighLeft + "/" + mzBlRecord.pressureFloorLeft;
  6309. if (tz == null) {
  6310. tz = temp;
  6311. } else {
  6312. tz += " " + temp;
  6313. }
  6314. }
  6315. return tz;
  6316. }
  6317. /**
  6318. * 打印医技申请单
  6319. * @param patientId
  6320. * @param times
  6321. * @param clnicId
  6322. * @param payMark
  6323. */
  6324. function printYjReq(patientId, times) {
  6325. $.ajax({
  6326. type: "GET",
  6327. url: '/thmz/printYjReq?patientId=' + patientId + '&times=' + times,
  6328. contentType: "application/json;charset=UTF-8",
  6329. dataType: "json",
  6330. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6331. success: function (res) {
  6332. if (res == '401' || res == 401) {
  6333. window.location.href = '/thmz/login/view'
  6334. return;
  6335. }
  6336. if (res.code == 0) {
  6337. if (res.data == null || res.data.mzYjReqList == null || res.data.mzYjReqList.length == 0) {
  6338. errorMesageSimaple("没有医技申请单可以打印");
  6339. return;
  6340. }
  6341. setPrint();
  6342. LODOP = getLodop();
  6343. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "湖南泰和医院检查申请单");
  6344. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  6345. //设置默认打印机
  6346. LODOP.SET_PRINTER_INDEX(printIndex);
  6347. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  6348. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  6349. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  6350. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "检查申请单");//对新建的纸张重命名
  6351. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  6352. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  6353. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  6354. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  6355. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  6356. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  6357. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  6358. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  6359. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  6360. var mzPatientMi = res.data.mzPatientMi;
  6361. $("#patientIdJcReq").text(mzPatientMi.patientId);
  6362. $("#patientNameJcReq").text(mzPatientMi.name);
  6363. $("#patientGenderJcReq").text(mzPatientMi.gender);
  6364. $("#patientAgeJcReq").text(mzPatientMi.age + "岁");
  6365. $("#responseTypeJcReq").text(mzPatientMi.responseTypeName);
  6366. $("#patientCardNoJcReq").text(mzPatientMi.icCardNo);
  6367. $("#icdTextJcReq").text(res.data.mzVisitTable.icdText);
  6368. $("#patientIdJyReq").text(mzPatientMi.patientId);
  6369. $("#patientNameJyReq").text(mzPatientMi.name);
  6370. $("#patientGenderJyReq").text(mzPatientMi.gender);
  6371. $("#patientAgeJyReq").text(mzPatientMi.age + "岁");
  6372. $("#responseTypeJyReq").text(mzPatientMi.responseTypeName);
  6373. $("#patientCardNoJyReq").text(mzPatientMi.icCardNo);
  6374. $("#icdTextJyReq").text(res.data.mzVisitTable.icdText);
  6375. var mzBlRecord = res.data.mzBlRecord;
  6376. $("#jcReqEmrChiefComplaint").text(mzBlRecord.emrChiefComplaint);
  6377. $("#jcReqHis").text(mzBlRecord.emrHpi);
  6378. $("#jyReqEmrChiefComplaint").text(mzBlRecord.emrChiefComplaint);
  6379. $("#jyReqHis").text(mzBlRecord.emrHpi);
  6380. var tz = getTz(mzBlRecord);
  6381. $("#jcReqTz").text(tz);
  6382. $("#jcReqReqDept").text(res.data.deptName);
  6383. $("#jcReqReqDoctor").text(res.data.doctorName);
  6384. $("#jyReqTz").text(tz);
  6385. $("#jyReqReqDept").text(res.data.deptName);
  6386. $("#jyReqReqDoctor").text(res.data.doctorName);
  6387. for (var i = 0; i < res.data.mzYjReqList.length; i++) {
  6388. var obj = res.data.mzYjReqList[i];
  6389. if (i == 0) {
  6390. var dateStr = format(obj.reqDate, "yyyy-MM-dd");
  6391. $("#jcReqReqDate").text(dateStr);
  6392. $("#jyReqReqDate").text(dateStr);
  6393. }
  6394. if (i > 0) {
  6395. LODOP.NewPageA();
  6396. }
  6397. if (obj.reqType == "3") {
  6398. $("#reqNoJcReq").text(obj.reqNo);
  6399. $("#jcReqItem").text(obj.groupName);
  6400. $("#jcReqRemark").text(obj.jyRemark);
  6401. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("jc_card_table").innerHTML);
  6402. } else if (obj.reqType == "2") {
  6403. $("#reqNoJyReq").text(obj.reqNo);
  6404. $("#jyReqItem").text(obj.groupName);
  6405. $("#jyReqInspectStuff").text(obj.inspectStuff);
  6406. //检验
  6407. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("jy_card_table").innerHTML);
  6408. }
  6409. }
  6410. LODOP.PREVIEW();
  6411. } else {
  6412. errorMesage(res);
  6413. }
  6414. }
  6415. });
  6416. }
  6417. /**
  6418. * 打印门诊病历
  6419. * @param patientId
  6420. * @param times
  6421. * @param clnicId
  6422. * @param payMark
  6423. */
  6424. function printBlRecord(patientId, times) {
  6425. $.ajax({
  6426. type: "GET",
  6427. url: '/thmz/getMzBlrecord?patientId=' + patientId + '&times=' + times,
  6428. contentType: "application/json;charset=UTF-8",
  6429. dataType: "json",
  6430. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6431. success: function (res) {
  6432. if (res == '401' || res == 401) {
  6433. window.location.href = '/thmz/login/view'
  6434. return;
  6435. }
  6436. if (res.code == 0) {
  6437. setPrint();
  6438. LODOP = getLodop();
  6439. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "湖南泰和医院门诊病历");
  6440. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  6441. //设置默认打印机
  6442. LODOP.SET_PRINTER_INDEX(printIndex);
  6443. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  6444. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  6445. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  6446. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊病历");//对新建的纸张重命名
  6447. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  6448. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  6449. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  6450. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  6451. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  6452. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  6453. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  6454. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  6455. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  6456. var mzPatientMi = res.mzPatientMi;
  6457. $("#patientIdBlrecord").text(mzPatientMi.patientId);
  6458. $("#patientNameBlrecord").text(mzPatientMi.name);
  6459. $("#patientGenderBlrecord").text(mzPatientMi.gender);
  6460. $("#patientAgeBlrecord").text(mzPatientMi.age + "岁");
  6461. var mzBlRecord = res.mzBlRecord;
  6462. if (mzBlRecord.firstOrNot == "1") {
  6463. $("#firstOrNotTitle").text("复诊");
  6464. } else {
  6465. $("#firstOrNotTitle").text("初诊");
  6466. }
  6467. if (mzBlRecord.emrChiefComplaint != null && mzBlRecord.emrChiefComplaint != "") {
  6468. $("#emrChiefComplaintBlrecord").text(mzBlRecord.emrChiefComplaint);
  6469. $("#emrChiefComplaintBlrecord").parent().css("display", "block");
  6470. } else {
  6471. $("#emrChiefComplaintBlrecord").parent().css("display", "none");
  6472. }
  6473. if (mzBlRecord.emrHpi != null && mzBlRecord.emrHpi != "") {
  6474. $("#emrHpiBlrecord").text(mzBlRecord.emrHpi);
  6475. $("#emrHpiBlrecord").parent().css("display", "block");
  6476. } else {
  6477. $("#emrHpiBlrecord").parent().css("display", "none");
  6478. }
  6479. if (mzBlRecord.emrPs != null && mzBlRecord.emrPs != "") {
  6480. $("#emrPsBlrecord").text(mzBlRecord.emrPs);
  6481. $("#emrPsBlrecord").parent().css("display", "block");
  6482. } else {
  6483. $("#emrPsBlrecord").parent().css("display", "none");
  6484. }
  6485. if (mzBlRecord.personalHistory != null && mzBlRecord.personalHistory != "") {
  6486. $("#personalHistoryBlrecord").text(mzBlRecord.personalHistory);
  6487. $("#personalHistoryBlrecord").parent().css("display", "block");
  6488. } else {
  6489. $("#personalHistoryBlrecord").parent().css("display", "none");
  6490. }
  6491. if (mzBlRecord.familyHistory != null && mzBlRecord.familyHistory != "") {
  6492. $("#familyHistoryBlrecord").text(mzBlRecord.familyHistory);
  6493. $("#familyHistoryBlrecord").parent().css("display", "block");
  6494. } else {
  6495. $("#familyHistoryBlrecord").parent().css("display", "none");
  6496. }
  6497. if (mzBlRecord.obstericalHistory != null && mzBlRecord.obstericalHistory != "") {
  6498. $("#obstericalHistoryBlrecord").text(mzBlRecord.obstericalHistory);
  6499. $("#obstericalHistoryBlrecord").parent().css("display", "block");
  6500. } else {
  6501. $("#obstericalHistoryBlrecord").parent().css("display", "none");
  6502. }
  6503. var tz = getTz(mzBlRecord);
  6504. if (tz != null && tz != "") {
  6505. $("#tzjcBlrecord").text(tz);
  6506. $("#tzjcBlrecord").parent().css("display", "block");
  6507. } else {
  6508. $("#tzjcBlrecord").parent().css("display", "none");
  6509. }
  6510. if (mzBlRecord.emrPe != null && mzBlRecord.emrPe != "") {
  6511. $("#emrPeBlrecord").text(mzBlRecord.emrPe);
  6512. $("#emrPeBlrecord").parent().css("display", "block");
  6513. } else {
  6514. $("#emrPeBlrecord").parent().css("display", "none");
  6515. }
  6516. if (res.icdText != null && res.icdText != "") {
  6517. $("#icdTextBlrecord").text(res.icdText);
  6518. $("#icdTextBlrecord").parent().css("display", "block");
  6519. } else {
  6520. $("#icdTextBlrecord").parent().css("display", "none");
  6521. }
  6522. if (mzBlRecord.emrProcess != null && mzBlRecord.emrProcess != "") {
  6523. $("#emrProcessBlrecord").html(mzBlRecord.emrProcess);
  6524. $("#emrProcessBlrecord").parent().css("display", "block");
  6525. } else {
  6526. $("#emrProcessBlrecord").parent().css("display", "none");
  6527. }
  6528. if (mzBlRecord.emrJkjy != null && mzBlRecord.emrJkjy != "") {
  6529. $("#emrJkjyBlrecord").text(mzBlRecord.emrJkjy);
  6530. $("#emrJkjyBlrecord").parent().css("display", "block");
  6531. } else {
  6532. $("#emrJkjyBlrecord").parent().css("display", "none");
  6533. }
  6534. $("#visitDeptBlrecord").text(res.deptName);
  6535. $("#visitDoctorBlrecord").text(res.doctorName);
  6536. $("#visitDateBlrecord").text(res.visitDate);
  6537. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("mz_blrecord_card_table").innerHTML);
  6538. LODOP.PREVIEW();
  6539. } else {
  6540. errorMesage(res);
  6541. }
  6542. }
  6543. });
  6544. }
  6545. /**
  6546. * 打印入院通知单
  6547. * @param patientId
  6548. * @param times
  6549. * @param clnicId
  6550. * @param payMark
  6551. */
  6552. function printZyReq(patientId) {
  6553. $.ajax({
  6554. type: "GET",
  6555. url: '/thmz/printZyReq?patientId=' + patientId,
  6556. contentType: "application/json;charset=UTF-8",
  6557. dataType: "json",
  6558. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6559. success: function (res) {
  6560. if (res == '401' || res == 401) {
  6561. window.location.href = '/thmz/login/view'
  6562. return;
  6563. }
  6564. if (res.code == 0) {
  6565. setPrint();
  6566. LODOP = getLodop();
  6567. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "湖南泰和医院入院通知单");
  6568. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  6569. //设置默认打印机
  6570. LODOP.SET_PRINTER_INDEX(printIndex);
  6571. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  6572. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  6573. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  6574. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "入院通知单");//对新建的纸张重命名
  6575. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  6576. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  6577. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  6578. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  6579. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  6580. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  6581. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  6582. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  6583. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  6584. var mzPatientMi = res.mzPatientMi;
  6585. var mzZyReq = res.mzZyReq;
  6586. $("#patientIdZyReq").text(mzPatientMi.patientId);
  6587. $("#patientNameZyReq").text(mzPatientMi.name);
  6588. $("#patientGenderZyReq").text(mzPatientMi.gender);
  6589. $("#patientAgeZyReq").text(mzPatientMi.age + "岁");
  6590. $("#sfzZyReq").text(mzPatientMi.icCardNo);
  6591. $("#birthDateZyReq").text(format(mzPatientMi.birthDay, "yyyy-MM-dd"));
  6592. $("#phoneZyReq").text(mzPatientMi.phoneNo);
  6593. $("#responseTypeZyReq").text(mzPatientMi.responseTypeName);
  6594. $("#addressZyReq").text(mzPatientMi.address);
  6595. $("#icsTextZyReq").text(mzZyReq.icdText);
  6596. $("#reqDeptZyReq").text(mzZyReq.reqWard);
  6597. $("#smallDeptZyReq").text(mzZyReq.smallDept);
  6598. $("#admissStatusZyReq").text(mzZyReq.admissStatus);
  6599. $("#visitDateZyReq").text(format(mzZyReq.visitDate, "yyyy-MM-dd HH:mm:ss"));
  6600. $("#deptCodeZyReq").text(mzZyReq.deptCode);
  6601. $("#doctorCodeZyReq").text(mzZyReq.doctorCode);
  6602. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("mz_zy_req_table").innerHTML);
  6603. LODOP.PREVIEW();
  6604. } else {
  6605. errorMesage(res);
  6606. }
  6607. }
  6608. });
  6609. }