clinic.js 448 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389
  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 prevEleId = null;
  13. //打开检查检验报告的时候不知道哪个有报告,如果检查没有就自动打开检验,但是为了防止死循环,次数加到1就不在进行重试
  14. var retryCount = 0;
  15. $(function () {
  16. initGenderSelect();
  17. iniAdmissStatus();
  18. initListDeptSelect();
  19. //initTryResultSelect();
  20. initResponceTypeSelect();
  21. initTemplateTypeSelect();
  22. initTemplateKindTypeSelect('templateKindType');
  23. initZyClassTypeSelect();
  24. initInstructionSelect();
  25. setSelectSize();
  26. initCertificateTypeSelect();
  27. $('#editUserBirthDayGroup').datetimepicker({
  28. format: 'yyyy-mm-dd',
  29. language: 'zh-CN',
  30. minView: "month",
  31. });
  32. initDaterangepickerWithId('reportrange', "right");
  33. formatCheck();
  34. //数据校验
  35. init_validator();
  36. //初始频次下拉选
  37. initOrderFrequencys("orderFrequency", true);
  38. //初始用药方式下拉选
  39. initSupplyTypes();
  40. //加载候诊患者列表
  41. loadUnClinicTableList();
  42. //加载接诊中患者列表
  43. loadInClinicTableList();
  44. //加载已接诊患者列表
  45. loadClinicTableList();
  46. //每隔一分钟秒读加载候诊患者列表
  47. setInterval(function () {
  48. //加载候诊患者列表
  49. loadUnClinicTableList();
  50. //加载已接诊患者列表 病人会缴费,需要刷新状态
  51. loadClinicTableList();
  52. }, 60000);
  53. //初始化快速接诊病人姓名栏事件
  54. initUserList();
  55. //初始化主诉弹出层
  56. initRecommendList();
  57. //卡号输入改变事件
  58. cardNoChange();
  59. /**
  60. * 患者信息修改
  61. */
  62. $("#saveEditUser").on("click", function (t) {
  63. modifyPatient();
  64. });
  65. // /**
  66. // * 保存入院证
  67. // */
  68. // $("#saveBeHospitalized").on("click", function (t) {
  69. // saveBeHospitalized();
  70. // });
  71. /**
  72. * 打印入院证
  73. */
  74. $("#printBeHospitalized").on("click", function (t) {
  75. modifyPatient();
  76. });
  77. //折叠按钮初始化
  78. $('.collapse-link').on('click', function () {
  79. var $BOX_PANEL = $(this).closest('.x_panel_mine'),
  80. $ICON = $(this).find('i'),
  81. $BOX_CONTENT = $BOX_PANEL.find('.x_content');
  82. // fix for some div with hardcoded fix class
  83. if ($BOX_PANEL.attr('style')) {
  84. $BOX_CONTENT.slideToggle(200, function () {
  85. $BOX_PANEL.removeAttr('style');
  86. });
  87. } else {
  88. $BOX_CONTENT.slideToggle(200);
  89. $BOX_PANEL.css('height', 'auto');
  90. }
  91. $ICON.toggleClass('fa-chevron-up fa-chevron-down');
  92. });
  93. /**
  94. * 接诊
  95. */
  96. $("#clinicalReception").on("click", function (t) {
  97. var patientIdDb = $("#patientIdDb").val();
  98. if (patientIdDb == null || patientIdDb == "") {
  99. errorMesageSimaple("当前未选择病人,无法接诊");
  100. return;
  101. }
  102. $.ajax({
  103. type: "GET",
  104. url: '/thmz/getMzfzPatientOrderByPatientId?patientId=' + patientIdDb,
  105. contentType: "application/json;charset=UTF-8",
  106. dataType: "json",
  107. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  108. success: function (res) {
  109. if (res == '401' || res == 401) {
  110. window.location.href = '/thmz/login/view'
  111. return;
  112. }
  113. if (res.code == 0) {
  114. if (res.data != null && res.data.length > 0) {
  115. if (res.data.length == 1) {
  116. $("#turnToConsultationIdInClick").val(res.data[0].turnToConsultationId);
  117. clinicalReception(patientIdDb, res.data[0].serialNo, res.data[0].reqType);
  118. } else {
  119. $("#mzfzPatientOrderModal").modal();
  120. $("#mzfzPatientOrderTable").html(null);
  121. for (var i = 0; i < res.data.length; i++) {
  122. var roomCode = res.data[i].roomCode;
  123. if (roomCode == null || roomCode == "null") {
  124. roomCode = "";
  125. }
  126. var doctorCode = (res.data[i].doctorCode == null || res.data[i].doctorCode == 'null') ? '' : res.data[i].doctorCode;
  127. $("<tr data-target='" + res.data[i].serialNo + "' data-target-reqType='" + res.data[i].reqType + "' data-target-turnToConsultationId='" + res.data[i].turnToConsultationId + "'><td>" + res.data[i].patientId + "</td><td>" + res.data[i].name + "</td><td>" + res.data[i].deptCode + "</td><td>" + doctorCode + "</td><td>" + roomCode + "</td></tr>").appendTo("#mzfzPatientOrderTable").bind('click', function () {
  128. $("#mzfzPatientOrderModal").modal("hide");
  129. $("#turnToConsultationIdInClick").val($(this).attr("data-target-turnToConsultationId"));
  130. clinicalReception(patientIdDb, $(this).attr("data-target"), $(this).attr("data-target-reqType"));
  131. });
  132. }
  133. }
  134. clearRapidAcceptsModal();
  135. $("#rapidAcceptsModal").modal("hide");
  136. } else {
  137. errorMesageSimaple("当前病人没有分诊信息");
  138. }
  139. } else if (res.code == 200) {
  140. clearRapidAcceptsModal();
  141. $("#rapidAcceptsModal").modal("hide");
  142. clinicalReception(patientIdDb, null, null);
  143. } else {
  144. errorMesage(res);
  145. }
  146. }
  147. });
  148. });
  149. /**
  150. * 存为范本
  151. */
  152. $("#saveapidAccepts").on("click", function (t) {
  153. // var symptom = $("#symptom").val();
  154. // if (symptom == null || symptom == "") {
  155. // errorMesageSimaple("主诉不能为空!");
  156. // return;
  157. // }
  158. //var emrHpi = $("#emrHpi").val();
  159. // if (emrHpi == null || emrHpi == "") {
  160. // errorMesageSimaple("现病史不能为空!");
  161. // return;
  162. // }
  163. // var diagnoseValue = $("#diagnoseValue").val();
  164. // var tentativeDiagnosis = $("#tentativeDiagnosis").val();
  165. // if (diagnoseValue != null) {
  166. // var reg = new RegExp(',', "g")
  167. // diagnoseValue = diagnoseValue.replace(reg, '');
  168. // }
  169. // if ((diagnoseValue == null || diagnoseValue == "") && (tentativeDiagnosis == null || tentativeDiagnosis == "")) {
  170. // errorMesageSimaple("诊断和初步诊断不能同时为空!");
  171. // return;
  172. // }
  173. //关闭帮助框
  174. $("#treeButton").webuiPopover('hide');
  175. $("#western_medicine_name").webuiPopover('hide');
  176. $("#chinese_medicine_name").webuiPopover('hide');
  177. $("#jcJyItem").webuiPopover('hide');
  178. $("#zlItem").webuiPopover('hide');
  179. $("#saveapidAcceptsModal").modal("show");
  180. });
  181. /**
  182. * 实例化智能问诊弹窗
  183. */
  184. // $("[data-toggle='popover']").popover();
  185. $("#box-arrow-left").popover({
  186. html: 'true',
  187. content: '<div id="smartAssistPopoverContent"></div>'
  188. });
  189. //初始化药品分组下拉选
  190. initGroupOrder();
  191. // 初始化用药天数下拉选
  192. initDayNum();
  193. //页面加载完成初始化西药处方
  194. //initNavTabs(0);
  195. //页面加载完成初始化住院处方
  196. //initNavTabs(3);
  197. //初始医生工作太配置
  198. initWorkspaceConfigForCurrent();
  199. initExecUnit();
  200. /**
  201. * 西药点击事件
  202. */
  203. $("#western_medicine_name").on("click", function (t) {
  204. var obj = $("#westernMedicinePopoverContent").parent().parent().parent();
  205. if ($(obj).hasClass("in") || $(obj).css("display") == "block") {
  206. $('#western_medicine_name').webuiPopover('hide');
  207. $("#treeButton").webuiPopover('hide');
  208. return;
  209. }
  210. $('#western_medicine_name').webuiPopover('show');
  211. loadYpList(0, null);
  212. });
  213. /**
  214. * 中药点击事件
  215. */
  216. $("#chinese_medicine_name").on("click", function (t) {
  217. var obj = $("#chineseMedicinePopoverContent").parent().parent().parent();
  218. if ($(obj).hasClass("in") || $(obj).css("display") == "block") {
  219. $('#chinese_medicine_name').webuiPopover('hide');
  220. $("#treeButton").webuiPopover('hide');
  221. return;
  222. }
  223. $('#chinese_medicine_name').webuiPopover('show');
  224. loadYpList(1, null);
  225. });
  226. /**
  227. * 辅助检查、检验点击事件
  228. */
  229. $("#jcJyItem").on("click", function (t) {
  230. var obj = $("#jcJyItemPopoverContent").parent().parent().parent();
  231. if ($(obj).hasClass("in") || $(obj).css("display") == "block") {
  232. $('#jcJyItem').webuiPopover('hide');
  233. $("#treeButton").webuiPopover('hide');
  234. return;
  235. }
  236. $('#jcJyItem').webuiPopover('show');
  237. loadjcJyItemList(null);
  238. });
  239. /**
  240. * 诊疗点击事件
  241. */
  242. $("#zlItem").on("click", function (t) {
  243. var obj = $("#zlItemPopoverContent").parent().parent().parent();
  244. if ($(obj).hasClass("in") || $(obj).css("display") == "block") {
  245. $('#zlItem').webuiPopover('hide');
  246. $("#treeButton").webuiPopover('hide');
  247. return;
  248. }
  249. $('#zlItem').webuiPopover('show');
  250. loadZlItemList(null);
  251. });
  252. initYshPart();
  253. initJyZdSample();
  254. setTimeout(function () {
  255. getLodop();
  256. }, 800);
  257. //键盘监听回车键
  258. $(document).unbind("keyup").keyup(function (event) {
  259. var index = getIndex("bill_item_group");
  260. if (event.keyCode == 13) { //是否是回车
  261. var el = event.srcElement || event.target;
  262. var id = el.getAttribute("id");
  263. var current_code = null;
  264. if (index == 0) {
  265. current_code = $("#western_medicine_current_code").val();
  266. } else if (index == 1) {
  267. current_code = $("#chinese_medicine_current_code").val();
  268. } else if (index == 2) {
  269. current_code = $("#jcjy_current_code").val();
  270. } else if (index == 3) {
  271. current_code = $("#zl_current_code").val();
  272. }
  273. if (id == null || id == "") {
  274. id = el.getAttribute("data-id");
  275. }
  276. if (id == null || id == "") {
  277. var search = el.getAttribute("aria-label");
  278. if (search == "Search") {
  279. id = $(el).parent().parent().prev().attr("data-id");
  280. }
  281. }
  282. if (id != null && id != "") {
  283. //将当前点击的id记录下
  284. //prevEleId = id;
  285. } else if (prevEleId != null) {
  286. id = prevEleId;
  287. }
  288. //回车时,光标不在任何区域判断是不是在药品和诊疗开立区域
  289. if (id == null || id == "") {
  290. var index = getIndex("bill_item_group");
  291. if (index == 0) {
  292. if (current_code != null && current_code != "") {
  293. //当前页面是西药保存页面,且有药品选中
  294. $("#supplyType").next().click();
  295. }
  296. } else if (index == 1) {
  297. //当前页面是中草药保存页面,且有药品选中
  298. } else if (index == 2) {
  299. if (current_code != null && current_code != "") {
  300. //当前页面是医技保存页面,且有选中
  301. if ($("#jyZdSampleDiv").hasClass('in')) {
  302. //此时是检验
  303. $("#jyZdSample").next().click();
  304. } else if ($("#yshPartDiv").hasClass('in')) {
  305. //说明现在是检查
  306. $("#yshPart").next().click();
  307. }
  308. }
  309. } else if (index == 3) {
  310. //诊疗
  311. $("#yshPart").next().click();
  312. return;
  313. } else if (index == 4) {
  314. //当前页面是住院保存页面
  315. $("#inpatientWardBeHospitalized").next().click();
  316. return;
  317. }
  318. }
  319. var customization = $("div.customization").not(".hide");
  320. // //回车时,光标不在任何区域,默认点击主诉
  321. // if (id == null || id == "") {
  322. // var eleId = $(customization[0]).attr("target-id");
  323. // $("#" + eleId).focus();
  324. // if (eleId == 'symptom') {
  325. // $("#" + eleId).click();
  326. // }
  327. // console.log("eleId=" + eleId);
  328. // } else
  329. if (id == 'symptom' || id == 'emrHpi' || id == 'emrPs' || id == 'personalHistory' || id == 'familyHistory' || id == 'obstericalHistory' || id == 'otherCheck' || id == 'diagnose' || id == 'tentativeDiagnosis') {
  330. console.log("1id=" + id);
  331. if (id != $(customization[customization.length - 1]).attr("target-id")) {
  332. var next = $("#" + id + "Flag").next();
  333. while ($(next).hasClass("foreclose") || $(next).hasClass("hide")) {
  334. next = $(next).next();
  335. }
  336. var eleId = $(next).attr("target-id");
  337. $("#" + eleId).focus();
  338. if (eleId == 'diagnose' || id == 'diagnose' || id == 'symptom') {
  339. $("#" + eleId).click();
  340. }
  341. console.log("1eleId=" + eleId);
  342. } else {
  343. var data_target = $("#symptom").attr("data-target");
  344. $("#" + data_target).find("a.close").click();
  345. data_target = $("#diagnose").attr("data-target");
  346. $("#" + data_target).find("a.close").click();
  347. if (index == 0) {
  348. $("#western_medicine_name").focus();
  349. } else if (index == 1) {
  350. $("#chinese_medicine_name").focus();
  351. } else if (index == 2) {
  352. $("#jcJyItem").focus();
  353. } else if (index == 3) {
  354. $("#zlItem").focus();
  355. } else if (index == 4) {
  356. $("#inpatientWardBeHospitalized").next().click();
  357. }
  358. }
  359. } else if (id == 'zy_drugWin') {
  360. $("#zyInstruction").next().click();
  361. } else if (id == 'zyInstruction') {
  362. var ariaExpanded = $("#zyInstruction").next().attr("aria-expanded");
  363. if (ariaExpanded == true || ariaExpanded == "true") {
  364. $("#zyInstruction").next().click();
  365. }
  366. $("#saveChineseMedicine").click();
  367. $("#chinese_medicine_name").focus();
  368. $("#chinese_medicine_name").click();
  369. }
  370. else if (id == 'cyJssm') {
  371. $("#cyJsl").focus();
  372. } else if (id == 'cyJsl') {
  373. $("#cyZql").focus();
  374. } else if (id == 'cyZql') {
  375. $("#cyFj").focus();
  376. } else if (id == 'cyFj') {
  377. $("#cyFfcs").focus();
  378. } else if (id == 'cyFj') {
  379. $("#cyFfcs").focus();
  380. } else if (id == 'cyFfcs') {
  381. $("#useType_1").next().click();
  382. } else if (id == 'useType_1') {
  383. $("#cyMtjs").focus();
  384. } else if (id == 'cyMtjs') {
  385. $("#zyfs").focus();
  386. } else if (id == 'zyfs') {
  387. $("#zy_supplyType_1").next().click();
  388. } else if (id == 'supplyType') {
  389. $("#drugWinUnit").next().click();
  390. } else if (id == 'drugWinUnit') {
  391. $("#drugWin").focus();
  392. } else if (id == 'drugWin') {
  393. $("#dayNum").next().click();
  394. } else if (id == 'dayNum') {
  395. $("#orderFrequency").next().click();
  396. } else if (id == 'orderFrequency') {
  397. $("#gross").focus();
  398. } else if (id == 'gross') {
  399. $("#packUnit").next().click();
  400. } else if (id == 'packUnit') {
  401. $("#medicalAdvice").next().click();
  402. } else if (id == 'medicalAdvice') {
  403. var ariaExpanded = $("#medicalAdvice").next().attr("aria-expanded");
  404. if (ariaExpanded == true || ariaExpanded == "true") {
  405. $("#medicalAdvice").next().click();
  406. }
  407. saveMedicine(0);
  408. $("#western_medicine_name").focus();
  409. } else if (id == 'saveWesternMedicine') {
  410. $("#western_medicine_name").focus();
  411. $("#western_medicine_name").click();
  412. } else if (id == 'jyZdSample' || id == 'yshPart') {
  413. $("#execUnit").next().click();
  414. } else if (id == 'execUnit') {
  415. var ariaExpanded = $("#execUnit").next().attr("aria-expanded");
  416. if (ariaExpanded == true || ariaExpanded == "true") {
  417. $("#execUnit").next().click();
  418. }
  419. $("#remark").focus();
  420. } else if (id == 'remark') {
  421. saveJyJcItem(true);
  422. $("#jcJyItem").focus();
  423. } else if (id == 'chargeUnit') {
  424. $("#zlExecUnit").next().click();
  425. } else if (id == 'zlExecUnit') {
  426. var ariaExpanded = $("#zlExecUnit").next().attr("aria-expanded");
  427. if (ariaExpanded == true || ariaExpanded == "true") {
  428. $("#zlExecUnit").next().click();
  429. }
  430. $("#itemQuantity").focus();
  431. } else if (id == 'itemQuantity') {
  432. $("#zlRemark").focus();
  433. } else if (id == 'zlRemark') {
  434. saveZlItem(true);
  435. $("#zlItem").focus();
  436. } else if (id == 'inpatientWardBeHospitalized') {
  437. $("#smallWardBeHospitalized").next().click();
  438. } else if (id == 'smallWardBeHospitalized') {
  439. $("#admissStatus").next().click();
  440. } else if (id == 'admissStatus') {
  441. saveZyReq(true);
  442. $("#zy_req_button").focus();
  443. } else if (id == 'western_medicine_name') {
  444. var webuiID = $("#western_medicine_name").attr("data-target");
  445. if (webuiID == null || webuiID == "null" || webuiID == "") {
  446. //药品查询框是空白的,打开查询框
  447. $("#western_medicine_name").click();
  448. return;
  449. }
  450. //选择框打开
  451. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  452. var arr = $("#tb_table_western_medicine").find("tbody").find("tr.trhover");
  453. if (arr != undefined && arr != null && arr.length > 0) {
  454. var dataIndex = $(arr).attr("data-index");
  455. var tableData = $("#tb_table_western_medicine").bootstrapTable('getData');
  456. if (tableData != null && tableData.length > 0 && dataIndex != null) {
  457. var trData = tableData[dataIndex];
  458. checkYpInfo(trData.code, trData.serial, trData.ypType, true, null);
  459. $("#western_medicine_name").click();
  460. }
  461. } else {
  462. //药品查询框是空白的,打开查询框
  463. $("#western_medicine_name").click();
  464. }
  465. } else {
  466. if (current_code != null && current_code != "") {
  467. //已经选中药品,跳到用法
  468. $("#supplyType").next().click();
  469. } else {
  470. //药品查询框是空白的,打开查询框
  471. $("#western_medicine_name").click();
  472. }
  473. }
  474. } else if (id == 'chinese_medicine_name') {
  475. var webuiID = $("#chinese_medicine_name").attr("data-target");
  476. if (webuiID == null || webuiID == "null" || webuiID == "") {
  477. $("#chinese_medicine_name").click();
  478. return;
  479. }
  480. //选择框打开
  481. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  482. var arr = $("#tb_table_chinese_medicine").find("tbody").find("tr.trhover");
  483. if (arr != undefined && arr != null && arr.length > 0) {
  484. var dataIndex = $(arr).attr("data-index");
  485. var tableData = $("#tb_table_chinese_medicine").bootstrapTable('getData');
  486. if (tableData != null && tableData.length > 0 && dataIndex != null) {
  487. var trData = tableData[dataIndex];
  488. checkZyInfo(trData.code, trData.serial, true);
  489. $("#chinese_medicine_name").click();
  490. }
  491. } else {
  492. //药品查询框是空白的,打开查询框
  493. $("#chinese_medicine_name").click();
  494. }
  495. } else {
  496. if (current_code != null && current_code != "") {
  497. //已经选中药品,跳到剂量
  498. $("#zy_drugWin").next().click();
  499. } else {
  500. //药品查询框是空白的,打开查询框
  501. $("#chinese_medicine_name").click();
  502. }
  503. }
  504. } else if (id == 'jcJyItem') {
  505. var webuiID = $("#jcJyItem").attr("data-target");
  506. if (webuiID == null || webuiID == "null" || webuiID == "") {
  507. $("#jcJyItem").click();
  508. return;
  509. }
  510. //选择框打开
  511. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  512. var arr = $("#tb_table_jc_jy_item").find("tbody").find("tr.trhover");
  513. if (arr != undefined && arr != null && arr.length > 0) {
  514. var dataIndex = $(arr).attr("data-index");
  515. var tableData = $("#tb_table_jc_jy_item").bootstrapTable('getData');
  516. if (tableData != null && tableData.length > 0 && dataIndex != null) {
  517. var trData = tableData[dataIndex];
  518. $('#jcJyItem').webuiPopover('hide');
  519. $("#jcJyZltype").val(trData.type);
  520. $("#execUnit").selectpicker('val', trData.execUnit);//默认不选中
  521. $("#execUnit").selectpicker('refresh');
  522. if (trData.type == 1) {
  523. //检验
  524. $("#jyZdSampleDiv").removeClass("hide").addClass("in");
  525. $("#chargeUnitDiv").removeClass("in").addClass("hide");
  526. $("#yshPartDiv").removeClass("in").addClass("hide");
  527. if (trData.sampleCode != null && trData.sampleCode != "") {
  528. $("#jyZdSample").selectpicker('val', trData.sampleCode);
  529. $('#jyZdSample').selectpicker('refresh');
  530. }
  531. } else if (trData.type == 2) {
  532. //检查
  533. $("#yshPartDiv").removeClass("hide").addClass("in");
  534. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  535. $("#chargeUnitDiv").removeClass("in").addClass("hide");
  536. if (trData.bwCode != null && trData.bwCode != "") {
  537. $("#yshPart").selectpicker('val', trData.bwCode);
  538. $('#yshPart').selectpicker('refresh');
  539. }
  540. }
  541. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  542. checkJcJyItemInfo(trData.code, trData.name, trData.type, true);
  543. }
  544. } else {
  545. //药品查询框是空白的,打开查询框
  546. $("#jcJyItem").click();
  547. }
  548. } else {
  549. if (current_code != null && current_code != "") {
  550. //如果是保存失败的,重新打开输入框查询
  551. if (prevEleId == 'remark') {
  552. $("#jcJyItem").click();
  553. } else {
  554. //当前页面是医技保存页面,且有选中
  555. if ($("#jyZdSampleDiv").hasClass('in')) {
  556. //此时是检验
  557. $("#jyZdSample").next().click();
  558. } else if ($("#yshPartDiv").hasClass('in')) {
  559. //说明现在是检查
  560. $("#yshPart").next().click();
  561. }
  562. }
  563. } else {
  564. //药品查询框是空白的,打开查询框
  565. $("#jcJyItem").click();
  566. }
  567. }
  568. } else if (id == 'zlItem') {
  569. var webuiID = $("#zlItem").attr("data-target");
  570. if (webuiID == null || webuiID == "null" || webuiID == "") {
  571. $("#zlItem").click();
  572. return;
  573. }
  574. //选择框打开
  575. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  576. var arr = $("#tb_table_zl_item").find("tbody").find("tr.trhover");
  577. if (arr != undefined && arr != null && arr.length > 0) {
  578. var dataIndex = $(arr).attr("data-index");
  579. var tableData = $("#tb_table_zl_item").bootstrapTable('getData');
  580. if (tableData != null && tableData.length > 0 && dataIndex != null) {
  581. var trData = tableData[dataIndex];
  582. $('#zlItem').webuiPopover('hide');
  583. $("#zlExecUnit").selectpicker('val', trData.execUnit);//默认不选中
  584. $("#zlExecUnit").selectpicker('refresh');
  585. //诊疗
  586. if ($("#zlTab").find("li") == null || $("#zlTab").find("li").length == 0) {
  587. initNavTabs(3);
  588. }
  589. $("#zlItem").val(trData.name);
  590. $("#zlItem").blur();
  591. $("#zlItemPrice").val(trData.chargeAmount);
  592. $("#chargeUnit").val(trData.specification);
  593. $("#zl_current_code").val(trData.code);
  594. $("#itemQuantity").val(1);
  595. $("#chargeUnit").focus();
  596. }
  597. } else {
  598. //药品查询框是空白的,打开查询框
  599. $("#zlItem").click();
  600. }
  601. } else {
  602. if (current_code != null && current_code != "") {
  603. //如果是保存失败的,重新打开输入框查询
  604. if (prevEleId == 'zlRemark') {
  605. $("#zlItem").click();
  606. } else {
  607. $("#chargeUnit").focus();
  608. }
  609. } else {
  610. //药品查询框是空白的,打开查询框
  611. $("#zlItem").click();
  612. }
  613. }
  614. } else if (id == 'zy_req_button') {
  615. //当前页面是住院保存页面,此时光标在入院按钮上
  616. console.log("入院按钮")
  617. $("#inpatientWardBeHospitalized").next().click();
  618. }
  619. if (id != null && id != "") {
  620. //将当前点击的id记录下
  621. prevEleId = id;
  622. }
  623. } else if (event.keyCode == 37) {
  624. // //左键事件
  625. // if(index==0){
  626. // return;
  627. // }
  628. // var prevObject=$("#bill_item_group").find("button")[index-1];
  629. // $(prevObject).click();
  630. } else if (event.keyCode == 38) {
  631. //上键事件
  632. var tableId = null;
  633. var inputId = null;
  634. var contentId = null;
  635. if (index == 0) {
  636. tableId = "tb_table_western_medicine";
  637. inputId = "western_medicine_name";
  638. contentId = "westernMedicinePopoverContent";
  639. } else if (index == 1) {
  640. tableId = "tb_table_chinese_medicine";
  641. inputId = "chinese_medicine_name";
  642. contentId = "chineseMedicinePopoverContent";
  643. } else if (index == 2) {
  644. tableId = "tb_table_jc_jy_item";
  645. inputId = "jcJyItem";
  646. contentId = "jcJyItemPopoverContent";
  647. } else if (index == 3) {
  648. tableId = "tb_table_zl_item";
  649. inputId = "zlItem";
  650. contentId = "zlItemPopoverContent";
  651. }
  652. if (inputId == null) {
  653. return;
  654. }
  655. var webuiID = $("#" + inputId).attr("data-target");
  656. if (webuiID == null || webuiID == "null" || webuiID == "") {
  657. return;
  658. }
  659. //选择框打开
  660. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  661. var arr = $("#" + tableId).find("tbody").find("tr.trhover");
  662. var prev = $(arr).prev();
  663. if (arr != undefined && arr != null && arr.length > 0) {
  664. if (prev != undefined && prev != null && prev.length > 0) {
  665. $(arr).removeClass("trhover");
  666. $(prev).addClass("trhover");
  667. var height = $(arr).css("height");
  668. $("#" + contentId).parent().animate({scrollTop: "-=" + height}, 100);
  669. }
  670. } else {
  671. var arrs = $("#" + tableId).find("tbody").find("tr");
  672. $(arrs[0]).addClass("trhover");
  673. var height = $(arrs[0]).css("height");
  674. $("#" + contentId).parent().animate({scrollTop: "+=" + height}, 100);
  675. }
  676. }
  677. } else if (event.keyCode == 39) {
  678. // //右键事件
  679. // if(index==4){
  680. // return;
  681. // }
  682. // var nextObject=$("#bill_item_group").find("button")[index+1];
  683. // $(nextObject).click();
  684. } else if (event.keyCode == 40) {
  685. //下键事件
  686. var tableId = null;
  687. var inputId = null;
  688. var contentId = null;
  689. if (index == 0) {
  690. tableId = "tb_table_western_medicine";
  691. inputId = "western_medicine_name";
  692. contentId = "westernMedicinePopoverContent";
  693. } else if (index == 1) {
  694. tableId = "tb_table_chinese_medicine";
  695. inputId = "chinese_medicine_name";
  696. contentId = "chineseMedicinePopoverContent";
  697. } else if (index == 2) {
  698. tableId = "tb_table_jc_jy_item";
  699. inputId = "jcJyItem";
  700. contentId = "jcJyItemPopoverContent";
  701. } else if (index == 3) {
  702. tableId = "tb_table_zl_item";
  703. inputId = "zlItem";
  704. contentId = "zlItemPopoverContent";
  705. }
  706. if (inputId == null) {
  707. return;
  708. }
  709. var webuiID = $("#" + inputId).attr("data-target");
  710. if (webuiID == null || webuiID == "null" || webuiID == "") {
  711. return;
  712. }
  713. //选择框打开
  714. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  715. var arr = $("#" + tableId).find("tbody").find("tr.trhover");
  716. var next = $(arr).next();
  717. if (arr != undefined && arr != null && arr.length > 0) {
  718. if (next != undefined && next != null && next.length > 0) {
  719. $(arr).removeClass("trhover");
  720. $(next).addClass("trhover");
  721. var height = $(arr).css("height");
  722. $("#" + contentId).parent().animate({scrollTop: "+=" + height}, 100);
  723. }
  724. } else {
  725. var arrs = $("#" + tableId).find("tbody").find("tr");
  726. $(arrs[0]).addClass("trhover");
  727. var height = $(arrs[0]).css("height");
  728. $("#" + contentId).parent().animate({scrollTop: "+=" + height}, 100);
  729. }
  730. }
  731. }
  732. });
  733. //打印检查检验报告单
  734. $('#btn_print').click(function () {
  735. printJyJcReport(1);
  736. });
  737. //打印设置检查检验报告单
  738. $('#btn_print_setup').click(function () {
  739. printJyJcReport(2);
  740. });
  741. /**
  742. * 医保电子凭证读卡
  743. */
  744. $("#siReadCard").on("click", function (t) {
  745. siReadCard();
  746. });
  747. /**
  748. * 快速接诊页面 -未挂号患者信息查询处编辑患者信息
  749. */
  750. $("#rapidAcceptsEditUser").on("click", function (t) {
  751. editUserModal($("#rapidAcceptsUserCode").val());
  752. });
  753. });
  754. /**
  755. * 打开配置页面
  756. */
  757. function configWorkspaceModal() {
  758. initWorkspaceConfigForCurrent();
  759. $("#configWorkspaceModal").modal("show");
  760. }
  761. /**
  762. * 初始化用药天数下拉选
  763. */
  764. function initDayNum() {
  765. var html = '';
  766. for (var i = 1; i <= 112; i++) {
  767. html += '<option value="' + i + '">' + i + '</option>';
  768. }
  769. $('#dayNum').html(html);
  770. $('#dayNum').selectpicker('refresh');
  771. }
  772. /**
  773. * 初始化药品分组下拉选
  774. */
  775. function initGroupOrder() {
  776. var html = '<option value="1">1</option>';
  777. $('#groupId').html(html);
  778. $('#groupId').selectpicker('refresh');
  779. $("#groupId").selectpicker('val', 1);
  780. $('#groupId').selectpicker('refresh');
  781. groupIdMap = new Map();
  782. }
  783. /**
  784. * 追加分组
  785. */
  786. function appendGroupOrder() {
  787. var last = parseInt($("#groupId > option:last").val());
  788. last++;
  789. var html = '<option value="' + last + '">' + last + '</option>';
  790. $('#groupId').append(html);
  791. $('#groupId').selectpicker('refresh');
  792. }
  793. /**
  794. * 组号改变事件
  795. */
  796. function groupIdChange() {
  797. var last = parseInt($("#groupId > option:last").val());
  798. var groupId = $("#groupId").val();
  799. if (groupId == last) {
  800. //是新增药品清空药品输入区域
  801. var updateFlag = $("#western_medicine_update_flag").val();
  802. var currentCode = $("#western_medicine_current_code").val();
  803. //当前时新增药品,而且没有选择药品的时候,组号变更,清空区域
  804. if ((updateFlag == undefined || updateFlag == null || updateFlag == "false" || updateFlag == false) && (currentCode == null || currentCode == "")) {
  805. clearWesternMedicine(true);
  806. }
  807. } else {
  808. var map = groupIdMap.get(groupId);
  809. if (map != null) {
  810. var supplyType = map.get("supplyType");
  811. var orderFrequency = map.get("orderFrequency");
  812. var dayNum = map.get("dayNum");
  813. //用法编码
  814. $("#supplyType").selectpicker('val', supplyType);
  815. $('#supplyType').selectpicker('refresh');
  816. //$("#supplyType").attr("disabled", "disabled");
  817. //天数
  818. $("#dayNum").selectpicker('val', dayNum);
  819. $('#dayNum').selectpicker('refresh');
  820. // $("#dayNum").attr("disabled", "disabled");
  821. //频次编码
  822. $("#orderFrequency").selectpicker('val', orderFrequency);
  823. $('#orderFrequency').selectpicker('refresh');
  824. // $("#orderFrequency").attr("disabled", "disabled");
  825. }
  826. }
  827. }
  828. /**
  829. * 关闭智能问诊弹框
  830. */
  831. function closePopover() {
  832. //$(".popover").popover('hide');
  833. $("#box-arrow-left").click();
  834. }
  835. /**
  836. * 加载智能问诊弹框内容
  837. */
  838. function contentMethod() {
  839. setTimeout(function () {
  840. $(".popover div.arrow").css("display", "none");
  841. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  842. if (popoverId == undefined) {
  843. return;
  844. }
  845. var left = $("#" + popoverId).css("left");
  846. left = left.replace("px", "");
  847. left = parseInt(left);
  848. left = left + 55;
  849. $("#" + popoverId).css("height", "100%").css("top", "0px").css("left", left + "px").css("border-radius", "0px").css("z-index", "11");
  850. $("#" + popoverId + " .popover-content").css("height", "100%");
  851. $("#smartAssistPopoverContent").css("height", "100%");
  852. var html = ' <div style="height: 24%;padding-left: 15px;width: 100%;">' +
  853. ' <button type="button" style="cursor: default;margin-bottom: 0px;margin-right: 0px; font-size: 12px;"' +
  854. ' class="btn btn-primary">' +
  855. ' <span id="patientHisData"></span>就医轨迹' +
  856. ' </button>' +
  857. ' <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true" onclick="closePopover()">×</span>' +
  858. ' </button>' +
  859. ' <div style="height: calc(100% - 39px);border: 1px solid #DDDDDD;margin-top: 5px;width: 100%;">' +
  860. ' <form class="form-horizontal form-label-left mz-fixed-form" novalidate autocomplete="off"' +
  861. ' style="height: 100%;overflow-y: auto;width: 100%;text-align: -webkit-center;position: relative;" id="patientHisDataForm">' +
  862. ' </form>' +
  863. ' </div>' +
  864. ' </div>' +
  865. ' <div style="height: 23%;padding-left: 15px;width: 100%;">' +
  866. ' <button type="button" style="cursor: default;margin-bottom: 0px;margin-right: 0px;margin-top: 5px;"' +
  867. ' class="btn btn-primary">' +
  868. ' <span id="recommendType"></span>推荐' +
  869. ' </button>' +
  870. ' <div style="height: calc(100% - 44px);border: 1px solid #DDDDDD;overflow-y: auto;margin-top: 5px;width: 100%;">' +
  871. ' <form class="form-horizontal form-label-left mz-fixed-form" novalidate autocomplete="off"' +
  872. ' style="height: 100%;overflow-y: auto;width: 100%;text-align: -webkit-center;position: relative;" id="recommendForm">' +
  873. ' <img src="/thmz/images/no-recommend.png" style="height: 120px;position: absolute;top: 50%;transform: translateY(-50%);margin-left: -30px;">' +
  874. ' </form>' +
  875. ' </div>' +
  876. ' </div>' +
  877. ' <div style="height: 53%;padding-left: 15px;width: 100%;">' +
  878. ' <button type="button"' +
  879. ' style="cursor: default;margin-bottom: 0px;margin-right: 0px;margin-top: 5px; font-size: 12px;"' +
  880. ' class="btn btn-primary">' +
  881. ' 医疗范本' +
  882. ' </button>' +
  883. ' <div class="item" style="width: 230px;height: 35px;float: right;line-height: 35px;margin-right: 40px;">' +
  884. ' <label class="control-label col-md-4 col-sm-4 col-xs-12" for="templateKindTypeForm">范文类型' +
  885. ' </label>' +
  886. ' <div class="col-md-8 col-sm-8 col-xs-12">' +
  887. ' <select class="form-control selectpicker show-tick" title="请选择" onchange="fitTemplateData()"' +
  888. ' id="templateKindTypeForm">' +
  889. ' </select>' +
  890. ' </div>' +
  891. ' </div>' +
  892. ' <div style="height: calc(100% - 44px);border: 1px solid #DDDDDD;overflow-y: auto;margin-top: 5px;width: 100%;position: relative;">' +
  893. ' <form class="form-horizontal form-label-left mz-fixed-form" novalidate autocomplete="off"' +
  894. ' style="height: 100%;overflow-y: auto;width: 100%;" id="TemplateData">' +
  895. ' </form>' +
  896. ' </div>' +
  897. ' </div>';
  898. $("#smartAssistPopoverContent").html(html);
  899. initTemplateKindTypeSelect('templateKindTypeForm');
  900. fitPatientHisData();
  901. fitSymptomData();
  902. fitEmrHpiData();
  903. fitEmrPsData();
  904. fitDiagnoseData();
  905. fitTemplateData();
  906. }, 100);
  907. // setTimeout(function () {
  908. // $("#patientHisDataForm").html("aadsasfasdfasdfasdfasdfsdfasdfasdfasdfdfafda");
  909. // },1000);
  910. }
  911. /**
  912. * 设置患者的就诊轨迹
  913. */
  914. function fitPatientHisData() {
  915. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  916. if (!$("#" + popoverId).hasClass("in")) {
  917. return;
  918. }
  919. var emptyHtml = '<img src="/thmz/images/locus.png" style="height: 120px;position: absolute;top: 50%;transform: translateY(-50%);margin-left: -30px;">';
  920. if (($("#patientId").text() == null || $("#patientId").text() == "") && ($("#userName").val() == null || $("#userName").val() == "")) {
  921. $("#patientHisDataForm").html(emptyHtml);
  922. return;
  923. }
  924. var patientId = $("#patientId").text();
  925. if (patientId == null || patientId == "") {
  926. patientId = $("#userName").val();
  927. }
  928. $.ajax({
  929. type: "POST",
  930. url: '/thmz/getClinicWithPage',
  931. contentType: "application/json;charset=UTF-8",
  932. dataType: "json",
  933. data: JSON.stringify({
  934. "patientId": patientId,
  935. //"clinicStatuses": [5, 6],
  936. "clinicStatuses": [6],
  937. "pageSize": 10000,
  938. "offset": 0,
  939. "beginDate": "2012-02-01 00:00:00",
  940. "endDate": format(new Date(), "yyyy-MM-dd HH:mm:ss"),
  941. "doctorCode": "-1"
  942. }),
  943. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  944. success: function (res) {
  945. if (res == '401' || res == 401) {
  946. window.location.href = '/thmz/login/view'
  947. return;
  948. }
  949. if (res.code == 0) {
  950. var html = '';
  951. var data = res.data;
  952. if (data == null || data.length == 0) {
  953. html += emptyHtml;
  954. } else {
  955. for (var i = 0; i < data.length; i++) {
  956. var icdText = data[i].icdText;
  957. if (icdText == null) {
  958. // continue;
  959. icdText = "空白诊断";
  960. }
  961. icdText = icdText.trim();
  962. html += ' <div class="item form-group thmz_alert" style="width: 100%;">';
  963. html += ' <div style="float: left;width: 172px;">';
  964. html += ' <img src="/thmz/css/bootstrap/bootstrap-icons-1.5.0/stopwatch.svg"';
  965. html += ' style="margin-left: 10px!important;vertical-align: -.15em;margin-right: 10px!important;"/>';
  966. html += ' <span style="width: 120px;margin-right: 20px!important;">' + format(data[i].opDay, "yyyy-MM-dd HH:mm") + '</span>';
  967. html += ' </div>';
  968. html += ' <div style="text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 172px);"';
  969. html += ' title="' + icdText + '">诊断:<a style="cursor: pointer; color: #2e69eb;"';
  970. html += ' onclick="visitingDetailModal(\'' + data[i].patientId + '\',' + data[i].times + ',' + data[i].id + ',' + data[i].clinicStatus + ')">' + icdText + '</a>';
  971. html += ' </div>';
  972. html += ' </div>';
  973. }
  974. }
  975. var patientName = $("#patientName").text();
  976. if ((patientName == null || patientName == "") && res.mzPatientMi != null) {
  977. patientName = res.mzPatientMi.name;
  978. }
  979. $("#patientHisData").text(patientName + "的");
  980. if (($("#patientId").text() == null || $("#patientId").text() == "") && ($("#userName").val() == null || $("#userName").val() == "")) {
  981. $("#patientHisDataForm").html(emptyHtml);
  982. } else {
  983. $("#patientHisDataForm").html(html);
  984. }
  985. } else {
  986. errorMesage(res);
  987. }
  988. }
  989. });
  990. }
  991. /**
  992. * 设置主诉推荐
  993. */
  994. function fitSymptomData() {
  995. fitRecommendData(12);
  996. }
  997. /**
  998. * 设置现病史推荐
  999. */
  1000. function fitEmrHpiData() {
  1001. fitRecommendData(5);
  1002. }
  1003. /**
  1004. * 设置既往史推荐
  1005. */
  1006. function fitEmrPsData() {
  1007. fitRecommendData(6);
  1008. }
  1009. /**
  1010. * 设置诊断推荐
  1011. */
  1012. function fitDiagnoseData() {
  1013. fitRecommendData(13);
  1014. }
  1015. /**
  1016. * 设置推荐通用方法
  1017. */
  1018. function fitRecommendData(paramsType) {
  1019. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  1020. if (!$("#" + popoverId).hasClass("in")) {
  1021. return;
  1022. }
  1023. var inputId = "symptom";
  1024. var text = "主诉";
  1025. if (paramsType == 5) {
  1026. inputId = "emrHpi";
  1027. text = "现病史";
  1028. } else if (paramsType == 6) {
  1029. inputId = "emrPs";
  1030. text = "既往史";
  1031. } else if (paramsType == 13) {
  1032. inputId = "diagnose";
  1033. text = "诊断";
  1034. }
  1035. //光标不在现病史上
  1036. if (document.activeElement.id != inputId) {
  1037. return;
  1038. }
  1039. $("#recommendType").html(text);
  1040. var emptyHtml = '<img src="/thmz/images/no-recommend.png" style="height: 120px;position: absolute;top: 50%;transform: translateY(-50%);margin-left: -30px;">';
  1041. $.ajax({
  1042. type: "GET",
  1043. url: '/thmz/getTCommonParamsByParamsType?paramsType=' + paramsType + '&commonParams=&pageSize=10',
  1044. contentType: "application/json;charset=UTF-8",
  1045. dataType: "json",
  1046. async: false,
  1047. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1048. success: function (res) {
  1049. if (res == '401' || res == 401) {
  1050. window.location.href = '/thmz/login/view'
  1051. return;
  1052. }
  1053. if (res.code == 0) {
  1054. var html = '';
  1055. var data = res.data;
  1056. if (data == null || data.length == 0) {
  1057. html += emptyHtml;
  1058. } else {
  1059. for (var i = 0; i < data.length; i++) {
  1060. var paramsContent = data[i].paramsContent;
  1061. html += ' <div class="item form-group thmz_alert" style="width: 100%;">';
  1062. html += ' <div style="margin-left: 10px;float: left;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 60px);" title="' + paramsContent + '">';
  1063. html += paramsContent;
  1064. html += ' </div>';
  1065. html += ' <div style="float: left;width: 36px;cursor: pointer;"';
  1066. html += ' onclick="fitAppeal(\'' + paramsContent + '\',' + paramsType + ',' + data[i].id + ')">';
  1067. html += ' <img';
  1068. html += ' src="/thmz/css/bootstrap/bootstrap-icons-1.5.0/cursor-fill.svg"';
  1069. html += ' style="margin-left: 10px!important;vertical-align: -.15em;margin-right: 10px!important;"/>';
  1070. html += ' </div>';
  1071. html += ' </div>';
  1072. }
  1073. }
  1074. $("#recommendForm").html(html);
  1075. } else {
  1076. errorMesage(res);
  1077. }
  1078. }
  1079. });
  1080. }
  1081. /**
  1082. * 设置医疗范文方法
  1083. */
  1084. function fitTemplateData() {
  1085. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  1086. if (!$("#" + popoverId).hasClass("in")) {
  1087. return;
  1088. }
  1089. 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;">';
  1090. $.ajax({
  1091. type: "GET",
  1092. url: '/thmz/getTemplate?templateKindType=' + $("#templateKindTypeForm").val(),
  1093. contentType: "application/json;charset=UTF-8",
  1094. dataType: "json",
  1095. async: false,
  1096. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1097. success: function (res) {
  1098. if (res == '401' || res == 401) {
  1099. window.location.href = '/thmz/login/view'
  1100. return;
  1101. }
  1102. if (res.code == 0) {
  1103. var html = '';
  1104. var data = res.data;
  1105. if (data == null || data.length == 0) {
  1106. html += emptyHtml;
  1107. } else {
  1108. for (var i = 0; i < data.length; i++) {
  1109. var template = data[i];
  1110. var icdText = (template.icdText == null || template.icdText == "") ? "无" : template.icdText;
  1111. html += ' <div class="item form-group thmz_alert" style="width: 100%;">';
  1112. html += ' <div title="' + template.name + '"';
  1113. html += ' style="margin-left: 10px!important;float: left;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: 100px;">';
  1114. html += template.name;
  1115. html += ' </div>';
  1116. html += ' <div style="float: left;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 160px);"';
  1117. html += ' title="' + template.icdText + '">诊断:<a';
  1118. html += ' style="cursor: pointer; color: #2e69eb;"';
  1119. html += ' onclick="medicalModelModal(' + template.id + ')">' + icdText + '</a>';
  1120. html += ' </div>';
  1121. html += ' <div style="float: left;width: 36px;cursor: pointer;" onclick="medicalModelModal(' + template.id + ')"><img';
  1122. html += ' src="/thmz/css/bootstrap/bootstrap-icons-1.5.0/cursor-fill.svg"';
  1123. html += ' style="margin-left: 10px!important;vertical-align: -.15em;margin-right: 10px!important;"/>';
  1124. html += ' </div>';
  1125. html += ' </div>';
  1126. }
  1127. }
  1128. $("#TemplateData").html(html);
  1129. } else {
  1130. errorMesage(res);
  1131. }
  1132. }
  1133. });
  1134. }
  1135. /**
  1136. * 清空快速接诊弹窗
  1137. */
  1138. function clearRapidAcceptsModal() {
  1139. $("#rapidAcceptsUserName").val(null);
  1140. $("#rapidAcceptsUserCode").val(null);
  1141. $("#patientIdDb").val(null);
  1142. $("#rapidAcceptsUserCardNo").val(null);
  1143. $("#rapidAcceptsUserGender").selectpicker('val', 0);
  1144. $("#rapidAcceptsUserGender").selectpicker('refresh');
  1145. $("#rapidAcceptsUserPhoneNum").val(null);
  1146. $('#rapidAcceptsUserCertificateType').selectpicker('val', '01');
  1147. $('#rapidAcceptsUserCertificateType').selectpicker('refresh');
  1148. $("#rapidAcceptsUserIdCard").val(null);
  1149. $("#rapidAcceptsUserIdCard").attr("title", null);
  1150. $("#rapidAcceptsUserPhoneNum").attr("title", null);
  1151. $("#rapidAcceptsUserAddress").attr("title", null);
  1152. $("#rapidAcceptsUserAddress").val(null);
  1153. $("#rapidAcceptsUserContact").val(null);
  1154. $("#rapidAcceptsUserContactPhone").val(null);
  1155. }
  1156. /**
  1157. * 清空接诊台用户信息
  1158. * @param flag 是否清空分诊流水哈 true 清空
  1159. */
  1160. function clearUser(flag) {
  1161. $("#patientName").html("");
  1162. $("#patientAge").html("");
  1163. $("#patientGender").html("");
  1164. $("#patientId").text(null);
  1165. $("#editUser").css("display", "none");
  1166. $("#clearUser").css("display", "none");
  1167. $("#fetchSpcSlwinfo").css("display", "none");
  1168. $("#patientPhone").html("");
  1169. $("#patientPhoneLabel").hide();
  1170. $("#patientResponseType").html("");
  1171. $("#first").next().click();
  1172. $("#patientHisData").text("");
  1173. if (flag) {
  1174. $("#transferTreatment").css("display", "none");
  1175. $("#consultation").css("display", "none");
  1176. $("#mzfzSerialNoInClick").val(null);
  1177. $("#mzfzReqTypeNoInClick").val(null);
  1178. $("#turnToConsultationIdInClick").val(null);
  1179. }
  1180. }
  1181. /**
  1182. * 卡号输入改变事件
  1183. */
  1184. function cardNoChange() {
  1185. if (window.ActiveXObject || "ActiveXObject" in window) {
  1186. $("#rapidAcceptsUserCardNo").on('input propertychange', function () {
  1187. queryUserInfoByCardNo();
  1188. });
  1189. } else {
  1190. $("#rapidAcceptsUserCardNo").on('input οninput', function () {
  1191. queryUserInfoByCardNo();
  1192. });
  1193. }
  1194. }
  1195. /**
  1196. * 刷新就诊列表
  1197. */
  1198. function refreshClinic() {
  1199. loadInClinicTableList();
  1200. loadClinicTableList();
  1201. }
  1202. /**
  1203. * 加载已接诊患者列表
  1204. */
  1205. function loadClinicTableList() {
  1206. //loadCommonClinicTableList("tb_table_clinic","/thmz/getClinicWithPage");
  1207. loadCommonClinicTableList("tb_table_clinic", queryParamsClinic);
  1208. }
  1209. /**
  1210. * 加载患者列表通用方法
  1211. * @param id
  1212. * @param queryParams
  1213. */
  1214. function loadCommonClinicTableList(id, queryParams) {
  1215. $('#' + id).bootstrapTable('refresh');
  1216. $('#' + id).bootstrapTable({
  1217. url: "/thmz/getClinicWithPage", //请求后台的URL(*)
  1218. method: 'post', //请求方式(*)
  1219. toolbar: '#toolbar', //工具按钮用哪个容器
  1220. striped: true, //是否显示行间隔色
  1221. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  1222. pagination: true, //是否显示分页(*)
  1223. sortable: true, //是否启用排序
  1224. sortOrder: "asc", //排序方式
  1225. queryParams: queryParams, //传递参数(*)
  1226. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  1227. pageNumber: 1, //初始化加载第一页,默认第一页
  1228. pageSize: 5, //每页的记录行数(*)
  1229. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  1230. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  1231. strictSearch: true,
  1232. showColumns: false, //是否显示所有的列
  1233. showRefresh: false, //是否显示刷新按钮
  1234. minimumCountColumns: 2, //最少允许的列数
  1235. clickToSelect: true, //是否启用点击选中行
  1236. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  1237. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  1238. cardView: false, //是否显示详细视图
  1239. detailView: false,
  1240. //rowStyle:rowStyle,//通过自定义函数设置行样式
  1241. ajaxOptions: {
  1242. headers: {
  1243. 'Accept': 'application/json',
  1244. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  1245. }
  1246. },
  1247. columns: [
  1248. {
  1249. field: 'patientName',
  1250. title: '姓名/性别/年龄',
  1251. align: "center",
  1252. valign: 'middle',
  1253. // sortable: true
  1254. formatter: function (value, row, index) {
  1255. var age = row.age;
  1256. if (age == null || age == "null") {
  1257. age = "";
  1258. }
  1259. return value + "/" + row.gender + "/" + age + "岁";
  1260. }
  1261. }, {
  1262. field: 'opDay',
  1263. title: '接诊时间',
  1264. align: "center",
  1265. valign: 'middle',
  1266. // sortable: true
  1267. formatter: function (value, row, index) {
  1268. return format(value, "MM/dd HH:mm");
  1269. }
  1270. }
  1271. , {
  1272. title: '操作',
  1273. align: "center",
  1274. valign: 'middle',
  1275. // sortable: true,
  1276. formatter: function (value, row, index) {
  1277. if (row.clinicStatus == 5) {
  1278. 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>';
  1279. // 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>';
  1280. } else if (row.clinicStatus == 6) {
  1281. 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>';
  1282. } else if (row.clinicStatus == 7) {
  1283. 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>';
  1284. }
  1285. }
  1286. }
  1287. ],
  1288. responseHandler: function (res) {
  1289. if (res == '401' || res == 401) {
  1290. window.location.href = '/thmz/login/view'
  1291. return;
  1292. }
  1293. var ress = eval(res);
  1294. if (ress.code == -1) {
  1295. new PNotify({
  1296. title: '错误提示',
  1297. text: ress.message,
  1298. type: 'error',
  1299. hide: false,
  1300. styling: 'bootstrap3'
  1301. });
  1302. return {
  1303. "total": 0,//总页数
  1304. "rows": {} //数据
  1305. };
  1306. }
  1307. return {
  1308. "total": ress.total,//总页数
  1309. "rows": ress.data //数据
  1310. };
  1311. },
  1312. onLoadSuccess: function (data) {
  1313. $(".pagination-detail").css("display", "none");
  1314. if (id == "tb_table_clinic") {
  1315. $("#ClinicNum").html(data.total);
  1316. } else {
  1317. $("#inClinicNum").html(data.total);
  1318. }
  1319. }
  1320. });
  1321. }
  1322. /**
  1323. * 得到查询的参数 接诊中
  1324. * @param params
  1325. * @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}}
  1326. */
  1327. function queryParamsInClinic(params) {
  1328. var temp = {
  1329. pageSize: params.limit,
  1330. pageIndex: params.offset / params.limit, //页码
  1331. statusFlagList: [8]
  1332. };
  1333. return temp;
  1334. };
  1335. /**
  1336. * 得到查询的参数
  1337. * @param params
  1338. * @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}}
  1339. */
  1340. function queryParamsClinic(params) {
  1341. var rePortRangeArr = getRePortRangeArr();
  1342. var commonParams = $("#userName").val();
  1343. var needDateParams = commonParams == null || commonParams == "null" || commonParams == "";
  1344. var temp = {
  1345. beginDate: needDateParams ? rePortRangeArr[0] : "2012-02-01 00:00:00",
  1346. endDate: needDateParams ? rePortRangeArr[1] : format(new Date(), "yyyy-MM-dd HH:mm:ss"),
  1347. commonParams: commonParams,
  1348. clinicStatuses: [5, 6, 7],
  1349. pageSize: params.limit,
  1350. offset: params.offset
  1351. };
  1352. return temp;
  1353. };
  1354. /**
  1355. * 加载待诊患者列表方法
  1356. */
  1357. function loadUnClinicTableList() {
  1358. loadCanClinicTableList("tb_table_un_clinic", queryParamsUnClinic);
  1359. }
  1360. /**
  1361. * 加载接诊中患者列表方法
  1362. */
  1363. function loadInClinicTableList() {
  1364. loadCanClinicTableList("tb_table_in_clinic", queryParamsInClinic);
  1365. }
  1366. /**
  1367. * 加载待诊和接诊中患者列表通用方法方法
  1368. */
  1369. function loadCanClinicTableList(id, queryParams) {
  1370. $('#' + id).bootstrapTable('refresh');
  1371. $('#' + id).bootstrapTable({
  1372. url: "/thmz/getUnClinicWithPage", //请求后台的URL(*)
  1373. method: 'post', //请求方式(*)
  1374. toolbar: '#toolbar', //工具按钮用哪个容器
  1375. striped: true, //是否显示行间隔色
  1376. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  1377. pagination: true, //是否显示分页(*)
  1378. sortable: true, //是否启用排序
  1379. sortOrder: "asc", //排序方式
  1380. queryParams: queryParams, //传递参数(*)
  1381. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  1382. pageNumber: 1, //初始化加载第一页,默认第一页
  1383. pageSize: 5, //每页的记录行数(*)
  1384. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  1385. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  1386. strictSearch: true,
  1387. showColumns: false, //是否显示所有的列
  1388. showRefresh: false, //是否显示刷新按钮
  1389. minimumCountColumns: 2, //最少允许的列数
  1390. clickToSelect: true, //是否启用点击选中行
  1391. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  1392. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  1393. cardView: false, //是否显示详细视图
  1394. detailView: false,
  1395. //rowStyle:rowStyle,//通过自定义函数设置行样式
  1396. ajaxOptions: {
  1397. headers: {
  1398. 'Accept': 'application/json',
  1399. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  1400. }
  1401. },
  1402. columns: [
  1403. {
  1404. field: 'name',
  1405. title: '姓名/性别/年龄',
  1406. align: "center",
  1407. valign: 'middle',
  1408. // sortable: true
  1409. formatter: function (value, row, index) {
  1410. return value + "/" + row.gender + "/" + row.age + "岁";
  1411. }
  1412. }, {
  1413. field: 'visitDate',
  1414. title: '分诊时间',
  1415. align: "center",
  1416. valign: 'middle',
  1417. // sortable: true
  1418. formatter: function (value, row, index) {
  1419. return format(value, "MM/dd HH:mm");
  1420. }
  1421. }
  1422. , {
  1423. title: '操作',
  1424. align: "center",
  1425. valign: 'middle',
  1426. // sortable: true,
  1427. formatter: function (value, row, index) {
  1428. if (row.statusFlag == 0) {
  1429. return '<a title="接诊" onclick="clinicalReception(\'' + row.patientId + '\',\'' + row.serialNo + '\',' + row.reqType + ')" style="cursor: pointer">接诊</a>';
  1430. } else if (row.statusFlag == 8) {
  1431. //TODO 继续接诊需要新方法
  1432. return '<a title="继续接诊" onclick="clinicalReception(\'' + row.patientId + '\',\'' + row.serialNo + '\',' + row.reqType + ')" style="cursor: pointer">续诊</a> <a title="取消接诊" onclick="cancelClinic(\'' + row.patientId + '\',\'' + row.times + '\')" style="cursor: pointer">消诊</a>';
  1433. } else if (row.statusFlag == 1 || row.statusFlag == 2 || row.statusFlag == 3) {
  1434. return '<a title="通知" onclick="clinicCallNumber(\'' + row.serialNo + '\')" style="cursor: pointer">通知</a>&nbsp;<a title="接诊" onclick="clinicalReception(\'' + row.patientId + '\',\'' + row.serialNo + '\',' + row.reqType + ')" style="cursor: pointer">接诊</a>';
  1435. }
  1436. }
  1437. }
  1438. ],
  1439. responseHandler: function (res) {
  1440. if (res == '401' || res == 401) {
  1441. window.location.href = '/thmz/login/view'
  1442. return;
  1443. }
  1444. var ress = eval(res);
  1445. if (ress.code == -1) {
  1446. new PNotify({
  1447. title: '错误提示',
  1448. text: ress.message,
  1449. type: 'error',
  1450. hide: false,
  1451. styling: 'bootstrap3'
  1452. });
  1453. return {
  1454. "total": 0,//总页数
  1455. "rows": {} //数据
  1456. };
  1457. }
  1458. return {
  1459. "total": ress.total,//总页数
  1460. "rows": ress.data //数据
  1461. };
  1462. },
  1463. onLoadSuccess: function (data) {
  1464. $(".pagination-detail").css("display", "none");
  1465. $("#unClinicNum").html(data.total);
  1466. }
  1467. });
  1468. }
  1469. /**
  1470. * 得到查询的参数
  1471. * @param params
  1472. * @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}}
  1473. */
  1474. function queryParamsUnClinic(params) {
  1475. var temp = {
  1476. pageSize: params.limit,
  1477. pageIndex: params.offset / params.limit, //页码
  1478. statusFlagList: [0, 1, 2, 3]
  1479. };
  1480. return temp;
  1481. };
  1482. /**
  1483. * 通知叫号
  1484. * @param serialNo
  1485. */
  1486. function clinicCallNumber(serialNo) {
  1487. $.ajax({
  1488. type: "GET",
  1489. url: '/thmz/clinicCallNumber?serialNo=' + serialNo,
  1490. contentType: "application/json;charset=UTF-8",
  1491. dataType: "json",
  1492. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1493. success: function (res) {
  1494. if (res == '401' || res == 401) {
  1495. window.location.href = '/thmz/login/view'
  1496. return;
  1497. }
  1498. if (res.code == 0) {
  1499. successMesage(res);
  1500. } else {
  1501. errorMesage(res);
  1502. }
  1503. }
  1504. });
  1505. }
  1506. /**
  1507. * 接诊方法
  1508. * @param patientId 门诊id
  1509. * @param serialNo 分诊流水号
  1510. * @param reqType 号表类别
  1511. */
  1512. function clinicalReception(patientId, serialNo, reqType) {
  1513. var existPatientId = $("#patientId").text();
  1514. if (existPatientId != null && existPatientId != "" && existPatientId != patientId) {
  1515. $("#messageModal").modal();
  1516. $("#messageContent").html("当前有病人正在接诊,是否切换?");
  1517. $("#messageButton").off("click").on("click", function (t) {
  1518. $("#messageModal").modal("hide");
  1519. //当前有人在接诊,提示是否需要切换和保存
  1520. $("#messagePrescriptionModal").modal();
  1521. $("#confirmPrescriptionButton").off("click").on("click", function (t) {
  1522. $("#messagePrescriptionModal").modal("hide");
  1523. //先保存目前接诊信息,再切换就诊人
  1524. var jsonData = getParamsForpPrescription(1);
  1525. $.ajax({
  1526. type: "POST",
  1527. url: '/thmz/savePrescription',
  1528. contentType: "application/json;charset=UTF-8",
  1529. dataType: "json",
  1530. data: JSON.stringify(jsonData),
  1531. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1532. success: function (res) {
  1533. if (res == '401' || res == 401) {
  1534. window.location.href = '/thmz/login/view'
  1535. return;
  1536. }
  1537. if (res.code == 0) {
  1538. clearWorkSpace();
  1539. realClinicalReception(patientId, serialNo, reqType);
  1540. //加载已接诊患者列表
  1541. loadClinicTableList();
  1542. } else {
  1543. errorMesage(res);
  1544. }
  1545. }
  1546. });
  1547. });
  1548. $("#cancelPrescriptionButton").off("click").on("click", function (t) {
  1549. $("#messagePrescriptionModal").modal("hide");
  1550. clearWorkSpace();
  1551. realClinicalReception(patientId, serialNo, reqType);
  1552. });
  1553. });
  1554. $("#cancelButton").off("click");
  1555. } else {
  1556. realClinicalReception(patientId, serialNo, reqType);
  1557. }
  1558. }
  1559. /**
  1560. * 取消接诊
  1561. * @param patientId
  1562. */
  1563. function cancelClinic(patientId, times) {
  1564. $("#messageModal").modal();
  1565. $("#messageContent").html("确认取消当前病人的接诊记录吗?");
  1566. $("#messageButton").off("click").on("click", function (t) {
  1567. $("#messageModal").modal("hide");
  1568. $.ajax({
  1569. type: "GET",
  1570. url: '/thmz/cancelClinic?patientId=' + patientId + "&times=" + times,
  1571. contentType: "application/json;charset=UTF-8",
  1572. dataType: "json",
  1573. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1574. success: function (res) {
  1575. if (res == '401' || res == 401) {
  1576. window.location.href = '/thmz/login/view'
  1577. return;
  1578. }
  1579. if (res.code == 0) {
  1580. if (res.data == null || res.data.length == 0) {
  1581. return;
  1582. }
  1583. successMesage(res);
  1584. if (times > 0) {
  1585. loadUnClinicTableList();
  1586. loadInClinicTableList();
  1587. clearWorkSpace();
  1588. }
  1589. } else if (res.code == -1) {
  1590. errorMesage(res);
  1591. }
  1592. }
  1593. });
  1594. });
  1595. $("#cancelButton").off("click");
  1596. };
  1597. /**
  1598. * 设置当前接诊病人信息
  1599. * @param mzPatientMi
  1600. */
  1601. function setMzPatientInfo(mzPatientMi) {
  1602. $("#patientName").html(mzPatientMi.name);
  1603. $("#patientAge").html(mzPatientMi.age);
  1604. $("#patientGender").html(mzPatientMi.gender);
  1605. $("#patientId").text(mzPatientMi.patientId);
  1606. $("#editUser").css("display", "inline-block");
  1607. $("#clearUser").css("display", "inline-block");
  1608. if (mzPatientMi.phoneNo != null && mzPatientMi.phoneNo != '') {
  1609. $("#patientPhone").html(mzPatientMi.phoneNo);
  1610. $("#patientPhoneLabel").show();
  1611. } else {
  1612. $("#patientPhoneLabel").hide();
  1613. }
  1614. $("#patientResponseType").html(mzPatientMi.responseTypeName);
  1615. if (mzPatientMi.times == 1) {
  1616. $("#first").next().click();
  1617. } else {
  1618. $("#not").next().click();
  1619. }
  1620. $("#patientHisData").text(mzPatientMi.name);
  1621. fitPatientHisData();
  1622. setTmResponseType(mzPatientMi.patientId);
  1623. }
  1624. /**
  1625. * 判断是否是特门病人
  1626. * @param patientId
  1627. */
  1628. function setTmResponseType(patientId) {
  1629. $.ajax({
  1630. type: "GET",
  1631. url: '/thmz/fetchSpcSlwinfo?patientId=' + patientId,
  1632. contentType: "application/json;charset=UTF-8",
  1633. dataType: "json",
  1634. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1635. success: function (res) {
  1636. if (res == '401' || res == 401) {
  1637. window.location.href = '/thmz/login/view'
  1638. return;
  1639. }
  1640. if (res.code == 0) {
  1641. if (res.data != null && res.data.length > 0) {
  1642. $("#patientResponseType").html("特殊门诊");
  1643. $("#fetchSpcSlwinfo").css("display", "inline-block");
  1644. }
  1645. }
  1646. }
  1647. });
  1648. }
  1649. /**
  1650. * 特门详情
  1651. * @param patientId
  1652. */
  1653. function fetchSpcSlwinfo() {
  1654. var patientId = $("#patientId").text();
  1655. $.ajax({
  1656. type: "GET",
  1657. url: '/thmz/fetchSpcSlwinfo?patientId=' + patientId,
  1658. contentType: "application/json;charset=UTF-8",
  1659. dataType: "json",
  1660. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1661. success: function (res) {
  1662. if (res == '401' || res == 401) {
  1663. window.location.href = '/thmz/login/view'
  1664. return;
  1665. }
  1666. if (res.code == 0) {
  1667. if (res.data != null && res.data.length > 0) {
  1668. $("#fetchSpcSlwinfoModal").modal();
  1669. $("#fetchSpcSlwinfoTable").html(null);
  1670. for (var i = 0; i < res.data.length; i++) {
  1671. var begndate = res.data[i].begndate;
  1672. if (begndate == null || begndate == "null") {
  1673. begndate = "";
  1674. }
  1675. var enddate = res.data[i].enddate;
  1676. if (enddate == null || enddate == "null") {
  1677. enddate = "";
  1678. }
  1679. var opspDiseName = res.data[i].opspDiseName;
  1680. if (opspDiseName == null || opspDiseName == "null") {
  1681. opspDiseName = "";
  1682. }
  1683. var opspDiseCode = res.data[i].opspDiseCode;
  1684. if (opspDiseCode == null || opspDiseCode == "null") {
  1685. opspDiseCode = "";
  1686. }
  1687. var ideFixmedinsName = res.data[i].ideFixmedinsName;
  1688. if (ideFixmedinsName == null || ideFixmedinsName == "null") {
  1689. ideFixmedinsName = "";
  1690. }
  1691. $("<tr><td>" + begndate + "</td><td>" + enddate + "</td><td>" + opspDiseCode + "</td><td>" + opspDiseName + "</td><td>" + ideFixmedinsName + "</td></tr>").appendTo("#fetchSpcSlwinfoTable");
  1692. // .bind('click', function () {
  1693. // $("#fetchSpcSlwinfoModal").modal("hide");
  1694. // clinicalReception(patientIdDb, $(this).attr("data-target"));
  1695. // });
  1696. }
  1697. } else {
  1698. errorMesage(res);
  1699. }
  1700. } else {
  1701. errorMesage(res);
  1702. }
  1703. }
  1704. });
  1705. }
  1706. /**
  1707. * 真实的接诊方法
  1708. * @param patientId
  1709. * @param serialNo 分诊流水号
  1710. * @param reqType 号表类别
  1711. */
  1712. function realClinicalReception(patientId, serialNo, reqType) {
  1713. var turnToConsultationIdInClick = $("#turnToConsultationIdInClick").val();
  1714. if (turnToConsultationIdInClick == null || turnToConsultationIdInClick == "null") {
  1715. turnToConsultationIdInClick = 0;
  1716. }
  1717. $.ajax({
  1718. type: "GET",
  1719. url: '/thmz/saveClinic?patientId=' + patientId + "&serialNo=" + serialNo + "&turnToConsultationId=" + turnToConsultationIdInClick,
  1720. contentType: "application/json;charset=UTF-8",
  1721. dataType: "json",
  1722. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1723. success: function (res) {
  1724. if (res == '401' || res == 401) {
  1725. window.location.href = '/thmz/login/view'
  1726. return;
  1727. }
  1728. if (res.code == 0) {
  1729. if (res.data != null) {
  1730. var mzPatientMi = res.data;
  1731. setMzPatientInfo(mzPatientMi);
  1732. $("#mzfzSerialNoInClick").val(serialNo);
  1733. $("#mzfzReqTypeNoInClick").val(reqType);
  1734. //有分诊流水号且不是简易门诊和会诊目标科室接诊
  1735. if (serialNo != null && serialNo != "null") {
  1736. if (!(reqType == 10 || reqType == "10" || reqType == "16" || reqType == 16 || reqType == -200)) {
  1737. $("#transferTreatment").css("display", "inline-block");
  1738. }
  1739. $("#consultation").css("display", "inline-block");
  1740. }
  1741. //加载候诊患者列表
  1742. loadUnClinicTableList();
  1743. //加载接诊中患者列表
  1744. loadInClinicTableList();
  1745. }
  1746. } else {
  1747. errorMesage(res);
  1748. }
  1749. }
  1750. });
  1751. }
  1752. /**
  1753. * 清空工作台
  1754. */
  1755. function clearWorkSpace() {
  1756. clearUser(true);
  1757. clearWorkSpaceExcludeUser(1);
  1758. }
  1759. /**
  1760. * 清空工作台除了用户信息
  1761. * @param source 1 清空工作台 2 调用模板 3 调用历史处方
  1762. */
  1763. function clearWorkSpaceExcludeUser(source) {
  1764. var conciseRecordsFlag = false;
  1765. if (source == 2) {
  1766. conciseRecordsFlag = $("#conciseRecordsYlfw").prop("checked");
  1767. } else if (source == 3) {
  1768. conciseRecordsFlag = $("#conciseRecordsJzxq").prop("checked");
  1769. }
  1770. if (source == 1 || conciseRecordsFlag) {
  1771. $("#symptom").val(null);
  1772. $("#emrHpi").val(null);
  1773. $("#emrPs").val(null);
  1774. $("#personalHistory").val(null);
  1775. $("#familyHistory").val(null);
  1776. $("#obstericalHistory").val(null);
  1777. $("#weight").val(null);
  1778. $("#temperature").val(null);
  1779. $("#sphygmus").val(null);
  1780. $("#breathe").val(null);
  1781. $("#pressure_high").val(null);
  1782. $("#pressure_floor").val(null);
  1783. $("#pressure_high_left").val(null);
  1784. $("#pressure_floor_left").val(null);
  1785. $("#tentativeDiagnosis").val(null);
  1786. $("#otherCheck").val(null);
  1787. $("#diagnoseValue").val(null);
  1788. $("#diagnoseTags").html(null);
  1789. $("#healthEducation").val(null);
  1790. }
  1791. if (source == 1) {
  1792. clearWesternMedicine(true);
  1793. clearChineseMedicine();
  1794. clearJyJcItem();
  1795. clearZyReq();
  1796. //initNavTabs(0);
  1797. clearNavTabs(0);
  1798. clearNavTabs(1);
  1799. clearNavTabs(2);
  1800. clearNavTabs(3);
  1801. clearNavTabs(4);
  1802. }
  1803. clearApidAcceptsModal();
  1804. clearTurnToConsultationInput();
  1805. $("#totalAmount").text(0);
  1806. }
  1807. /**
  1808. * 构造西药处方详情和模板预览方法
  1809. * @param pyPrescription
  1810. * @param contentId 内容ID
  1811. * @param titleId 标题ID
  1812. * @param checkBox 是否需要增加ckeckBox
  1813. */
  1814. function fitxyContent(pyPrescription, contentId, titleId, checkBox) {
  1815. if (pyPrescription != null && pyPrescription.length > 0) {
  1816. var xypyHtml = "";
  1817. for (var i = 0; i < pyPrescription.length; i++) {
  1818. var py = pyPrescription[i];
  1819. if (py == null || py.length == 0) {
  1820. continue;
  1821. }
  1822. var detail = py.detail;
  1823. if (detail == null || detail.length == 0) {
  1824. continue;
  1825. }
  1826. for (var j = 0; j < detail.length; j++) {
  1827. var pyDetail = detail[j];
  1828. if (checkBox) {
  1829. xypyHtml += "<div style='cursor: pointer;' data-id='" + pyDetail.orderCode + "'>";
  1830. xypyHtml += "<input type='checkbox'/>";
  1831. xypyHtml += "<span onclick='rowDataClick(this)'>";
  1832. } else {
  1833. xypyHtml += "<div>";
  1834. }
  1835. xypyHtml += "<span style='color: red;'>" + pyDetail.groupOrder + "." + "</span>";
  1836. xypyHtml += pyDetail.name;
  1837. xypyHtml += " ";
  1838. xypyHtml += pyDetail.specification;
  1839. xypyHtml += " X ";
  1840. xypyHtml += pyDetail.quantity;
  1841. xypyHtml += pyDetail.packUnit;
  1842. xypyHtml += " 用法: ";
  1843. xypyHtml += pyDetail.supplyName;
  1844. xypyHtml += " ";
  1845. xypyHtml += pyDetail.drugQuan;
  1846. xypyHtml += pyDetail.unitDesc;
  1847. xypyHtml += " ";
  1848. xypyHtml += pyDetail.frequency;
  1849. xypyHtml += " ";
  1850. xypyHtml += pyDetail.orderDays;
  1851. xypyHtml += "天 ";
  1852. if (pyDetail.tryFlag != undefined && pyDetail.tryFlag != null && pyDetail.tryFlag != "null" && pyDetail.tryFlag != "") {
  1853. xypyHtml += pyDetail.tryFlag;
  1854. }else if (pyDetail.tryResult != undefined && pyDetail.tryResult != null && pyDetail.tryResult != "null" && pyDetail.tryResult != "") {
  1855. xypyHtml += pyDetail.tryResult;
  1856. }
  1857. if (checkBox) {
  1858. xypyHtml += "</span>";
  1859. }
  1860. xypyHtml += "</div>";
  1861. }
  1862. }
  1863. afterFitContent(contentId, xypyHtml, titleId);
  1864. } else {
  1865. $("#" + titleId).removeClass("in").addClass("hide");
  1866. $("#" + contentId).html("");
  1867. }
  1868. }
  1869. /**
  1870. * 构造中药处方详情和模板预览方法
  1871. * @param zyPrescription
  1872. * @param contentId 内容ID
  1873. * @param titleId 标题ID
  1874. * @param checkBox 是否需要增加ckeckBox
  1875. */
  1876. function fitzyContent(zyPrescription, contentId, titleId, checkBox) {
  1877. if (zyPrescription == null || zyPrescription.length == 0) {
  1878. $("#" + titleId).removeClass("in").addClass("hide");
  1879. $("#" + contentId).html("");
  1880. return;
  1881. }
  1882. var zyDetail = zyPrescription[0];
  1883. if (zyDetail == null || zyDetail.length == 0) {
  1884. $("#" + titleId).removeClass("in").addClass("hide");
  1885. $("#" + contentId).html("");
  1886. return;
  1887. }
  1888. var detail = zyDetail.detail;
  1889. if (detail == null || detail.length == 0) {
  1890. $("#" + titleId).removeClass("in").addClass("hide");
  1891. $("#" + contentId).html("");
  1892. return;
  1893. }
  1894. var zypyHtml = "";
  1895. for (var i = 0; i < detail.length; i++) {
  1896. //zypyHtml += '<div class="item form-group" style="margin-bottom: -5px;">';
  1897. var zy = detail[i];
  1898. if (zy == null || zy.length == 0) {
  1899. continue;
  1900. }
  1901. if (checkBox) {
  1902. zypyHtml += "<div class=\"col-md-3 col-sm-3 col-xs-12\" style='cursor: pointer;' data-id='" + zy.orderCode + "'>";
  1903. zypyHtml += "<input type='checkbox'/>";
  1904. zypyHtml += "<span onclick='rowDataClick(this)'>";
  1905. } else {
  1906. zypyHtml += "<div class=\"col-md-3 col-sm-3 col-xs-12\">";
  1907. }
  1908. zypyHtml += zy.name;
  1909. var instructionText = zy.instructionText;
  1910. if (instructionText != null && instructionText != "") {
  1911. zypyHtml += "[";
  1912. zypyHtml += instructionText;
  1913. zypyHtml += "]";
  1914. }
  1915. zypyHtml += zy.quantity;
  1916. zypyHtml += "g";
  1917. if (checkBox) {
  1918. zypyHtml += "</span>";
  1919. }
  1920. zypyHtml += "</div>";
  1921. // if (i % 4 == 0) {
  1922. // zypyHtml += '</div>';
  1923. // }
  1924. }
  1925. // if(detail.length%4!=0){
  1926. // for(var i=0;i<4-(detail.length%4);i++){
  1927. // zypyHtml += "<div class=\"col-md-3 col-sm-3 col-xs-12\"></div>";
  1928. // }
  1929. // }
  1930. var zyfs = zyDetail.zyfs;
  1931. if (zyfs != null && zyfs != "") {
  1932. zypyHtml += " <div class=\"col-md-12 col-sm-12 col-xs-12\">";
  1933. zypyHtml += ' <div style="text-indent: 2em;">';
  1934. zypyHtml += ' <div>';
  1935. zypyHtml += 'x<span>';
  1936. zypyHtml += zyfs;
  1937. zypyHtml += '</span> 付</div>';
  1938. }
  1939. afterFitContent(contentId, zypyHtml, titleId);
  1940. }
  1941. /**
  1942. * 构造辅助检查、检验处方详情和模板预览方法
  1943. * @param jcjyPrescription
  1944. * @param contentId 内容ID
  1945. * @param titleId 标题ID
  1946. * @param checkBox 是否需要增加ckeckBox
  1947. */
  1948. function fitJcjyContent(jcjyPrescription, contentId, titleId, checkBox) {
  1949. if (jcjyPrescription == null || jcjyPrescription.length == 0) {
  1950. $("#" + titleId).removeClass("in").addClass("hide");
  1951. $("#" + contentId).html("");
  1952. return;
  1953. }
  1954. var jcjyDetail = jcjyPrescription[0];
  1955. if (jcjyDetail == null || jcjyDetail.length == 0) {
  1956. $("#" + titleId).removeClass("in").addClass("hide");
  1957. $("#" + contentId).html("");
  1958. return;
  1959. }
  1960. var detail = jcjyDetail.detail;
  1961. if (detail == null || detail.length == 0) {
  1962. $("#" + titleId).removeClass("in").addClass("hide");
  1963. $("#" + contentId).html("");
  1964. return;
  1965. }
  1966. var jcjyHtml = "";
  1967. for (var i = 0; i < detail.length; i++) {
  1968. var jcjy = detail[i];
  1969. if (jcjy == null || jcjy.length == 0) {
  1970. continue;
  1971. }
  1972. if (checkBox) {
  1973. jcjyHtml += "<div style='cursor: pointer;' data-id='" + jcjy.orderCode + "'>";
  1974. jcjyHtml += "<input type='checkbox'/>";
  1975. jcjyHtml += "<span onclick='rowDataClick(this)'>";
  1976. } else {
  1977. jcjyHtml += "<div>";
  1978. }
  1979. jcjyHtml += jcjy.index + ".";
  1980. jcjyHtml += jcjy.name;
  1981. if (checkBox) {
  1982. jcjyHtml += "</span>";
  1983. }
  1984. jcjyHtml += "</div>";
  1985. }
  1986. afterFitContent(contentId, jcjyHtml, titleId);
  1987. }
  1988. /**
  1989. * 构造入院处方详情和模板预览方法
  1990. * @param jcjyPrescription
  1991. * @param contentId 内容ID
  1992. * @param titleId 标题ID
  1993. * @param checkBox 是否需要增加ckeckBox
  1994. */
  1995. function fitZyReqContent(zyReqPrescription, contentId, titleId, checkBox) {
  1996. if (zyReqPrescription == null || zyReqPrescription.length == 0) {
  1997. $("#" + titleId).removeClass("in").addClass("hide");
  1998. $("#" + contentId).html("");
  1999. return;
  2000. }
  2001. var zyReqHtml = "";
  2002. if (checkBox) {
  2003. zyReqHtml += "<div style='cursor: pointer;'>";
  2004. zyReqHtml += "<input type='checkbox'/>";
  2005. zyReqHtml += "<span onclick='rowDataClick(this)'>";
  2006. } else {
  2007. zyReqHtml += "<div>";
  2008. }
  2009. zyReqHtml += "收住院 [";
  2010. zyReqHtml += zyReqPrescription.reqDept;
  2011. if (zyReqPrescription.smallDept != null && zyReqPrescription.smallDept != "") {
  2012. zyReqHtml += "(" + zyReqPrescription.smallDept + ")";
  2013. }
  2014. zyReqHtml += "]";
  2015. if (zyReqPrescription.admissStatus != null && zyReqPrescription.admissStatus != "") {
  2016. zyReqHtml += zyReqPrescription.admissStatus;
  2017. }
  2018. zyReqHtml += " 侯床";
  2019. if (checkBox) {
  2020. zyReqHtml += "</span>";
  2021. }
  2022. zyReqHtml += "</div>";
  2023. afterFitContent(contentId, zyReqHtml, titleId);
  2024. }
  2025. /**
  2026. * 处方详情构造方法后续事件,如所有的复选框默认勾选
  2027. * @param contentId
  2028. * @param zyReqHtml
  2029. * @param titleId
  2030. */
  2031. function afterFitContent(contentId, zyReqHtml, titleId) {
  2032. $("#" + contentId).html(zyReqHtml);
  2033. $("#" + titleId).removeClass("hide").addClass("in");
  2034. $("#" + titleId).find("input[type='checkbox']").prop("checked", true);
  2035. $("#" + contentId).find("input[type='checkbox']").each(function (index, obj) {
  2036. $(obj).prop("checked", true);
  2037. });
  2038. }
  2039. /**
  2040. * 模板、详情页行数据点击事件
  2041. * @param obj
  2042. */
  2043. function rowDataClick(obj) {
  2044. $(obj).prev().click();
  2045. }
  2046. /**
  2047. * 模板、详情页治疗分类标题点击事件
  2048. * @param obj
  2049. * @param source 0 是标题的行点击事件 1 标题的checkbox本身触发
  2050. */
  2051. function titleClick(obj, source) {
  2052. var contentObj = $(obj).parent().next();
  2053. var check = $(obj).prop("checked");
  2054. if (source == 0) {
  2055. var prev = $(obj).prev();
  2056. check = !$(prev).prop("checked");
  2057. $(prev).prop("checked", check)
  2058. }
  2059. if (contentObj != null) {
  2060. $(contentObj).children().each(function (index, object) {
  2061. //以下两个方法,单独调用一个可能不行
  2062. $(object).find("input[type='checkbox']").prop("checked", check) //如果鼠标点击选中了,执行后可以取消选中
  2063. });
  2064. }
  2065. }
  2066. /**
  2067. * 处方明细复选框点击事件
  2068. * @param obj
  2069. * @param source 0 是标题的行点击事件 1 标题的checkbox本身触发
  2070. */
  2071. function prescriptionCfmxChosice(obj, source) {
  2072. var check = $(obj).prop("checked");
  2073. if (source == 0) {
  2074. var prev = $(obj).prev();
  2075. check = !$(prev).prop("checked");
  2076. //以下两个方法,单独调用一个可能不行
  2077. $(prev).prop("checked", check) //如果鼠标点击选中了,执行后可以取消选中
  2078. }
  2079. var conents = $(obj).parent().parent().nextAll();
  2080. if (conents == null || conents.length == 0) {
  2081. return;
  2082. }
  2083. $(conents).each(function (index, object) {
  2084. //以下两个方法,单独调用一个可能不行
  2085. $(object).find("div:eq(0)").find("input[type='checkbox']").prop("checked", check) //如果鼠标点击选中了,执行后可以取消选中
  2086. var contentObj = $(object).find("div:eq(1)");
  2087. if (contentObj != null) {
  2088. $(contentObj).children().each(function (contentIndex, contentObject) {
  2089. $(contentObject).find("input[type='checkbox']").prop("checked", check) //如果鼠标点击选中了,执行后可以取消选中
  2090. });
  2091. }
  2092. });
  2093. }
  2094. /**
  2095. * 简明病历标题点击事件
  2096. * @param obj
  2097. */
  2098. function prescriptionJmblChosice(obj) {
  2099. var prev = $(obj).prev();
  2100. var check = !$(prev).prop("checked");
  2101. $(prev).prop("checked", check); //如果鼠标点击选中了,执行后可以取消选中
  2102. }
  2103. /**
  2104. * 医疗范文详情预览
  2105. * @param id
  2106. */
  2107. function medicalModelModal(id) {
  2108. $("#conciseRecordsYlfw").prop("checked", true);
  2109. $("#prescriptionSubsidiaryYlfw").prop("checked", true);
  2110. $.ajax({
  2111. type: "GET",
  2112. url: '/thmz/getTemplateById?id=' + id,
  2113. contentType: "application/json;charset=UTF-8",
  2114. dataType: "json",
  2115. async: false,
  2116. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2117. success: function (res) {
  2118. if (res == '401' || res == 401) {
  2119. window.location.href = '/thmz/login/view'
  2120. return;
  2121. }
  2122. if (res.code == 0) {
  2123. var jsonData = JSON.parse(res.data.templateData);
  2124. $("#vmedicalModelName").text(res.data.name);
  2125. $("#idTemplate").val(res.data.id);
  2126. $("#zsTemplate").html(jsonData.mzBlRecord.emrChiefComplaint);
  2127. $("#xbsTemplate").html(jsonData.mzBlRecord.emrHpi);
  2128. var icdText = res.data.icdText;
  2129. $("#zdTemplate").html("");
  2130. $("#xypyContent").html("");
  2131. $("#xymjContent").html("");
  2132. $("#xyjeContent").html("");
  2133. $("#yczlContent").html("");
  2134. $("#zyzlContent").html("");
  2135. $("#zlyjContent").html("");
  2136. if (icdText != null) {
  2137. var arr = icdText.split(",");
  2138. var html = "";
  2139. for (var i = 0; i < arr.length; i++) {
  2140. if (i == 0) {
  2141. html += ' <div class="tagZdy tagZdy-back">';
  2142. } else {
  2143. html += ' <div class="tagZdy tagZdy-back-green">';
  2144. }
  2145. html += arr[i];
  2146. html += '</div>';
  2147. }
  2148. $("#zdTemplate").html(html);
  2149. }
  2150. var prescriptionDetail = jsonData.mzBlRecord.prescriptionDetail;
  2151. if (prescriptionDetail != null && prescriptionDetail != "") {
  2152. prescriptionDetail = JSON.parse(prescriptionDetail);
  2153. var xyPrescription = prescriptionDetail.xyPrescription;
  2154. if (xyPrescription != null) {
  2155. fitxyContent(xyPrescription.pyPrescription, "xypyContent", "xypyTitle", true);
  2156. fitxyContent(xyPrescription.mjPrescription, "xymjContent", "xymjTitle", true);
  2157. fitxyContent(xyPrescription.jePrescription, "xyjeContent", "xyjeTitle", true);
  2158. fitxyContent(xyPrescription.ycPrescription, "yczlContent", "yczlTitle", true);
  2159. } else {
  2160. $("#xypyTitle").removeClass("in").addClass("hide");
  2161. $("#xypyContent").html("");
  2162. $("#xymjTitle").removeClass("in").addClass("hide");
  2163. $("#xymjContent").html("");
  2164. $("#xyjeTitle").removeClass("in").addClass("hide");
  2165. $("#xyjeContent").html("");
  2166. $("#yczlTitle").removeClass("in").addClass("hide");
  2167. $("#yczlContent").html("");
  2168. }
  2169. var zyPrescription = prescriptionDetail.zyPrescription;
  2170. if (zyPrescription != null) {
  2171. fitzyContent(zyPrescription, "zyzlContent", "zyzlTitle", true);
  2172. } else {
  2173. $("#zyzlTitle").removeClass("in").addClass("hide");
  2174. $("#zyzlContent").html("");
  2175. }
  2176. var jcjyPrescription = prescriptionDetail.jcjyPrescription;
  2177. if (jcjyPrescription != null) {
  2178. fitJcjyContent(jcjyPrescription, "jcjyContent", "jcjyTitle", true);
  2179. } else {
  2180. $("#jcjyTitle").removeClass("in").addClass("hide");
  2181. $("#jcjyContent").html("");
  2182. }
  2183. var zlPrescription = prescriptionDetail.zlPrescription;
  2184. if (zlPrescription != null) {
  2185. fitJcjyContent(zlPrescription, "zlContent", "zlTitle", true);
  2186. } else {
  2187. $("#zlTitle").removeClass("in").addClass("hide");
  2188. $("#zlContent").html("");
  2189. }
  2190. var zyReqPrescription = prescriptionDetail.zyReqPrescription;
  2191. if (zyReqPrescription != null) {
  2192. fitZyReqContent(zyReqPrescription, "zyReqContent", "zyReqTitle", true);
  2193. } else {
  2194. $("#zyReqTitle").removeClass("in").addClass("hide");
  2195. $("#zyReqContent").html("");
  2196. }
  2197. } else {
  2198. $("#xypyTitle").removeClass("in").addClass("hide");
  2199. $("#xypyContent").html("");
  2200. $("#xymjTitle").removeClass("in").addClass("hide");
  2201. $("#xymjContent").html("");
  2202. $("#xyjeTitle").removeClass("in").addClass("hide");
  2203. $("#xyjeContent").html("");
  2204. $("#yczlTitle").removeClass("in").addClass("hide");
  2205. $("#yczlContent").html("");
  2206. $("#zyzlTitle").removeClass("in").addClass("hide");
  2207. $("#zyzlContent").html("");
  2208. $("#jcjyTitle").removeClass("in").addClass("hide");
  2209. $("#jcjyContent").html("");
  2210. $("#zlTitle").removeClass("in").addClass("hide");
  2211. $("#zlContent").html("");
  2212. $("#zyReqTitle").removeClass("in").addClass("hide");
  2213. $("#zyReqContent").html("");
  2214. }
  2215. } else {
  2216. errorMesage(res);
  2217. }
  2218. }
  2219. });
  2220. $("#medicalModelModal").modal();
  2221. }
  2222. /**
  2223. * 诊疗项目回写
  2224. * @param code
  2225. * @param mzChargeDetail
  2226. */
  2227. function callBackZlDetail(code, mzChargeDetail) {
  2228. //诊疗项目
  2229. $.ajax({
  2230. type: "GET",
  2231. url: '/thmz/getZdChargeItemByCode?code=' + code,
  2232. contentType: "application/json;charset=UTF-8",
  2233. dataType: "json",
  2234. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2235. async: false,
  2236. success: function (res) {
  2237. if (res == '401' || res == 401) {
  2238. window.location.href = '/thmz/login/view'
  2239. return;
  2240. }
  2241. if (res.code == 0) {
  2242. //如果
  2243. if ($("#zlTab").find("li") == null || $("#zlTab").find("li").length == 0) {
  2244. initNavTabs(3);
  2245. }
  2246. $("#zlItem").val(res.data.name);
  2247. $("#zlItem").blur();
  2248. $("#zlItemPrice").val(res.data.chargeAmount);
  2249. $("#chargeUnit").val(res.data.chargeUnit);
  2250. $("#zl_current_code").val(res.data.code);
  2251. $("#zlRemark").val(mzChargeDetail.instructionText);
  2252. if (mzChargeDetail.execDept != null && mzChargeDetail.execDept != "") {
  2253. $("#zlExecUnit").selectpicker('val', mzChargeDetail.execDept);
  2254. $('#zlExecUnit').selectpicker('refresh');
  2255. }
  2256. $("#itemQuantity").val(mzChargeDetail.quantity);
  2257. saveZlItem(false);
  2258. } else {
  2259. errorMesage(res);
  2260. }
  2261. }
  2262. });
  2263. }
  2264. /**
  2265. * 处方回写
  2266. * @param jsonData 处方数据
  2267. * @param type 回写类型 0 全部回写 1 医疗范文 2 就诊详情
  2268. */
  2269. function editPrescription(jsonData, type) {
  2270. var firstOrNot = jsonData.firstOrNot;
  2271. var conciseRecordsFlag = false;
  2272. if (type == 1) {
  2273. conciseRecordsFlag = $("#conciseRecordsYlfw").prop("checked");
  2274. } else if (type == 2) {
  2275. conciseRecordsFlag = $("#conciseRecordsJzxq").prop("checked");
  2276. }
  2277. if (firstOrNot == 0) {
  2278. $("#first").next().click();
  2279. } else if (firstOrNot == 1) {
  2280. $("#not").next().click();
  2281. }
  2282. if (type == 0 || conciseRecordsFlag) {
  2283. $("#symptom").val(jsonData.mzBlRecord.emrChiefComplaint);
  2284. $("#emrHpi").val(jsonData.mzBlRecord.emrHpi);
  2285. $("#emrPs").val(jsonData.mzBlRecord.emrPs);
  2286. $("#personalHistory").val(jsonData.mzBlRecord.personalHistory);
  2287. $("#familyHistory").val(jsonData.mzBlRecord.familyHistory);
  2288. $("#obstericalHistory").val(jsonData.mzBlRecord.obstericalHistory);
  2289. if (jsonData.mzBlRecord.weight != null && jsonData.mzBlRecord.weight != 0) {
  2290. $("#weight").val(jsonData.mzBlRecord.weight);
  2291. } else {
  2292. $("#weight").val("");
  2293. }
  2294. if (jsonData.mzBlRecord.temperature != null && jsonData.mzBlRecord.temperature != 0) {
  2295. $("#temperature").val(jsonData.mzBlRecord.temperature);
  2296. } else {
  2297. $("#temperature").val("");
  2298. }
  2299. if (jsonData.mzBlRecord.sphygmus != null && jsonData.mzBlRecord.sphygmus != 0) {
  2300. $("#sphygmus").val(jsonData.mzBlRecord.sphygmus);
  2301. } else {
  2302. $("#sphygmus").val("");
  2303. }
  2304. if (jsonData.mzBlRecord.breathe != null && jsonData.mzBlRecord.breathe != 0) {
  2305. $("#breathe").val(jsonData.mzBlRecord.breathe);
  2306. } else {
  2307. $("#breathe").val("");
  2308. }
  2309. if (jsonData.mzBlRecord.pressureHigh != null && jsonData.mzBlRecord.pressureHigh != 0) {
  2310. $("#pressure_high").val(jsonData.mzBlRecord.pressureHigh);
  2311. } else {
  2312. $("#pressure_high").val("");
  2313. }
  2314. if (jsonData.mzBlRecord.pressureFloor != null && jsonData.mzBlRecord.pressureFloor != 0) {
  2315. $("#pressure_floor").val(jsonData.mzBlRecord.pressureFloor);
  2316. } else {
  2317. $("#pressure_floor").val("");
  2318. }
  2319. if (jsonData.mzBlRecord.pressureHighLeft != null && jsonData.mzBlRecord.pressureHighLeft != 0) {
  2320. $("#pressure_high_left").val(jsonData.mzBlRecord.pressureHighLeft);
  2321. } else {
  2322. $("#pressure_high_left").val("");
  2323. }
  2324. if (jsonData.mzBlRecord.pressureFloorLeft != null && jsonData.mzBlRecord.pressureFloorLeft != 0) {
  2325. $("#pressure_floor_left").val(jsonData.mzBlRecord.pressureFloorLeft);
  2326. } else {
  2327. $("#pressure_floor_left").val("");
  2328. }
  2329. $("#tentativeDiagnosis").val(jsonData.mzBlRecord.tentativeDiagnosis);
  2330. $("#otherCheck").val(jsonData.mzBlRecord.emrPe);
  2331. var icdCode = jsonData.icdCode;
  2332. var icdText = jsonData.icdText;
  2333. var icdCodeArr = icdCode != null ? icdCode.split(",") : null;
  2334. var icdTextArr = icdText != null ? icdText.split(",") : null;
  2335. if (icdCodeArr != null && icdCodeArr.length > 0 && icdTextArr != null && icdTextArr.length > 0) {
  2336. for (var i = 0; i < icdCodeArr.length; i++) {
  2337. fitDiagnoseValue(icdTextArr[i], icdCodeArr[i]);
  2338. }
  2339. }
  2340. $("#healthEducation").val(jsonData.mzBlRecord.emrJkjy);
  2341. }
  2342. //西药选中的数据组
  2343. var xyArrays = [];
  2344. //中药选中的数据组
  2345. var zyArrays = [];
  2346. //辅助检查、检验选中的数据组
  2347. var jcjyArrays = [];
  2348. //诊疗选中的数据组
  2349. var zlArrays = [];
  2350. //住院选中的数据组
  2351. var zyReqArrays = [];
  2352. //住院回写
  2353. var zyReqCallBack = false;
  2354. if (type == 1) {
  2355. setCallBackArrays("xypyContent", xyArrays);
  2356. setCallBackArrays("xymjContent", xyArrays);
  2357. setCallBackArrays("xyjeContent", xyArrays);
  2358. setCallBackArrays("yczlContent", xyArrays);
  2359. setCallBackArrays("zyzlContent", zyArrays);
  2360. setCallBackArrays("jcjyContent", jcjyArrays);
  2361. setCallBackArrays("zlContent", zlArrays);
  2362. zyReqCallBack = $("#zyReqContent").find("input").prop("checked");
  2363. } else if (type == 2) {
  2364. setCallBackArrays("prescriptionDetail_xypyContent", xyArrays);
  2365. setCallBackArrays("prescriptionDetail_xymjContent", xyArrays);
  2366. setCallBackArrays("prescriptionDetail_xyjeContent", xyArrays);
  2367. setCallBackArrays("prescriptionDetail_yczlContent", xyArrays);
  2368. setCallBackArrays("prescriptionDetail_zyzlContent", zyArrays);
  2369. setCallBackArrays("prescriptionDetail_jcjyContent", jcjyArrays);
  2370. setCallBackArrays("prescriptionDetail_zlContent", zlArrays);
  2371. zyReqCallBack = $("#prescriptionDetail_zyReqContent").find("input").prop("checked");
  2372. } else if (type == 0) {
  2373. zyReqCallBack = true;
  2374. }
  2375. var mzChargeDetailList = jsonData.mzChargeDetailList;
  2376. var mzZyReq = jsonData.mzZyReq;
  2377. //中药的公共参数是否已经设置了
  2378. var hadSetZyFullParams = false;
  2379. //西药,成药,医材,麻精,中药,诊疗
  2380. if (mzChargeDetailList != null && mzChargeDetailList.length > 0) {
  2381. for (var i = 0; i < mzChargeDetailList.length; i++) {
  2382. var mzChargeDetail = mzChargeDetailList[i];
  2383. var groupNo = mzChargeDetail.groupNo;
  2384. var code = mzChargeDetail.chargeItemCode;
  2385. var serial = mzChargeDetail.serial;
  2386. if (groupNo == "00") {
  2387. if (type != 0 && !isInArray(code, zlArrays)) {
  2388. continue;
  2389. }
  2390. callBackZlDetail(code, mzChargeDetail);
  2391. } else if (groupNo == "71" || groupNo == "91" || groupNo == "111" || groupNo == "131") {
  2392. // 71 西成药 91 医材 111 精一 131 精二
  2393. var groupOrder = mzChargeDetail.groupOrder;
  2394. if (groupOrder == null || groupOrder == 'null' || groupOrder == "") {
  2395. groupOrder = 1;
  2396. }
  2397. if (type != 0 && !isInArray(code + "_" + serial + "_" + groupOrder, xyArrays)) {
  2398. continue;
  2399. }
  2400. var lastGroupOrder = parseInt($("#groupId > option:last").val());
  2401. while (lastGroupOrder < groupOrder) {
  2402. appendGroupOrder();
  2403. lastGroupOrder = parseInt($("#groupId > option:last").val());
  2404. }
  2405. //appendGroupOrder()
  2406. $("#groupId").selectpicker('val', groupOrder);
  2407. $('#groupId').selectpicker('refresh');
  2408. checkYpInfo(code, serial, groupNo, false, mzChargeDetail.orderNo);
  2409. // 给药方式 同组药品给药方式相同
  2410. $("#supplyType").selectpicker('val', mzChargeDetail.supplyCode);
  2411. $('#supplyType').selectpicker('refresh');
  2412. $("#drugWin").val(mzChargeDetail.drugQuan);
  2413. $("#drugWinUnit").selectpicker('val', mzChargeDetail.drugUnit);
  2414. $('#drugWinUnit').selectpicker('refresh');
  2415. //天数 同组药品天数相同
  2416. $("#dayNum").selectpicker('val', mzChargeDetail.orderDays);
  2417. $('#dayNum').selectpicker('refresh');
  2418. //频次编码 同组药品频次编码相同
  2419. $("#orderFrequency").selectpicker('val', mzChargeDetail.frequency);
  2420. $('#orderFrequency').selectpicker('refresh');
  2421. if (mzChargeDetail.tryFlag == 1 || mzChargeDetail.tryFlag == "1") {
  2422. $("#tryResult").selectpicker('val', 100);
  2423. $('#tryResult').selectpicker('refresh');
  2424. } else if (mzChargeDetail.tryResult != null && mzChargeDetail.tryResult != "null" && mzChargeDetail.tryResult != "") {
  2425. $("#tryResult").selectpicker('val', mzChargeDetail.tryResult);
  2426. $('#tryResult').selectpicker('refresh');
  2427. }
  2428. $("#gross").val(mzChargeDetail.quantity);
  2429. $("#totalRetprice").val(Multiply(mzChargeDetail.quantity, $("#packRetprice").val()).toFixed(2));
  2430. $("#medicalAdvice").selectpicker('val', mzChargeDetail.instructionCode);
  2431. $('#medicalAdvice').selectpicker('refresh');
  2432. saveWesternMedicine(false);
  2433. $("#western_medicine_button").click();
  2434. } else {
  2435. if (type != 0 && !isInArray(code + "_" + serial, zyArrays)) {
  2436. continue;
  2437. }
  2438. //中药与颗粒剂
  2439. checkZyInfo(code, serial, false);
  2440. //类型
  2441. $("#zyClassType").selectpicker('val', groupNo);
  2442. $('#zyClassType').selectpicker('refresh');
  2443. $("#zy_drugWin").val(mzChargeDetail.quantity);
  2444. $("#zyInstruction").selectpicker('val', mzChargeDetail.instructionCode);
  2445. $('#zyInstruction').selectpicker('refresh');
  2446. saveChineseMedicine(false);
  2447. if (!hadSetZyFullParams) {
  2448. hadSetZyFullParams = true;
  2449. $("input.zyfs").val(mzChargeDetail.drugWin);
  2450. // $("#zy_orderFrequency_1").selectpicker('val', mzChargeDetail.frequency);
  2451. // $('#zy_orderFrequency_1').selectpicker('refresh');
  2452. $("#useType_1").selectpicker('val', mzChargeDetail.cyFysm);
  2453. $('#useType_1').selectpicker('refresh');
  2454. $("#cyJssm").selectpicker('val', mzChargeDetail.cyJssm);
  2455. $('#cyJssm').selectpicker('refresh');
  2456. $("#cyJsl").val(mzChargeDetail.cyJsl);
  2457. $("#cyZql").val(mzChargeDetail.cyZql);
  2458. $("#cyFj").val(mzChargeDetail.cyFj);
  2459. $("#cyFfcs").val(mzChargeDetail.cyFfcs);
  2460. $("#cyMtjs").val(mzChargeDetail.cyMtjs);
  2461. $("#zy_supplyType_1").selectpicker('val', mzChargeDetail.cyDj);
  2462. $('#zy_supplyType_1').selectpicker('refresh');
  2463. }
  2464. $("#chinese_medicine_button").click();
  2465. }
  2466. }
  2467. }
  2468. //检验与检查
  2469. var mzYjReqList = jsonData.mzYjReqList;
  2470. if (mzYjReqList != null && mzYjReqList.length > 0) {
  2471. for (var i = 0; i < mzYjReqList.length; i++) {
  2472. var mzYjReq = mzYjReqList[i];
  2473. var code = mzYjReq.orderCode;
  2474. if (type != 0 && !isInArray(code, jcjyArrays)) {
  2475. continue;
  2476. }
  2477. var jcJyZltype = null;
  2478. if (mzYjReq.reqType == 2) {
  2479. jcJyZltype = 1;
  2480. $("#jyZdSample").selectpicker('val', mzYjReq.inspectStuff);
  2481. $('#jyZdSample').selectpicker('refresh');
  2482. } else if (mzYjReq.reqType == 3) {
  2483. jcJyZltype = 2;
  2484. $("#yshPart").selectpicker('val', mzYjReq.inspectPart);
  2485. $('#yshPart').selectpicker('refresh');
  2486. }
  2487. $("#jcJyZltype").val(jcJyZltype);
  2488. checkJcJyItemInfo(code, null, jcJyZltype, false);
  2489. $("#remark").val(mzYjReq.jyRemark);
  2490. if (mzYjReq.execDept != null && mzYjReq.execDept != "") {
  2491. $("#execUnit").selectpicker('val', mzYjReq.execDept);
  2492. $('#execUnit').selectpicker('refresh');
  2493. }
  2494. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  2495. saveJyJcItem(false);
  2496. $("#jcJyItemChargeDetail").removeClass("in").addClass("hide");
  2497. }
  2498. $("#yj_req_button").click();
  2499. }
  2500. //入院证
  2501. if (zyReqCallBack && mzZyReq != null && mzZyReq.reqDept != null && mzZyReq.reqDept != "") {
  2502. $("#inpatientWardBeHospitalized").selectpicker('val', mzZyReq.reqDept);
  2503. $('#inpatientWardBeHospitalized').selectpicker('refresh');
  2504. initSmallDeptByDept();
  2505. $("#admissStatus").selectpicker('val', mzZyReq.admissStatus);
  2506. $('#admissStatus').selectpicker('refresh');
  2507. setTimeout(function () {
  2508. $("#smallWardBeHospitalized").selectpicker('val', mzZyReq.smallDept);
  2509. $('#smallWardBeHospitalized').selectpicker('refresh');
  2510. saveZyReq(false);
  2511. }, 500);
  2512. $("#zy_req_button").click();
  2513. }
  2514. setTimeout(function () {
  2515. //设置总金额 计算金额的时候,可能处方还没有回写完
  2516. calculateTotalAmount();
  2517. }, 1000);
  2518. }
  2519. /**
  2520. * 根据勾选内容设置选中集合
  2521. * @param id 区域id
  2522. * @param arrays 集合
  2523. */
  2524. function setCallBackArrays(id, arrays) {
  2525. var contents = $("#" + id).children();
  2526. if (contents == null || contents.length == 0) {
  2527. return;
  2528. }
  2529. $(contents).each(function (index, obj) {
  2530. var checked = $(obj).find("input").prop("checked");
  2531. var data_id = $(obj).attr("data-id");
  2532. if (checked && data_id != undefined && data_id != null && data_id != "null" && data_id != "") {
  2533. arrays[arrays.length] = data_id;
  2534. }
  2535. });
  2536. }
  2537. /**
  2538. * 调用医疗范文
  2539. */
  2540. function callTemplate() {
  2541. clearWorkSpaceExcludeUser(2);
  2542. $.ajax({
  2543. type: "GET",
  2544. url: '/thmz/increaseNumber?id=' + $("#idTemplate").val(),
  2545. contentType: "application/json;charset=UTF-8",
  2546. dataType: "json",
  2547. async: false,
  2548. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2549. success: function (res) {
  2550. if (res == '401' || res == 401) {
  2551. window.location.href = '/thmz/login/view'
  2552. return;
  2553. }
  2554. if (res.code == 0) {
  2555. var jsonData = JSON.parse(res.data.templateData);
  2556. editPrescription(jsonData, 1);
  2557. $("#templateId").val(res.data.id);
  2558. $("#templateName").val(res.data.name);
  2559. $("#templateKindType").selectpicker('val', res.data.templateKindType);
  2560. $("#templateKindType").selectpicker('refresh');
  2561. $("#templateType").selectpicker('val', res.data.templateType);
  2562. $("#templateType").selectpicker('refresh');
  2563. $("#medicalModelModal").modal("hide");
  2564. closePopover();
  2565. } else {
  2566. errorMesage(res);
  2567. }
  2568. }
  2569. });
  2570. }
  2571. /**
  2572. * 底层填充推荐方法
  2573. * @param paramsType
  2574. * @param appeal
  2575. * @param inputId
  2576. */
  2577. function extracted(paramsType, appeal, inputId) {
  2578. if (paramsType == 13) {
  2579. var contentArr = appeal.split(",");
  2580. if (contentArr != null && contentArr.length > 0) {
  2581. for (var i = 0; i < contentArr.length; i++) {
  2582. var content = contentArr[i].replace(")", "").replace("(", "-");
  2583. var diagnoseArr = content.split("-");
  2584. if (diagnoseArr == null || diagnoseArr.length == 0) {
  2585. continue;
  2586. }
  2587. fitDiagnoseValue(diagnoseArr[0], diagnoseArr[1]);
  2588. }
  2589. }
  2590. } else {
  2591. $("#" + inputId).val(appeal);
  2592. }
  2593. }
  2594. /**
  2595. * 填充推荐
  2596. * @param appeal
  2597. * @param paramsType
  2598. * @param id
  2599. */
  2600. function fitAppeal(appeal, paramsType, id) {
  2601. var inputId = "symptom";
  2602. var text = "主诉项已经录入,是否覆盖?";
  2603. if (paramsType == 5) {
  2604. inputId = "emrHpi";
  2605. text = "现病史项已经录入,是否覆盖?";
  2606. } else if (paramsType == 6) {
  2607. inputId = "emrPs";
  2608. text = "既往史项已经录入,是否覆盖?";
  2609. } else if (paramsType == 13) {
  2610. inputId = "diagnoseValue";
  2611. text = "诊断项已经录入,是否覆盖?";
  2612. }
  2613. var symptom = $("#" + inputId).val();
  2614. if (paramsType == 13 && (symptom == ",," || symptom == ",")) {
  2615. symptom = null;
  2616. }
  2617. if (symptom != null && symptom != "") {
  2618. $("#messageModal").modal();
  2619. $("#messageContent").html(text);
  2620. $("#messageButton").off("click").on("click", function (t) {
  2621. $("#messageModal").modal("hide");
  2622. if (paramsType == 13) {
  2623. $("#" + inputId).val(null);
  2624. $("#diagnoseTags").html(null);
  2625. }
  2626. extracted(paramsType, appeal, inputId);
  2627. });
  2628. $("#cancelButton").off("click");
  2629. } else {
  2630. extracted(paramsType, appeal, inputId);
  2631. }
  2632. $.ajax({
  2633. type: "GET",
  2634. url: '/thmz/increaseTcCommonParamsNumber?id=' + id,
  2635. contentType: "application/json;charset=UTF-8",
  2636. dataType: "json",
  2637. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2638. success: function (res) {
  2639. }
  2640. });
  2641. }
  2642. /**
  2643. * 初始嘱托下拉选
  2644. */
  2645. function initInstructionSelect() {
  2646. //西药医嘱
  2647. $.ajax({
  2648. type: "GET",
  2649. url: '/thmz/getMzZdInstructionByType?instructionType=0',
  2650. contentType: "application/json;charset=UTF-8",
  2651. dataType: "json",
  2652. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2653. success: function (res) {
  2654. if (res == '401' || res == 401) {
  2655. window.location.href = '/thmz/login/view'
  2656. return;
  2657. }
  2658. if (res.code == 0) {
  2659. res.data.forEach(function (item, index) {
  2660. var html = '<option value="' + item.code + '">' + item.instructionText + '</option>';
  2661. $('#medicalAdvice').append(html);
  2662. });
  2663. $('#medicalAdvice').selectpicker('refresh');
  2664. } else {
  2665. errorMesage(res);
  2666. }
  2667. }
  2668. });
  2669. //中药医嘱
  2670. $.ajax({
  2671. type: "GET",
  2672. url: '/thmz/getMzZdInstructionByType?instructionType=1',
  2673. contentType: "application/json;charset=UTF-8",
  2674. dataType: "json",
  2675. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2676. success: function (res) {
  2677. if (res == '401' || res == 401) {
  2678. window.location.href = '/thmz/login/view'
  2679. return;
  2680. }
  2681. if (res.code == 0) {
  2682. res.data.forEach(function (item, index) {
  2683. var html = '<option value="' + item.code + '">' + item.instructionText.trim() + '</option>';
  2684. $('#zyInstruction').append(html);
  2685. });
  2686. $('#zyInstruction').selectpicker('refresh');
  2687. } else {
  2688. errorMesage(res);
  2689. }
  2690. }
  2691. });
  2692. }
  2693. /**
  2694. * 设置下拉选的尺寸
  2695. */
  2696. function setSelectSize() {
  2697. $(".selectpicker").selectpicker({
  2698. dropuAuto: false,
  2699. size: 10
  2700. });
  2701. //select 从后台加载数据,并保留之前选择的内容
  2702. dynamicSelectWithOri("editZd", '/thmz/getAllZdIcdCommonParams?commonParams=');
  2703. }
  2704. /**
  2705. * 初始化性别下拉选
  2706. */
  2707. function initGenderSelect() {
  2708. var gender = '<option value="1">男</option><option value="2">女</option><option value="0">未知</option>';
  2709. $('#rapidAcceptsUserGender').html(gender);
  2710. $('#rapidAcceptsUserGender').selectpicker('refresh');
  2711. $('#editUserGender').html(gender);
  2712. $('#editUserGender').selectpicker('refresh');
  2713. //医疗范文状态
  2714. var templateStatus = '<option value="0">启用</option><option value="1">停用</option>';
  2715. $('#templateStatus').html(templateStatus);
  2716. $('#templateStatus').selectpicker('refresh');
  2717. }
  2718. /**
  2719. * 初始化中药类型下拉选
  2720. */
  2721. function initZyClassTypeSelect() {
  2722. var gender = '<option value="81">普通</option><option value="82">颗粒剂</option>';
  2723. $('#zyClassType').html(gender);
  2724. $('#zyClassType').selectpicker('refresh');
  2725. //$('#zyClassType').selectpicker('val', "81");
  2726. // $('#zyClassType').selectpicker('refresh');
  2727. }
  2728. /**
  2729. * 初始化皮试结果下拉选
  2730. * @param categoriesFlag 0 口服 2 注射针剂
  2731. */
  2732. function initTryResultSelect(categoriesFlag) {
  2733. var tryResult = '';
  2734. if (categoriesFlag == 2 || categoriesFlag == "2") {
  2735. tryResult += '<option value="100">皮试</option>';
  2736. }
  2737. tryResult += '<option value="0">阴性</option><option value="3">免试</option>';
  2738. //var tryResult = '<option value="100">皮试</option><option value="0">阴性</option><option value="3">免试</option>';
  2739. $('#tryResult').html(tryResult);
  2740. $('#tryResult').selectpicker('refresh');
  2741. //口服药选择皮试结果
  2742. $("#tryResult").parent().parent().parent().removeClass("hide").addClass("in");
  2743. }
  2744. /**
  2745. * 初始化病人身份类别下拉选
  2746. */
  2747. function initResponceTypeSelect() {
  2748. $.ajax({
  2749. type: "GET",
  2750. url: '/thmz/getMzResponceType',
  2751. contentType: "application/json;charset=UTF-8",
  2752. dataType: "json",
  2753. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2754. success: function (res) {
  2755. if (res == '401' || res == 401) {
  2756. window.location.href = '/thmz/login/view'
  2757. return;
  2758. }
  2759. if (res.code == 0) {
  2760. res.data.forEach(function (item, index) {
  2761. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  2762. $('#patientsNature').append(html);
  2763. $('#editUserPatientsNature').append(html);
  2764. // $('#responeTypeBeHospitalized').append(html);
  2765. });
  2766. $('#patientsNature').selectpicker('refresh');
  2767. $('#editUserPatientsNature').selectpicker('refresh');
  2768. } else {
  2769. errorMesage(res);
  2770. }
  2771. }
  2772. });
  2773. }
  2774. /**
  2775. * 所有的入院状态
  2776. */
  2777. function iniAdmissStatus() {
  2778. $.ajax({
  2779. type: "GET",
  2780. url: '/thmz/getAdmissStatus',
  2781. dataType: "json",
  2782. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2783. success: function (res) {
  2784. if (res == '401' || res == 401) {
  2785. window.location.href = '/thmz/login/view'
  2786. return;
  2787. }
  2788. var html = '';
  2789. $.each(res.data, function (commentIndex, comment) {
  2790. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  2791. });
  2792. $('#admissStatus').empty();
  2793. $('#admissStatus').html(html);
  2794. $('#admissStatus').selectpicker('destroy').selectpicker('refresh');
  2795. }
  2796. });
  2797. }
  2798. /**
  2799. * 入院登记的病区列表
  2800. */
  2801. function initListDeptSelect() {
  2802. //科室列表
  2803. $.ajax({
  2804. type: "GET",
  2805. url: '/thmz/allInpatientWard',
  2806. dataType: "json",
  2807. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2808. success: function (data) {
  2809. if (data == '401' || data == 401) {
  2810. window.location.href = '/thmz/login/view'
  2811. return;
  2812. }
  2813. var html = '';
  2814. $.each(data.data, function (commentIndex, comment) {
  2815. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';
  2816. });
  2817. $('#inpatientWardBeHospitalized').empty();
  2818. $('#inpatientWardBeHospitalized').html(html);
  2819. $('#inpatientWardBeHospitalized').selectpicker('refresh');
  2820. initSmallDeptByDept();
  2821. }
  2822. });
  2823. }
  2824. /**
  2825. * 小科室列表
  2826. */
  2827. function initSmallDeptByDept() {
  2828. //小科室列表
  2829. $.ajax({
  2830. type: "GET",
  2831. url: '/thmz/getSmallDeptByDept?code=' + $('#inpatientWardBeHospitalized').val(),
  2832. dataType: "json",
  2833. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2834. success: function (res) {
  2835. if (res == '401' || res == 401) {
  2836. window.location.href = '/thmz/login/view'
  2837. return;
  2838. }
  2839. var html = '';
  2840. $.each(res.data, function (commentIndex, comment) {
  2841. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  2842. });
  2843. $('#smallWardBeHospitalized').empty();
  2844. $('#smallWardBeHospitalized').html(html);
  2845. $('#smallWardBeHospitalized').selectpicker('destroy').selectpicker('refresh');
  2846. }
  2847. });
  2848. //病床数
  2849. $.ajax({
  2850. type: "GET",
  2851. url: '/thmz/getBedStatusNumByDept?code=' + $('#inpatientWardBeHospitalized').val(),
  2852. dataType: "json",
  2853. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2854. success: function (res) {
  2855. if (res == '401' || res == 401) {
  2856. window.location.href = '/thmz/login/view'
  2857. return;
  2858. }
  2859. if (res.code == 0) {
  2860. var data = res.data;
  2861. if (data == null) {
  2862. $("#totalBedNum").val(0);
  2863. $("#freeBedNum").val(0);
  2864. $("#occupationBedNum").val(0);
  2865. } else {
  2866. $("#totalBedNum").val(data.total);
  2867. $("#freeBedNum").val(data.free);
  2868. $("#occupationBedNum").val(data.occupation);
  2869. }
  2870. } else {
  2871. errorMesage(res);
  2872. }
  2873. }
  2874. });
  2875. }
  2876. //
  2877. // /**
  2878. // * 初始化诊断下拉选
  2879. // */
  2880. // function initIcdSelect() {
  2881. // var icdCodeInputBeHospitalized = $("#icdCodeInputBeHospitalized").val()
  2882. // $.ajax({
  2883. // type: "GET",
  2884. // url: '/thmz/getTCommonParamsByParamsType?paramsType=4&commonParams=' + icdCodeInputBeHospitalized + '&pageSize=100',
  2885. // contentType: "application/json;charset=UTF-8",
  2886. // dataType: "json",
  2887. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2888. // success: function (res) {
  2889. // if (res == '401' || res == 401) {
  2890. // window.location.href = '/thmz/login/view'
  2891. // return;
  2892. // }
  2893. // var html = '';
  2894. // if (res.code == 0) {
  2895. // if (res.data != null && res.data.length > 0) {
  2896. // var html = '';
  2897. // for (var i = 0; i < res.data.length; i++) {
  2898. // html += '<option value="' + res.data[i].paramsCode + '">' + res.data[i].paramsName + '(' + res.data[i].paramsCode + ')</option>';
  2899. // }
  2900. // $('#icdCodeBeHospitalized').empty();
  2901. // $('#icdCodeBeHospitalized').html(html);
  2902. // $('#icdCodeBeHospitalized').selectpicker('destroy').selectpicker('refresh');
  2903. // $('#icdCodeBeHospitalized').parent().addClass("open");
  2904. // $('#icdCodeBeHospitalized').next().addClass("hide");
  2905. // $('#icdCodeBeHospitalized').next().next().css("margin-top", "-34px");
  2906. // }
  2907. // } else {
  2908. // errorMesage(res);
  2909. // }
  2910. // }
  2911. // });
  2912. // }
  2913. //
  2914. // /**
  2915. // * 设置诊断内容
  2916. // */
  2917. // function setIcdText() {
  2918. // var icdCodeBeHospitalized = $('#icdCodeBeHospitalized option:selected').text();
  2919. // if (icdCodeBeHospitalized != null) {
  2920. // var icdText = icdCodeBeHospitalized.substring(0, icdCodeBeHospitalized.indexOf("("));
  2921. // $("#icdTextBeHospitalized").val(icdText);
  2922. // $("#icdCodeInputBeHospitalized").val($('#icdCodeBeHospitalized').val());
  2923. // $("#icdTextBeHospitalized").attr("title", icdText);
  2924. // } else {
  2925. // $("#icdTextBeHospitalized").val("");
  2926. // $("#icdCodeInputBeHospitalized").val("");
  2927. // $("#icdTextBeHospitalized").attr("title", "");
  2928. // }
  2929. // $('#icdCodeBeHospitalized').parent().addClass("hide");
  2930. // }
  2931. /**
  2932. * 初始化医疗范文范围下拉选
  2933. */
  2934. function initTemplateTypeSelect() {
  2935. $.ajax({
  2936. type: "GET",
  2937. url: '/thmz/getTemplateTypes',
  2938. contentType: "application/json;charset=UTF-8",
  2939. dataType: "json",
  2940. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2941. success: function (res) {
  2942. if (res == '401' || res == 401) {
  2943. window.location.href = '/thmz/login/view'
  2944. return;
  2945. }
  2946. if (res.code == 0) {
  2947. res.data.forEach(function (item) {
  2948. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  2949. $('#templateType').append(html);
  2950. });
  2951. $('#templateType').selectpicker('refresh');
  2952. } else {
  2953. errorMesage(res);
  2954. }
  2955. }
  2956. });
  2957. }
  2958. /**
  2959. * 初始化医疗范文类型下拉选
  2960. * @param templateKindTypeId
  2961. */
  2962. function initTemplateKindTypeSelect(templateKindTypeId) {
  2963. $.ajax({
  2964. type: "GET",
  2965. url: '/thmz/getTemplateKindTypes',
  2966. contentType: "application/json;charset=UTF-8",
  2967. dataType: "json",
  2968. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2969. success: function (res) {
  2970. if (res == '401' || res == 401) {
  2971. window.location.href = '/thmz/login/view'
  2972. return;
  2973. }
  2974. if (res.code == 0) {
  2975. res.data.forEach(function (item) {
  2976. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  2977. $('#' + templateKindTypeId).append(html);
  2978. });
  2979. $('#' + templateKindTypeId).selectpicker('refresh');
  2980. } else {
  2981. errorMesage(res);
  2982. }
  2983. }
  2984. });
  2985. }
  2986. /**
  2987. * 初始频次下拉选
  2988. * @param id
  2989. * @param async 是否是异步 true 异步 false 同步
  2990. */
  2991. function initOrderFrequencys(id, async) {
  2992. $.ajax({
  2993. type: "GET",
  2994. url: '/thmz/getXyOrderFrequencys',
  2995. dataType: "json",
  2996. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2997. async: async,
  2998. success: function (res) {
  2999. if (res == '401' || res == 401) {
  3000. window.location.href = '/thmz/login/view'
  3001. return;
  3002. }
  3003. var html = '';
  3004. $.each(res.data, function (commentIndex, comment) {
  3005. html += '<option value="' + comment.code + '" desc="' + comment.times + '">' + comment.name + '(' + comment.code + ')' + '</option>';
  3006. });
  3007. $('#' + id).empty();
  3008. $('#' + id).html(html);
  3009. $('#' + id).selectpicker('refresh');
  3010. }
  3011. });
  3012. }
  3013. /**
  3014. * 初始中药频次下拉选
  3015. * @param id
  3016. * @param async 是否是异步 true 异步 false 同步
  3017. */
  3018. function initZyOrderFrequencys(id, async) {
  3019. $.ajax({
  3020. type: "GET",
  3021. url: '/thmz/getZyOrderFrequencys',
  3022. dataType: "json",
  3023. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3024. async: async,
  3025. success: function (res) {
  3026. if (res == '401' || res == 401) {
  3027. window.location.href = '/thmz/login/view'
  3028. return;
  3029. }
  3030. var html = '';
  3031. $.each(res.data, function (commentIndex, comment) {
  3032. html += '<option value="' + comment.code + '" desc="' + comment.times + '">' + comment.name + '(' + comment.code + ')' + '</option>';
  3033. });
  3034. $('#' + id).empty();
  3035. $('#' + id).html(html);
  3036. $('#' + id).selectpicker('refresh');
  3037. }
  3038. });
  3039. }
  3040. /**
  3041. * 初始中药服用说明
  3042. */
  3043. function initAllMzYshZdFysm() {
  3044. $.ajax({
  3045. type: "GET",
  3046. url: '/thmz/getAllMzYshZdFysm',
  3047. dataType: "json",
  3048. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3049. async: false,
  3050. success: function (res) {
  3051. if (res == '401' || res == 401) {
  3052. window.location.href = '/thmz/login/view'
  3053. return;
  3054. }
  3055. var html = '';
  3056. $.each(res.data, function (commentIndex, comment) {
  3057. if (comment.name.indexOf(",") < 0) {
  3058. //过滤组合的用法
  3059. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  3060. }
  3061. });
  3062. $('.useType').empty();
  3063. $('.useType').html(html);
  3064. $('.useType').selectpicker('refresh');
  3065. $('.useType').selectpicker('val', "2");
  3066. $('.useType').selectpicker('refresh');
  3067. }
  3068. });
  3069. }
  3070. /**
  3071. * 初始用药方式下拉选
  3072. */
  3073. function initSupplyTypes() {
  3074. $.ajax({
  3075. type: "GET",
  3076. url: '/thmz/getSupplyTypes',
  3077. dataType: "json",
  3078. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3079. success: function (res) {
  3080. if (res == '401' || res == 401) {
  3081. window.location.href = '/thmz/login/view'
  3082. return;
  3083. }
  3084. var html = '';
  3085. $.each(res.data, function (commentIndex, comment) {
  3086. if (comment.supplyOcc === "71") {
  3087. html += '<option value="' + comment.supplyCode + '">' + comment.supplyName + '[' + comment.pyCode + ']' + '</option>';
  3088. }
  3089. });
  3090. $('#supplyType').empty();
  3091. $('#supplyType').html(html);
  3092. $('#supplyType').selectpicker('refresh');
  3093. }
  3094. });
  3095. }
  3096. /**
  3097. * 初始煎药方式下拉选
  3098. * @param async 是否是异步 true 异步 false 同步
  3099. */
  3100. function initZySupplyTypes(id, async) {
  3101. setSelectSize();
  3102. $.ajax({
  3103. type: "GET",
  3104. url: '/thmz/getSupplyTypes',
  3105. dataType: "json",
  3106. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3107. async: async,
  3108. success: function (res) {
  3109. if (res == '401' || res == 401) {
  3110. window.location.href = '/thmz/login/view'
  3111. return;
  3112. }
  3113. var html = '';
  3114. $.each(res.data, function (commentIndex, comment) {
  3115. if (comment.supplyOcc === "81") {
  3116. // html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  3117. html += '<option value="' + comment.supplyCode + '">' + comment.supplyName + '[' + comment.pyCode + ']' + '</option>';
  3118. }
  3119. });
  3120. $('#' + id).empty();
  3121. $('#' + id).html(html);
  3122. $('#' + id).selectpicker('refresh');
  3123. }
  3124. });
  3125. }
  3126. /**
  3127. * 初始查检查部位
  3128. */
  3129. function initYshPart() {
  3130. setSelectSize();
  3131. $.ajax({
  3132. type: "GET",
  3133. url: '/thmz/getYshPart',
  3134. dataType: "json",
  3135. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3136. success: function (res) {
  3137. if (res == '401' || res == 401) {
  3138. window.location.href = '/thmz/login/view'
  3139. return;
  3140. }
  3141. var html = '';
  3142. $.each(res.data, function (commentIndex, comment) {
  3143. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')' + '</option>';
  3144. });
  3145. $('#yshPart').empty();
  3146. $('#yshPart').html(html);
  3147. $('#yshPart').selectpicker('refresh');
  3148. }
  3149. });
  3150. }
  3151. /**
  3152. * 初始化验物下拉选
  3153. */
  3154. function initJyZdSample() {
  3155. setSelectSize();
  3156. $.ajax({
  3157. type: "GET",
  3158. url: '/thmz/getJyZdSample',
  3159. dataType: "json",
  3160. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3161. success: function (res) {
  3162. if (res == '401' || res == 401) {
  3163. window.location.href = '/thmz/login/view'
  3164. return;
  3165. }
  3166. var html = '';
  3167. $.each(res.data, function (commentIndex, comment) {
  3168. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')' + '</option>';
  3169. });
  3170. $('#jyZdSample').empty();
  3171. $('#jyZdSample').html(html);
  3172. $('#jyZdSample').selectpicker('refresh');
  3173. }
  3174. });
  3175. }
  3176. /**
  3177. * 保存当前药品到右边处方区域
  3178. * @param index 0 西药 1中药 2 诊疗和社备
  3179. */
  3180. function saveMedicine(index) {
  3181. if (index == 0) {
  3182. // //每个处方不能超过5个药品
  3183. // var tableId = $("#xyTab li.active").find("a").attr("href");
  3184. // var childrens = $(tableId).find("div:eq(0)").children().length;
  3185. // if (childrens === 5) {
  3186. // $("#messageModal").modal();
  3187. // $("#messageContent").html("单张处方最多只能开具5个药品,是否需要新增处方?");
  3188. // $("#messageButton").off("click").on("click", function (t) {
  3189. // $("#messageModal").modal("hide");
  3190. // refreshNavTabs(index);
  3191. // saveWesternMedicine();
  3192. // });
  3193. // } else {
  3194. // saveWesternMedicine();
  3195. // }
  3196. saveWesternMedicine(true);
  3197. } else if (index == 1) {
  3198. saveChineseMedicine(true);
  3199. }
  3200. }
  3201. /**
  3202. * 保存当前药品到右边处方区域 西药
  3203. * calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  3204. */
  3205. function saveWesternMedicine(calculateTotalAmountFlag) {
  3206. //组号
  3207. var groupId = $("#groupId").val();
  3208. //药品名称
  3209. var westernMedicineNamme = $("#western_medicine_name").val();
  3210. //当前药品编码
  3211. var currentCode = $("#western_medicine_current_code").val();
  3212. //当前药品规格
  3213. var currentSerial = $("#western_medicine_current_serial").val();
  3214. //当前药房编码
  3215. var currentGroupNo = $("#current_groupNo").val();
  3216. //用法编码
  3217. var supplyType = $("#supplyType").val();
  3218. //用法描述
  3219. var supplyTypeText = $('#supplyType option:selected').text();
  3220. supplyTypeText = supplyTypeText.substring(0, supplyTypeText.indexOf("["));
  3221. //药品默认单次使用剂量
  3222. var drugWinDb = $("#drugWinDb").val();
  3223. //处方实际单次使用剂量
  3224. var drugWin = $("#drugWin").val();
  3225. //剂量单位
  3226. var drugWinUnit = $('#drugWinUnit option:selected').text();
  3227. //drugWinUnit = drugWinUnit.substring(0, drugWinUnit.indexOf("("));
  3228. //天数
  3229. var dayNum = $("#dayNum").val();
  3230. //频次编码
  3231. var orderFrequency = $("#orderFrequency").val();
  3232. //频次描述
  3233. var orderFrequencyText = $('#orderFrequency option:selected').text();
  3234. orderFrequencyText = orderFrequencyText.substring(0, orderFrequencyText.indexOf("("));
  3235. //总量
  3236. var gross = $("#gross").val();
  3237. //包装单位
  3238. var packUnit = $("#packUnit").val();
  3239. if (packUnit == null) {
  3240. packUnit = "";
  3241. }
  3242. //医嘱码
  3243. var medicalAdvice = $("#medicalAdvice").val();
  3244. //医嘱内容
  3245. var medicalAdviceText = $('#medicalAdvice option:selected').text();
  3246. medicalAdviceText = medicalAdviceText.substring(0, medicalAdviceText.indexOf("("));
  3247. //金额
  3248. var totalRetprice = parseFloat($("#totalRetprice").val());
  3249. //单价
  3250. var packRetprice = $("#packRetprice").val();
  3251. //皮试结果
  3252. var tryResult = $("#tryResult").val();
  3253. if (currentCode == null || currentCode == '') {
  3254. errorMesageSimaple("未选择任何药品!");
  3255. return;
  3256. }
  3257. if (currentGroupNo != '91') {
  3258. if (supplyType == null || supplyType == "") {
  3259. errorMesageSimaple("用法为空!");
  3260. return;
  3261. }
  3262. if (drugWin == null || drugWin == "") {
  3263. errorMesageSimaple("剂量为空!");
  3264. return;
  3265. }
  3266. if (dayNum == null || dayNum == "") {
  3267. errorMesageSimaple("天数为空!");
  3268. return;
  3269. }
  3270. if (orderFrequency == null || orderFrequency == "") {
  3271. errorMesageSimaple("频次为空!");
  3272. return;
  3273. }
  3274. }
  3275. if (gross == null || gross == "") {
  3276. errorMesageSimaple("总量为空!");
  3277. return;
  3278. }
  3279. var manufactoryName = $("#manufactoryName").val();
  3280. var html = '<div class="form-group">';
  3281. html += groupId + '.<span style="margin-left: 5px"></span>';
  3282. html += westernMedicineNamme;
  3283. if (manufactoryName != null && manufactoryName != 'null' && manufactoryName != "") {
  3284. html += "(" + manufactoryName + ")"
  3285. }
  3286. html += '&nbsp;&nbsp;&nbsp;&nbsp;';
  3287. html += $("#specification").val();
  3288. html += '&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;';
  3289. //html += drugWinDb + drugWinUnit + ' 共';
  3290. html += gross + packUnit + " " + '<br/><span style="margin-left: 15px"></span>';
  3291. html += '用法:' + supplyTypeText + ' ';
  3292. html += drugWin + drugWinUnit + ' ';
  3293. html += '频次:' + orderFrequencyText + ' ';
  3294. html += dayNum + '天 ';
  3295. if (tryResult != null && tryResult != 'null' && tryResult != "") {
  3296. if (tryResult == "100" || tryResult == 100) {
  3297. html += '皮试 ';
  3298. } else {
  3299. html += '皮试结果: ' + $('#tryResult option:selected').text();
  3300. }
  3301. }
  3302. if (medicalAdvice != null && medicalAdvice != '') {
  3303. html += '医嘱:' + medicalAdviceText;
  3304. }
  3305. 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>';
  3306. 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>';
  3307. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  3308. html += '<input type="hidden" class="temporary_items_serial" value="' + currentSerial + '"/>';
  3309. html += '<input type="hidden" class="temporary_items_amount" value="' + totalRetprice + '"/>';
  3310. html += '<input type="hidden" class="temporary_items_groupId" value="' + groupId + '"/>';
  3311. html += '<input type="hidden" class="temporary_items_westernMedicineNamme" value="' + westernMedicineNamme + '"/>';
  3312. html += '<input type="hidden" class="temporary_items_drugWinDb" value="' + drugWinDb + '"/>';
  3313. html += '<input type="hidden" class="temporary_items_drugWin" value="' + drugWin + '"/>';
  3314. html += '<input type="hidden" class="temporary_items_drugWinUnit" value="' + $("#drugWinUnit").val() + '"/>';
  3315. html += '<input type="hidden" class="temporary_items_gross" value="' + gross + '"/>';
  3316. html += '<input type="hidden" class="temporary_items_packUnit" value="' + packUnit + '"/>';
  3317. html += '<input type="hidden" class="temporary_items_supplyType" value="' + supplyType + '"/>';
  3318. html += '<input type="hidden" class="temporary_items_orderFrequency" value="' + orderFrequency + '"/>';
  3319. html += '<input type="hidden" class="temporary_items_dayNum" value="' + dayNum + '"/>';
  3320. html += '<input type="hidden" class="temporary_items_medicalAdvice" value="' + medicalAdvice + '"/>';
  3321. html += '<input type="hidden" class="temporary_items_medicalAdviceText" value="' + medicalAdviceText + '"/>';
  3322. html += '<input type="hidden" class="temporary_items_packRetprice" value="' + packRetprice + '"/>';
  3323. html += '<input type="hidden" class="temporary_items_tryResult" value="' + tryResult + '"/>';
  3324. html += '<input type="hidden" class="temporary_items_currentGroupNo" value="' + currentGroupNo + '"/>';
  3325. html += '</div>';
  3326. var tableId = $("#xyTab li.active").find("a").attr("href");
  3327. //是新增药品还是编辑 true 修改 默认false
  3328. var updateFlag = $("#western_medicine_update_flag").val();
  3329. if (updateFlag == undefined || updateFlag == null) {
  3330. updateFlag = false;
  3331. }
  3332. // //原药品金额 如果是修改则需要设置
  3333. // var temporaryItemsAmount = 0;
  3334. //当前需要被移除元素的下个兄弟节点
  3335. var nextObj = null;
  3336. //当前修改的药品是不是最后一个
  3337. var isLast = false;
  3338. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  3339. if (formGroups != null && formGroups.length > 0) {
  3340. //如果是修改,需要减去原来的费用
  3341. if (updateFlag == "true" || updateFlag == true) {
  3342. for (var i = 0; i < formGroups.length; i++) {
  3343. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  3344. var temporaryItemsSerial = $(formGroups[i]).find("input.temporary_items_serial").val();
  3345. var temporaryItemsGroupId = $(formGroups[i]).find("input.temporary_items_groupId").val();
  3346. if (temporaryItemsCode === currentCode && temporaryItemsSerial === currentSerial && temporaryItemsGroupId == groupId) {
  3347. //temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  3348. if (formGroups.length > 1) {
  3349. nextObj = $(formGroups[i]).next();
  3350. }
  3351. isLast = (i + 1) === formGroups.length;
  3352. $(formGroups[i]).remove();
  3353. break;
  3354. }
  3355. }
  3356. } else {
  3357. //因为药品可以换组号,要保证相同组号的在一起
  3358. for (var i = 0; i < formGroups.length; i++) {
  3359. var temporaryItemsGroupId = parseInt($(formGroups[i]).find("input.temporary_items_groupId").val());
  3360. //如果当前的组号小与遍历到的组号,说明是原组号的下一个兄弟节点,新的药品插入到兄弟节点前就可以了
  3361. if (temporaryItemsGroupId > groupId) {
  3362. nextObj = $(formGroups[i]);
  3363. break;
  3364. }
  3365. }
  3366. }
  3367. }
  3368. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  3369. if (nextObj == null || isLast) {
  3370. $(tableId).find("div:eq(0)").append(html);
  3371. } else {
  3372. $(nextObj).before(html);
  3373. }
  3374. //设置当前处方金额
  3375. //calculateCfAmount(tableId, totalRetprice, temporaryItemsAmount, 0, 0);
  3376. if (calculateTotalAmountFlag) {
  3377. //设置总金额
  3378. calculateTotalAmount();
  3379. }
  3380. //判断当前组号是不是最后一个,是最后一个组号,就需要新增组号
  3381. var groupIdLast = $("#groupId option:last-child").text();
  3382. if (groupId === groupIdLast) {
  3383. appendGroupOrder();
  3384. }
  3385. //设置药品的用法,频次,天数
  3386. var map = groupIdMap.get(groupId);
  3387. if (map == null) {
  3388. map = new Map();
  3389. map.put("supplyType", supplyType);
  3390. map.put("orderFrequency", orderFrequency);
  3391. map.put("dayNum", dayNum);
  3392. groupIdMap.put(groupId, map);
  3393. }
  3394. //设置当前药品的品类
  3395. $(tableId).find("input.current_groupNo").val($("#current_groupNo").val());
  3396. clearWesternMedicine(false);
  3397. }
  3398. /**
  3399. * 上移
  3400. * @param obj
  3401. */
  3402. function arrowUp(obj) {
  3403. var parentObject = $(obj).parent();
  3404. if ($(parentObject).prev() == null) {
  3405. return;
  3406. }
  3407. //当前元素的序号
  3408. var thisJcjyItemGroupId = null;
  3409. //前一个兄弟节点的序号
  3410. var prevJcjyItemGroupId = null;
  3411. //当是项目时有序号,进行序号调整
  3412. if ($(parentObject).find("span.jcjyItemGroupId") != null) {
  3413. thisJcjyItemGroupId = $(parentObject).find("span.jcjyItemGroupId").html();
  3414. prevJcjyItemGroupId = $(parentObject).prev().find("span.jcjyItemGroupId").html();
  3415. $(parentObject).find("span.jcjyItemGroupId").html(prevJcjyItemGroupId);
  3416. $(parentObject).prev().find("span.jcjyItemGroupId").html(thisJcjyItemGroupId);
  3417. }
  3418. $(parentObject).prev().before($(parentObject));
  3419. }
  3420. /**
  3421. * 下移
  3422. * @param obj
  3423. */
  3424. function arrowDown(obj) {
  3425. var parentObject = $(obj).parent();
  3426. if ($(parentObject).next() == null) {
  3427. return;
  3428. }
  3429. //当前元素的序号
  3430. var thisJcjyItemGroupId = null;
  3431. //后一个兄弟节点的序号
  3432. var afterJcjyItemGroupId = null;
  3433. //当是项目时有序号,进行序号调整
  3434. if ($(parentObject).find("span.jcjyItemGroupId") != null) {
  3435. thisJcjyItemGroupId = $(parentObject).find("span.jcjyItemGroupId").html();
  3436. afterJcjyItemGroupId = $(parentObject).after().find("span.jcjyItemGroupId").html();
  3437. $(parentObject).find("span.jcjyItemGroupId").html(afterJcjyItemGroupId);
  3438. $(parentObject).after().find("span.jcjyItemGroupId").html(thisJcjyItemGroupId);
  3439. }
  3440. $(parentObject).next().after($(parentObject));
  3441. }
  3442. /**
  3443. * 修改西药
  3444. * @param obj
  3445. */
  3446. function editWesternMedicine(obj) {
  3447. clearWesternMedicine(true);
  3448. //是新增药品还是编辑 true 修改 默认false
  3449. $("#western_medicine_update_flag").val(true);
  3450. var parentObject = $(obj).parent();
  3451. //组号
  3452. $("#groupId").val($(parentObject).find("input.temporary_items_groupId").val());
  3453. $('#groupId').selectpicker('refresh');
  3454. //药品名称
  3455. $("#western_medicine_name").val($(parentObject).find("input.temporary_items_westernMedicineNamme").val());
  3456. var code = $(parentObject).find("input.temporary_items_code").val();
  3457. var serial = $(parentObject).find("input.temporary_items_serial").val();
  3458. //当前药品编码
  3459. $("#western_medicine_current_code").val(code);
  3460. //当前药品规格
  3461. $("#western_medicine_current_serial").val(serial);
  3462. //用法编码
  3463. $("#supplyType").val($(parentObject).find("input.temporary_items_supplyType").val());
  3464. $('#supplyType').selectpicker('refresh');
  3465. //药品默认单次使用剂量
  3466. $("#drugWinDb").val($(parentObject).find("input.temporary_items_drugWinDb").val());
  3467. //处方实际单次使用剂量
  3468. $("#drugWin").val($(parentObject).find("input.temporary_items_drugWin").val());
  3469. //天数
  3470. $("#dayNum").val($(parentObject).find("input.temporary_items_dayNum").val());
  3471. $('#dayNum').selectpicker('refresh');
  3472. //频次编码
  3473. $("#orderFrequency").val($(parentObject).find("input.temporary_items_orderFrequency").val());
  3474. $('#orderFrequency').selectpicker('refresh');
  3475. //总量
  3476. $("#gross").val($(parentObject).find("input.temporary_items_gross").val());
  3477. //医嘱
  3478. $("#medicalAdvice").val($(parentObject).find("input.temporary_items_medicalAdvice").val());
  3479. $('#medicalAdvice').selectpicker('refresh');
  3480. //金额
  3481. $("#totalRetprice").val($(parentObject).find("input.temporary_items_amount").val());
  3482. //单价
  3483. $("#packRetprice").val($(parentObject).find("input.temporary_items_packRetprice").val());
  3484. //皮试结果
  3485. var tryResult = $(parentObject).find("input.temporary_items_tryResult").val();
  3486. //设置当前药品类型
  3487. $("#current_groupNo").val($(parentObject).find("input.temporary_items_currentGroupNo").val());
  3488. $.ajax({
  3489. type: "GET",
  3490. url: '/thmz/getYpZdDictByCodeAndSerial?code=' + code + "&serial=" + serial,
  3491. contentType: "application/json;charset=UTF-8",
  3492. dataType: "json",
  3493. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3494. success: function (res) {
  3495. if (res == '401' || res == 401) {
  3496. window.location.href = '/thmz/login/view'
  3497. return;
  3498. }
  3499. if (res.code == 0) {
  3500. if (res.data != null) {
  3501. var drugWinHtml = '';
  3502. if (res.data.weight != null) {
  3503. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  3504. $("#drugWin").val(res.data.weight);
  3505. $("#drugWinDb").val(res.data.weight);
  3506. }
  3507. drugWinHtml = '<option value="' + res.data.weighUnit + '" desc="' + res.data.weight + '">' + res.data.weighUnitDesc + '</option>';
  3508. }
  3509. if (res.data.volum != null) {
  3510. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  3511. $("#drugWin").val(res.data.volum);
  3512. $("#drugWinDb").val(res.data.volum);
  3513. }
  3514. drugWinHtml += '<option value="' + res.data.volUnit + '" desc="' + res.data.volum + '">' + res.data.volUnitDesc + '</option>';
  3515. }
  3516. if (res.data.miniUnit != null && res.data.miniUnit != "") {
  3517. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  3518. $("#drugWin").val(1);
  3519. $("#drugWinDb").val(1);
  3520. }
  3521. drugWinHtml += '<option value="' + res.data.miniUnit + '" desc="1">' + res.data.miniUnitDesc + '</option>';
  3522. }
  3523. $('#drugWinUnit').html(drugWinHtml);
  3524. $('#drugWinUnit').selectpicker('refresh');
  3525. //剂量单位
  3526. $("#drugWinUnit").val($(parentObject).find("input.temporary_items_drugWinUnit").val());
  3527. $('#drugWinUnit').selectpicker('refresh');
  3528. if (res.data.packUnitDesc != null && res.data.packUnitDesc != "") {
  3529. var html = '<option value="' + res.data.packUnitDesc + '" >' + res.data.packUnitDesc + '</option>';
  3530. $('#packUnit').html(html);
  3531. $('#packUnit').selectpicker('refresh');
  3532. //包装单位
  3533. $("#packUnit").val($(parentObject).find("input.temporary_items_packUnit").val());
  3534. $('#packUnit').selectpicker('refresh');
  3535. }
  3536. if (res.data.psFlag != null && (res.data.psFlag == 1 || res.data.psFlag == "1")) {
  3537. if (res.data.categoriesFlag == 0 || res.data.categoriesFlag == "0" || res.data.categoriesFlag == 2 || res.data.categoriesFlag == "2") {
  3538. initTryResultSelect(res.data.categoriesFlag);
  3539. $("#tryResult").val(tryResult);
  3540. $('#tryResult').selectpicker('refresh');
  3541. }
  3542. }
  3543. //厂家名称
  3544. $("#manufactoryName").val(res.data.manufactoryName);
  3545. //规格
  3546. $("#specification").val(res.data.specification);
  3547. }
  3548. } else {
  3549. errorMesage(res);
  3550. }
  3551. }
  3552. });
  3553. }
  3554. /**
  3555. * 修改中药
  3556. * @param obj
  3557. */
  3558. function editChineseMedicine(obj) {
  3559. //是新增药品还是编辑 true 修改 默认false
  3560. $("#chinese_medicine_update_flag").val(true);
  3561. var parentObject = $(obj).parent();
  3562. //当前药品编码
  3563. $("#chinese_medicine_current_code").val($(parentObject).find("input.temporary_items_code").val());
  3564. //当前药品规格
  3565. $("#chinese_medicine_current_serial").val($(parentObject).find("input.temporary_items_serial").val());
  3566. //中药类型
  3567. $("#zyClassType").val($(parentObject).find("input.temporary_items_zyClassType").val());
  3568. $('#zyClassType').selectpicker('refresh');
  3569. //药品名称
  3570. $("#chinese_medicine_name").val($(parentObject).find("input.temporary_items_chineseMedicineNamme").val());
  3571. //单价
  3572. $("#zy_packRetprice").val($(parentObject).find("input.temporary_items_zyPackRetprice").val());
  3573. //处方实际单次使用剂量
  3574. $("#zy_drugWin").val($(parentObject).find("input.temporary_items_drugWin").val());
  3575. //医嘱码
  3576. $("#zyInstruction").val($(parentObject).find("input.temporary_items_zyInstruction").val());
  3577. $('#zyInstruction').selectpicker('refresh');
  3578. }
  3579. /**
  3580. * 修改辅助检查、检验项目
  3581. * @param obj
  3582. */
  3583. function editJyJcItem(obj) {
  3584. //是新增药品还是编辑 true 修改 默认false
  3585. $("#jcjy_update_flag").val(true);
  3586. var parentObject = $(obj).parent();
  3587. //当前项目编码
  3588. $("#jcjy_current_code").val($(parentObject).find("input.temporary_items_code").val());
  3589. //项目名称
  3590. $("#jcJyItem").val($(parentObject).find("input.temporary_items_jcJyItemName").val());
  3591. //单价
  3592. $("#jcjyItemPrice").val($(parentObject).find("input.temporary_items_amount").val());
  3593. //备注
  3594. $("#remark").val($(parentObject).find("input.temporary_items_remark").val());
  3595. var chargeUnit = $(parentObject).find("input.temporary_items_desc_value").val();
  3596. var jcJyZltype = $(parentObject).find("input.temporary_items_type").val();
  3597. //执行科室
  3598. var execUnit = $(parentObject).find("input.temporary_items_execUnit").val();
  3599. $("#execUnit").selectpicker('val', execUnit);
  3600. $('#execUnit').selectpicker('refresh');
  3601. if (jcJyZltype == 1 || jcJyZltype == "1") {
  3602. $("#jyZdSample").selectpicker('val', chargeUnit);
  3603. $('#jyZdSample').selectpicker('refresh');
  3604. $("#jyZdSampleDiv").removeClass("hide").addClass("in");
  3605. $("#yshPartDiv").removeClass("in").addClass("hide");
  3606. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  3607. } else if (jcJyZltype == 2 || jcJyZltype == "2") {
  3608. $("#yshPart").selectpicker('val', chargeUnit);
  3609. $('#yshPart').selectpicker('refresh');
  3610. $("#yshPartDiv").removeClass("hide").addClass("in");
  3611. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  3612. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  3613. }
  3614. $("#jcJyZltype").val(jcJyZltype);
  3615. }
  3616. /**
  3617. * 修改诊疗项目
  3618. * @param obj
  3619. */
  3620. function editZlItem(obj) {
  3621. //是新增药品还是编辑 true 修改 默认false
  3622. $("#zl_update_flag").val(true);
  3623. var parentObject = $(obj).parent();
  3624. //当前项目编码
  3625. $("#zl_current_code").val($(parentObject).find("input.temporary_items_code").val());
  3626. //项目名称
  3627. $("#zlItem").val($(parentObject).find("input.temporary_items_zlItemName").val());
  3628. //单价
  3629. $("#zlItemPrice").val($(parentObject).find("input.temporary_items_amount").val());
  3630. //备注
  3631. $("#zlRemark").val($(parentObject).find("input.temporary_items_remark").val());
  3632. var chargeUnit = $(parentObject).find("input.temporary_items_desc_value").val();
  3633. //数量
  3634. var itemQuantity = $(parentObject).find("input.temporary_items_itemQuantity").val();
  3635. //执行科室
  3636. var execUnit = $(parentObject).find("input.temporary_items_execUnit").val();
  3637. $("#zlExecUnit").selectpicker('val', execUnit);
  3638. $('#zlExecUnit').selectpicker('refresh');
  3639. //描述
  3640. $("#chargeUnit").val(chargeUnit);
  3641. $("#itemQuantity").val(itemQuantity);
  3642. }
  3643. /**
  3644. * 保存当前辅助检查、检验项目到右边处方区域 需要提示加价
  3645. * @param calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  3646. */
  3647. function saveJyJcItem(calculateTotalAmountFlag) {
  3648. //6岁内提示加价
  3649. var patientAge = $("#patientAge").text();
  3650. if (calculateTotalAmountFlag && patientAge != null && patientAge != "" && patientAge < 6) {
  3651. $.ajax({
  3652. type: "GET",
  3653. url: '/thmz/checkAdditionally?code=' + $("#jcjy_current_code").val() + "&jcJyZltype=" + $("#jcJyZltype").val(),
  3654. contentType: "application/json;charset=UTF-8",
  3655. dataType: "json",
  3656. async: false,
  3657. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3658. success: function (res) {
  3659. if (res == '401' || res == 401) {
  3660. window.location.href = '/thmz/login/view'
  3661. return;
  3662. }
  3663. if (res.code == 0) {
  3664. if (res.data != undefined && res.data != null && res.data.co != null && res.data.co == 1 && res.data.xlCode != null && res.data.xlCode != "") {
  3665. var xlCode = res.data.xlCode;
  3666. xlCode = Multiply(100, xlCode);
  3667. $("#messageModal").modal();
  3668. $("#messageContent").html("根据【湘医保发〔2020〕51 号】价格通知,6岁以内的小朋友诊疗费上调" + xlCode + "%,是否需要继续添加该项目?");
  3669. $("#messageButton").off("click").on("click", function (t) {
  3670. $("#messageModal").modal("hide");
  3671. saveJyJcItemReal(calculateTotalAmountFlag);
  3672. });
  3673. $("#cancelButton").off("click");
  3674. } else {
  3675. //虽然是不满6岁,但是也没有需要加收的项目,直接保存
  3676. saveJyJcItemReal(calculateTotalAmountFlag);
  3677. }
  3678. } else {
  3679. errorMesage(res);
  3680. }
  3681. }
  3682. });
  3683. } else {
  3684. saveJyJcItemReal(calculateTotalAmountFlag);
  3685. }
  3686. }
  3687. /**
  3688. * 保存当前项目到右边处方区域
  3689. * @param calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  3690. */
  3691. function saveJyJcItemReal(calculateTotalAmountFlag) {
  3692. var tableId = $("#jcjyTab li.active").find("a").attr("href");
  3693. //组号
  3694. var groupId = $(tableId).find("div:eq(0)").children().length + 1;
  3695. //项目名称
  3696. var jcJyItem = $("#jcJyItem").val();
  3697. //当前项目编码
  3698. var currentCode = $("#jcjy_current_code").val();
  3699. //当前项目价格
  3700. var jcjyItemPrice = $("#jcjyItemPrice").val();
  3701. //执行科室
  3702. var execUnit = $("#execUnit").val();
  3703. //执行科室
  3704. var execUnitName = $('#execUnit option:selected').text();
  3705. execUnitName = execUnitName.substring(0, execUnitName.indexOf("("));
  3706. //描述编码
  3707. var chargeUnitCode = null;
  3708. var chargeUnitName = "";
  3709. //检验物或者检查部位
  3710. var chargeUnit = null;
  3711. //备注
  3712. var remark = $("#remark").val();
  3713. //项目类型
  3714. var jcJyZltype = $("#jcJyZltype").val();
  3715. if (jcJyZltype == "1" || jcJyZltype == 1) {
  3716. //检验
  3717. chargeUnit = $('#jyZdSample option:selected').text();
  3718. chargeUnit = chargeUnit.substring(0, chargeUnit.indexOf("("));
  3719. chargeUnitCode = $('#jyZdSample').val();
  3720. chargeUnitName = " 检验物:";
  3721. } else if (jcJyZltype == "2" || jcJyZltype == 2) {
  3722. //检查
  3723. chargeUnit = $('#yshPart option:selected').text();
  3724. chargeUnit = chargeUnit.substring(0, chargeUnit.indexOf("("));
  3725. chargeUnitCode = $('#yshPart').val();
  3726. chargeUnitName = " 检查部位:";
  3727. }
  3728. if (currentCode == null || currentCode == '') {
  3729. if (calculateTotalAmountFlag == true) {
  3730. errorMesageSimaple("未选择任何项目!");
  3731. }
  3732. return;
  3733. }
  3734. //判断是否有重复的项目 返回true 说明有重复的
  3735. //彩超加收一个部位的不限制多开
  3736. if ("003913" != currentCode && verifyRepeat(currentCode, null, chargeUnitCode, 2)) {
  3737. return;
  3738. }
  3739. //原药品金额 如果是修改则需要设置
  3740. var temporaryItemsAmount = 0;
  3741. //当前需要被移除元素的下个兄弟节点
  3742. var nextObj = null;
  3743. //当前修改的药品是不是最后一个
  3744. var isLast = false;
  3745. //是新增药品还是编辑 true 修改 默认false
  3746. var updateFlag = $("#jcjy_update_flag").val();
  3747. if (updateFlag == undefined || updateFlag == null) {
  3748. updateFlag = false;
  3749. }
  3750. //如果是修改,需要减去原来的费用
  3751. //原组号
  3752. var oriGroupId = null;
  3753. if (updateFlag == "true" || updateFlag == true) {
  3754. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  3755. if (formGroups != null && formGroups.length > 0) {
  3756. for (var i = 0; i < formGroups.length; i++) {
  3757. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  3758. if (temporaryItemsCode === currentCode) {
  3759. temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  3760. if (formGroups.length > 1) {
  3761. nextObj = $(formGroups[i]).next();
  3762. }
  3763. isLast = (i + 1) === formGroups.length;
  3764. oriGroupId = $(formGroups[i]).find("span.jcjyItemGroupId").text();
  3765. $(formGroups[i]).remove();
  3766. break;
  3767. }
  3768. }
  3769. }
  3770. }
  3771. if (oriGroupId != null) {
  3772. groupId = oriGroupId;
  3773. }
  3774. var html = '<div class="form-group">';
  3775. html += '<span class="jcjyItemGroupId">' + groupId + '</span>.<span style="margin-left: 5px"></span>'
  3776. html += jcJyItem + ' ';
  3777. if (jcJyZltype == "3" || jcJyZltype == 3) {
  3778. html += " 数量:" + itemQuantity;
  3779. }
  3780. if (execUnit != null && execUnit != "") {
  3781. html += " 执行科室:" + execUnitName;
  3782. }
  3783. if (chargeUnit != null && chargeUnit != '') {
  3784. html += chargeUnitName + chargeUnit;
  3785. }
  3786. if (remark != null && remark != '') {
  3787. html += ' 备注:' + remark;
  3788. }
  3789. 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>';
  3790. 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>';
  3791. 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>';
  3792. if ($("#jcJyItemChargeDetail").hasClass("in")) {
  3793. 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>';
  3794. }
  3795. 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>';
  3796. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  3797. html += '<input type="hidden" class="temporary_items_jcJyItemName" value="' + jcJyItem + '"/>';
  3798. html += '<input type="hidden" class="temporary_items_amount" value="' + jcjyItemPrice + '"/>';
  3799. html += '<input type="hidden" class="temporary_items_remark" value="' + remark + '"/>';
  3800. html += '<input type="hidden" class="temporary_items_type" value="' + jcJyZltype + '"/>';
  3801. html += '<input type="hidden" class="temporary_items_desc_value" value="' + chargeUnitCode + '"/>';
  3802. html += '<input type="hidden" class="temporary_items_execUnit" value="' + execUnit + '"/>';
  3803. html += '</div>';
  3804. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  3805. if (nextObj == null || isLast) {
  3806. $(tableId).find("div:eq(0)").append(html);
  3807. } else {
  3808. $(nextObj).before(html);
  3809. }
  3810. //设置当前处方金额
  3811. //calculateCfAmount(tableId, jcjyItemPrice, temporaryItemsAmount, 2, 0);
  3812. if (calculateTotalAmountFlag) {
  3813. //设置总金额
  3814. calculateTotalAmount();
  3815. }
  3816. clearJyJcItem();
  3817. }
  3818. /**
  3819. * 保存当前诊疗项目到右边处方区域 需要提示加价
  3820. * @param calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  3821. */
  3822. function saveZlItem(calculateTotalAmountFlag) {
  3823. //6岁内提示加价
  3824. var patientAge = $("#patientAge").text();
  3825. if (calculateTotalAmountFlag && patientAge != null && patientAge != "" && patientAge < 6) {
  3826. $.ajax({
  3827. type: "GET",
  3828. url: '/thmz/checkAdditionally?code=' + $("#zl_current_code").val() + "&jcJyZltype=3",
  3829. contentType: "application/json;charset=UTF-8",
  3830. dataType: "json",
  3831. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3832. async: false,
  3833. success: function (res) {
  3834. if (res == '401' || res == 401) {
  3835. window.location.href = '/thmz/login/view'
  3836. return;
  3837. }
  3838. if (res.code == 0) {
  3839. if (res.data != undefined && res.data != null && res.data.co != null && res.data.co == 1 && res.data.xlCode != null && res.data.xlCode != "") {
  3840. var xlCode = res.data.xlCode;
  3841. xlCode = Multiply(100, xlCode);
  3842. $("#messageModal").modal();
  3843. $("#messageContent").html("根据【湘医保发〔2020〕51 号】价格通知,6岁以内的小朋友诊疗费上调" + xlCode + "%,是否需要继续添加该项目?");
  3844. $("#messageButton").off("click").on("click", function (t) {
  3845. $("#messageModal").modal("hide");
  3846. saveZlItemReal(calculateTotalAmountFlag);
  3847. });
  3848. $("#cancelButton").off("click");
  3849. } else {
  3850. //虽然是不满6岁,但是也没有需要加收的项目,直接保存
  3851. saveZlItemReal(calculateTotalAmountFlag);
  3852. }
  3853. } else {
  3854. errorMesage(res);
  3855. }
  3856. }
  3857. });
  3858. } else {
  3859. saveZlItemReal(calculateTotalAmountFlag);
  3860. }
  3861. }
  3862. /**
  3863. * 保存当前项目到右边处方区域
  3864. * @param calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  3865. */
  3866. function saveZlItemReal(calculateTotalAmountFlag) {
  3867. var tableId = $("#zlTab li.active").find("a").attr("href");
  3868. //组号
  3869. var groupId = $(tableId).find("div:eq(0)").children().length + 1;
  3870. //项目名称
  3871. var zlItem = $("#zlItem").val();
  3872. //当前项目编码
  3873. var currentCode = $("#zl_current_code").val();
  3874. //当前项目价格
  3875. var zlItemPrice = $("#zlItemPrice").val();
  3876. //描述
  3877. var chargeUnit = $("#chargeUnit").val();
  3878. //执行科室
  3879. var zlExecUnit = $("#zlExecUnit").val();
  3880. //执行科室
  3881. var zlExecUnitName = $('#zlExecUnit option:selected').text();
  3882. zlExecUnitName = zlExecUnitName.substring(0, zlExecUnitName.indexOf("("));
  3883. //次数
  3884. var itemQuantity = $("#itemQuantity").val();
  3885. //描述编码
  3886. var chargeUnitCode = chargeUnit;
  3887. var chargeUnitName = " 描述:";
  3888. //备注
  3889. var remark = $("#zlRemark").val();
  3890. if (currentCode == null || currentCode == '') {
  3891. if (calculateTotalAmountFlag == true) {
  3892. errorMesageSimaple("未选择任何项目!");
  3893. }
  3894. return;
  3895. }
  3896. //判断是否有重复的项目 返回true 说明有重复的
  3897. if (verifyRepeat(currentCode, null, null, 3)) {
  3898. return;
  3899. }
  3900. //原药品金额 如果是修改则需要设置
  3901. var temporaryItemsAmount = 0;
  3902. //当前需要被移除元素的下个兄弟节点
  3903. var nextObj = null;
  3904. //当前修改的药品是不是最后一个
  3905. var isLast = false;
  3906. //是新增药品还是编辑 true 修改 默认false
  3907. var updateFlag = $("#zl_update_flag").val();
  3908. if (updateFlag == undefined || updateFlag == null) {
  3909. updateFlag = false;
  3910. }
  3911. //如果是修改,需要减去原来的费用
  3912. //原组号
  3913. var oriGroupId = null;
  3914. if (updateFlag == "true" || updateFlag == true) {
  3915. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  3916. if (formGroups != null && formGroups.length > 0) {
  3917. for (var i = 0; i < formGroups.length; i++) {
  3918. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  3919. if (temporaryItemsCode === currentCode) {
  3920. temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  3921. if (formGroups.length > 1) {
  3922. nextObj = $(formGroups[i]).next();
  3923. }
  3924. isLast = (i + 1) === formGroups.length;
  3925. oriGroupId = $(formGroups[i]).find("span.zlItemGroupId").text();
  3926. $(formGroups[i]).remove();
  3927. break;
  3928. }
  3929. }
  3930. }
  3931. }
  3932. if (oriGroupId != null) {
  3933. groupId = oriGroupId;
  3934. }
  3935. var html = '<div class="form-group">';
  3936. html += '<span class="zlItemGroupId">' + groupId + '</span>.<span style="margin-left: 5px"></span>'
  3937. html += zlItem + ' ';
  3938. html += " 数量:" + itemQuantity;
  3939. if (zlExecUnit != null && zlExecUnit != "") {
  3940. html += " 执行科室:" + zlExecUnitName;
  3941. }
  3942. if (chargeUnit != null && chargeUnit != '') {
  3943. html += chargeUnitName + chargeUnit;
  3944. }
  3945. if (remark != null && remark != '') {
  3946. html += ' 备注:' + remark;
  3947. }
  3948. 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>';
  3949. 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>';
  3950. html += ' <i class="fa fa-long-arrow-left" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;" onclick="editZlItem(this)"></i>';
  3951. 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>';
  3952. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  3953. html += '<input type="hidden" class="temporary_items_zlItemName" value="' + zlItem + '"/>';
  3954. html += '<input type="hidden" class="temporary_items_amount" value="' + zlItemPrice + '"/>';
  3955. html += '<input type="hidden" class="temporary_items_remark" value="' + remark + '"/>';
  3956. html += '<input type="hidden" class="temporary_items_desc_value" value="' + chargeUnitCode + '"/>';
  3957. html += '<input type="hidden" class="temporary_items_itemQuantity" value="' + itemQuantity + '"/>';
  3958. html += '<input type="hidden" class="temporary_items_execUnit" value="' + zlExecUnit + '"/>';
  3959. html += '</div>';
  3960. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  3961. if (nextObj == null || isLast) {
  3962. $(tableId).find("div:eq(0)").append(html);
  3963. } else {
  3964. $(nextObj).before(html);
  3965. }
  3966. //设置当前处方金额
  3967. //calculateCfAmount(tableId, jcjyItemPrice, temporaryItemsAmount, 2, 0);
  3968. if (calculateTotalAmountFlag) {
  3969. //设置总金额
  3970. calculateTotalAmount();
  3971. }
  3972. clearZlItem();
  3973. }
  3974. /**
  3975. * 临时保存住院证
  3976. * @param messageFlag 是否需要提醒已经存在的入院申请 true 提示
  3977. */
  3978. function saveZyReq(messageFlag) {
  3979. //如果
  3980. if ($("#zyReqTab").find("li") == null || $("#zyReqTab").find("li").length == 0) {
  3981. initNavTabs(4);
  3982. }
  3983. var tableId = $("#zyReqTab li.active").find("a").attr("href");
  3984. //病区编码
  3985. var inpatientWardBeHospitalized = $("#inpatientWardBeHospitalized").val();
  3986. //小病室编码
  3987. var smallWardBeHospitalized = $("#smallWardBeHospitalized").val();
  3988. //入院状态编码
  3989. var admissStatus = $("#admissStatus").val();
  3990. //病区名称
  3991. var inpatientWardText = $('#inpatientWardBeHospitalized option:selected').text();
  3992. //小科室名称
  3993. var smallWardText = $('#smallWardBeHospitalized option:selected').text();
  3994. //入院状态名称
  3995. var admissStatusText = $('#admissStatus option:selected').text();
  3996. if (inpatientWardBeHospitalized == null || inpatientWardBeHospitalized == '') {
  3997. errorMesageSimaple("未选择入院病区!");
  3998. return;
  3999. }
  4000. if (admissStatus == null || admissStatus == '') {
  4001. errorMesageSimaple("未选择入院状态!");
  4002. return;
  4003. }
  4004. if (messageFlag == "true" || messageFlag == true) {
  4005. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  4006. if (formGroups != null && formGroups.length > 0) {
  4007. $("#messageModal").modal();
  4008. $("#messageContent").html("当前病人已经有一个暂存的入院申请,是否需要替换该申请?");
  4009. $("#messageButton").off("click").on("click", function (t) {
  4010. $("#messageModal").modal("hide");
  4011. saveZyReq(false);
  4012. });
  4013. $("#cancelButton").off("click");
  4014. return;
  4015. }
  4016. }
  4017. var html = '<div class="form-group"> 收住院';
  4018. if (inpatientWardText != null) {
  4019. html += " [" + inpatientWardText;
  4020. }
  4021. if (smallWardText != null) {
  4022. html += " (" + smallWardText + ") ";
  4023. }
  4024. if (inpatientWardText != null) {
  4025. html += "] ";
  4026. }
  4027. if (admissStatusText != null) {
  4028. html += admissStatusText;
  4029. }
  4030. html += ' 侯床';
  4031. //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>';
  4032. 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>';
  4033. html += '<input type="hidden" class="temporary_inpatient_ward" value="' + inpatientWardBeHospitalized + '"/>';
  4034. html += '<input type="hidden" class="temporary_items_small_ward" value="' + smallWardBeHospitalized + '"/>';
  4035. html += '<input type="hidden" class="temporary_items_admiss_status" value="' + admissStatus + '"/>';
  4036. html += '</div>';
  4037. $(tableId).find("div:eq(0)").html(html);
  4038. clearZyReq();
  4039. }
  4040. /**
  4041. * 删除药品或者项目
  4042. * @param index 0 西药 1 中药 2 项目
  4043. * @param obj 当前点击的对象
  4044. */
  4045. function removeYpOrProject(index, obj) {
  4046. var tabId = null;
  4047. var className = null;
  4048. //西药
  4049. if (index == 0) {
  4050. tabId = "xyTab";
  4051. } else if (index == 1) {
  4052. //中成药
  4053. tabId = "zyTab";
  4054. } else if (index == 2) {
  4055. //辅助检查、检验
  4056. className = ".jcjyItemGroupId";
  4057. tabId = "jcjyTab";
  4058. } else if (index == 3) {
  4059. //诊疗
  4060. className = ".zlItemGroupId";
  4061. tabId = "zlTab";
  4062. } else if (index == 4) {
  4063. //入院
  4064. tabId = "zyReqTab";
  4065. }
  4066. var tableId = $("#" + tabId + " li.active").find("a").attr("href");
  4067. //var totalRetprice = $(obj).parent().find("input.temporary_items_amount").val();
  4068. //calculateCfAmount(tableId, totalRetprice, null, index, 1);
  4069. //医技和诊疗的序号调整一下
  4070. if (index == 2 || index == 3) {
  4071. var nextAll = $(obj).parent().nextAll();
  4072. if (nextAll != null && nextAll.length > 0) {
  4073. for (var i = 0; i < nextAll.length; i++) {
  4074. var index = $(nextAll[i]).find(className).text();
  4075. $(nextAll[i]).find(className).text(index - 1);
  4076. }
  4077. }
  4078. }
  4079. $(obj).parent().remove();
  4080. if (index != 4) {
  4081. calculateTotalAmount();
  4082. }
  4083. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  4084. if (formGroups == null || formGroups.length == 0) {
  4085. if (index == 0) {
  4086. //西药被清空后,重置药房类型编码
  4087. $(tableId).find("input.current_groupNo").val(null);
  4088. //当本处方内容都被删除完后,也删除处方table
  4089. $("#" + tabId).find("a[href=\"" + tableId + "\"]").parent().remove();
  4090. $(tableId).remove();
  4091. //切换处方 最后一个被选中
  4092. $("#" + tabId).find("li:last > a").off("click").tab('show');
  4093. } else if (index == 1) {
  4094. //当中药处方被清空完后,重置当前中药类型为空
  4095. $("#current_zyClassType").val(null);
  4096. }
  4097. }
  4098. }
  4099. /**
  4100. * 清空西药
  4101. * @param flag 是否全部清空 因为 西药有分组,同一组的药品用药方式和频率以及天数一样,不能改变。所以不换组是不能改变 并且设置成不可编辑
  4102. */
  4103. function clearWesternMedicine(flag) {
  4104. $("#western_medicine_update_flag").val(false);
  4105. //药品名称
  4106. $("#western_medicine_name").val(null);
  4107. //当前药品编码
  4108. $("#western_medicine_current_code").val(null);
  4109. //当前药品规格
  4110. $("#western_medicine_current_serial").val(null);
  4111. //当前药房编码
  4112. $("#current_groupNo").val(null);
  4113. if (flag) {
  4114. //用法编码
  4115. $("#supplyType").selectpicker('val', null);
  4116. $('#supplyType').selectpicker('refresh');
  4117. //$("#supplyType").removeAttr("disabled");
  4118. //天数
  4119. $("#dayNum").selectpicker('val', null);
  4120. $('#dayNum').selectpicker('refresh');
  4121. // $("#dayNum").removeAttr("disabled");
  4122. //频次编码
  4123. $("#orderFrequency").selectpicker('val', null);
  4124. $('#orderFrequency').selectpicker('refresh');
  4125. // $("#orderFrequency").removeAttr("disabled");
  4126. }
  4127. //药品默认单次使用剂量
  4128. $("#drugWinDb").val(null);
  4129. //处方实际单次使用剂量
  4130. $("#drugWin").val(null);
  4131. //剂量单位
  4132. $("#drugWinUnit").selectpicker('val', null);
  4133. $('#drugWinUnit').selectpicker('refresh');
  4134. //总量
  4135. $("#gross").val(null);
  4136. //包装单位
  4137. $("#packUnit").selectpicker('val', null);
  4138. $('#packUnit').selectpicker('refresh');
  4139. //单价
  4140. $("#packRetprice").val(null);
  4141. //金额
  4142. $("#totalRetprice").val(null);
  4143. //医嘱
  4144. $("#medicalAdvice").selectpicker('val', null);
  4145. $('#medicalAdvice').selectpicker('refresh');
  4146. $("#tryResult").parent().parent().parent().removeClass("in").addClass("hide");
  4147. //皮试结果
  4148. $("#tryResult").selectpicker('val', null);
  4149. $('#tryResult').selectpicker('refresh');
  4150. //$("#gross").attr("readonly", "readonly");
  4151. $("#manufactoryName").val(null);
  4152. $("#specification").val(null);
  4153. }
  4154. /**
  4155. * 保存当前药品到右边处方区域 中药
  4156. * calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  4157. */
  4158. function saveChineseMedicine(calculateTotalAmountFlag) {
  4159. //药品名称
  4160. var chineseMedicineNamme = $("#chinese_medicine_name").val();
  4161. //当前药品编码
  4162. var currentCode = $("#chinese_medicine_current_code").val();
  4163. //当前药品规格
  4164. var currentSerial = $("#chinese_medicine_current_serial").val();
  4165. //处方实际单次使用剂量
  4166. var drugWin = $("#zy_drugWin").val();
  4167. //医嘱码
  4168. var zyInstruction = $("#zyInstruction").val();
  4169. //医嘱
  4170. var zyInstructionText = $('#zyInstruction option:selected').text();
  4171. //单价
  4172. var zyPackRetprice = parseFloat($("#zy_packRetprice").val());
  4173. //当前中药的总价
  4174. var totalRetprice = Multiply(drugWin, zyPackRetprice);
  4175. //中药类型
  4176. var zyClassType = $("#zyClassType").val();
  4177. //已经选中的药品类型, 中药不允许一个处方里有普通中药和颗粒剂
  4178. var currentYyClassType = $("#current_zyClassType").val();
  4179. if (currentYyClassType == null || currentYyClassType == "") {
  4180. //中药此时是第一次选择药品,不控制类型
  4181. $("#current_zyClassType").val(zyClassType);
  4182. } else if (currentYyClassType != zyClassType) {
  4183. errorMesageSimaple("同一个中药处方不允许同时出现普通中药和颗粒剂中药!");
  4184. return;
  4185. }
  4186. if (currentCode == null || currentCode == '') {
  4187. errorMesageSimaple("未选择任何药品!");
  4188. return;
  4189. }
  4190. var html = '<div class="form-group" style="float: left;">';
  4191. html += chineseMedicineNamme;
  4192. if (zyInstruction != null && zyInstruction != '') {
  4193. html += '[' + zyInstructionText + ']';
  4194. }
  4195. html += '<span style="margin-left: 5px"></span>';
  4196. html += drugWin + 'g';
  4197. 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>';
  4198. 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>';
  4199. 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>';
  4200. 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>';
  4201. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  4202. html += '<input type="hidden" class="temporary_items_serial" value="' + currentSerial + '"/>';
  4203. html += '<input type="hidden" class="temporary_items_amount" value="' + totalRetprice + '"/>';
  4204. html += '<input type="hidden" class="temporary_items_zyClassType" value="' + zyClassType + '"/>';
  4205. html += '<input type="hidden" class="temporary_items_chineseMedicineNamme" value="' + chineseMedicineNamme + '"/>';
  4206. html += '<input type="hidden" class="temporary_items_zyPackRetprice" value="' + zyPackRetprice + '"/>';
  4207. html += '<input type="hidden" class="temporary_items_drugWin" value="' + drugWin + '"/>';
  4208. html += '<input type="hidden" class="temporary_items_zyInstruction" value="' + zyInstruction + '"/>';
  4209. html += '<input type="hidden" class="temporary_items_zyInstructionText" value="' + zyInstructionText + '"/>';
  4210. html += '</div>';
  4211. var tableId = $("#zyTab li.active").find("a").attr("href");
  4212. //原药品金额 如果是修改则需要设置
  4213. var temporaryItemsAmount = 0;
  4214. //当前需要被移除元素的下个兄弟节点
  4215. var nextObj = null;
  4216. //当前修改的药品是不是最后一个
  4217. var isLast = false;
  4218. //是新增药品还是编辑 true 修改 默认false
  4219. var updateFlag = $("#chinese_medicine_update_flag").val();
  4220. if (updateFlag == undefined || updateFlag == null) {
  4221. updateFlag = false;
  4222. }
  4223. //如果是修改,需要减去原来的费用
  4224. if (updateFlag == "true" || updateFlag == true) {
  4225. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  4226. if (formGroups != null && formGroups.length > 0) {
  4227. for (var i = 0; i < formGroups.length; i++) {
  4228. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  4229. var temporaryItemsSerial = $(formGroups[i]).find("input.temporary_items_serial").val();
  4230. if (temporaryItemsCode === currentCode && temporaryItemsSerial === currentSerial) {
  4231. temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  4232. if (formGroups.length > 1) {
  4233. nextObj = $(formGroups[i]).next();
  4234. }
  4235. isLast = (i + 1) === formGroups.length;
  4236. $(formGroups[i]).remove();
  4237. break;
  4238. }
  4239. }
  4240. }
  4241. }
  4242. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  4243. if (nextObj == null || isLast) {
  4244. $(tableId).find("div:eq(0)").append(html);
  4245. } else {
  4246. $(nextObj).before(html);
  4247. }
  4248. //设置当前处方金额
  4249. // calculateCfAmount(tableId, totalRetprice, temporaryItemsAmount, 1, 0);
  4250. if (calculateTotalAmountFlag) {
  4251. //设置总金额
  4252. calculateTotalAmount();
  4253. }
  4254. clearChineseMedicine();
  4255. }
  4256. /**
  4257. * 清空中药
  4258. */
  4259. function clearChineseMedicine() {
  4260. $("#chinese_medicine_update_flag").val(false);
  4261. //药品名称
  4262. $("#chinese_medicine_name").val(null);
  4263. //当前药品编码
  4264. $("#chinese_medicine_current_code").val(null);
  4265. //当前药品规格
  4266. $("#chinese_medicine_current_serial").val(null);
  4267. //医嘱
  4268. $("#zyInstruction").selectpicker('val', null);
  4269. $('#zyInstruction').selectpicker('refresh');
  4270. //剂量
  4271. $("#zy_drugWin").val(null);
  4272. //单价
  4273. $("#zy_packRetprice").val(null);
  4274. }
  4275. /**
  4276. * 清空辅助检查、检验项目
  4277. */
  4278. function clearJyJcItem() {
  4279. $("#jcjy_update_flag").val(false);
  4280. //项目名称
  4281. $("#jcJyItem").val(null);
  4282. //当前项目编码
  4283. $("#jcjy_current_code").val(null);
  4284. //单价
  4285. $("#jcjyItemPrice").val(null);
  4286. //备注
  4287. $("#remark").val(null);
  4288. $("#jcJyZltype").val(null);
  4289. $("#jyZdSample").selectpicker('val', null);
  4290. $('#jyZdSample').selectpicker('refresh');
  4291. $("#yshPart").selectpicker('val', null);
  4292. $('#yshPart').selectpicker('refresh');
  4293. $("#execUnit").selectpicker('val', null);
  4294. $('#execUnit').selectpicker('refresh');
  4295. $("#jcJyItemChargeDetail").removeClass("in").addClass("hide");
  4296. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  4297. $("#yshPartDiv").removeClass("in").addClass("hide");
  4298. }
  4299. /**
  4300. * 清空诊疗项目
  4301. */
  4302. function clearZlItem() {
  4303. $("#zl_update_flag").val(false);
  4304. //项目名称
  4305. $("#zlItem").val(null);
  4306. //当前项目编码
  4307. $("#zl_current_code").val(null);
  4308. //单价
  4309. $("#zlItemPrice").val(null);
  4310. //备注
  4311. $("#zlRemark").val(null);
  4312. //描述
  4313. $("#chargeUnit").val(null);
  4314. $("#itemQuantity").val(1);
  4315. $("#zlExecUnit").selectpicker('val', null);
  4316. $('#zlExecUnit').selectpicker('refresh');
  4317. }
  4318. /**
  4319. * 清空入院证输入框
  4320. */
  4321. function clearZyReq() {
  4322. $("#inpatientWardBeHospitalized").selectpicker('val', null);
  4323. $('#inpatientWardBeHospitalized').selectpicker('refresh');
  4324. $("#smallWardBeHospitalized").selectpicker('val', null);
  4325. $('#smallWardBeHospitalized').selectpicker('refresh');
  4326. $("#admissStatus").selectpicker('val', null);
  4327. $('#admissStatus').selectpicker('refresh');
  4328. $("#totalBedNum").val(null);
  4329. $("#freeBedNum").val(null);
  4330. $("#occupationBedNum").val(null);
  4331. initSmallDeptByDept();
  4332. }
  4333. /**
  4334. * 计算总金额
  4335. */
  4336. function calculateTotalAmount() {
  4337. //调用后去除所有的验证提示
  4338. $("div.alert ").each(function (index, obj) {
  4339. $(obj).remove();
  4340. });
  4341. var jsonData = getParamsForpPrescription(3);
  4342. $.ajax({
  4343. type: "POST",
  4344. url: '/thmz/getAmountForTempPrescription',
  4345. contentType: "application/json;charset=UTF-8",
  4346. dataType: "json",
  4347. data: JSON.stringify(jsonData),
  4348. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4349. success: function (res) {
  4350. if (res == '401' || res == 401) {
  4351. window.location.href = '/thmz/login/view'
  4352. return;
  4353. }
  4354. if (res.code == 0) {
  4355. $("#totalAmount").html(res.data.amount.toFixed(1));
  4356. var arrs = $("span.cf_amount");
  4357. for (var i = 0; i < arrs.length; i++) {
  4358. if (res.data.amountList[i] != undefined && res.data.amountList[i] != null) {
  4359. $(arrs[i]).html(res.data.amountList[i].toFixed(1));
  4360. }
  4361. }
  4362. } else {
  4363. errorMesage(res);
  4364. }
  4365. }
  4366. });
  4367. }
  4368. // /**
  4369. // * 打开住院处理窗口
  4370. // * @param data
  4371. // */
  4372. // function beHospitalized() {
  4373. // $("#beHospitalizedModal").modal();
  4374. // //根据病人门诊id查询病人的入院申请
  4375. // $.ajax({
  4376. // type: "GET",
  4377. // url: '/thmz/getMzZyReqByPatientId?patientId=' + $("#patientId").text(),
  4378. // contentType: "application/json;charset=UTF-8",
  4379. // dataType: "json",
  4380. // headers: {
  4381. // 'Accept': 'application/json',
  4382. // 'Authorization': 'Bearer ' + localStorage.getItem("token")
  4383. // },
  4384. // success: function (resZyz) {
  4385. // if (resZyz == '401' || resZyz == 401) {
  4386. // window.location.href = '/thmz/login/view'
  4387. // return;
  4388. // }
  4389. // if (resZyz.code == 0) {
  4390. // $("#icdCodeInputBeHospitalized").val(resZyz.data.icdCode);
  4391. // $("#icdTextBeHospitalized").val(resZyz.data.icdText);
  4392. // $("#icdTextBeHospitalized").attr("title", resZyz.data.icdText);
  4393. // $("#inpatientWardBeHospitalized").selectpicker('val', resZyz.data.reqDept);
  4394. // $("#inpatientWardBeHospitalized").selectpicker('refresh');
  4395. // initSmallDeptByDept();
  4396. // $("#smallWardBeHospitalized").selectpicker('val', resZyz.data.smallDept);
  4397. // $("#smallWardBeHospitalized").selectpicker('refresh');
  4398. // $("#admissStatus").selectpicker('val', resZyz.data.admissStatus);
  4399. // $("#admissStatus").selectpicker('refresh');
  4400. // $("#zyReqVisitDate").val(format(resZyz.data.visitDate, "yyyy-MM-dd HH:mm:ss"));
  4401. // }
  4402. // }
  4403. // });
  4404. // }
  4405. /**
  4406. * 打开编辑用户信息窗口
  4407. * @param data
  4408. */
  4409. function editUserModal(patientId) {
  4410. if (patientId == null) {
  4411. //医生工作台发起
  4412. patientId = $("#patientId").text();
  4413. } else {
  4414. //快速接诊界面发起
  4415. clearRapidAccepts();
  4416. }
  4417. if (patientId == null || patientId == "null" || patientId == "") {
  4418. errorMesageSimaple("请输入需要编辑的患者信息");
  4419. return;
  4420. }
  4421. $("#rapidAcceptsModal").modal("hide");
  4422. $("#editUserModal").modal();
  4423. $.ajax({
  4424. type: "GET",
  4425. url: '/thmz/getByPatientId?patientId=' + patientId,
  4426. contentType: "application/json;charset=UTF-8",
  4427. dataType: "json",
  4428. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4429. success: function (res) {
  4430. if (res == '401' || res == 401) {
  4431. window.location.href = '/thmz/login/view'
  4432. return;
  4433. }
  4434. if (res.code == 0) {
  4435. if (res.data != null) {
  4436. //延时调用,因为当前弹框还没有加载出来,校验规则无法获取光标与模拟光标丢失事件,延时可以等弹框加载出来后模拟事件
  4437. setTimeout(function () {
  4438. fillPlusPatinet(res.data);
  4439. }, 400);
  4440. }
  4441. } else {
  4442. errorMesage(res);
  4443. $("#editUserModal").modal("hide");
  4444. }
  4445. }
  4446. });
  4447. }
  4448. /**
  4449. * 处方类型按钮切换事件
  4450. * @param object
  4451. * @param objectIndex
  4452. */
  4453. function billItemButtonChange(object, objectIndex) {
  4454. $(".nav-tabs").removeClass("in").addClass("hide");
  4455. $(".tab-content").removeClass("in").addClass("hide");
  4456. $(".nav-tabs:eq(" + objectIndex + ")").removeClass("hide").addClass("in");
  4457. $(".tab-content:eq(" + objectIndex + ")").removeClass("hide").addClass("in");
  4458. $("#bill_item_group").find("button").each(function (index, element) {
  4459. if ($(element).hasClass("btn-primary")) {
  4460. $(element).removeClass("btn-primary").addClass("btn-default");
  4461. }
  4462. $("#rp_form" + index).removeClass("show").addClass("hide");
  4463. });
  4464. $("#rp_form" + objectIndex).removeClass("hide").addClass("show");
  4465. $(object).removeClass("btn-default").addClass("btn-primary");
  4466. $("#western_medicine_name").webuiPopover('hide');
  4467. $("#chinese_medicine_name").webuiPopover('hide');
  4468. $("#jcJyItem").webuiPopover('hide');
  4469. $("#zlItem").webuiPopover('hide');
  4470. if (objectIndex == 0) {
  4471. $("#western_medicine_name").focus();
  4472. //有时候调用药品多了以后,会导致一个药品处方名对应多个content显现
  4473. var paneId = $("#xyTab li.active").find("a").attr("href");
  4474. if (paneId != null) {
  4475. //去除第一个字符 #
  4476. paneId = paneId.slice(1);
  4477. xyTableOnClick(paneId)
  4478. }
  4479. } else if (objectIndex == 1) {
  4480. $("#chinese_medicine_name").focus();
  4481. } else if (objectIndex == 2) {
  4482. $("#jcJyItem").focus();
  4483. } else if (objectIndex == 3) {
  4484. $("#zlItem").focus();
  4485. } else if (objectIndex == 4) {
  4486. // $("#inpatientWardBeHospitalized").next().click();
  4487. prevEleId = "zy_req_button";
  4488. }
  4489. }
  4490. /**
  4491. * 打开快速接诊窗口
  4492. * @param data
  4493. */
  4494. function rapidAcceptsModal() {
  4495. $("#rapidAcceptsModal").modal();
  4496. //延迟触发 默认光标在卡号输入框
  4497. setTimeout('$("#rapidAcceptsUserCardNo").focus();', 500);
  4498. }
  4499. /**
  4500. * checkBox样式
  4501. */
  4502. function formatCheck() {
  4503. if ($("input.flat")[0]) {
  4504. $(document).ready(function () {
  4505. $('input.flat').iCheck({
  4506. checkboxClass: 'icheckbox_flat-blue',
  4507. radioClass: 'iradio_flat-blue'
  4508. });
  4509. });
  4510. }
  4511. }
  4512. /**
  4513. * 卡号有变化后查询病人信息
  4514. */
  4515. function queryUserInfoByCardNo() {
  4516. //当反写的id不存在,说明不是查询后的改变事件,触发查询
  4517. var rapidAcceptsUserCardNo = $("#rapidAcceptsUserCardNo").val();
  4518. var index = rapidAcceptsUserCardNo.indexOf("-");
  4519. if (($("#patientIdDb").val() == null || $("#patientIdDb").val() == "") && ((index > 0 && index == rapidAcceptsUserCardNo.length - 2) || rapidAcceptsUserCardNo.length == 8)) {
  4520. $("#cardNo").attr("title", rapidAcceptsUserCardNo);
  4521. $.ajax({
  4522. type: "GET",
  4523. url: '/thmz/getByIcCardNo?icCardNo=' + rapidAcceptsUserCardNo,
  4524. contentType: "application/json;charset=UTF-8",
  4525. dataType: "json",
  4526. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4527. success: function (res) {
  4528. if (res == '401' || res == 401) {
  4529. window.location.href = '/thmz/login/view'
  4530. return;
  4531. }
  4532. if (res.code == 0) {
  4533. if (res.data != null) {
  4534. $("#rapidAcceptsUserName").val(res.data.name);
  4535. $("#rapidAcceptsUserCode").val(res.data.patientId);
  4536. $("#patientIdDb").val(res.data.patientId);
  4537. $("#rapidAcceptsUserCardNo").val(res.data.icCardNo);
  4538. $("#rapidAcceptsUserGender").selectpicker('val', res.data.sex);
  4539. $("#rapidAcceptsUserGender").selectpicker('refresh');
  4540. $("#rapidAcceptsUserPhoneNum").val(res.data.phoneNo);
  4541. $("#rapidAcceptsUserIdCard").val(res.data.socialNo);
  4542. $('#rapidAcceptsUserCertificateType').selectpicker('val', '01');
  4543. $('#rapidAcceptsUserCertificateType').selectpicker('refresh');
  4544. $("#rapidAcceptsUserIdCard").attr("title", res.data.socialNo);
  4545. $("#rapidAcceptsUserPhoneNum").attr("title", res.data.phoneNo);
  4546. $("#rapidAcceptsUserAddress").attr("title", res.data.address);
  4547. $("#rapidAcceptsUserAddress").val(res.data.address);
  4548. $("#rapidAcceptsUserContact").val(res.data.relName);
  4549. $("#rapidAcceptsUserContactPhone").val(res.data.contractName);
  4550. //查询分诊号
  4551. $.ajax({
  4552. type: "POST",
  4553. url: '/thmz/getUnClinicWithPage',
  4554. contentType: "application/json;charset=UTF-8",
  4555. dataType: "json",
  4556. data: JSON.stringify({"patientId": res.data.patientId}),
  4557. headers: {
  4558. 'Accept': 'application/json',
  4559. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  4560. },
  4561. success: function (resFz) {
  4562. if (resFz == '401' || resFz == 401) {
  4563. window.location.href = '/thmz/login/view'
  4564. return;
  4565. }
  4566. if (resFz.code == 0) {
  4567. if (resFz.data == null || resFz.data.length == 0) {
  4568. errorMesageSimaple("没有查询到符合条件的分诊记录!");
  4569. clearRapidAcceptsModal();
  4570. return;
  4571. }
  4572. $("#mzfzSerialNo").val(resFz.data[0].serialNo);
  4573. }
  4574. }
  4575. });
  4576. } else {
  4577. errorMesageSimaple("病人信息不存在!");
  4578. }
  4579. } else {
  4580. errorMesage(res);
  4581. }
  4582. }
  4583. });
  4584. }
  4585. }
  4586. /**
  4587. * 清空快速接诊查询框
  4588. */
  4589. function clearRapidAccepts() {
  4590. $("#rapidAcceptsUserName").val(null);
  4591. $("#rapidAcceptsUserCode").val(null);
  4592. $("#patientIdDb").val(null);
  4593. $("#rapidAcceptsUserCardNo").val(null);
  4594. $("#rapidAcceptsUserGender").selectpicker('val', 0);
  4595. $("#rapidAcceptsUserGender").selectpicker('refresh');
  4596. $("#rapidAcceptsUserPhoneNum").val(null);
  4597. $("#rapidAcceptsUserIdCard").val(null);
  4598. $("#rapidAcceptsUserIdCard").attr("title", null);
  4599. $("#rapidAcceptsUserPhoneNum").attr("title", null);
  4600. $("#rapidAcceptsUserAddress").attr("title", null);
  4601. $("#mzfzSerialNo").val(null);
  4602. $("#rapidAcceptsUserCardNo").focus();
  4603. $("#rapidAcceptsUserAddress").val(null);
  4604. $("#rapidAcceptsUserContact").val(null);
  4605. $("#rapidAcceptsUserContactPhone").val(null);
  4606. }
  4607. /**
  4608. * 根据病人姓名输入框内容动态加载病人列表
  4609. */
  4610. function initUserList() {
  4611. //var width=$("#userName").css("width");
  4612. var settings = {
  4613. trigger: 'click',
  4614. content: '',
  4615. width: 170,
  4616. multi: true,
  4617. closeable: false,
  4618. style: '',
  4619. delay: 300,
  4620. padding: true,
  4621. height: 300,
  4622. };
  4623. var webuiPopover = $('#rapidAcceptsUserName').webuiPopover('destroy').webuiPopover(settings);
  4624. //用户姓名选中事件
  4625. $("#rapidAcceptsUserName").on("click", function (t) {
  4626. if ($(webuiPopover).css("display") == "block") {
  4627. refeshPatinetList(true);
  4628. }
  4629. });
  4630. }
  4631. /**
  4632. * 刷新候诊病人列表
  4633. */
  4634. function refeshPatinetList(flag) {
  4635. //如果是重新加载病人列表,需要重置下标
  4636. if (flag) {
  4637. //重置下标
  4638. pageIndex = 0;
  4639. msg_list_loading = true;
  4640. }
  4641. var userName = $('#rapidAcceptsUserName').val();
  4642. if (!(userName == null || userName == "" || isChinese(userName))) {
  4643. return;
  4644. }
  4645. $.ajax({
  4646. type: "POST",
  4647. url: '/thmz/getUnClinicWithPage',
  4648. contentType: "application/json;charset=UTF-8",
  4649. dataType: "json",
  4650. data: JSON.stringify({"name": userName, "pageIndex": pageIndex}),
  4651. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4652. success: function (res) {
  4653. if (res == '401' || res == 401) {
  4654. window.location.href = '/thmz/login/view'
  4655. return;
  4656. }
  4657. if (res.code == 0) {
  4658. if (res.data != null && res.data.length > 0) {
  4659. $("#webuiPopover0").css("display", "block");
  4660. $("#webuiPopover0 .webui-popover-content").css("max-height", "300px").css("height", "auto");
  4661. var html = '<div class="list-group">';
  4662. for (var i = 0; i < res.data.length; i++) {
  4663. var mzPatientMi = res.data[i];
  4664. html += '<a href="#" class="list-group-item list-group-item-action" onclick="fillUnClinicPatinet(\'' + mzPatientMi.patientId + '\')">';
  4665. if (mzPatientMi.gender == "男") {
  4666. html += '<img src="/thmz/images/boy.png"/>'
  4667. } else if (mzPatientMi.gender == "女") {
  4668. html += '<img src="/thmz/images/girl.png"/>'
  4669. } else if (mzPatientMi.gender == "未知" || mzPatientMi.gender == null) {
  4670. html += '<img src="/thmz/images/girl_or_boy.png"/>'
  4671. }
  4672. html += '<div>' + mzPatientMi.name + '&nbsp;' + mzPatientMi.gender + '&nbsp;';
  4673. if (mzPatientMi.age != null && mzPatientMi.age != "") {
  4674. html += mzPatientMi.age + '岁';
  4675. } else {
  4676. html += '**岁';
  4677. }
  4678. if (mzPatientMi.phoneNo != null && mzPatientMi.phoneNo != "") {
  4679. html += '<span>' + mzPatientMi.phoneNo + '</span>';
  4680. }
  4681. html += '</div></a>';
  4682. }
  4683. html += '</div>';
  4684. if (flag) {
  4685. $("#webuiPopover0 div.webui-popover-content").html("");
  4686. }
  4687. $("#webuiPopover0 div.webui-popover-content").append(html);
  4688. $("#webuiPopover0 div.arrow").css("left", "23px");
  4689. refeshPatinetListScrollEvent();
  4690. } else {
  4691. $("#webuiPopover0").css("display", "none");
  4692. }
  4693. }
  4694. //查询完成,设置加载完成
  4695. msg_list_loading = false;
  4696. }
  4697. });
  4698. }
  4699. /**
  4700. * 病人下拉列表滚动条滚动到底部时继续加载新纪录
  4701. */
  4702. function refeshPatinetListScrollEvent() {
  4703. $('.webui-popover-content').scroll(function (event) {
  4704. var top = $(this).scrollTop();
  4705. var height = $(this).height();
  4706. var scrollHeight = $(this).get(0).scrollHeight;
  4707. if (scrollHeight <= top + height) {
  4708. if (!msg_list_loading) {
  4709. msg_list_loading = true;
  4710. pageIndex = pageIndex + 1;
  4711. refeshPatinetList(false);
  4712. }
  4713. }
  4714. });
  4715. }
  4716. /**
  4717. * 按照病人id查询病人信息
  4718. * @param patientId
  4719. */
  4720. function fillUnClinicPatinet(patientId) {
  4721. $("#rapidAcceptsUserCardNo").val(patientId);
  4722. $("#webuiPopover0").css("display", "none");
  4723. queryUserInfoByCardNo();
  4724. }
  4725. /**
  4726. * 加载主诉,体格检查,诊断窗口
  4727. */
  4728. function initRecommendList() {
  4729. var width = $("#symptom").parent().css("width");
  4730. var settings = {
  4731. placement: 'bottom-right',//值: auto,top,right,bottom,left,top-right,top-left,bottom-right,bottom-left 要显示的位置
  4732. trigger: 'click', //值:click,hover 触发方式 manual 手动
  4733. content: '',//内容,内容可以是函数
  4734. width: width,
  4735. //arrow:false,//是否显示箭头
  4736. multi: true,//在页面允许其他弹出层
  4737. closeable: true,//显示关闭按钮
  4738. style: '', //值:'',inverse
  4739. delay: 300,//延迟时间, 悬浮属性才执行
  4740. padding: true,//内容填充
  4741. height: 320,
  4742. //offsetTop:10,
  4743. cache: true,//如果缓存设置为false,则popover将销毁并重新创建
  4744. };
  4745. //主诉弹窗
  4746. var symptomWebuiPopover = $('#symptom').webuiPopover('destroy').webuiPopover(settings);
  4747. //体格检查弹窗
  4748. settings.height = 260;
  4749. $('#weight').webuiPopover('destroy').webuiPopover(settings);
  4750. //诊断弹窗
  4751. settings.height = 320;
  4752. var diagnoseWebuiPopover = $('#diagnose').webuiPopover('destroy').webuiPopover(settings);
  4753. //西药弹窗
  4754. settings.width = 680;
  4755. settings.closeable = false;
  4756. settings.arrow = false;//显示箭头或不显示箭头
  4757. settings.content = '<div id="westernMedicinePopoverContent"><table id="tb_table_western_medicine"></table></div>';
  4758. //手动触发
  4759. settings.trigger = 'manual';
  4760. var westernMedicineWebuiPopover = $('#western_medicine_name').webuiPopover('destroy').webuiPopover(settings);
  4761. //中药弹窗
  4762. settings.trigger = 'click';
  4763. settings.content = '<div id="chineseMedicinePopoverContent"><table id="tb_table_chinese_medicine"></table></div>';
  4764. //手动触发
  4765. settings.trigger = 'manual';
  4766. var chineseMedicineWebuiPopover = $('#chinese_medicine_name').webuiPopover('destroy').webuiPopover(settings);
  4767. //辅助检查、检验弹窗
  4768. settings.trigger = 'manual';
  4769. settings.content = '<div id="jcJyItemPopoverContent"><table id="tb_table_jc_jy_item"></table></div>';
  4770. var jcJyItemWebuiPopover = $('#jcJyItem').webuiPopover('destroy').webuiPopover(settings);
  4771. //诊疗弹窗
  4772. settings.trigger = 'manual';
  4773. settings.content = '<div id="zlItemPopoverContent"><table id="tb_table_zl_item"></table></div>';
  4774. var zlItemWebuiPopover = $('#zlItem').webuiPopover('destroy').webuiPopover(settings);
  4775. //主诉选中事件
  4776. $("#symptom").on("click", function (t) {
  4777. if ($(symptomWebuiPopover).css("display") == "block") {
  4778. $("#webuiPopover1 div.arrow").css("left", "23px");
  4779. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">主诉</span>';
  4780. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='contentHtml'>";
  4781. html += "</div>";
  4782. html += '<div style="height: 60px; line-height: 60px; font-size: 14px;">' +
  4783. '<div style="float: left">' +
  4784. '<span style="margin-left: 20px;">内容:</span> ' +
  4785. '</div>' +
  4786. '<div style="float: left;">' +
  4787. '<select class="form-control selectpicker show-tick" id="paramsType" dropupAuto="true">' +
  4788. '<option label="常用症状" value="0">常用症状</option>' +
  4789. '<option label="常用时间" value="1">常用时间</option>' +
  4790. '<option label="常用标点" value="2">常用标点</option>' +
  4791. '<option label="常用词" value="3">常用词</option>' +
  4792. '</select> ' +
  4793. '</div>' +
  4794. '<div style="width: 200px;float: left;margin-left: 10px;">' +
  4795. '<input id="paramsNameInput" class="form-control" type="text" style="position: relative;top: 13px;height: 34px;">' +
  4796. '</div>' +
  4797. '<div style="float: left;margin-left: 10px;">' +
  4798. ' <button type="button" class="btn" onclick="saveParams();"' +
  4799. ' style="height: 30px;line-height: 15px;border-color: #2e69eb!important;color: #2e69eb;background-color: white;">' +
  4800. ' <svg class="bi" width="1em" height="1em" fill="currentColor" style="vertical-align: -.15em;margin-right: 10px!important;color: #2e69eb;">' +
  4801. ' <use xlink:href="/thmz/css/bootstrap/bootstrap-icons-1.5.0/bootstrap-icons.svg#plus-circle"></use>' +
  4802. ' </svg>' +
  4803. '新增' +
  4804. ' </button>' +
  4805. ' </div>' +
  4806. '</div>';
  4807. $("#webuiPopover1 div.webui-popover-content").html(html);
  4808. $('#paramsType').selectpicker('refresh');
  4809. $("#paramsType").parent().css("width", "140px").css("height", "34px");
  4810. $("#webuiPopover1").css("z-index", "10");
  4811. if ($("#webuiPopover1").hasClass("in")) {
  4812. loadSymptom();
  4813. }
  4814. }
  4815. //加载智能接诊模块的主诉推荐
  4816. fitSymptomData();
  4817. });
  4818. //体格检查各输入框选中事件
  4819. $("#weight,#temperature,#sphygmus,#breathe,#pressure_high,#pressure_floor,#pressure_high_left,#pressure_floor_left").on("click", function (t) {
  4820. if ($("#webuiPopover2").css("display") == "block") {
  4821. $("#webuiPopover2").css("left", $("#webuiPopover1").css("left"));
  4822. if ($("#healthCheckupContentHtml").html() == null || $("#healthCheckupContentHtml").html() == "") {
  4823. $("#webuiPopover2 div.arrow").css("left", "23px");
  4824. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">体格检查</span>';
  4825. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='healthCheckupContentHtml'>";
  4826. html += "</div>";
  4827. $("#webuiPopover2 div.webui-popover-content").html(html);
  4828. $("#webuiPopover2").css("z-index", "10");
  4829. if ($("#webuiPopover2").hasClass("in")) {
  4830. loadHealthCheckup();
  4831. }
  4832. }
  4833. //loadSymptom();
  4834. } else {
  4835. $('#weight').webuiPopover('show');
  4836. $("#webuiPopover2").css("left", $("#webuiPopover1").css("left"));
  4837. if ($("#healthCheckupContentHtml").html() == null || $("#healthCheckupContentHtml").html() != "") {
  4838. $("#webuiPopover2 div.arrow").css("left", "23px");
  4839. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">体格检查</span>';
  4840. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='healthCheckupContentHtml'>";
  4841. html += "</div>";
  4842. $("#webuiPopover2 div.webui-popover-content").html(html);
  4843. $("#webuiPopover2").css("z-index", "10");
  4844. if ($("#webuiPopover2").hasClass("in")) {
  4845. loadHealthCheckup();
  4846. }
  4847. }
  4848. }
  4849. return false;
  4850. });
  4851. //诊断选中事件
  4852. $("#diagnose").on("click", function (t) {
  4853. if ($(diagnoseWebuiPopover).css("display") == "block") {
  4854. $("#webuiPopover3 div.arrow").css("left", "23px");
  4855. $("#webuiPopover3 a.close").css("margin-top", "15px");
  4856. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">诊断</span>';
  4857. html += '<div class="form-group has-feedback" style="float: right;width: 300px;margin-right: 20px;margin-top: 10px;">' +
  4858. ' <input type="text" class="form-control has-feedback-left" ' +
  4859. ' placeholder="搜索" style="padding-left: 10px;" oninput="loadDiagnose(this.value)" id="paramsDiagnose">' +
  4860. ' <span class="fa fa-search form-control-feedback right" aria-hidden="true" style="right: 0px;"></span>' +
  4861. ' </div>';
  4862. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='diagnoseContentHtml'>";
  4863. html += "</div>";
  4864. $("#webuiPopover3 div.webui-popover-content").html(html);
  4865. $("#webuiPopover3").css("z-index", "10");
  4866. //$("#paramsDiagnose").on('input propertychange', loadDiagnose($("#paramsDiagnose").val()));
  4867. loadDiagnose("");
  4868. }
  4869. //加载智能接诊模块的诊断推荐推荐
  4870. fitDiagnoseData();
  4871. });
  4872. //现病史选中事件
  4873. $("#emrHpi").on("click", function (t) {
  4874. //加载智能接诊模块的现病史推荐推荐
  4875. fitEmrHpiData();
  4876. });
  4877. //既往史选中事件
  4878. $("#emrPs").on("click", function (t) {
  4879. //加载智能接诊模块的既往史推荐推荐
  4880. fitEmrPsData();
  4881. });
  4882. // //西药选中事件
  4883. // $("#western_medicine_name").on("click", function (t) {
  4884. // if ($(westernMedicineWebuiPopover).css("display") == "block") {
  4885. // $("#westernMedicinePopoverContent").parent().parent().prev().css("left", "23px");
  4886. // loadYpList(0);
  4887. // }
  4888. // });
  4889. // //中药选中事件
  4890. // $("#chinese_medicine_name").on("click", function (t) {
  4891. // if ($(chineseMedicineWebuiPopover).css("display") == "block") {
  4892. // $("#chineseMedicinePopoverContent").parent().parent().prev().css("left", "23px");
  4893. // loadYpList(1);
  4894. // }
  4895. // });
  4896. // //诊疗与医技弹窗选中事件
  4897. // $("#jcJyItem").on("click", function (t) {
  4898. // if ($(jcJyItemWebuiPopover).css("display") == "block") {
  4899. // $("#jcJyItemPopoverContent").parent().parent().prev().css("left", "23px");
  4900. // loadjcJyItemList();
  4901. // }
  4902. // });
  4903. //帮助字典弹窗
  4904. settings.width = 450;
  4905. settings.height = 500;
  4906. settings.placement = 'right';//值: auto,top,right,bottom,left,top-right,top-left,bottom-right,bottom-left 要显示的位置
  4907. settings.content = '<div id="treePopoverContent"><div><ul id="treeDemo" class="ztree"></ul></div></div>';
  4908. settings.trigger = 'click';
  4909. var treeWebuiPopover = $('#treeButton').webuiPopover('destroy').webuiPopover(settings);
  4910. $("#treeButton").on("click", function (t) {
  4911. // $("#treePopoverContent").parent().parent().prev().css("left", "23px");
  4912. //初始化药品,检查检验菜单树
  4913. initzTree();
  4914. });
  4915. }
  4916. /**
  4917. * 新增通用参数
  4918. */
  4919. function saveParams() {
  4920. $.ajax({
  4921. type: "POST",
  4922. url: '/thmz/saveTCommonParams',
  4923. contentType: "application/json;charset=UTF-8",
  4924. dataType: "json",
  4925. data: JSON.stringify({
  4926. "paramsType": $("#paramsType").val(),
  4927. "paramsName": $("#paramsNameInput").val()
  4928. }),
  4929. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4930. success: function (res) {
  4931. if (res == '401' || res == 401) {
  4932. window.location.href = '/thmz/login/view'
  4933. return;
  4934. }
  4935. if (res.code == 0) {
  4936. successMesage(res);
  4937. loadSymptom();
  4938. $("#paramsNameInput").val(null);
  4939. // $("#paramsType").selectpicker('val', 0);
  4940. // $("#paramsType").selectpicker('refresh');
  4941. } else {
  4942. errorMesage(res);
  4943. }
  4944. }
  4945. });
  4946. }
  4947. /**
  4948. * 加载主诉参数列表
  4949. */
  4950. function loadSymptom() {
  4951. $.ajax({
  4952. type: "GET",
  4953. url: '/thmz/loadSymptom',
  4954. contentType: "application/json;charset=UTF-8",
  4955. dataType: "json",
  4956. async: false,
  4957. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4958. success: function (res) {
  4959. if (res == '401' || res == 401) {
  4960. window.location.href = '/thmz/login/view'
  4961. return;
  4962. }
  4963. var html = '';
  4964. if (res.code == 0) {
  4965. if (res.featureList != null && res.featureList.length > 0) {
  4966. html += '<div id="feature">';
  4967. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用症状:</div>';
  4968. html += '<div style="width: calc(100% - 80px); float: left;">';
  4969. for (var i = 0; i < res.featureList.length; i++) {
  4970. 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;">';
  4971. html += res.featureList[i].paramsName;
  4972. html += '</span></button>';
  4973. }
  4974. html += '</div><div style="clear:both"></div></div>';
  4975. }
  4976. if (res.timeList != null && res.timeList.length > 0) {
  4977. html += '<div id="time">';
  4978. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用时间:</div>';
  4979. html += '<div style="width: calc(100% - 80px); float: left;">';
  4980. for (var i = 0; i < res.timeList.length; i++) {
  4981. 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;">';
  4982. html += res.timeList[i].paramsName;
  4983. html += '</span></button>';
  4984. }
  4985. html += '</div><div style="clear:both"></div></div>';
  4986. }
  4987. if (res.characterList != null && res.characterList.length > 0) {
  4988. html += '<div id="character">';
  4989. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用标点:</div>';
  4990. html += '<div style="width: calc(100% - 80px); float: left;">';
  4991. for (var i = 0; i < res.characterList.length; i++) {
  4992. 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;">';
  4993. html += res.characterList[i].paramsName;
  4994. html += '</span></button>';
  4995. }
  4996. html += '</div><div style="clear:both"></div></div>';
  4997. }
  4998. if (res.wordsList != null && res.wordsList.length > 0) {
  4999. html += '<div id="words">';
  5000. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用词:</div>';
  5001. html += '<div style="width: calc(100% - 80px); float: left;">';
  5002. for (var i = 0; i < res.wordsList.length; i++) {
  5003. 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;">';
  5004. html += res.wordsList[i].paramsName;
  5005. html += '</span></button>';
  5006. }
  5007. html += '</div><div style="clear:both"></div></div>';
  5008. }
  5009. } else {
  5010. errorMesage(res);
  5011. }
  5012. $("#contentHtml").html(html);
  5013. }
  5014. });
  5015. }
  5016. /**
  5017. * 加载体格检查参数列表
  5018. */
  5019. function loadHealthCheckup() {
  5020. $.ajax({
  5021. type: "GET",
  5022. url: '/thmz/loadHealthCheckup',
  5023. contentType: "application/json;charset=UTF-8",
  5024. dataType: "json",
  5025. async: false,
  5026. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5027. success: function (res) {
  5028. if (res == '401' || res == 401) {
  5029. window.location.href = '/thmz/login/view'
  5030. return;
  5031. }
  5032. var html = '';
  5033. if (res.code == 0) {
  5034. if (res.weightList != null && res.weightList.length > 0) {
  5035. html += '<div id="weightDiv">';
  5036. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">体重:</div>';
  5037. html += '<div style="width: calc(100% - 80px); float: left;">';
  5038. for (var i = 0; i < res.weightList.length; i++) {
  5039. 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;">';
  5040. html += res.weightList[i].paramsName;
  5041. html += '</span></button>';
  5042. }
  5043. html += '</div><div style="clear:both"></div></div>';
  5044. }
  5045. if (res.temperatureList != null && res.temperatureList.length > 0) {
  5046. html += '<div id="temperatureDiv">';
  5047. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">体温:</div>';
  5048. html += '<div style="width: calc(100% - 80px); float: left;">';
  5049. for (var i = 0; i < res.temperatureList.length; i++) {
  5050. 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;">';
  5051. html += res.temperatureList[i].paramsName;
  5052. html += '</span></button>';
  5053. }
  5054. html += '</div><div style="clear:both"></div></div>';
  5055. }
  5056. if (res.sphygmusList != null && res.sphygmusList.length > 0) {
  5057. html += '<div id="sphygmusDiv">';
  5058. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">脉搏:</div>';
  5059. html += '<div style="width: calc(100% - 80px); float: left;">';
  5060. for (var i = 0; i < res.sphygmusList.length; i++) {
  5061. 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;">';
  5062. html += res.sphygmusList[i].paramsName;
  5063. html += '</span></button>';
  5064. }
  5065. html += '</div><div style="clear:both"></div></div>';
  5066. }
  5067. if (res.breatheList != null && res.breatheList.length > 0) {
  5068. html += '<div id="breatheDiv">';
  5069. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">呼吸:</div>';
  5070. html += '<div style="width: calc(100% - 80px); float: left;">';
  5071. for (var i = 0; i < res.breatheList.length; i++) {
  5072. 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;">';
  5073. html += res.breatheList[i].paramsName;
  5074. html += '</span></button>';
  5075. }
  5076. html += '</div><div style="clear:both"></div></div>';
  5077. }
  5078. if (res.pressureList != null && res.pressureList.length > 0) {
  5079. html += '<div id="pressureDiv">';
  5080. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">血压:</div>';
  5081. html += '<div style="width: calc(100% - 80px); float: left;">';
  5082. for (var i = 0; i < res.pressureList.length; i++) {
  5083. 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;">';
  5084. html += res.pressureList[i].paramsName;
  5085. html += '</span></button>';
  5086. }
  5087. html += '</div><div style="clear:both"></div></div>';
  5088. }
  5089. } else {
  5090. errorMesage(res);
  5091. }
  5092. $("#healthCheckupContentHtml").html(html);
  5093. }
  5094. });
  5095. }
  5096. /**
  5097. * 加载诊断参数列表
  5098. * @param value
  5099. */
  5100. function loadDiagnose(value) {
  5101. if (!$("#webuiPopover3").hasClass("in")) {
  5102. return;
  5103. }
  5104. $.ajax({
  5105. type: "GET",
  5106. url: '/thmz/getTCommonParamsByParamsType?paramsType=4&commonParams=' + value + '&pageSize=100',
  5107. contentType: "application/json;charset=UTF-8",
  5108. dataType: "json",
  5109. async: false,
  5110. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5111. success: function (res) {
  5112. if (res == '401' || res == 401) {
  5113. window.location.href = '/thmz/login/view'
  5114. return;
  5115. }
  5116. var html = '';
  5117. if (res.code == 0) {
  5118. if (res.data != null && res.data.length > 0) {
  5119. html += '<div>';
  5120. for (var i = 0; i < res.data.length; i++) {
  5121. 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;">';
  5122. html += res.data[i].paramsName;
  5123. html += '<small>&nbsp;&nbsp;(' + res.data[i].paramsCode + ')</small>';
  5124. html += '</span></button>';
  5125. }
  5126. html += '</div>';
  5127. }
  5128. } else {
  5129. errorMesage(res);
  5130. }
  5131. $("#diagnoseContentHtml").html(html);
  5132. }
  5133. });
  5134. }
  5135. /**
  5136. * 填充诊断
  5137. * @param value
  5138. * @param code
  5139. */
  5140. function fitDiagnoseValue(value, code) {
  5141. if (code === null || code === "") {
  5142. return;
  5143. }
  5144. var html = '';
  5145. var childrenNum = $("#diagnoseTags").children().length;
  5146. if (childrenNum == 6) {
  5147. errorMesageSimaple("最多填写六个诊断!");
  5148. return;
  5149. }
  5150. var diagnoseValue = $("#diagnoseValue").val();
  5151. if (diagnoseValue == null || diagnoseValue == "") {
  5152. diagnoseValue = code;
  5153. } else {
  5154. if (diagnoseValue.indexOf(code) != -1) {
  5155. errorMesageSimaple("诊断已存在,请勿重复添加!");
  5156. return;
  5157. }
  5158. diagnoseValue += "," + code;
  5159. }
  5160. $("#diagnoseValue").val(diagnoseValue);
  5161. if (childrenNum == 0) {
  5162. html += '<span class="el-tag--mainDiagnosis" ';
  5163. } else {
  5164. html += '<span class="el-tag--secondaryDiagnosis" ';
  5165. }
  5166. 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>';
  5167. $("#diagnoseTags").append(html);
  5168. $("#diagnoseTags").parent().parent().css("height", $("#diagnoseTags").height());
  5169. }
  5170. /**
  5171. * 移除诊断
  5172. * @param code
  5173. */
  5174. function removeDiagnoseValue(code) {
  5175. var childrenIndex = 0;
  5176. var children = $("#diagnoseTags").children();
  5177. for (var i = 0; i < children.length; i++) {
  5178. if ($(children[i]).attr("id") == code) {
  5179. childrenIndex = i;
  5180. break;
  5181. }
  5182. }
  5183. $($("#diagnoseTags").children("span")[childrenIndex]).remove();
  5184. if (childrenIndex == 0) {
  5185. $($("#diagnoseTags").children("span")[childrenIndex]).removeClass("el-tag--secondaryDiagnosis").addClass("el-tag--mainDiagnosis");
  5186. }
  5187. var diagnoseValue = $("#diagnoseValue").val();
  5188. $("#diagnoseValue").val(diagnoseValue.replace(code, ""));
  5189. $("#diagnoseTags").parent().parent().css("height", $("#diagnoseTags").height());
  5190. }
  5191. /**
  5192. * 点击通用参数属性值时设置值到对应的区域
  5193. * @param value
  5194. * @param id
  5195. */
  5196. function fitValue(value, id) {
  5197. //当选择的是血压时
  5198. if (id == "pressure_") {
  5199. var arr = value.split("/");
  5200. $("#pressure_high").val(arr[0]);
  5201. $("#pressure_floor").val(arr[1]);
  5202. if ($("#pressureLeftFlag").hasClass("in")) {
  5203. $("#pressure_high_left").val(arr[0]);
  5204. $("#pressure_floor_left").val(arr[1]);
  5205. }
  5206. //当选的是体重,体温,脉搏和呼吸时
  5207. } else if (id == "weight" || id == "temperature" || id == "sphygmus" || id == "breathe") {
  5208. $("#" + id).val(value);
  5209. } else {
  5210. //主诉拼写时
  5211. var valueExist = $("#" + id).val();
  5212. if (valueExist != null && valueExist != "") {
  5213. value = valueExist + value;
  5214. }
  5215. $("#" + id).val(value);
  5216. }
  5217. }
  5218. /**
  5219. * 加载药品列表数列表
  5220. * @param index
  5221. */
  5222. function loadYpList(index, event) {
  5223. if (event != null) {
  5224. if (event.keyCode == 38 || event.keyCode == 40 || event.keyCode == 13) {
  5225. //上下键不刷新表格
  5226. return;
  5227. }
  5228. }
  5229. var medicinePopoverContent = null;
  5230. var tableMedicine = null;
  5231. var MedicineName = null;
  5232. //var groupNo=null;
  5233. if (index == 0) {
  5234. medicinePopoverContent = "westernMedicinePopoverContent";
  5235. tableMedicine = "tb_table_western_medicine";
  5236. MedicineName = "western_medicine_name";
  5237. // groupNo=71;
  5238. }
  5239. if (index == 1) {
  5240. medicinePopoverContent = "chineseMedicinePopoverContent";
  5241. tableMedicine = "tb_table_chinese_medicine";
  5242. MedicineName = "chinese_medicine_name";
  5243. // groupNo=$("#zyClassType").val();
  5244. }
  5245. // if (!$("#" + medicinePopoverContent).parent().parent().parent().hasClass("in")) {
  5246. // return;
  5247. // }
  5248. $('#' + MedicineName).webuiPopover('show');
  5249. $('#' + tableMedicine).bootstrapTable('refresh');
  5250. $('#' + tableMedicine).bootstrapTable({
  5251. url: '/thmz/getYpListByCommonParams', //请求后台的URL(*)
  5252. method: 'GET', //请求方式(*)
  5253. toolbar: '#toolbar', //工具按钮用哪个容器
  5254. striped: true, //是否显示行间隔色
  5255. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  5256. pagination: false, //是否显示分页(*)
  5257. sortable: true, //是否启用排序
  5258. sortOrder: "asc", //排序方式
  5259. queryParams: function (params) {
  5260. var groupNo = null;
  5261. if (index == 0) {
  5262. groupNo = 71;
  5263. }
  5264. if (index == 1) {
  5265. groupNo = $("#zyClassType").val();
  5266. }
  5267. var temp = {
  5268. groupNo: groupNo,
  5269. commonParams: $("#" + MedicineName).val()
  5270. };
  5271. return temp;
  5272. }, //传递参数(*)
  5273. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  5274. pageNumber: 1, //初始化加载第一页,默认第一页
  5275. pageSize: 5, //每页的记录行数(*)
  5276. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  5277. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  5278. strictSearch: true,
  5279. showColumns: false, //是否显示所有的列
  5280. showRefresh: false, //是否显示刷新按钮
  5281. minimumCountColumns: 2, //最少允许的列数
  5282. clickToSelect: true, //是否启用点击选中行
  5283. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  5284. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  5285. cardView: false, //是否显示详细视图
  5286. detailView: false,
  5287. //rowStyle:rowStyle,//通过自定义函数设置行样式
  5288. ajaxOptions: {
  5289. headers: {
  5290. 'Accept': 'application/json',
  5291. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  5292. }
  5293. },
  5294. columns: [
  5295. {
  5296. field: 'code',
  5297. title: '编码',
  5298. align: "center",
  5299. valign: 'middle',
  5300. // sortable: true
  5301. }, {
  5302. field: 'name',
  5303. title: '药品名称',
  5304. align: "center",
  5305. valign: 'middle',
  5306. // sortable: true
  5307. }
  5308. , {
  5309. field: 'specification',
  5310. title: '规格',
  5311. align: "center",
  5312. valign: 'middle',
  5313. // sortable: true
  5314. }, {
  5315. field: 'manufactory',
  5316. title: '生产厂家',
  5317. align: "center",
  5318. valign: 'middle',
  5319. // sortable: true
  5320. }, {
  5321. field: 'miniUnitName',
  5322. title: '单位',
  5323. align: "center",
  5324. valign: 'middle',
  5325. // sortable: true
  5326. }, {
  5327. field: 'chargeAmount',
  5328. title: '零售价',
  5329. align: "center",
  5330. valign: 'middle',
  5331. // sortable: true
  5332. formatter: function (value, row, index) {
  5333. if (value == null) {
  5334. return '0.0元';
  5335. }
  5336. return value.toFixed(2) + "元";
  5337. }
  5338. }, {
  5339. field: 'drugWinDesc',
  5340. title: '剂量',
  5341. align: "center",
  5342. valign: 'middle',
  5343. // sortable: true
  5344. }, {
  5345. field: 'stockAmountVirtual',
  5346. title: '库存数量',
  5347. align: "center",
  5348. valign: 'middle',
  5349. // sortable: true
  5350. }
  5351. ],
  5352. responseHandler: function (res) {
  5353. if (res == '401' || res == 401) {
  5354. window.location.href = '/thmz/login/view'
  5355. return;
  5356. }
  5357. var ress = eval(res);
  5358. if (ress.code == -1) {
  5359. errorMesage(res);
  5360. return {
  5361. "total": 0,//总页数
  5362. "rows": {} //数据
  5363. };
  5364. }
  5365. $("#" + medicinePopoverContent).parent().css("background", "#EBEBE4");
  5366. return {
  5367. "total": ress.data.length,//总页数
  5368. "rows": ress.data //数据
  5369. };
  5370. },
  5371. onClickRow: function (row, $element) {
  5372. $('#' + MedicineName).webuiPopover('hide');
  5373. if (index == 0) {
  5374. checkYpInfo(row.code, row.serial, row.ypType, true, null);
  5375. }
  5376. if (index == 1) {
  5377. checkZyInfo(row.code, row.serial, true);
  5378. }
  5379. }
  5380. });
  5381. }
  5382. /**
  5383. * 按照药品的编码 和药品拆零规格查询药品信息 西药
  5384. * @param code
  5385. * @param serial
  5386. * @param groupNo
  5387. * @param needNotice 是否需要提示 当用户操作的时候 true 需要提示, 范文和处方回写的时候false不需要提示
  5388. * @param orderNo 处方号,回写的时候需要用,因为有的处方没有满5个
  5389. */
  5390. function checkYpInfo(code, serial, groupNo, needNotice, orderNo) {
  5391. //判断是否有重复的项目 返回true 说明有重复的
  5392. if (verifyRepeat(code, serial, null, 0)) {
  5393. return;
  5394. }
  5395. $("#current_groupNo").val(groupNo);
  5396. //不需要每次都关闭这个帮助字典
  5397. //$("#treeButton").webuiPopover('hide');
  5398. $.ajax({
  5399. type: "GET",
  5400. url: '/thmz/getYpZdDictByCodeAndSerial?code=' + code + "&serial=" + serial,
  5401. contentType: "application/json;charset=UTF-8",
  5402. dataType: "json",
  5403. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5404. async: needNotice,//当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  5405. success: function (res) {
  5406. if (res == '401' || res == 401) {
  5407. window.location.href = '/thmz/login/view'
  5408. return;
  5409. }
  5410. if (res.code == 0) {
  5411. if (res.data != null) {
  5412. //如果
  5413. if ($("#xyTab").find("li") == null || $("#xyTab").find("li").length == 0) {
  5414. initNavTabs(0);
  5415. }
  5416. var cfdesc = '普药';
  5417. if (groupNo == '91') {
  5418. cfdesc = '医材';
  5419. } else if (groupNo == '111') {
  5420. cfdesc = '麻、精一';
  5421. } else if (groupNo == '131') {
  5422. cfdesc = '精二';
  5423. }
  5424. // else if(groupNo=='151'){
  5425. // cfdesc='诊疗';
  5426. // }
  5427. //每个处方不能超过5个药品
  5428. var tableId = $("#xyTab li.active").find("a").attr("href");
  5429. var childrens = $(tableId).find("div:eq(0)").children().length;
  5430. var currentGroupNo = $(tableId).find("input.current_groupNo").val();
  5431. if (childrens === 5) {
  5432. if (needNotice) {
  5433. $("#messageModal").modal();
  5434. $("#messageContent").html("单张处方最多只能开具5个药品,是否需要新增处方?");
  5435. $("#messageButton").off("click").on("click", function (t) {
  5436. $("#messageModal").modal("hide");
  5437. refreshNavTabs(0, groupNo);
  5438. fitWesternMedicine(res, groupNo);
  5439. // //选中药品后,光标默认到用法
  5440. // $("#supplyType").next().click();
  5441. });
  5442. $("#cancelButton").off("click");
  5443. } else {
  5444. refreshNavTabs(0, groupNo);
  5445. fitWesternMedicine(res, groupNo);
  5446. }
  5447. } else if (currentGroupNo != null && currentGroupNo != '' && groupNo != currentGroupNo) {
  5448. //当前编辑的处方与选中的品类非同一处方能保存的
  5449. var currentGroupNos = $("#xyTabContent").find("input.current_groupNo");
  5450. //是否需要新增处方页,以保存医材处方
  5451. var needAddTable = true;
  5452. for (var i = 0; i < currentGroupNos.length; i++) {
  5453. if ($(currentGroupNos[i]).val() == groupNo) {
  5454. var next = $(currentGroupNos[i]).next();
  5455. if (needAddTable && $(next).children().length < 5) {
  5456. var parentId = $(currentGroupNos[i]).parent().attr("id");
  5457. //切换处方
  5458. $("#xyTab").find("a[href='#" + parentId + "']").off("click").tab('show');
  5459. //因为存在没有满5个的处方页,直接保存到该页
  5460. needAddTable = false;
  5461. fitWesternMedicine(res, groupNo);
  5462. }
  5463. }
  5464. }
  5465. if (needAddTable) {
  5466. //91 医材
  5467. var message = "医材需要单独处方,是否需要新增医材处方?";
  5468. if (groupNo == '71') {
  5469. message = "普通西成药需要单独处方,是否需要新增处方?"
  5470. } else if (groupNo == '111') {
  5471. message = "麻、精一药物需要单独处方,是否需要新增处方?"
  5472. } else if (groupNo == '131') {
  5473. message = "精二药物需要单独处方,是否需要新增处方?"
  5474. }
  5475. if (needNotice) {
  5476. $("#messageModal").modal();
  5477. $("#messageContent").html(message);
  5478. $("#messageButton").off("click").on("click", function (t) {
  5479. $("#messageModal").modal("hide");
  5480. refreshNavTabs(0, groupNo);
  5481. fitWesternMedicine(res, groupNo);
  5482. // //选中药品后,光标默认到用法
  5483. // $("#supplyType").next().click();
  5484. });
  5485. $("#cancelButton").off("click");
  5486. } else {
  5487. refreshNavTabs(0, groupNo);
  5488. fitWesternMedicine(res, groupNo);
  5489. }
  5490. }
  5491. //当前编辑的处方非普通西药处方
  5492. } else {
  5493. //修改药品
  5494. if (orderNo != null) {
  5495. //西药处方数量
  5496. var xyTabLiLength = $("#xyTab li").length;
  5497. if (xyTabLiLength < orderNo) {
  5498. refreshNavTabs(0, groupNo);
  5499. } else {
  5500. $("#xyTab li.active").find("a").find("small.cfdesc").text("(" + cfdesc + ")");
  5501. }
  5502. fitWesternMedicine(res, groupNo);
  5503. } else {
  5504. $("#xyTab li.active").find("a").find("small.cfdesc").text("(" + cfdesc + ")");
  5505. fitWesternMedicine(res, groupNo);
  5506. }
  5507. }
  5508. // if (needNotice) {
  5509. // //选中药品后,光标默认到用法
  5510. // $("#supplyType").next().click();
  5511. // // prevEleId = 'supplyType';
  5512. // }
  5513. }
  5514. } else {
  5515. errorMesage(res);
  5516. }
  5517. }
  5518. });
  5519. }
  5520. /**
  5521. * 按照药品的编码 和药品拆零规格查询药品信息 中药
  5522. * @param code
  5523. * @param serial
  5524. * @param async 当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  5525. */
  5526. function checkZyInfo(code, serial, async) {
  5527. //判断是否有重复的项目 返回true 说明有重复的
  5528. if (verifyRepeat(code, serial, null, 1)) {
  5529. return;
  5530. }
  5531. $.ajax({
  5532. type: "GET",
  5533. url: '/thmz/getYpZdDictByCodeAndSerial?code=' + code + "&serial=" + serial,
  5534. contentType: "application/json;charset=UTF-8",
  5535. dataType: "json",
  5536. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5537. async: async,//当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  5538. success: function (res) {
  5539. if (res == '401' || res == 401) {
  5540. window.location.href = '/thmz/login/view'
  5541. return;
  5542. }
  5543. if (res.code == 0) {
  5544. if (res.data != null) {
  5545. //如果
  5546. if ($("#zyTab").find("li") == null || $("#zyTab").find("li").length == 0) {
  5547. initNavTabs(1);
  5548. //$("input.zyfs").val(1);
  5549. }
  5550. $("#chinese_medicine_name").val(res.data.name);
  5551. $("#chinese_medicine_name").blur();
  5552. //$("#zy_drugWin").val(res.data.weight);
  5553. $("#zy_packRetprice").val(res.data.packRetprice);
  5554. $("#chinese_medicine_current_code").val(res.data.code);
  5555. $("#chinese_medicine_current_serial").val(res.data.serial);
  5556. if (async) {
  5557. //选中药品后,光标默认到数量输入框
  5558. $("#zy_drugWin").focus();
  5559. // prevEleId = 'zy_drugWin';
  5560. }
  5561. }
  5562. } else {
  5563. errorMesage(res);
  5564. }
  5565. }
  5566. });
  5567. }
  5568. /**
  5569. * 加载辅助检查、检验列表
  5570. * @param index
  5571. */
  5572. function loadjcJyItemList(event) {
  5573. if (event != null) {
  5574. if (event.keyCode == 38 || event.keyCode == 40 || event.keyCode == 13) {
  5575. //上下键不刷新表格
  5576. return;
  5577. }
  5578. }
  5579. // if (!$("#jcJyItemPopoverContent").parent().parent().parent().hasClass("in")) {
  5580. // return;
  5581. // }
  5582. $('#jcJyItem').webuiPopover('show');
  5583. $('#tb_table_jc_jy_item').bootstrapTable('refresh');
  5584. $('#tb_table_jc_jy_item').bootstrapTable({
  5585. url: '/thmz/getJcJyItemByCommonParams', //请求后台的URL(*)
  5586. method: 'GET', //请求方式(*)
  5587. toolbar: '#toolbar', //工具按钮用哪个容器
  5588. striped: true, //是否显示行间隔色
  5589. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  5590. pagination: false, //是否显示分页(*)
  5591. sortable: true, //是否启用排序
  5592. sortOrder: "asc", //排序方式
  5593. queryParams: function (params) {
  5594. var temp = {
  5595. commonParams: $("#jcJyItem").val()
  5596. };
  5597. return temp;
  5598. }, //传递参数(*)
  5599. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  5600. pageNumber: 1, //初始化加载第一页,默认第一页
  5601. pageSize: 5, //每页的记录行数(*)
  5602. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  5603. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  5604. strictSearch: true,
  5605. showColumns: false, //是否显示所有的列
  5606. showRefresh: false, //是否显示刷新按钮
  5607. minimumCountColumns: 2, //最少允许的列数
  5608. clickToSelect: true, //是否启用点击选中行
  5609. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  5610. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  5611. cardView: false, //是否显示详细视图
  5612. detailView: false,
  5613. //rowStyle:rowStyle,//通过自定义函数设置行样式
  5614. ajaxOptions: {
  5615. headers: {
  5616. 'Accept': 'application/json',
  5617. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  5618. }
  5619. },
  5620. columns: [
  5621. {
  5622. field: 'code',
  5623. title: '编码',
  5624. align: "center",
  5625. valign: 'middle',
  5626. // sortable: true
  5627. }, {
  5628. field: 'name',
  5629. title: '名称',
  5630. align: "center",
  5631. valign: 'middle',
  5632. // sortable: true
  5633. }
  5634. , {
  5635. field: 'execUnitName',
  5636. title: '执行科室',
  5637. align: "center",
  5638. valign: 'middle',
  5639. // sortable: true
  5640. }, {
  5641. field: 'type',
  5642. title: '项目类型',
  5643. align: "center",
  5644. valign: 'middle',
  5645. // sortable: true
  5646. formatter: function (value, row, index) {
  5647. if (value == 1 || value == "1") {
  5648. return "检验";
  5649. }
  5650. if (value == 2 || value == "2") {
  5651. return "辅助检查";
  5652. }
  5653. if (value == 3 || value == "3") {
  5654. return "诊疗";
  5655. }
  5656. return "";
  5657. }
  5658. },
  5659. ],
  5660. responseHandler: function (res) {
  5661. if (res == '401' || res == 401) {
  5662. window.location.href = '/thmz/login/view'
  5663. return;
  5664. }
  5665. var ress = eval(res);
  5666. if (ress.code == -1) {
  5667. errorMesage(res);
  5668. return {
  5669. "total": 0,//总页数
  5670. "rows": {} //数据
  5671. };
  5672. }
  5673. $("#jcJyItemPopoverContent").parent().css("background", "#EBEBE4");
  5674. return {
  5675. "total": ress.data.length,//总页数
  5676. "rows": ress.data //数据
  5677. };
  5678. },
  5679. onClickRow: function (row, $element) {
  5680. $('#jcJyItem').webuiPopover('hide');
  5681. $("#jcJyZltype").val(row.type);
  5682. $("#execUnit").selectpicker('val', row.execUnit);//默认不选中
  5683. $("#execUnit").selectpicker('refresh');
  5684. if (row.type == 1) {
  5685. //检验
  5686. $("#jyZdSampleDiv").removeClass("hide").addClass("in");
  5687. $("#yshPartDiv").removeClass("in").addClass("hide");
  5688. if (row.sampleCode != null && row.sampleCode != "") {
  5689. $("#jyZdSample").selectpicker('val', row.sampleCode);
  5690. $('#jyZdSample').selectpicker('refresh');
  5691. }
  5692. } else if (row.type == 2) {
  5693. //检查
  5694. $("#yshPartDiv").removeClass("hide").addClass("in");
  5695. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  5696. if (row.bwCode != null && row.bwCode != "") {
  5697. $("#yshPart").selectpicker('val', row.bwCode);
  5698. $('#yshPart').selectpicker('refresh');
  5699. }
  5700. }
  5701. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  5702. checkJcJyItemInfo(row.code, row.name, row.type, true);
  5703. }
  5704. });
  5705. }
  5706. /**
  5707. * 加载诊疗列表
  5708. * @param index
  5709. */
  5710. function loadZlItemList(event) {
  5711. if (event != null) {
  5712. if (event.keyCode == 38 || event.keyCode == 40 || event.keyCode == 13) {
  5713. //上下键不刷新表格
  5714. return;
  5715. }
  5716. }
  5717. $('#zlItem').webuiPopover('show');
  5718. $('#tb_table_zl_item').bootstrapTable('refresh');
  5719. $('#tb_table_zl_item').bootstrapTable({
  5720. url: '/thmz/getZlItemByCommonParams', //请求后台的URL(*)
  5721. method: 'GET', //请求方式(*)
  5722. toolbar: '#toolbar', //工具按钮用哪个容器
  5723. striped: true, //是否显示行间隔色
  5724. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  5725. pagination: false, //是否显示分页(*)
  5726. sortable: true, //是否启用排序
  5727. sortOrder: "asc", //排序方式
  5728. queryParams: function (params) {
  5729. var temp = {
  5730. commonParams: $("#zlItem").val()
  5731. };
  5732. return temp;
  5733. }, //传递参数(*)
  5734. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  5735. pageNumber: 1, //初始化加载第一页,默认第一页
  5736. pageSize: 5, //每页的记录行数(*)
  5737. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  5738. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  5739. strictSearch: true,
  5740. showColumns: false, //是否显示所有的列
  5741. showRefresh: false, //是否显示刷新按钮
  5742. minimumCountColumns: 2, //最少允许的列数
  5743. clickToSelect: true, //是否启用点击选中行
  5744. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  5745. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  5746. cardView: false, //是否显示详细视图
  5747. detailView: false,
  5748. //rowStyle:rowStyle,//通过自定义函数设置行样式
  5749. ajaxOptions: {
  5750. headers: {
  5751. 'Accept': 'application/json',
  5752. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  5753. }
  5754. },
  5755. columns: [
  5756. {
  5757. field: 'code',
  5758. title: '编码',
  5759. align: "center",
  5760. valign: 'middle',
  5761. // sortable: true
  5762. }, {
  5763. field: 'name',
  5764. title: '名称',
  5765. align: "center",
  5766. valign: 'middle',
  5767. // sortable: true
  5768. }
  5769. , {
  5770. field: 'execUnitName',
  5771. title: '执行科室',
  5772. align: "center",
  5773. valign: 'middle',
  5774. // sortable: true
  5775. }
  5776. , {
  5777. field: 'chargeAmount',
  5778. title: '价格',
  5779. align: "center",
  5780. valign: 'middle',
  5781. // sortable: true
  5782. formatter: function (value, row, index) {
  5783. if (value == null) {
  5784. return "0.00元";
  5785. }
  5786. return value.toFixed(2) + "元";
  5787. }
  5788. }, {
  5789. field: 'descriptions',
  5790. title: '规格',
  5791. align: "center",
  5792. valign: 'middle',
  5793. // sortable: true
  5794. }
  5795. ],
  5796. responseHandler: function (res) {
  5797. if (res == '401' || res == 401) {
  5798. window.location.href = '/thmz/login/view'
  5799. return;
  5800. }
  5801. var ress = eval(res);
  5802. if (ress.code == -1) {
  5803. errorMesage(res);
  5804. return {
  5805. "total": 0,//总页数
  5806. "rows": {} //数据
  5807. };
  5808. }
  5809. $("#zlItemPopoverContent").parent().css("background", "#EBEBE4");
  5810. return {
  5811. "total": ress.data.length,//总页数
  5812. "rows": ress.data //数据
  5813. };
  5814. },
  5815. onClickRow: function (row, $element) {
  5816. $('#zlItem').webuiPopover('hide');
  5817. $("#zlExecUnit").selectpicker('val', row.execUnit);//默认不选中
  5818. $("#zlExecUnit").selectpicker('refresh');
  5819. //诊疗
  5820. if ($("#zlTab").find("li") == null || $("#zlTab").find("li").length == 0) {
  5821. initNavTabs(3);
  5822. }
  5823. $("#zlItem").val(row.name);
  5824. $("#zlItem").blur();
  5825. $("#zlItemPrice").val(row.chargeAmount);
  5826. $("#chargeUnit").val(row.specification);
  5827. $("#zl_current_code").val(row.code);
  5828. $("#itemQuantity").val(1);
  5829. $("#chargeUnit").focus();
  5830. return;
  5831. }
  5832. });
  5833. }
  5834. /**
  5835. * 诊疗与医技选中
  5836. * @param code
  5837. * @param name 回写的时候可以设置null
  5838. * @param type 1 检验 2 检查 3 诊疗
  5839. * @param async 当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  5840. */
  5841. //function checkJcJyItemInfo(code, name, type) {
  5842. function checkJcJyItemInfo(code, name, type, async) {
  5843. // //判断是否有重复的项目 返回true 说明有重复的
  5844. // if (verifyRepeat(code, null, 2)) {
  5845. // return;
  5846. // }
  5847. //不需要每次都关闭帮助树
  5848. //$("#treeButton").webuiPopover('hide');
  5849. $.ajax({
  5850. type: "GET",
  5851. url: '/thmz/getJcJyItemChargeByCode?code=' + code + '&jcJyZltype=' + type,
  5852. contentType: "application/json;charset=UTF-8",
  5853. dataType: "json",
  5854. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5855. async: async,//当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  5856. success: function (res) {
  5857. if (res == '401' || res == 401) {
  5858. window.location.href = '/thmz/login/view'
  5859. return;
  5860. }
  5861. if (res.code == 0) {
  5862. if (res.data != null) {
  5863. //如果
  5864. if ($("#jcjyTab").find("li") == null || $("#jcjyTab").find("li").length == 0) {
  5865. initNavTabs(2);
  5866. }
  5867. if (name == null) {
  5868. name = res.name;
  5869. }
  5870. $("#jcJyItem").val(name);
  5871. $("#jcJyItem").blur();
  5872. $("#jcjyItemPrice").val(res.totalAmount);
  5873. $("#jcjy_current_code").val(code);
  5874. $("#execUnit").selectpicker('val', res.execUnit);//默认不选中
  5875. $("#execUnit").selectpicker('refresh');
  5876. // if (async) {
  5877. // if (type == 1) {
  5878. // //选中项目后,光标默认到数量输入框
  5879. // $("#jyZdSample").next().click();
  5880. // // prevEleId = 'jyZdSample';
  5881. // } else if (type == 2) {
  5882. // $("#yshPart").next().click();
  5883. // // prevEleId = 'yshPart';
  5884. // }
  5885. // }
  5886. }
  5887. } else {
  5888. errorMesage(res);
  5889. }
  5890. }
  5891. });
  5892. }
  5893. /**
  5894. * 查询辅助检查、检验项目明细
  5895. * @param code 编码
  5896. * @param jcJyZltype 1 检验 2 检查
  5897. */
  5898. function getJcJyItemChargeByCode(code, jcJyZltype) {
  5899. if (code != null) {
  5900. $("#itemCodeSearch").val(code);
  5901. $("#jcJyZltypeSearch").val(jcJyZltype);
  5902. } else if ($("#jcjy_current_code").val() == null || $("#jcjy_current_code").val() == '') {
  5903. errorMesageSimaple("未选中任何项目!");
  5904. return;
  5905. }
  5906. $("#jcJyItemModal").modal("show");
  5907. $('#jcJyItemTable').bootstrapTable('refresh');
  5908. $('#jcJyItemTable').bootstrapTable({
  5909. url: '/thmz/getJcJyItemChargeByCode', //请求后台的URL(*)
  5910. method: 'GET', //请求方式(*)
  5911. toolbar: '#toolbar', //工具按钮用哪个容器
  5912. striped: true, //是否显示行间隔色
  5913. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  5914. pagination: false, //是否显示分页(*)
  5915. sortable: true, //是否启用排序
  5916. sortOrder: "asc", //排序方式
  5917. queryParams: function (params) {
  5918. var itemCodeSearch = $("#itemCodeSearch").val();
  5919. var jcJyZltypeSearch = $("#jcJyZltypeSearch").val();
  5920. if (itemCodeSearch == null || itemCodeSearch == "") {
  5921. itemCodeSearch = $("#jcjy_current_code").val();
  5922. jcJyZltypeSearch = $("#jcJyZltype").val();
  5923. }
  5924. var temp = {
  5925. code: itemCodeSearch,
  5926. jcJyZltype: jcJyZltypeSearch
  5927. };
  5928. return temp;
  5929. }, //传递参数(*)
  5930. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  5931. pageNumber: 1, //初始化加载第一页,默认第一页
  5932. pageSize: 5, //每页的记录行数(*)
  5933. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  5934. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  5935. strictSearch: true,
  5936. showColumns: false, //是否显示所有的列
  5937. showRefresh: false, //是否显示刷新按钮
  5938. minimumCountColumns: 2, //最少允许的列数
  5939. clickToSelect: true, //是否启用点击选中行
  5940. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  5941. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  5942. cardView: false, //是否显示详细视图
  5943. detailView: false,
  5944. //rowStyle:rowStyle,//通过自定义函数设置行样式
  5945. ajaxOptions: {
  5946. headers: {
  5947. 'Accept': 'application/json',
  5948. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  5949. }
  5950. },
  5951. columns: [
  5952. {
  5953. field: 'tcCode',
  5954. title: '项目编码',
  5955. align: "center",
  5956. valign: 'middle',
  5957. // sortable: true
  5958. }, {
  5959. field: 'code',
  5960. title: '收费编码',
  5961. align: "center",
  5962. valign: 'middle',
  5963. // sortable: true
  5964. }
  5965. , {
  5966. field: 'name',
  5967. title: '收费名称',
  5968. align: "center",
  5969. valign: 'middle',
  5970. // sortable: true
  5971. }, {
  5972. field: 'num',
  5973. title: '数量',
  5974. align: "center",
  5975. valign: 'middle',
  5976. // sortable: true
  5977. }, {
  5978. field: 'chargeAmount',
  5979. title: '单价',
  5980. align: "center",
  5981. valign: 'middle',
  5982. // sortable: true
  5983. formatter: function (value, row, index) {
  5984. if (value == null || value == "") {
  5985. return 0;
  5986. }
  5987. return value.toFixed(2);
  5988. }
  5989. }, {
  5990. field: 'totalAmount',
  5991. title: '总金额',
  5992. align: "center",
  5993. valign: 'middle',
  5994. // sortable: true
  5995. formatter: function (value, row, index) {
  5996. if (value == null || value == "") {
  5997. return 0;
  5998. }
  5999. return value.toFixed(2);
  6000. }
  6001. }
  6002. ],
  6003. responseHandler: function (res) {
  6004. if (res == '401' || res == 401) {
  6005. window.location.href = '/thmz/login/view'
  6006. return;
  6007. }
  6008. $("#itemCodeSearch").val(null);
  6009. var ress = eval(res);
  6010. if (ress.code == -1) {
  6011. errorMesage(res);
  6012. return {
  6013. "total": 0,//总页数
  6014. "rows": {} //数据
  6015. };
  6016. }
  6017. return {
  6018. "total": ress.data.length,//总页数
  6019. "rows": ress.data //数据
  6020. };
  6021. }
  6022. });
  6023. }
  6024. /**
  6025. * 判断是否有重复的项目 返回true 说明有重复的
  6026. * @param code 编码
  6027. * @param serial 药品规格 null 时是非药品
  6028. * @param chargeUnitCode 检查部位或者检验物 null 时是 诊疗
  6029. * @param index
  6030. */
  6031. function verifyRepeat(code, serial, chargeUnitCode, index) {
  6032. //是新增药品还是编辑 true 修改 默认false
  6033. var updateFlag = null;
  6034. if (index == 0) {
  6035. updateFlag = $("#western_medicine_update_flag").val();
  6036. } else if (index == 1) {
  6037. updateFlag = $("#chinese_medicine_update_flag").val();
  6038. } else if (index == 2) {
  6039. updateFlag = $("#jcjy_update_flag").val();
  6040. } else if (index == 3) {
  6041. updateFlag = $("#zl_update_flag").val();
  6042. }
  6043. if (updateFlag == undefined || updateFlag == null) {
  6044. updateFlag = false;
  6045. }
  6046. if (updateFlag == "true" || updateFlag == true) {
  6047. return false;
  6048. }
  6049. var tabId = null;
  6050. //西药
  6051. if (index == 0) {
  6052. tabId = "xyTab";
  6053. } else if (index == 1) {
  6054. //中成药
  6055. tabId = "zyTab";
  6056. } else if (index == 2) {
  6057. //辅助检查、检验
  6058. tabId = "jcjyTab";
  6059. } else if (index == 3) {
  6060. //诊疗
  6061. tabId = "zlTab";
  6062. } else if (index == 4) {
  6063. //入院
  6064. tabId = "zyReqTab";
  6065. }
  6066. var tableId = $("#" + tabId + " li.active").find("a").attr("href");
  6067. var items = $(tableId).find("div:eq(0)").find("div.form-group");
  6068. var groupId = null;
  6069. if (index == 0) {
  6070. groupId = $("#groupId").val();
  6071. }
  6072. if (items != null && items.length > 0) {
  6073. for (var i = 0; i < items.length; i++) {
  6074. if (serial == null) {
  6075. var temporary_items_code = $(items[i]).find("input.temporary_items_code").val();
  6076. var temporary_items_desc_value = $(items[i]).find("input.temporary_items_desc_value").val();
  6077. if (chargeUnitCode == null && code === temporary_items_code) {
  6078. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  6079. return true;
  6080. }
  6081. if (code === temporary_items_code && chargeUnitCode === temporary_items_desc_value) {
  6082. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  6083. return true;
  6084. }
  6085. } else {
  6086. if (index == 0) {
  6087. //西药需要判断组号,因为可能会有不同组的皮试用药,需要相同的药品
  6088. var temporary_items_groupId = $(items[i]).find("input.temporary_items_groupId").val();
  6089. var temporary_items_code = $(items[i]).find("input.temporary_items_code").val();
  6090. var temporary_items_serial = $(items[i]).find("input.temporary_items_serial").val();
  6091. if (code === temporary_items_code && serial === temporary_items_serial && groupId === temporary_items_groupId) {
  6092. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  6093. return true;
  6094. }
  6095. } else {
  6096. var temporary_items_code = $(items[i]).find("input.temporary_items_code").val();
  6097. var temporary_items_serial = $(items[i]).find("input.temporary_items_serial").val();
  6098. if (code === temporary_items_code && serial === temporary_items_serial) {
  6099. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  6100. return true;
  6101. }
  6102. }
  6103. }
  6104. }
  6105. }
  6106. return false;
  6107. }
  6108. /**
  6109. * 初始化处方分页
  6110. * @param index 0 西药 1 中药 2 诊疗 3 入院
  6111. */
  6112. function initNavTabs(index) {
  6113. var tabId = null;
  6114. var tabContentId = null;
  6115. var paneId = null;
  6116. var cfdesc = '普药';
  6117. //西药
  6118. if (index == 0) {
  6119. tabId = "xyTab";
  6120. tabContentId = "xyTabContent";
  6121. paneId = "xycf_" + getUID();
  6122. } else if (index == 1) {
  6123. //中草药
  6124. tabId = "zyTab";
  6125. tabContentId = "zyTabContent";
  6126. paneId = "zycf_" + getUID();
  6127. cfdesc = '中草药';
  6128. } else if (index == 2) {
  6129. //医技
  6130. tabId = "jcjyTab";
  6131. tabContentId = "jcjyTabContent";
  6132. paneId = "jcjycf_" + getUID();
  6133. cfdesc = '辅助检查、检验';
  6134. } else if (index == 3) {
  6135. //诊疗
  6136. tabId = "zlTab";
  6137. tabContentId = "zlTabContent";
  6138. paneId = "zlcf_" + getUID();
  6139. cfdesc = '诊疗';
  6140. } else if (index == 4) {
  6141. //住院
  6142. tabId = "zyReqTab";
  6143. tabContentId = "zyReqTabContent";
  6144. paneId = "zyReqcf_" + getUID();
  6145. cfdesc = '入院';
  6146. }
  6147. var tabHtml = '<li class="active"><a href="#' + paneId + '" role="tab" data-toggle="tab" ';
  6148. if (index == 0) {
  6149. tabHtml += ' onclick=xyTableOnClick("' + paneId + '")';
  6150. }
  6151. tabHtml += '>处方 <small class="cfdesc">(' + cfdesc + ')</small></a></li>';
  6152. $("#" + tabId).html(tabHtml);
  6153. var html = '<div class="tab-pane fade in active" id="' + paneId + '" style="height: 100%;min-height: 285px;position: relative;">';
  6154. html += '<img src="/thmz/images/prescription.png" style="margin-top: 5px;"/>';
  6155. html += '<input class="current_groupNo" type="hidden"/>';
  6156. html += ' <div class="cf_content rb_item" style="height: 230px;padding-top: 5px;overflow-y: auto;"></div>' +
  6157. ' <div style="height: 30px;border-top: 1px solid #ddd;width: 100%;position: absolute;bottom:0;padding-top: 10px;">';
  6158. html += '<div style="width: 460px;">'
  6159. if (index == 1) {
  6160. html += '<div style="width: 130px;float: left;line-height: 34px;">' +
  6161. ' <label class="my_label_2">复煎:</label>' +
  6162. ' <div style="width: 69px;float: left;">' +
  6163. ' <input type="number" class="form-control " id="cyFj" placeholder="请输入" value="1"/>' +
  6164. ' </div>次' +
  6165. ' </div>';
  6166. html += '<div style="width: 130px;float: left;line-height: 34px;">' +
  6167. ' <label class="my_label_2">分服:</label>' +
  6168. ' <div style="width: 69px;float: left;">' +
  6169. ' <input type="number" class="form-control " id="cyFfcs" placeholder="请输入" value="2"/>' +
  6170. ' </div>次' +
  6171. ' </div>';
  6172. html += '<div style="width: 180px;float: left;">' +
  6173. ' <label class="my_label_2">用法:</label>' +
  6174. ' <div style="width: 135px;float: left;">' +
  6175. ' <select class="form-control selectpicker show-tick useType"' +
  6176. ' title="请选择" id="useType_1">' +
  6177. ' </select>' +
  6178. ' </div>' +
  6179. ' </div>';
  6180. html += '</div><div style="width: 460px;">'
  6181. html += '<input id="singleAmount" type="hidden"/>';
  6182. }
  6183. html += '<div style="width: 130px;float: left;padding-left: 7px;padding-top: 8px;">金额:<span class="cf_amount">0.0</span><span>元</span></div>';
  6184. if (index == 0) {
  6185. html += '<div style="width: 310px;float: left;color: red;padding-top: 8px;">说明:此费用包含药品给药方式所产生的费用!</div>';
  6186. }
  6187. // else if (index == 1) {
  6188. // html += '<div style="width: 310px;float: left;color: red;padding-top: 8px;">说明:此费用包含药品代煎所产生的费用!</div>';
  6189. // }
  6190. html += '</div></div></div>';
  6191. $("#" + tabContentId).html(html);
  6192. if (index == 1) {
  6193. var water = '<option value="加凉水">加凉水</option><option value="加温水">加温水</option><option value="加开水">加开水</option><option value="加冰水">加冰水</option><option value="加糖水">加糖水</option>';
  6194. $('#cyJssm').html(water);
  6195. $('#cyJssm').selectpicker('refresh');
  6196. $("#cyJssm").selectpicker('val', "加凉水");
  6197. $('#cyJssm').selectpicker('refresh');
  6198. initAllMzYshZdFysm();
  6199. //initZyOrderFrequencys("zy_orderFrequency_1", false);
  6200. initZySupplyTypes("zy_supplyType_1", false);
  6201. }
  6202. }
  6203. /**
  6204. * 清空处方分页
  6205. * @param index 0 西药 1 中药 2 诊疗 3 入院
  6206. */
  6207. function clearNavTabs(index) {
  6208. var tabId = null;
  6209. var tabContentId = null;
  6210. //西药
  6211. if (index == 0) {
  6212. tabId = "xyTab";
  6213. tabContentId = "xyTabContent";
  6214. } else if (index == 1) {
  6215. //中草药
  6216. tabId = "zyTab";
  6217. tabContentId = "zyTabContent";
  6218. $("#cyJsl").val(400);
  6219. $("#cyZql").val(200);
  6220. $("#cyFj").val(1);
  6221. $("#cyFfcs").val(2);
  6222. $("#cyMtjs").val(1);
  6223. $("#zyfs").val(null);
  6224. $("#cyJssm").selectpicker('val', "加凉水");
  6225. $('#cyJssm').selectpicker('refresh');
  6226. $("#zy_supplyType_1").selectpicker('val', null);
  6227. $('#zy_supplyType_1').selectpicker('refresh');
  6228. } else if (index == 2) {
  6229. //辅助检查、检验
  6230. tabId = "jcjyTab";
  6231. tabContentId = "jcjyTabContent";
  6232. } else if (index == 3) {
  6233. //医技
  6234. tabId = "zlTab";
  6235. tabContentId = "zlTabContent";
  6236. } else if (index == 4) {
  6237. //医技
  6238. tabId = "zyReqTab";
  6239. tabContentId = "zyReqTabContent";
  6240. }
  6241. $("#" + tabId).html(null);
  6242. $("#" + tabContentId).html(null);
  6243. }
  6244. /**
  6245. * 添加处方分页
  6246. * @param index 0 西药 1 中药 2 诊疗 3 入院
  6247. * @param groupNo 71 普通西药 91 医材 111 麻、精一 131 精二 151 诊疗
  6248. */
  6249. function refreshNavTabs(index, groupNo) {
  6250. var tabId = null;
  6251. var tabContentId = null;
  6252. var paneIdPrfix = null;
  6253. var cfdesc = '普药';
  6254. //西药
  6255. if (index == 0) {
  6256. tabId = "xyTab";
  6257. tabContentId = "xyTabContent";
  6258. paneIdPrfix = "xycf_";
  6259. if (groupNo == '91') {
  6260. cfdesc = '医材';
  6261. } else if (groupNo == '111') {
  6262. cfdesc = '麻、精一';
  6263. } else if (groupNo == '131') {
  6264. cfdesc = '精二';
  6265. }
  6266. // else if(groupNo=='151'){
  6267. // cfdesc='诊疗';
  6268. // }
  6269. } else if (index == 1) {
  6270. //中草药
  6271. tabId = "zyTab";
  6272. tabContentId = "zyTabContent";
  6273. paneIdPrfix = "zycf_";
  6274. cfdesc = '中草药';
  6275. } else if (index == 2) {
  6276. //辅助检查、检验
  6277. tabId = "jcjyTab";
  6278. tabContentId = "jcjyTabContent";
  6279. paneIdPrfix = "jcjycf_";
  6280. cfdesc = '辅助检查、检验';
  6281. } else if (index == 3) {
  6282. //诊疗
  6283. tabId = "zlTab";
  6284. tabContentId = "zlTabContent";
  6285. paneIdPrfix = "zlcf_";
  6286. cfdesc = '诊疗';
  6287. } else if (index == 4) {
  6288. //入院
  6289. tabId = "zyReqTab";
  6290. tabContentId = "zyReqTabContent";
  6291. paneIdPrfix = "zyReqcf_";
  6292. cfdesc = '入院';
  6293. }
  6294. // var tableId = $("#"+tabId+" li.active").find("a").attr("href");
  6295. // var length = $(tableId).find("div:eq(0)").children().length;
  6296. // if(length==0){
  6297. // //当前处方是空白的,不需要新增处方
  6298. // return;
  6299. // }
  6300. var cfTitle = "处方" + " <small class=\"cfdesc\">(" + cfdesc + ")</small>";
  6301. var paneId = paneIdPrfix + getUID();
  6302. //清除选中的样式
  6303. $("#" + tabId).find("li.active").removeClass("active");
  6304. var tabHtml = '<li><a href="#' + paneId + '" role="tab" data-toggle="tab"';
  6305. if (index == 0) {
  6306. tabHtml += ' onclick=xyTableOnClick("' + paneId + '")';
  6307. }
  6308. tabHtml += '>' + cfTitle + '</a';
  6309. tabHtml += '</li>';
  6310. $("#" + tabId).append(tabHtml);
  6311. var html = '<div class="tab-pane fade in active" id="' + paneId + '" style="height: 100%;min-height: 285px;position: relative;">' +
  6312. '<img src="/thmz/images/prescription.png" style="margin-top: 5px;"/>' +
  6313. '<input class="current_groupNo" type="hidden"/>' +
  6314. ' <div class="cf_content rb_item" style="height: 230px;padding-top: 5px;overflow-y: auto;"></div>' +
  6315. ' <div style="height: 30px;border-top: 1px solid #ddd;width: 100%;position: absolute;bottom:0;">' +
  6316. '<div style="width: 460px;">' +
  6317. '<div style="width: 130px;float: left;padding-left: 7px;padding-top: 8px;">金额:<span class="cf_amount">0.0</span><span>元</span></div>';
  6318. if (index == 0) {
  6319. html += '<div style="width: 310px;float: left;color: red;padding-top: 8px;">说明:此费用包含药品给药方式所产生的费用!</div>';
  6320. }
  6321. html += '</div></div>';
  6322. $("#" + tabContentId).append(html);
  6323. //切换处方
  6324. $("#" + tabId).find("a[href='#" + paneId + "']").off("click").tab('show');
  6325. }
  6326. /**
  6327. * 填充西药选中的内容
  6328. * @param res
  6329. * @param groupNo
  6330. */
  6331. function fitWesternMedicine(res, groupNo) {
  6332. $("#western_medicine_name").val(res.data.name);
  6333. $("#western_medicine_name").blur();
  6334. var drugWinHtml = '';
  6335. var index = null;
  6336. if (res.data.weight != null) {
  6337. $("#drugWin").val(res.data.weight);
  6338. $("#drugWinDb").val(res.data.weight);
  6339. drugWinHtml = '<option value="' + res.data.weighUnit + '" desc="' + res.data.weight + '">' + res.data.weighUnitDesc + '</option>';
  6340. index = res.data.weighUnit;
  6341. }
  6342. if (res.data.volum != null) {
  6343. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  6344. $("#drugWin").val(res.data.volum);
  6345. $("#drugWinDb").val(res.data.volum);
  6346. }
  6347. drugWinHtml += '<option value="' + res.data.volUnit + '" desc="' + res.data.volum + '">' + res.data.volUnitDesc + '</option>';
  6348. if (index == null) {
  6349. index = res.data.volUnit;
  6350. }
  6351. }
  6352. if (res.data.miniUnit != null && res.data.miniUnit != "") {
  6353. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  6354. $("#drugWin").val(1);
  6355. $("#drugWinDb").val(1);
  6356. }
  6357. drugWinHtml += '<option value="' + res.data.miniUnit + '" desc="1">' + res.data.miniUnitDesc + '</option>';
  6358. if (index == null) {
  6359. index = res.data.miniUnit;
  6360. }
  6361. }
  6362. $('#drugWinUnit').html(drugWinHtml);
  6363. $('#drugWinUnit').selectpicker('refresh');
  6364. $("#drugWinUnit").selectpicker('val', index);
  6365. $('#drugWinUnit').selectpicker('refresh');
  6366. if (res.data.packUnitDesc != null && res.data.packUnitDesc != "") {
  6367. var html = '<option value="' + res.data.packUnitDesc + '" >' + res.data.packUnitDesc + '</option>';
  6368. $('#packUnit').html(html);
  6369. $('#packUnit').selectpicker('refresh');
  6370. $("#packUnit").selectpicker('val', res.data.packUnitDesc);
  6371. $('#packUnit').selectpicker('refresh');
  6372. }
  6373. $("#packRetprice").val(res.data.packRetprice);
  6374. $("#packSize").val(res.data.packSize);
  6375. $("#western_medicine_current_code").val(res.data.code);
  6376. $("#western_medicine_current_serial").val(res.data.serial);
  6377. if ($("#dayNum").val() == null) {
  6378. //天数 同组药品天数相同
  6379. $("#dayNum").selectpicker('val', 1);
  6380. $('#dayNum').selectpicker('refresh');
  6381. }
  6382. if ($("#supplyType").val() == null && res.data.supplyType != null) {
  6383. // 给药方式 同组药品给药方式相同
  6384. $("#supplyType").selectpicker('val', res.data.supplyType);
  6385. $('#supplyType').selectpicker('refresh');
  6386. }
  6387. if ($("#orderFrequency").val() == null && res.data.frequency != null) {
  6388. //频次编码 同组药品频次编码相同
  6389. $("#orderFrequency").selectpicker('val', res.data.frequency);
  6390. $('#orderFrequency').selectpicker('refresh');
  6391. }
  6392. if ($("#orderFrequency").val() == null) {
  6393. //频次编码 防止频次为空
  6394. $("#orderFrequency").selectpicker('val', "ONCE");
  6395. $('#orderFrequency').selectpicker('refresh');
  6396. }
  6397. $("#tryResult").parent().parent().parent().removeClass("in").addClass("hide");
  6398. if (res.data.psFlag != null && (res.data.psFlag == 1 || res.data.psFlag == "1")) {
  6399. if (res.data.categoriesFlag == 0 || res.data.categoriesFlag == "0" || res.data.categoriesFlag == 2 || res.data.categoriesFlag == "2") {
  6400. initTryResultSelect(res.data.categoriesFlag);
  6401. }
  6402. }
  6403. $("#manufactoryName").val(res.data.manufactoryName);
  6404. $("#specification").val(res.data.specification);
  6405. // if (groupNo == "91") {
  6406. // //医材
  6407. // $("#gross").removeAttr("readonly")
  6408. // } else {
  6409. // $("#gross").attr("readonly", "readonly");
  6410. // }
  6411. calculate();
  6412. $("#western_medicine_name").focus();
  6413. }
  6414. /**
  6415. * 剂量单位改变事件
  6416. */
  6417. function drugWinUnitChange() {
  6418. var desc = $('#drugWinUnit').find("option:selected").attr('desc');
  6419. $("#drugWin").val(desc);
  6420. $("#drugWinDb").val(desc);
  6421. calculate();
  6422. }
  6423. /**
  6424. * 根据选择的内容计算总的用药量
  6425. */
  6426. function calculate() {
  6427. //最小规格剂量
  6428. var drugWinDb = $("#drugWinDb").val();
  6429. //天数
  6430. var dayNum = $("#dayNum").val();
  6431. //当前使用的最小剂量
  6432. var drugWin = $("#drugWin").val();
  6433. //频率
  6434. var times = $('#orderFrequency').find("option:selected").attr('desc');
  6435. //包装规格数量
  6436. var packSize = $("#packSize").val();
  6437. //单价
  6438. var packRetprice = $("#packRetprice").val();
  6439. //当前药房编码
  6440. var currentGroupNo = $("#current_groupNo").val();
  6441. if (drugWinDb == null || drugWinDb === "") {
  6442. if (currentGroupNo == '71') {
  6443. return;
  6444. }
  6445. drugWinDb = 1;
  6446. }
  6447. if (dayNum == null || dayNum === "") {
  6448. if (currentGroupNo == '71') {
  6449. return;
  6450. }
  6451. dayNum = 1;
  6452. }
  6453. if (drugWin == null || drugWin === "") {
  6454. if (currentGroupNo == '71') {
  6455. return;
  6456. }
  6457. drugWin = 1;
  6458. }
  6459. if (times == null || times === "") {
  6460. if (currentGroupNo == '71') {
  6461. return;
  6462. }
  6463. times = 1;
  6464. }
  6465. if (packSize == null || packSize === "") {
  6466. return;
  6467. }
  6468. //拆零总量
  6469. var scatteredTotalNum = Multiply(Multiply(dayNum, drugWin), times);
  6470. //整包装的数量
  6471. var totalNum = Math.ceil(Division(scatteredTotalNum, Multiply(packSize, drugWinDb)));
  6472. $("#gross").val(totalNum);
  6473. $("#totalRetprice").val(Multiply(totalNum, packRetprice).toFixed(2));
  6474. }
  6475. /**
  6476. * 根据选择的总量计算金额 只有医材的时候需要计算
  6477. */
  6478. function calculateSimple() {
  6479. //总量
  6480. var gross = $("#gross").val();
  6481. //单价
  6482. var packRetprice = $("#packRetprice").val();
  6483. $("#totalRetprice").val(Multiply(gross, packRetprice).toFixed(2));
  6484. //当前药房编码
  6485. var currentGroupNo = $("#current_groupNo").val();
  6486. if (currentGroupNo == '91') {
  6487. //医材默认天数为1
  6488. $("#dayNum").selectpicker('val', 1);
  6489. $('#dayNum').selectpicker('refresh');
  6490. $("#orderFrequency").selectpicker('val', "ONCE");
  6491. $('#orderFrequency').selectpicker('refresh');
  6492. }
  6493. }
  6494. /**
  6495. * 根据中药付数计算金额
  6496. */
  6497. function calculateZyAmount() {
  6498. var singleAmount = $("#singleAmount").val();
  6499. var tableId = $("#zyTab li.active").find("a").attr("href");
  6500. //获取中药付数
  6501. //var zyfs = $(tableId).find("input.zyfs").val();
  6502. var zyfs = $("#zyfs").val();
  6503. var cfAmount = Multiply(zyfs, singleAmount);
  6504. $(tableId).find("span.cf_amount").html(cfAmount);
  6505. calculateTotalAmount();
  6506. }
  6507. /**
  6508. * 将病人信息填入患者信息修改form
  6509. * @param patinet
  6510. */
  6511. function fillPlusPatinet(patinet) {
  6512. if (patinet != null) {
  6513. $("#editUserCode").val(patinet.patientId);
  6514. $("#editUserName").val(patinet.name);
  6515. $("#editUserName").blur();
  6516. $("#editUserAge").val(patinet.age);
  6517. $("#editUserAge").blur();
  6518. $("#editUserGender").selectpicker('val', patinet.sex);
  6519. $("#editUserGender").selectpicker('refresh');
  6520. $("#editUserGender").blur();
  6521. $("#editUserBirthDay").val(patinet.birthDayStr);
  6522. $("#editUserBirthDay").blur();
  6523. $('#editUserCertificateType').selectpicker('val', patinet.certificateType);
  6524. $('#editUserCertificateType').selectpicker('refresh');
  6525. $("#editUserCardNo").val(patinet.icCardNo);
  6526. $("#editUserCardNo").attr("title", patinet.icCardNo);
  6527. $("#editUserCardNo").blur();
  6528. $("#editUserPhoneNum").val(patinet.phoneNo);
  6529. $("#editUserPhoneNum").attr("title", patinet.phoneNo);
  6530. $("#editUserPhoneNum").blur();
  6531. $("#editUserPatientsNature").selectpicker('val', patinet.responseType);//默认选中
  6532. $('#editUserPatientsNature').selectpicker('refresh');
  6533. $("#editUserPatientsNature").blur();
  6534. $("#editUserIdCard").val(patinet.socialNo);
  6535. $("#editUserIdCard").attr("title", patinet.socialNo);
  6536. $("#editUserIdCard").blur();
  6537. $("#editUserAddress").val(patinet.address);
  6538. $("#editUserAddress").blur();
  6539. $("#editUserContact").val(patinet.relName);
  6540. $("#editUserContactPhone").val(patinet.contractName);
  6541. }
  6542. }
  6543. /**
  6544. * 修改病人信息
  6545. */
  6546. function modifyPatient() {
  6547. $.ajax({
  6548. type: "POST",
  6549. url: '/thmz/modifyPatient',
  6550. contentType: "application/json;charset=UTF-8",
  6551. dataType: "json",
  6552. data: JSON.stringify({
  6553. "name": $("#editUserName").val(),
  6554. "age": $("#editUserAge").val(),
  6555. "sex": $("#editUserGender").val(),
  6556. "birthDay": $("#editUserBirthDay").val(),
  6557. "certificateType": $("#editUserCertificateType").val(),
  6558. "icCardNo": $("#editUserCardNo").val(),
  6559. "phoneNo": $("#editUserPhoneNum").val(),
  6560. "responseType": $("#editUserPatientsNature").val(),
  6561. "socialNo": $("#editUserIdCard").val(),
  6562. "address": $("#editUserAddress").val(),
  6563. "patientId": $("#editUserCode").val(),
  6564. "relName": $("#editUserContact").val(),
  6565. "contractName": $("#editUserContactPhone").val()
  6566. }),
  6567. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6568. success: function (res) {
  6569. if (res == '401' || res == 401) {
  6570. window.location.href = '/thmz/login/view'
  6571. return;
  6572. }
  6573. if (res.code == 0) {
  6574. $('#editUserModal').modal('hide');
  6575. var patientId = $("#patientId").text();
  6576. if (patientId != null && patientId != 'null' && patientId != "") {
  6577. realClinicalReception(patientId, $("#mzfzSerialNoInClick").val(), $("#mzfzReqTypeNoInClick").val());
  6578. }
  6579. clearPlusPatinet();
  6580. } else {
  6581. errorMesage(res);
  6582. }
  6583. }
  6584. });
  6585. }
  6586. /**
  6587. * 将病人信息修改域置空
  6588. * @param patinet
  6589. */
  6590. function clearPlusPatinet() {
  6591. $("#editUserCode").val(null);
  6592. $("#editUserName").val(null);
  6593. $("#editUserAge").val(null);
  6594. $("#editUserGender").selectpicker('val', '1');
  6595. $("#editUserGender").selectpicker('refresh');
  6596. $("#editUserBirthDay").val(null);
  6597. $('#editUserCertificateType').selectpicker('val', '01');
  6598. $('#editUserCertificateType').selectpicker('refresh');
  6599. $("#editUserCardNo").val(null);
  6600. $("#editUserCardNo").attr("title", null);
  6601. $("#editUserPhoneNum").val(null);
  6602. $("#editUserPhoneNum").attr("title", null);
  6603. $("#editUserPatientsNature").selectpicker('val', '01');//默认选中
  6604. $('#editUserPatientsNature').selectpicker('refresh');
  6605. $("#editUserIdCard").val(null);
  6606. $("#editUserIdCard").attr("title", null);
  6607. $("#editUserAddress").val(null);
  6608. $("#editUserContact").val(null);
  6609. $("#editUserContactPhone").val(null);
  6610. }
  6611. // /**
  6612. // * 保存入院证
  6613. // */
  6614. // function saveBeHospitalized() {
  6615. // $.ajax({
  6616. // type: "POST",
  6617. // url: '/thmz/saveMzZyReq',
  6618. // contentType: "application/json;charset=UTF-8",
  6619. // dataType: "json",
  6620. // data: JSON.stringify({
  6621. // "patientId": $("#patientId").text(),
  6622. // "icdCode": $("#icdCodeBeHospitalized").val(),
  6623. // "icdText": $("#icdTextBeHospitalized").val(),
  6624. // "reqDept": $("#inpatientWardBeHospitalized").val(),
  6625. // "smallDept": $("#smallWardBeHospitalized").val(),
  6626. // "admissStatus": $("#admissStatus").val()
  6627. // }),
  6628. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6629. // success: function (res) {
  6630. // if (res == '401' || res == 401) {
  6631. // window.location.href = '/thmz/login/view'
  6632. // return;
  6633. // }
  6634. // if (res.code == 0) {
  6635. // successMesage(res);
  6636. // $('#beHospitalizedModal').modal('hide');
  6637. // loadInClinicTableList();
  6638. // loadClinicTableList();
  6639. // clearWorkSpace();
  6640. // } else {
  6641. // errorMesage(res);
  6642. // }
  6643. // }
  6644. // });
  6645. // }
  6646. /**
  6647. * 获取按钮组选择的下标
  6648. * @param id
  6649. * @returns {number}
  6650. */
  6651. function getIndex(id) {
  6652. var index = 0;
  6653. var item = $("#" + id).find("button");
  6654. for (var i = 0; i <= item.length; i++) {
  6655. if ($(item[i]).hasClass("btn-primary")) {
  6656. index = i;
  6657. break;
  6658. }
  6659. }
  6660. return index;
  6661. }
  6662. /**
  6663. * 获取时间选择器的时间数组
  6664. * @returns {string[]}
  6665. */
  6666. function getRePortRangeArr() {
  6667. var rePortRange = $('#reportrange span').html();
  6668. var rePortRangeArr = rePortRange.split(" - ");
  6669. rePortRangeArr[0] = rePortRangeArr[0] + " 00:00:00"
  6670. rePortRangeArr[1] = rePortRangeArr[1] + " 23:59:59"
  6671. return rePortRangeArr;
  6672. }
  6673. /**
  6674. * 初始医生工作太配置
  6675. */
  6676. function initWorkspaceConfigForCurrent() {
  6677. $.ajax({
  6678. type: "GET",
  6679. url: '/thmz/getWorkspaceConfigForCurrent',
  6680. dataType: "json",
  6681. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6682. success: function (res) {
  6683. if (res == '401' || res == 401) {
  6684. window.location.href = '/thmz/login/view'
  6685. return;
  6686. }
  6687. if (res.code == 0) {
  6688. if (res.data.symptomFlag == 1) {
  6689. $("#symptomFlag").removeClass("in").addClass("hide");
  6690. if ($("#symptomFlagCheck").parent().hasClass("checked")) {
  6691. $("#symptomFlagCheck").parent().parent().click();//当前选中改为不选中
  6692. }
  6693. } else if (res.data.symptomFlag == 0) {
  6694. $("#symptomFlag").removeClass("hide").addClass("in");
  6695. if (!$("#symptomFlagCheck").parent().hasClass("checked")) {
  6696. $("#symptomFlagCheck").parent().parent().click();//当前不选中改为选中
  6697. }
  6698. }
  6699. if (res.data.emrHpiFlag == 1) {
  6700. $("#emrHpiFlag").removeClass("in").addClass("hide");
  6701. if ($("#emrHpiFlagCheck").parent().hasClass("checked")) {
  6702. $("#emrHpiFlagCheck").parent().parent().click();//当前选中改为不选中
  6703. }
  6704. } else if (res.data.emrHpiFlag == 0) {
  6705. $("#emrHpiFlag").removeClass("hide").addClass("in");
  6706. if (!$("#emrHpiFlagCheck").parent().hasClass("checked")) {
  6707. $("#emrHpiFlagCheck").parent().parent().click();//当前不选中改为选中
  6708. }
  6709. }
  6710. if (res.data.emrPsFlag == 1) {
  6711. $("#emrPsFlag").removeClass("in").addClass("hide");
  6712. if ($("#emrPsFlagCheck").parent().hasClass("checked")) {
  6713. $("#emrPsFlagCheck").parent().parent().click();//当前选中改为不选中
  6714. }
  6715. } else if (res.data.emrPsFlag == 0) {
  6716. $("#emrPsFlag").removeClass("hide").addClass("in");
  6717. if (!$("#emrPsFlagCheck").parent().hasClass("checked")) {
  6718. $("#emrPsFlagCheck").parent().parent().click();//当前不选中改为选中
  6719. }
  6720. }
  6721. if (res.data.personalHistoryFlag == 1) {
  6722. $("#personalHistoryFlag").removeClass("in").addClass("hide");
  6723. if ($("#personalHistoryFlagCheck").parent().hasClass("checked")) {
  6724. $("#personalHistoryFlagCheck").parent().parent().click();//当前选中改为不选中
  6725. }
  6726. } else if (res.data.personalHistoryFlag == 0) {
  6727. $("#personalHistoryFlag").removeClass("hide").addClass("in");
  6728. if (!$("#personalHistoryFlagCheck").parent().hasClass("checked")) {
  6729. $("#personalHistoryFlagCheck").parent().parent().click();//当前不选中改为选中
  6730. }
  6731. }
  6732. if (res.data.familyHistoryFlag == 1) {
  6733. $("#familyHistoryFlag").removeClass("in").addClass("hide");
  6734. if ($("#familyHistoryFlagCheck").parent().hasClass("checked")) {
  6735. $("#familyHistoryFlagCheck").parent().parent().click();//当前选中改为不选中
  6736. }
  6737. } else if (res.data.familyHistoryFlag == 0) {
  6738. $("#familyHistoryFlag").removeClass("hide").addClass("in");
  6739. if (!$("#familyHistoryFlagCheck").parent().hasClass("checked")) {
  6740. $("#familyHistoryFlagCheck").parent().parent().click();//当前不选中改为选中
  6741. }
  6742. }
  6743. if (res.data.obstericalHistoryFlag == 1) {
  6744. $("#obstericalHistoryFlag").removeClass("in").addClass("hide");
  6745. if ($("#obstericalHistoryFlagCheck").parent().hasClass("checked")) {
  6746. $("#obstericalHistoryFlagCheck").parent().parent().click();//当前选中改为不选中
  6747. }
  6748. } else if (res.data.obstericalHistoryFlag == 0) {
  6749. $("#obstericalHistoryFlag").removeClass("hide").addClass("in");
  6750. if (!$("#obstericalHistoryFlagCheck").parent().hasClass("checked")) {
  6751. $("#obstericalHistoryFlagCheck").parent().parent().click();//当前不选中改为选中
  6752. }
  6753. }
  6754. if (res.data.pressureLeftFlag == 1) {
  6755. $("#pressureLeftFlag").removeClass("in").addClass("hide");
  6756. if ($("#pressureLeftFlagCheck").parent().hasClass("checked")) {
  6757. $("#pressureLeftFlagCheck").parent().parent().click();//当前选中改为不选中
  6758. }
  6759. } else if (res.data.pressureLeftFlag == 0) {
  6760. $("#pressureLeftFlag").removeClass("hide").addClass("in");
  6761. if (!$("#pressureLeftFlagCheck").parent().hasClass("checked")) {
  6762. $("#pressureLeftFlagCheck").parent().parent().click();//当前不选中改为选中
  6763. }
  6764. }
  6765. if (res.data.tentativeDiagnosisFlag == 1) {
  6766. $("#tentativeDiagnosisFlag").removeClass("in").addClass("hide");
  6767. if ($("#tentativeDiagnosisFlagCheck").parent().hasClass("checked")) {
  6768. $("#tentativeDiagnosisFlagCheck").parent().parent().click();//当前选中改为不选中
  6769. }
  6770. } else if (res.data.tentativeDiagnosisFlag == 0) {
  6771. $("#tentativeDiagnosisFlag").removeClass("hide").addClass("in");
  6772. if (!$("#tentativeDiagnosisFlagCheck").parent().hasClass("checked")) {
  6773. $("#tentativeDiagnosisFlagCheck").parent().parent().click();//当前不选中改为选中
  6774. }
  6775. }
  6776. } else {
  6777. errorMesage(res);
  6778. }
  6779. }
  6780. });
  6781. }
  6782. /**
  6783. * 保存医生工作台配置
  6784. */
  6785. function saveWorkspaceConfig() {
  6786. var symptomFlag = $("#symptomFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  6787. var emrHpiFlag = $("#emrHpiFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  6788. var emrPsFlag = $("#emrPsFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  6789. var personalHistoryFlag = $("#personalHistoryFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  6790. var familyHistoryFlag = $("#familyHistoryFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  6791. var obstericalHistoryFlag = $("#obstericalHistoryFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  6792. var pressureLeftFlag = $("#pressureLeftFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  6793. var tentativeDiagnosisFlag = $("#tentativeDiagnosisFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  6794. $.ajax({
  6795. type: "POST",
  6796. url: '/thmz/saveWorkspaceConfig',
  6797. contentType: "application/json;charset=UTF-8",
  6798. dataType: "json",
  6799. data: JSON.stringify({
  6800. "symptomFlag": symptomFlag,
  6801. "emrHpiFlag": emrHpiFlag,
  6802. "emrPsFlag": emrPsFlag,
  6803. "personalHistoryFlag": personalHistoryFlag,
  6804. "familyHistoryFlag": familyHistoryFlag,
  6805. "obstericalHistoryFlag": obstericalHistoryFlag,
  6806. "pressureLeftFlag": pressureLeftFlag,
  6807. "tentativeDiagnosisFlag": tentativeDiagnosisFlag
  6808. }),
  6809. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6810. success: function (res) {
  6811. if (res == '401' || res == 401) {
  6812. window.location.href = '/thmz/login/view'
  6813. return;
  6814. }
  6815. if (res.code == 0) {
  6816. //successMesage(res);
  6817. initWorkspaceConfigForCurrent();
  6818. $("#configWorkspaceModal").modal("hide");
  6819. } else {
  6820. errorMesage(res);
  6821. }
  6822. }
  6823. });
  6824. }
  6825. /**
  6826. * 初始化药品,检查检验菜单树
  6827. */
  6828. function initzTree() {
  6829. var index = getIndex("bill_item_group");
  6830. if (index == 0) {
  6831. $("#western_medicine_name").webuiPopover('hide');
  6832. $.ajax({
  6833. type: "GET",
  6834. url: '/thmz/getYpZdClasses',
  6835. contentType: "application/json;charset=UTF-8",
  6836. dataType: "json",
  6837. async: false,
  6838. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6839. success: function (res) {
  6840. if (res == '401' || res == 401) {
  6841. window.location.href = '/thmz/login/view'
  6842. return;
  6843. }
  6844. if (res.code == 0) {
  6845. // zTree 的参数配置,深入使用请参考 API 文档(setting 配置详解)
  6846. var setting = {
  6847. callback: {
  6848. onClick: zTreeOnClick
  6849. }
  6850. };
  6851. $.fn.zTree.init($("#treeDemo"), setting, res.data);
  6852. var webuiId = $("#treeButton").attr("data-target");
  6853. var top = $("#" + webuiId).css("top");
  6854. if (top.indexOf("-") == 0) {
  6855. $("#" + webuiId).css("top", '0px');
  6856. }
  6857. } else {
  6858. errorMesage(res);
  6859. }
  6860. }
  6861. });
  6862. } else if (index == 2) {
  6863. $("#jcJyItem").webuiPopover('hide');
  6864. $.ajax({
  6865. type: "GET",
  6866. url: '/thmz/getJyJcZdClasses',
  6867. contentType: "application/json;charset=UTF-8",
  6868. dataType: "json",
  6869. async: false,
  6870. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6871. success: function (res) {
  6872. if (res == '401' || res == 401) {
  6873. window.location.href = '/thmz/login/view'
  6874. return;
  6875. }
  6876. if (res.code == 0) {
  6877. // zTree 的参数配置,深入使用请参考 API 文档(setting 配置详解)
  6878. var setting = {
  6879. callback: {
  6880. onClick: zTreeOnClick
  6881. }
  6882. };
  6883. $.fn.zTree.init($("#treeDemo"), setting, res.data);
  6884. var webuiId = $("#treeButton").attr("data-target");
  6885. var top = $("#" + webuiId).css("top");
  6886. if (top.indexOf("-") == 0) {
  6887. $("#" + webuiId).css("top", '0px');
  6888. }
  6889. } else {
  6890. errorMesage(res);
  6891. }
  6892. }
  6893. });
  6894. } else if (index == 1) {
  6895. $("#treeButton").webuiPopover('hide');
  6896. warningMesageSimaple("中药暂无帮助字典");
  6897. } else if (index == 3) {
  6898. $("#treeButton").webuiPopover('hide');
  6899. warningMesageSimaple("诊疗暂无帮助字典");
  6900. } else {
  6901. $("#treeButton").webuiPopover('hide');
  6902. warningMesageSimaple("入院暂无帮助字典");
  6903. }
  6904. }
  6905. /**
  6906. * 节点点击事件
  6907. * @param event
  6908. * @param treeId
  6909. * @param treeNode
  6910. */
  6911. function zTreeOnClick(event, treeId, treeNode) {
  6912. var index = getIndex("bill_item_group");
  6913. if (index == 0) {
  6914. $("#western_medicine_name").val(treeNode.id);
  6915. $('#western_medicine_name').webuiPopover('show');
  6916. loadYpList(0, null);
  6917. } else if (index == 2) {
  6918. $("#jcJyItem").val(treeNode.id);
  6919. $('#jcJyItem').webuiPopover('show');
  6920. loadjcJyItemList(null);
  6921. }
  6922. }
  6923. /**
  6924. * 构建处方参数
  6925. * @param type 1 保存处方 2 保存模板 3 计算金额
  6926. * @returns {any}
  6927. */
  6928. function getParamsForpPrescription(type) {
  6929. var codes = $("#diagnoseValue").val();
  6930. var icdCode = null;
  6931. if (codes != null && codes.length > 0) {
  6932. var arr = codes.split(",");
  6933. if (arr != null) {
  6934. for (i = 0; i < arr.length; i++) {
  6935. if (arr[i] != "") {
  6936. if (icdCode == null) {
  6937. icdCode = arr[i];
  6938. } else {
  6939. icdCode += "," + arr[i];
  6940. }
  6941. }
  6942. }
  6943. }
  6944. }
  6945. 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": ""}}');
  6946. jsonData.patientId = $("#patientId").text();
  6947. jsonData.firstOrNot = $("input[name='firstOrNot']:checked").val();
  6948. jsonData.icdCode = icdCode;
  6949. jsonData.serialNo = $("#mzfzSerialNoInClick").val();
  6950. if (type == 1) {
  6951. jsonData.turnToConsultationId = $("#turnToConsultationIdInClick").val();
  6952. }
  6953. jsonData.mzBlRecord.firstOrNot = jsonData.firstOrNot;
  6954. jsonData.mzBlRecord.emrChiefComplaint = $("#symptom").val();
  6955. jsonData.mzBlRecord.emrHpi = $("#emrHpi").val();
  6956. jsonData.mzBlRecord.emrPs = $("#emrPs").val();
  6957. jsonData.mzBlRecord.emrPe = $("#otherCheck").val();
  6958. jsonData.mzBlRecord.emrJkjy = $("#healthEducation").val();
  6959. jsonData.mzBlRecord.personalHistory = $("#personalHistory").val();
  6960. jsonData.mzBlRecord.familyHistory = $("#familyHistory").val();
  6961. jsonData.mzBlRecord.obstericalHistory = $("#obstericalHistory").val();
  6962. jsonData.mzBlRecord.weight = $("#weight").val();
  6963. jsonData.mzBlRecord.temperature = $("#temperature").val();
  6964. jsonData.mzBlRecord.sphygmus = $("#sphygmus").val();
  6965. jsonData.mzBlRecord.breathe = $("#breathe").val();
  6966. jsonData.mzBlRecord.pressureHigh = $("#pressure_high").val();
  6967. jsonData.mzBlRecord.pressureFloor = $("#pressure_floor").val();
  6968. jsonData.mzBlRecord.pressureHighLeft = $("#pressure_high_left").val();
  6969. jsonData.mzBlRecord.pressureFloorLeft = $("#pressure_floor_left").val();
  6970. jsonData.mzBlRecord.tentativeDiagnosis = $("#tentativeDiagnosis").val();
  6971. //设置处方详情
  6972. var emrFzjc = null;
  6973. var xyTabContents = $("#xyTabContent").find("div.tab-pane");
  6974. //处方号
  6975. var orderNo = 0;
  6976. var arrs = $("span.cf_amount");
  6977. //西药设置
  6978. if (xyTabContents != null && xyTabContents.length > 0) {
  6979. for (var i = 0; i < xyTabContents.length; i++) {
  6980. //当前药品类型
  6981. var currentGroupNo = $(xyTabContents[i]).find("input.current_groupNo").val();
  6982. var formGroups = $(xyTabContents[i]).find("div.form-group");
  6983. if (formGroups != null && formGroups.length > 0) {
  6984. for (var j = 0; j < formGroups.length; j++) {
  6985. var tempJson = JSON.parse('{"chargeItemCode": "","serial": "","quantity": "","drugQuan": "","drugUnit": "","frequency": "","orderDays": "","paySelf": "0","drugWin": "1","instructionCode":"",' +
  6986. '"instructionText":"","orderNo":"","groupOrder":"","supplyCode":"","tryFlag":"0","tryResult":"0","groupNo":"","cyJssm":"","cyDj":"","cyFysm":"","cyJsl":"","cyZql":"","cyFj":"","cyFfcs":"","cyMtjs":""}');
  6987. tempJson.chargeItemCode = $(formGroups[j]).find("input.temporary_items_code").val();
  6988. tempJson.serial = $(formGroups[j]).find("input.temporary_items_serial").val();
  6989. tempJson.quantity = $(formGroups[j]).find("input.temporary_items_gross").val();
  6990. tempJson.drugQuan = $(formGroups[j]).find("input.temporary_items_drugWin").val();
  6991. tempJson.drugUnit = $(formGroups[j]).find("input.temporary_items_drugWinUnit").val();
  6992. tempJson.frequency = $(formGroups[j]).find("input.temporary_items_orderFrequency").val();
  6993. tempJson.orderDays = $(formGroups[j]).find("input.temporary_items_dayNum").val();
  6994. tempJson.instructionCode = $(formGroups[j]).find("input.temporary_items_medicalAdvice").val();
  6995. tempJson.instructionText = $(formGroups[j]).find("input.temporary_items_medicalAdviceText").val();
  6996. tempJson.supplyCode = $(formGroups[j]).find("input.temporary_items_supplyType").val();
  6997. orderNo = i + 1;
  6998. tempJson.orderNo = orderNo;
  6999. tempJson.groupOrder = $(formGroups[j]).find("input.temporary_items_groupId").val();
  7000. tempJson.groupNo = currentGroupNo;
  7001. var tryResult = $(formGroups[j]).find("input.temporary_items_tryResult").val();
  7002. if (tryResult != undefined || tryResult != null || tryResult != "") {
  7003. if (tryResult == 100 || tryResult == "100") {
  7004. tempJson.tryFlag = 1;
  7005. } else {
  7006. tempJson.tryResult = tryResult;
  7007. }
  7008. }
  7009. jsonData.mzChargeDetailList[jsonData.mzChargeDetailList.length] = tempJson;
  7010. }
  7011. }
  7012. }
  7013. }
  7014. //中草药
  7015. var zyTabContents = $("#zyTabContent").find("div.form-group");
  7016. if (zyTabContents != null && zyTabContents.length > 0) {
  7017. orderNo++;
  7018. var zyfs = $("#zyfs").val();
  7019. if (zyfs == null || zyfs == "") {
  7020. if (type == 3) {
  7021. zyfs = 1;
  7022. } else {
  7023. errorMesageSimaple("中药付数为空,请设置!");
  7024. $("#messageButton").attr("disabled", false);
  7025. throw new Error('中药付数为空,请设置!');
  7026. }
  7027. }
  7028. //中药的类型
  7029. var currentZyClassType = $("#current_zyClassType").val();
  7030. for (var i = 0; i < zyTabContents.length; i++) {
  7031. var tempJson = JSON.parse('{"chargeItemCode": "","serial": "","quantity": "","drugQuan": "","drugUnit": "g","frequency": "","orderDays": "1","paySelf": "0","drugWin": "","instructionCode":"",' +
  7032. '"instructionText":"","orderNo":"1","groupOrder":"1","supplyCode":"","tryFlag":"0","tryResult":"0","groupNo":"","cyJssm":"","cyDj":"","cyFysm":"","cyJsl":"","cyZql":"","cyFj":"","cyFfcs":"","cyMtjs":""}');
  7033. tempJson.chargeItemCode = $(zyTabContents[i]).find("input.temporary_items_code").val();
  7034. tempJson.serial = $(zyTabContents[i]).find("input.temporary_items_serial").val();
  7035. tempJson.quantity = $(zyTabContents[i]).find("input.temporary_items_drugWin").val();
  7036. tempJson.drugQuan = $(zyTabContents[i]).find("input.temporary_items_drugWin").val();
  7037. tempJson.drugWin = zyfs;
  7038. //tempJson.frequency = $("#zy_orderFrequency_1").val();
  7039. tempJson.instructionCode = $(zyTabContents[i]).find("input.temporary_items_zyInstruction").val();
  7040. tempJson.instructionText = $(zyTabContents[i]).find("input.temporary_items_zyInstructionText").val();
  7041. tempJson.cyFysm = $("#useType_1").val();
  7042. tempJson.cyJssm = $("#cyJssm").val();
  7043. tempJson.cyDj = $("#zy_supplyType_1").val();
  7044. tempJson.cyJsl = $("#cyJsl").val();
  7045. tempJson.cyZql = $("#cyZql").val();
  7046. tempJson.cyFj = $("#cyFj").val();
  7047. tempJson.cyFfcs = $("#cyFfcs").val();
  7048. tempJson.cyMtjs = $("#cyMtjs").val();
  7049. tempJson.orderNo = orderNo;
  7050. tempJson.groupNo = currentZyClassType;
  7051. jsonData.mzChargeDetailList[jsonData.mzChargeDetailList.length] = tempJson;
  7052. }
  7053. }
  7054. //辅助检查、检验
  7055. var jcjyTabContents = $("#jcjyTabContent").find("div.form-group");
  7056. if (jcjyTabContents != null && jcjyTabContents.length > 0) {
  7057. orderNo++;
  7058. for (var i = 0; i < jcjyTabContents.length; i++) {
  7059. if (emrFzjc == null) {
  7060. emrFzjc = $(jcjyTabContents[i]).text();
  7061. } else {
  7062. emrFzjc += "," + $(jcjyTabContents[i]).text();
  7063. }
  7064. var tempJson = null;
  7065. //项目类型
  7066. var itemsType = $(jcjyTabContents[i]).find("input.temporary_items_type").val();
  7067. //执行科室
  7068. var execUnit = $(jcjyTabContents[i]).find("input.temporary_items_execUnit").val();
  7069. tempJson = JSON.parse('{"orderCode":"","inspectPart":"","inspectStuff":"","jyRemark":"","orderNo":"1","execDept":""}');
  7070. tempJson.orderCode = $(jcjyTabContents[i]).find("input.temporary_items_code").val();
  7071. if (itemsType == "1" || itemsType == 1) {
  7072. //检验
  7073. tempJson.inspectStuff = $(jcjyTabContents[i]).find("input.temporary_items_desc_value").val();
  7074. } else if (itemsType == "2" || itemsType == 2) {
  7075. //检查
  7076. tempJson.inspectPart = $(jcjyTabContents[i]).find("input.temporary_items_desc_value").val();
  7077. }
  7078. tempJson.jyRemark = $(jcjyTabContents[i]).find("input.temporary_items_remark").val();
  7079. tempJson.orderNo = orderNo;
  7080. tempJson.execDept = execUnit;
  7081. jsonData.mzYjReqList[jsonData.mzYjReqList.length] = tempJson;
  7082. }
  7083. }
  7084. //诊疗
  7085. var zlTabContents = $("#zlTabContent").find("div.form-group");
  7086. if (zlTabContents != null && zlTabContents.length > 0) {
  7087. orderNo++;
  7088. for (var i = 0; i < zlTabContents.length; i++) {
  7089. var tempJson = null;
  7090. //执行科室
  7091. var execUnit = $(zlTabContents[i]).find("input.temporary_items_execUnit").val();
  7092. //诊疗,放入药品类型中入库,因为诊疗是与药品一样直接入明细库,但是是与医技在同一处方开立页面开立
  7093. 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":""}');
  7094. tempJson.chargeItemCode = $(zlTabContents[i]).find("input.temporary_items_code").val();
  7095. tempJson.instructionText = $(zlTabContents[i]).find("input.temporary_items_remark").val();
  7096. tempJson.quantity = $(zlTabContents[i]).find("input.temporary_items_itemQuantity").val();
  7097. tempJson.orderNo = orderNo;
  7098. tempJson.execDept = execUnit;
  7099. jsonData.mzChargeDetailList[jsonData.mzChargeDetailList.length] = tempJson;
  7100. }
  7101. }
  7102. //入院
  7103. var zyReqTabContents = $("#zyReqTabContent").find("div.form-group");
  7104. if (zyReqTabContents != null && zyReqTabContents.length > 0) {
  7105. jsonData.mzZyReq.reqDept = $(zyReqTabContents[0]).find("input.temporary_inpatient_ward").val();
  7106. jsonData.mzZyReq.smallDept = $(zyReqTabContents[0]).find("input.temporary_items_small_ward").val();
  7107. jsonData.mzZyReq.admissStatus = $(zyReqTabContents[0]).find("input.temporary_items_admiss_status").val();
  7108. }
  7109. //设置诊断名称
  7110. var icdText = null;
  7111. var tagsTexts = $("span.el-select__tags-text");
  7112. if (tagsTexts != null && tagsTexts.length > 0) {
  7113. for (var i = 0; i < tagsTexts.length; i++) {
  7114. if (icdText == null) {
  7115. icdText = $(tagsTexts[i]).text();
  7116. } else {
  7117. icdText += "," + $(tagsTexts[i]).text();
  7118. }
  7119. }
  7120. }
  7121. jsonData.icdText = icdText;
  7122. jsonData.mzBlRecord.emrFzjc = emrFzjc;
  7123. return jsonData;
  7124. }
  7125. /**
  7126. * 保存处方
  7127. */
  7128. function savePrescription() {
  7129. //关闭帮助框
  7130. $("#treeButton").webuiPopover('hide');
  7131. $("#western_medicine_name").webuiPopover('hide');
  7132. $("#chinese_medicine_name").webuiPopover('hide');
  7133. $("#jcJyItem").webuiPopover('hide');
  7134. $("#zlItem").webuiPopover('hide');
  7135. $("#messageModal").modal();
  7136. $("#messageContent").html("确认保存处方吗?");
  7137. $("#messageButton").off("click").on("click", function (t) {
  7138. //$("#messageModal").modal("hide");
  7139. $("#messageButton").attr("disabled", true);
  7140. var jsonData = getParamsForpPrescription(1);
  7141. $.ajax({
  7142. type: "POST",
  7143. url: '/thmz/savePrescription',
  7144. contentType: "application/json;charset=UTF-8",
  7145. dataType: "json",
  7146. data: JSON.stringify(jsonData),
  7147. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7148. success: function (res) {
  7149. if (res == '401' || res == 401) {
  7150. window.location.href = '/thmz/login/view'
  7151. return;
  7152. }
  7153. $("#messageButton").attr("disabled", false);
  7154. if (res.code == 0) {
  7155. successMesage(res);
  7156. clearWorkSpace();
  7157. loadInClinicTableList();
  7158. loadClinicTableList();
  7159. //$("#messageModal").modal();
  7160. $("#messageContent").html("门诊处方保存成功,是否打印处方和门诊指引单?");
  7161. $("#messageButton").off("click").on("click", function (t) {
  7162. $("#messageModal").modal("hide");
  7163. printPrescription(res.data.patientId, res.data.times, res.data.id, 5, 1);
  7164. });
  7165. $("#cancelButton").off("click");
  7166. } else {
  7167. $("#messageModal").modal("hide");
  7168. errorMesage(res);
  7169. }
  7170. }
  7171. });
  7172. });
  7173. $("#cancelButton").off("click");
  7174. }
  7175. /**
  7176. * 保存医疗范文
  7177. */
  7178. function saveapidAccepts() {
  7179. var templateName = $("#templateName").val();
  7180. if (templateName == null || templateName == "") {
  7181. errorMesageSimaple("范文名称不能为空!");
  7182. return;
  7183. }
  7184. var templateKindType = $("#templateKindType").val();
  7185. if (templateKindType == null || templateKindType == "") {
  7186. errorMesageSimaple("范文类型不能为空!");
  7187. return;
  7188. }
  7189. var templateType = $("#templateType").val();
  7190. if (templateType == null || templateType == "") {
  7191. errorMesageSimaple("范文范围不能为空!");
  7192. return;
  7193. }
  7194. var templateStatus = $("#templateStatus").val();
  7195. if (templateStatus == null || templateStatus == "") {
  7196. errorMesageSimaple("范文状态不能为空!");
  7197. return;
  7198. }
  7199. $("#saveapidAcceptsModal").modal("hide");
  7200. $("#messageModal").modal();
  7201. $("#messageContent").html("确认保存医疗范文吗?");
  7202. $("#messageButton").off("click").on("click", function (t) {
  7203. $("#messageModal").modal("hide");
  7204. var jsonData = getParamsForpPrescription(2);
  7205. $.ajax({
  7206. type: "POST",
  7207. url: '/thmz/saveTemplate',
  7208. contentType: "application/json;charset=UTF-8",
  7209. dataType: "json",
  7210. data: JSON.stringify({
  7211. "id": $("#templateId").val(),
  7212. "name": templateName,
  7213. "icdText": jsonData.icdText != null ? jsonData.icdText : jsonData.mzBlRecord.tentativeDiagnosis,
  7214. "templateKindType": templateKindType,
  7215. "templateType": templateType,
  7216. "templateStatus": templateStatus,
  7217. "templateData": JSON.stringify(jsonData),
  7218. "emrChiefComplaint": $("#symptom").val(),
  7219. "emrHpi": $("#emrHpi").val(),
  7220. "emrPs": $("#emrPs").val(),
  7221. "icdCode": $("#diagnoseValue").val()
  7222. }),
  7223. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7224. success: function (res) {
  7225. if (res == '401' || res == 401) {
  7226. window.location.href = '/thmz/login/view'
  7227. return;
  7228. }
  7229. if (res.code == 0) {
  7230. successMesage(res);
  7231. //范本保存完不清空
  7232. //clearWorkSpace();
  7233. } else {
  7234. $("#saveapidAcceptsModal").modal();
  7235. errorMesage(res);
  7236. }
  7237. }
  7238. });
  7239. });
  7240. $("#cancelButton").off("click");
  7241. }
  7242. /**
  7243. * 停用医疗范文
  7244. */
  7245. function removeTemplate() {
  7246. $("#messageModal").modal();
  7247. $("#messageContent").html("确认停用医疗范文吗?");
  7248. $("#messageButton").off("click").on("click", function (t) {
  7249. $("#messageModal").modal("hide");
  7250. $.ajax({
  7251. type: "POST",
  7252. url: '/thmz/removeTemplate',
  7253. contentType: "application/json;charset=UTF-8",
  7254. dataType: "json",
  7255. data: JSON.stringify({
  7256. "id": $("#idTemplate").val()
  7257. }),
  7258. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7259. success: function (res) {
  7260. if (res == '401' || res == 401) {
  7261. window.location.href = '/thmz/login/view'
  7262. return;
  7263. }
  7264. if (res.code == 0) {
  7265. successMesage(res);
  7266. $("#medicalModelModal").modal("hide");
  7267. fitTemplateData();
  7268. } else {
  7269. errorMesage(res);
  7270. }
  7271. }
  7272. });
  7273. });
  7274. $("#cancelButton").off("click");
  7275. }
  7276. /**
  7277. * 清空医疗范文模块内容
  7278. */
  7279. function clearApidAcceptsModal() {
  7280. $("#templateId").val(null);
  7281. $("#templateName").val(null);
  7282. $("#templateKindType").selectpicker('val', 0);
  7283. $("#templateKindType").selectpicker('refresh');
  7284. $("#templateType").selectpicker('val', 0);
  7285. $("#templateType").selectpicker('refresh');
  7286. $("#templateStatus").selectpicker('val', 0);
  7287. $("#templateStatus").selectpicker('refresh');
  7288. }
  7289. /**
  7290. * 查询病人未缴费处方信息 加载到处方修改
  7291. * @param patientId
  7292. * @param times
  7293. * @param clnicId 就诊记录id
  7294. */
  7295. function getMzPrescriptionVoUnPaid(patientId, times, clnicId) {
  7296. var currentPatientId = $("#patientId").text();
  7297. //当前接诊的用户和操作接诊的是同一个人,不做任何操作
  7298. if (currentPatientId == patientId) {
  7299. warningMesageSimaple("当前病人正在接诊中,请勿重复操作!");
  7300. return;
  7301. }
  7302. if (currentPatientId == null || currentPatientId == "") {
  7303. //当前没有人接诊,直接接诊
  7304. getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId);
  7305. } else {
  7306. //当前有人在接诊,提示是否需要切换和保存
  7307. $("#messagePrescriptionModal").modal();
  7308. $("#confirmPrescriptionButton").off("click").on("click", function (t) {
  7309. $("#messagePrescriptionModal").modal("hide");
  7310. //先保存目前接诊信息,再切换就诊人
  7311. var jsonData = getParamsForpPrescription(1);
  7312. $.ajax({
  7313. type: "POST",
  7314. url: '/thmz/savePrescription',
  7315. contentType: "application/json;charset=UTF-8",
  7316. dataType: "json",
  7317. data: JSON.stringify(jsonData),
  7318. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7319. success: function (res) {
  7320. if (res == '401' || res == 401) {
  7321. window.location.href = '/thmz/login/view'
  7322. return;
  7323. }
  7324. if (res.code == 0) {
  7325. loadInClinicTableList();
  7326. loadClinicTableList();
  7327. getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId);
  7328. } else {
  7329. errorMesage(res);
  7330. }
  7331. }
  7332. });
  7333. });
  7334. $("#cancelPrescriptionButton").off("click").on("click", function (t) {
  7335. $("#messagePrescriptionModal").modal("hide");
  7336. getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId);
  7337. });
  7338. }
  7339. }
  7340. /**
  7341. * 查询病人未缴费处方信息 加载到处方修改 通用方法
  7342. * @param patientId
  7343. * @param times
  7344. * @param clnicId 就诊记录id
  7345. */
  7346. function getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId) {
  7347. $.ajax({
  7348. type: "GET",
  7349. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + "&times=" + times + "&MzBlRecordFlag=false&payMark=5&clnicId=null",
  7350. contentType: "application/json;charset=UTF-8",
  7351. dataType: "json",
  7352. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7353. success: function (res) {
  7354. if (res == '401' || res == 401) {
  7355. window.location.href = '/thmz/login/view'
  7356. return;
  7357. }
  7358. if (res.code == 0) {
  7359. clearWorkSpace();
  7360. setMzPatientInfo(res.mzPatientMi);
  7361. editPrescription(res.data, 0)
  7362. //修改患者的时候,将原纪录的就诊记录id带上,并借用分诊流水号字段传参
  7363. $("#mzfzSerialNoInClick").val("clnicId_" + clnicId);
  7364. } else {
  7365. errorMesage(res);
  7366. }
  7367. }
  7368. });
  7369. }
  7370. /**
  7371. * 查询病人已缴费处方信息 调用处方
  7372. * @param patientId
  7373. * @param times
  7374. * @param clnicId 就诊记录id
  7375. */
  7376. function getMzPrescriptionVoPaid(patientId, times, clnicId) {
  7377. $("#visitingDetailModal").modal("hide");
  7378. $("#messageModal").modal();
  7379. $("#messageContent").html("确认调用选中处方吗?将会覆盖当前处方。");
  7380. $("#messageButton").off("click").on("click", function (t) {
  7381. $("#messageModal").modal("hide");
  7382. $.ajax({
  7383. type: "GET",
  7384. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + "&times=" + times + "&MzBlRecordFlag=false&payMark=0&clnicId=null",
  7385. contentType: "application/json;charset=UTF-8",
  7386. dataType: "json",
  7387. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7388. success: function (res) {
  7389. if (res == '401' || res == 401) {
  7390. window.location.href = '/thmz/login/view'
  7391. return;
  7392. }
  7393. if (res.code == 0) {
  7394. var mzfzSerialNoInClick = $("#mzfzSerialNoInClick").val();
  7395. var mzfzReqTypeNoInClick = $("#mzfzReqTypeNoInClick").val();
  7396. clearUser(false);
  7397. clearWorkSpaceExcludeUser(3);
  7398. setMzPatientInfo(res.mzPatientMi);
  7399. editPrescription(res.data, 2)
  7400. $("#mzfzSerialNoInClick").val(mzfzSerialNoInClick);
  7401. $("#mzfzReqTypeNoInClick").val(mzfzReqTypeNoInClick);
  7402. } else {
  7403. errorMesage(res);
  7404. }
  7405. }
  7406. });
  7407. });
  7408. $("#cancelButton").off("click");
  7409. }
  7410. /**
  7411. * 重复接诊
  7412. * @param patientId
  7413. * @param times
  7414. * @param clnicId
  7415. * @param deptCode 就诊科室编码
  7416. */
  7417. function repeatAccepts(patientId, times, clnicId, deptCode) {
  7418. $.ajax({
  7419. type: "GET",
  7420. url: '/thmz/validMzyReqrec?patientId=' + patientId + "&deptCode=" + deptCode,
  7421. contentType: "application/json;charset=UTF-8",
  7422. dataType: "json",
  7423. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7424. success: function (res) {
  7425. if (res == '401' || res == 401) {
  7426. window.location.href = '/thmz/login/view'
  7427. return;
  7428. }
  7429. if (res.code == 0) {
  7430. if (res.data == 0) {
  7431. $("#messageModal").modal();
  7432. $("#messageContent").html("挂号失效,确定继续就诊?");
  7433. $("#messageButton").off("click").on("click", function (t) {
  7434. $("#messageModal").modal("hide");
  7435. repeatAcceptsConfirm(patientId, times, clnicId);
  7436. });
  7437. $("#cancelButton").off("click");
  7438. return;
  7439. }
  7440. repeatAcceptsConfirm(patientId, times, clnicId);
  7441. } else {
  7442. errorMesage(res);
  7443. }
  7444. }
  7445. });
  7446. }
  7447. /**
  7448. * 重复接诊提示方法
  7449. * @param patientId
  7450. * @param times
  7451. * @param clnicId
  7452. */
  7453. function repeatAcceptsConfirm(patientId, times, clnicId) {
  7454. var currentPatientId = $("#patientId").text();
  7455. //当前接诊的用户和操作接诊的是同一个人,不做任何操作
  7456. if (currentPatientId == patientId) {
  7457. return;
  7458. }
  7459. if (currentPatientId == null || currentPatientId == "") {
  7460. //当前没有人接诊,直接接诊
  7461. repeatAcceptsCommon(patientId, times, clnicId);
  7462. } else {
  7463. //当前有人在接诊,提示是否需要切换和保存
  7464. $("#messagePrescriptionModal").modal();
  7465. $("#confirmPrescriptionButton").off("click").on("click", function (t) {
  7466. $("#messagePrescriptionModal").modal("hide");
  7467. //先保存目前接诊信息,再切换就诊人
  7468. var jsonData = getParamsForpPrescription(1);
  7469. $.ajax({
  7470. type: "POST",
  7471. url: '/thmz/savePrescription',
  7472. contentType: "application/json;charset=UTF-8",
  7473. dataType: "json",
  7474. data: JSON.stringify(jsonData),
  7475. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7476. success: function (res) {
  7477. if (res == '401' || res == 401) {
  7478. window.location.href = '/thmz/login/view'
  7479. return;
  7480. }
  7481. if (res.code == 0) {
  7482. repeatAcceptsCommon(patientId, times, clnicId);
  7483. //加载已接诊患者列表
  7484. loadClinicTableList();
  7485. } else {
  7486. errorMesage(res);
  7487. }
  7488. }
  7489. });
  7490. });
  7491. $("#cancelPrescriptionButton").off("click").on("click", function (t) {
  7492. $("#messagePrescriptionModal").modal("hide");
  7493. repeatAcceptsCommon(patientId, times, clnicId);
  7494. });
  7495. }
  7496. }
  7497. /**
  7498. * 重复接诊通用方法
  7499. * @param patientId
  7500. * @param times
  7501. * @param clnicId
  7502. */
  7503. function repeatAcceptsCommon(patientId, times, clnicId) {
  7504. $.ajax({
  7505. type: "GET",
  7506. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + "&times=" + times + "&MzBlRecordFlag=true&payMark=null&clnicId=null",
  7507. contentType: "application/json;charset=UTF-8",
  7508. dataType: "json",
  7509. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7510. success: function (res) {
  7511. if (res == '401' || res == 401) {
  7512. window.location.href = '/thmz/login/view'
  7513. return;
  7514. }
  7515. if (res.code == 0) {
  7516. clearWorkSpace();
  7517. setMzPatientInfo(res.mzPatientMi);
  7518. editPrescription(res.data, 0)
  7519. //修改患者的时候,将原纪录的就诊记录id带上,并借用分诊流水号字段传参
  7520. $("#mzfzSerialNoInClick").val("clnicId_" + clnicId);
  7521. } else {
  7522. errorMesage(res);
  7523. }
  7524. }
  7525. });
  7526. }
  7527. /**
  7528. * 就诊详情 已诊患者列表发起
  7529. * @param patientId
  7530. * @param times
  7531. * @param clnicId
  7532. * @param payMark
  7533. */
  7534. function prescriptionDetail(patientId, times, clnicId, payMark) {
  7535. prescriptionDetailCommon(patientId, times, clnicId, payMark, 0);
  7536. }
  7537. /**
  7538. * 就诊详情 历史轨迹发起
  7539. * @param patientId
  7540. * @param times
  7541. * @param clnicId
  7542. * @param clinicStatus
  7543. */
  7544. function visitingDetailModal(patientId, times, clnicId, clinicStatus) {
  7545. var payMark = null;
  7546. if (clinicStatus == 5) {
  7547. payMark = 5;
  7548. } else {
  7549. payMark = 0;
  7550. }
  7551. prescriptionDetailCommon(patientId, times, clnicId, payMark, 1);
  7552. }
  7553. /**
  7554. * 就诊详情通用方法
  7555. * @param patientId
  7556. * @param times
  7557. * @param clnicId
  7558. * @param payMark
  7559. * @param type 0 已诊患者列表发起 1 历史轨迹发起
  7560. */
  7561. function prescriptionDetailCommon(patientId, times, clnicId, payMark, type) {
  7562. $('#baseMzBlTimes').val(null);
  7563. var oriPayMark = payMark;
  7564. if (payMark == 1) {
  7565. //退费时,查看的明细还是处方开立的情况
  7566. payMark = 0;
  7567. }
  7568. $("#conciseRecordsJzxq").prop("checked", true);
  7569. $("#prescriptionSubsidiaryJzxq").prop("checked", true);
  7570. $.ajax({
  7571. type: "GET",
  7572. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + '&times=' + times + '&MzBlRecordFlag=false&payMark=' + payMark + '&clnicId=' + clnicId,
  7573. contentType: "application/json;charset=UTF-8",
  7574. dataType: "json",
  7575. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7576. success: function (res) {
  7577. if (res == '401' || res == 401) {
  7578. window.location.href = '/thmz/login/view'
  7579. return;
  7580. }
  7581. if (res.code == 0) {
  7582. $("#visitingDetailModal").modal();
  7583. var jsonData = res.data;
  7584. var mzPatientMi = res.mzPatientMi;
  7585. $("#visitingDetailPatientName").text(mzPatientMi.name);
  7586. $("#visitingDetailPatientAge").text(mzPatientMi.age);
  7587. $("#visitingDetailPatientGender").val(mzPatientMi.gender);
  7588. $("#prescriptionDetail_zd").html("");
  7589. $("#prescriptionDetail_xyzlContent").html("");
  7590. $("#prescriptionDetail_zyzlContent").html("");
  7591. $("#prescriptionDetail_zlyjContent").html("");
  7592. if (res.opDate != null) {
  7593. $("#visitingDetailDate").text(res.opDate);
  7594. }
  7595. if (res.deptName != null) {
  7596. $("#visitingDetailDept").text(res.deptName);
  7597. }
  7598. if (res.doctorName != null) {
  7599. $("#visitingDetailDoctor").text(res.doctorName);
  7600. }
  7601. var firstOrNot = jsonData.mzBlRecord.firstOrNot;
  7602. if (firstOrNot == 0) {
  7603. $("#visitFlag").html("初诊");
  7604. $("#first").next().click();
  7605. } else if (firstOrNot == 1) {
  7606. $("#visitFlag").html("复诊");
  7607. $("#not").next().click();
  7608. }
  7609. if (oriPayMark == 0) {
  7610. $("#chargeImage").attr("src", "/thmz/images/charge.png");
  7611. } else if (oriPayMark == 1) {
  7612. $("#chargeImage").attr("src", "/thmz/images/refund.png");
  7613. } else if (oriPayMark == 5) {
  7614. $("#chargeImage").attr("src", "/thmz/images/nocharge.png");
  7615. }
  7616. $("#prescriptionDetail_zs").html(jsonData.mzBlRecord.emrChiefComplaint);
  7617. $("#prescriptionDetail_xbs").html(jsonData.mzBlRecord.emrHpi);
  7618. var icdText = jsonData.icdText;
  7619. if (icdText != null) {
  7620. var arr = icdText.split(",");
  7621. var html = "";
  7622. for (var i = 0; i < arr.length; i++) {
  7623. if (i == 0) {
  7624. html += ' <div class="tagZdy tagZdy-back">';
  7625. } else {
  7626. html += ' <div class="tagZdy tagZdy-back-green">';
  7627. }
  7628. html += arr[i];
  7629. html += '</div>';
  7630. }
  7631. $("#prescriptionDetail_zd").html(html);
  7632. } else {
  7633. $("#prescriptionDetail_zd").html(jsonData.mzBlRecord.tentativeDiagnosis);
  7634. }
  7635. var prescriptionDetail = jsonData.mzBlRecord.prescriptionDetail;
  7636. if (prescriptionDetail != null) {
  7637. var checkBox = type == 1;
  7638. prescriptionDetail = JSON.parse(prescriptionDetail);
  7639. var xyPrescription = prescriptionDetail.xyPrescription;
  7640. if (xyPrescription != null) {
  7641. fitxyContent(xyPrescription.pyPrescription, "prescriptionDetail_xypyContent", "prescriptionDetail_xypyTitle", checkBox);
  7642. fitxyContent(xyPrescription.mjPrescription, "prescriptionDetail_xymjContent", "prescriptionDetail_xymjTitle", checkBox);
  7643. fitxyContent(xyPrescription.jePrescription, "prescriptionDetail_xyjeContent", "prescriptionDetail_xyjeTitle", checkBox);
  7644. fitxyContent(xyPrescription.ycPrescription, "prescriptionDetail_yczlContent", "prescriptionDetail_yczlTitle", checkBox);
  7645. } else {
  7646. $("#prescriptionDetail_xypyTitle").removeClass("in").addClass("hide");
  7647. $("#prescriptionDetail_xypyContent").html("");
  7648. $("#prescriptionDetail_xymjTitle").removeClass("in").addClass("hide");
  7649. $("#prescriptionDetail_xymjContent").html("");
  7650. $("#prescriptionDetail_xyjeTitle").removeClass("in").addClass("hide");
  7651. $("#prescriptionDetail_xyjeContent").html("");
  7652. $("#prescriptionDetail_yczlTitle").removeClass("in").addClass("hide");
  7653. $("#prescriptionDetail_yczlContent").html("");
  7654. }
  7655. var zyPrescription = prescriptionDetail.zyPrescription;
  7656. if (zyPrescription != null) {
  7657. fitzyContent(zyPrescription, "prescriptionDetail_zyzlContent", "prescriptionDetail_zyzlTitle", checkBox);
  7658. } else {
  7659. $("#prescriptionDetail_zyzlTitle").removeClass("in").addClass("hide");
  7660. $("#prescriptionDetail_zyzlContent").html("");
  7661. }
  7662. var jcjyPrescription = prescriptionDetail.jcjyPrescription;
  7663. if (jcjyPrescription != null) {
  7664. fitJcjyContent(jcjyPrescription, "prescriptionDetail_jcjyContent", "prescriptionDetail_jcjyTitle", checkBox);
  7665. } else {
  7666. ("#prescriptionDetail_jcjyTitle").removeClass("in").addClass("hide");
  7667. $("#prescriptionDetail_jcjyContent").html("");
  7668. }
  7669. var zlPrescription = prescriptionDetail.zlPrescription;
  7670. if (zlPrescription != null) {
  7671. fitJcjyContent(zlPrescription, "prescriptionDetail_zlContent", "prescriptionDetail_zlTitle", checkBox);
  7672. } else {
  7673. $("#prescriptionDetail_zlTitle").removeClass("in").addClass("hide");
  7674. $("#prescriptionDetail_zlContent").html("");
  7675. }
  7676. var zyReqPrescription = prescriptionDetail.zyReqPrescription;
  7677. if (zyReqPrescription != null) {
  7678. fitZyReqContent(zyReqPrescription, "prescriptionDetail_zyReqContent", "prescriptionDetail_zyReqTitle", true);
  7679. } else {
  7680. $("#prescriptionDetail_zyReqTitle").removeClass("in").addClass("hide");
  7681. $("#prescriptionDetail_zyReqContent").html("");
  7682. }
  7683. } else {
  7684. $("#prescriptionDetail_xypyTitle").removeClass("in").addClass("hide");
  7685. $("#prescriptionDetail_xypyContent").html("");
  7686. $("#prescriptionDetail_xymjTitle").removeClass("in").addClass("hide");
  7687. $("#prescriptionDetail_xymjContent").html("");
  7688. $("#prescriptionDetail_xyjeTitle").removeClass("in").addClass("hide");
  7689. $("#prescriptionDetail_xyjeContent").html("");
  7690. $("#prescriptionDetail_yczlTitle").removeClass("in").addClass("hide");
  7691. $("#prescriptionDetail_yczlContent").html("");
  7692. $("#prescriptionDetail_zyzlTitle").removeClass("in").addClass("hide");
  7693. $("#prescriptionDetail_zyzlContent").html("");
  7694. $("#prescriptionDetail_jcjyTitle").removeClass("in").addClass("hide");
  7695. $("#prescriptionDetail_jcjyContent").html("");
  7696. $("#prescriptionDetail_zlTitle").removeClass("in").addClass("hide");
  7697. $("#prescriptionDetail_zlContent").html("");
  7698. $("#prescriptionDetail_zyReqTitle").removeClass("in").addClass("hide");
  7699. $("#prescriptionDetail_zyReqContent").html("");
  7700. }
  7701. $("#printJcReq").removeClass("in").addClass("hide");
  7702. $("#printJcReq").off("click");
  7703. $("#printJyReq").removeClass("in").addClass("hide");
  7704. $("#printJyReq").off("click");
  7705. $("#printJcReqSetup").removeClass("in").addClass("hide");
  7706. $("#printJcReqSetup").off("click");
  7707. $("#printJyReqSetup").removeClass("in").addClass("hide");
  7708. $("#printJyReqSetup").off("click");
  7709. $("#previewYjReq").removeClass("in").addClass("hide");
  7710. $("#previewYjReq").off("click");
  7711. $("#previewYjReqAll").removeClass("in").addClass("hide");
  7712. $("#previewYjReqAll").off("click");
  7713. $("#deletePrescription").removeClass("in").addClass("hide");
  7714. $("#deletePrescription").off("click");
  7715. if (jsonData.mzYjReqList != null && jsonData.mzYjReqList.length > 0) {
  7716. $("#previewYjReq").removeClass("hide").addClass("in");
  7717. $("#previewYjReq").off("click").on("click", function (t) {
  7718. previewYjReq(patientId, times);
  7719. });
  7720. }
  7721. if (res.yjReqCount != null && res.yjReqCount > 0) {
  7722. $("#previewYjReqAll").removeClass("hide").addClass("in");
  7723. $("#previewYjReqAll").off("click").on("click", function (t) {
  7724. previewYjReqAll(patientId);
  7725. });
  7726. }
  7727. if (type == 0) {
  7728. $("#callPrescription").removeClass("in").addClass("hide");
  7729. if ((jsonData.mzChargeDetailList == null || jsonData.mzChargeDetailList.length == 0) && (jsonData.mzYjReqList == null || jsonData.mzYjReqList.length == 0)) {
  7730. $("#printPrescription").removeClass("in").addClass("hide");
  7731. $("#printPrescriptionSetup").removeClass("in").addClass("hide");
  7732. } else {
  7733. $("#printPrescription").removeClass("hide").addClass("in");
  7734. $("#printPrescription").off("click").on("click", function (t) {
  7735. printPrescription(patientId, times, clnicId, payMark, 1);
  7736. });
  7737. $("#printPrescriptionSetup").removeClass("hide").addClass("in");
  7738. $("#printPrescriptionSetup").off("click").on("click", function (t) {
  7739. printPrescription(patientId, times, clnicId, payMark, 2);
  7740. });
  7741. }
  7742. if (jsonData.mzYjReqList != null && jsonData.mzYjReqList.length > 0) {
  7743. var hadJc = false;
  7744. var hadJy = false;
  7745. for (var i = 0; i < jsonData.mzYjReqList.length; i++) {
  7746. var mzYjReq = jsonData.mzYjReqList[i];
  7747. if (mzYjReq.reqType == 2) {
  7748. hadJy = true;
  7749. } else if (mzYjReq.reqType == 3) {
  7750. hadJc = true;
  7751. }
  7752. }
  7753. if (hadJc) {
  7754. $("#printJcReq").removeClass("hide").addClass("in");
  7755. $("#printJcReq").off("click").on("click", function (t) {
  7756. printYjReq(patientId, times, 3, 1);
  7757. });
  7758. $("#printJcReqSetup").removeClass("hide").addClass("in");
  7759. $("#printJcReqSetup").off("click").on("click", function (t) {
  7760. printYjReq(patientId, times, 3, 2);
  7761. });
  7762. }
  7763. if (hadJy) {
  7764. $("#printJyReq").removeClass("hide").addClass("in");
  7765. $("#printJyReq").off("click").on("click", function (t) {
  7766. printYjReq(patientId, times, 2, 1);
  7767. });
  7768. $("#printJyReqSetup").removeClass("hide").addClass("in");
  7769. $("#printJyReqSetup").off("click").on("click", function (t) {
  7770. printYjReq(patientId, times, 2, 2);
  7771. });
  7772. }
  7773. }
  7774. if (jsonData.mzZyReq == null || jsonData.mzZyReq.reqDept == null || jsonData.mzZyReq.reqDept == "") {
  7775. $("#printZyReq").removeClass("in").addClass("hide");
  7776. $("#printZyReq").off("click");
  7777. $("#printZyReqSetup").removeClass("in").addClass("hide");
  7778. $("#printZyReqSetup").off("click");
  7779. } else {
  7780. $("#printZyReq").removeClass("hide").addClass("in");
  7781. $("#printZyReq").off("click").on("click", function (t) {
  7782. printZyReq(patientId, 1);
  7783. });
  7784. $("#printZyReqSetup").removeClass("hide").addClass("in");
  7785. $("#printZyReqSetup").off("click").on("click", function (t) {
  7786. printZyReq(patientId, 2);
  7787. });
  7788. }
  7789. //未缴费状态的时候可以删除处方
  7790. if (oriPayMark == 5 || oriPayMark == "5") {
  7791. $("#deletePrescription").removeClass("hide").addClass("in");
  7792. $("#deletePrescription").off("click").on("click", function (t) {
  7793. deletePrescription(clnicId);
  7794. });
  7795. }
  7796. } else {
  7797. $("#printPrescription").removeClass("in").addClass("hide");
  7798. $("#printZyReq").removeClass("in").addClass("hide");
  7799. $("#printBlRecord").removeClass("in").addClass("hide");
  7800. $("#printJcReq").removeClass("in").addClass("hide");
  7801. $("#printJyReq").removeClass("in").addClass("hide");
  7802. $("#callPrescription").removeClass("hide").addClass("in");
  7803. $("#callPrescription").off("click").on("click", function (t) {
  7804. getMzPrescriptionVoPaid(patientId, times, clnicId);
  7805. });
  7806. }
  7807. if (oriPayMark == 1) {
  7808. $("#printPrescription").removeClass("in").addClass("hide");
  7809. $("#printPrescriptionSetup").removeClass("in").addClass("hide");
  7810. } else {
  7811. if ((jsonData.mzChargeDetailList == null || jsonData.mzChargeDetailList.length == 0) && (jsonData.mzYjReqList == null || jsonData.mzYjReqList.length == 0)) {
  7812. $("#printPrescription").removeClass("in").addClass("hide");
  7813. $("#printPrescriptionSetup").removeClass("in").addClass("hide");
  7814. } else {
  7815. $("#printPrescription").removeClass("hide").addClass("in");
  7816. $("#printPrescription").off("click").on("click", function (t) {
  7817. printPrescription(patientId, times, clnicId, payMark, 1);
  7818. });
  7819. $("#printPrescriptionSetup").removeClass("hide").addClass("in");
  7820. $("#printPrescriptionSetup").off("click").on("click", function (t) {
  7821. printPrescription(patientId, times, clnicId, payMark, 2);
  7822. });
  7823. }
  7824. }
  7825. $("#printBlRecord").removeClass("hide").addClass("in");
  7826. $("#printBlRecord").off("click").on("click", function (t) {
  7827. printBlRecord(patientId, times, 1);
  7828. });
  7829. $("#printBlRecordSetup").removeClass("hide").addClass("in");
  7830. $("#printBlRecordSetup").off("click").on("click", function (t) {
  7831. printBlRecord(patientId, times, 2);
  7832. });
  7833. $("#showMzBlRecordModal").removeClass("hide").addClass("in");
  7834. $("#showMzBlRecordModal").off("click").on("click", function (t) {
  7835. showMzBlRecordModal(patientId, times, 1);
  7836. });
  7837. if ($("#setupId").hasClass("fa-chevron-up")) {
  7838. //默认不展开打印设置
  7839. $("#setupId").parent().click();
  7840. }
  7841. // setTimeout(function () {
  7842. // if ($("#setupId").hasClass("fa-chevron-up")) {
  7843. // //默认不展开打印设置
  7844. // $("#setupId").parent().click();
  7845. // }
  7846. // }, 400);
  7847. //就诊详情的时候,隐藏复选框
  7848. if (type == 0) {
  7849. $("#visitingDetailModal").find("input[type=checkbox]").each(function (index, obj) {
  7850. $(obj).css("display", "none");
  7851. });
  7852. } else {
  7853. //历史处方显示复选框
  7854. $("#visitingDetailModal").find("input[type=checkbox]").each(function (index, obj) {
  7855. $(obj).css("display", "inline-block");
  7856. });
  7857. }
  7858. } else {
  7859. errorMesage(res);
  7860. }
  7861. }
  7862. });
  7863. }
  7864. /**
  7865. * 查询默认打印机
  7866. */
  7867. function setPrint() {
  7868. if (printIndex >= 0) {
  7869. return;
  7870. }
  7871. $.ajax({
  7872. type: "GET",
  7873. url: '/thmz/getLastWindowsByCurrentUser',
  7874. contentType: "application/json;charset=UTF-8",
  7875. dataType: "json",
  7876. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7877. async: false,
  7878. success: function (res) {
  7879. if (res == '401' || res == 401) {
  7880. window.location.href = '/thmz/login/view'
  7881. return;
  7882. }
  7883. if (res.code == 0) {
  7884. printIndex = res.data.cgPrintIndex;
  7885. } else {
  7886. printIndex = -1;
  7887. }
  7888. }
  7889. });
  7890. }
  7891. function setTableHtml(prescriptionDetail) {
  7892. //设置成组处方符号
  7893. if (prescriptionDetail.length > 1) {
  7894. var map = new Map();
  7895. var groupOrderlist = [];
  7896. for (var j = 0; j < prescriptionDetail.length; j++) {
  7897. var detail = prescriptionDetail[j];
  7898. var list = map.get(detail.groupOrder);
  7899. if (list == null) {
  7900. list = [];
  7901. map.put(detail.groupOrder, list);
  7902. groupOrderlist[groupOrderlist.length] = detail.groupOrder;
  7903. }
  7904. list[list.length] = detail;
  7905. }
  7906. for (var j = 0; j < groupOrderlist.length; j++) {
  7907. var list = map.get(groupOrderlist[j]);
  7908. if (list.length == 1) {
  7909. continue;
  7910. }
  7911. list[0].groupFlag = "┒";
  7912. list[list.length - 1].groupFlag = "┛";
  7913. if (list.length > 2) {
  7914. for (var t = 1; t < list.length - 1; t++) {
  7915. list[t].groupFlag = "┃";
  7916. }
  7917. }
  7918. }
  7919. }
  7920. var html = "";
  7921. for (var j = 0; j < prescriptionDetail.length; j++) {
  7922. var detail = prescriptionDetail[j];
  7923. html += "<tr><td>" + detail.groupOrder + "</td>";
  7924. html += "<td colspan='2'>";
  7925. html += detail.name + "(" + detail.specification + ")";
  7926. html += "</td>";
  7927. html += "<td colspan='2'></td>";
  7928. html += "<td>X</td>";
  7929. html += "<td rowspan='2' style='height: 100%;line-height: 100%;font-size: 40px;'>";
  7930. if (detail.groupFlag != undefined && detail.groupFlag != null) {
  7931. html += detail.groupFlag;
  7932. }
  7933. html += "</td><td>" + detail.quantity + detail.packUnit + "</td>";
  7934. html += "</tr>";
  7935. html += "<tr><td></td>";
  7936. if (detail.tryResult != undefined && detail.tryResult != null && detail.tryResult != "null" && detail.tryResult != "") {
  7937. html += "<td>" + detail.tryResult + "</td>";
  7938. } else if (detail.tryFlag != undefined && detail.tryFlag != null && detail.tryFlag != "null" && detail.tryFlag != "") {
  7939. html += "<td>" + detail.tryFlag + "</td>";
  7940. } else {
  7941. html += "<td></td>";
  7942. }
  7943. html += "<td style='font-weight: bold;text-align: right;'>用法:</td>";
  7944. html += "<td>" + detail.drugQuan + detail.unitDesc + "/次</td>";
  7945. html += "<td>" + detail.frequency + "</td>";
  7946. html += "<td>" + detail.orderDays + "天</td>";
  7947. html += "<td>" + detail.supplyName + "</td>";
  7948. html += "</tr>";
  7949. }
  7950. html += "<tr><td colspan='7'>&nbsp;&nbsp;&nbsp;&nbsp;------(以下空白)------</td></tr>";
  7951. return {html: html, j: j};
  7952. }
  7953. // /**
  7954. // * 打印门诊指引单
  7955. // * @param patientId
  7956. // * @param times
  7957. // */
  7958. // function printGuideCard(patientId, times) {
  7959. //
  7960. // }
  7961. /**
  7962. * 打印门诊处方
  7963. * @param patientId
  7964. * @param times
  7965. * @param clnicId
  7966. * @param payMark
  7967. * @param printType 打印模式 1 预览打印 2 打印设置
  7968. */
  7969. function printPrescription(patientId, times, clnicId, payMark, printType) {
  7970. $.ajax({
  7971. type: "GET",
  7972. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + '&times=' + times + '&MzBlRecordFlag=false&payMark=' + payMark + '&clnicId=' + clnicId,
  7973. contentType: "application/json;charset=UTF-8",
  7974. dataType: "json",
  7975. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7976. success: function (res) {
  7977. if (res == '401' || res == 401) {
  7978. window.location.href = '/thmz/login/view'
  7979. return;
  7980. }
  7981. if (res.code == 0) {
  7982. var prescriptionDetail = res.data.mzBlRecord.prescriptionDetail;
  7983. if (prescriptionDetail != null && prescriptionDetail != "") {
  7984. var prescriptionDetailJson = JSON.parse(prescriptionDetail);
  7985. //当前处方只开了住院证则只打印住院证
  7986. 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.jcjyPrescription.length == 0 && prescriptionDetailJson.zyPrescription.length == 0 && prescriptionDetailJson.zyReqPrescription != null && prescriptionDetailJson.zyReqPrescription.length > 0) {
  7987. printZyReq(patientId, 1);
  7988. return;
  7989. }
  7990. var index = 0;
  7991. setPrint();
  7992. LODOP = getLodop();
  7993. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院处方笺");
  7994. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  7995. //设置默认打印机
  7996. LODOP.SET_PRINTER_INDEX(printIndex);
  7997. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  7998. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  7999. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  8000. //LODOP.SET_SHOW_MODE("SETUP_ENABLESS",getCheckSS());
  8001. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊处方笺");//对新建的纸张重命名
  8002. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  8003. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  8004. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  8005. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  8006. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  8007. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  8008. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  8009. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  8010. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  8011. var mzPatientMi = res.mzPatientMi;
  8012. $("#patientNamePrescription").text(mzPatientMi.name);
  8013. $("#patientGenderPrescription").text(mzPatientMi.gender);
  8014. $("#patientAgePrescription").text(mzPatientMi.age);
  8015. $("#patientIdPrescription").text(mzPatientMi.patientId);
  8016. $("#deptPrescription").text(res.deptName);
  8017. $("#doctorPrescription").text(res.doctorName);
  8018. $("#cfTime").text(res.opDate);
  8019. $("#socialNo").text(mzPatientMi.socialNo);
  8020. $("#zdPrescription").text(res.data.icdText);
  8021. $("#patientIdGuideCard").text(mzPatientMi.patientId);
  8022. $("#patientNameGuideCard").text(mzPatientMi.name);
  8023. $("#patientDateGuideCard").text(format(new Date(), "yyyy-MM-dd"));
  8024. //普药处方
  8025. var pyPrescription = prescriptionDetailJson.xyPrescription.pyPrescription;
  8026. if (pyPrescription != null && pyPrescription.length > 0) {
  8027. for (var i = 0; i < pyPrescription.length; i++) {
  8028. if (index > 0) {
  8029. LODOP.NewPageA();
  8030. }
  8031. var prescriptionDetail = pyPrescription[i].detail;
  8032. var __ret = setTableHtml(prescriptionDetail);
  8033. var html = __ret.html;
  8034. var j = __ret.j;
  8035. if (res.deptName != undefined && res.deptName != null) {
  8036. if (res.deptName.indexOf("儿") > 0) {
  8037. $("#typePrescription").text("儿科");
  8038. $("#cfTitle").text("儿科");
  8039. } else if (res.deptName.indexOf("急诊科") > 0) {
  8040. $("#typePrescription").text("急诊");
  8041. $("#cfTitle").text("急诊");
  8042. } else {
  8043. $("#typePrescription").text("普通处方");
  8044. $("#cfTitle").text("普通");
  8045. }
  8046. }
  8047. $("#prescriptionDetail").html(html);
  8048. $("#cfAmountPrint").text(pyPrescription[i].amount + "元 (不含注射费)");
  8049. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  8050. index++;
  8051. }
  8052. }
  8053. //医材处方
  8054. var ycPrescription = prescriptionDetailJson.xyPrescription.ycPrescription;
  8055. if (ycPrescription != null && ycPrescription.length > 0) {
  8056. for (var i = 0; i < ycPrescription.length; i++) {
  8057. if (index > 0) {
  8058. LODOP.NewPageA();
  8059. }
  8060. var prescriptionDetail = ycPrescription[i].detail;
  8061. var __ret = setTableHtml(prescriptionDetail);
  8062. var html = __ret.html;
  8063. var j = __ret.j;
  8064. if (res.deptName != undefined && res.deptName != null) {
  8065. if (res.deptName.indexOf("儿") > 0) {
  8066. $("#typePrescription").text("儿科");
  8067. $("#cfTitle").text("儿科");
  8068. } else if (res.deptName.indexOf("急诊科") > 0) {
  8069. $("#typePrescription").text("急诊");
  8070. $("#cfTitle").text("急诊");
  8071. } else {
  8072. $("#typePrescription").text("医材处方");
  8073. $("#cfTitle").text("普通");
  8074. }
  8075. }
  8076. $("#prescriptionDetail").html(html);
  8077. $("#cfAmountPrint").text(ycPrescription[i].amount + "元 ");
  8078. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  8079. index++;
  8080. }
  8081. }
  8082. //麻精处方
  8083. var mjPrescription = prescriptionDetailJson.xyPrescription.mjPrescription;
  8084. if (mjPrescription != null && mjPrescription.length > 0) {
  8085. for (var i = 0; i < mjPrescription.length; i++) {
  8086. if (index > 0) {
  8087. LODOP.NewPageA();
  8088. }
  8089. var prescriptionDetail = mjPrescription[i].detail;
  8090. var __ret = setTableHtml(prescriptionDetail);
  8091. var html = __ret.html;
  8092. var j = __ret.j;
  8093. $("#typePrescription").text("麻、精一处方");
  8094. $("#cfTitle").text("麻、精一");
  8095. $("#prescriptionDetail").html(html);
  8096. $("#cfAmountPrint").text(mjPrescription[i].amount + "元 (不含注射费)");
  8097. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  8098. index++;
  8099. }
  8100. }
  8101. //精二处方
  8102. var jePrescription = prescriptionDetailJson.xyPrescription.jePrescription;
  8103. if (jePrescription != null && jePrescription.length > 0) {
  8104. for (var i = 0; i < jePrescription.length; i++) {
  8105. if (index > 0) {
  8106. LODOP.NewPageA();
  8107. }
  8108. var prescriptionDetail = jePrescription[i].detail;
  8109. var __ret = setTableHtml(prescriptionDetail);
  8110. var html = __ret.html;
  8111. var j = __ret.j;
  8112. $("#typePrescription").text("精二处方");
  8113. $("#cfTitle").text("精二");
  8114. $("#prescriptionDetail").html(html);
  8115. $("#cfAmountPrint").text(jePrescription[i].amount + "元 (不含注射费)");
  8116. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  8117. index++;
  8118. }
  8119. }
  8120. //中药处方
  8121. if (prescriptionDetailJson.zyPrescription != null && prescriptionDetailJson.zyPrescription.length > 0) {
  8122. var zyPrescription = prescriptionDetailJson.zyPrescription[0].detail;
  8123. if (zyPrescription != null && zyPrescription.length > 0) {
  8124. var html = "";
  8125. for (var i = 0; i < zyPrescription.length; i++) {
  8126. if (i % 3 == 0) {
  8127. html += "<tr>";
  8128. }
  8129. html += "<td>";
  8130. html += zyPrescription[i].name;
  8131. html += zyPrescription[i].quantity + "g";
  8132. if (zyPrescription[i].instructionText != null) {
  8133. html += "[" + zyPrescription[i].instructionText + "]";
  8134. }
  8135. if (i % 3 == 2) {
  8136. html += "</td></tr>";
  8137. } else {
  8138. html += "</td>";
  8139. }
  8140. }
  8141. if (zyPrescription.length % 3 != 0) {
  8142. html += "</tr>";
  8143. }
  8144. html += "<tr><td></td><td></td><td>X " + prescriptionDetailJson.zyPrescription[0].zyfs + "付</td></tr>";
  8145. var cyMtjs = prescriptionDetailJson.zyPrescription[0].cyMtjs;
  8146. if (cyMtjs == null || cyMtjs == "null") {
  8147. cyMtjs = "";
  8148. }
  8149. var cyJssm = prescriptionDetailJson.zyPrescription[0].cyJssm;
  8150. if (cyJssm == null || cyJssm == "null") {
  8151. cyJssm = "";
  8152. }
  8153. var cyJsl = prescriptionDetailJson.zyPrescription[0].cyJsl;
  8154. if (cyJsl == null || cyJsl == "null") {
  8155. cyJsl = "";
  8156. }
  8157. var cyZql = prescriptionDetailJson.zyPrescription[0].cyZql;
  8158. if (cyZql == null || cyZql == "null") {
  8159. cyZql = "";
  8160. }
  8161. var cyFj = prescriptionDetailJson.zyPrescription[0].cyFj;
  8162. if (cyFj == null || cyFj == "null") {
  8163. cyFj = "";
  8164. }
  8165. var cyFfcs = prescriptionDetailJson.zyPrescription[0].cyFfcs;
  8166. if (cyFfcs == null || cyFfcs == "null") {
  8167. cyFfcs = "";
  8168. }
  8169. var cyFysm = prescriptionDetailJson.zyPrescription[0].cyFysm;
  8170. if (cyFysm == null || cyFysm == "null") {
  8171. cyFysm = "";
  8172. }
  8173. html += "<tr><td colspan='3'>每天" + cyMtjs + "剂," + cyJssm + cyJsl + "ml,煮取量" + cyZql + "ml,复煎" + cyFj + "次。分" + cyFfcs + "次" + cyFysm + "。</td></tr>";
  8174. html += "<tr><td colspan='3'>&nbsp;&nbsp;&nbsp;&nbsp;------(以下空白)------</td></tr>";
  8175. if (index > 0) {
  8176. LODOP.NewPageA();
  8177. }
  8178. if (res.deptName != undefined && res.deptName != null) {
  8179. if (res.deptName.indexOf("儿") > 0) {
  8180. $("#typePrescription").text("儿科");
  8181. $("#cfTitle").text("儿科");
  8182. } else if (res.deptName.indexOf("急诊科") > 0) {
  8183. $("#typePrescription").text("急诊");
  8184. $("#cfTitle").text("急诊");
  8185. } else {
  8186. $("#typePrescription").text("中药处方");
  8187. $("#cfTitle").text("普通");
  8188. }
  8189. }
  8190. $("#prescriptionDetail").html(html);
  8191. $("#cfAmountPrint").text(prescriptionDetailJson.zyPrescription[0].amount + "元 (不含代煎费)");
  8192. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  8193. index++;
  8194. }
  8195. }
  8196. //暂时不打印 诊疗了
  8197. var printZlPrescription = false;
  8198. if (printZlPrescription) {
  8199. if (prescriptionDetailJson.zlPrescription != null && prescriptionDetailJson.zlPrescription.length > 0) {
  8200. //诊疗处方
  8201. var zlPrescription = prescriptionDetailJson.zlPrescription[0].detail;
  8202. if (zlPrescription != null && zlPrescription.length > 0) {
  8203. var html = "";
  8204. for (var i = 0; i < zlPrescription.length; i++) {
  8205. html += "<tr><td>";
  8206. html += zlPrescription[i];
  8207. html += "</td></tr>";
  8208. }
  8209. if (index > 0) {
  8210. LODOP.NewPageA();
  8211. }
  8212. if (res.deptName != undefined && res.deptName != null) {
  8213. if (res.deptName.indexOf("儿") > 0) {
  8214. $("#typePrescription").text("儿科");
  8215. $("#cfTitle").text("儿科");
  8216. } else if (res.deptName.indexOf("急诊科") > 0) {
  8217. $("#typePrescription").text("急诊");
  8218. $("#cfTitle").text("急诊");
  8219. } else {
  8220. $("#typePrescription").text("诊疗处方");
  8221. $("#cfTitle").text("普通");
  8222. }
  8223. }
  8224. $("#prescriptionDetail").html(html);
  8225. $("#cfAmountPrint").text(prescriptionDetailJson.zlPrescription[0].amount + "元 ");
  8226. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  8227. index++;
  8228. }
  8229. }
  8230. }
  8231. //检查申请单打印
  8232. var mzYjReqList = res.data.mzYjReqList;
  8233. if (mzYjReqList != null && mzYjReqList.length > 0) {
  8234. $("#patientIdJcReq").text(mzPatientMi.patientId);
  8235. $("#patientNameJcReq").text(mzPatientMi.name);
  8236. $("#patientGenderJcReq").text(mzPatientMi.gender);
  8237. $("#patientAgeJcReq").text(mzPatientMi.age + "岁");
  8238. $("#responseTypeJcReq").text(mzPatientMi.responseTypeName);
  8239. $("#patientCardNoJcReq").text(mzPatientMi.icCardNo);
  8240. $("#icdTextJcReq").text(res.data.icdText);
  8241. var mzBlRecord = res.data.mzBlRecord;
  8242. $("#jcReqEmrChiefComplaint").text(mzBlRecord.emrChiefComplaint);
  8243. $("#jcReqHis").text(mzBlRecord.emrHpi);
  8244. var tz = getTz(mzBlRecord);
  8245. $("#jcReqTz").text(tz);
  8246. $("#jcReqReqDept").text(res.deptName);
  8247. $("#jcReqReqDoctor").text(res.doctorName);
  8248. for (var i = 0; i < mzYjReqList.length; i++) {
  8249. var mzYjReq = mzYjReqList[i];
  8250. if (i == 0) {
  8251. var dateStr = format(mzYjReq.reqDate, "yyyy-MM-dd");
  8252. $("#jcReqReqDate").text(dateStr);
  8253. }
  8254. if (mzYjReq == null || mzYjReq.reqType == 2) {
  8255. continue;
  8256. }
  8257. if ((i == 0 && index > 0) || i > 0) {
  8258. LODOP.NewPageA();
  8259. }
  8260. $("#reqNoJcReq").text(mzYjReq.reqNo);
  8261. $("#jcReqItem").text(mzYjReq.groupName);
  8262. $("#jcReqRemark").text(mzYjReq.jyRemark);
  8263. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("jc_card_table").innerHTML);
  8264. index++;
  8265. }
  8266. }
  8267. $.ajax({
  8268. type: "GET",
  8269. url: '/thmz/getChargeDetailForGuideCard?patientId=' + patientId + '&times=' + times,
  8270. contentType: "application/json;charset=UTF-8",
  8271. dataType: "json",
  8272. headers: {
  8273. 'Accept': 'application/json',
  8274. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  8275. },
  8276. success: function (res) {
  8277. if (res == '401' || res == 401) {
  8278. window.location.href = '/thmz/login/view'
  8279. return;
  8280. }
  8281. if (res.code == 0) {
  8282. if (res.data != null && res.data.length > 0) {
  8283. var html = "";
  8284. for (var i = 0; i < res.data.length; i++) {
  8285. html += "<tr><td>" + res.data[i].itemType + "</td><td>" + Division(res.data[i].itemTotalFee, 1).toFixed(1) + "</td><td>" + res.data[i].execDeptName + "</td><td>" + res.data[i].execDeptAddress + "</td></tr>"
  8286. }
  8287. $("#guideCardDetail").html(html);
  8288. }
  8289. if (res.payQrcode != null && res.payQrcode != "") {
  8290. $("#payQrcodeGuideCard").html(null);
  8291. new QRCode(document.getElementById("payQrcodeGuideCard"), res.payQrcode); // 设置要生成二维码的链接
  8292. $("canvas").attr("id", "erw");
  8293. var canvas = document.getElementById('erw');
  8294. var src = canvas.toDataURL("image/png");
  8295. //var strDataURI =canvas.toDataURL("image/png");
  8296. $("#payQrcodeGuideCard").html("<img src='" + src + "' style='width:100px;height:100px;'/><div style='width: 100px;margin-top: 10px;text-align: center;'>微信支付</div>");
  8297. }
  8298. $("#totalAmountGuideCard").text("¥" + res.totalAmount);
  8299. // $("#imgcode").JsBarcode(patientId);
  8300. console.log(patientId);
  8301. JsBarcode('#imgcode', patientId, {
  8302. lineColor: '#333', //线条颜色
  8303. width: 2, //线宽
  8304. height: 60, //条码高度
  8305. displayValue: false, //是否显示文字信息
  8306. });
  8307. if (index > 0) {
  8308. LODOP.NewPageA();
  8309. }
  8310. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("guide_card_table").innerHTML);
  8311. //LODOP.PRINT();
  8312. if (printType == 1) {
  8313. LODOP.PREVIEW();
  8314. } else if (printType == 2) {
  8315. LODOP.PRINT_SETUP();
  8316. }
  8317. } else if (res.code == -2) {
  8318. if (printType == 1) {
  8319. LODOP.PREVIEW();
  8320. } else if (printType == 2) {
  8321. LODOP.PRINT_SETUP();
  8322. }
  8323. } else {
  8324. errorMesage(res);
  8325. }
  8326. }
  8327. });
  8328. // printGuideCard(patientId, times);
  8329. }
  8330. } else {
  8331. errorMesage(res);
  8332. }
  8333. }
  8334. });
  8335. }
  8336. /**
  8337. * 构建体征描述
  8338. * @param mzBlRecord
  8339. * @returns {*}
  8340. */
  8341. function getTz(mzBlRecord) {
  8342. var tz = null;
  8343. if (mzBlRecord.weight != null && mzBlRecord.weight != 0) {
  8344. var temp = "体重:" + mzBlRecord.weight + "kg ";
  8345. if (tz == null) {
  8346. tz = temp;
  8347. } else {
  8348. tz += " " + temp;
  8349. }
  8350. }
  8351. if (mzBlRecord.temperature != null && mzBlRecord.temperature != 0) {
  8352. var temp = "体温:" + mzBlRecord.temperature + "℃ ";
  8353. if (tz == null) {
  8354. tz = temp;
  8355. } else {
  8356. tz += " " + temp;
  8357. }
  8358. }
  8359. if (mzBlRecord.sphygmus != null && mzBlRecord.sphygmus != 0) {
  8360. var temp = "脉搏:" + mzBlRecord.sphygmus + "次/分 ";
  8361. if (tz == null) {
  8362. tz = temp;
  8363. } else {
  8364. tz += " " + temp;
  8365. }
  8366. }
  8367. if (mzBlRecord.breathe != null && mzBlRecord.breathe != 0) {
  8368. var temp = "呼吸:" + mzBlRecord.breathe + "次/分 ";
  8369. if (tz == null) {
  8370. tz = temp;
  8371. } else {
  8372. tz += " " + temp;
  8373. }
  8374. }
  8375. if (mzBlRecord.pressureHigh != null && mzBlRecord.pressureFloor != null && mzBlRecord.pressureHigh != 0 && mzBlRecord.pressureFloor != 0) {
  8376. var temp = "血压:" + mzBlRecord.pressureHigh + "/" + mzBlRecord.pressureFloor;
  8377. if (tz == null) {
  8378. tz = temp;
  8379. } else {
  8380. tz += " " + temp;
  8381. }
  8382. }
  8383. if (mzBlRecord.pressureHighLeft != null && mzBlRecord.pressureFloorLeft != null && mzBlRecord.pressureHighLeft != 0 && mzBlRecord.pressureFloorLeft != 0) {
  8384. var temp = "左血压:" + mzBlRecord.pressureHighLeft + "/" + mzBlRecord.pressureFloorLeft;
  8385. if (tz == null) {
  8386. tz = temp;
  8387. } else {
  8388. tz += " " + temp;
  8389. }
  8390. }
  8391. if (mzBlRecord.emrPe != null && mzBlRecord.emrPe != "") {
  8392. if (tz == null) {
  8393. tz = mzBlRecord.emrPe;
  8394. } else {
  8395. tz += "," + mzBlRecord.emrPe;
  8396. }
  8397. }
  8398. return tz;
  8399. }
  8400. /**
  8401. * 打印医技申请单
  8402. * @param patientId
  8403. * @param times
  8404. * @param type 申请单类型:2:检验;3:检查
  8405. * @param printType 打印模式 1 预览打印 2 打印设置
  8406. */
  8407. function printYjReq(patientId, times, type, printType) {
  8408. $.ajax({
  8409. type: "GET",
  8410. url: '/thmz/printYjReq?patientId=' + patientId + '&times=' + times + "&reqType=" + type,
  8411. contentType: "application/json;charset=UTF-8",
  8412. dataType: "json",
  8413. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8414. success: function (res) {
  8415. if (res == '401' || res == 401) {
  8416. window.location.href = '/thmz/login/view'
  8417. return;
  8418. }
  8419. if (res.code == 0) {
  8420. if (res.data == null || res.data.mzYjReqList == null || res.data.mzYjReqList.length == 0) {
  8421. errorMesageSimaple("没有医技申请单可以打印");
  8422. return;
  8423. }
  8424. setPrint();
  8425. LODOP = getLodop();
  8426. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院检查申请单");
  8427. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  8428. //设置默认打印机
  8429. LODOP.SET_PRINTER_INDEX(printIndex);
  8430. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  8431. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  8432. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  8433. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "检查申请单");//对新建的纸张重命名
  8434. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  8435. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  8436. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  8437. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  8438. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  8439. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  8440. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  8441. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  8442. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  8443. var mzPatientMi = res.data.mzPatientMi;
  8444. $("#patientIdJcReq").text(mzPatientMi.patientId);
  8445. $("#patientNameJcReq").text(mzPatientMi.name);
  8446. $("#patientGenderJcReq").text(mzPatientMi.gender);
  8447. $("#patientAgeJcReq").text(mzPatientMi.age + "岁");
  8448. $("#responseTypeJcReq").text(mzPatientMi.responseTypeName);
  8449. $("#patientCardNoJcReq").text(mzPatientMi.icCardNo);
  8450. $("#icdTextJcReq").text(res.data.icdText);
  8451. $("#patientIdJyReq").text(mzPatientMi.patientId);
  8452. $("#patientNameJyReq").text(mzPatientMi.name);
  8453. $("#patientGenderJyReq").text(mzPatientMi.gender);
  8454. $("#patientAgeJyReq").text(mzPatientMi.age + "岁");
  8455. $("#responseTypeJyReq").text(mzPatientMi.responseTypeName);
  8456. $("#patientCardNoJyReq").text(mzPatientMi.icCardNo);
  8457. $("#icdTextJyReq").text(res.data.icdText);
  8458. var mzBlRecord = res.data.mzBlRecord;
  8459. $("#jcReqEmrChiefComplaint").text(mzBlRecord.emrChiefComplaint);
  8460. $("#jcReqHis").text(mzBlRecord.emrHpi);
  8461. $("#jyReqEmrChiefComplaint").text(mzBlRecord.emrChiefComplaint);
  8462. $("#jyReqHis").text(mzBlRecord.emrHpi);
  8463. var tz = getTz(mzBlRecord);
  8464. $("#jcReqTz").text(tz);
  8465. $("#jcReqReqDept").text(res.data.deptName);
  8466. $("#jcReqReqDoctor").text(res.data.doctorName);
  8467. $("#jyReqTz").text(tz);
  8468. $("#jyReqReqDept").text(res.data.deptName);
  8469. $("#jyReqReqDoctor").text(res.data.doctorName);
  8470. //检验报告列表名
  8471. var jyTitle = '<tr><th style="min-height: 30px;border-bottom: 1px solid black;">检验项目</th><th style="min-height: 30px;border-bottom: 1px solid black;">标本</th><th style="min-height: 30px;border-bottom: 1px solid black;">单号</th></tr>';
  8472. var jyContent = "";
  8473. var needNewPageA = false;
  8474. for (var i = 0; i < res.data.mzYjReqList.length; i++) {
  8475. var obj = res.data.mzYjReqList[i];
  8476. if (i == 0) {
  8477. var dateStr = format(obj.reqDate, "yyyy-MM-dd");
  8478. $("#jcReqReqDate").text(dateStr);
  8479. $("#jyReqReqDate").text(dateStr);
  8480. }
  8481. if (obj.reqType == "3") {
  8482. if (i > 0) {
  8483. LODOP.NewPageA();
  8484. }
  8485. $("#reqNoJcReq").text(obj.reqNo);
  8486. $("#jcReqItem").text(obj.groupName);
  8487. $("#jcReqRemark").text(obj.jyRemark);
  8488. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("jc_card_table").innerHTML);
  8489. needNewPageA = true;
  8490. } else if (obj.reqType == "2") {
  8491. var inspectStuff = (obj.inspectStuff == null || obj.inspectStuff == "null") ? "" : obj.inspectStuff;
  8492. jyContent += '<tr><td style="min-height: 30px;">' + obj.groupName + '</td><td>' + inspectStuff + '</td><td>' + obj.reqNo + '</td></tr>';
  8493. }
  8494. }
  8495. if (jyContent != null && jyContent != "" && jyContent.length > 0) {
  8496. if (needNewPageA) {
  8497. LODOP.NewPageA();
  8498. }
  8499. jyContent = jyTitle + jyContent;
  8500. $("#jyContent").html(jyContent);
  8501. //检验
  8502. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("jy_card_table").innerHTML);
  8503. }
  8504. if (printType == 1) {
  8505. LODOP.PREVIEW();
  8506. } else if (printType == 2) {
  8507. LODOP.PRINT_SETUP();
  8508. }
  8509. } else {
  8510. errorMesage(res);
  8511. }
  8512. }
  8513. });
  8514. }
  8515. /**
  8516. * 打印门诊病历
  8517. * @param patientId
  8518. * @param times
  8519. * @param clnicId
  8520. * @param payMark
  8521. * @param printType 打印模式 1 预览打印 2 打印设置
  8522. */
  8523. function printBlRecord(patientId, times, printType) {
  8524. $.ajax({
  8525. type: "GET",
  8526. url: '/thmz/getMzBlrecord?patientId=' + patientId + '&times=' + times,
  8527. contentType: "application/json;charset=UTF-8",
  8528. dataType: "json",
  8529. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8530. success: function (res) {
  8531. if (res == '401' || res == 401) {
  8532. window.location.href = '/thmz/login/view'
  8533. return;
  8534. }
  8535. if (res.code == 0) {
  8536. setPrint();
  8537. LODOP = getLodop();
  8538. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院门诊病历");
  8539. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  8540. //设置默认打印机
  8541. LODOP.SET_PRINTER_INDEX(printIndex);
  8542. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  8543. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  8544. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  8545. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊病历");//对新建的纸张重命名
  8546. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  8547. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  8548. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  8549. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  8550. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  8551. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  8552. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  8553. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  8554. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  8555. var mzPatientMi = res.mzPatientMi;
  8556. $("#patientIdBlrecord").text(mzPatientMi.patientId);
  8557. $("#patientNameBlrecord").text(mzPatientMi.name);
  8558. $("#patientGenderBlrecord").text(mzPatientMi.gender);
  8559. $("#patientAgeBlrecord").text(mzPatientMi.age + "岁");
  8560. var mzBlRecord = res.mzBlRecord;
  8561. if (mzBlRecord.firstOrNot == "1") {
  8562. $("#firstOrNotTitle").text("复诊");
  8563. } else {
  8564. $("#firstOrNotTitle").text("初诊");
  8565. }
  8566. if (mzBlRecord.emrChiefComplaint != null && mzBlRecord.emrChiefComplaint != "") {
  8567. $("#emrChiefComplaintBlrecord").text(mzBlRecord.emrChiefComplaint);
  8568. $("#emrChiefComplaintBlrecord").parent().css("display", "block");
  8569. } else {
  8570. $("#emrChiefComplaintBlrecord").parent().css("display", "none");
  8571. }
  8572. if (mzBlRecord.emrHpi != null && mzBlRecord.emrHpi != "") {
  8573. $("#emrHpiBlrecord").text(mzBlRecord.emrHpi);
  8574. $("#emrHpiBlrecord").parent().css("display", "block");
  8575. } else {
  8576. $("#emrHpiBlrecord").parent().css("display", "none");
  8577. }
  8578. if (mzBlRecord.emrPs != null && mzBlRecord.emrPs != "") {
  8579. $("#emrPsBlrecord").text(mzBlRecord.emrPs);
  8580. $("#emrPsBlrecord").parent().css("display", "block");
  8581. } else {
  8582. $("#emrPsBlrecord").parent().css("display", "none");
  8583. }
  8584. if (mzBlRecord.personalHistory != null && mzBlRecord.personalHistory != "") {
  8585. $("#personalHistoryBlrecord").text(mzBlRecord.personalHistory);
  8586. $("#personalHistoryBlrecord").parent().css("display", "block");
  8587. } else {
  8588. $("#personalHistoryBlrecord").parent().css("display", "none");
  8589. }
  8590. if (mzBlRecord.familyHistory != null && mzBlRecord.familyHistory != "") {
  8591. $("#familyHistoryBlrecord").text(mzBlRecord.familyHistory);
  8592. $("#familyHistoryBlrecord").parent().css("display", "block");
  8593. } else {
  8594. $("#familyHistoryBlrecord").parent().css("display", "none");
  8595. }
  8596. if (mzBlRecord.obstericalHistory != null && mzBlRecord.obstericalHistory != "") {
  8597. $("#obstericalHistoryBlrecord").text(mzBlRecord.obstericalHistory);
  8598. $("#obstericalHistoryBlrecord").parent().css("display", "block");
  8599. } else {
  8600. $("#obstericalHistoryBlrecord").parent().css("display", "none");
  8601. }
  8602. var tz = getTz(mzBlRecord);
  8603. if (tz != null && tz != "") {
  8604. $("#emrPeBlrecord").text(tz);
  8605. $("#emrPeBlrecord").parent().css("display", "block");
  8606. } else {
  8607. $("#emrPeBlrecord").parent().css("display", "none");
  8608. }
  8609. // if (mzBlRecord.emrPe != null && mzBlRecord.emrPe != "") {
  8610. // $("#emrPeBlrecord").text(mzBlRecord.emrPe);
  8611. // $("#emrPeBlrecord").parent().css("display", "block");
  8612. // } else {
  8613. // $("#emrPeBlrecord").parent().css("display", "none");
  8614. // }
  8615. if (res.icdText != null && res.icdText != "") {
  8616. $("#icdTextBlrecord").text(res.icdText);
  8617. $("#icdTextBlrecord").parent().css("display", "block");
  8618. } else {
  8619. $("#icdTextBlrecord").parent().css("display", "none");
  8620. }
  8621. if (mzBlRecord.emrProcess != null && mzBlRecord.emrProcess != "") {
  8622. $("#emrProcessBlrecord").html(mzBlRecord.emrProcess);
  8623. $("#emrProcessBlrecord").parent().css("display", "block");
  8624. } else {
  8625. $("#emrProcessBlrecord").parent().css("display", "none");
  8626. }
  8627. if (mzBlRecord.emrJkjy != null && mzBlRecord.emrJkjy != "") {
  8628. $("#emrJkjyBlrecord").text(mzBlRecord.emrJkjy);
  8629. $("#emrJkjyBlrecord").parent().css("display", "block");
  8630. } else {
  8631. $("#emrJkjyBlrecord").parent().css("display", "none");
  8632. }
  8633. $("#visitDeptBlrecord").text(res.deptName);
  8634. $("#visitDoctorBlrecord").text(res.doctorName);
  8635. $("#visitDateBlrecord").text(res.visitDate);
  8636. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("mz_blrecord_card_table").innerHTML);
  8637. if (printType == 1) {
  8638. LODOP.PREVIEW();
  8639. } else if (printType == 2) {
  8640. LODOP.PRINT_SETUP();
  8641. }
  8642. } else {
  8643. errorMesage(res);
  8644. }
  8645. }
  8646. });
  8647. }
  8648. /**
  8649. * 将内容拼接空格,这样才会有下划线
  8650. * @param mzPatientMi
  8651. * @param maxLength 最大长度
  8652. * @returns {*}
  8653. */
  8654. function formatUnderline(params, maxLength) {
  8655. var length = 0;
  8656. if (params == null || params.length == 0) {
  8657. length = maxLength;
  8658. } else {
  8659. length = maxLength - params.length;
  8660. }
  8661. for (var i = 0; i < length; i++) {
  8662. params += " ";
  8663. }
  8664. return params;
  8665. }
  8666. /**
  8667. * 打印入院通知单
  8668. * @param patientId
  8669. * @param times
  8670. * @param clnicId
  8671. * @param payMark
  8672. * @param printType 打印模式 1 预览打印 2 打印设置
  8673. */
  8674. function printZyReq(patientId, printType) {
  8675. $.ajax({
  8676. type: "GET",
  8677. url: '/thmz/printZyReq?patientId=' + patientId,
  8678. contentType: "application/json;charset=UTF-8",
  8679. dataType: "json",
  8680. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8681. success: function (res) {
  8682. if (res == '401' || res == 401) {
  8683. window.location.href = '/thmz/login/view'
  8684. return;
  8685. }
  8686. if (res.code == 0) {
  8687. setPrint();
  8688. LODOP = getLodop();
  8689. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院入院通知单");
  8690. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  8691. //设置默认打印机
  8692. LODOP.SET_PRINTER_INDEX(printIndex);
  8693. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  8694. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  8695. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  8696. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "入院通知单");//对新建的纸张重命名
  8697. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  8698. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  8699. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  8700. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  8701. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  8702. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  8703. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  8704. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  8705. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  8706. var mzPatientMi = res.mzPatientMi;
  8707. var mzZyReq = res.mzZyReq;
  8708. var mzPatientId = formatUnderline(mzPatientMi.patientId, 15);
  8709. $("#patientIdZyReq").text(mzPatientId);
  8710. var mzPatientMiName = formatUnderline(mzPatientMi.name, 22);
  8711. $("#patientNameZyReq").text(mzPatientMiName);
  8712. var mzPatientGender = formatUnderline(mzPatientMi.gender, 10);
  8713. $("#patientGenderZyReq").text(mzPatientGender);
  8714. var mzPatientAge = formatUnderline(mzPatientMi.age + "岁", 6);
  8715. $("#patientAgeZyReq").text(mzPatientAge);
  8716. var mzPatientSocialNo = formatUnderline(mzPatientMi.socialNo, 48);
  8717. $("#sfzZyReq").text(mzPatientSocialNo);
  8718. $("#birthDateZyReq").text(format(mzPatientMi.birthDay, "yyyy-MM-dd"));
  8719. var mzPatientPhoneNo = formatUnderline(mzPatientMi.phoneNo, 55);
  8720. $("#phoneZyReq").text(mzPatientPhoneNo);
  8721. $("#responseTypeZyReq").text(mzPatientMi.responseTypeName);
  8722. var mzPatientMiAddress = formatUnderline(mzPatientMi.address, 31);
  8723. $("#addressZyReq").text(mzPatientMiAddress);
  8724. if (mzZyReq.icdCode == null || mzZyReq.icdCode == "" || mzZyReq.icdCode.length == 0) {
  8725. $("#icsCodeZyReq").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
  8726. var mzPatientMiIcdText = formatUnderline(mzZyReq.icdText, 29);
  8727. $("#icsTextZyReq").text(" " + mzPatientMiIcdText);
  8728. } else {
  8729. var mzPatientMiIcdCode = formatUnderline(mzZyReq.icdCode, 12);
  8730. $("#icsCodeZyReq").text(mzPatientMiIcdCode);
  8731. var mzPatientMiIcdText = formatUnderline(mzZyReq.icdText, 29);
  8732. $("#icsTextZyReq").text(mzPatientMiIcdText);
  8733. }
  8734. var mzZyReqReqWard = formatUnderline(mzZyReq.reqWard, 6);
  8735. $("#reqDeptZyReq").text(mzZyReqReqWard);
  8736. var mzZyReqSmallDept = formatUnderline(mzZyReq.smallDept, 27);
  8737. $("#smallDeptZyReq").text(mzZyReqSmallDept);
  8738. //$("#admissStatusZyReq").text(mzZyReq.admissStatus);
  8739. $("input:checkbox[value='" + mzZyReq.admissStatus + "']").attr('checked', 'true');
  8740. var mzZyReqVisitDate = formatUnderline(format(mzZyReq.visitDate, "yyyy-MM-dd HH:mm:ss"), 37);
  8741. $("#visitDateZyReq").text(mzZyReqVisitDate);
  8742. var mzZyReqDeptCode = formatUnderline(mzZyReq.deptCode, 15);
  8743. $("#deptCodeZyReq").text(mzZyReqDeptCode);
  8744. var mzZyReqDoctorCode = formatUnderline(mzZyReq.doctorCode, 16);
  8745. $("#doctorCodeZyReq").text(mzZyReqDoctorCode);
  8746. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("mz_zy_req_table").innerHTML);
  8747. if (printType == 1) {
  8748. LODOP.PREVIEW();
  8749. } else if (printType == 2) {
  8750. LODOP.PRINT_SETUP();
  8751. }
  8752. } else {
  8753. errorMesage(res);
  8754. }
  8755. }
  8756. });
  8757. }
  8758. /**
  8759. * 打开查看检查检验报告窗口(含往期)
  8760. * @param patientId
  8761. */
  8762. function previewYjReqAll(patientId) {
  8763. $("#visitingDetailModal").modal("hide");
  8764. $("#previewYjReqModal").modal();
  8765. $("#previewYjReqModalPatientId").val(patientId);
  8766. $("#previewYjReqModalTimes").val(null);
  8767. //重置参数
  8768. retryCount = 0;
  8769. initJcJyTable();
  8770. }
  8771. /**
  8772. * 打开查看检查检验报告窗口
  8773. * @param patientId 门诊病人ID
  8774. * @param times 就诊次数
  8775. */
  8776. function previewYjReq(patientId, times) {
  8777. $("#visitingDetailModal").modal("hide");
  8778. $("#previewYjReqModal").modal();
  8779. $("#previewYjReqModalPatientId").val(patientId);
  8780. $("#previewYjReqModalTimes").val(times);
  8781. //重置参数
  8782. retryCount = 0;
  8783. initJcJyTable();
  8784. }
  8785. /**
  8786. * 删除本次处方
  8787. * @param clnicId 就诊记录id
  8788. */
  8789. function deletePrescription(clnicId) {
  8790. $("#visitingDetailModal").modal("hide");
  8791. $("#messageModal").modal();
  8792. $("#messageContent").html("确认要删除本次处方信息吗?");
  8793. $("#messageButton").off("click").on("click", function (t) {
  8794. $("#messageModal").modal("hide");
  8795. $.ajax({
  8796. type: "GET",
  8797. url: '/thmz/deletePrescription?clnicId=' + clnicId,
  8798. contentType: "application/json;charset=UTF-8",
  8799. dataType: "json",
  8800. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8801. success: function (res) {
  8802. if (res == '401' || res == 401) {
  8803. window.location.href = '/thmz/login/view'
  8804. return;
  8805. }
  8806. if (res.code == 0) {
  8807. successMesage(res);
  8808. $("#tb_table_clinic").bootstrapTable('refresh');
  8809. } else {
  8810. errorMesage(res);
  8811. }
  8812. }
  8813. });
  8814. });
  8815. $("#cancelButton").off("click").on("click", function (t) {
  8816. $("#visitingDetailModal").modal();
  8817. });
  8818. ;
  8819. }
  8820. /**
  8821. * 检查检验列表类型按钮切换事件
  8822. * @param object
  8823. */
  8824. function jcjyButtonChange(object) {
  8825. $("#jcjy_group").find("button").each(function (index, element) {
  8826. if ($(element).hasClass("btn-primary")) {
  8827. $(element).removeClass("btn-primary").addClass("btn-default");
  8828. }
  8829. });
  8830. $(object).removeClass("btn-default").addClass("btn-primary");
  8831. initJcJyTable();
  8832. }
  8833. /**
  8834. * 初始化检查检验报告列表
  8835. */
  8836. function initJcJyTable() {
  8837. clearInspectionDetail();
  8838. clearJcDetail();
  8839. var typeIndex = getIndex("jcjy_group");
  8840. if (typeIndex == 0) {
  8841. //检查
  8842. $('#tb_jy_pName_table_list').bootstrapTable("destroy");
  8843. $('#tb_jy_table_list').bootstrapTable("destroy");
  8844. initJcListTable();
  8845. $("#jy_detail").removeClass("in").addClass("hide");
  8846. $("#jc_detail").removeClass("hide").addClass("in");
  8847. } else {
  8848. $('#tb_table_list').bootstrapTable("destroy");
  8849. initJyListTable();
  8850. $("#jc_detail").removeClass("in").addClass("hide");
  8851. $("#jy_detail").removeClass("hide").addClass("in");
  8852. }
  8853. }
  8854. /**
  8855. * 初始化检查报告列表
  8856. */
  8857. function initJcListTable() {
  8858. $('#tb_table_list').bootstrapTable("destroy");
  8859. $('#tb_table_list').bootstrapTable({
  8860. url: '/thmz/getJcJyList', //请求后台的URL(*)
  8861. method: 'post', //请求方式(*)
  8862. toolbar: '#toolbar', //工具按钮用哪个容器
  8863. striped: true, //是否显示行间隔色
  8864. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  8865. pagination: true, //是否显示分页(*)
  8866. sortable: true, //是否启用排序
  8867. sortOrder: "asc", //排序方式
  8868. queryParams: queryParams, //传递参数(*)
  8869. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  8870. pageNumber: 1, //初始化加载第一页,默认第一页
  8871. pageSize: 5, //每页的记录行数(*)
  8872. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  8873. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  8874. strictSearch: true,
  8875. showColumns: false, //是否显示所有的列
  8876. showRefresh: false, //是否显示刷新按钮
  8877. minimumCountColumns: 2, //最少允许的列数
  8878. clickToSelect: true, //是否启用点击选中行
  8879. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  8880. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  8881. cardView: false, //是否显示详细视图
  8882. detailView: false,
  8883. //rowStyle:rowStyle,//通过自定义函数设置行样式
  8884. ajaxOptions: {
  8885. headers: {
  8886. 'Accept': 'application/json',
  8887. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  8888. }
  8889. },
  8890. columns: [
  8891. {
  8892. field: 'groupName',
  8893. title: '项目名称',
  8894. align: "center",
  8895. valign: 'middle',
  8896. }, {
  8897. field: 'reqDate',
  8898. title: '申请时间',
  8899. align: "center",
  8900. valign: 'middle',
  8901. formatter: function (value, row, index) {
  8902. if (value == null || value == "") {
  8903. return "";
  8904. }
  8905. return format(value, "yyyy-MM-dd HH:mm:ss");
  8906. }
  8907. }
  8908. ],
  8909. onClickRow: function (row) {
  8910. clearJcDetail();
  8911. $("#patientId_t").text(row.patientId);
  8912. $("#name_t").text(row.patientName);
  8913. $("#date_t").text(format(row.reqDate, "yyyy-MM-dd HH:mm:ss"));
  8914. fitJcDetail(row.reqNo, row.patientId);
  8915. },
  8916. responseHandler: function (res) {
  8917. if (res == '401' || res == 401) {
  8918. window.location.href = '/thmz/login/view'
  8919. return;
  8920. }
  8921. var ress = eval(res);
  8922. if (ress.code == -1) {
  8923. if (ress.message != null && ress.message != '') {
  8924. errorMesage(ress);
  8925. }
  8926. if (retryCount == 0) {
  8927. retryCount++;
  8928. $("#jyButton").click();
  8929. return;
  8930. }
  8931. return {
  8932. "total": 0,//总页数
  8933. "rows": {} //数据
  8934. };
  8935. }
  8936. if (ress.count <= 0 && retryCount == 0) {
  8937. retryCount++;
  8938. $("#jyButton").click();
  8939. return;
  8940. }
  8941. //有数据的时候,计数也需要加1,防止这时医生自己候点击检验没数据又跳回检查
  8942. retryCount++;
  8943. return {
  8944. "total": ress.count,//总页数
  8945. "rows": ress.data //数据
  8946. };
  8947. },
  8948. onLoadSuccess: function (data) {
  8949. $(".pagination-detail").css("display", "none");
  8950. }
  8951. });
  8952. }
  8953. /**
  8954. * 构建列表查询参数
  8955. * @param params
  8956. * @returns {{mzChargeDetail: {patientId: string | number | string[] | undefined | jQuery, warnDept: string | number | string[] | undefined | jQuery, doctorCode: string | number | string[] | undefined | jQuery, name: string | number | string[] | undefined | jQuery, payMark: number}, beginTime: Date, endTime: Date, pageSize: *, pageIndex: number}}
  8957. */
  8958. function queryParams(params) {
  8959. var patientId = $("#previewYjReqModalPatientId").val();
  8960. var times = $("#previewYjReqModalTimes").val();
  8961. return {
  8962. reqType: "3",
  8963. patientId: patientId,
  8964. times: times,
  8965. pageSize: params.limit, //页面大小
  8966. pageIndex: params.offset / params.limit //页码
  8967. };
  8968. };
  8969. /**
  8970. * 加载检查明细
  8971. * @param reqNo
  8972. */
  8973. function fitJcDetail(reqNo, patientId) {
  8974. $.ajax({
  8975. type: "GET",
  8976. url: '/thmz/getYjJcRecordReport?hisReqNo=' + reqNo + "&patientId=" + patientId,
  8977. contentType: "application/json;charset=UTF-8",
  8978. dataType: "json",
  8979. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8980. success: function (res) {
  8981. if (res == '401' || res == 401) {
  8982. window.location.href = '/thmz/login/view'
  8983. return;
  8984. }
  8985. if (res.code == 0) {
  8986. canBePrintJc = true;
  8987. $("#jy_detail").removeClass("in").addClass("hide");
  8988. $("#jc_detail").removeClass("hide").addClass("in");
  8989. var mzPatientMi = res.data.mzPatientMi;
  8990. $("#gender_jc").text(mzPatientMi.gender);
  8991. $("#age_jc").text(mzPatientMi.age);
  8992. var yjJcRecordReport = res.data.yjJcRecordReport;
  8993. $("#groupName").text(res.data.groupName);
  8994. $("#textJc").text(yjJcRecordReport.textJc);
  8995. $("#textZd").text(yjJcRecordReport.textZd);
  8996. var jcRecord = res.data.jcRecord;
  8997. $("#report_no").text(jcRecord.reportNo);
  8998. $("#reportId").text(jcRecord.reportId);
  8999. if (jcRecord.reportDate == null || jcRecord.reportDate == "") {
  9000. $("#reportDate").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
  9001. } else {
  9002. $("#reportDate").text(format(jcRecord.reportDate, "yyyy-MM-dd HH:mm:ss"));
  9003. }
  9004. $("#confirmId").text(jcRecord.confirmId);
  9005. if (jcRecord.confirmDate == null || jcRecord.confirmDate == "") {
  9006. $("#confirmDate").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
  9007. } else {
  9008. $("#confirmDate").text(format(jcRecord.confirmDate, "yyyy-MM-dd HH:mm:ss"));
  9009. }
  9010. } else {
  9011. errorMesage(res);
  9012. }
  9013. }
  9014. });
  9015. }
  9016. /**
  9017. * 清空检查明细
  9018. * @param reqNo
  9019. */
  9020. function clearJcDetail() {
  9021. canBePrintJc = false;
  9022. $("#patientId_t").text("");
  9023. $("#name_t").text("");
  9024. $("#date_t").text("");
  9025. $("#gender_jc").text("");
  9026. $("#age_jc").text("");
  9027. $("#groupName").text("");
  9028. $("#textJc").text("");
  9029. $("#textZd").text("");
  9030. $("#report_no").text("");
  9031. $("#reportId").text("");
  9032. $("#reportDate").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
  9033. $("#confirmId").text("");
  9034. $("#confirmDate").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
  9035. }
  9036. /**
  9037. * 初始化检验报告列表
  9038. */
  9039. function initJyListTable() {
  9040. var patientId = $("#previewYjReqModalPatientId").val();
  9041. var times = $("#previewYjReqModalTimes").val();
  9042. $('#tb_table_list').bootstrapTable("destroy");
  9043. $('#tb_table_list').bootstrapTable({
  9044. url: '/thmz/getJyListByPatientIdAndTimes?patientId=' + patientId + "&times=" + times, //请求后台的URL(*)
  9045. method: 'get', //请求方式(*)
  9046. toolbar: '#toolbar', //工具按钮用哪个容器
  9047. striped: true, //是否显示行间隔色
  9048. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  9049. pagination: true, //是否显示分页(*)
  9050. sortable: true, //是否启用排序
  9051. sortOrder: "asc", //排序方式
  9052. //queryParams: queryJyPNameParams, //传递参数(*)
  9053. sidePagination: "client", //分页方式:client客户端分页,server服务端分页(*)
  9054. pageNumber: 1, //初始化加载第一页,默认第一页
  9055. pageSize: 5, //每页的记录行数(*)
  9056. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  9057. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  9058. strictSearch: true,
  9059. showColumns: false, //是否显示所有的列
  9060. showRefresh: false, //是否显示刷新按钮
  9061. minimumCountColumns: 2, //最少允许的列数
  9062. clickToSelect: true, //是否启用点击选中行
  9063. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  9064. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  9065. cardView: false, //是否显示详细视图
  9066. detailView: false,
  9067. //rowStyle:rowStyle,//通过自定义函数设置行样式
  9068. ajaxOptions: {
  9069. headers: {
  9070. 'Accept': 'application/json',
  9071. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  9072. }
  9073. },
  9074. columns: [
  9075. {
  9076. field: 'aply_CTNT',
  9077. title: '检验名称',
  9078. align: "center",
  9079. valign: 'middle',
  9080. }, {
  9081. field: 'ordr_CREATE_DATE',
  9082. title: '检验时间',
  9083. align: "center",
  9084. valign: 'middle',
  9085. formatter: function (value, row, index) {
  9086. if (value == null || value == "") {
  9087. return "";
  9088. }
  9089. return format(value, "yyyy-MM-dd HH:mm:ss");
  9090. }
  9091. }
  9092. ],
  9093. onClickRow: function (row) {
  9094. queryInspectionDetail(row.ordr_ID);
  9095. },
  9096. responseHandler: function (res) {
  9097. if (res == '401' || res == 401) {
  9098. window.location.href = '/thmz/login/view'
  9099. return;
  9100. }
  9101. var ress = eval(res);
  9102. if (ress.code == -1) {
  9103. if (retryCount == 0) {
  9104. retryCount++;
  9105. $("#jcButton").click();
  9106. return;
  9107. }
  9108. if (ress.message != null && ress.message != '') {
  9109. errorMesage(ress);
  9110. }
  9111. return {
  9112. "total": ress.data.length,//总页数
  9113. "rows": ress.data //数据
  9114. };
  9115. }
  9116. if (ress.data.length <= 0 && retryCount == 0) {
  9117. retryCount++;
  9118. $("#jcButton").click();
  9119. return;
  9120. }
  9121. //有数据的时候,计数也需要加1,防止这时医生自己候点击检查没数据又跳回检验
  9122. retryCount++;
  9123. return {
  9124. "total": ress.data.length,//总页数
  9125. "rows": ress.data //数据
  9126. };
  9127. },
  9128. onLoadSuccess: function (data) {
  9129. $("#jy_table_table_div").find(".pagination-detail").css("display", "none");
  9130. }
  9131. });
  9132. }
  9133. /**
  9134. * 清空检验明细
  9135. * @param orderId
  9136. */
  9137. function clearInspectionDetail() {
  9138. canBePrintJy = false;
  9139. $("#patientId_t_jy").text("");
  9140. $("#name_t_jy").text("");
  9141. $("#gender_jy").text("");
  9142. $("#age_jy").text("");
  9143. $("#reqDept_t_jy").text("");
  9144. $("#bed_no_jy").text("");
  9145. $("#smpl_jy").text("");
  9146. $("#item_jy").text("");
  9147. $("#applyDate").text("");
  9148. $("#orderCreateDate").text("");
  9149. $("#auditTime").text("");
  9150. $("#orderUsrName").text("");
  9151. $("#testUsrName").text("");
  9152. $("#auditUsrName").text("");
  9153. $("#jyBody").html("");
  9154. }
  9155. /**
  9156. * 加载检验明细
  9157. * @param orderId
  9158. */
  9159. function queryInspectionDetail(orderId) {
  9160. clearInspectionDetail();
  9161. $.ajax({
  9162. type: "GET",
  9163. url: '/thmz/getInspectionDetail?orderId=' + orderId,
  9164. contentType: "application/json;charset=UTF-8",
  9165. dataType: "json",
  9166. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9167. success: function (res) {
  9168. if (res == '401' || res == 401) {
  9169. window.location.href = '/thmz/login/view'
  9170. return;
  9171. }
  9172. if (res.code == 0) {
  9173. canBePrintJy = true;
  9174. $("#jc_detail").removeClass("in").addClass("hide");
  9175. $("#jy_detail").removeClass("hide").addClass("in");
  9176. var mzPatientMi = res.mzPatientMi;
  9177. $("#patientId_t_jy").text(mzPatientMi.patientId);
  9178. $("#name_t_jy").text(mzPatientMi.name);
  9179. $("#gender_jy").text(mzPatientMi.gender);
  9180. $("#age_jy").text(mzPatientMi.age);
  9181. var html = "";
  9182. if (res.data != null) {
  9183. var inspectionHeader = res.data.inspectionHeader;
  9184. $("#reqDept_t_jy").text(inspectionHeader.dept_NAME);
  9185. $("#bed_no_jy").text(inspectionHeader.ptnt_BED_NO);
  9186. $("#smpl_jy").text(inspectionHeader.smpl_NAME);
  9187. $("#item_jy").text(inspectionHeader.aply_CNTN);
  9188. $("#applyDate").text(format(inspectionHeader.aply_DATE, "yyyy-MM-dd HH:mm:ss"));
  9189. $("#orderCreateDate").text(format(inspectionHeader.ordr_CREATE_DATE, "yyyy-MM-dd HH:mm:ss"));
  9190. $("#auditTime").text(format(inspectionHeader.audt_TIME, "yyyy-MM-dd HH:mm:ss"));
  9191. $("#orderUsrName").text(inspectionHeader.ordr_USR_NAME);
  9192. $("#testUsrName").text(inspectionHeader.test_USR_NAME);
  9193. $("#auditUsrName").text(inspectionHeader.audt_USR_NAME);
  9194. var inspectionItems = res.data.inspectionItems;
  9195. if (inspectionItems != null && inspectionItems.length > 0) {
  9196. for (var i = 0; i < inspectionItems.length; i++) {
  9197. html += "<tr>";
  9198. var obj = inspectionItems[i];
  9199. var itm_VALUE = obj.itm_VALUE;
  9200. if (itm_VALUE == null || itm_VALUE == "null") {
  9201. itm_VALUE = "";
  9202. }
  9203. itm_VALUE += (obj.itm_STR_VALUE == null || obj.itm_STR_VALUE == "null") ? "" : obj.itm_STR_VALUE;
  9204. var range = obj.range;
  9205. if (range == null || range == "null") {
  9206. range = "";
  9207. }
  9208. range += (obj.range_STR == null || obj.range_STR == "null") ? "" : obj.range_STR;
  9209. html += "<td width='25%'>" + obj.itm_NAME + "</td>";
  9210. html += "<td width='16.66%'>" + itm_VALUE + "</td>";
  9211. html += "<td width='16.66%'>" + obj.itm_UNIT + "</td>";
  9212. if (obj.itm_ALERT == null || obj.itm_ALERT == "") {
  9213. html += "<td width='16.66%'><span style=\"color:#67C23A;font-weight:bold\"></span></td>";
  9214. } else if (obj.itm_ALERT == "H") {
  9215. html += "<td width='16.66%'><span style=\"color:#F56C6C;font-weight:bold\">↑</span></td>";
  9216. } else if (obj.itm_ALERT == "L") {
  9217. html += "<td width='16.66%'><span style=\"color:#F56C6C;font-weight:bold\">↓</span></td>";
  9218. }
  9219. html += "<td width='25%'>" + range + "</td>";
  9220. html += "</tr>";
  9221. var bacteriaResults = obj.bacteriaResults;
  9222. if (bacteriaResults == null || bacteriaResults.length == 0) {
  9223. continue;
  9224. }
  9225. var bacteriaResult = bacteriaResults[0];
  9226. if (bacteriaResult == null || bacteriaResult.length == 0) {
  9227. continue;
  9228. }
  9229. var antibioticResults = bacteriaResult.antibioticResults;
  9230. if (antibioticResults == null || antibioticResults.length == 0) {
  9231. continue;
  9232. }
  9233. html += '<tr><th width="35%;" style="text-align: left;padding-left: 2%;" >抗菌药物</th><th width="20%;" style="text-align: left;">药物编码</th><th width="30%;" style="text-align: left;">MIC值</th><th width="15%;" style="text-align: left;padding-right: 2%;">敏感性</th></tr>';
  9234. for (var j = 0; j < antibioticResults.length; j++) {
  9235. var antibioticResultsObj = antibioticResults[j];
  9236. html += "<tr>";
  9237. html += "<td width='35%' style='padding-left: 2%;";
  9238. if (j == 0) {
  9239. html += "border-top: 1px solid black;";
  9240. }
  9241. html += "'>" + antibioticResultsObj.anti_NAME_CN + "</td>";
  9242. html += "<td width='20%' ";
  9243. if (j == 0) {
  9244. html += "style='border-top: 1px solid black;'";
  9245. }
  9246. html += ">" + antibioticResultsObj.anti_ABB + "</td>";
  9247. html += "<td width='25%' ";
  9248. if (j == 0) {
  9249. html += "style='border-top: 1px solid black;'";
  9250. }
  9251. html += ">" + antibioticResultsObj.anti_MIC + "</td>";
  9252. html += "<td width='20%' style='padding-right: 2%;";
  9253. if (j == 0) {
  9254. html += "border-top: 1px solid black;";
  9255. }
  9256. html += "'>" + antibioticResultsObj.anti_VALUE + "</td>";
  9257. html += "</tr>";
  9258. }
  9259. }
  9260. }
  9261. }
  9262. $("#jyBody").html(html);
  9263. } else {
  9264. errorMesage(res);
  9265. }
  9266. }
  9267. });
  9268. }
  9269. /**
  9270. * 打印检查检验报告单
  9271. * @param printType 打印模式 1 预览打印 2 打印设置
  9272. */
  9273. function printJyJcReport(printType) {
  9274. var typeIndex = getIndex("jcjy_group");
  9275. var title = "检查报告单";
  9276. if (typeIndex == 1) {
  9277. title = "检验报告单"
  9278. if (!canBePrintJy) {
  9279. warningMesageSimaple("没有任何【" + title + "】可供打印!");
  9280. return;
  9281. }
  9282. } else {
  9283. if (!canBePrintJc) {
  9284. warningMesageSimaple("没有任何【" + title + "】可供打印!");
  9285. return;
  9286. }
  9287. }
  9288. setPrint();
  9289. LODOP = getLodop();
  9290. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院" + title);
  9291. LODOP.SET_PRINT_STYLE("FontSize", 7); //字体大小
  9292. //设置默认打印机
  9293. LODOP.SET_PRINTER_INDEX(printIndex);
  9294. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  9295. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  9296. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  9297. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", title);//对新建的纸张重命名
  9298. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  9299. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  9300. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  9301. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  9302. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  9303. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  9304. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  9305. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  9306. var strStyle = "<style>table{width: 96%;} #jy_detail_content thead {border-bottom: 1px solid black;border-collapse: collapse;}</style>";
  9307. if (typeIndex == 0) {
  9308. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("jc_detail").innerHTML);
  9309. }
  9310. if (typeIndex == 1) {
  9311. LODOP.ADD_PRINT_TABLE("37mm", "5mm", "130mm", "138mm", strStyle + document.getElementById("jy_detail_content").innerHTML);
  9312. LODOP.SET_PRINT_STYLEA(0, "Vorient", 3);
  9313. LODOP.ADD_PRINT_HTM("0mm", "5mm", "130mm", "200mm", strStyle + document.getElementById("jy_detail_title").innerHTML);
  9314. LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
  9315. LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
  9316. LODOP.ADD_PRINT_HTM("177mm", "5mm", "130mm", "200mm", strStyle + document.getElementById("jy_detail_foot").innerHTML);
  9317. LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
  9318. LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
  9319. }
  9320. if (printType == 1) {
  9321. LODOP.PREVIEW();
  9322. } else if (printType == 2) {
  9323. LODOP.PRINT_SETUP();
  9324. }
  9325. }
  9326. /**
  9327. * 初始化科室下拉选
  9328. */
  9329. function initExecUnit() {
  9330. //父科室列表
  9331. $.ajax({
  9332. type: "GET",
  9333. url: '/thmz/allUnitCode',
  9334. dataType: "json",
  9335. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9336. success: function (data) {
  9337. if (data == '401' || data == 401) {
  9338. window.location.href = '/thmz/login/view'
  9339. return;
  9340. }
  9341. $('#execUnit').empty(); //清空resText里面的所有内容
  9342. $('#zlExecUnit').empty(); //清空resText里面的所有内容
  9343. var html = '';
  9344. $.each(data.data, function (commentIndex, comment) {
  9345. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + '-' + comment.code + ')</option>';
  9346. });
  9347. $('#execUnit').html(html);
  9348. $('#execUnit').selectpicker('refresh');
  9349. $('#zlExecUnit').html(html);
  9350. $('#zlExecUnit').selectpicker('refresh');
  9351. }
  9352. });
  9353. }
  9354. /**
  9355. * 初始化证件类型下拉选
  9356. */
  9357. function initCertificateTypeSelect() {
  9358. $.ajax({
  9359. type: "GET",
  9360. url: '/thmz/listCertificateType',
  9361. contentType: "application/json;charset=UTF-8",
  9362. dataType: "json",
  9363. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9364. success: function (res) {
  9365. if (res == '401' || res == 401) {
  9366. window.location.href = '/thmz/login/view'
  9367. return;
  9368. }
  9369. if (res.code == 0) {
  9370. res.data.forEach(function (item, index) {
  9371. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  9372. $('#rapidAcceptsUserCertificateType').append(html);
  9373. $('#editUserCertificateType').append(html);
  9374. });
  9375. $('#rapidAcceptsUserCertificateType').selectpicker('refresh');
  9376. $('#editUserCertificateType').selectpicker('refresh');
  9377. } else {
  9378. errorMesage(res);
  9379. }
  9380. }
  9381. });
  9382. }
  9383. /**
  9384. * 加载病历信息编辑预览
  9385. * @param patientId
  9386. * @param times
  9387. * @param type 1 编辑 2 预览
  9388. */
  9389. function showMzBlRecordModal(patientId, times, type) {
  9390. $.ajax({
  9391. type: "GET",
  9392. url: '/thmz/getMzBlrecord?patientId=' + patientId + '&times=' + times,
  9393. contentType: "application/json;charset=UTF-8",
  9394. dataType: "json",
  9395. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9396. success: function (res) {
  9397. if (res == '401' || res == 401) {
  9398. window.location.href = '/thmz/login/view'
  9399. return;
  9400. }
  9401. if (res.code == 0) {
  9402. var mzPatientMi = res.mzPatientMi;
  9403. $("#editPatientId").text(mzPatientMi.patientId);
  9404. $("#editPatientName").text(mzPatientMi.name);
  9405. $("#editPatientGender").text(mzPatientMi.gender);
  9406. $("#editPatientAge").text(mzPatientMi.age + "岁");
  9407. var mzBlRecord = res.mzBlRecord;
  9408. $("#editEmrChiefComplaint").val(mzBlRecord.emrChiefComplaint == null ? "" : mzBlRecord.emrChiefComplaint);
  9409. $("#editEmrHpi").val(mzBlRecord.emrHpi == null ? "" : mzBlRecord.emrHpi);
  9410. $("#editEmrPs").val(mzBlRecord.emrPs == null ? "" : mzBlRecord.emrPs);
  9411. $("#editPersonalHistory").val(mzBlRecord.personalHistory == null ? "" : mzBlRecord.personalHistory);
  9412. $("#editFamilyHistory").val(mzBlRecord.familyHistory == null ? "" : mzBlRecord.familyHistory);
  9413. $("#editObstericalHistory").val(mzBlRecord.obstericalHistory == null ? "" : mzBlRecord.obstericalHistory);
  9414. $("#editQtjc").val(mzBlRecord.emrPe == null ? "" : mzBlRecord.emrPe);
  9415. if (mzBlRecord.icdCode != null && mzBlRecord.icdText != null) {
  9416. setSelectedAttr("editZd", mzBlRecord.icdCode, mzBlRecord.icdText)
  9417. }
  9418. $("#edittentativeDiagnosis").val(mzBlRecord.tentativeDiagnosis == null ? "" : mzBlRecord.tentativeDiagnosis);
  9419. $("#editEmrJkjy").val(mzBlRecord.emrJkjy == null ? "" : mzBlRecord.emrJkjy);
  9420. $("#bl_weight").val(mzBlRecord.weight == 0 ? null : mzBlRecord.weight);
  9421. $("#bl_temperature").val(mzBlRecord.temperature == 0 ? null : mzBlRecord.temperature);
  9422. $("#bl_sphygmus").val(mzBlRecord.sphygmus == 0 ? null : mzBlRecord.sphygmus);
  9423. $("#bl_breathe").val(mzBlRecord.breathe == 0 ? null : mzBlRecord.breathe);
  9424. $("#bl_pressure_high").val(mzBlRecord.pressureHigh == 0 ? null : mzBlRecord.pressureHigh);
  9425. $("#bl_pressure_floor").val(mzBlRecord.pressureFloor == 0 ? null : mzBlRecord.pressureFloor);
  9426. $("#bl_pressure_high_left").val(mzBlRecord.pressureHighLeft == 0 ? null : mzBlRecord.pressureHighLeft);
  9427. $("#bl_pressure_floor_left").val(mzBlRecord.pressureFloorLeft == 0 ? null : mzBlRecord.pressureFloorLeft);
  9428. if (mzBlRecord.emrProcess != null && mzBlRecord.emrProcess != "") {
  9429. var reg = new RegExp("</br>", "g");//g,表示全部替换。
  9430. var editEmrProcess = mzBlRecord.emrProcess.replace(reg, "\n");
  9431. reg = new RegExp("&nbsp;", "g");//g,表示全部替换。
  9432. editEmrProcess = editEmrProcess.replace(reg, "");
  9433. $("#editEmrProcess").val(editEmrProcess);
  9434. } else {
  9435. $("#editEmrProcess").val("");
  9436. }
  9437. if (type == 1) {
  9438. $("#mzBlRecorTitle").html("门诊病历【编辑】");
  9439. $("#setOtherEmrProcess").removeClass("in").addClass("hide");
  9440. $("#openBlRecordModel").removeClass("hide").addClass("in");
  9441. $("#setEmrProcess").removeClass("hide").addClass("in");
  9442. $("#visitingDetailModal").modal("hide");
  9443. } else if (type == 2) {
  9444. $("#mzBlRecorTitle").html("门诊病历【预览】");
  9445. $("#setOtherEmrProcess").removeClass("hide").addClass("in");
  9446. $("#openBlRecordModel").removeClass("in").addClass("hide");
  9447. $("#setEmrProcess").removeClass("in").addClass("hide");
  9448. //因为预览的时候,关闭预览框没有清空数据,且 此时基础数据的病历次数被清空
  9449. if ($("#mzBlTimes").val() != null && $("#mzBlTimes").val() != "" && ($("#baseMzBlTimes").val() == null || $("#baseMzBlTimes").val() == "")) {
  9450. $("#baseMzBlTimes").val($("#mzBlTimes").val());
  9451. }
  9452. $("#otherBlRecordModal").modal("hide");
  9453. }
  9454. $("#mzBlTimes").val(mzBlRecord.times);
  9455. $("#editMzBlRecordModal").modal();
  9456. } else {
  9457. errorMesage(res);
  9458. }
  9459. }
  9460. });
  9461. }
  9462. /**
  9463. * 清空区域
  9464. */
  9465. function clearInput() {
  9466. //编辑病历的时候,没有基础病历的就诊次数,如果是预览病历的时候,有基础病历的次数
  9467. var baseMzBlTimes = $("#baseMzBlTimes").val();
  9468. $("#editPatientId").text(null);
  9469. $("#editPatientName").text(null);
  9470. $("#editPatientGender").text(null);
  9471. $("#editPatientAge").text(null);
  9472. $("#editEmrChiefComplaint").val(null);
  9473. $("#editEmrHpi").val(null);
  9474. $("#editEmrPs").val(null);
  9475. $("#editPersonalHistory").val(null);
  9476. $("#editFamilyHistory").val(null);
  9477. $("#editObstericalHistory").val(null);
  9478. $("#bl_weight").val(null);
  9479. $("#bl_sphygmus").val(null);
  9480. $("#bl_breathe").val(null);
  9481. $("#bl_pressure_high").val(null);
  9482. $("#bl_pressure_floor").val(null);
  9483. $("#bl_pressure_high_left").val(null);
  9484. $("#bl_pressure_floor_left").val(null);
  9485. $("#editQtjc").val(null);
  9486. $("#editZd").selectpicker('val', null);
  9487. $("#editZd").selectpicker('refresh');
  9488. $("#edittentativeDiagnosis").val(null);
  9489. $("#editEmrProcess").val(null);
  9490. $("#editEmrJkjy").val(null);
  9491. $("#mzBlTimes").val(null);
  9492. if (baseMzBlTimes != null && baseMzBlTimes != "") {
  9493. $("#otherBlRecordModal").modal();
  9494. }
  9495. }
  9496. /**
  9497. * 保存门诊病历
  9498. */
  9499. function setEmrProcess() {
  9500. $("#editMzBlRecordModal").modal("hide");
  9501. $("#messageModal").modal();
  9502. $("#messageContent").html("确认修改当前门诊病历吗?");
  9503. $("#messageButton").off("click").on("click", function (t) {
  9504. $("#messageModal").modal("hide");
  9505. sendEmrProcess();
  9506. });
  9507. $("#cancelButton").off("click").on("click", function (t) {
  9508. $("#editMzBlRecordModal").modal();
  9509. });
  9510. }
  9511. /**
  9512. * 提交保存门诊病历
  9513. */
  9514. function sendEmrProcess() {
  9515. //修改告警人员
  9516. var icdCodes = $("#editZd").val();
  9517. var icdCodeStr = null;
  9518. if (icdCodes != null && icdCodes.length > 0) {
  9519. for (var i = 0; i < icdCodes.length; i++) {
  9520. if (icdCodeStr == null) {
  9521. icdCodeStr = icdCodes[i];
  9522. } else {
  9523. icdCodeStr += "," + icdCodes[i];
  9524. }
  9525. }
  9526. }
  9527. $.ajax({
  9528. type: "POST",
  9529. url: '/thmz/setEmrProcess',
  9530. contentType: "application/json;charset=UTF-8",
  9531. dataType: "json",
  9532. data: JSON.stringify({
  9533. "patientId": $("#editPatientId").text(),
  9534. "times": $("#mzBlTimes").val(),
  9535. "emrChiefComplaint": $("#editEmrChiefComplaint").val(),
  9536. "emrHpi": $("#editEmrHpi").val(),
  9537. "emrPs": $("#editEmrPs").val(),
  9538. "personalHistory": $("#editPersonalHistory").val(),
  9539. "familyHistory": $("#editFamilyHistory").val(),
  9540. "obstericalHistory": $("#editObstericalHistory").val(),
  9541. "emrPe": $("#editQtjc").val(),
  9542. "weight": $("#bl_weight").val(),
  9543. "temperature": $("#bl_temperature").val(),
  9544. "sphygmus": $("#bl_sphygmus").val(),
  9545. "breathe": $("#bl_breathe").val(),
  9546. "pressureHigh": $("#bl_pressure_high").val(),
  9547. "pressureFloor": $("#bl_pressure_floor").val(),
  9548. "pressureHighLeft": $("#bl_pressure_high_left").val(),
  9549. "pressureFloorLeft": $("#bl_pressure_floor_left").val(),
  9550. "icdCode": icdCodeStr,
  9551. "icdText": $('#editZd').next().attr("title"),
  9552. "tentativeDiagnosis": $("#edittentativeDiagnosis").val(),
  9553. "emrJkjy": $("#editEmrJkjy").val(),
  9554. "emrProcess": $("#editEmrProcess").val()
  9555. }),
  9556. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9557. success: function (res) {
  9558. if (res == '401' || res == 401) {
  9559. window.location.href = '/thmz/login/view'
  9560. return;
  9561. }
  9562. if (res.code == 0) {
  9563. clearInput();
  9564. successMesage(res);
  9565. $("#editMzBlRecordModal").modal("hide");
  9566. } else {
  9567. errorMesage(res);
  9568. }
  9569. }
  9570. });
  9571. }
  9572. /**
  9573. * 打开待合并病历列表弹框
  9574. */
  9575. function openBlRecordModel() {
  9576. $("#editMzBlRecordModal").modal("hide");
  9577. $("#otherBlRecordModal").modal();
  9578. initOtherMzBlRecordList();
  9579. }
  9580. /**
  9581. * 关闭待合并病历列表
  9582. */
  9583. function closeBlRecordModel() {
  9584. $('#baseMzBlTimes').val(null);
  9585. $("#visitingDetailModal").modal();
  9586. }
  9587. /**
  9588. * 病历列表
  9589. */
  9590. function initOtherMzBlRecordList() {
  9591. $('#other_bl_record_table').bootstrapTable("destroy");
  9592. $('#other_bl_record_table').bootstrapTable({
  9593. url: '/thmz/getMzBlRecordList', //请求后台的URL(*)
  9594. method: 'post', //请求方式(*)
  9595. toolbar: '#toolbar', //工具按钮用哪个容器
  9596. striped: true, //是否显示行间隔色
  9597. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  9598. pagination: true, //是否显示分页(*)
  9599. sortable: true, //是否启用排序
  9600. sortOrder: "desc", //排序方式
  9601. queryParams: queryOtherParams, //传递参数(*)
  9602. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  9603. pageNumber: 1, //初始化加载第一页,默认第一页
  9604. pageSize: 5, //每页的记录行数(*)
  9605. pageList: [10, 15, 25, 50, 100], //可供选择的每页的行数(*)
  9606. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  9607. strictSearch: true,
  9608. showColumns: false, //是否显示所有的列
  9609. showRefresh: false, //是否显示刷新按钮
  9610. minimumCountColumns: 2, //最少允许的列数
  9611. clickToSelect: true, //是否启用点击选中行
  9612. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  9613. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  9614. cardView: false, //是否显示详细视图
  9615. detailView: false,
  9616. //rowStyle:rowStyle,//通过自定义函数设置行样式
  9617. ajaxOptions: {
  9618. headers: {
  9619. 'Accept': 'application/json',
  9620. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  9621. }
  9622. },
  9623. columns: [
  9624. {
  9625. title: '操作',
  9626. field: 'op',
  9627. align: "center",
  9628. valign: 'middle',
  9629. formatter: function (value, row, index) {
  9630. var str = '<button type="button" class="btn btn-primary btn-sm" onclick="showMzBlRecordModal(\'' + row.patientId + '\',' + row.times + ',2)">预览<i class="fa fa-edit" style="margin-left: 10px;"></i></button>';
  9631. return [str].join('');
  9632. }
  9633. },
  9634. {
  9635. field: 'patientId',
  9636. title: '门诊ID',
  9637. align: "center",
  9638. valign: 'middle'
  9639. }, {
  9640. field: 'patientName',
  9641. title: '患者姓名',
  9642. align: "center",
  9643. valign: 'middle'
  9644. }, {
  9645. field: 'deptCode',
  9646. title: '就诊科室',
  9647. align: "center",
  9648. valign: 'middle'
  9649. }, {
  9650. field: 'doctorCode',
  9651. title: '接诊医师',
  9652. align: "center",
  9653. valign: 'middle'
  9654. }, {
  9655. field: 'firstOrNot',
  9656. title: '初/复诊',
  9657. align: "center",
  9658. valign: 'middle',
  9659. formatter: function (value, row, index) {
  9660. if (value == '1') {
  9661. return "复诊";
  9662. }
  9663. return "初诊";
  9664. }
  9665. }
  9666. , {
  9667. field: 'visitDate',
  9668. title: '就诊时间',
  9669. align: "center",
  9670. valign: 'middle',
  9671. formatter: function (value, row, index) {
  9672. if (value == null || value == "") {
  9673. return "";
  9674. }
  9675. return format(value, "yyyy-MM-dd HH:mm:ss");
  9676. }
  9677. }
  9678. ],
  9679. responseHandler: function (res) {
  9680. if (res == '401' || res == 401) {
  9681. window.location.href = '/thmz/login/view'
  9682. return;
  9683. }
  9684. var ress = eval(res);
  9685. if (ress.code == -1) {
  9686. if (ress.message != null && ress.message != '') {
  9687. errorMesage(ress);
  9688. }
  9689. return {
  9690. "total": 0,//总页数
  9691. "rows": {} //数据
  9692. };
  9693. }
  9694. return {
  9695. "total": ress.total,//总页数
  9696. "rows": ress.data //数据
  9697. };
  9698. },
  9699. });
  9700. }
  9701. /**
  9702. * 构建列表查询参数
  9703. * @param params
  9704. * @returns {{mzChargeDetail: {patientId: string | number | string[] | undefined | jQuery, warnDept: string | number | string[] | undefined | jQuery, doctorCode: string | number | string[] | undefined | jQuery, name: string | number | string[] | undefined | jQuery, payMark: number}, beginTime: Date, endTime: Date, pageSize: *, pageIndex: number}}
  9705. */
  9706. function queryOtherParams(params) {
  9707. var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
  9708. patientId: $("#editPatientId").text(),
  9709. exceptTimes: $("#mzBlTimes").val(),
  9710. pageSize: params.limit, //页面大小
  9711. pageIndex: params.offset / params.limit, //页码
  9712. };
  9713. return temp;
  9714. }
  9715. /**
  9716. * 提取处理意见保存
  9717. */
  9718. function setOtherEmrProcess() {
  9719. $("#editMzBlRecordModal").modal("hide");
  9720. $("#messageModal").modal();
  9721. $("#messageContent").html("确定要执行此次提取处理意见操作吗?");
  9722. $("#messageButton").off("click").on("click", function (t) {
  9723. $("#messageModal").modal("hide");
  9724. $.ajax({
  9725. type: "GET",
  9726. url: '/thmz/extractEmrProcess?patientId=' + $("#editPatientId").html() + '&baseTimes=' + $("#baseMzBlTimes").val() + '&times=' + $("#mzBlTimes").val(),
  9727. contentType: "application/json;charset=UTF-8",
  9728. dataType: "json",
  9729. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9730. success: function (res) {
  9731. if (res == '401' || res == 401) {
  9732. window.location.href = '/thmz/login/view'
  9733. return;
  9734. }
  9735. if (res.code == 0) {
  9736. successMesage(res);
  9737. $("#editMzBlRecordModal").modal("hide");
  9738. } else {
  9739. errorMesage(res);
  9740. }
  9741. }
  9742. });
  9743. });
  9744. $("#cancelButton").off("click").on("click", function (t) {
  9745. $("#editMzBlRecordModal").modal();
  9746. });
  9747. }
  9748. /**
  9749. * 医保电子凭证读卡
  9750. */
  9751. function siReadCard() {
  9752. $.ajax({
  9753. type: "GET",
  9754. url: 'http://localhost:8321/readcard/entry?param=qrcode_01101',
  9755. contentType: "application/json;charset=UTF-8",
  9756. dataType: "json",
  9757. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9758. success: function (res) {
  9759. if (res == '401' || res == 401) {
  9760. window.location.href = '/thmz/login/view'
  9761. return;
  9762. }
  9763. //console.log(res);
  9764. if (res.code == 200) {
  9765. var data = JSON.parse(res.data);
  9766. queryUserInfoBySocialNoNotFillPatient('rapidAcceptsUserCardNo', "" + data.data.idNo + "", queryUserInfoByCardNo, 'rapidAcceptsModal');
  9767. } else {
  9768. errorMesage(res);
  9769. }
  9770. }
  9771. });
  9772. // window.open('ReadCard://'+prm, '_self')
  9773. }
  9774. /**
  9775. * 西药品类按钮点击事件 因为原插件有点未解决bug,点击title的时候,加载的列表非对应的,
  9776. * @param paneId
  9777. */
  9778. function xyTableOnClick(paneId) {
  9779. setTimeout(function () {
  9780. $("#xyTabContent div.tab-pane").each(function (index, obj) {
  9781. var targetId = $(obj).attr("id");
  9782. //如果处方内容是空的,就删除没有处方
  9783. if ($(obj).find("div.cf_content").children().length == 0) {
  9784. $(obj).remove();
  9785. $("[href='#" + targetId + "']").parent().remove();
  9786. } else if (targetId == paneId) {
  9787. $(obj).addClass("active").addClass("in");
  9788. } else {
  9789. $(obj).removeClass("active").removeClass("in");
  9790. }
  9791. });
  9792. }, 400);
  9793. }
  9794. /**
  9795. * 打开转诊弹层
  9796. */
  9797. function transferTreatment() {
  9798. $("#turnDept").selectpicker({
  9799. size: 5
  9800. });
  9801. $("#turnToConsultationTitle").html("转诊");
  9802. $("#opType").val(1);
  9803. $("#turnToConsultationDoctorDiv").removeClass("hide").addClass("in");
  9804. $("#turnDeptDiv").removeClass("hide").addClass("in");
  9805. $("#consultationDeptDiv").removeClass("in").addClass("hide");
  9806. //科室列表
  9807. $.ajax({
  9808. type: "GET",
  9809. url: '/thmz/getUnitCodeByRequestDay?ampm=',
  9810. dataType: "json",
  9811. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9812. success: function (data) {
  9813. if (data == '401' || data == 401) {
  9814. window.location.href = '/thmz/login/view'
  9815. return;
  9816. }
  9817. var html = '';
  9818. $.each(data.data, function (commentIndex, comment) {
  9819. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';
  9820. });
  9821. $('#turnDept').empty();
  9822. $('#turnDept').html(html);
  9823. $('#turnDept').selectpicker('refresh');
  9824. }
  9825. });
  9826. $("#turnToConsultationModal").modal();
  9827. }
  9828. /**
  9829. * 打开会诊弹层
  9830. */
  9831. function consultation() {
  9832. $("#consultationDept").selectpicker({
  9833. size: 5
  9834. });
  9835. $("#turnToConsultationTitle").html("发起会诊");
  9836. $("#opType").val(2);
  9837. $("#turnToConsultationDoctorDiv").removeClass("in").addClass("hide");
  9838. $("#consultationDeptDiv").removeClass("hide").addClass("in");
  9839. $("#turnDeptDiv").removeClass("in").addClass("hide");
  9840. //科室列表
  9841. $.ajax({
  9842. type: "GET",
  9843. url: '/thmz/allMzUnitCode',
  9844. dataType: "json",
  9845. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9846. success: function (res) {
  9847. if (res == '401' || res == 401) {
  9848. window.location.href = '/thmz/login/view'
  9849. return;
  9850. }
  9851. var html = '';
  9852. $.each(res.data, function (commentIndex, comment) {
  9853. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';
  9854. });
  9855. $('#consultationDept').empty();
  9856. $('#consultationDept').html(html);
  9857. $('#consultationDept').selectpicker('refresh');
  9858. $.ajax({
  9859. type: "GET",
  9860. url: '/thmz/getUnConsultation?serialNo=' + $("#mzfzSerialNoInClick").val(),
  9861. dataType: "json",
  9862. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9863. success: function (res) {
  9864. if (res == '401' || res == 401) {
  9865. window.location.href = '/thmz/login/view'
  9866. return;
  9867. }
  9868. var data = res.data;
  9869. if (data != null && data.length > 0) {
  9870. $('#consultationDept').selectpicker('val', data);
  9871. $('#consultationDept').selectpicker('refresh');
  9872. }
  9873. }
  9874. });
  9875. }
  9876. });
  9877. $("#turnToConsultationModal").modal();
  9878. }
  9879. /**
  9880. * 清空转诊和发起会诊区域
  9881. */
  9882. function clearTurnToConsultationInput() {
  9883. $("#turnDept").selectpicker('val', null);
  9884. $("#turnDept").selectpicker('refresh');
  9885. $("#consultationDept").selectpicker('val', null);
  9886. $("#consultationDept").selectpicker('refresh');
  9887. $("#turnToConsultationDoctor").selectpicker('val', null);
  9888. $("#turnToConsultationDoctor").selectpicker('refresh');
  9889. $("#turnToConsultationId").val(null);
  9890. $("#opType").val(null);
  9891. $("#turnToConsultationDoctorDiv").removeClass("in").addClass("hide");
  9892. $("#turnDeptDiv").removeClass("in").addClass("hide");
  9893. $("#consultationDeptDiv").removeClass("in").addClass("hide");
  9894. }
  9895. /**
  9896. * 保存转诊/会诊
  9897. */
  9898. function setTurnToConsultation() {
  9899. $("#turnToConsultationModal").modal("hide");
  9900. $("#messageModal").modal();
  9901. var opType = $("#opType").val();
  9902. var targetDeptNo = $("#turnDept").val();
  9903. var title = "确认提交转诊操作吗,提交后您将无法继续接诊该患者?";
  9904. if (opType == 2 || opType == "2") {
  9905. title = "确认提交本次会诊操作吗?";
  9906. var consultationDept = $("#consultationDept").val();
  9907. if (consultationDept != null && consultationDept.length > 0) {
  9908. targetDeptNo = null;
  9909. for (var i = 0; i < consultationDept.length; i++) {
  9910. if (targetDeptNo == null) {
  9911. targetDeptNo = consultationDept[i];
  9912. } else {
  9913. targetDeptNo += "," + consultationDept[i];
  9914. }
  9915. }
  9916. }
  9917. }
  9918. $("#messageContent").html(title);
  9919. $("#messageButton").off("click").on("click", function (t) {
  9920. $("#messageModal").modal("hide");
  9921. $.ajax({
  9922. type: "POST",
  9923. url: '/thmz/saveTurnToConsultation',
  9924. contentType: "application/json;charset=UTF-8",
  9925. dataType: "json",
  9926. data: JSON.stringify({
  9927. "id": $("#turnToConsultationId").val(),
  9928. "opType": opType,
  9929. "targetDeptNo": targetDeptNo,
  9930. "targetDoctorNo": $("#turnToConsultationDoctor").val(),
  9931. "serialNo": $("#mzfzSerialNoInClick").val(),
  9932. "remark": $("#turnToConsultationRemark").val(),
  9933. }),
  9934. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9935. success: function (res) {
  9936. if (res == '401' || res == 401) {
  9937. window.location.href = '/thmz/login/view'
  9938. return;
  9939. }
  9940. if (res.code == 0) {
  9941. successMesage(res);
  9942. clearTurnToConsultationInput();
  9943. if (opType == 1 || opType == "1") {
  9944. //加载候诊患者列表
  9945. loadUnClinicTableList();
  9946. //加载接诊中患者列表
  9947. loadInClinicTableList();
  9948. clearWorkSpace();
  9949. }
  9950. } else {
  9951. $("#turnToConsultationModal").modal();
  9952. errorMesage(res);
  9953. }
  9954. }
  9955. });
  9956. });
  9957. $("#cancelButton").off("click");
  9958. }
  9959. /**
  9960. * 初始医生下拉选
  9961. * @param ampm 时间段区间
  9962. */
  9963. function initEmployee() {
  9964. var opType = $("#opType").val();
  9965. if (opType == 2) {
  9966. return;
  9967. }
  9968. $("#turnToConsultationDoctor").selectpicker({
  9969. size: 5
  9970. });
  9971. //医生列表
  9972. $.ajax({
  9973. type: "GET",
  9974. url: '/thmz/getDoctorCodeByRequestDay?unitCode=' + $('#turnDept').val() + "&ampm=&chargeType=",
  9975. dataType: "json",
  9976. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9977. success: function (res) {
  9978. if (res == '401' || res == 401) {
  9979. window.location.href = '/thmz/login/view'
  9980. return;
  9981. }
  9982. var html = '';
  9983. var defaultCode = null;
  9984. $.each(res.data, function (commentIndex, comment) {
  9985. var employeeName = comment.employee.employeeName;
  9986. if (comment.leftNum != null) {
  9987. employeeName = employeeName + " 余号(" + comment.leftNum + ")"
  9988. }
  9989. html += '<option value="' + comment.employee.employeeCode + '" data-chargeType="' + comment.chargeType + '" data-checkFee="' + comment.checkFee + '" data-mzyRequestId="' + comment.mzyRequestId + '">' + employeeName + '</option>';
  9990. if (res.data.length == 1) {
  9991. //如果只有一个号别,默认选中
  9992. defaultCode = comment.employee.employeeCode;
  9993. }
  9994. });
  9995. $('#turnToConsultationDoctor').empty();
  9996. $('#turnToConsultationDoctor').html(html);
  9997. $('#turnToConsultationDoctor').selectpicker('refresh');
  9998. if (defaultCode != null) {
  9999. //如果有无需选择医生的选项,默认选择
  10000. $('#turnToConsultationDoctor').selectpicker('val', defaultCode);
  10001. $('#turnToConsultationDoctor').selectpicker('refresh');
  10002. }
  10003. }
  10004. });
  10005. }