clinic.js 318 KB

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