clinic.js 470 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941
  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. //是否在读卡中
  16. var mztczfSiReadCardStatus = false;
  17. //药品组号与处方号关系
  18. var gropuIdAndOrderNoMap = null;
  19. //上一个药品大类
  20. //var prevCategoriesFlag = null;
  21. $(function () {
  22. initGenderSelect();
  23. iniAdmissStatus();
  24. initListDeptSelect();
  25. //initTryResultSelect();
  26. initResponceTypeSelect();
  27. initTemplateTypeSelect("templateType");
  28. initTemplateKindTypeSelect('templateKindType');
  29. initZyClassTypeSelect();
  30. initInstructionSelect();
  31. setSelectSize();
  32. initCertificateTypeSelect();
  33. initMztcSelect();
  34. $('#editUserBirthDayGroup').datetimepicker({
  35. format: 'yyyy-mm-dd',
  36. language: 'zh-CN',
  37. minView: "month",
  38. });
  39. initDaterangepickerWithId('reportrange', "right");
  40. formatCheck();
  41. //数据校验
  42. init_validator();
  43. //初始频次下拉选
  44. initOrderFrequencys("orderFrequency", true);
  45. //初始用药方式下拉选
  46. initSupplyTypes();
  47. //加载候诊患者列表
  48. loadUnClinicTableList();
  49. //加载接诊中患者列表
  50. loadInClinicTableList();
  51. //加载已接诊患者列表
  52. loadClinicTableList();
  53. //每隔一分钟秒读加载候诊患者列表
  54. setInterval(function () {
  55. //加载候诊患者列表
  56. loadUnClinicTableList();
  57. //加载已接诊患者列表 病人会缴费,需要刷新状态
  58. loadClinicTableList();
  59. }, 60000);
  60. //初始化快速接诊病人姓名栏事件
  61. initUserList();
  62. //初始化主诉弹出层
  63. initRecommendList();
  64. //卡号输入改变事件
  65. cardNoChange();
  66. /**
  67. * 患者信息修改
  68. */
  69. $("#saveEditUser").on("click", function (t) {
  70. modifyPatient();
  71. });
  72. // /**
  73. // * 保存入院证
  74. // */
  75. // $("#saveBeHospitalized").on("click", function (t) {
  76. // saveBeHospitalized();
  77. // });
  78. /**
  79. * 打印入院证
  80. */
  81. $("#printBeHospitalized").on("click", function (t) {
  82. modifyPatient();
  83. });
  84. //折叠按钮初始化
  85. $('.collapse-link').on('click', function () {
  86. var $BOX_PANEL = $(this).closest('.x_panel_mine'),
  87. $ICON = $(this).find('i'),
  88. $BOX_CONTENT = $BOX_PANEL.find('.x_content');
  89. // fix for some div with hardcoded fix class
  90. if ($BOX_PANEL.attr('style')) {
  91. $BOX_CONTENT.slideToggle(200, function () {
  92. $BOX_PANEL.removeAttr('style');
  93. });
  94. } else {
  95. $BOX_CONTENT.slideToggle(200);
  96. $BOX_PANEL.css('height', 'auto');
  97. }
  98. $ICON.toggleClass('fa-chevron-up fa-chevron-down');
  99. });
  100. /**
  101. * 接诊
  102. */
  103. $("#clinicalReception").on("click", function (t) {
  104. var patientIdDb = $("#patientIdDb").val();
  105. if (patientIdDb == null || patientIdDb == "") {
  106. errorMesageSimaple("当前未选择病人,无法接诊");
  107. return;
  108. }
  109. $.ajax({
  110. type: "GET",
  111. url: '/thmz/getMzfzPatientOrderByPatientId?patientId=' + patientIdDb,
  112. contentType: "application/json;charset=UTF-8",
  113. dataType: "json",
  114. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  115. success: function (res) {
  116. if (res == '401' || res == 401) {
  117. window.location.href = '/thmz/login/view'
  118. return;
  119. }
  120. if (res.code == 0) {
  121. if (res.data != null && res.data.length > 0) {
  122. if (res.data.length == 1) {
  123. $("#turnToConsultationIdInClick").val(res.data[0].turnToConsultationId);
  124. clinicalReception(patientIdDb, res.data[0].serialNo, res.data[0].reqType);
  125. } else {
  126. $("#mzfzPatientOrderModal").modal();
  127. $("#mzfzPatientOrderTable").html(null);
  128. for (var i = 0; i < res.data.length; i++) {
  129. var roomCode = res.data[i].roomCode;
  130. if (roomCode == null || roomCode == "null") {
  131. roomCode = "";
  132. }
  133. var doctorCode = (res.data[i].doctorCode == null || res.data[i].doctorCode == 'null') ? '' : res.data[i].doctorCode;
  134. $("<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 () {
  135. $("#mzfzPatientOrderModal").modal("hide");
  136. $("#turnToConsultationIdInClick").val($(this).attr("data-target-turnToConsultationId"));
  137. clinicalReception(patientIdDb, $(this).attr("data-target"), $(this).attr("data-target-reqType"));
  138. });
  139. }
  140. }
  141. clearRapidAcceptsModal();
  142. $("#rapidAcceptsModal").modal("hide");
  143. } else {
  144. errorMesageSimaple("当前病人没有分诊信息");
  145. }
  146. } else if (res.code == 200) {
  147. clearRapidAcceptsModal();
  148. $("#rapidAcceptsModal").modal("hide");
  149. clinicalReception(patientIdDb, null, null);
  150. } else {
  151. errorMesage(res);
  152. }
  153. }
  154. });
  155. });
  156. /**
  157. * 存为范本
  158. */
  159. $("#saveapidAccepts").on("click", function (t) {
  160. // var symptom = $("#symptom").val();
  161. // if (symptom == null || symptom == "") {
  162. // errorMesageSimaple("主诉不能为空!");
  163. // return;
  164. // }
  165. //var emrHpi = $("#emrHpi").val();
  166. // if (emrHpi == null || emrHpi == "") {
  167. // errorMesageSimaple("现病史不能为空!");
  168. // return;
  169. // }
  170. // var diagnoseValue = $("#diagnoseValue").val();
  171. // var tentativeDiagnosis = $("#tentativeDiagnosis").val();
  172. // if (diagnoseValue != null) {
  173. // var reg = new RegExp(',', "g")
  174. // diagnoseValue = diagnoseValue.replace(reg, '');
  175. // }
  176. // if ((diagnoseValue == null || diagnoseValue == "") && (tentativeDiagnosis == null || tentativeDiagnosis == "")) {
  177. // errorMesageSimaple("诊断和初步诊断不能同时为空!");
  178. // return;
  179. // }
  180. //关闭帮助框
  181. $("#treeButton").webuiPopover('hide');
  182. $("#western_medicine_name").webuiPopover('hide');
  183. $("#chinese_medicine_name").webuiPopover('hide');
  184. $("#jcJyItem").webuiPopover('hide');
  185. $("#zlItem").webuiPopover('hide');
  186. $("#saveapidAcceptsModal").modal("show");
  187. });
  188. /**
  189. * 实例化智能问诊弹窗
  190. */
  191. // $("[data-toggle='popover']").popover();
  192. $("#box-arrow-left").popover({
  193. html: 'true',
  194. content: '<div id="smartAssistPopoverContent"></div>'
  195. });
  196. //初始化药品分组下拉选
  197. initGroupOrder();
  198. // 初始化用药天数下拉选
  199. initDayNum();
  200. //页面加载完成初始化西药处方
  201. //initNavTabs(0);
  202. //页面加载完成初始化住院处方
  203. //initNavTabs(3);
  204. //初始医生工作太配置
  205. initWorkspaceConfigForCurrent();
  206. initExecUnit();
  207. /**
  208. * 西药点击事件
  209. */
  210. $("#western_medicine_name").on("click", function (t) {
  211. var obj = $("#westernMedicinePopoverContent").parent().parent().parent();
  212. if ($(obj).hasClass("in") || $(obj).css("display") == "block") {
  213. $('#western_medicine_name').webuiPopover('hide');
  214. $("#treeButton").webuiPopover('hide');
  215. return;
  216. }
  217. $('#western_medicine_name').webuiPopover('show');
  218. loadYpList(0, null);
  219. });
  220. /**
  221. * 中药点击事件
  222. */
  223. $("#chinese_medicine_name").on("click", function (t) {
  224. var obj = $("#chineseMedicinePopoverContent").parent().parent().parent();
  225. if ($(obj).hasClass("in") || $(obj).css("display") == "block") {
  226. $('#chinese_medicine_name').webuiPopover('hide');
  227. $("#treeButton").webuiPopover('hide');
  228. return;
  229. }
  230. $('#chinese_medicine_name').webuiPopover('show');
  231. loadYpList(1, null);
  232. });
  233. /**
  234. * 辅助检查、检验点击事件
  235. */
  236. $("#jcJyItem").on("click", function (t) {
  237. var obj = $("#jcJyItemPopoverContent").parent().parent().parent();
  238. if ($(obj).hasClass("in") || $(obj).css("display") == "block") {
  239. $('#jcJyItem').webuiPopover('hide');
  240. $("#treeButton").webuiPopover('hide');
  241. return;
  242. }
  243. $('#jcJyItem').webuiPopover('show');
  244. loadjcJyItemList(null);
  245. });
  246. /**
  247. * 诊疗点击事件
  248. */
  249. $("#zlItem").on("click", function (t) {
  250. var obj = $("#zlItemPopoverContent").parent().parent().parent();
  251. if ($(obj).hasClass("in") || $(obj).css("display") == "block") {
  252. $('#zlItem').webuiPopover('hide');
  253. $("#treeButton").webuiPopover('hide');
  254. return;
  255. }
  256. $('#zlItem').webuiPopover('show');
  257. loadZlItemList(null);
  258. });
  259. initYshPart();
  260. initJyZdSample();
  261. setTimeout(function () {
  262. getLodop();
  263. }, 800);
  264. //键盘监听回车键
  265. $(document).unbind("keyup").keyup(function (event) {
  266. var index = getIndex("bill_item_group");
  267. if (event.keyCode == 13) { //是否是回车
  268. var el = event.srcElement || event.target;
  269. var id = el.getAttribute("id");
  270. var current_code = null;
  271. if (index == 0) {
  272. current_code = $("#western_medicine_current_code").val();
  273. } else if (index == 1) {
  274. current_code = $("#chinese_medicine_current_code").val();
  275. } else if (index == 2) {
  276. current_code = $("#jcjy_current_code").val();
  277. } else if (index == 3) {
  278. current_code = $("#zl_current_code").val();
  279. }
  280. if (id == null || id == "") {
  281. id = el.getAttribute("data-id");
  282. }
  283. if (id == null || id == "") {
  284. var search = el.getAttribute("aria-label");
  285. if (search == "Search") {
  286. id = $(el).parent().parent().prev().attr("data-id");
  287. }
  288. }
  289. if (id != null && id != "") {
  290. //将当前点击的id记录下
  291. //prevEleId = id;
  292. } else if (prevEleId != null) {
  293. id = prevEleId;
  294. }
  295. //回车时,光标不在任何区域判断是不是在药品和诊疗开立区域
  296. if (id == null || id == "") {
  297. var index = getIndex("bill_item_group");
  298. if (index == 0) {
  299. if (current_code != null && current_code != "") {
  300. //当前页面是西药保存页面,且有药品选中
  301. $("#supplyType").next().click();
  302. }
  303. } else if (index == 1) {
  304. //当前页面是中草药保存页面,且有药品选中
  305. } else if (index == 2) {
  306. if (current_code != null && current_code != "") {
  307. //当前页面是医技保存页面,且有选中
  308. if ($("#jyZdSampleDiv").hasClass('in')) {
  309. //此时是检验
  310. $("#jyZdSample").next().click();
  311. } else if ($("#yshPartDiv").hasClass('in')) {
  312. //说明现在是检查
  313. $("#yshPart").next().click();
  314. }
  315. }
  316. } else if (index == 3) {
  317. //诊疗
  318. $("#yshPart").next().click();
  319. return;
  320. } else if (index == 4) {
  321. //当前页面是住院保存页面
  322. $("#inpatientWardBeHospitalized").next().click();
  323. return;
  324. }
  325. }
  326. var customization = $("div.customization").not(".hide");
  327. // //回车时,光标不在任何区域,默认点击主诉
  328. // if (id == null || id == "") {
  329. // var eleId = $(customization[0]).attr("target-id");
  330. // $("#" + eleId).focus();
  331. // if (eleId == 'symptom') {
  332. // $("#" + eleId).click();
  333. // }
  334. // console.log("eleId=" + eleId);
  335. // } else
  336. if (id == 'symptom' || id == 'emrHpi' || id == 'emrPs' || id == 'personalHistory' || id == 'familyHistory' || id == 'obstericalHistory' || id == 'otherCheck' || id == 'diagnose' || id == 'tentativeDiagnosis') {
  337. console.log("1id=" + id);
  338. if (id != $(customization[customization.length - 1]).attr("target-id")) {
  339. var next = $("#" + id + "Flag").next();
  340. while ($(next).hasClass("foreclose") || $(next).hasClass("hide")) {
  341. next = $(next).next();
  342. }
  343. var eleId = $(next).attr("target-id");
  344. $("#" + eleId).focus();
  345. if (eleId == 'diagnose' || id == 'diagnose' || id == 'symptom') {
  346. $("#" + eleId).click();
  347. }
  348. console.log("1eleId=" + eleId);
  349. } else {
  350. var data_target = $("#symptom").attr("data-target");
  351. $("#" + data_target).find("a.close").click();
  352. data_target = $("#diagnose").attr("data-target");
  353. $("#" + data_target).find("a.close").click();
  354. if (index == 0) {
  355. $("#western_medicine_name").focus();
  356. } else if (index == 1) {
  357. $("#chinese_medicine_name").focus();
  358. } else if (index == 2) {
  359. $("#jcJyItem").focus();
  360. } else if (index == 3) {
  361. $("#zlItem").focus();
  362. } else if (index == 4) {
  363. $("#inpatientWardBeHospitalized").next().click();
  364. }
  365. }
  366. } else if (id == 'zy_drugWin') {
  367. $("#zyInstruction").next().click();
  368. } else if (id == 'zyInstruction') {
  369. var ariaExpanded = $("#zyInstruction").next().attr("aria-expanded");
  370. if (ariaExpanded == true || ariaExpanded == "true") {
  371. $("#zyInstruction").next().click();
  372. }
  373. $("#saveChineseMedicine").click();
  374. $("#chinese_medicine_name").focus();
  375. $("#chinese_medicine_name").click();
  376. }
  377. else if (id == 'cyJssm') {
  378. $("#cyJsl").focus();
  379. } else if (id == 'cyJsl') {
  380. $("#cyZql").focus();
  381. } else if (id == 'cyZql') {
  382. $("#cyFj").focus();
  383. } else if (id == 'cyFj') {
  384. $("#cyFfcs").focus();
  385. } else if (id == 'cyFj') {
  386. $("#cyFfcs").focus();
  387. } else if (id == 'cyFfcs') {
  388. $("#useType_1").next().click();
  389. } else if (id == 'useType_1') {
  390. $("#cyMtjs").focus();
  391. } else if (id == 'cyMtjs') {
  392. $("#zyfs").focus();
  393. } else if (id == 'zyfs') {
  394. $("#zy_supplyType_1").next().click();
  395. } else if (id == 'supplyType') {
  396. $("#drugWinUnit").next().click();
  397. } else if (id == 'drugWinUnit') {
  398. $("#drugWin").focus();
  399. } else if (id == 'drugWin') {
  400. $("#dayNum").next().click();
  401. } else if (id == 'dayNum') {
  402. $("#orderFrequency").next().click();
  403. } else if (id == 'orderFrequency') {
  404. $("#gross").focus();
  405. } else if (id == 'gross') {
  406. $("#packUnit").next().click();
  407. } else if (id == 'packUnit') {
  408. $("#medicalAdvice").next().click();
  409. } else if (id == 'medicalAdvice') {
  410. var ariaExpanded = $("#medicalAdvice").next().attr("aria-expanded");
  411. if (ariaExpanded == true || ariaExpanded == "true") {
  412. $("#medicalAdvice").next().click();
  413. }
  414. saveMedicine(0);
  415. $("#western_medicine_name").focus();
  416. } else if (id == 'saveWesternMedicine') {
  417. $("#western_medicine_name").focus();
  418. $("#western_medicine_name").click();
  419. } else if (id == 'jyZdSample' || id == 'yshPart') {
  420. $("#execUnit").next().click();
  421. } else if (id == 'execUnit') {
  422. var ariaExpanded = $("#execUnit").next().attr("aria-expanded");
  423. if (ariaExpanded == true || ariaExpanded == "true") {
  424. $("#execUnit").next().click();
  425. }
  426. $("#remark").focus();
  427. } else if (id == 'remark') {
  428. saveJyJcItem(true);
  429. $("#jcJyItem").focus();
  430. } else if (id == 'chargeUnit') {
  431. $("#zlExecUnit").next().click();
  432. } else if (id == 'zlExecUnit') {
  433. var ariaExpanded = $("#zlExecUnit").next().attr("aria-expanded");
  434. if (ariaExpanded == true || ariaExpanded == "true") {
  435. $("#zlExecUnit").next().click();
  436. }
  437. $("#itemQuantity").focus();
  438. } else if (id == 'itemQuantity') {
  439. $("#zlRemark").focus();
  440. } else if (id == 'zlRemark') {
  441. saveZlItem(true);
  442. $("#zlItem").focus();
  443. } else if (id == 'inpatientWardBeHospitalized') {
  444. $("#smallWardBeHospitalized").next().click();
  445. } else if (id == 'smallWardBeHospitalized') {
  446. $("#admissStatus").next().click();
  447. } else if (id == 'admissStatus') {
  448. saveZyReq(true);
  449. $("#zy_req_button").focus();
  450. } else if (id == 'western_medicine_name') {
  451. var webuiID = $("#western_medicine_name").attr("data-target");
  452. if (webuiID == null || webuiID == "null" || webuiID == "") {
  453. //药品查询框是空白的,打开查询框
  454. $("#western_medicine_name").click();
  455. return;
  456. }
  457. //选择框打开
  458. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  459. var arr = $("#tb_table_western_medicine").find("tbody").find("tr.trhover");
  460. if (arr != undefined && arr != null && arr.length > 0) {
  461. var dataIndex = $(arr).attr("data-index");
  462. var tableData = $("#tb_table_western_medicine").bootstrapTable('getData');
  463. if (tableData != null && tableData.length > 0 && dataIndex != null) {
  464. var trData = tableData[dataIndex];
  465. checkYpInfo(trData.code, trData.serial, trData.ypType, true, null);
  466. $("#western_medicine_name").click();
  467. }
  468. } else {
  469. //药品查询框是空白的,打开查询框
  470. $("#western_medicine_name").click();
  471. }
  472. } else {
  473. if (current_code != null && current_code != "") {
  474. //已经选中药品,跳到用法
  475. $("#supplyType").next().click();
  476. } else {
  477. //药品查询框是空白的,打开查询框
  478. $("#western_medicine_name").click();
  479. }
  480. }
  481. } else if (id == 'chinese_medicine_name') {
  482. var webuiID = $("#chinese_medicine_name").attr("data-target");
  483. if (webuiID == null || webuiID == "null" || webuiID == "") {
  484. $("#chinese_medicine_name").click();
  485. return;
  486. }
  487. //选择框打开
  488. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  489. var arr = $("#tb_table_chinese_medicine").find("tbody").find("tr.trhover");
  490. if (arr != undefined && arr != null && arr.length > 0) {
  491. var dataIndex = $(arr).attr("data-index");
  492. var tableData = $("#tb_table_chinese_medicine").bootstrapTable('getData');
  493. if (tableData != null && tableData.length > 0 && dataIndex != null) {
  494. var trData = tableData[dataIndex];
  495. checkZyInfo(trData.code, trData.serial, true);
  496. $("#chinese_medicine_name").click();
  497. }
  498. } else {
  499. //药品查询框是空白的,打开查询框
  500. $("#chinese_medicine_name").click();
  501. }
  502. } else {
  503. if (current_code != null && current_code != "") {
  504. //已经选中药品,跳到剂量
  505. $("#zy_drugWin").next().click();
  506. } else {
  507. //药品查询框是空白的,打开查询框
  508. $("#chinese_medicine_name").click();
  509. }
  510. }
  511. } else if (id == 'jcJyItem') {
  512. var webuiID = $("#jcJyItem").attr("data-target");
  513. if (webuiID == null || webuiID == "null" || webuiID == "") {
  514. $("#jcJyItem").click();
  515. return;
  516. }
  517. //选择框打开
  518. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  519. var arr = $("#tb_table_jc_jy_item").find("tbody").find("tr.trhover");
  520. if (arr != undefined && arr != null && arr.length > 0) {
  521. var dataIndex = $(arr).attr("data-index");
  522. var tableData = $("#tb_table_jc_jy_item").bootstrapTable('getData');
  523. if (tableData != null && tableData.length > 0 && dataIndex != null) {
  524. var trData = tableData[dataIndex];
  525. $('#jcJyItem').webuiPopover('hide');
  526. $("#jcJyZltype").val(trData.type);
  527. $("#execUnit").selectpicker('val', trData.execUnit);//默认不选中
  528. $("#execUnit").selectpicker('refresh');
  529. if (trData.type == 1) {
  530. //检验
  531. $("#jyZdSampleDiv").removeClass("hide").addClass("in");
  532. $("#chargeUnitDiv").removeClass("in").addClass("hide");
  533. $("#yshPartDiv").removeClass("in").addClass("hide");
  534. if (trData.sampleCode != null && trData.sampleCode != "") {
  535. $("#jyZdSample").selectpicker('val', trData.sampleCode);
  536. $('#jyZdSample').selectpicker('refresh');
  537. }
  538. } else if (trData.type == 2) {
  539. //检查
  540. $("#yshPartDiv").removeClass("hide").addClass("in");
  541. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  542. $("#chargeUnitDiv").removeClass("in").addClass("hide");
  543. if (trData.bwCode != null && trData.bwCode != "") {
  544. $("#yshPart").selectpicker('val', trData.bwCode);
  545. $('#yshPart').selectpicker('refresh');
  546. }
  547. }
  548. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  549. checkJcJyItemInfo(trData.code, trData.name, trData.type, true);
  550. }
  551. } else {
  552. //药品查询框是空白的,打开查询框
  553. $("#jcJyItem").click();
  554. }
  555. } else {
  556. if (current_code != null && current_code != "") {
  557. //如果是保存失败的,重新打开输入框查询
  558. if (prevEleId == 'remark') {
  559. $("#jcJyItem").click();
  560. } else {
  561. //当前页面是医技保存页面,且有选中
  562. if ($("#jyZdSampleDiv").hasClass('in')) {
  563. //此时是检验
  564. $("#jyZdSample").next().click();
  565. } else if ($("#yshPartDiv").hasClass('in')) {
  566. //说明现在是检查
  567. $("#yshPart").next().click();
  568. }
  569. }
  570. } else {
  571. //药品查询框是空白的,打开查询框
  572. $("#jcJyItem").click();
  573. }
  574. }
  575. } else if (id == 'zlItem') {
  576. var webuiID = $("#zlItem").attr("data-target");
  577. if (webuiID == null || webuiID == "null" || webuiID == "") {
  578. $("#zlItem").click();
  579. return;
  580. }
  581. //选择框打开
  582. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  583. var arr = $("#tb_table_zl_item").find("tbody").find("tr.trhover");
  584. if (arr != undefined && arr != null && arr.length > 0) {
  585. var dataIndex = $(arr).attr("data-index");
  586. var tableData = $("#tb_table_zl_item").bootstrapTable('getData');
  587. if (tableData != null && tableData.length > 0 && dataIndex != null) {
  588. var trData = tableData[dataIndex];
  589. $('#zlItem').webuiPopover('hide');
  590. $("#zlExecUnit").selectpicker('val', trData.execUnit);//默认不选中
  591. $("#zlExecUnit").selectpicker('refresh');
  592. //诊疗
  593. if ($("#zlTab").find("li") == null || $("#zlTab").find("li").length == 0) {
  594. initNavTabs(3);
  595. }
  596. $("#zlItem").val(trData.name);
  597. $("#zlItem").blur();
  598. $("#zlItemPrice").val(trData.chargeAmount);
  599. $("#chargeUnit").val(trData.specification);
  600. $("#zl_current_code").val(trData.code);
  601. $("#itemQuantity").val(1);
  602. $("#chargeUnit").focus();
  603. }
  604. } else {
  605. //药品查询框是空白的,打开查询框
  606. $("#zlItem").click();
  607. }
  608. } else {
  609. if (current_code != null && current_code != "") {
  610. //如果是保存失败的,重新打开输入框查询
  611. if (prevEleId == 'zlRemark') {
  612. $("#zlItem").click();
  613. } else {
  614. $("#chargeUnit").focus();
  615. }
  616. } else {
  617. //药品查询框是空白的,打开查询框
  618. $("#zlItem").click();
  619. }
  620. }
  621. } else if (id == 'zy_req_button') {
  622. //当前页面是住院保存页面,此时光标在入院按钮上
  623. console.log("入院按钮")
  624. $("#inpatientWardBeHospitalized").next().click();
  625. }
  626. if (id != null && id != "") {
  627. //将当前点击的id记录下
  628. prevEleId = id;
  629. }
  630. } else if (event.keyCode == 37) {
  631. // //左键事件
  632. // if(index==0){
  633. // return;
  634. // }
  635. // var prevObject=$("#bill_item_group").find("button")[index-1];
  636. // $(prevObject).click();
  637. } else if (event.keyCode == 38) {
  638. //上键事件
  639. var tableId = null;
  640. var inputId = null;
  641. var contentId = null;
  642. if (index == 0) {
  643. tableId = "tb_table_western_medicine";
  644. inputId = "western_medicine_name";
  645. contentId = "westernMedicinePopoverContent";
  646. } else if (index == 1) {
  647. tableId = "tb_table_chinese_medicine";
  648. inputId = "chinese_medicine_name";
  649. contentId = "chineseMedicinePopoverContent";
  650. } else if (index == 2) {
  651. tableId = "tb_table_jc_jy_item";
  652. inputId = "jcJyItem";
  653. contentId = "jcJyItemPopoverContent";
  654. } else if (index == 3) {
  655. tableId = "tb_table_zl_item";
  656. inputId = "zlItem";
  657. contentId = "zlItemPopoverContent";
  658. }
  659. if (inputId == null) {
  660. return;
  661. }
  662. var webuiID = $("#" + inputId).attr("data-target");
  663. if (webuiID == null || webuiID == "null" || webuiID == "") {
  664. return;
  665. }
  666. //选择框打开
  667. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  668. var arr = $("#" + tableId).find("tbody").find("tr.trhover");
  669. var prev = $(arr).prev();
  670. if (arr != undefined && arr != null && arr.length > 0) {
  671. if (prev != undefined && prev != null && prev.length > 0) {
  672. $(arr).removeClass("trhover");
  673. $(prev).addClass("trhover");
  674. var height = $(arr).css("height");
  675. $("#" + contentId).parent().animate({scrollTop: "-=" + height}, 100);
  676. }
  677. } else {
  678. var arrs = $("#" + tableId).find("tbody").find("tr");
  679. $(arrs[0]).addClass("trhover");
  680. var height = $(arrs[0]).css("height");
  681. $("#" + contentId).parent().animate({scrollTop: "+=" + height}, 100);
  682. }
  683. }
  684. } else if (event.keyCode == 39) {
  685. // //右键事件
  686. // if(index==4){
  687. // return;
  688. // }
  689. // var nextObject=$("#bill_item_group").find("button")[index+1];
  690. // $(nextObject).click();
  691. } else if (event.keyCode == 40) {
  692. //下键事件
  693. var tableId = null;
  694. var inputId = null;
  695. var contentId = null;
  696. if (index == 0) {
  697. tableId = "tb_table_western_medicine";
  698. inputId = "western_medicine_name";
  699. contentId = "westernMedicinePopoverContent";
  700. } else if (index == 1) {
  701. tableId = "tb_table_chinese_medicine";
  702. inputId = "chinese_medicine_name";
  703. contentId = "chineseMedicinePopoverContent";
  704. } else if (index == 2) {
  705. tableId = "tb_table_jc_jy_item";
  706. inputId = "jcJyItem";
  707. contentId = "jcJyItemPopoverContent";
  708. } else if (index == 3) {
  709. tableId = "tb_table_zl_item";
  710. inputId = "zlItem";
  711. contentId = "zlItemPopoverContent";
  712. }
  713. if (inputId == null) {
  714. return;
  715. }
  716. var webuiID = $("#" + inputId).attr("data-target");
  717. if (webuiID == null || webuiID == "null" || webuiID == "") {
  718. return;
  719. }
  720. //选择框打开
  721. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  722. var arr = $("#" + tableId).find("tbody").find("tr.trhover");
  723. var next = $(arr).next();
  724. if (arr != undefined && arr != null && arr.length > 0) {
  725. if (next != undefined && next != null && next.length > 0) {
  726. $(arr).removeClass("trhover");
  727. $(next).addClass("trhover");
  728. var height = $(arr).css("height");
  729. $("#" + contentId).parent().animate({scrollTop: "+=" + height}, 100);
  730. }
  731. } else {
  732. var arrs = $("#" + tableId).find("tbody").find("tr");
  733. $(arrs[0]).addClass("trhover");
  734. var height = $(arrs[0]).css("height");
  735. $("#" + contentId).parent().animate({scrollTop: "+=" + height}, 100);
  736. }
  737. }
  738. }
  739. });
  740. //打印检查检验报告单
  741. $('#btn_print').click(function () {
  742. printJyJcReport(1);
  743. });
  744. //打印设置检查检验报告单
  745. $('#btn_print_setup').click(function () {
  746. printJyJcReport(2);
  747. });
  748. /**
  749. * 医保电子凭证读卡
  750. */
  751. $("#siReadCard").on("click", function (t) {
  752. siReadCard();
  753. });
  754. /**
  755. * 门诊统筹支付医保电子凭证读卡
  756. */
  757. $("#mztczfSiReadCard").on("click", function (t) {
  758. mztczfSiReadCard(true);
  759. });
  760. /**
  761. * 快速接诊页面 -未挂号患者信息查询处编辑患者信息
  762. */
  763. $("#rapidAcceptsEditUser").on("click", function (t) {
  764. editUserModal($("#rapidAcceptsUserCode").val());
  765. });
  766. });
  767. /**
  768. * 打开配置页面
  769. */
  770. function configWorkspaceModal() {
  771. initWorkspaceConfigForCurrent();
  772. $("#configWorkspaceModal").modal("show");
  773. }
  774. /**
  775. * 初始化用药天数下拉选
  776. */
  777. function initDayNum() {
  778. var html = '';
  779. for (var i = 1; i <= 112; i++) {
  780. html += '<option value="' + i + '">' + i + '</option>';
  781. }
  782. $('#dayNum').html(html);
  783. $('#dayNum').selectpicker('refresh');
  784. }
  785. /**
  786. * 处方回调
  787. */
  788. function resetGroupIdSelect() {
  789. var groupIds = $("#groupId option");
  790. var usedGroupIdInputs = $("#xyTabContent").find("input.temporary_items_groupId");
  791. if (usedGroupIdInputs != null && usedGroupIdInputs.length > 0) {
  792. let lastGroupId = 0;
  793. for (var i = 0; i < usedGroupIdInputs.length; i++) {
  794. var groupId = Number($(usedGroupIdInputs[i]).val());
  795. if (groupId > lastGroupId) {
  796. lastGroupId = groupId;
  797. }
  798. }
  799. if (groupIds != null && groupIds.length > 1) {
  800. for (var i = 0; i < groupIds.length; i++) {
  801. var groupId = $(groupIds[i]).val();
  802. if (groupId <= lastGroupId) {
  803. continue;
  804. }
  805. $(groupIds[i]).remove();
  806. //删除给药方式与其他属性的缓存
  807. groupIdMap.remove(groupId);
  808. }
  809. appendGroupOrder();
  810. }
  811. } else if (groupIds != null && groupIds.length > 1) {
  812. initGroupOrder();
  813. }
  814. }
  815. /**
  816. * 初始化药品分组下拉选
  817. */
  818. function initGroupOrder() {
  819. var html = '<option value="1">1</option>';
  820. $('#groupId').html(html);
  821. $('#groupId').selectpicker('refresh');
  822. $("#groupId").selectpicker('val', 1);
  823. $('#groupId').selectpicker('refresh');
  824. groupIdMap = new Map();
  825. }
  826. /**
  827. * 追加分组
  828. */
  829. function appendGroupOrder() {
  830. var last = parseInt($("#groupId > option:last").val());
  831. last++;
  832. var html = '<option value="' + last + '">' + last + '</option>';
  833. $('#groupId').append(html);
  834. $('#groupId').selectpicker('refresh');
  835. }
  836. /**
  837. * 组号改变事件
  838. */
  839. function groupIdChange() {
  840. var last = parseInt($("#groupId > option:last").val());
  841. var groupId = $("#groupId").val();
  842. if (groupId == last) {
  843. //是新增药品清空药品输入区域
  844. var updateFlag = $("#western_medicine_update_flag").val();
  845. var currentCode = $("#western_medicine_current_code").val();
  846. //当前时新增药品,而且没有选择药品的时候,组号变更,清空区域
  847. if ((updateFlag == undefined || updateFlag == null || updateFlag == "false" || updateFlag == false) && (currentCode == null || currentCode == "")) {
  848. clearWesternMedicine(true);
  849. }
  850. } else {
  851. var map = groupIdMap.get(groupId);
  852. if (map != null) {
  853. var supplyType = map.get("supplyType");
  854. var orderFrequency = map.get("orderFrequency");
  855. var dayNum = map.get("dayNum");
  856. //用法编码
  857. $("#supplyType").selectpicker('val', supplyType);
  858. $('#supplyType').selectpicker('refresh');
  859. //$("#supplyType").attr("disabled", "disabled");
  860. //天数
  861. $("#dayNum").selectpicker('val', dayNum);
  862. $('#dayNum').selectpicker('refresh');
  863. // $("#dayNum").attr("disabled", "disabled");
  864. //频次编码
  865. $("#orderFrequency").selectpicker('val', orderFrequency);
  866. $('#orderFrequency').selectpicker('refresh');
  867. // $("#orderFrequency").attr("disabled", "disabled");
  868. }
  869. }
  870. }
  871. /**
  872. * 关闭智能问诊弹框
  873. */
  874. function closePopover() {
  875. //$(".popover").popover('hide');
  876. $("#box-arrow-left").click();
  877. }
  878. /**
  879. * 加载智能问诊弹框内容
  880. */
  881. function contentMethod() {
  882. setTimeout(function () {
  883. $(".popover div.arrow").css("display", "none");
  884. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  885. if (popoverId == undefined) {
  886. return;
  887. }
  888. var left = $("#" + popoverId).css("left");
  889. left = left.replace("px", "");
  890. left = parseInt(left);
  891. left = left + 55;
  892. $("#" + popoverId).css("height", "100%").css("top", "0px").css("left", left + "px").css("border-radius", "0px").css("z-index", "11");
  893. $("#" + popoverId + " .popover-content").css("height", "100%");
  894. $("#smartAssistPopoverContent").css("height", "100%");
  895. var html = ' <div style="height: 24%;padding-left: 15px;width: 100%;">' +
  896. ' <button type="button" style="cursor: default;margin-bottom: 0px;margin-right: 0px; font-size: 12px;"' +
  897. ' class="btn btn-primary">' +
  898. ' <span id="patientHisData"></span>就医轨迹' +
  899. ' </button>' +
  900. ' <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true" onclick="closePopover()">×</span>' +
  901. ' </button>' +
  902. ' <div style="height: calc(100% - 39px);border: 1px solid #DDDDDD;margin-top: 5px;width: 100%;">' +
  903. ' <form class="form-horizontal form-label-left mz-fixed-form" novalidate autocomplete="off"' +
  904. ' style="height: 100%;overflow-y: auto;width: 100%;text-align: -webkit-center;position: relative;" id="patientHisDataForm">' +
  905. ' </form>' +
  906. ' </div>' +
  907. ' </div>' +
  908. ' <div style="height: 23%;padding-left: 15px;width: 100%;">' +
  909. ' <button type="button" style="cursor: default;margin-bottom: 0px;margin-right: 0px;margin-top: 5px;"' +
  910. ' class="btn btn-primary">' +
  911. ' <span id="recommendType"></span>推荐' +
  912. ' </button>' +
  913. ' <div style="height: calc(100% - 44px);border: 1px solid #DDDDDD;overflow-y: auto;margin-top: 5px;width: 100%;">' +
  914. ' <form class="form-horizontal form-label-left mz-fixed-form" novalidate autocomplete="off"' +
  915. ' style="height: 100%;overflow-y: auto;width: 100%;text-align: -webkit-center;position: relative;" id="recommendForm">' +
  916. ' <img src="/thmz/images/no-recommend.png" style="height: 120px;position: absolute;top: 50%;transform: translateY(-50%);margin-left: -30px;">' +
  917. ' </form>' +
  918. ' </div>' +
  919. ' </div>' +
  920. ' <div style="height: 53%;padding-left: 15px;width: 100%;">' +
  921. ' <button type="button"' +
  922. ' style="cursor: default;margin-bottom: 0px;margin-right: 0px;margin-top: 5px; font-size: 12px;"' +
  923. ' class="btn btn-primary">' +
  924. ' 医疗范本' +
  925. ' </button>' +
  926. ' <div class="item" style="width: 230px;height: 35px;float: right;line-height: 35px;margin-right: 40px;">' +
  927. ' <div class="col-md-6 col-sm-6 col-xs-12">' +
  928. ' <select class="form-control selectpicker show-tick" title="范文范围" onchange="fitTemplateData()"' +
  929. ' id="templateTypeForm">' +
  930. ' </select>' +
  931. ' </div>' +
  932. ' <div class="col-md-6 col-sm-6 col-xs-12">' +
  933. ' <select class="form-control selectpicker show-tick" title="范文类型" onchange="fitTemplateData()"' +
  934. ' id="templateKindTypeForm">' +
  935. ' </select>' +
  936. ' </div>' +
  937. ' </div>' +
  938. ' <div style="height: calc(100% - 44px);border: 1px solid #DDDDDD;overflow-y: auto;margin-top: 5px;width: 100%;position: relative;">' +
  939. ' <form class="form-horizontal form-label-left mz-fixed-form" novalidate autocomplete="off"' +
  940. ' style="height: 100%;overflow-y: auto;width: 100%;" id="TemplateData">' +
  941. ' </form>' +
  942. ' </div>' +
  943. ' </div>';
  944. $("#smartAssistPopoverContent").html(html);
  945. initTemplateTypeSelect("templateTypeForm");
  946. initTemplateKindTypeSelect('templateKindTypeForm');
  947. fitPatientHisData();
  948. fitSymptomData();
  949. fitEmrHpiData();
  950. fitEmrPsData();
  951. fitDiagnoseData();
  952. fitTemplateData();
  953. }, 100);
  954. // setTimeout(function () {
  955. // $("#patientHisDataForm").html("aadsasfasdfasdfasdfasdfsdfasdfasdfasdfdfafda");
  956. // },1000);
  957. }
  958. /**
  959. * 设置患者的就诊轨迹
  960. */
  961. function fitPatientHisData() {
  962. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  963. if (!$("#" + popoverId).hasClass("in")) {
  964. return;
  965. }
  966. var emptyHtml = '<img src="/thmz/images/locus.png" style="height: 120px;position: absolute;top: 50%;transform: translateY(-50%);margin-left: -30px;">';
  967. if (($("#patientId").text() == null || $("#patientId").text() == "") && ($("#userName").val() == null || $("#userName").val() == "")) {
  968. $("#patientHisDataForm").html(emptyHtml);
  969. return;
  970. }
  971. var patientId = $("#patientId").text();
  972. if (patientId == null || patientId == "") {
  973. patientId = $("#userName").val();
  974. }
  975. $.ajax({
  976. type: "POST",
  977. url: '/thmz/getClinicWithPage',
  978. contentType: "application/json;charset=UTF-8",
  979. dataType: "json",
  980. data: JSON.stringify({
  981. "commonParams": patientId,
  982. //"clinicStatuses": [5, 6],
  983. "clinicStatuses": [6],
  984. "pageSize": 10000,
  985. "offset": 0,
  986. "beginDate": "2012-02-01 00:00:00",
  987. "endDate": format(new Date(), "yyyy-MM-dd HH:mm:ss"),
  988. "doctorCode": "-1"
  989. }),
  990. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  991. success: function (res) {
  992. if (res == '401' || res == 401) {
  993. window.location.href = '/thmz/login/view'
  994. return;
  995. }
  996. if (res.code == 0) {
  997. var html = '';
  998. var data = res.data;
  999. if (data == null || data.length == 0) {
  1000. html += emptyHtml;
  1001. } else {
  1002. for (var i = 0; i < data.length; i++) {
  1003. var icdText = data[i].icdText;
  1004. if (icdText == null) {
  1005. // continue;
  1006. icdText = "空白诊断";
  1007. }
  1008. icdText = icdText.trim();
  1009. html += ' <div class="item form-group thmz_alert" style="width: 100%;">';
  1010. html += ' <div style="float: left;width: 172px;">';
  1011. html += ' <img src="/thmz/css/bootstrap/bootstrap-icons-1.5.0/stopwatch.svg"';
  1012. html += ' style="margin-left: 10px!important;vertical-align: -.15em;margin-right: 10px!important;"/>';
  1013. html += ' <span style="width: 120px;margin-right: 20px!important;">' + format(data[i].opDay, "yyyy-MM-dd HH:mm") + '</span>';
  1014. html += ' </div>';
  1015. html += ' <div style="text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 172px);"';
  1016. html += ' title="' + icdText + '">诊断:<a style="cursor: pointer; color: #2e69eb;"';
  1017. html += ' onclick="visitingDetailModal(\'' + data[i].patientId + '\',' + data[i].times + ',' + data[i].id + ',' + data[i].clinicStatus + ')">' + icdText + '</a>';
  1018. html += ' </div>';
  1019. html += ' </div>';
  1020. }
  1021. }
  1022. var patientName = $("#patientName").text();
  1023. if (patientName == null || patientName == "") {
  1024. if (res.mzPatientMi != null) {
  1025. patientName = res.mzPatientMi.name;
  1026. } else {
  1027. patientName = patientId;
  1028. }
  1029. }
  1030. $("#patientHisData").text(patientName + "的");
  1031. if (($("#patientId").text() == null || $("#patientId").text() == "") && ($("#userName").val() == null || $("#userName").val() == "")) {
  1032. $("#patientHisDataForm").html(emptyHtml);
  1033. } else {
  1034. $("#patientHisDataForm").html(html);
  1035. }
  1036. } else {
  1037. errorMesage(res);
  1038. }
  1039. }
  1040. });
  1041. }
  1042. /**
  1043. * 设置主诉推荐
  1044. */
  1045. function fitSymptomData() {
  1046. fitRecommendData(12);
  1047. }
  1048. /**
  1049. * 设置现病史推荐
  1050. */
  1051. function fitEmrHpiData() {
  1052. fitRecommendData(5);
  1053. }
  1054. /**
  1055. * 设置既往史推荐
  1056. */
  1057. function fitEmrPsData() {
  1058. fitRecommendData(6);
  1059. }
  1060. /**
  1061. * 设置诊断推荐
  1062. */
  1063. function fitDiagnoseData() {
  1064. fitRecommendData(13);
  1065. }
  1066. /**
  1067. * 设置推荐通用方法
  1068. */
  1069. function fitRecommendData(paramsType) {
  1070. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  1071. if (!$("#" + popoverId).hasClass("in")) {
  1072. return;
  1073. }
  1074. var inputId = "symptom";
  1075. var text = "主诉";
  1076. if (paramsType == 5) {
  1077. inputId = "emrHpi";
  1078. text = "现病史";
  1079. } else if (paramsType == 6) {
  1080. inputId = "emrPs";
  1081. text = "既往史";
  1082. } else if (paramsType == 13) {
  1083. inputId = "diagnose";
  1084. text = "诊断";
  1085. }
  1086. //光标不在现病史上
  1087. if (document.activeElement.id != inputId) {
  1088. return;
  1089. }
  1090. $("#recommendType").html(text);
  1091. var emptyHtml = '<img src="/thmz/images/no-recommend.png" style="height: 120px;position: absolute;top: 50%;transform: translateY(-50%);margin-left: -30px;">';
  1092. $.ajax({
  1093. type: "GET",
  1094. url: '/thmz/getTCommonParamsByParamsType?paramsType=' + paramsType + '&commonParams=&pageSize=10',
  1095. contentType: "application/json;charset=UTF-8",
  1096. dataType: "json",
  1097. async: false,
  1098. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1099. success: function (res) {
  1100. if (res == '401' || res == 401) {
  1101. window.location.href = '/thmz/login/view'
  1102. return;
  1103. }
  1104. if (res.code == 0) {
  1105. var html = '';
  1106. var data = res.data;
  1107. if (data == null || data.length == 0) {
  1108. html += emptyHtml;
  1109. } else {
  1110. for (var i = 0; i < data.length; i++) {
  1111. var paramsContent = data[i].paramsContent;
  1112. html += ' <div class="item form-group thmz_alert" style="width: 100%;">';
  1113. html += ' <div style="margin-left: 10px;float: left;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 60px);" title="' + paramsContent + '">';
  1114. html += paramsContent;
  1115. html += ' </div>';
  1116. html += ' <div style="float: left;width: 36px;cursor: pointer;"';
  1117. html += ' onclick="fitAppeal(\'' + paramsContent + '\',' + paramsType + ',' + data[i].id + ')">';
  1118. html += ' <img';
  1119. html += ' src="/thmz/css/bootstrap/bootstrap-icons-1.5.0/cursor-fill.svg"';
  1120. html += ' style="margin-left: 10px!important;vertical-align: -.15em;margin-right: 10px!important;"/>';
  1121. html += ' </div>';
  1122. html += ' </div>';
  1123. }
  1124. }
  1125. $("#recommendForm").html(html);
  1126. } else {
  1127. errorMesage(res);
  1128. }
  1129. }
  1130. });
  1131. }
  1132. /**
  1133. * 设置医疗范文方法
  1134. */
  1135. function fitTemplateData() {
  1136. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  1137. if (!$("#" + popoverId).hasClass("in")) {
  1138. return;
  1139. }
  1140. 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;">';
  1141. $.ajax({
  1142. type: "GET",
  1143. url: '/thmz/getTemplate?templateKindType=' + $("#templateKindTypeForm").val() + '&templateType=' + $("#templateTypeForm").val(),
  1144. contentType: "application/json;charset=UTF-8",
  1145. dataType: "json",
  1146. async: false,
  1147. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1148. success: function (res) {
  1149. if (res == '401' || res == 401) {
  1150. window.location.href = '/thmz/login/view'
  1151. return;
  1152. }
  1153. if (res.code == 0) {
  1154. var html = '';
  1155. var data = res.data;
  1156. if (data == null || data.length == 0) {
  1157. html += emptyHtml;
  1158. } else {
  1159. for (var i = 0; i < data.length; i++) {
  1160. var template = data[i];
  1161. var icdText = (template.icdText == null || template.icdText == "") ? "无" : template.icdText;
  1162. html += ' <div class="item form-group thmz_alert" style="width: 100%;">';
  1163. html += ' <div title="' + template.name + '"';
  1164. html += ' style="margin-left: 10px!important;float: left;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: 100px;">';
  1165. html += template.name;
  1166. html += ' </div>';
  1167. html += ' <div style="float: left;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 160px);"';
  1168. html += ' title="' + template.icdText + '">诊断:<a';
  1169. html += ' style="cursor: pointer; color: #2e69eb;"';
  1170. html += ' onclick="medicalModelModal(' + template.id + ')">' + icdText + '</a>';
  1171. html += ' </div>';
  1172. html += ' <div style="float: left;width: 36px;cursor: pointer;" onclick="medicalModelModal(' + template.id + ')"><img';
  1173. html += ' src="/thmz/css/bootstrap/bootstrap-icons-1.5.0/cursor-fill.svg"';
  1174. html += ' style="margin-left: 10px!important;vertical-align: -.15em;margin-right: 10px!important;"/>';
  1175. html += ' </div>';
  1176. html += ' </div>';
  1177. }
  1178. }
  1179. $("#TemplateData").html(html);
  1180. } else {
  1181. errorMesage(res);
  1182. }
  1183. }
  1184. });
  1185. }
  1186. /**
  1187. * 清空快速接诊弹窗
  1188. */
  1189. function clearRapidAcceptsModal() {
  1190. $("#rapidAcceptsUserName").val(null);
  1191. $("#rapidAcceptsUserCode").val(null);
  1192. $("#patientIdDb").val(null);
  1193. $("#rapidAcceptsUserCardNo").val(null);
  1194. $("#rapidAcceptsUserGender").selectpicker('val', 0);
  1195. $("#rapidAcceptsUserGender").selectpicker('refresh');
  1196. $("#rapidAcceptsUserPhoneNum").val(null);
  1197. $('#rapidAcceptsUserCertificateType').selectpicker('val', '01');
  1198. $('#rapidAcceptsUserCertificateType').selectpicker('refresh');
  1199. $("#rapidAcceptsUserIdCard").val(null);
  1200. $("#rapidAcceptsUserIdCard").attr("title", null);
  1201. $("#rapidAcceptsUserPhoneNum").attr("title", null);
  1202. $("#rapidAcceptsUserAddress").attr("title", null);
  1203. $("#rapidAcceptsUserAddress").val(null);
  1204. $("#rapidAcceptsUserContact").val(null);
  1205. $("#rapidAcceptsUserContactPhone").val(null);
  1206. }
  1207. /**
  1208. * 清空接诊台用户信息
  1209. * @param flag 是否清空分诊流水哈 true 清空
  1210. */
  1211. function clearUser(flag) {
  1212. $("#patientName").html("");
  1213. $("#patientAge").html("");
  1214. $("#patientGender").html("");
  1215. $("#patientId").text(null);
  1216. $("#editUser").css("display", "none");
  1217. $("#clearUser").css("display", "none");
  1218. $("#fetchSpcSlwinfo").css("display", "none");
  1219. $("#patientPhone").html("");
  1220. $("#patientPhoneLabel").hide();
  1221. $("#patientResponseType").html("");
  1222. $("#first").next().click();
  1223. $("#patientHisData").text("");
  1224. if (flag) {
  1225. $("#transferTreatment").css("display", "none");
  1226. $("#consultation").css("display", "none");
  1227. $("#mzfzSerialNoInClick").val(null);
  1228. $("#mzfzReqTypeNoInClick").val(null);
  1229. $("#turnToConsultationIdInClick").val(null);
  1230. }
  1231. }
  1232. /**
  1233. * 卡号输入改变事件
  1234. */
  1235. function cardNoChange() {
  1236. if (window.ActiveXObject || "ActiveXObject" in window) {
  1237. $("#rapidAcceptsUserCardNo").on('input propertychange', function () {
  1238. queryUserInfoByCardNo();
  1239. });
  1240. } else {
  1241. $("#rapidAcceptsUserCardNo").on('input οninput', function () {
  1242. queryUserInfoByCardNo();
  1243. });
  1244. }
  1245. }
  1246. /**
  1247. * 刷新就诊列表
  1248. */
  1249. function refreshClinic() {
  1250. loadInClinicTableList();
  1251. loadClinicTableList();
  1252. fitPatientHisData();
  1253. }
  1254. /**
  1255. * 加载已接诊患者列表
  1256. */
  1257. function loadClinicTableList() {
  1258. //loadCommonClinicTableList("tb_table_clinic","/thmz/getClinicWithPage");
  1259. loadCommonClinicTableList("tb_table_clinic", queryParamsClinic);
  1260. }
  1261. /**
  1262. * 加载患者列表通用方法
  1263. * @param id
  1264. * @param queryParams
  1265. */
  1266. function loadCommonClinicTableList(id, queryParams) {
  1267. $('#' + id).bootstrapTable('refresh');
  1268. $('#' + id).bootstrapTable({
  1269. url: "/thmz/getClinicWithPage", //请求后台的URL(*)
  1270. method: 'post', //请求方式(*)
  1271. toolbar: '#toolbar', //工具按钮用哪个容器
  1272. striped: true, //是否显示行间隔色
  1273. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  1274. pagination: true, //是否显示分页(*)
  1275. sortable: true, //是否启用排序
  1276. sortOrder: "asc", //排序方式
  1277. queryParams: queryParams, //传递参数(*)
  1278. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  1279. pageNumber: 1, //初始化加载第一页,默认第一页
  1280. pageSize: 5, //每页的记录行数(*)
  1281. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  1282. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  1283. strictSearch: true,
  1284. showColumns: false, //是否显示所有的列
  1285. showRefresh: false, //是否显示刷新按钮
  1286. minimumCountColumns: 2, //最少允许的列数
  1287. clickToSelect: true, //是否启用点击选中行
  1288. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  1289. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  1290. cardView: false, //是否显示详细视图
  1291. detailView: false,
  1292. //rowStyle:rowStyle,//通过自定义函数设置行样式
  1293. ajaxOptions: {
  1294. headers: {
  1295. 'Accept': 'application/json',
  1296. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  1297. }
  1298. },
  1299. columns: [
  1300. {
  1301. field: 'patientName',
  1302. title: '姓名/性别/年龄',
  1303. align: "center",
  1304. valign: 'middle',
  1305. // sortable: true
  1306. formatter: function (value, row, index) {
  1307. var age = row.age;
  1308. if (age == null || age == "null") {
  1309. age = "";
  1310. }
  1311. return value + "/" + row.gender + "/" + age;
  1312. }
  1313. }, {
  1314. field: 'opDay',
  1315. title: '接诊时间',
  1316. align: "center",
  1317. valign: 'middle',
  1318. // sortable: true
  1319. formatter: function (value, row, index) {
  1320. return format(value, "MM/dd HH:mm");
  1321. }
  1322. }
  1323. , {
  1324. title: '操作',
  1325. align: "center",
  1326. valign: 'middle',
  1327. // sortable: true,
  1328. formatter: function (value, row, index) {
  1329. if (row.clinicStatus == 5) {
  1330. 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>';
  1331. // 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>';
  1332. } else if (row.clinicStatus == 6) {
  1333. 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>';
  1334. } else if (row.clinicStatus == 7) {
  1335. 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>';
  1336. }
  1337. }
  1338. }
  1339. ],
  1340. responseHandler: function (res) {
  1341. if (res == '401' || res == 401) {
  1342. window.location.href = '/thmz/login/view'
  1343. return;
  1344. }
  1345. var ress = eval(res);
  1346. if (ress.code == -1) {
  1347. new PNotify({
  1348. title: '错误提示',
  1349. text: ress.message,
  1350. type: 'error',
  1351. hide: false,
  1352. styling: 'bootstrap3'
  1353. });
  1354. return {
  1355. "total": 0,//总页数
  1356. "rows": {} //数据
  1357. };
  1358. }
  1359. return {
  1360. "total": ress.total,//总页数
  1361. "rows": ress.data //数据
  1362. };
  1363. },
  1364. onLoadSuccess: function (data) {
  1365. $(".pagination-detail").css("display", "none");
  1366. if (id == "tb_table_clinic") {
  1367. $("#ClinicNum").html(data.total);
  1368. } else {
  1369. $("#inClinicNum").html(data.total);
  1370. }
  1371. }
  1372. });
  1373. }
  1374. /**
  1375. * 得到查询的参数 接诊中
  1376. * @param params
  1377. * @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}}
  1378. */
  1379. function queryParamsInClinic(params) {
  1380. var temp = {
  1381. pageSize: params.limit,
  1382. pageIndex: params.offset / params.limit, //页码
  1383. statusFlagList: [8]
  1384. };
  1385. return temp;
  1386. };
  1387. /**
  1388. * 得到查询的参数
  1389. * @param params
  1390. * @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}}
  1391. */
  1392. function queryParamsClinic(params) {
  1393. var rePortRangeArr = getRePortRangeArr();
  1394. var commonParams = $("#userName").val();
  1395. var needDateParams = commonParams == null || commonParams == "null" || commonParams == "";
  1396. var temp = {
  1397. beginDate: needDateParams ? rePortRangeArr[0] : "2012-02-01 00:00:00",
  1398. endDate: needDateParams ? rePortRangeArr[1] : format(new Date(), "yyyy-MM-dd HH:mm:ss"),
  1399. commonParams: commonParams,
  1400. clinicStatuses: [5, 6, 7],
  1401. pageSize: params.limit,
  1402. offset: params.offset
  1403. };
  1404. return temp;
  1405. };
  1406. /**
  1407. * 加载待诊患者列表方法
  1408. */
  1409. function loadUnClinicTableList() {
  1410. loadCanClinicTableList("tb_table_un_clinic", queryParamsUnClinic);
  1411. }
  1412. /**
  1413. * 加载接诊中患者列表方法
  1414. */
  1415. function loadInClinicTableList() {
  1416. loadCanClinicTableList("tb_table_in_clinic", queryParamsInClinic);
  1417. }
  1418. /**
  1419. * 加载待诊和接诊中患者列表通用方法方法
  1420. */
  1421. function loadCanClinicTableList(id, queryParams) {
  1422. $('#' + id).bootstrapTable('refresh');
  1423. $('#' + id).bootstrapTable({
  1424. url: "/thmz/getUnClinicWithPage", //请求后台的URL(*)
  1425. method: 'post', //请求方式(*)
  1426. toolbar: '#toolbar', //工具按钮用哪个容器
  1427. striped: true, //是否显示行间隔色
  1428. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  1429. pagination: true, //是否显示分页(*)
  1430. sortable: true, //是否启用排序
  1431. sortOrder: "asc", //排序方式
  1432. queryParams: queryParams, //传递参数(*)
  1433. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  1434. pageNumber: 1, //初始化加载第一页,默认第一页
  1435. pageSize: 2, //每页的记录行数(*)
  1436. pageList: [2, 5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  1437. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  1438. strictSearch: true,
  1439. showColumns: false, //是否显示所有的列
  1440. showRefresh: false, //是否显示刷新按钮
  1441. minimumCountColumns: 2, //最少允许的列数
  1442. clickToSelect: true, //是否启用点击选中行
  1443. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  1444. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  1445. cardView: false, //是否显示详细视图
  1446. detailView: false,
  1447. //rowStyle:rowStyle,//通过自定义函数设置行样式
  1448. ajaxOptions: {
  1449. headers: {
  1450. 'Accept': 'application/json',
  1451. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  1452. }
  1453. },
  1454. columns: [
  1455. {
  1456. field: 'name',
  1457. title: '姓名/性别/年龄',
  1458. align: "center",
  1459. valign: 'middle',
  1460. // sortable: true
  1461. formatter: function (value, row, index) {
  1462. return value + "/" + row.gender + "/" + row.age;
  1463. }
  1464. }, {
  1465. field: 'visitDate',
  1466. title: '分诊时间',
  1467. align: "center",
  1468. valign: 'middle',
  1469. // sortable: true
  1470. formatter: function (value, row, index) {
  1471. return format(value, "MM/dd HH:mm");
  1472. }
  1473. }
  1474. , {
  1475. title: '操作',
  1476. align: "center",
  1477. valign: 'middle',
  1478. // sortable: true,
  1479. formatter: function (value, row, index) {
  1480. if (row.statusFlag == 0) {
  1481. return '<a title="接诊" onclick="clinicalReception(\'' + row.patientId + '\',\'' + row.serialNo + '\',' + row.reqType + ')" style="cursor: pointer">接诊</a>';
  1482. } else if (row.statusFlag == 8) {
  1483. //TODO 继续接诊需要新方法
  1484. 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>';
  1485. } else if (row.statusFlag == 1 || row.statusFlag == 2 || row.statusFlag == 3) {
  1486. 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>';
  1487. }
  1488. }
  1489. }
  1490. ],
  1491. responseHandler: function (res) {
  1492. if (res == '401' || res == 401) {
  1493. window.location.href = '/thmz/login/view'
  1494. return;
  1495. }
  1496. var ress = eval(res);
  1497. if (ress.code == -1) {
  1498. new PNotify({
  1499. title: '错误提示',
  1500. text: ress.message,
  1501. type: 'error',
  1502. hide: false,
  1503. styling: 'bootstrap3'
  1504. });
  1505. return {
  1506. "total": 0,//总页数
  1507. "rows": {} //数据
  1508. };
  1509. }
  1510. return {
  1511. "total": ress.total,//总页数
  1512. "rows": ress.data //数据
  1513. };
  1514. },
  1515. onLoadSuccess: function (data) {
  1516. $(".pagination-detail").css("display", "none");
  1517. $("#unClinicNum").html(data.total);
  1518. }
  1519. });
  1520. }
  1521. /**
  1522. * 得到查询的参数
  1523. * @param params
  1524. * @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}}
  1525. */
  1526. function queryParamsUnClinic(params) {
  1527. var temp = {
  1528. pageSize: params.limit,
  1529. pageIndex: params.offset / params.limit, //页码
  1530. statusFlagList: [0, 1, 2, 3]
  1531. };
  1532. return temp;
  1533. };
  1534. /**
  1535. * 通知叫号
  1536. * @param serialNo
  1537. */
  1538. function clinicCallNumber(serialNo) {
  1539. $.ajax({
  1540. type: "GET",
  1541. url: '/thmz/clinicCallNumber?serialNo=' + serialNo,
  1542. contentType: "application/json;charset=UTF-8",
  1543. dataType: "json",
  1544. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1545. success: function (res) {
  1546. if (res == '401' || res == 401) {
  1547. window.location.href = '/thmz/login/view'
  1548. return;
  1549. }
  1550. if (res.code == 0) {
  1551. successMesage(res);
  1552. } else {
  1553. errorMesage(res);
  1554. }
  1555. }
  1556. });
  1557. }
  1558. /**
  1559. * 接诊方法
  1560. * @param patientId 门诊id
  1561. * @param serialNo 分诊流水号
  1562. * @param reqType 号表类别
  1563. */
  1564. function clinicalReception(patientId, serialNo, reqType) {
  1565. var existPatientId = $("#patientId").text();
  1566. if (existPatientId != null && existPatientId != "" && existPatientId != patientId) {
  1567. $("#messageModal").modal();
  1568. $("#messageContent").html("当前有病人正在接诊,是否切换?");
  1569. $("#messageButton").off("click").on("click", function (t) {
  1570. $("#messageModal").modal("hide");
  1571. //当前有人在接诊,提示是否需要切换和保存
  1572. $("#messagePrescriptionModal").modal();
  1573. $("#confirmPrescriptionButton").off("click").on("click", function (t) {
  1574. $("#messagePrescriptionModal").modal("hide");
  1575. //先保存目前接诊信息,再切换就诊人
  1576. var jsonData = getParamsForpPrescription(1);
  1577. $.ajax({
  1578. type: "POST",
  1579. url: '/thmz/savePrescription',
  1580. contentType: "application/json;charset=UTF-8",
  1581. dataType: "json",
  1582. data: JSON.stringify(jsonData),
  1583. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1584. success: function (res) {
  1585. if (res == '401' || res == 401) {
  1586. window.location.href = '/thmz/login/view'
  1587. return;
  1588. }
  1589. if (res.code == 0) {
  1590. clearWorkSpace();
  1591. realClinicalReception(patientId, serialNo, reqType);
  1592. //加载已接诊患者列表
  1593. loadClinicTableList();
  1594. } else {
  1595. errorMesage(res);
  1596. }
  1597. }
  1598. });
  1599. });
  1600. $("#cancelPrescriptionButton").off("click").on("click", function (t) {
  1601. $("#messagePrescriptionModal").modal("hide");
  1602. clearWorkSpace();
  1603. realClinicalReception(patientId, serialNo, reqType);
  1604. });
  1605. });
  1606. $("#cancelButton").off("click");
  1607. } else {
  1608. realClinicalReception(patientId, serialNo, reqType);
  1609. }
  1610. }
  1611. /**
  1612. * 取消接诊
  1613. * @param patientId
  1614. */
  1615. function cancelClinic(patientId, times) {
  1616. $("#messageModal").modal();
  1617. $("#messageContent").html("确认取消当前病人的接诊记录吗?");
  1618. $("#messageButton").off("click").on("click", function (t) {
  1619. $("#messageModal").modal("hide");
  1620. $.ajax({
  1621. type: "GET",
  1622. url: '/thmz/cancelClinic?patientId=' + patientId + "&times=" + times,
  1623. contentType: "application/json;charset=UTF-8",
  1624. dataType: "json",
  1625. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1626. success: function (res) {
  1627. if (res == '401' || res == 401) {
  1628. window.location.href = '/thmz/login/view'
  1629. return;
  1630. }
  1631. if (res.code == 0) {
  1632. if (res.data == null || res.data.length == 0) {
  1633. return;
  1634. }
  1635. successMesage(res);
  1636. if (times > 0) {
  1637. loadUnClinicTableList();
  1638. loadInClinicTableList();
  1639. clearWorkSpace();
  1640. }
  1641. } else if (res.code == -1) {
  1642. errorMesage(res);
  1643. }
  1644. }
  1645. });
  1646. });
  1647. $("#cancelButton").off("click");
  1648. };
  1649. /**
  1650. * 设置当前接诊病人信息
  1651. * @param mzPatientMi
  1652. */
  1653. function setMzPatientInfo(mzPatientMi) {
  1654. $("#patientName").html(mzPatientMi.name);
  1655. //var age = getAge(mzPatientMi);
  1656. $("#patientAge").html(mzPatientMi.ageString);
  1657. $("#patientGender").html(mzPatientMi.gender);
  1658. $("#patientId").text(mzPatientMi.patientId);
  1659. $("#editUser").css("display", "inline-block");
  1660. $("#clearUser").css("display", "inline-block");
  1661. if (mzPatientMi.phoneNo != null && mzPatientMi.phoneNo != '') {
  1662. $("#patientPhone").html(mzPatientMi.phoneNo);
  1663. $("#patientPhoneLabel").show();
  1664. } else {
  1665. $("#patientPhoneLabel").hide();
  1666. }
  1667. $("#patientResponseType").html(mzPatientMi.responseTypeName);
  1668. if (mzPatientMi.times == 1) {
  1669. $("#first").next().click();
  1670. } else {
  1671. $("#not").next().click();
  1672. }
  1673. $("#patientHisData").text(mzPatientMi.name);
  1674. fitPatientHisData();
  1675. setTmResponseType(mzPatientMi.patientId);
  1676. }
  1677. /**
  1678. * 判断是否是特门病人
  1679. * @param patientId
  1680. */
  1681. function setTmResponseType(patientId) {
  1682. $.ajax({
  1683. type: "GET",
  1684. url: '/thmz/fetchSpcSlwinfo?patientId=' + patientId,
  1685. contentType: "application/json;charset=UTF-8",
  1686. dataType: "json",
  1687. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1688. success: function (res) {
  1689. if (res == '401' || res == 401) {
  1690. window.location.href = '/thmz/login/view'
  1691. return;
  1692. }
  1693. if (res.code == 0) {
  1694. if (res.data != null && res.data.length > 0) {
  1695. $("#patientResponseType").html("特殊门诊");
  1696. $("#fetchSpcSlwinfo").css("display", "inline-block");
  1697. }
  1698. }
  1699. }
  1700. });
  1701. }
  1702. /**
  1703. * 特门详情
  1704. * @param patientId
  1705. */
  1706. function fetchSpcSlwinfo() {
  1707. var patientId = $("#patientId").text();
  1708. $.ajax({
  1709. type: "GET",
  1710. url: '/thmz/fetchSpcSlwinfo?patientId=' + patientId,
  1711. contentType: "application/json;charset=UTF-8",
  1712. dataType: "json",
  1713. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1714. success: function (res) {
  1715. if (res == '401' || res == 401) {
  1716. window.location.href = '/thmz/login/view'
  1717. return;
  1718. }
  1719. if (res.code == 0) {
  1720. if (res.data != null && res.data.length > 0) {
  1721. $("#fetchSpcSlwinfoModal").modal();
  1722. $("#fetchSpcSlwinfoTable").html(null);
  1723. for (var i = 0; i < res.data.length; i++) {
  1724. var begndate = res.data[i].begndate;
  1725. if (begndate == null || begndate == "null") {
  1726. begndate = "";
  1727. }
  1728. var enddate = res.data[i].enddate;
  1729. if (enddate == null || enddate == "null") {
  1730. enddate = "";
  1731. }
  1732. var opspDiseName = res.data[i].opspDiseName;
  1733. if (opspDiseName == null || opspDiseName == "null") {
  1734. opspDiseName = "";
  1735. }
  1736. var opspDiseCode = res.data[i].opspDiseCode;
  1737. if (opspDiseCode == null || opspDiseCode == "null") {
  1738. opspDiseCode = "";
  1739. }
  1740. var ideFixmedinsName = res.data[i].ideFixmedinsName;
  1741. if (ideFixmedinsName == null || ideFixmedinsName == "null") {
  1742. ideFixmedinsName = "";
  1743. }
  1744. $("<tr><td>" + begndate + "</td><td>" + enddate + "</td><td>" + opspDiseCode + "</td><td>" + opspDiseName + "</td><td>" + ideFixmedinsName + "</td></tr>").appendTo("#fetchSpcSlwinfoTable");
  1745. // .bind('click', function () {
  1746. // $("#fetchSpcSlwinfoModal").modal("hide");
  1747. // clinicalReception(patientIdDb, $(this).attr("data-target"));
  1748. // });
  1749. }
  1750. } else {
  1751. errorMesage(res);
  1752. }
  1753. } else {
  1754. errorMesage(res);
  1755. }
  1756. }
  1757. });
  1758. }
  1759. /**
  1760. * 真实的接诊方法
  1761. * @param patientId
  1762. * @param serialNo 分诊流水号
  1763. * @param reqType 号表类别
  1764. */
  1765. function realClinicalReception(patientId, serialNo, reqType) {
  1766. var turnToConsultationIdInClick = $("#turnToConsultationIdInClick").val();
  1767. if (turnToConsultationIdInClick == null || turnToConsultationIdInClick == "null") {
  1768. turnToConsultationIdInClick = 0;
  1769. }
  1770. $.ajax({
  1771. type: "GET",
  1772. url: '/thmz/saveClinic?patientId=' + patientId + "&serialNo=" + serialNo + "&turnToConsultationId=" + turnToConsultationIdInClick,
  1773. contentType: "application/json;charset=UTF-8",
  1774. dataType: "json",
  1775. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1776. success: function (res) {
  1777. if (res == '401' || res == 401) {
  1778. window.location.href = '/thmz/login/view'
  1779. return;
  1780. }
  1781. if (res.code == 0) {
  1782. if (res.data != null) {
  1783. var mzPatientMi = res.data;
  1784. setMzPatientInfo(mzPatientMi);
  1785. $("#mzfzSerialNoInClick").val(serialNo);
  1786. $("#mzfzReqTypeNoInClick").val(reqType);
  1787. //有分诊流水号 且 不是简易门诊 或 会诊目标科室接诊
  1788. if (serialNo != null && serialNo != "null") {
  1789. if (!(reqType == 10 || reqType == "10" || reqType == "16" || reqType == 16 || reqType == -200)) {
  1790. $("#transferTreatment").css("display", "inline-block");
  1791. }
  1792. $("#consultation").css("display", "inline-block");
  1793. }
  1794. //加载候诊患者列表
  1795. loadUnClinicTableList();
  1796. //加载接诊中患者列表
  1797. loadInClinicTableList();
  1798. //查询患者的门诊统筹信息
  1799. queryInsuinfo(patientId);
  1800. // $.ajax({
  1801. // type: "GET",
  1802. // url: '/thmz/queryInsuinfo?patientId=' + patientId,
  1803. // contentType: "application/json;charset=UTF-8",
  1804. // dataType: "json",
  1805. // headers: {
  1806. // 'Accept': 'application/json',
  1807. // 'Authorization': 'Bearer ' + localStorage.getItem("token")
  1808. // },
  1809. // success: function (res) {
  1810. // if (res == '401' || res == 401) {
  1811. // window.location.href = '/thmz/login/view'
  1812. // return;
  1813. // }
  1814. // if (res.code == 0) {
  1815. // $("#messageModal").modal();
  1816. // $("#messageContent").html("请与患者沟通是否使用职工门诊统筹支付门诊费用!");
  1817. // $("#messageButton").off("click").on("click", function (t) {
  1818. // $("#messageModal").modal("hide");
  1819. // //TODO读卡
  1820. // mztczfSiReadCard();
  1821. // $("#zgmztczf").val(1);
  1822. // if (res.balc != null) {
  1823. // var balc = Number(res.balc);
  1824. // if (balc > 0) {
  1825. // $("#messageModal").modal();
  1826. // $("#messageContent").html("患者个人医保账户(医保卡)有余额,请与患者沟通是否使用个人账户余额支付个人自付部分费用(免刷卡)!");
  1827. // $("#messageButton").off("click").on("click", function (t) {
  1828. // $("#messageModal").modal("hide");
  1829. // $("#grzhzf").val(1);
  1830. // });
  1831. // $("#cancelButton").off("click");
  1832. // }
  1833. // }
  1834. // });
  1835. // $("#cancelButton").off("click");
  1836. // } else if (res.code == -1) {
  1837. // errorMesageSimaple(res.message);
  1838. // } else if (res.code == -2) {
  1839. // warningMesageSimaple(res.message);
  1840. // }
  1841. // }
  1842. // });
  1843. }
  1844. } else {
  1845. errorMesage(res);
  1846. }
  1847. }
  1848. });
  1849. }
  1850. /**
  1851. * 查询患者的门诊统筹信息
  1852. * @param patientId
  1853. */
  1854. function queryInsuinfo(patientId) {
  1855. $.ajax({
  1856. type: "GET",
  1857. url: '/thmz/queryInsuinfo?patientId=' + patientId,
  1858. contentType: "application/json;charset=UTF-8",
  1859. dataType: "json",
  1860. headers: {
  1861. 'Accept': 'application/json',
  1862. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  1863. },
  1864. success: function (res) {
  1865. if (res == '401' || res == 401) {
  1866. window.location.href = '/thmz/login/view'
  1867. return;
  1868. }
  1869. if (res.code == 0) {
  1870. $("#zgmztczfDiv").removeClass("hide").addClass("in");
  1871. $("#mztczfSiReadCard").removeClass("hide").addClass("in");
  1872. if (res.balc != null) {
  1873. var balc = Number(res.balc);
  1874. if (balc > 0) {
  1875. $("#grzhzfDiv").removeClass("hide").addClass("in");
  1876. }
  1877. }
  1878. } else if (res.code == -1) {
  1879. errorMesageSimaple(res.message);
  1880. } else if (res.code == -2) {
  1881. warningMesageSimaple(res.message);
  1882. }
  1883. }
  1884. });
  1885. }
  1886. /**
  1887. * 读医保电子凭证
  1888. * @param asyncFlag true 异步 false 同步
  1889. */
  1890. function mztczfSiReadCard(asyncFlag) {
  1891. mztczfSiReadCardStatus = true;
  1892. $.ajax({
  1893. type: "GET",
  1894. url: 'http://localhost:8321/readcard/entry?param=qrcode_01101',
  1895. contentType: "application/json;charset=UTF-8",
  1896. dataType: "json",
  1897. async: asyncFlag,
  1898. headers: {
  1899. 'Accept': 'application/json',
  1900. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  1901. },
  1902. success: function (res) {
  1903. mztczfSiReadCardStatus = false;
  1904. if (res == '401' || res == 401) {
  1905. window.location.href = '/thmz/login/view'
  1906. return;
  1907. }
  1908. //console.log(res);
  1909. if (res.code == 200) {
  1910. var data = JSON.parse(res.data);
  1911. $("#readCardResult").val(JSON.stringify(data.data));
  1912. $("#messageContent").html("读卡成功,是否保存处方?");
  1913. } else {
  1914. $("#messageContent").html("读卡失败,是否保存处方(不享受门诊统筹)?");
  1915. errorMesage(res);
  1916. }
  1917. },
  1918. error: function (XMLHttpRequest, textStatus, errorThrown) {
  1919. mztczfSiReadCardStatus = false;
  1920. $("#messageContent").html("读卡异常,是否保存处方(不享受门诊统筹)?");
  1921. }
  1922. });
  1923. }
  1924. /**
  1925. * 实际读医保电子凭证
  1926. * @param asyncFlag true 异步 false 同步
  1927. */
  1928. function realMztczfSiReadCard(asyncFlag) {
  1929. }
  1930. /**
  1931. * 清空工作台
  1932. */
  1933. function clearWorkSpace() {
  1934. clearUser(true);
  1935. clearWorkSpaceExcludeUser(1);
  1936. }
  1937. /**
  1938. * 清空工作台除了用户信息
  1939. * @param source 1 清空工作台 2 调用模板 3 调用历史处方
  1940. */
  1941. function clearWorkSpaceExcludeUser(source) {
  1942. var conciseRecordsFlag = false;
  1943. if (source == 2) {
  1944. conciseRecordsFlag = $("#conciseRecordsYlfw").prop("checked");
  1945. } else if (source == 3) {
  1946. conciseRecordsFlag = $("#conciseRecordsJzxq").prop("checked");
  1947. }
  1948. if (source == 1 || conciseRecordsFlag) {
  1949. $("#symptom").val(null);
  1950. $("#emrHpi").val(null);
  1951. $("#emrPs").val(null);
  1952. $("#personalHistory").val(null);
  1953. $("#familyHistory").val(null);
  1954. $("#obstericalHistory").val(null);
  1955. $("#weight").val(null);
  1956. $("#temperature").val(null);
  1957. $("#sphygmus").val(null);
  1958. $("#breathe").val(null);
  1959. $("#pressure_high").val(null);
  1960. $("#pressure_floor").val(null);
  1961. $("#pressure_high_left").val(null);
  1962. $("#pressure_floor_left").val(null);
  1963. $("#tentativeDiagnosis").val(null);
  1964. $("#otherCheck").val(null);
  1965. $("#diagnoseValue").val(null);
  1966. $("#diagnoseTags").html(null);
  1967. $("#healthEducation").val(null);
  1968. }
  1969. //清空工作台的时候需要调用
  1970. if (source == 1) {
  1971. clearWesternMedicine(true);
  1972. clearChineseMedicine();
  1973. clearJyJcItem();
  1974. clearZyReq();
  1975. //initNavTabs(0);
  1976. clearNavTabs(0);
  1977. clearNavTabs(1);
  1978. clearNavTabs(2);
  1979. clearNavTabs(3);
  1980. clearNavTabs(4);
  1981. clearApidAcceptsModal();
  1982. clearTurnToConsultationInput();
  1983. clearZgtczfInput();
  1984. gropuIdAndOrderNoMap = null;
  1985. //prevCategoriesFlag = null;
  1986. initGroupOrder();
  1987. }
  1988. $("#totalAmount").text(0);
  1989. }
  1990. /**
  1991. * 构造西药处方详情和模板预览方法
  1992. * @param pyPrescription
  1993. * @param contentId 内容ID
  1994. * @param titleId 标题ID
  1995. * @param checkBox 是否需要增加ckeckBox
  1996. */
  1997. function fitxyContent(pyPrescription, contentId, titleId, checkBox) {
  1998. if (pyPrescription != null && pyPrescription.length > 0) {
  1999. var xypyHtml = "";
  2000. for (var i = 0; i < pyPrescription.length; i++) {
  2001. var py = pyPrescription[i];
  2002. if (py == null || py.length == 0) {
  2003. continue;
  2004. }
  2005. var detail = py.detail;
  2006. if (detail == null || detail.length == 0) {
  2007. continue;
  2008. }
  2009. for (var j = 0; j < detail.length; j++) {
  2010. var pyDetail = detail[j];
  2011. if (checkBox) {
  2012. xypyHtml += "<div style='cursor: pointer;' data-id='" + pyDetail.orderCode + "'>";
  2013. xypyHtml += "<input type='checkbox'/>";
  2014. xypyHtml += "<span onclick='rowDataClick(this)'>";
  2015. } else {
  2016. xypyHtml += "<div>";
  2017. }
  2018. xypyHtml += "<span style='color: red;'>" + pyDetail.groupOrder + "." + "</span>";
  2019. xypyHtml += pyDetail.name;
  2020. xypyHtml += " ";
  2021. xypyHtml += pyDetail.specification;
  2022. xypyHtml += " X ";
  2023. xypyHtml += pyDetail.quantity;
  2024. xypyHtml += pyDetail.packUnit;
  2025. xypyHtml += " 用法: ";
  2026. xypyHtml += pyDetail.supplyName;
  2027. xypyHtml += " ";
  2028. xypyHtml += pyDetail.drugQuan;
  2029. xypyHtml += pyDetail.unitDesc;
  2030. xypyHtml += " ";
  2031. xypyHtml += pyDetail.frequency;
  2032. xypyHtml += " ";
  2033. xypyHtml += pyDetail.orderDays;
  2034. xypyHtml += "天 ";
  2035. if (pyDetail.tryFlag != undefined && pyDetail.tryFlag != null && pyDetail.tryFlag != "null" && pyDetail.tryFlag != "") {
  2036. xypyHtml += pyDetail.tryFlag;
  2037. } else if (pyDetail.tryResult != undefined && pyDetail.tryResult != null && pyDetail.tryResult != "null" && pyDetail.tryResult != "") {
  2038. xypyHtml += pyDetail.tryResult;
  2039. }
  2040. if (checkBox) {
  2041. xypyHtml += "</span>";
  2042. }
  2043. xypyHtml += "</div>";
  2044. }
  2045. }
  2046. afterFitContent(contentId, xypyHtml, titleId);
  2047. } else {
  2048. $("#" + titleId).removeClass("in").addClass("hide");
  2049. $("#" + contentId).html("");
  2050. }
  2051. }
  2052. /**
  2053. * 构造中药处方详情和模板预览方法
  2054. * @param zyPrescription
  2055. * @param contentId 内容ID
  2056. * @param titleId 标题ID
  2057. * @param checkBox 是否需要增加ckeckBox
  2058. */
  2059. function fitzyContent(zyPrescription, contentId, titleId, checkBox) {
  2060. if (zyPrescription == null || zyPrescription.length == 0) {
  2061. $("#" + titleId).removeClass("in").addClass("hide");
  2062. $("#" + contentId).html("");
  2063. return;
  2064. }
  2065. var zyDetail = zyPrescription[0];
  2066. if (zyDetail == null || zyDetail.length == 0) {
  2067. $("#" + titleId).removeClass("in").addClass("hide");
  2068. $("#" + contentId).html("");
  2069. return;
  2070. }
  2071. var detail = zyDetail.detail;
  2072. if (detail == null || detail.length == 0) {
  2073. $("#" + titleId).removeClass("in").addClass("hide");
  2074. $("#" + contentId).html("");
  2075. return;
  2076. }
  2077. var zypyHtml = "";
  2078. for (var i = 0; i < detail.length; i++) {
  2079. //zypyHtml += '<div class="item form-group" style="margin-bottom: -5px;">';
  2080. var zy = detail[i];
  2081. if (zy == null || zy.length == 0) {
  2082. continue;
  2083. }
  2084. if (checkBox) {
  2085. zypyHtml += "<div class=\"col-md-3 col-sm-3 col-xs-12\" style='cursor: pointer;' data-id='" + zy.orderCode + "'>";
  2086. zypyHtml += "<input type='checkbox'/>";
  2087. zypyHtml += "<span onclick='rowDataClick(this)'>";
  2088. } else {
  2089. zypyHtml += "<div class=\"col-md-3 col-sm-3 col-xs-12\">";
  2090. }
  2091. zypyHtml += zy.name;
  2092. var instructionText = zy.instructionText;
  2093. if (instructionText != null && instructionText != "") {
  2094. zypyHtml += "[";
  2095. zypyHtml += instructionText;
  2096. zypyHtml += "]";
  2097. }
  2098. zypyHtml += zy.quantity;
  2099. zypyHtml += "g";
  2100. if (checkBox) {
  2101. zypyHtml += "</span>";
  2102. }
  2103. zypyHtml += "</div>";
  2104. // if (i % 4 == 0) {
  2105. // zypyHtml += '</div>';
  2106. // }
  2107. }
  2108. // if(detail.length%4!=0){
  2109. // for(var i=0;i<4-(detail.length%4);i++){
  2110. // zypyHtml += "<div class=\"col-md-3 col-sm-3 col-xs-12\"></div>";
  2111. // }
  2112. // }
  2113. var zyfs = zyDetail.zyfs;
  2114. if (zyfs != null && zyfs != "") {
  2115. zypyHtml += " <div class=\"col-md-12 col-sm-12 col-xs-12\">";
  2116. zypyHtml += ' <div style="text-indent: 2em;">';
  2117. zypyHtml += ' <div>';
  2118. zypyHtml += 'x<span>';
  2119. zypyHtml += zyfs;
  2120. zypyHtml += '</span> 付</div>';
  2121. }
  2122. afterFitContent(contentId, zypyHtml, titleId);
  2123. }
  2124. /**
  2125. * 构造辅助检查、检验处方详情和模板预览方法
  2126. * @param jcjyPrescription
  2127. * @param contentId 内容ID
  2128. * @param titleId 标题ID
  2129. * @param checkBox 是否需要增加ckeckBox
  2130. */
  2131. function fitJcjyContent(jcjyPrescription, contentId, titleId, checkBox) {
  2132. if (jcjyPrescription == null || jcjyPrescription.length == 0) {
  2133. $("#" + titleId).removeClass("in").addClass("hide");
  2134. $("#" + contentId).html("");
  2135. return;
  2136. }
  2137. var jcjyDetail = jcjyPrescription[0];
  2138. if (jcjyDetail == null || jcjyDetail.length == 0) {
  2139. $("#" + titleId).removeClass("in").addClass("hide");
  2140. $("#" + contentId).html("");
  2141. return;
  2142. }
  2143. var detail = jcjyDetail.detail;
  2144. if (detail == null || detail.length == 0) {
  2145. $("#" + titleId).removeClass("in").addClass("hide");
  2146. $("#" + contentId).html("");
  2147. return;
  2148. }
  2149. var jcjyHtml = "";
  2150. for (var i = 0; i < detail.length; i++) {
  2151. var jcjy = detail[i];
  2152. if (jcjy == null || jcjy.length == 0) {
  2153. continue;
  2154. }
  2155. if (checkBox) {
  2156. jcjyHtml += "<div style='cursor: pointer;' data-id='" + jcjy.orderCode + "'>";
  2157. jcjyHtml += "<input type='checkbox'/>";
  2158. jcjyHtml += "<span onclick='rowDataClick(this)'>";
  2159. } else {
  2160. jcjyHtml += "<div>";
  2161. }
  2162. jcjyHtml += jcjy.index + ".";
  2163. jcjyHtml += jcjy.name;
  2164. if (checkBox) {
  2165. jcjyHtml += "</span>";
  2166. }
  2167. jcjyHtml += "</div>";
  2168. }
  2169. afterFitContent(contentId, jcjyHtml, titleId);
  2170. }
  2171. /**
  2172. * 构造入院处方详情和模板预览方法
  2173. * @param jcjyPrescription
  2174. * @param contentId 内容ID
  2175. * @param titleId 标题ID
  2176. * @param checkBox 是否需要增加ckeckBox
  2177. */
  2178. function fitZyReqContent(zyReqPrescription, contentId, titleId, checkBox) {
  2179. if (zyReqPrescription == null || zyReqPrescription.length == 0) {
  2180. $("#" + titleId).removeClass("in").addClass("hide");
  2181. $("#" + contentId).html("");
  2182. return;
  2183. }
  2184. var zyReqHtml = "";
  2185. if (checkBox) {
  2186. zyReqHtml += "<div style='cursor: pointer;'>";
  2187. zyReqHtml += "<input type='checkbox'/>";
  2188. zyReqHtml += "<span onclick='rowDataClick(this)'>";
  2189. } else {
  2190. zyReqHtml += "<div>";
  2191. }
  2192. zyReqHtml += "收住院 [";
  2193. zyReqHtml += zyReqPrescription.reqDept;
  2194. if (zyReqPrescription.smallDept != null && zyReqPrescription.smallDept != "") {
  2195. zyReqHtml += "(" + zyReqPrescription.smallDept + ")";
  2196. }
  2197. zyReqHtml += "]";
  2198. if (zyReqPrescription.admissStatus != null && zyReqPrescription.admissStatus != "") {
  2199. zyReqHtml += zyReqPrescription.admissStatus;
  2200. }
  2201. zyReqHtml += " 侯床";
  2202. if (checkBox) {
  2203. zyReqHtml += "</span>";
  2204. }
  2205. zyReqHtml += "</div>";
  2206. afterFitContent(contentId, zyReqHtml, titleId);
  2207. }
  2208. /**
  2209. * 处方详情构造方法后续事件,如所有的复选框默认勾选
  2210. * @param contentId
  2211. * @param zyReqHtml
  2212. * @param titleId
  2213. */
  2214. function afterFitContent(contentId, zyReqHtml, titleId) {
  2215. $("#" + contentId).html(zyReqHtml);
  2216. $("#" + titleId).removeClass("hide").addClass("in");
  2217. //是否默认勾选处方回调
  2218. var checkboxFlag = localStorage.getItem("checkboxFlag");
  2219. if (checkboxFlag != null && (checkboxFlag == "0" || checkboxFlag == 0)) {
  2220. $("#" + titleId).find("input[type='checkbox']").prop("checked", true);
  2221. $("#" + contentId).find("input[type='checkbox']").each(function (index, obj) {
  2222. $(obj).prop("checked", true);
  2223. });
  2224. } else {
  2225. $("#" + titleId).find("input[type='checkbox']").prop("checked", false);
  2226. }
  2227. }
  2228. /**
  2229. * 模板、详情页行数据点击事件
  2230. * @param obj
  2231. */
  2232. function rowDataClick(obj) {
  2233. $(obj).prev().click();
  2234. }
  2235. /**
  2236. * 模板、详情页治疗分类标题点击事件
  2237. * @param obj
  2238. * @param source 0 是标题的行点击事件 1 标题的checkbox本身触发
  2239. */
  2240. function titleClick(obj, source) {
  2241. var contentObj = $(obj).parent().next();
  2242. var check = $(obj).prop("checked");
  2243. if (source == 0) {
  2244. var prev = $(obj).prev();
  2245. check = !$(prev).prop("checked");
  2246. $(prev).prop("checked", check)
  2247. }
  2248. if (contentObj != null) {
  2249. $(contentObj).children().each(function (index, object) {
  2250. //以下两个方法,单独调用一个可能不行
  2251. $(object).find("input[type='checkbox']").prop("checked", check) //如果鼠标点击选中了,执行后可以取消选中
  2252. });
  2253. }
  2254. }
  2255. /**
  2256. * 处方明细复选框点击事件
  2257. * @param obj
  2258. * @param source 0 是标题的行点击事件 1 标题的checkbox本身触发
  2259. */
  2260. function prescriptionCfmxChosice(obj, source) {
  2261. var check = $(obj).prop("checked");
  2262. if (source == 0) {
  2263. var prev = $(obj).prev();
  2264. check = !$(prev).prop("checked");
  2265. //以下两个方法,单独调用一个可能不行
  2266. $(prev).prop("checked", check) //如果鼠标点击选中了,执行后可以取消选中
  2267. }
  2268. var conents = $(obj).parent().parent().nextAll();
  2269. if (conents == null || conents.length == 0) {
  2270. return;
  2271. }
  2272. $(conents).each(function (index, object) {
  2273. //以下两个方法,单独调用一个可能不行
  2274. $(object).find("div:eq(0)").find("input[type='checkbox']").prop("checked", check) //如果鼠标点击选中了,执行后可以取消选中
  2275. var contentObj = $(object).find("div:eq(1)");
  2276. if (contentObj != null) {
  2277. $(contentObj).children().each(function (contentIndex, contentObject) {
  2278. $(contentObject).find("input[type='checkbox']").prop("checked", check) //如果鼠标点击选中了,执行后可以取消选中
  2279. });
  2280. }
  2281. });
  2282. }
  2283. /**
  2284. * 简明病历标题点击事件
  2285. * @param obj
  2286. */
  2287. function prescriptionJmblChosice(obj) {
  2288. var prev = $(obj).prev();
  2289. var check = !$(prev).prop("checked");
  2290. $(prev).prop("checked", check); //如果鼠标点击选中了,执行后可以取消选中
  2291. }
  2292. /**
  2293. * 医疗范文详情预览
  2294. * @param id
  2295. */
  2296. function medicalModelModal(id) {
  2297. //是否默认勾选处方回调
  2298. var checkboxFlag = localStorage.getItem("checkboxFlag");
  2299. if (checkboxFlag != null && (checkboxFlag == "0" || checkboxFlag == 0)) {
  2300. $("#conciseRecordsYlfw").prop("checked", true);
  2301. $("#prescriptionSubsidiaryYlfw").prop("checked", true);
  2302. } else {
  2303. $("#conciseRecordsYlfw").prop("checked", false);
  2304. $("#prescriptionSubsidiaryYlfw").prop("checked", false);
  2305. }
  2306. $.ajax({
  2307. type: "GET",
  2308. url: '/thmz/getTemplateById?id=' + id,
  2309. contentType: "application/json;charset=UTF-8",
  2310. dataType: "json",
  2311. async: false,
  2312. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2313. success: function (res) {
  2314. if (res == '401' || res == 401) {
  2315. window.location.href = '/thmz/login/view'
  2316. return;
  2317. }
  2318. if (res.code == 0) {
  2319. var jsonData = JSON.parse(res.data.templateData);
  2320. $("#vmedicalModelName").text(res.data.name);
  2321. $("#idTemplate").val(res.data.id);
  2322. $("#zsTemplate").html(jsonData.mzBlRecord.emrChiefComplaint);
  2323. $("#xbsTemplate").html(jsonData.mzBlRecord.emrHpi);
  2324. var icdText = res.data.icdText;
  2325. $("#zdTemplate").html("");
  2326. $("#xypyContent").html("");
  2327. $("#xymjContent").html("");
  2328. $("#xyjeContent").html("");
  2329. $("#yczlContent").html("");
  2330. $("#zyzlContent").html("");
  2331. $("#zlyjContent").html("");
  2332. if (icdText != null) {
  2333. var arr = icdText.split(",");
  2334. var html = "";
  2335. for (var i = 0; i < arr.length; i++) {
  2336. if (i == 0) {
  2337. html += ' <div class="tagZdy tagZdy-back">';
  2338. } else {
  2339. html += ' <div class="tagZdy tagZdy-back-green">';
  2340. }
  2341. html += arr[i];
  2342. html += '</div>';
  2343. }
  2344. $("#zdTemplate").html(html);
  2345. }
  2346. var prescriptionDetail = jsonData.mzBlRecord.prescriptionDetail;
  2347. if (prescriptionDetail != null && prescriptionDetail != "") {
  2348. prescriptionDetail = JSON.parse(prescriptionDetail);
  2349. var xyPrescription = prescriptionDetail.xyPrescription;
  2350. if (xyPrescription != null) {
  2351. fitxyContent(xyPrescription.pyPrescription, "xypyContent", "xypyTitle", true);
  2352. fitxyContent(xyPrescription.mjPrescription, "xymjContent", "xymjTitle", true);
  2353. fitxyContent(xyPrescription.jePrescription, "xyjeContent", "xyjeTitle", true);
  2354. fitxyContent(xyPrescription.ycPrescription, "yczlContent", "yczlTitle", true);
  2355. } else {
  2356. $("#xypyTitle").removeClass("in").addClass("hide");
  2357. $("#xypyContent").html("");
  2358. $("#xymjTitle").removeClass("in").addClass("hide");
  2359. $("#xymjContent").html("");
  2360. $("#xyjeTitle").removeClass("in").addClass("hide");
  2361. $("#xyjeContent").html("");
  2362. $("#yczlTitle").removeClass("in").addClass("hide");
  2363. $("#yczlContent").html("");
  2364. }
  2365. var zyPrescription = prescriptionDetail.zyPrescription;
  2366. if (zyPrescription != null) {
  2367. fitzyContent(zyPrescription, "zyzlContent", "zyzlTitle", true);
  2368. } else {
  2369. $("#zyzlTitle").removeClass("in").addClass("hide");
  2370. $("#zyzlContent").html("");
  2371. }
  2372. var jcjyPrescription = prescriptionDetail.jcjyPrescription;
  2373. if (jcjyPrescription != null) {
  2374. fitJcjyContent(jcjyPrescription, "jcjyContent", "jcjyTitle", true);
  2375. } else {
  2376. $("#jcjyTitle").removeClass("in").addClass("hide");
  2377. $("#jcjyContent").html("");
  2378. }
  2379. var zlPrescription = prescriptionDetail.zlPrescription;
  2380. if (zlPrescription != null) {
  2381. fitJcjyContent(zlPrescription, "zlContent", "zlTitle", true);
  2382. } else {
  2383. $("#zlTitle").removeClass("in").addClass("hide");
  2384. $("#zlContent").html("");
  2385. }
  2386. var zyReqPrescription = prescriptionDetail.zyReqPrescription;
  2387. if (zyReqPrescription != null) {
  2388. fitZyReqContent(zyReqPrescription, "zyReqContent", "zyReqTitle", true);
  2389. } else {
  2390. $("#zyReqTitle").removeClass("in").addClass("hide");
  2391. $("#zyReqContent").html("");
  2392. }
  2393. } else {
  2394. $("#xypyTitle").removeClass("in").addClass("hide");
  2395. $("#xypyContent").html("");
  2396. $("#xymjTitle").removeClass("in").addClass("hide");
  2397. $("#xymjContent").html("");
  2398. $("#xyjeTitle").removeClass("in").addClass("hide");
  2399. $("#xyjeContent").html("");
  2400. $("#yczlTitle").removeClass("in").addClass("hide");
  2401. $("#yczlContent").html("");
  2402. $("#zyzlTitle").removeClass("in").addClass("hide");
  2403. $("#zyzlContent").html("");
  2404. $("#jcjyTitle").removeClass("in").addClass("hide");
  2405. $("#jcjyContent").html("");
  2406. $("#zlTitle").removeClass("in").addClass("hide");
  2407. $("#zlContent").html("");
  2408. $("#zyReqTitle").removeClass("in").addClass("hide");
  2409. $("#zyReqContent").html("");
  2410. }
  2411. } else {
  2412. errorMesage(res);
  2413. }
  2414. }
  2415. });
  2416. $("#medicalModelModal").modal();
  2417. }
  2418. /**
  2419. * 诊疗项目回写
  2420. * @param code
  2421. * @param mzChargeDetail
  2422. */
  2423. function callBackZlDetail(code, mzChargeDetail) {
  2424. //诊疗项目
  2425. $.ajax({
  2426. type: "GET",
  2427. url: '/thmz/getZdChargeItemByCode?code=' + code,
  2428. contentType: "application/json;charset=UTF-8",
  2429. dataType: "json",
  2430. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2431. async: false,
  2432. success: function (res) {
  2433. if (res == '401' || res == 401) {
  2434. window.location.href = '/thmz/login/view'
  2435. return;
  2436. }
  2437. if (res.code == 0) {
  2438. //如果
  2439. if ($("#zlTab").find("li") == null || $("#zlTab").find("li").length == 0) {
  2440. initNavTabs(3);
  2441. }
  2442. $("#zlItem").val(res.data.name);
  2443. $("#zlItem").blur();
  2444. $("#zlItemPrice").val(res.data.chargeAmount);
  2445. $("#chargeUnit").val(res.data.chargeUnit);
  2446. $("#zl_current_code").val(res.data.code);
  2447. $("#zlRemark").val(mzChargeDetail.instructionText);
  2448. if (mzChargeDetail.execDept != null && mzChargeDetail.execDept != "") {
  2449. $("#zlExecUnit").selectpicker('val', mzChargeDetail.execDept);
  2450. $('#zlExecUnit').selectpicker('refresh');
  2451. }
  2452. $("#itemQuantity").val(mzChargeDetail.quantity);
  2453. saveZlItem(false);
  2454. } else {
  2455. errorMesage(res);
  2456. }
  2457. }
  2458. });
  2459. }
  2460. /**
  2461. * 处方回写
  2462. * @param jsonData 处方数据
  2463. * @param type 回写类型 0 全部回写 1 医疗范文 2 就诊详情
  2464. */
  2465. function editPrescription(jsonData, type) {
  2466. var firstOrNot = jsonData.firstOrNot;
  2467. var conciseRecordsFlag = false;
  2468. if (type == 1) {
  2469. conciseRecordsFlag = $("#conciseRecordsYlfw").prop("checked");
  2470. } else if (type == 2) {
  2471. conciseRecordsFlag = $("#conciseRecordsJzxq").prop("checked");
  2472. }
  2473. if (firstOrNot == 0) {
  2474. $("#first").next().click();
  2475. } else if (firstOrNot == 1) {
  2476. $("#not").next().click();
  2477. }
  2478. if (type == 0 || conciseRecordsFlag) {
  2479. $("#symptom").val(jsonData.mzBlRecord.emrChiefComplaint);
  2480. $("#emrHpi").val(jsonData.mzBlRecord.emrHpi);
  2481. $("#emrPs").val(jsonData.mzBlRecord.emrPs);
  2482. $("#personalHistory").val(jsonData.mzBlRecord.personalHistory);
  2483. $("#familyHistory").val(jsonData.mzBlRecord.familyHistory);
  2484. $("#obstericalHistory").val(jsonData.mzBlRecord.obstericalHistory);
  2485. if (jsonData.mzBlRecord.weight != null && jsonData.mzBlRecord.weight != 0) {
  2486. $("#weight").val(jsonData.mzBlRecord.weight);
  2487. } else {
  2488. $("#weight").val("");
  2489. }
  2490. if (jsonData.mzBlRecord.temperature != null && jsonData.mzBlRecord.temperature != 0) {
  2491. $("#temperature").val(jsonData.mzBlRecord.temperature);
  2492. } else {
  2493. $("#temperature").val("");
  2494. }
  2495. if (jsonData.mzBlRecord.sphygmus != null && jsonData.mzBlRecord.sphygmus != 0) {
  2496. $("#sphygmus").val(jsonData.mzBlRecord.sphygmus);
  2497. } else {
  2498. $("#sphygmus").val("");
  2499. }
  2500. if (jsonData.mzBlRecord.breathe != null && jsonData.mzBlRecord.breathe != 0) {
  2501. $("#breathe").val(jsonData.mzBlRecord.breathe);
  2502. } else {
  2503. $("#breathe").val("");
  2504. }
  2505. if (jsonData.mzBlRecord.pressureHigh != null && jsonData.mzBlRecord.pressureHigh != 0) {
  2506. $("#pressure_high").val(jsonData.mzBlRecord.pressureHigh);
  2507. } else {
  2508. $("#pressure_high").val("");
  2509. }
  2510. if (jsonData.mzBlRecord.pressureFloor != null && jsonData.mzBlRecord.pressureFloor != 0) {
  2511. $("#pressure_floor").val(jsonData.mzBlRecord.pressureFloor);
  2512. } else {
  2513. $("#pressure_floor").val("");
  2514. }
  2515. if (jsonData.mzBlRecord.pressureHighLeft != null && jsonData.mzBlRecord.pressureHighLeft != 0) {
  2516. $("#pressure_high_left").val(jsonData.mzBlRecord.pressureHighLeft);
  2517. } else {
  2518. $("#pressure_high_left").val("");
  2519. }
  2520. if (jsonData.mzBlRecord.pressureFloorLeft != null && jsonData.mzBlRecord.pressureFloorLeft != 0) {
  2521. $("#pressure_floor_left").val(jsonData.mzBlRecord.pressureFloorLeft);
  2522. } else {
  2523. $("#pressure_floor_left").val("");
  2524. }
  2525. $("#tentativeDiagnosis").val(jsonData.mzBlRecord.tentativeDiagnosis);
  2526. $("#otherCheck").val(jsonData.mzBlRecord.emrPe);
  2527. var icdCode = jsonData.icdCode;
  2528. if (icdCode != null && icdCode != "" && icdCode.length > 0) {
  2529. $.ajax({
  2530. type: "GET",
  2531. url: '/thmz/getZdIcdByCodes?icdCode=' + icdCode,
  2532. contentType: "application/json;charset=UTF-8",
  2533. dataType: "json",
  2534. async: false,
  2535. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2536. success: function (res) {
  2537. if (res == '401' || res == 401) {
  2538. window.location.href = '/thmz/login/view'
  2539. return;
  2540. }
  2541. if (res.code == 0) {
  2542. if (res.data != null && res.data.length > 0) {
  2543. for (var i = 0; i < res.data.length; i++) {
  2544. fitDiagnoseValue(res.data[i].name, res.data[i].code);
  2545. }
  2546. }
  2547. } else {
  2548. errorMesage(res);
  2549. }
  2550. }
  2551. });
  2552. }
  2553. $("#healthEducation").val(jsonData.mzBlRecord.emrJkjy);
  2554. }
  2555. //西药选中的数据组
  2556. var xyArrays = [];
  2557. //中药选中的数据组
  2558. var zyArrays = [];
  2559. //辅助检查、检验选中的数据组
  2560. var jcjyArrays = [];
  2561. //诊疗选中的数据组
  2562. var zlArrays = [];
  2563. //住院选中的数据组
  2564. var zyReqArrays = [];
  2565. //住院回写
  2566. var zyReqCallBack = false;
  2567. if (type == 1) {
  2568. setCallBackArrays("xypyContent", xyArrays);
  2569. setCallBackArrays("xymjContent", xyArrays);
  2570. setCallBackArrays("xyjeContent", xyArrays);
  2571. setCallBackArrays("yczlContent", xyArrays);
  2572. setCallBackArrays("zyzlContent", zyArrays);
  2573. setCallBackArrays("jcjyContent", jcjyArrays);
  2574. setCallBackArrays("zlContent", zlArrays);
  2575. zyReqCallBack = $("#zyReqContent").find("input").prop("checked");
  2576. } else if (type == 2) {
  2577. setCallBackArrays("prescriptionDetail_xypyContent", xyArrays);
  2578. setCallBackArrays("prescriptionDetail_xymjContent", xyArrays);
  2579. setCallBackArrays("prescriptionDetail_xyjeContent", xyArrays);
  2580. setCallBackArrays("prescriptionDetail_yczlContent", xyArrays);
  2581. setCallBackArrays("prescriptionDetail_zyzlContent", zyArrays);
  2582. setCallBackArrays("prescriptionDetail_jcjyContent", jcjyArrays);
  2583. setCallBackArrays("prescriptionDetail_zlContent", zlArrays);
  2584. zyReqCallBack = $("#prescriptionDetail_zyReqContent").find("input").prop("checked");
  2585. } else if (type == 0) {
  2586. zyReqCallBack = true;
  2587. }
  2588. var mzChargeDetailList = jsonData.mzChargeDetailList;
  2589. var mzZyReq = jsonData.mzZyReq;
  2590. //中药的公共参数是否已经设置了
  2591. var hadSetZyFullParams = false;
  2592. //西药,成药,医材,麻精,中药,诊疗
  2593. if (mzChargeDetailList != null && mzChargeDetailList.length > 0) {
  2594. for (var i = 0; i < mzChargeDetailList.length; i++) {
  2595. var mzChargeDetail = mzChargeDetailList[i];
  2596. var groupNo = mzChargeDetail.groupNo;
  2597. var code = mzChargeDetail.chargeItemCode;
  2598. var serial = mzChargeDetail.serial;
  2599. if (groupNo == "00") {
  2600. if (type != 0 && !isInArray(code, zlArrays)) {
  2601. continue;
  2602. }
  2603. callBackZlDetail(code, mzChargeDetail);
  2604. } else if (groupNo == "71" || groupNo == "91" || groupNo == "111" || groupNo == "131") {
  2605. // 71 西成药 91 医材 111 精一 131 精二
  2606. var groupOrder = mzChargeDetail.groupOrder;
  2607. if (groupOrder == null || groupOrder == 'null' || groupOrder == "") {
  2608. groupOrder = 1;
  2609. }
  2610. if (type != 0 && !isInArray(code + "_" + serial + "_" + groupOrder, xyArrays)) {
  2611. continue;
  2612. }
  2613. var lastGroupOrder = parseInt($("#groupId > option:last").val());
  2614. while (lastGroupOrder < groupOrder) {
  2615. appendGroupOrder();
  2616. lastGroupOrder = parseInt($("#groupId > option:last").val());
  2617. }
  2618. //appendGroupOrder()
  2619. $("#groupId").selectpicker('val', groupOrder);
  2620. $('#groupId').selectpicker('refresh');
  2621. checkYpInfo(code, serial, groupNo, false, mzChargeDetail.orderNo);
  2622. // 给药方式 同组药品给药方式相同
  2623. $("#supplyType").selectpicker('val', mzChargeDetail.supplyCode);
  2624. $('#supplyType').selectpicker('refresh');
  2625. $("#drugWin").val(mzChargeDetail.drugQuan);
  2626. $("#drugWinUnit").selectpicker('val', mzChargeDetail.drugUnit);
  2627. $('#drugWinUnit').selectpicker('refresh');
  2628. //天数 同组药品天数相同
  2629. $("#dayNum").selectpicker('val', mzChargeDetail.orderDays);
  2630. $('#dayNum').selectpicker('refresh');
  2631. //频次编码 同组药品频次编码相同
  2632. $("#orderFrequency").selectpicker('val', mzChargeDetail.frequency);
  2633. $('#orderFrequency').selectpicker('refresh');
  2634. if (mzChargeDetail.tryFlag == 1 || mzChargeDetail.tryFlag == "1") {
  2635. $("#tryResult").selectpicker('val', 100);
  2636. $('#tryResult').selectpicker('refresh');
  2637. } else if (mzChargeDetail.tryResult != null && mzChargeDetail.tryResult != "null" && mzChargeDetail.tryResult != "") {
  2638. $("#tryResult").selectpicker('val', mzChargeDetail.tryResult);
  2639. $('#tryResult').selectpicker('refresh');
  2640. }
  2641. $("#gross").val(mzChargeDetail.quantity);
  2642. $("#totalRetprice").val(Multiply(mzChargeDetail.quantity, $("#packRetprice").val()).toFixed(2));
  2643. $("#medicalAdvice").selectpicker('val', mzChargeDetail.instructionCode);
  2644. $('#medicalAdvice').selectpicker('refresh');
  2645. saveWesternMedicine(false);
  2646. $("#western_medicine_button").click();
  2647. } else {
  2648. if (type != 0 && !isInArray(code + "_" + serial, zyArrays)) {
  2649. continue;
  2650. }
  2651. //中药与颗粒剂
  2652. checkZyInfo(code, serial, false);
  2653. //类型
  2654. $("#zyClassType").selectpicker('val', groupNo);
  2655. $('#zyClassType').selectpicker('refresh');
  2656. $("#zy_drugWin").val(mzChargeDetail.quantity);
  2657. $("#zyInstruction").selectpicker('val', mzChargeDetail.instructionCode);
  2658. $('#zyInstruction').selectpicker('refresh');
  2659. saveChineseMedicine(false);
  2660. if (!hadSetZyFullParams) {
  2661. hadSetZyFullParams = true;
  2662. $("input.zyfs").val(mzChargeDetail.drugWin);
  2663. // $("#zy_orderFrequency_1").selectpicker('val', mzChargeDetail.frequency);
  2664. // $('#zy_orderFrequency_1').selectpicker('refresh');
  2665. $("#useType_1").selectpicker('val', mzChargeDetail.cyFysm);
  2666. $('#useType_1').selectpicker('refresh');
  2667. $("#cyJssm").selectpicker('val', mzChargeDetail.cyJssm);
  2668. $('#cyJssm').selectpicker('refresh');
  2669. $("#cyJsl").val(mzChargeDetail.cyJsl);
  2670. $("#cyZql").val(mzChargeDetail.cyZql);
  2671. $("#cyFj").val(mzChargeDetail.cyFj);
  2672. $("#cyFfcs").val(mzChargeDetail.cyFfcs);
  2673. $("#cyMtjs").val(mzChargeDetail.cyMtjs);
  2674. $("#zy_supplyType_1").selectpicker('val', mzChargeDetail.cyDj);
  2675. $('#zy_supplyType_1').selectpicker('refresh');
  2676. }
  2677. $("#chinese_medicine_button").click();
  2678. }
  2679. }
  2680. }
  2681. //检验与检查
  2682. var mzYjReqList = jsonData.mzYjReqList;
  2683. if (mzYjReqList != null && mzYjReqList.length > 0) {
  2684. for (var i = 0; i < mzYjReqList.length; i++) {
  2685. var mzYjReq = mzYjReqList[i];
  2686. var code = mzYjReq.orderCode;
  2687. if (type != 0 && !isInArray(code, jcjyArrays)) {
  2688. continue;
  2689. }
  2690. var jcJyZltype = null;
  2691. if (mzYjReq.reqType == 2) {
  2692. jcJyZltype = 1;
  2693. $("#jyZdSample").selectpicker('val', mzYjReq.inspectStuff);
  2694. $('#jyZdSample').selectpicker('refresh');
  2695. } else if (mzYjReq.reqType == 3) {
  2696. jcJyZltype = 2;
  2697. $("#yshPart").selectpicker('val', mzYjReq.inspectPart);
  2698. $('#yshPart').selectpicker('refresh');
  2699. }
  2700. $("#jcJyZltype").val(jcJyZltype);
  2701. checkJcJyItemInfo(code, null, jcJyZltype, false);
  2702. $("#remark").val(mzYjReq.jyRemark);
  2703. if (mzYjReq.execDept != null && mzYjReq.execDept != "") {
  2704. $("#execUnit").selectpicker('val', mzYjReq.execDept);
  2705. $('#execUnit').selectpicker('refresh');
  2706. }
  2707. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  2708. saveJyJcItem(false);
  2709. $("#jcJyItemChargeDetail").removeClass("in").addClass("hide");
  2710. }
  2711. $("#yj_req_button").click();
  2712. }
  2713. //入院证
  2714. if (zyReqCallBack && mzZyReq != null && mzZyReq.reqDept != null && mzZyReq.reqDept != "") {
  2715. $("#inpatientWardBeHospitalized").selectpicker('val', mzZyReq.reqDept);
  2716. $('#inpatientWardBeHospitalized').selectpicker('refresh');
  2717. initSmallDeptByDept();
  2718. $("#admissStatus").selectpicker('val', mzZyReq.admissStatus);
  2719. $('#admissStatus').selectpicker('refresh');
  2720. setTimeout(function () {
  2721. $("#smallWardBeHospitalized").selectpicker('val', mzZyReq.smallDept);
  2722. $('#smallWardBeHospitalized').selectpicker('refresh');
  2723. saveZyReq(false);
  2724. }, 500);
  2725. $("#zy_req_button").click();
  2726. }
  2727. setTimeout(function () {
  2728. //设置总金额 计算金额的时候,可能处方还没有回写完
  2729. calculateTotalAmount();
  2730. }, 1000);
  2731. }
  2732. /**
  2733. * 根据勾选内容设置选中集合
  2734. * @param id 区域id
  2735. * @param arrays 集合
  2736. */
  2737. function setCallBackArrays(id, arrays) {
  2738. var contents = $("#" + id).children();
  2739. if (contents == null || contents.length == 0) {
  2740. return;
  2741. }
  2742. $(contents).each(function (index, obj) {
  2743. var checked = $(obj).find("input").prop("checked");
  2744. var data_id = $(obj).attr("data-id");
  2745. if (checked && data_id != undefined && data_id != null && data_id != "null" && data_id != "") {
  2746. arrays[arrays.length] = data_id;
  2747. }
  2748. });
  2749. }
  2750. /**
  2751. * 调用医疗范文
  2752. */
  2753. function callTemplate() {
  2754. clearWorkSpaceExcludeUser(2);
  2755. $.ajax({
  2756. type: "GET",
  2757. url: '/thmz/increaseNumber?id=' + $("#idTemplate").val(),
  2758. contentType: "application/json;charset=UTF-8",
  2759. dataType: "json",
  2760. async: false,
  2761. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2762. success: function (res) {
  2763. if (res == '401' || res == 401) {
  2764. window.location.href = '/thmz/login/view'
  2765. return;
  2766. }
  2767. if (res.code == 0) {
  2768. var jsonData = JSON.parse(res.data.templateData);
  2769. editPrescription(jsonData, 1);
  2770. $("#templateId").val(res.data.id);
  2771. $("#templateName").val(res.data.name);
  2772. $("#templateKindType").selectpicker('val', res.data.templateKindType);
  2773. $("#templateKindType").selectpicker('refresh');
  2774. $("#templateType").selectpicker('val', res.data.templateType);
  2775. $("#templateType").selectpicker('refresh');
  2776. $("#medicalModelModal").modal("hide");
  2777. closePopover();
  2778. } else {
  2779. errorMesage(res);
  2780. }
  2781. }
  2782. });
  2783. }
  2784. /**
  2785. * 底层填充推荐方法
  2786. * @param paramsType
  2787. * @param appeal
  2788. * @param inputId
  2789. */
  2790. function extracted(paramsType, appeal, inputId) {
  2791. if (paramsType == 13) {
  2792. var contentArr = appeal.split(",");
  2793. if (contentArr != null && contentArr.length > 0) {
  2794. for (var i = 0; i < contentArr.length; i++) {
  2795. var content = contentArr[i].replace(")", "").replace("(", "-");
  2796. var diagnoseArr = content.split("-");
  2797. if (diagnoseArr == null || diagnoseArr.length == 0) {
  2798. continue;
  2799. }
  2800. fitDiagnoseValue(diagnoseArr[0], diagnoseArr[1]);
  2801. }
  2802. }
  2803. } else {
  2804. $("#" + inputId).val(appeal);
  2805. }
  2806. }
  2807. /**
  2808. * 填充推荐
  2809. * @param appeal
  2810. * @param paramsType
  2811. * @param id
  2812. */
  2813. function fitAppeal(appeal, paramsType, id) {
  2814. var inputId = "symptom";
  2815. var text = "主诉项已经录入,是否覆盖?";
  2816. if (paramsType == 5) {
  2817. inputId = "emrHpi";
  2818. text = "现病史项已经录入,是否覆盖?";
  2819. } else if (paramsType == 6) {
  2820. inputId = "emrPs";
  2821. text = "既往史项已经录入,是否覆盖?";
  2822. } else if (paramsType == 13) {
  2823. inputId = "diagnoseValue";
  2824. text = "诊断项已经录入,是否覆盖?";
  2825. }
  2826. var symptom = $("#" + inputId).val();
  2827. if (paramsType == 13 && (symptom == ",," || symptom == ",")) {
  2828. symptom = null;
  2829. }
  2830. if (symptom != null && symptom != "") {
  2831. $("#messageModal").modal();
  2832. $("#messageContent").html(text);
  2833. $("#messageButton").off("click").on("click", function (t) {
  2834. $("#messageModal").modal("hide");
  2835. if (paramsType == 13) {
  2836. $("#" + inputId).val(null);
  2837. $("#diagnoseTags").html(null);
  2838. }
  2839. extracted(paramsType, appeal, inputId);
  2840. });
  2841. $("#cancelButton").off("click");
  2842. } else {
  2843. extracted(paramsType, appeal, inputId);
  2844. }
  2845. $.ajax({
  2846. type: "GET",
  2847. url: '/thmz/increaseTcCommonParamsNumber?id=' + id,
  2848. contentType: "application/json;charset=UTF-8",
  2849. dataType: "json",
  2850. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2851. success: function (res) {
  2852. }
  2853. });
  2854. }
  2855. /**
  2856. * 初始嘱托下拉选
  2857. */
  2858. function initInstructionSelect() {
  2859. //西药医嘱
  2860. $.ajax({
  2861. type: "GET",
  2862. url: '/thmz/getMzZdInstructionByType?instructionType=0',
  2863. contentType: "application/json;charset=UTF-8",
  2864. dataType: "json",
  2865. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2866. success: function (res) {
  2867. if (res == '401' || res == 401) {
  2868. window.location.href = '/thmz/login/view'
  2869. return;
  2870. }
  2871. if (res.code == 0) {
  2872. res.data.forEach(function (item, index) {
  2873. var html = '<option value="' + item.code + '">' + item.instructionText + '</option>';
  2874. $('#medicalAdvice').append(html);
  2875. });
  2876. $('#medicalAdvice').selectpicker('refresh');
  2877. } else {
  2878. errorMesage(res);
  2879. }
  2880. }
  2881. });
  2882. //中药医嘱
  2883. $.ajax({
  2884. type: "GET",
  2885. url: '/thmz/getMzZdInstructionByType?instructionType=1',
  2886. contentType: "application/json;charset=UTF-8",
  2887. dataType: "json",
  2888. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2889. success: function (res) {
  2890. if (res == '401' || res == 401) {
  2891. window.location.href = '/thmz/login/view'
  2892. return;
  2893. }
  2894. if (res.code == 0) {
  2895. res.data.forEach(function (item, index) {
  2896. var html = '<option value="' + item.code + '">' + item.instructionText.trim() + '</option>';
  2897. $('#zyInstruction').append(html);
  2898. });
  2899. $('#zyInstruction').selectpicker('refresh');
  2900. } else {
  2901. errorMesage(res);
  2902. }
  2903. }
  2904. });
  2905. }
  2906. /**
  2907. * 设置下拉选的尺寸
  2908. */
  2909. function setSelectSize() {
  2910. $(".selectpicker").selectpicker({
  2911. dropuAuto: false,
  2912. size: 10
  2913. });
  2914. //select 从后台加载数据,并保留之前选择的内容
  2915. dynamicSelectWithOri("editZd", '/thmz/getAllZdIcdCommonParams?commonParams=');
  2916. }
  2917. /**
  2918. * 初始化性别下拉选
  2919. */
  2920. function initGenderSelect() {
  2921. var gender = '<option value="1">男</option><option value="2">女</option><option value="0">未知</option>';
  2922. $('#rapidAcceptsUserGender').html(gender);
  2923. $('#rapidAcceptsUserGender').selectpicker('refresh');
  2924. $('#editUserGender').html(gender);
  2925. $('#editUserGender').selectpicker('refresh');
  2926. //医疗范文状态
  2927. var templateStatus = '<option value="0">启用</option><option value="1">停用</option>';
  2928. $('#templateStatus').html(templateStatus);
  2929. $('#templateStatus').selectpicker('refresh');
  2930. }
  2931. /**
  2932. * 初始化中药类型下拉选
  2933. */
  2934. function initZyClassTypeSelect() {
  2935. var gender = '<option value="81">普通</option><option value="82">颗粒剂</option>';
  2936. $('#zyClassType').html(gender);
  2937. $('#zyClassType').selectpicker('refresh');
  2938. //$('#zyClassType').selectpicker('val', "81");
  2939. // $('#zyClassType').selectpicker('refresh');
  2940. }
  2941. /**
  2942. * 初始化皮试结果下拉选
  2943. * @param categoriesFlag 0 口服 2 注射针剂
  2944. */
  2945. function initTryResultSelect(categoriesFlag) {
  2946. var tryResult = '';
  2947. if (categoriesFlag == 2 || categoriesFlag == "2") {
  2948. tryResult += '<option value="100">皮试</option>';
  2949. }
  2950. tryResult += '<option value="0">阴性</option><option value="3">免试</option>';
  2951. //var tryResult = '<option value="100">皮试</option><option value="0">阴性</option><option value="3">免试</option>';
  2952. $('#tryResult').html(tryResult);
  2953. $('#tryResult').selectpicker('refresh');
  2954. //口服药选择皮试结果
  2955. $("#tryResult").parent().parent().parent().removeClass("hide").addClass("in");
  2956. }
  2957. /**
  2958. * 初始化病人身份类别下拉选
  2959. */
  2960. function initResponceTypeSelect() {
  2961. $.ajax({
  2962. type: "GET",
  2963. url: '/thmz/getMzResponceType',
  2964. contentType: "application/json;charset=UTF-8",
  2965. dataType: "json",
  2966. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2967. success: function (res) {
  2968. if (res == '401' || res == 401) {
  2969. window.location.href = '/thmz/login/view'
  2970. return;
  2971. }
  2972. if (res.code == 0) {
  2973. res.data.forEach(function (item, index) {
  2974. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  2975. $('#patientsNature').append(html);
  2976. $('#editUserPatientsNature').append(html);
  2977. // $('#responeTypeBeHospitalized').append(html);
  2978. });
  2979. $('#patientsNature').selectpicker('refresh');
  2980. $('#editUserPatientsNature').selectpicker('refresh');
  2981. } else {
  2982. errorMesage(res);
  2983. }
  2984. }
  2985. });
  2986. }
  2987. /**
  2988. * 所有的入院状态
  2989. */
  2990. function iniAdmissStatus() {
  2991. $.ajax({
  2992. type: "GET",
  2993. url: '/thmz/getAdmissStatus',
  2994. dataType: "json",
  2995. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2996. success: function (res) {
  2997. if (res == '401' || res == 401) {
  2998. window.location.href = '/thmz/login/view'
  2999. return;
  3000. }
  3001. var html = '';
  3002. $.each(res.data, function (commentIndex, comment) {
  3003. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  3004. });
  3005. $('#admissStatus').empty();
  3006. $('#admissStatus').html(html);
  3007. $('#admissStatus').selectpicker('destroy').selectpicker('refresh');
  3008. }
  3009. });
  3010. }
  3011. /**
  3012. * 入院登记的病区列表
  3013. */
  3014. function initListDeptSelect() {
  3015. //科室列表
  3016. $.ajax({
  3017. type: "GET",
  3018. url: '/thmz/allInpatientWard',
  3019. dataType: "json",
  3020. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3021. success: function (data) {
  3022. if (data == '401' || data == 401) {
  3023. window.location.href = '/thmz/login/view'
  3024. return;
  3025. }
  3026. var html = '';
  3027. $.each(data.data, function (commentIndex, comment) {
  3028. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';
  3029. });
  3030. $('#inpatientWardBeHospitalized').empty();
  3031. $('#inpatientWardBeHospitalized').html(html);
  3032. $('#inpatientWardBeHospitalized').selectpicker('refresh');
  3033. initSmallDeptByDept();
  3034. }
  3035. });
  3036. }
  3037. /**
  3038. * 小科室列表
  3039. */
  3040. function initSmallDeptByDept() {
  3041. //小科室列表
  3042. $.ajax({
  3043. type: "GET",
  3044. url: '/thmz/getSmallDeptByDept?code=' + $('#inpatientWardBeHospitalized').val(),
  3045. dataType: "json",
  3046. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3047. success: function (res) {
  3048. if (res == '401' || res == 401) {
  3049. window.location.href = '/thmz/login/view'
  3050. return;
  3051. }
  3052. var html = '';
  3053. $.each(res.data, function (commentIndex, comment) {
  3054. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  3055. });
  3056. $('#smallWardBeHospitalized').empty();
  3057. $('#smallWardBeHospitalized').html(html);
  3058. $('#smallWardBeHospitalized').selectpicker('destroy').selectpicker('refresh');
  3059. }
  3060. });
  3061. //病床数
  3062. $.ajax({
  3063. type: "GET",
  3064. url: '/thmz/getBedStatusNumByDept?code=' + $('#inpatientWardBeHospitalized').val(),
  3065. dataType: "json",
  3066. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3067. success: function (res) {
  3068. if (res == '401' || res == 401) {
  3069. window.location.href = '/thmz/login/view'
  3070. return;
  3071. }
  3072. if (res.code == 0) {
  3073. var data = res.data;
  3074. if (data == null) {
  3075. $("#totalBedNum").val(0);
  3076. $("#freeBedNum").val(0);
  3077. $("#occupationBedNum").val(0);
  3078. } else {
  3079. $("#totalBedNum").val(data.total);
  3080. $("#freeBedNum").val(data.free);
  3081. $("#occupationBedNum").val(data.occupation);
  3082. }
  3083. } else {
  3084. errorMesage(res);
  3085. }
  3086. }
  3087. });
  3088. }
  3089. /**
  3090. * 初始化门诊统筹下拉选
  3091. */
  3092. function initMztcSelect() {
  3093. var selectHtml = '<option value="0">否</option><option value="1">是</option>';
  3094. $('#zgmztczf').html(selectHtml);
  3095. $('#zgmztczf').selectpicker('refresh');
  3096. $('#grzhzf').html(selectHtml);
  3097. $('#grzhzf').selectpicker('refresh');
  3098. }
  3099. //
  3100. // /**
  3101. // * 初始化诊断下拉选
  3102. // */
  3103. // function initIcdSelect() {
  3104. // var icdCodeInputBeHospitalized = $("#icdCodeInputBeHospitalized").val()
  3105. // $.ajax({
  3106. // type: "GET",
  3107. // url: '/thmz/getTCommonParamsByParamsType?paramsType=4&commonParams=' + icdCodeInputBeHospitalized + '&pageSize=100',
  3108. // contentType: "application/json;charset=UTF-8",
  3109. // dataType: "json",
  3110. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3111. // success: function (res) {
  3112. // if (res == '401' || res == 401) {
  3113. // window.location.href = '/thmz/login/view'
  3114. // return;
  3115. // }
  3116. // var html = '';
  3117. // if (res.code == 0) {
  3118. // if (res.data != null && res.data.length > 0) {
  3119. // var html = '';
  3120. // for (var i = 0; i < res.data.length; i++) {
  3121. // html += '<option value="' + res.data[i].paramsCode + '">' + res.data[i].paramsName + '(' + res.data[i].paramsCode + ')</option>';
  3122. // }
  3123. // $('#icdCodeBeHospitalized').empty();
  3124. // $('#icdCodeBeHospitalized').html(html);
  3125. // $('#icdCodeBeHospitalized').selectpicker('destroy').selectpicker('refresh');
  3126. // $('#icdCodeBeHospitalized').parent().addClass("open");
  3127. // $('#icdCodeBeHospitalized').next().addClass("hide");
  3128. // $('#icdCodeBeHospitalized').next().next().css("margin-top", "-34px");
  3129. // }
  3130. // } else {
  3131. // errorMesage(res);
  3132. // }
  3133. // }
  3134. // });
  3135. // }
  3136. //
  3137. // /**
  3138. // * 设置诊断内容
  3139. // */
  3140. // function setIcdText() {
  3141. // var icdCodeBeHospitalized = $('#icdCodeBeHospitalized option:selected').text();
  3142. // if (icdCodeBeHospitalized != null) {
  3143. // var icdText = icdCodeBeHospitalized.substring(0, icdCodeBeHospitalized.indexOf("("));
  3144. // $("#icdTextBeHospitalized").val(icdText);
  3145. // $("#icdCodeInputBeHospitalized").val($('#icdCodeBeHospitalized').val());
  3146. // $("#icdTextBeHospitalized").attr("title", icdText);
  3147. // } else {
  3148. // $("#icdTextBeHospitalized").val("");
  3149. // $("#icdCodeInputBeHospitalized").val("");
  3150. // $("#icdTextBeHospitalized").attr("title", "");
  3151. // }
  3152. // $('#icdCodeBeHospitalized').parent().addClass("hide");
  3153. // }
  3154. /**
  3155. * 初始化医疗范文范围下拉选
  3156. * @param templateTypeId
  3157. */
  3158. function initTemplateTypeSelect(templateTypeId) {
  3159. $.ajax({
  3160. type: "GET",
  3161. url: '/thmz/getTemplateTypes',
  3162. contentType: "application/json;charset=UTF-8",
  3163. dataType: "json",
  3164. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3165. success: function (res) {
  3166. if (res == '401' || res == 401) {
  3167. window.location.href = '/thmz/login/view'
  3168. return;
  3169. }
  3170. if (res.code == 0) {
  3171. res.data.forEach(function (item) {
  3172. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  3173. $('#' + templateTypeId).append(html);
  3174. });
  3175. $('#' + templateTypeId).selectpicker('refresh');
  3176. // $('#'+templateTypeId).selectpicker('val', "0");
  3177. // $('#'+templateTypeId).selectpicker('refresh');
  3178. } else {
  3179. errorMesage(res);
  3180. }
  3181. }
  3182. });
  3183. }
  3184. /**
  3185. * 初始化医疗范文类型下拉选
  3186. * @param templateKindTypeId
  3187. */
  3188. function initTemplateKindTypeSelect(templateKindTypeId) {
  3189. $.ajax({
  3190. type: "GET",
  3191. url: '/thmz/getTemplateKindTypes',
  3192. contentType: "application/json;charset=UTF-8",
  3193. dataType: "json",
  3194. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3195. success: function (res) {
  3196. if (res == '401' || res == 401) {
  3197. window.location.href = '/thmz/login/view'
  3198. return;
  3199. }
  3200. if (res.code == 0) {
  3201. res.data.forEach(function (item) {
  3202. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  3203. $('#' + templateKindTypeId).append(html);
  3204. });
  3205. $('#' + templateKindTypeId).selectpicker('refresh');
  3206. } else {
  3207. errorMesage(res);
  3208. }
  3209. }
  3210. });
  3211. }
  3212. /**
  3213. * 初始频次下拉选
  3214. * @param id
  3215. * @param async 是否是异步 true 异步 false 同步
  3216. */
  3217. function initOrderFrequencys(id, async) {
  3218. $.ajax({
  3219. type: "GET",
  3220. url: '/thmz/getXyOrderFrequencys',
  3221. dataType: "json",
  3222. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3223. async: async,
  3224. success: function (res) {
  3225. if (res == '401' || res == 401) {
  3226. window.location.href = '/thmz/login/view'
  3227. return;
  3228. }
  3229. var html = '';
  3230. $.each(res.data, function (commentIndex, comment) {
  3231. html += '<option value="' + comment.code + '" desc="' + comment.times + '">' + comment.name + '(' + comment.code + ')' + '</option>';
  3232. });
  3233. $('#' + id).empty();
  3234. $('#' + id).html(html);
  3235. $('#' + id).selectpicker('refresh');
  3236. }
  3237. });
  3238. }
  3239. /**
  3240. * 初始中药频次下拉选
  3241. * @param id
  3242. * @param async 是否是异步 true 异步 false 同步
  3243. */
  3244. function initZyOrderFrequencys(id, async) {
  3245. $.ajax({
  3246. type: "GET",
  3247. url: '/thmz/getZyOrderFrequencys',
  3248. dataType: "json",
  3249. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3250. async: async,
  3251. success: function (res) {
  3252. if (res == '401' || res == 401) {
  3253. window.location.href = '/thmz/login/view'
  3254. return;
  3255. }
  3256. var html = '';
  3257. $.each(res.data, function (commentIndex, comment) {
  3258. html += '<option value="' + comment.code + '" desc="' + comment.times + '">' + comment.name + '(' + comment.code + ')' + '</option>';
  3259. });
  3260. $('#' + id).empty();
  3261. $('#' + id).html(html);
  3262. $('#' + id).selectpicker('refresh');
  3263. }
  3264. });
  3265. }
  3266. /**
  3267. * 初始中药服用说明
  3268. */
  3269. function initAllMzYshZdFysm() {
  3270. $.ajax({
  3271. type: "GET",
  3272. url: '/thmz/getAllMzYshZdFysm',
  3273. dataType: "json",
  3274. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3275. async: false,
  3276. success: function (res) {
  3277. if (res == '401' || res == 401) {
  3278. window.location.href = '/thmz/login/view'
  3279. return;
  3280. }
  3281. var html = '';
  3282. $.each(res.data, function (commentIndex, comment) {
  3283. if (comment.name.indexOf(",") < 0) {
  3284. //过滤组合的用法
  3285. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  3286. }
  3287. });
  3288. $('.useType').empty();
  3289. $('.useType').html(html);
  3290. $('.useType').selectpicker('refresh');
  3291. $('.useType').selectpicker('val', "2");
  3292. $('.useType').selectpicker('refresh');
  3293. }
  3294. });
  3295. }
  3296. /**
  3297. * 初始用药方式下拉选
  3298. */
  3299. function initSupplyTypes() {
  3300. $.ajax({
  3301. type: "GET",
  3302. url: '/thmz/getSupplyTypes',
  3303. dataType: "json",
  3304. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3305. success: function (res) {
  3306. if (res == '401' || res == 401) {
  3307. window.location.href = '/thmz/login/view'
  3308. return;
  3309. }
  3310. var html = '';
  3311. $.each(res.data, function (commentIndex, comment) {
  3312. if (comment.supplyOcc === "71") {
  3313. html += '<option value="' + comment.supplyCode + '">' + comment.supplyName + '[' + comment.pyCode + ']' + '</option>';
  3314. }
  3315. });
  3316. $('#supplyType').empty();
  3317. $('#supplyType').html(html);
  3318. $('#supplyType').selectpicker('refresh');
  3319. }
  3320. });
  3321. }
  3322. /**
  3323. * 初始煎药方式下拉选
  3324. * @param async 是否是异步 true 异步 false 同步
  3325. */
  3326. function initZySupplyTypes(id, async) {
  3327. setSelectSize();
  3328. $.ajax({
  3329. type: "GET",
  3330. url: '/thmz/getSupplyTypes',
  3331. dataType: "json",
  3332. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3333. async: async,
  3334. success: function (res) {
  3335. if (res == '401' || res == 401) {
  3336. window.location.href = '/thmz/login/view'
  3337. return;
  3338. }
  3339. var html = '';
  3340. $.each(res.data, function (commentIndex, comment) {
  3341. if (comment.supplyOcc === "81") {
  3342. // html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  3343. html += '<option value="' + comment.supplyCode + '">' + comment.supplyName + '[' + comment.pyCode + ']' + '</option>';
  3344. }
  3345. });
  3346. $('#' + id).empty();
  3347. $('#' + id).html(html);
  3348. $('#' + id).selectpicker('refresh');
  3349. }
  3350. });
  3351. }
  3352. /**
  3353. * 初始查检查部位
  3354. */
  3355. function initYshPart() {
  3356. setSelectSize();
  3357. $.ajax({
  3358. type: "GET",
  3359. url: '/thmz/getYshPart',
  3360. dataType: "json",
  3361. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3362. success: function (res) {
  3363. if (res == '401' || res == 401) {
  3364. window.location.href = '/thmz/login/view'
  3365. return;
  3366. }
  3367. var html = '';
  3368. $.each(res.data, function (commentIndex, comment) {
  3369. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')' + '</option>';
  3370. });
  3371. $('#yshPart').empty();
  3372. $('#yshPart').html(html);
  3373. $('#yshPart').selectpicker('refresh');
  3374. }
  3375. });
  3376. }
  3377. /**
  3378. * 初始化验物下拉选
  3379. */
  3380. function initJyZdSample() {
  3381. setSelectSize();
  3382. $.ajax({
  3383. type: "GET",
  3384. url: '/thmz/getJyZdSample',
  3385. dataType: "json",
  3386. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3387. success: function (res) {
  3388. if (res == '401' || res == 401) {
  3389. window.location.href = '/thmz/login/view'
  3390. return;
  3391. }
  3392. var html = '';
  3393. $.each(res.data, function (commentIndex, comment) {
  3394. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')' + '</option>';
  3395. });
  3396. $('#jyZdSample').empty();
  3397. $('#jyZdSample').html(html);
  3398. $('#jyZdSample').selectpicker('refresh');
  3399. }
  3400. });
  3401. }
  3402. /**
  3403. * 保存当前药品到右边处方区域
  3404. * @param index 0 西药 1中药 2 诊疗和社备
  3405. */
  3406. function saveMedicine(index) {
  3407. if (index == 0) {
  3408. // //每个处方不能超过5个药品
  3409. // var tableId = $("#xyTab li.active").find("a").attr("href");
  3410. // var childrens = $(tableId).find("div:eq(0)").children().length;
  3411. // if (childrens === 5) {
  3412. // $("#messageModal").modal();
  3413. // $("#messageContent").html("单张处方最多只能开具5个药品,是否需要新增处方?");
  3414. // $("#messageButton").off("click").on("click", function (t) {
  3415. // $("#messageModal").modal("hide");
  3416. // refreshNavTabs(index);
  3417. // saveWesternMedicine();
  3418. // });
  3419. // } else {
  3420. // saveWesternMedicine();
  3421. // }
  3422. saveWesternMedicine(true);
  3423. } else if (index == 1) {
  3424. saveChineseMedicine(true);
  3425. }
  3426. }
  3427. /**
  3428. * 保存当前药品到右边处方区域 西药
  3429. * calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  3430. */
  3431. function saveWesternMedicine(calculateTotalAmountFlag) {
  3432. //当前处方选项卡下标
  3433. var xyTabIndex = $("#xyTab li.active").index();
  3434. //组号
  3435. var groupId = $("#groupId").val();
  3436. if (gropuIdAndOrderNoMap == null) {
  3437. gropuIdAndOrderNoMap = new Map();
  3438. }
  3439. var exitIndex = gropuIdAndOrderNoMap.get(groupId);
  3440. if (exitIndex == null) {
  3441. exitIndex = xyTabIndex;
  3442. gropuIdAndOrderNoMap.put(groupId, xyTabIndex);
  3443. }
  3444. if (xyTabIndex != exitIndex) {
  3445. var westernMedicineUpdateFlag = $("#western_medicine_update_flag").val();
  3446. var westernMedicineOriGroupId = $("#western_medicine_ori_group_id").val();
  3447. //非修改组号的情况下就需要切换组号
  3448. if (!((westernMedicineUpdateFlag == true || westernMedicineUpdateFlag == "true") && westernMedicineOriGroupId != groupId)) {
  3449. groupId = parseInt($("#groupId > option:last").val());
  3450. $("#groupId").selectpicker('val', groupId);
  3451. $('#groupId').selectpicker('refresh');
  3452. gropuIdAndOrderNoMap.put(groupId, xyTabIndex);
  3453. appendGroupOrder();
  3454. }
  3455. warningMesageSimaple("同一组药必须出现在同一个处方中,当前组号已经被其他处方使用,系统已自动为您重新分配组号!");
  3456. //return;
  3457. }
  3458. //药品名称
  3459. var westernMedicineNamme = $("#western_medicine_name").val();
  3460. //当前药品编码
  3461. var currentCode = $("#western_medicine_current_code").val();
  3462. //当前药品规格
  3463. var currentSerial = $("#western_medicine_current_serial").val();
  3464. //当前药房编码
  3465. var currentGroupNo = $("#current_groupNo").val();
  3466. //用法编码
  3467. var supplyType = $("#supplyType").val();
  3468. //用法描述
  3469. var supplyTypeText = $('#supplyType option:selected').text();
  3470. supplyTypeText = supplyTypeText.substring(0, supplyTypeText.indexOf("["));
  3471. //药品默认单次使用剂量
  3472. var drugWinDb = $("#drugWinDb").val();
  3473. //处方实际单次使用剂量
  3474. var drugWin = $("#drugWin").val();
  3475. //剂量单位
  3476. var drugWinUnit = $('#drugWinUnit option:selected').text();
  3477. //drugWinUnit = drugWinUnit.substring(0, drugWinUnit.indexOf("("));
  3478. //天数
  3479. var dayNum = $("#dayNum").val();
  3480. //频次编码
  3481. var orderFrequency = $("#orderFrequency").val();
  3482. //频次描述
  3483. var orderFrequencyText = $('#orderFrequency option:selected').text();
  3484. orderFrequencyText = orderFrequencyText.substring(0, orderFrequencyText.indexOf("("));
  3485. //总量
  3486. var gross = $("#gross").val();
  3487. //包装单位
  3488. var packUnit = $("#packUnit").val();
  3489. if (packUnit == null) {
  3490. packUnit = "";
  3491. }
  3492. //医嘱码
  3493. var medicalAdvice = $("#medicalAdvice").val();
  3494. //医嘱内容
  3495. var medicalAdviceText = $('#medicalAdvice option:selected').text();
  3496. medicalAdviceText = medicalAdviceText.substring(0, medicalAdviceText.indexOf("("));
  3497. //金额
  3498. var totalRetprice = parseFloat($("#totalRetprice").val());
  3499. //单价
  3500. var packRetprice = $("#packRetprice").val();
  3501. //皮试结果
  3502. var tryResult = $("#tryResult").val();
  3503. //药品大类标志
  3504. var categoriesFlag = $("#categoriesFlag").val();
  3505. if (currentCode == null || currentCode == '') {
  3506. errorMesageSimaple("未选择任何药品!");
  3507. return;
  3508. }
  3509. if (currentGroupNo != '91') {
  3510. if (supplyType == null || supplyType == "") {
  3511. errorMesageSimaple("用法为空!");
  3512. return;
  3513. }
  3514. if (drugWin == null || drugWin == "") {
  3515. errorMesageSimaple("剂量为空!");
  3516. return;
  3517. }
  3518. if (dayNum == null || dayNum == "") {
  3519. errorMesageSimaple("天数为空!");
  3520. return;
  3521. }
  3522. if (orderFrequency == null || orderFrequency == "") {
  3523. errorMesageSimaple("频次为空!");
  3524. return;
  3525. }
  3526. }
  3527. if (gross == null || gross == "") {
  3528. errorMesageSimaple("总量为空!");
  3529. return;
  3530. }
  3531. var manufactoryName = $("#manufactoryName").val();
  3532. var html = '<div class="form-group">';
  3533. html += groupId + '.<span style="margin-left: 5px"></span>';
  3534. html += westernMedicineNamme;
  3535. if (manufactoryName != null && manufactoryName != 'null' && manufactoryName != "") {
  3536. html += "(" + manufactoryName + ")"
  3537. }
  3538. html += '&nbsp;&nbsp;&nbsp;&nbsp;';
  3539. html += $("#specification").val();
  3540. html += '&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;';
  3541. //html += drugWinDb + drugWinUnit + ' 共';
  3542. html += gross + packUnit + " " + '<br/><span style="margin-left: 15px"></span>';
  3543. html += '用法:' + supplyTypeText + ' ';
  3544. html += drugWin + drugWinUnit + ' ';
  3545. html += '频次:' + orderFrequencyText + ' ';
  3546. html += dayNum + '天 ';
  3547. if (tryResult != null && tryResult != 'null' && tryResult != "") {
  3548. if (tryResult == "100" || tryResult == 100) {
  3549. html += '皮试 ';
  3550. } else {
  3551. html += '皮试结果: ' + $('#tryResult option:selected').text();
  3552. }
  3553. }
  3554. if (medicalAdvice != null && medicalAdvice != '') {
  3555. html += '医嘱:' + medicalAdviceText;
  3556. }
  3557. 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>';
  3558. 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>';
  3559. 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>';
  3560. 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>';
  3561. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  3562. html += '<input type="hidden" class="temporary_items_serial" value="' + currentSerial + '"/>';
  3563. html += '<input type="hidden" class="temporary_items_amount" value="' + totalRetprice + '"/>';
  3564. html += '<input type="hidden" class="temporary_items_groupId" value="' + groupId + '"/>';
  3565. html += '<input type="hidden" class="temporary_items_westernMedicineNamme" value="' + westernMedicineNamme + '"/>';
  3566. html += '<input type="hidden" class="temporary_items_drugWinDb" value="' + drugWinDb + '"/>';
  3567. html += '<input type="hidden" class="temporary_items_drugWin" value="' + drugWin + '"/>';
  3568. html += '<input type="hidden" class="temporary_items_drugWinUnit" value="' + $("#drugWinUnit").val() + '"/>';
  3569. html += '<input type="hidden" class="temporary_items_gross" value="' + gross + '"/>';
  3570. html += '<input type="hidden" class="temporary_items_packUnit" value="' + packUnit + '"/>';
  3571. html += '<input type="hidden" class="temporary_items_supplyType" value="' + supplyType + '"/>';
  3572. html += '<input type="hidden" class="temporary_items_orderFrequency" value="' + orderFrequency + '"/>';
  3573. html += '<input type="hidden" class="temporary_items_dayNum" value="' + dayNum + '"/>';
  3574. html += '<input type="hidden" class="temporary_items_medicalAdvice" value="' + medicalAdvice + '"/>';
  3575. html += '<input type="hidden" class="temporary_items_medicalAdviceText" value="' + medicalAdviceText + '"/>';
  3576. html += '<input type="hidden" class="temporary_items_packRetprice" value="' + packRetprice + '"/>';
  3577. html += '<input type="hidden" class="temporary_items_tryResult" value="' + tryResult + '"/>';
  3578. html += '<input type="hidden" class="temporary_items_currentGroupNo" value="' + currentGroupNo + '"/>';
  3579. html += '<input type="hidden" class="temporary_items_categoriesFlag" value="' + categoriesFlag + '"/>';
  3580. html += '</div>';
  3581. var tableId = $("#xyTab li.active").find("a").attr("href");
  3582. //是新增药品还是编辑 true 修改 默认false
  3583. var updateFlag = $("#western_medicine_update_flag").val();
  3584. if (updateFlag == undefined || updateFlag == null) {
  3585. updateFlag = false;
  3586. }
  3587. // //原药品金额 如果是修改则需要设置
  3588. // var temporaryItemsAmount = 0;
  3589. //当前需要被移除元素的下个兄弟节点
  3590. var nextObj = null;
  3591. //当前修改的药品是不是最后一个
  3592. var isLast = false;
  3593. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  3594. if (formGroups != null && formGroups.length > 0) {
  3595. //如果是修改,需要减去原来的费用
  3596. if (updateFlag == "true" || updateFlag == true) {
  3597. //药品有可能会修改,所以,判断的时候要用原药品编码
  3598. var updateOriCode = $("#update_ori_code").val();
  3599. //规格有可能会修改,所以,判断的时候要用原规格
  3600. var updateOriSerial = $("#update_ori_serial").val();
  3601. //组号有可能会修改,所以,判断的时候要用原组号
  3602. var westernMedicineOriGroupId = $("#western_medicine_ori_group_id").val();
  3603. for (var i = 0; i < formGroups.length; i++) {
  3604. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  3605. var temporaryItemsSerial = $(formGroups[i]).find("input.temporary_items_serial").val();
  3606. var temporaryItemsGroupId = $(formGroups[i]).find("input.temporary_items_groupId").val();
  3607. if (temporaryItemsCode === updateOriCode && temporaryItemsSerial === updateOriSerial && temporaryItemsGroupId == westernMedicineOriGroupId) {
  3608. //temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  3609. if (formGroups.length > 1) {
  3610. nextObj = $(formGroups[i]).next();
  3611. }
  3612. isLast = (i + 1) === formGroups.length;
  3613. $(formGroups[i]).remove();
  3614. break;
  3615. }
  3616. }
  3617. } else {
  3618. //因为药品可以换组号,要保证相同组号的在一起
  3619. for (var i = 0; i < formGroups.length; i++) {
  3620. var temporaryItemsGroupId = parseInt($(formGroups[i]).find("input.temporary_items_groupId").val());
  3621. //如果当前的组号小与遍历到的组号,说明是原组号的下一个兄弟节点,新的药品插入到兄弟节点前就可以了
  3622. if (temporaryItemsGroupId > groupId) {
  3623. nextObj = $(formGroups[i]);
  3624. break;
  3625. }
  3626. }
  3627. }
  3628. }
  3629. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  3630. if (nextObj == null || isLast) {
  3631. $(tableId).find("div:eq(0)").append(html);
  3632. } else {
  3633. $(nextObj).before(html);
  3634. }
  3635. //设置当前处方金额
  3636. //calculateCfAmount(tableId, totalRetprice, temporaryItemsAmount, 0, 0);
  3637. if (calculateTotalAmountFlag) {
  3638. //设置总金额
  3639. calculateTotalAmount();
  3640. resetGroupIdSelect()
  3641. }
  3642. //判断当前组号是不是最后一个,是最后一个组号,就需要新增组号
  3643. var groupIdLast = $("#groupId option:last-child").text();
  3644. if (groupId === groupIdLast) {
  3645. appendGroupOrder();
  3646. }
  3647. //设置药品的用法,频次,天数
  3648. var map = groupIdMap.get(groupId);
  3649. if (map == null) {
  3650. map = new Map();
  3651. map.put("supplyType", supplyType);
  3652. map.put("orderFrequency", orderFrequency);
  3653. map.put("dayNum", dayNum);
  3654. groupIdMap.put(groupId, map);
  3655. }
  3656. //设置当前药品的品类
  3657. $(tableId).find("input.current_groupNo").val($("#current_groupNo").val());
  3658. clearWesternMedicine(false);
  3659. }
  3660. /**
  3661. * 上移
  3662. * @param obj
  3663. */
  3664. function arrowUp(obj) {
  3665. var parentObject = $(obj).parent();
  3666. if ($(parentObject).prev() == null) {
  3667. return;
  3668. }
  3669. //当前元素的序号
  3670. var thisJcjyItemGroupId = null;
  3671. //前一个兄弟节点的序号
  3672. var prevJcjyItemGroupId = null;
  3673. //当是项目时有序号,进行序号调整
  3674. if ($(parentObject).find("span.jcjyItemGroupId") != null) {
  3675. thisJcjyItemGroupId = $(parentObject).find("span.jcjyItemGroupId").html();
  3676. prevJcjyItemGroupId = $(parentObject).prev().find("span.jcjyItemGroupId").html();
  3677. $(parentObject).find("span.jcjyItemGroupId").html(prevJcjyItemGroupId);
  3678. $(parentObject).prev().find("span.jcjyItemGroupId").html(thisJcjyItemGroupId);
  3679. }
  3680. $(parentObject).prev().before($(parentObject));
  3681. }
  3682. /**
  3683. * 下移
  3684. * @param obj
  3685. */
  3686. function arrowDown(obj) {
  3687. var parentObject = $(obj).parent();
  3688. if ($(parentObject).next() == null) {
  3689. return;
  3690. }
  3691. //当前元素的序号
  3692. var thisJcjyItemGroupId = null;
  3693. //后一个兄弟节点的序号
  3694. var afterJcjyItemGroupId = null;
  3695. //当是项目时有序号,进行序号调整
  3696. if ($(parentObject).find("span.jcjyItemGroupId") != null) {
  3697. thisJcjyItemGroupId = $(parentObject).find("span.jcjyItemGroupId").html();
  3698. afterJcjyItemGroupId = $(parentObject).after().find("span.jcjyItemGroupId").html();
  3699. $(parentObject).find("span.jcjyItemGroupId").html(afterJcjyItemGroupId);
  3700. $(parentObject).after().find("span.jcjyItemGroupId").html(thisJcjyItemGroupId);
  3701. }
  3702. $(parentObject).next().after($(parentObject));
  3703. }
  3704. /**
  3705. * 修改西药
  3706. * @param obj
  3707. */
  3708. function editWesternMedicine(obj) {
  3709. clearWesternMedicine(true);
  3710. //是新增药品还是编辑 true 修改 默认false
  3711. $("#western_medicine_update_flag").val(true);
  3712. var parentObject = $(obj).parent();
  3713. //组号
  3714. $("#groupId").val($(parentObject).find("input.temporary_items_groupId").val());
  3715. //组号有可能会修改,所以,判断的时候要用原组号
  3716. $("#western_medicine_ori_group_id").val($(parentObject).find("input.temporary_items_groupId").val());
  3717. $('#groupId').selectpicker('refresh');
  3718. //药品名称
  3719. $("#western_medicine_name").val($(parentObject).find("input.temporary_items_westernMedicineNamme").val());
  3720. var code = $(parentObject).find("input.temporary_items_code").val();
  3721. var serial = $(parentObject).find("input.temporary_items_serial").val();
  3722. //当前药品编码
  3723. $("#western_medicine_current_code").val(code);
  3724. //当前药品规格
  3725. $("#western_medicine_current_serial").val(serial);
  3726. //当前修改药品原始编码
  3727. $("#update_ori_code").val(code);
  3728. //当前修改的药品原始规格
  3729. $("#update_ori_serial").val(serial);
  3730. //用法编码
  3731. $("#supplyType").val($(parentObject).find("input.temporary_items_supplyType").val());
  3732. $('#supplyType').selectpicker('refresh');
  3733. //药品默认单次使用剂量
  3734. $("#drugWinDb").val($(parentObject).find("input.temporary_items_drugWinDb").val());
  3735. //处方实际单次使用剂量
  3736. $("#drugWin").val($(parentObject).find("input.temporary_items_drugWin").val());
  3737. //天数
  3738. $("#dayNum").val($(parentObject).find("input.temporary_items_dayNum").val());
  3739. $('#dayNum').selectpicker('refresh');
  3740. //频次编码
  3741. $("#orderFrequency").val($(parentObject).find("input.temporary_items_orderFrequency").val());
  3742. $('#orderFrequency').selectpicker('refresh');
  3743. //总量
  3744. $("#gross").val($(parentObject).find("input.temporary_items_gross").val());
  3745. //医嘱
  3746. $("#medicalAdvice").val($(parentObject).find("input.temporary_items_medicalAdvice").val());
  3747. $('#medicalAdvice').selectpicker('refresh');
  3748. //金额
  3749. $("#totalRetprice").val($(parentObject).find("input.temporary_items_amount").val());
  3750. //单价
  3751. $("#packRetprice").val($(parentObject).find("input.temporary_items_packRetprice").val());
  3752. //皮试结果
  3753. var tryResult = $(parentObject).find("input.temporary_items_tryResult").val();
  3754. //设置当前药品类型
  3755. $("#current_groupNo").val($(parentObject).find("input.temporary_items_currentGroupNo").val());
  3756. //设置当前药品大类
  3757. $("#categoriesFlag").val($(parentObject).find("input.temporary_items_categoriesFlag").val());
  3758. $.ajax({
  3759. type: "GET",
  3760. url: '/thmz/getYpZdDictByCodeAndSerial?code=' + code + "&serial=" + serial,
  3761. contentType: "application/json;charset=UTF-8",
  3762. dataType: "json",
  3763. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3764. success: function (res) {
  3765. if (res == '401' || res == 401) {
  3766. window.location.href = '/thmz/login/view'
  3767. return;
  3768. }
  3769. if (res.code == 0) {
  3770. if (res.data != null) {
  3771. var drugWinHtml = '';
  3772. if (res.data.weight != null) {
  3773. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  3774. $("#drugWin").val(res.data.weight);
  3775. $("#drugWinDb").val(res.data.weight);
  3776. }
  3777. drugWinHtml = '<option value="' + res.data.weighUnit + '" desc="' + res.data.weight + '">' + res.data.weighUnitDesc + '</option>';
  3778. }
  3779. if (res.data.volum != null) {
  3780. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  3781. $("#drugWin").val(res.data.volum);
  3782. $("#drugWinDb").val(res.data.volum);
  3783. }
  3784. drugWinHtml += '<option value="' + res.data.volUnit + '" desc="' + res.data.volum + '">' + res.data.volUnitDesc + '</option>';
  3785. }
  3786. if (res.data.miniUnit != null && res.data.miniUnit != "") {
  3787. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  3788. $("#drugWin").val(1);
  3789. $("#drugWinDb").val(1);
  3790. }
  3791. drugWinHtml += '<option value="' + res.data.miniUnit + '" desc="1">' + res.data.miniUnitDesc + '</option>';
  3792. }
  3793. $('#drugWinUnit').html(drugWinHtml);
  3794. $('#drugWinUnit').selectpicker('refresh');
  3795. //剂量单位
  3796. $("#drugWinUnit").val($(parentObject).find("input.temporary_items_drugWinUnit").val());
  3797. $('#drugWinUnit').selectpicker('refresh');
  3798. if (res.data.packUnitDesc != null && res.data.packUnitDesc != "") {
  3799. var html = '<option value="' + res.data.packUnitDesc + '" >' + res.data.packUnitDesc + '</option>';
  3800. $('#packUnit').html(html);
  3801. $('#packUnit').selectpicker('refresh');
  3802. //包装单位
  3803. $("#packUnit").val($(parentObject).find("input.temporary_items_packUnit").val());
  3804. $('#packUnit').selectpicker('refresh');
  3805. }
  3806. if (res.data.psFlag != null && (res.data.psFlag == 1 || res.data.psFlag == "1")) {
  3807. if (res.data.categoriesFlag == 0 || res.data.categoriesFlag == "0" || res.data.categoriesFlag == 2 || res.data.categoriesFlag == "2") {
  3808. initTryResultSelect(res.data.categoriesFlag);
  3809. $("#tryResult").val(tryResult);
  3810. $('#tryResult').selectpicker('refresh');
  3811. }
  3812. }
  3813. //厂家名称
  3814. $("#manufactoryName").val(res.data.manufactoryName);
  3815. //规格
  3816. $("#specification").val(res.data.specification);
  3817. }
  3818. } else {
  3819. errorMesage(res);
  3820. }
  3821. }
  3822. });
  3823. }
  3824. /**
  3825. * 修改中药
  3826. * @param obj
  3827. */
  3828. function editChineseMedicine(obj) {
  3829. //是新增药品还是编辑 true 修改 默认false
  3830. $("#chinese_medicine_update_flag").val(true);
  3831. var parentObject = $(obj).parent();
  3832. //当前药品编码
  3833. $("#chinese_medicine_current_code").val($(parentObject).find("input.temporary_items_code").val());
  3834. //当前药品规格
  3835. $("#chinese_medicine_current_serial").val($(parentObject).find("input.temporary_items_serial").val());
  3836. //当前修改药品原始编码
  3837. $("#update_ori_code").val($(parentObject).find("input.temporary_items_code").val());
  3838. //当前修改的药品原始规格
  3839. $("#update_ori_serial").val($(parentObject).find("input.temporary_items_serial").val());
  3840. //中药类型
  3841. $("#zyClassType").val($(parentObject).find("input.temporary_items_zyClassType").val());
  3842. $('#zyClassType').selectpicker('refresh');
  3843. //药品名称
  3844. $("#chinese_medicine_name").val($(parentObject).find("input.temporary_items_chineseMedicineNamme").val());
  3845. //单价
  3846. $("#zy_packRetprice").val($(parentObject).find("input.temporary_items_zyPackRetprice").val());
  3847. //处方实际单次使用剂量
  3848. $("#zy_drugWin").val($(parentObject).find("input.temporary_items_drugWin").val());
  3849. //医嘱码
  3850. $("#zyInstruction").val($(parentObject).find("input.temporary_items_zyInstruction").val());
  3851. $('#zyInstruction').selectpicker('refresh');
  3852. }
  3853. /**
  3854. * 修改辅助检查、检验项目
  3855. * @param obj
  3856. */
  3857. function editJyJcItem(obj) {
  3858. //是新增药品还是编辑 true 修改 默认false
  3859. $("#jcjy_update_flag").val(true);
  3860. var parentObject = $(obj).parent();
  3861. //当前项目编码
  3862. $("#jcjy_current_code").val($(parentObject).find("input.temporary_items_code").val());
  3863. $("#update_ori_code").val($(parentObject).find("input.temporary_items_code").val());
  3864. //项目名称
  3865. $("#jcJyItem").val($(parentObject).find("input.temporary_items_jcJyItemName").val());
  3866. //单价
  3867. $("#jcjyItemPrice").val($(parentObject).find("input.temporary_items_amount").val());
  3868. //备注
  3869. $("#remark").val($(parentObject).find("input.temporary_items_remark").val());
  3870. var chargeUnit = $(parentObject).find("input.temporary_items_desc_value").val();
  3871. var jcJyZltype = $(parentObject).find("input.temporary_items_type").val();
  3872. //执行科室
  3873. var execUnit = $(parentObject).find("input.temporary_items_execUnit").val();
  3874. $("#execUnit").selectpicker('val', execUnit);
  3875. $('#execUnit').selectpicker('refresh');
  3876. if (jcJyZltype == 1 || jcJyZltype == "1") {
  3877. $("#jyZdSample").selectpicker('val', chargeUnit);
  3878. $('#jyZdSample').selectpicker('refresh');
  3879. $("#jyZdSampleDiv").removeClass("hide").addClass("in");
  3880. $("#yshPartDiv").removeClass("in").addClass("hide");
  3881. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  3882. } else if (jcJyZltype == 2 || jcJyZltype == "2") {
  3883. $("#yshPart").selectpicker('val', chargeUnit);
  3884. $('#yshPart').selectpicker('refresh');
  3885. $("#yshPartDiv").removeClass("hide").addClass("in");
  3886. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  3887. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  3888. }
  3889. $("#jcJyZltype").val(jcJyZltype);
  3890. }
  3891. /**
  3892. * 修改诊疗项目
  3893. * @param obj
  3894. */
  3895. function editZlItem(obj) {
  3896. //是新增药品还是编辑 true 修改 默认false
  3897. $("#zl_update_flag").val(true);
  3898. var parentObject = $(obj).parent();
  3899. //当前项目编码
  3900. $("#zl_current_code").val($(parentObject).find("input.temporary_items_code").val());
  3901. $("#update_ori_code").val($(parentObject).find("input.temporary_items_code").val());
  3902. //项目名称
  3903. $("#zlItem").val($(parentObject).find("input.temporary_items_zlItemName").val());
  3904. //单价
  3905. $("#zlItemPrice").val($(parentObject).find("input.temporary_items_amount").val());
  3906. //备注
  3907. $("#zlRemark").val($(parentObject).find("input.temporary_items_remark").val());
  3908. var chargeUnit = $(parentObject).find("input.temporary_items_desc_value").val();
  3909. //数量
  3910. var itemQuantity = $(parentObject).find("input.temporary_items_itemQuantity").val();
  3911. //执行科室
  3912. var execUnit = $(parentObject).find("input.temporary_items_execUnit").val();
  3913. $("#zlExecUnit").selectpicker('val', execUnit);
  3914. $('#zlExecUnit').selectpicker('refresh');
  3915. //描述
  3916. $("#chargeUnit").val(chargeUnit);
  3917. $("#itemQuantity").val(itemQuantity);
  3918. }
  3919. /**
  3920. * 保存当前辅助检查、检验项目到右边处方区域 需要提示加价
  3921. * @param calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  3922. */
  3923. function saveJyJcItem(calculateTotalAmountFlag) {
  3924. //6岁内提示加价
  3925. var patientAge = $("#patientAge").text();
  3926. if (calculateTotalAmountFlag && patientAge != null && patientAge != "" && patientAge < 6) {
  3927. $.ajax({
  3928. type: "GET",
  3929. url: '/thmz/checkAdditionally?code=' + $("#jcjy_current_code").val() + "&jcJyZltype=" + $("#jcJyZltype").val(),
  3930. contentType: "application/json;charset=UTF-8",
  3931. dataType: "json",
  3932. async: false,
  3933. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3934. success: function (res) {
  3935. if (res == '401' || res == 401) {
  3936. window.location.href = '/thmz/login/view'
  3937. return;
  3938. }
  3939. if (res.code == 0) {
  3940. if (res.data != undefined && res.data != null && res.data.co != null && res.data.co == 1 && res.data.xlCode != null && res.data.xlCode != "") {
  3941. var xlCode = res.data.xlCode;
  3942. xlCode = Multiply(100, xlCode);
  3943. $("#messageModal").modal();
  3944. $("#messageContent").html("根据【湘医保发〔2020〕51 号】价格通知,6岁以内的小朋友诊疗费上调" + xlCode + "%,是否需要继续添加该项目?");
  3945. $("#messageButton").off("click").on("click", function (t) {
  3946. $("#messageModal").modal("hide");
  3947. saveJyJcItemReal(calculateTotalAmountFlag);
  3948. });
  3949. $("#cancelButton").off("click");
  3950. } else {
  3951. //虽然是不满6岁,但是也没有需要加收的项目,直接保存
  3952. saveJyJcItemReal(calculateTotalAmountFlag);
  3953. }
  3954. } else {
  3955. errorMesage(res);
  3956. }
  3957. }
  3958. });
  3959. } else {
  3960. saveJyJcItemReal(calculateTotalAmountFlag);
  3961. }
  3962. }
  3963. /**
  3964. * 保存当前项目到右边处方区域
  3965. * @param calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  3966. */
  3967. function saveJyJcItemReal(calculateTotalAmountFlag) {
  3968. var tableId = $("#jcjyTab li.active").find("a").attr("href");
  3969. //组号
  3970. var groupId = $(tableId).find("div:eq(0)").children().length + 1;
  3971. //项目名称
  3972. var jcJyItem = $("#jcJyItem").val();
  3973. //当前项目编码
  3974. var currentCode = $("#jcjy_current_code").val();
  3975. //当前项目价格
  3976. var jcjyItemPrice = $("#jcjyItemPrice").val();
  3977. //执行科室
  3978. var execUnit = $("#execUnit").val();
  3979. //执行科室
  3980. var execUnitName = $('#execUnit option:selected').text();
  3981. execUnitName = execUnitName.substring(0, execUnitName.indexOf("("));
  3982. //描述编码
  3983. var chargeUnitCode = null;
  3984. var chargeUnitName = "";
  3985. //检验物或者检查部位
  3986. var chargeUnit = null;
  3987. //备注
  3988. var remark = $("#remark").val();
  3989. //项目类型
  3990. var jcJyZltype = $("#jcJyZltype").val();
  3991. if (jcJyZltype == "1" || jcJyZltype == 1) {
  3992. //检验
  3993. chargeUnit = $('#jyZdSample option:selected').text();
  3994. chargeUnit = chargeUnit.substring(0, chargeUnit.indexOf("("));
  3995. chargeUnitCode = $('#jyZdSample').val();
  3996. chargeUnitName = " 检验物:";
  3997. } else if (jcJyZltype == "2" || jcJyZltype == 2) {
  3998. //检查
  3999. chargeUnit = $('#yshPart option:selected').text();
  4000. chargeUnit = chargeUnit.substring(0, chargeUnit.indexOf("("));
  4001. chargeUnitCode = $('#yshPart').val();
  4002. chargeUnitName = " 检查部位:";
  4003. }
  4004. if (currentCode == null || currentCode == '') {
  4005. if (calculateTotalAmountFlag == true) {
  4006. errorMesageSimaple("未选择任何项目!");
  4007. }
  4008. return;
  4009. }
  4010. //判断是否有重复的项目 返回true 说明有重复的
  4011. //彩超加收一个部位的不限制多开
  4012. if ("003913" != currentCode && verifyRepeat(currentCode, null, chargeUnitCode, 2)) {
  4013. return;
  4014. }
  4015. //原药品金额 如果是修改则需要设置
  4016. var temporaryItemsAmount = 0;
  4017. //当前需要被移除元素的下个兄弟节点
  4018. var nextObj = null;
  4019. //当前修改的药品是不是最后一个
  4020. var isLast = false;
  4021. //是新增药品还是编辑 true 修改 默认false
  4022. var updateFlag = $("#jcjy_update_flag").val();
  4023. if (updateFlag == undefined || updateFlag == null) {
  4024. updateFlag = false;
  4025. }
  4026. //如果是修改,需要减去原来的费用
  4027. //原组号
  4028. var oriGroupId = null;
  4029. if (updateFlag == "true" || updateFlag == true) {
  4030. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  4031. if (formGroups != null && formGroups.length > 0) {
  4032. var updateOriCode=$("#update_ori_code").val();
  4033. for (var i = 0; i < formGroups.length; i++) {
  4034. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  4035. if (temporaryItemsCode === updateOriCode) {
  4036. temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  4037. if (formGroups.length > 1) {
  4038. nextObj = $(formGroups[i]).next();
  4039. }
  4040. isLast = (i + 1) === formGroups.length;
  4041. oriGroupId = $(formGroups[i]).find("span.jcjyItemGroupId").text();
  4042. $(formGroups[i]).remove();
  4043. break;
  4044. }
  4045. }
  4046. }
  4047. }
  4048. if (oriGroupId != null) {
  4049. groupId = oriGroupId;
  4050. }
  4051. var html = '<div class="form-group">';
  4052. html += '<span class="jcjyItemGroupId">' + groupId + '</span>.<span style="margin-left: 5px"></span>'
  4053. html += jcJyItem + ' ';
  4054. if (jcJyZltype == "3" || jcJyZltype == 3) {
  4055. html += " 数量:" + itemQuantity;
  4056. }
  4057. if (execUnit != null && execUnit != "") {
  4058. html += " 执行科室:" + execUnitName;
  4059. }
  4060. if (chargeUnit != null && chargeUnit != '') {
  4061. html += chargeUnitName + chargeUnit;
  4062. }
  4063. if (remark != null && remark != '') {
  4064. html += ' 备注:' + remark;
  4065. }
  4066. 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>';
  4067. 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>';
  4068. 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>';
  4069. if ($("#jcJyItemChargeDetail").hasClass("in")) {
  4070. 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>';
  4071. }
  4072. 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>';
  4073. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  4074. html += '<input type="hidden" class="temporary_items_jcJyItemName" value="' + jcJyItem + '"/>';
  4075. html += '<input type="hidden" class="temporary_items_amount" value="' + jcjyItemPrice + '"/>';
  4076. html += '<input type="hidden" class="temporary_items_remark" value="' + remark + '"/>';
  4077. html += '<input type="hidden" class="temporary_items_type" value="' + jcJyZltype + '"/>';
  4078. html += '<input type="hidden" class="temporary_items_desc_value" value="' + chargeUnitCode + '"/>';
  4079. html += '<input type="hidden" class="temporary_items_execUnit" value="' + execUnit + '"/>';
  4080. html += '</div>';
  4081. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  4082. if (nextObj == null || isLast) {
  4083. $(tableId).find("div:eq(0)").append(html);
  4084. } else {
  4085. $(nextObj).before(html);
  4086. }
  4087. //设置当前处方金额
  4088. //calculateCfAmount(tableId, jcjyItemPrice, temporaryItemsAmount, 2, 0);
  4089. if (calculateTotalAmountFlag) {
  4090. //设置总金额
  4091. calculateTotalAmount();
  4092. }
  4093. clearJyJcItem();
  4094. }
  4095. /**
  4096. * 保存当前诊疗项目到右边处方区域 需要提示加价
  4097. * @param calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  4098. */
  4099. function saveZlItem(calculateTotalAmountFlag) {
  4100. //6岁内提示加价
  4101. var patientAge = $("#patientAge").text();
  4102. if (calculateTotalAmountFlag && patientAge != null && patientAge != "" && patientAge < 6) {
  4103. $.ajax({
  4104. type: "GET",
  4105. url: '/thmz/checkAdditionally?code=' + $("#zl_current_code").val() + "&jcJyZltype=3",
  4106. contentType: "application/json;charset=UTF-8",
  4107. dataType: "json",
  4108. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4109. async: false,
  4110. success: function (res) {
  4111. if (res == '401' || res == 401) {
  4112. window.location.href = '/thmz/login/view'
  4113. return;
  4114. }
  4115. if (res.code == 0) {
  4116. if (res.data != undefined && res.data != null && res.data.co != null && res.data.co == 1 && res.data.xlCode != null && res.data.xlCode != "") {
  4117. var xlCode = res.data.xlCode;
  4118. xlCode = Multiply(100, xlCode);
  4119. $("#messageModal").modal();
  4120. $("#messageContent").html("根据【湘医保发〔2020〕51 号】价格通知,6岁以内的小朋友诊疗费上调" + xlCode + "%,是否需要继续添加该项目?");
  4121. $("#messageButton").off("click").on("click", function (t) {
  4122. $("#messageModal").modal("hide");
  4123. saveZlItemReal(calculateTotalAmountFlag);
  4124. });
  4125. $("#cancelButton").off("click");
  4126. } else {
  4127. //虽然是不满6岁,但是也没有需要加收的项目,直接保存
  4128. saveZlItemReal(calculateTotalAmountFlag);
  4129. }
  4130. } else {
  4131. errorMesage(res);
  4132. }
  4133. }
  4134. });
  4135. } else {
  4136. saveZlItemReal(calculateTotalAmountFlag);
  4137. }
  4138. }
  4139. /**
  4140. * 保存当前项目到右边处方区域
  4141. * @param calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  4142. */
  4143. function saveZlItemReal(calculateTotalAmountFlag) {
  4144. var tableId = $("#zlTab li.active").find("a").attr("href");
  4145. //组号
  4146. var groupId = $(tableId).find("div:eq(0)").children().length + 1;
  4147. //项目名称
  4148. var zlItem = $("#zlItem").val();
  4149. //当前项目编码
  4150. var currentCode = $("#zl_current_code").val();
  4151. //当前项目价格
  4152. var zlItemPrice = $("#zlItemPrice").val();
  4153. //描述
  4154. var chargeUnit = $("#chargeUnit").val();
  4155. //执行科室
  4156. var zlExecUnit = $("#zlExecUnit").val();
  4157. //执行科室
  4158. var zlExecUnitName = $('#zlExecUnit option:selected').text();
  4159. zlExecUnitName = zlExecUnitName.substring(0, zlExecUnitName.indexOf("("));
  4160. //次数
  4161. var itemQuantity = $("#itemQuantity").val();
  4162. //描述编码
  4163. var chargeUnitCode = chargeUnit;
  4164. var chargeUnitName = " 描述:";
  4165. //备注
  4166. var remark = $("#zlRemark").val();
  4167. if (currentCode == null || currentCode == '') {
  4168. if (calculateTotalAmountFlag == true) {
  4169. errorMesageSimaple("未选择任何项目!");
  4170. }
  4171. return;
  4172. }
  4173. //判断是否有重复的项目 返回true 说明有重复的
  4174. if (verifyRepeat(currentCode, null, null, 3)) {
  4175. return;
  4176. }
  4177. //原药品金额 如果是修改则需要设置
  4178. var temporaryItemsAmount = 0;
  4179. //当前需要被移除元素的下个兄弟节点
  4180. var nextObj = null;
  4181. //当前修改的药品是不是最后一个
  4182. var isLast = false;
  4183. //是新增药品还是编辑 true 修改 默认false
  4184. var updateFlag = $("#zl_update_flag").val();
  4185. if (updateFlag == undefined || updateFlag == null) {
  4186. updateFlag = false;
  4187. }
  4188. //如果是修改,需要减去原来的费用
  4189. //原组号
  4190. var oriGroupId = null;
  4191. if (updateFlag == "true" || updateFlag == true) {
  4192. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  4193. if (formGroups != null && formGroups.length > 0) {
  4194. var updateOriCode=$("#update_ori_code").val();
  4195. for (var i = 0; i < formGroups.length; i++) {
  4196. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  4197. if (temporaryItemsCode === updateOriCode) {
  4198. temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  4199. if (formGroups.length > 1) {
  4200. nextObj = $(formGroups[i]).next();
  4201. }
  4202. isLast = (i + 1) === formGroups.length;
  4203. oriGroupId = $(formGroups[i]).find("span.zlItemGroupId").text();
  4204. $(formGroups[i]).remove();
  4205. break;
  4206. }
  4207. }
  4208. }
  4209. }
  4210. if (oriGroupId != null) {
  4211. groupId = oriGroupId;
  4212. }
  4213. var html = '<div class="form-group">';
  4214. html += '<span class="zlItemGroupId">' + groupId + '</span>.<span style="margin-left: 5px"></span>'
  4215. html += zlItem + ' ';
  4216. html += " 数量:" + itemQuantity;
  4217. if (zlExecUnit != null && zlExecUnit != "") {
  4218. html += " 执行科室:" + zlExecUnitName;
  4219. }
  4220. if (chargeUnit != null && chargeUnit != '') {
  4221. html += chargeUnitName + chargeUnit;
  4222. }
  4223. if (remark != null && remark != '') {
  4224. html += ' 备注:' + remark;
  4225. }
  4226. 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>';
  4227. 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>';
  4228. 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>';
  4229. 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>';
  4230. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  4231. html += '<input type="hidden" class="temporary_items_zlItemName" value="' + zlItem + '"/>';
  4232. html += '<input type="hidden" class="temporary_items_amount" value="' + zlItemPrice + '"/>';
  4233. html += '<input type="hidden" class="temporary_items_remark" value="' + remark + '"/>';
  4234. html += '<input type="hidden" class="temporary_items_desc_value" value="' + chargeUnitCode + '"/>';
  4235. html += '<input type="hidden" class="temporary_items_itemQuantity" value="' + itemQuantity + '"/>';
  4236. html += '<input type="hidden" class="temporary_items_execUnit" value="' + zlExecUnit + '"/>';
  4237. html += '</div>';
  4238. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  4239. if (nextObj == null || isLast) {
  4240. $(tableId).find("div:eq(0)").append(html);
  4241. } else {
  4242. $(nextObj).before(html);
  4243. }
  4244. //设置当前处方金额
  4245. //calculateCfAmount(tableId, jcjyItemPrice, temporaryItemsAmount, 2, 0);
  4246. if (calculateTotalAmountFlag) {
  4247. //设置总金额
  4248. calculateTotalAmount();
  4249. }
  4250. clearZlItem();
  4251. }
  4252. /**
  4253. * 临时保存住院证
  4254. * @param messageFlag 是否需要提醒已经存在的入院申请 true 提示
  4255. */
  4256. function saveZyReq(messageFlag) {
  4257. //如果
  4258. if ($("#zyReqTab").find("li") == null || $("#zyReqTab").find("li").length == 0) {
  4259. initNavTabs(4);
  4260. }
  4261. var tableId = $("#zyReqTab li.active").find("a").attr("href");
  4262. //病区编码
  4263. var inpatientWardBeHospitalized = $("#inpatientWardBeHospitalized").val();
  4264. //小病室编码
  4265. var smallWardBeHospitalized = $("#smallWardBeHospitalized").val();
  4266. //入院状态编码
  4267. var admissStatus = $("#admissStatus").val();
  4268. //病区名称
  4269. var inpatientWardText = $('#inpatientWardBeHospitalized option:selected').text();
  4270. //小科室名称
  4271. var smallWardText = $('#smallWardBeHospitalized option:selected').text();
  4272. //入院状态名称
  4273. var admissStatusText = $('#admissStatus option:selected').text();
  4274. if (inpatientWardBeHospitalized == null || inpatientWardBeHospitalized == '') {
  4275. errorMesageSimaple("未选择入院病区!");
  4276. return;
  4277. }
  4278. if (admissStatus == null || admissStatus == '') {
  4279. errorMesageSimaple("未选择入院状态!");
  4280. return;
  4281. }
  4282. if (messageFlag == "true" || messageFlag == true) {
  4283. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  4284. if (formGroups != null && formGroups.length > 0) {
  4285. $("#messageModal").modal();
  4286. $("#messageContent").html("当前病人已经有一个暂存的入院申请,是否需要替换该申请?");
  4287. $("#messageButton").off("click").on("click", function (t) {
  4288. $("#messageModal").modal("hide");
  4289. saveZyReq(false);
  4290. });
  4291. $("#cancelButton").off("click");
  4292. return;
  4293. }
  4294. }
  4295. var html = '<div class="form-group"> 收住院';
  4296. if (inpatientWardText != null) {
  4297. html += " [" + inpatientWardText;
  4298. }
  4299. if (smallWardText != null) {
  4300. html += " (" + smallWardText + ") ";
  4301. }
  4302. if (inpatientWardText != null) {
  4303. html += "] ";
  4304. }
  4305. if (admissStatusText != null) {
  4306. html += admissStatusText;
  4307. }
  4308. html += ' 侯床';
  4309. //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>';
  4310. 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>';
  4311. html += '<input type="hidden" class="temporary_inpatient_ward" value="' + inpatientWardBeHospitalized + '"/>';
  4312. html += '<input type="hidden" class="temporary_items_small_ward" value="' + smallWardBeHospitalized + '"/>';
  4313. html += '<input type="hidden" class="temporary_items_admiss_status" value="' + admissStatus + '"/>';
  4314. html += '</div>';
  4315. $(tableId).find("div:eq(0)").html(html);
  4316. clearZyReq();
  4317. }
  4318. /**
  4319. * 删除药品或者项目
  4320. * @param index 0 西药 1 中药 2 项目
  4321. * @param obj 当前点击的对象
  4322. */
  4323. function removeYpOrProject(index, obj) {
  4324. var tabId = null;
  4325. var className = null;
  4326. //西药
  4327. if (index == 0) {
  4328. tabId = "xyTab";
  4329. } else if (index == 1) {
  4330. //中成药
  4331. tabId = "zyTab";
  4332. } else if (index == 2) {
  4333. //辅助检查、检验
  4334. className = ".jcjyItemGroupId";
  4335. tabId = "jcjyTab";
  4336. } else if (index == 3) {
  4337. //诊疗
  4338. className = ".zlItemGroupId";
  4339. tabId = "zlTab";
  4340. } else if (index == 4) {
  4341. //入院
  4342. tabId = "zyReqTab";
  4343. }
  4344. var tableId = $("#" + tabId + " li.active").find("a").attr("href");
  4345. //var totalRetprice = $(obj).parent().find("input.temporary_items_amount").val();
  4346. //calculateCfAmount(tableId, totalRetprice, null, index, 1);
  4347. //医技和诊疗的序号调整一下
  4348. if (index == 2 || index == 3) {
  4349. var nextAll = $(obj).parent().nextAll();
  4350. if (nextAll != null && nextAll.length > 0) {
  4351. for (var i = 0; i < nextAll.length; i++) {
  4352. var index = $(nextAll[i]).find(className).text();
  4353. $(nextAll[i]).find(className).text(index - 1);
  4354. }
  4355. }
  4356. }
  4357. $(obj).parent().remove();
  4358. if (index != 4) {
  4359. calculateTotalAmount();
  4360. }
  4361. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  4362. if (formGroups == null || formGroups.length == 0) {
  4363. if (index == 0) {
  4364. //西药被清空后,重置药房类型编码
  4365. $(tableId).find("input.current_groupNo").val(null);
  4366. //当本处方内容都被删除完后,也删除处方table
  4367. $("#" + tabId).find("a[href=\"" + tableId + "\"]").parent().remove();
  4368. $(tableId).remove();
  4369. //切换处方 最后一个被选中
  4370. $("#" + tabId).find("li:last > a").off("click").tab('show');
  4371. } else if (index == 1) {
  4372. //当中药处方被清空完后,重置当前中药类型为空
  4373. $("#current_zyClassType").val(null);
  4374. }
  4375. }
  4376. }
  4377. /**
  4378. * 清空西药
  4379. * @param flag 是否全部清空 因为 西药有分组,同一组的药品用药方式和频率以及天数一样,不能改变。所以不换组是不能改变 并且设置成不可编辑
  4380. */
  4381. function clearWesternMedicine(flag) {
  4382. $("#western_medicine_update_flag").val(false);
  4383. $("#western_medicine_ori_group_id").val(null);
  4384. $("#update_ori_code").val(null);
  4385. $("#update_ori_serial").val(null);
  4386. //药品名称
  4387. $("#western_medicine_name").val(null);
  4388. //当前药品编码
  4389. $("#western_medicine_current_code").val(null);
  4390. //当前药品规格
  4391. $("#western_medicine_current_serial").val(null);
  4392. //当前药房编码
  4393. $("#current_groupNo").val(null);
  4394. if (flag) {
  4395. //用法编码
  4396. $("#supplyType").selectpicker('val', null);
  4397. $('#supplyType').selectpicker('refresh');
  4398. //$("#supplyType").removeAttr("disabled");
  4399. //天数
  4400. $("#dayNum").selectpicker('val', null);
  4401. $('#dayNum').selectpicker('refresh');
  4402. // $("#dayNum").removeAttr("disabled");
  4403. //频次编码
  4404. $("#orderFrequency").selectpicker('val', null);
  4405. $('#orderFrequency').selectpicker('refresh');
  4406. // $("#orderFrequency").removeAttr("disabled");
  4407. }
  4408. //药品默认单次使用剂量
  4409. $("#drugWinDb").val(null);
  4410. //处方实际单次使用剂量
  4411. $("#drugWin").val(null);
  4412. //剂量单位
  4413. $("#drugWinUnit").selectpicker('val', null);
  4414. $('#drugWinUnit').selectpicker('refresh');
  4415. //总量
  4416. $("#gross").val(null);
  4417. //包装单位
  4418. $("#packUnit").selectpicker('val', null);
  4419. $('#packUnit').selectpicker('refresh');
  4420. //单价
  4421. $("#packRetprice").val(null);
  4422. //金额
  4423. $("#totalRetprice").val(null);
  4424. //医嘱
  4425. $("#medicalAdvice").selectpicker('val', null);
  4426. $('#medicalAdvice').selectpicker('refresh');
  4427. $("#tryResult").parent().parent().parent().removeClass("in").addClass("hide");
  4428. //皮试结果
  4429. $("#tryResult").selectpicker('val', null);
  4430. $('#tryResult').selectpicker('refresh');
  4431. //$("#gross").attr("readonly", "readonly");
  4432. $("#manufactoryName").val(null);
  4433. $("#specification").val(null);
  4434. $("#categoriesFlag").val(null);
  4435. }
  4436. /**
  4437. * 保存当前药品到右边处方区域 中药
  4438. * calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  4439. */
  4440. function saveChineseMedicine(calculateTotalAmountFlag) {
  4441. //药品名称
  4442. var chineseMedicineNamme = $("#chinese_medicine_name").val();
  4443. //当前药品编码
  4444. var currentCode = $("#chinese_medicine_current_code").val();
  4445. //当前药品规格
  4446. var currentSerial = $("#chinese_medicine_current_serial").val();
  4447. //处方实际单次使用剂量
  4448. var drugWin = $("#zy_drugWin").val();
  4449. //医嘱码
  4450. var zyInstruction = $("#zyInstruction").val();
  4451. //医嘱
  4452. var zyInstructionText = $('#zyInstruction option:selected').text();
  4453. //单价
  4454. var zyPackRetprice = parseFloat($("#zy_packRetprice").val());
  4455. //当前中药的总价
  4456. var totalRetprice = Multiply(drugWin, zyPackRetprice);
  4457. //中药类型
  4458. var zyClassType = $("#zyClassType").val();
  4459. //已经选中的药品类型, 中药不允许一个处方里有普通中药和颗粒剂
  4460. var currentYyClassType = $("#current_zyClassType").val();
  4461. if (currentYyClassType == null || currentYyClassType == "") {
  4462. //中药此时是第一次选择药品,不控制类型
  4463. $("#current_zyClassType").val(zyClassType);
  4464. } else if (currentYyClassType != zyClassType) {
  4465. errorMesageSimaple("同一个中药处方不允许同时出现普通中药和颗粒剂中药!");
  4466. return;
  4467. }
  4468. if (currentCode == null || currentCode == '') {
  4469. errorMesageSimaple("未选择任何药品!");
  4470. return;
  4471. }
  4472. var html = '<div class="form-group" style="float: left;">';
  4473. html += chineseMedicineNamme;
  4474. if (zyInstruction != null && zyInstruction != '') {
  4475. html += '[' + zyInstructionText + ']';
  4476. }
  4477. html += '<span style="margin-left: 5px"></span>';
  4478. html += drugWin + 'g';
  4479. 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>';
  4480. 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>';
  4481. 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>';
  4482. 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>';
  4483. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  4484. html += '<input type="hidden" class="temporary_items_serial" value="' + currentSerial + '"/>';
  4485. html += '<input type="hidden" class="temporary_items_amount" value="' + totalRetprice + '"/>';
  4486. html += '<input type="hidden" class="temporary_items_zyClassType" value="' + zyClassType + '"/>';
  4487. html += '<input type="hidden" class="temporary_items_chineseMedicineNamme" value="' + chineseMedicineNamme + '"/>';
  4488. html += '<input type="hidden" class="temporary_items_zyPackRetprice" value="' + zyPackRetprice + '"/>';
  4489. html += '<input type="hidden" class="temporary_items_drugWin" value="' + drugWin + '"/>';
  4490. html += '<input type="hidden" class="temporary_items_zyInstruction" value="' + zyInstruction + '"/>';
  4491. html += '<input type="hidden" class="temporary_items_zyInstructionText" value="' + zyInstructionText + '"/>';
  4492. html += '</div>';
  4493. var tableId = $("#zyTab li.active").find("a").attr("href");
  4494. //原药品金额 如果是修改则需要设置
  4495. var temporaryItemsAmount = 0;
  4496. //当前需要被移除元素的下个兄弟节点
  4497. var nextObj = null;
  4498. //当前修改的药品是不是最后一个
  4499. var isLast = false;
  4500. //是新增药品还是编辑 true 修改 默认false
  4501. var updateFlag = $("#chinese_medicine_update_flag").val();
  4502. if (updateFlag == undefined || updateFlag == null) {
  4503. updateFlag = false;
  4504. }
  4505. //如果是修改,需要减去原来的费用
  4506. if (updateFlag == "true" || updateFlag == true) {
  4507. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  4508. if (formGroups != null && formGroups.length > 0) {
  4509. //药品有可能会修改,所以,判断的时候要用原药品编码
  4510. var updateOriCode = $("#update_ori_code").val();
  4511. //规格有可能会修改,所以,判断的时候要用原规格
  4512. var updateOriSerial = $("#update_ori_serial").val();
  4513. for (var i = 0; i < formGroups.length; i++) {
  4514. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  4515. var temporaryItemsSerial = $(formGroups[i]).find("input.temporary_items_serial").val();
  4516. if (temporaryItemsCode === updateOriCode && temporaryItemsSerial === updateOriSerial) {
  4517. temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  4518. if (formGroups.length > 1) {
  4519. nextObj = $(formGroups[i]).next();
  4520. }
  4521. isLast = (i + 1) === formGroups.length;
  4522. $(formGroups[i]).remove();
  4523. break;
  4524. }
  4525. }
  4526. }
  4527. }
  4528. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  4529. if (nextObj == null || isLast) {
  4530. $(tableId).find("div:eq(0)").append(html);
  4531. } else {
  4532. $(nextObj).before(html);
  4533. }
  4534. //设置当前处方金额
  4535. // calculateCfAmount(tableId, totalRetprice, temporaryItemsAmount, 1, 0);
  4536. if (calculateTotalAmountFlag) {
  4537. //设置总金额
  4538. calculateTotalAmount();
  4539. }
  4540. clearChineseMedicine();
  4541. }
  4542. /**
  4543. * 清空中药
  4544. */
  4545. function clearChineseMedicine() {
  4546. $("#chinese_medicine_update_flag").val(false);
  4547. $("#update_ori_code").val(null);
  4548. $("#update_ori_serial").val(null);
  4549. //药品名称
  4550. $("#chinese_medicine_name").val(null);
  4551. //当前药品编码
  4552. $("#chinese_medicine_current_code").val(null);
  4553. //当前药品规格
  4554. $("#chinese_medicine_current_serial").val(null);
  4555. //医嘱
  4556. $("#zyInstruction").selectpicker('val', null);
  4557. $('#zyInstruction').selectpicker('refresh');
  4558. //剂量
  4559. $("#zy_drugWin").val(null);
  4560. //单价
  4561. $("#zy_packRetprice").val(null);
  4562. }
  4563. /**
  4564. * 清空辅助检查、检验项目
  4565. */
  4566. function clearJyJcItem() {
  4567. $("#update_ori_code").val(null);
  4568. $("#jcjy_update_flag").val(false);
  4569. //项目名称
  4570. $("#jcJyItem").val(null);
  4571. //当前项目编码
  4572. $("#jcjy_current_code").val(null);
  4573. //单价
  4574. $("#jcjyItemPrice").val(null);
  4575. //备注
  4576. $("#remark").val(null);
  4577. $("#jcJyZltype").val(null);
  4578. $("#jyZdSample").selectpicker('val', null);
  4579. $('#jyZdSample').selectpicker('refresh');
  4580. $("#yshPart").selectpicker('val', null);
  4581. $('#yshPart').selectpicker('refresh');
  4582. $("#execUnit").selectpicker('val', null);
  4583. $('#execUnit').selectpicker('refresh');
  4584. $("#jcJyItemChargeDetail").removeClass("in").addClass("hide");
  4585. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  4586. $("#yshPartDiv").removeClass("in").addClass("hide");
  4587. }
  4588. /**
  4589. * 清空诊疗项目
  4590. */
  4591. function clearZlItem() {
  4592. $("#update_ori_code").val(null);
  4593. $("#zl_update_flag").val(false);
  4594. //项目名称
  4595. $("#zlItem").val(null);
  4596. //当前项目编码
  4597. $("#zl_current_code").val(null);
  4598. //单价
  4599. $("#zlItemPrice").val(null);
  4600. //备注
  4601. $("#zlRemark").val(null);
  4602. //描述
  4603. $("#chargeUnit").val(null);
  4604. $("#itemQuantity").val(1);
  4605. $("#zlExecUnit").selectpicker('val', null);
  4606. $('#zlExecUnit').selectpicker('refresh');
  4607. }
  4608. /**
  4609. * 清空入院证输入框
  4610. */
  4611. function clearZyReq() {
  4612. $("#inpatientWardBeHospitalized").selectpicker('val', null);
  4613. $('#inpatientWardBeHospitalized').selectpicker('refresh');
  4614. $("#smallWardBeHospitalized").selectpicker('val', null);
  4615. $('#smallWardBeHospitalized').selectpicker('refresh');
  4616. $("#admissStatus").selectpicker('val', null);
  4617. $('#admissStatus').selectpicker('refresh');
  4618. $("#totalBedNum").val(null);
  4619. $("#freeBedNum").val(null);
  4620. $("#occupationBedNum").val(null);
  4621. initSmallDeptByDept();
  4622. }
  4623. /**
  4624. * 计算总金额
  4625. */
  4626. function calculateTotalAmount() {
  4627. //调用后去除所有的验证提示
  4628. $("div.alert ").each(function (index, obj) {
  4629. $(obj).remove();
  4630. });
  4631. var jsonData = getParamsForpPrescription(3);
  4632. $.ajax({
  4633. type: "POST",
  4634. url: '/thmz/getAmountForTempPrescription',
  4635. contentType: "application/json;charset=UTF-8",
  4636. dataType: "json",
  4637. data: JSON.stringify(jsonData),
  4638. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4639. success: function (res) {
  4640. if (res == '401' || res == 401) {
  4641. window.location.href = '/thmz/login/view'
  4642. return;
  4643. }
  4644. if (res.code == 0) {
  4645. $("#totalAmount").html(res.data.amount.toFixed(1));
  4646. var arrs = $("span.cf_amount");
  4647. for (var i = 0; i < arrs.length; i++) {
  4648. if (res.data.amountList[i] != undefined && res.data.amountList[i] != null) {
  4649. $(arrs[i]).html(res.data.amountList[i].toFixed(1));
  4650. }
  4651. }
  4652. } else {
  4653. errorMesage(res);
  4654. }
  4655. }
  4656. });
  4657. }
  4658. // /**
  4659. // * 打开住院处理窗口
  4660. // * @param data
  4661. // */
  4662. // function beHospitalized() {
  4663. // $("#beHospitalizedModal").modal();
  4664. // //根据病人门诊id查询病人的入院申请
  4665. // $.ajax({
  4666. // type: "GET",
  4667. // url: '/thmz/getMzZyReqByPatientId?patientId=' + $("#patientId").text(),
  4668. // contentType: "application/json;charset=UTF-8",
  4669. // dataType: "json",
  4670. // headers: {
  4671. // 'Accept': 'application/json',
  4672. // 'Authorization': 'Bearer ' + localStorage.getItem("token")
  4673. // },
  4674. // success: function (resZyz) {
  4675. // if (resZyz == '401' || resZyz == 401) {
  4676. // window.location.href = '/thmz/login/view'
  4677. // return;
  4678. // }
  4679. // if (resZyz.code == 0) {
  4680. // $("#icdCodeInputBeHospitalized").val(resZyz.data.icdCode);
  4681. // $("#icdTextBeHospitalized").val(resZyz.data.icdText);
  4682. // $("#icdTextBeHospitalized").attr("title", resZyz.data.icdText);
  4683. // $("#inpatientWardBeHospitalized").selectpicker('val', resZyz.data.reqDept);
  4684. // $("#inpatientWardBeHospitalized").selectpicker('refresh');
  4685. // initSmallDeptByDept();
  4686. // $("#smallWardBeHospitalized").selectpicker('val', resZyz.data.smallDept);
  4687. // $("#smallWardBeHospitalized").selectpicker('refresh');
  4688. // $("#admissStatus").selectpicker('val', resZyz.data.admissStatus);
  4689. // $("#admissStatus").selectpicker('refresh');
  4690. // $("#zyReqVisitDate").val(format(resZyz.data.visitDate, "yyyy-MM-dd HH:mm:ss"));
  4691. // }
  4692. // }
  4693. // });
  4694. // }
  4695. /**
  4696. * 打开编辑用户信息窗口
  4697. * @param data
  4698. */
  4699. function editUserModal(patientId) {
  4700. if (patientId == null) {
  4701. //医生工作台发起
  4702. patientId = $("#patientId").text();
  4703. } else {
  4704. //快速接诊界面发起
  4705. clearRapidAccepts();
  4706. }
  4707. if (patientId == null || patientId == "null" || patientId == "") {
  4708. errorMesageSimaple("请输入需要编辑的患者信息");
  4709. return;
  4710. }
  4711. $("#rapidAcceptsModal").modal("hide");
  4712. $("#editUserModal").modal();
  4713. $.ajax({
  4714. type: "GET",
  4715. url: '/thmz/getByPatientId?patientId=' + patientId,
  4716. contentType: "application/json;charset=UTF-8",
  4717. dataType: "json",
  4718. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4719. success: function (res) {
  4720. if (res == '401' || res == 401) {
  4721. window.location.href = '/thmz/login/view'
  4722. return;
  4723. }
  4724. if (res.code == 0) {
  4725. if (res.data != null) {
  4726. //延时调用,因为当前弹框还没有加载出来,校验规则无法获取光标与模拟光标丢失事件,延时可以等弹框加载出来后模拟事件
  4727. setTimeout(function () {
  4728. fillPlusPatinet(res.data);
  4729. }, 400);
  4730. }
  4731. } else {
  4732. errorMesage(res);
  4733. $("#editUserModal").modal("hide");
  4734. }
  4735. }
  4736. });
  4737. }
  4738. /**
  4739. * 处方类型按钮切换事件
  4740. * @param object
  4741. * @param objectIndex
  4742. */
  4743. function billItemButtonChange(object, objectIndex) {
  4744. $(".nav-tabs").removeClass("in").addClass("hide");
  4745. $(".tab-content").removeClass("in").addClass("hide");
  4746. $(".nav-tabs:eq(" + objectIndex + ")").removeClass("hide").addClass("in");
  4747. $(".tab-content:eq(" + objectIndex + ")").removeClass("hide").addClass("in");
  4748. $("#bill_item_group").find("button").each(function (index, element) {
  4749. if ($(element).hasClass("btn-primary")) {
  4750. $(element).removeClass("btn-primary").addClass("btn-default");
  4751. }
  4752. $("#rp_form" + index).removeClass("show").addClass("hide");
  4753. });
  4754. $("#rp_form" + objectIndex).removeClass("hide").addClass("show");
  4755. $(object).removeClass("btn-default").addClass("btn-primary");
  4756. $("#western_medicine_name").webuiPopover('hide');
  4757. $("#chinese_medicine_name").webuiPopover('hide');
  4758. $("#jcJyItem").webuiPopover('hide');
  4759. $("#zlItem").webuiPopover('hide');
  4760. if (objectIndex == 0) {
  4761. $("#western_medicine_name").focus();
  4762. //有时候调用药品多了以后,会导致一个药品处方名对应多个content显现
  4763. var paneId = $("#xyTab li.active").find("a").attr("href");
  4764. if (paneId != null) {
  4765. //去除第一个字符 #
  4766. paneId = paneId.slice(1);
  4767. xyTableOnClick(paneId)
  4768. }
  4769. } else if (objectIndex == 1) {
  4770. $("#chinese_medicine_name").focus();
  4771. } else if (objectIndex == 2) {
  4772. $("#jcJyItem").focus();
  4773. } else if (objectIndex == 3) {
  4774. $("#zlItem").focus();
  4775. } else if (objectIndex == 4) {
  4776. // $("#inpatientWardBeHospitalized").next().click();
  4777. prevEleId = "zy_req_button";
  4778. }
  4779. }
  4780. /**
  4781. * 打开快速接诊窗口
  4782. * @param data
  4783. */
  4784. function rapidAcceptsModal() {
  4785. $("#rapidAcceptsModal").modal();
  4786. //延迟触发 默认光标在卡号输入框
  4787. setTimeout('$("#rapidAcceptsUserCardNo").focus();', 500);
  4788. }
  4789. /**
  4790. * checkBox样式
  4791. */
  4792. function formatCheck() {
  4793. if ($("input.flat")[0]) {
  4794. $(document).ready(function () {
  4795. $('input.flat').iCheck({
  4796. checkboxClass: 'icheckbox_flat-blue',
  4797. radioClass: 'iradio_flat-blue'
  4798. });
  4799. });
  4800. }
  4801. }
  4802. /**
  4803. * 卡号有变化后查询病人信息
  4804. */
  4805. function queryUserInfoByCardNo() {
  4806. //当反写的id不存在,说明不是查询后的改变事件,触发查询
  4807. var rapidAcceptsUserCardNo = $("#rapidAcceptsUserCardNo").val();
  4808. var index = rapidAcceptsUserCardNo.indexOf("-");
  4809. if (($("#patientIdDb").val() == null || $("#patientIdDb").val() == "") && ((index > 0 && index == rapidAcceptsUserCardNo.length - 2) || rapidAcceptsUserCardNo.length == 8)) {
  4810. $("#cardNo").attr("title", rapidAcceptsUserCardNo);
  4811. $.ajax({
  4812. type: "GET",
  4813. url: '/thmz/getByIcCardNo?icCardNo=' + rapidAcceptsUserCardNo,
  4814. contentType: "application/json;charset=UTF-8",
  4815. dataType: "json",
  4816. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4817. success: function (res) {
  4818. if (res == '401' || res == 401) {
  4819. window.location.href = '/thmz/login/view'
  4820. return;
  4821. }
  4822. if (res.code == 0) {
  4823. if (res.data != null) {
  4824. $("#rapidAcceptsUserName").val(res.data.name);
  4825. $("#rapidAcceptsUserCode").val(res.data.patientId);
  4826. $("#patientIdDb").val(res.data.patientId);
  4827. $("#rapidAcceptsUserCardNo").val(res.data.icCardNo);
  4828. $("#rapidAcceptsUserGender").selectpicker('val', res.data.sex);
  4829. $("#rapidAcceptsUserGender").selectpicker('refresh');
  4830. $("#rapidAcceptsUserPhoneNum").val(res.data.phoneNo);
  4831. $("#rapidAcceptsUserIdCard").val(res.data.socialNo);
  4832. $('#rapidAcceptsUserCertificateType').selectpicker('val', '01');
  4833. $('#rapidAcceptsUserCertificateType').selectpicker('refresh');
  4834. $("#rapidAcceptsUserIdCard").attr("title", res.data.socialNo);
  4835. $("#rapidAcceptsUserPhoneNum").attr("title", res.data.phoneNo);
  4836. $("#rapidAcceptsUserAddress").attr("title", res.data.address);
  4837. $("#rapidAcceptsUserAddress").val(res.data.address);
  4838. $("#rapidAcceptsUserContact").val(res.data.relName);
  4839. $("#rapidAcceptsUserContactPhone").val(res.data.contractName);
  4840. //查询分诊号
  4841. $.ajax({
  4842. type: "POST",
  4843. url: '/thmz/getUnClinicWithPage',
  4844. contentType: "application/json;charset=UTF-8",
  4845. dataType: "json",
  4846. data: JSON.stringify({"patientId": res.data.patientId}),
  4847. headers: {
  4848. 'Accept': 'application/json',
  4849. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  4850. },
  4851. success: function (resFz) {
  4852. if (resFz == '401' || resFz == 401) {
  4853. window.location.href = '/thmz/login/view'
  4854. return;
  4855. }
  4856. if (resFz.code == 0) {
  4857. if (resFz.data == null || resFz.data.length == 0) {
  4858. errorMesageSimaple("没有查询到符合条件的分诊记录!");
  4859. clearRapidAcceptsModal();
  4860. return;
  4861. }
  4862. $("#mzfzSerialNo").val(resFz.data[0].serialNo);
  4863. }
  4864. }
  4865. });
  4866. } else {
  4867. errorMesageSimaple("病人信息不存在!");
  4868. }
  4869. } else {
  4870. errorMesage(res);
  4871. }
  4872. }
  4873. });
  4874. }
  4875. }
  4876. /**
  4877. * 清空快速接诊查询框
  4878. */
  4879. function clearRapidAccepts() {
  4880. $("#rapidAcceptsUserName").val(null);
  4881. $("#rapidAcceptsUserCode").val(null);
  4882. $("#patientIdDb").val(null);
  4883. $("#rapidAcceptsUserCardNo").val(null);
  4884. $("#rapidAcceptsUserGender").selectpicker('val', 0);
  4885. $("#rapidAcceptsUserGender").selectpicker('refresh');
  4886. $("#rapidAcceptsUserPhoneNum").val(null);
  4887. $("#rapidAcceptsUserIdCard").val(null);
  4888. $("#rapidAcceptsUserIdCard").attr("title", null);
  4889. $("#rapidAcceptsUserPhoneNum").attr("title", null);
  4890. $("#rapidAcceptsUserAddress").attr("title", null);
  4891. $("#mzfzSerialNo").val(null);
  4892. $("#rapidAcceptsUserCardNo").focus();
  4893. $("#rapidAcceptsUserAddress").val(null);
  4894. $("#rapidAcceptsUserContact").val(null);
  4895. $("#rapidAcceptsUserContactPhone").val(null);
  4896. }
  4897. /**
  4898. * 根据病人姓名输入框内容动态加载病人列表
  4899. */
  4900. function initUserList() {
  4901. //var width=$("#userName").css("width");
  4902. var settings = {
  4903. trigger: 'click',
  4904. content: '',
  4905. width: 170,
  4906. multi: true,
  4907. closeable: false,
  4908. style: '',
  4909. delay: 300,
  4910. padding: true,
  4911. height: 300,
  4912. };
  4913. var webuiPopover = $('#rapidAcceptsUserName').webuiPopover('destroy').webuiPopover(settings);
  4914. //用户姓名选中事件
  4915. $("#rapidAcceptsUserName").on("click", function (t) {
  4916. if ($(webuiPopover).css("display") == "block") {
  4917. refeshPatinetList(true);
  4918. }
  4919. });
  4920. }
  4921. /**
  4922. * 刷新候诊病人列表
  4923. */
  4924. function refeshPatinetList(flag) {
  4925. //如果是重新加载病人列表,需要重置下标
  4926. if (flag) {
  4927. //重置下标
  4928. pageIndex = 0;
  4929. msg_list_loading = true;
  4930. }
  4931. var userName = $('#rapidAcceptsUserName').val();
  4932. if (!(userName == null || userName == "" || isChinese(userName))) {
  4933. return;
  4934. }
  4935. $.ajax({
  4936. type: "POST",
  4937. url: '/thmz/getUnClinicWithPage',
  4938. contentType: "application/json;charset=UTF-8",
  4939. dataType: "json",
  4940. data: JSON.stringify({"name": userName, "pageIndex": pageIndex}),
  4941. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4942. success: function (res) {
  4943. if (res == '401' || res == 401) {
  4944. window.location.href = '/thmz/login/view'
  4945. return;
  4946. }
  4947. if (res.code == 0) {
  4948. if (res.data != null && res.data.length > 0) {
  4949. $("#webuiPopover0").css("display", "block");
  4950. $("#webuiPopover0 .webui-popover-content").css("max-height", "300px").css("height", "auto");
  4951. var html = '<div class="list-group">';
  4952. for (var i = 0; i < res.data.length; i++) {
  4953. var mzPatientMi = res.data[i];
  4954. html += '<a href="#" class="list-group-item list-group-item-action" onclick="fillUnClinicPatinet(\'' + mzPatientMi.patientId + '\')">';
  4955. if (mzPatientMi.gender == "男") {
  4956. html += '<img src="/thmz/images/boy.png"/>'
  4957. } else if (mzPatientMi.gender == "女") {
  4958. html += '<img src="/thmz/images/girl.png"/>'
  4959. } else if (mzPatientMi.gender == "未知" || mzPatientMi.gender == null) {
  4960. html += '<img src="/thmz/images/girl_or_boy.png"/>'
  4961. }
  4962. html += '<div>' + mzPatientMi.name + '&nbsp;' + mzPatientMi.gender + '&nbsp;';
  4963. html += mzPatientMi.ageString;
  4964. if (mzPatientMi.phoneNo != null && mzPatientMi.phoneNo != "") {
  4965. html += '<span>' + mzPatientMi.phoneNo + '</span>';
  4966. }
  4967. html += '</div></a>';
  4968. }
  4969. html += '</div>';
  4970. if (flag) {
  4971. $("#webuiPopover0 div.webui-popover-content").html("");
  4972. }
  4973. $("#webuiPopover0 div.webui-popover-content").append(html);
  4974. $("#webuiPopover0 div.arrow").css("left", "23px");
  4975. refeshPatinetListScrollEvent();
  4976. } else {
  4977. $("#webuiPopover0").css("display", "none");
  4978. }
  4979. }
  4980. //查询完成,设置加载完成
  4981. msg_list_loading = false;
  4982. }
  4983. });
  4984. }
  4985. /**
  4986. * 病人下拉列表滚动条滚动到底部时继续加载新纪录
  4987. */
  4988. function refeshPatinetListScrollEvent() {
  4989. $('.webui-popover-content').scroll(function (event) {
  4990. var top = $(this).scrollTop();
  4991. var height = $(this).height();
  4992. var scrollHeight = $(this).get(0).scrollHeight;
  4993. if (scrollHeight <= top + height) {
  4994. if (!msg_list_loading) {
  4995. msg_list_loading = true;
  4996. pageIndex = pageIndex + 1;
  4997. refeshPatinetList(false);
  4998. }
  4999. }
  5000. });
  5001. }
  5002. /**
  5003. * 按照病人id查询病人信息
  5004. * @param patientId
  5005. */
  5006. function fillUnClinicPatinet(patientId) {
  5007. $("#rapidAcceptsUserCardNo").val(patientId);
  5008. $("#webuiPopover0").css("display", "none");
  5009. queryUserInfoByCardNo();
  5010. }
  5011. /**
  5012. * 加载主诉,体格检查,诊断窗口
  5013. */
  5014. function initRecommendList() {
  5015. var width = $("#symptom").parent().css("width");
  5016. var settings = {
  5017. placement: 'bottom-right',//值: auto,top,right,bottom,left,top-right,top-left,bottom-right,bottom-left 要显示的位置
  5018. trigger: 'click', //值:click,hover 触发方式 manual 手动
  5019. content: '',//内容,内容可以是函数
  5020. width: width,
  5021. //arrow:false,//是否显示箭头
  5022. multi: true,//在页面允许其他弹出层
  5023. closeable: true,//显示关闭按钮
  5024. style: '', //值:'',inverse
  5025. delay: 300,//延迟时间, 悬浮属性才执行
  5026. padding: true,//内容填充
  5027. height: 320,
  5028. //offsetTop:10,
  5029. cache: true,//如果缓存设置为false,则popover将销毁并重新创建
  5030. };
  5031. //主诉弹窗
  5032. var symptomWebuiPopover = $('#symptom').webuiPopover('destroy').webuiPopover(settings);
  5033. //体格检查弹窗
  5034. settings.height = 260;
  5035. $('#weight').webuiPopover('destroy').webuiPopover(settings);
  5036. //诊断弹窗
  5037. settings.height = 320;
  5038. var diagnoseWebuiPopover = $('#diagnose').webuiPopover('destroy').webuiPopover(settings);
  5039. //西药弹窗
  5040. settings.width = 680;
  5041. settings.closeable = false;
  5042. settings.arrow = false;//显示箭头或不显示箭头
  5043. settings.content = '<div id="westernMedicinePopoverContent"><table id="tb_table_western_medicine"></table></div>';
  5044. //手动触发
  5045. settings.trigger = 'manual';
  5046. var westernMedicineWebuiPopover = $('#western_medicine_name').webuiPopover('destroy').webuiPopover(settings);
  5047. //中药弹窗
  5048. settings.trigger = 'click';
  5049. settings.content = '<div id="chineseMedicinePopoverContent"><table id="tb_table_chinese_medicine"></table></div>';
  5050. //手动触发
  5051. settings.trigger = 'manual';
  5052. var chineseMedicineWebuiPopover = $('#chinese_medicine_name').webuiPopover('destroy').webuiPopover(settings);
  5053. //辅助检查、检验弹窗
  5054. settings.trigger = 'manual';
  5055. settings.content = '<div id="jcJyItemPopoverContent"><table id="tb_table_jc_jy_item"></table></div>';
  5056. var jcJyItemWebuiPopover = $('#jcJyItem').webuiPopover('destroy').webuiPopover(settings);
  5057. //诊疗弹窗
  5058. settings.trigger = 'manual';
  5059. settings.content = '<div id="zlItemPopoverContent"><table id="tb_table_zl_item"></table></div>';
  5060. var zlItemWebuiPopover = $('#zlItem').webuiPopover('destroy').webuiPopover(settings);
  5061. //主诉选中事件
  5062. $("#symptom").on("click", function (t) {
  5063. if ($(symptomWebuiPopover).css("display") == "block") {
  5064. $("#webuiPopover1 div.arrow").css("left", "23px");
  5065. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">主诉</span>';
  5066. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='contentHtml'>";
  5067. html += "</div>";
  5068. html += '<div style="height: 60px; line-height: 60px; font-size: 14px;">' +
  5069. '<div style="float: left">' +
  5070. '<span style="margin-left: 20px;">内容:</span> ' +
  5071. '</div>' +
  5072. '<div style="float: left;">' +
  5073. '<select class="form-control selectpicker show-tick" id="paramsType" dropupAuto="true">' +
  5074. '<option label="常用症状" value="0">常用症状</option>' +
  5075. '<option label="常用时间" value="1">常用时间</option>' +
  5076. '<option label="常用标点" value="2">常用标点</option>' +
  5077. '<option label="常用词" value="3">常用词</option>' +
  5078. '</select> ' +
  5079. '</div>' +
  5080. '<div style="width: 200px;float: left;margin-left: 10px;">' +
  5081. '<input id="paramsNameInput" class="form-control" type="text" style="position: relative;top: 13px;height: 34px;">' +
  5082. '</div>' +
  5083. '<div style="float: left;margin-left: 10px;">' +
  5084. ' <button type="button" class="btn" onclick="saveParams();"' +
  5085. ' style="height: 30px;line-height: 15px;border-color: #2e69eb!important;color: #2e69eb;background-color: white;">' +
  5086. ' <svg class="bi" width="1em" height="1em" fill="currentColor" style="vertical-align: -.15em;margin-right: 10px!important;color: #2e69eb;">' +
  5087. ' <use xlink:href="/thmz/css/bootstrap/bootstrap-icons-1.5.0/bootstrap-icons.svg#plus-circle"></use>' +
  5088. ' </svg>' +
  5089. '新增' +
  5090. ' </button>' +
  5091. ' </div>' +
  5092. '</div>';
  5093. $("#webuiPopover1 div.webui-popover-content").html(html);
  5094. $('#paramsType').selectpicker('refresh');
  5095. $("#paramsType").parent().css("width", "140px").css("height", "34px");
  5096. $("#webuiPopover1").css("z-index", "10");
  5097. if ($("#webuiPopover1").hasClass("in")) {
  5098. loadSymptom();
  5099. }
  5100. }
  5101. //加载智能接诊模块的主诉推荐
  5102. fitSymptomData();
  5103. });
  5104. //体格检查各输入框选中事件
  5105. $("#weight,#temperature,#sphygmus,#breathe,#pressure_high,#pressure_floor,#pressure_high_left,#pressure_floor_left").on("click", function (t) {
  5106. if ($("#webuiPopover2").css("display") == "block") {
  5107. $("#webuiPopover2").css("left", $("#webuiPopover1").css("left"));
  5108. if ($("#healthCheckupContentHtml").html() == null || $("#healthCheckupContentHtml").html() == "") {
  5109. $("#webuiPopover2 div.arrow").css("left", "23px");
  5110. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">体格检查</span>';
  5111. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='healthCheckupContentHtml'>";
  5112. html += "</div>";
  5113. $("#webuiPopover2 div.webui-popover-content").html(html);
  5114. $("#webuiPopover2").css("z-index", "10");
  5115. if ($("#webuiPopover2").hasClass("in")) {
  5116. loadHealthCheckup();
  5117. }
  5118. }
  5119. //loadSymptom();
  5120. } else {
  5121. $('#weight').webuiPopover('show');
  5122. $("#webuiPopover2").css("left", $("#webuiPopover1").css("left"));
  5123. if ($("#healthCheckupContentHtml").html() == null || $("#healthCheckupContentHtml").html() != "") {
  5124. $("#webuiPopover2 div.arrow").css("left", "23px");
  5125. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">体格检查</span>';
  5126. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='healthCheckupContentHtml'>";
  5127. html += "</div>";
  5128. $("#webuiPopover2 div.webui-popover-content").html(html);
  5129. $("#webuiPopover2").css("z-index", "10");
  5130. if ($("#webuiPopover2").hasClass("in")) {
  5131. loadHealthCheckup();
  5132. }
  5133. }
  5134. }
  5135. return false;
  5136. });
  5137. //诊断选中事件
  5138. $("#diagnose").on("click", function (t) {
  5139. if ($(diagnoseWebuiPopover).css("display") == "block") {
  5140. $("#webuiPopover3 div.arrow").css("left", "23px");
  5141. $("#webuiPopover3 a.close").css("margin-top", "15px");
  5142. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">诊断</span>';
  5143. html += '<div class="form-group has-feedback" style="float: right;width: 300px;margin-right: 20px;margin-top: 10px;">' +
  5144. ' <input type="text" class="form-control has-feedback-left" ' +
  5145. ' placeholder="搜索" style="padding-left: 10px;" onkeyup="debounce(loadDiagnose(this.value),100,true)" id="paramsDiagnose">' +
  5146. ' <span class="fa fa-search form-control-feedback right" aria-hidden="true" style="right: 0px;"></span>' +
  5147. ' </div>';
  5148. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='diagnoseContentHtml'>";
  5149. html += "</div>";
  5150. $("#webuiPopover3 div.webui-popover-content").html(html);
  5151. $("#webuiPopover3").css("z-index", "10");
  5152. //$("#paramsDiagnose").on('input propertychange', loadDiagnose($("#paramsDiagnose").val()));
  5153. //中文会导致查询混乱
  5154. $("#paramsDiagnose").on('compositionstart', function () {
  5155. $("#paramsDiagnose").attr("isNeedPrevent", true);
  5156. });
  5157. $("#paramsDiagnose").on('compositionend', function () {
  5158. $("#paramsDiagnose").attr("isNeedPrevent", false);
  5159. });
  5160. loadDiagnose("");
  5161. }
  5162. //加载智能接诊模块的诊断推荐推荐
  5163. fitDiagnoseData();
  5164. });
  5165. //现病史选中事件
  5166. $("#emrHpi").on("click", function (t) {
  5167. //加载智能接诊模块的现病史推荐推荐
  5168. fitEmrHpiData();
  5169. });
  5170. //既往史选中事件
  5171. $("#emrPs").on("click", function (t) {
  5172. //加载智能接诊模块的既往史推荐推荐
  5173. fitEmrPsData();
  5174. });
  5175. // //西药选中事件
  5176. // $("#western_medicine_name").on("click", function (t) {
  5177. // if ($(westernMedicineWebuiPopover).css("display") == "block") {
  5178. // $("#westernMedicinePopoverContent").parent().parent().prev().css("left", "23px");
  5179. // loadYpList(0);
  5180. // }
  5181. // });
  5182. // //中药选中事件
  5183. // $("#chinese_medicine_name").on("click", function (t) {
  5184. // if ($(chineseMedicineWebuiPopover).css("display") == "block") {
  5185. // $("#chineseMedicinePopoverContent").parent().parent().prev().css("left", "23px");
  5186. // loadYpList(1);
  5187. // }
  5188. // });
  5189. // //诊疗与医技弹窗选中事件
  5190. // $("#jcJyItem").on("click", function (t) {
  5191. // if ($(jcJyItemWebuiPopover).css("display") == "block") {
  5192. // $("#jcJyItemPopoverContent").parent().parent().prev().css("left", "23px");
  5193. // loadjcJyItemList();
  5194. // }
  5195. // });
  5196. //帮助字典弹窗
  5197. settings.width = 450;
  5198. settings.height = 500;
  5199. settings.placement = 'right';//值: auto,top,right,bottom,left,top-right,top-left,bottom-right,bottom-left 要显示的位置
  5200. settings.content = '<div id="treePopoverContent"><div><ul id="treeDemo" class="ztree"></ul></div></div>';
  5201. settings.trigger = 'click';
  5202. var treeWebuiPopover = $('#treeButton').webuiPopover('destroy').webuiPopover(settings);
  5203. $("#treeButton").on("click", function (t) {
  5204. // $("#treePopoverContent").parent().parent().prev().css("left", "23px");
  5205. //初始化药品,检查检验菜单树
  5206. initzTree();
  5207. });
  5208. }
  5209. /**
  5210. * 新增通用参数
  5211. */
  5212. function saveParams() {
  5213. $.ajax({
  5214. type: "POST",
  5215. url: '/thmz/saveTCommonParams',
  5216. contentType: "application/json;charset=UTF-8",
  5217. dataType: "json",
  5218. data: JSON.stringify({
  5219. "paramsType": $("#paramsType").val(),
  5220. "paramsName": $("#paramsNameInput").val()
  5221. }),
  5222. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5223. success: function (res) {
  5224. if (res == '401' || res == 401) {
  5225. window.location.href = '/thmz/login/view'
  5226. return;
  5227. }
  5228. if (res.code == 0) {
  5229. successMesage(res);
  5230. loadSymptom();
  5231. $("#paramsNameInput").val(null);
  5232. // $("#paramsType").selectpicker('val', 0);
  5233. // $("#paramsType").selectpicker('refresh');
  5234. } else {
  5235. errorMesage(res);
  5236. }
  5237. }
  5238. });
  5239. }
  5240. /**
  5241. * 加载主诉参数列表
  5242. */
  5243. function loadSymptom() {
  5244. $.ajax({
  5245. type: "GET",
  5246. url: '/thmz/loadSymptom',
  5247. contentType: "application/json;charset=UTF-8",
  5248. dataType: "json",
  5249. async: false,
  5250. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5251. success: function (res) {
  5252. if (res == '401' || res == 401) {
  5253. window.location.href = '/thmz/login/view'
  5254. return;
  5255. }
  5256. var html = '';
  5257. if (res.code == 0) {
  5258. if (res.featureList != null && res.featureList.length > 0) {
  5259. html += '<div id="feature">';
  5260. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用症状:</div>';
  5261. html += '<div style="width: calc(100% - 80px); float: left;">';
  5262. for (var i = 0; i < res.featureList.length; i++) {
  5263. 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;">';
  5264. html += res.featureList[i].paramsName;
  5265. html += '</span></button>';
  5266. }
  5267. html += '</div><div style="clear:both"></div></div>';
  5268. }
  5269. if (res.timeList != null && res.timeList.length > 0) {
  5270. html += '<div id="time">';
  5271. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用时间:</div>';
  5272. html += '<div style="width: calc(100% - 80px); float: left;">';
  5273. for (var i = 0; i < res.timeList.length; i++) {
  5274. 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;">';
  5275. html += res.timeList[i].paramsName;
  5276. html += '</span></button>';
  5277. }
  5278. html += '</div><div style="clear:both"></div></div>';
  5279. }
  5280. if (res.characterList != null && res.characterList.length > 0) {
  5281. html += '<div id="character">';
  5282. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用标点:</div>';
  5283. html += '<div style="width: calc(100% - 80px); float: left;">';
  5284. for (var i = 0; i < res.characterList.length; i++) {
  5285. 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;">';
  5286. html += res.characterList[i].paramsName;
  5287. html += '</span></button>';
  5288. }
  5289. html += '</div><div style="clear:both"></div></div>';
  5290. }
  5291. if (res.wordsList != null && res.wordsList.length > 0) {
  5292. html += '<div id="words">';
  5293. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用词:</div>';
  5294. html += '<div style="width: calc(100% - 80px); float: left;">';
  5295. for (var i = 0; i < res.wordsList.length; i++) {
  5296. 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;">';
  5297. html += res.wordsList[i].paramsName;
  5298. html += '</span></button>';
  5299. }
  5300. html += '</div><div style="clear:both"></div></div>';
  5301. }
  5302. } else {
  5303. errorMesage(res);
  5304. }
  5305. $("#contentHtml").html(html);
  5306. }
  5307. });
  5308. }
  5309. /**
  5310. * 加载体格检查参数列表
  5311. */
  5312. function loadHealthCheckup() {
  5313. $.ajax({
  5314. type: "GET",
  5315. url: '/thmz/loadHealthCheckup',
  5316. contentType: "application/json;charset=UTF-8",
  5317. dataType: "json",
  5318. async: false,
  5319. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5320. success: function (res) {
  5321. if (res == '401' || res == 401) {
  5322. window.location.href = '/thmz/login/view'
  5323. return;
  5324. }
  5325. var html = '';
  5326. if (res.code == 0) {
  5327. if (res.weightList != null && res.weightList.length > 0) {
  5328. html += '<div id="weightDiv">';
  5329. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">体重:</div>';
  5330. html += '<div style="width: calc(100% - 80px); float: left;">';
  5331. for (var i = 0; i < res.weightList.length; i++) {
  5332. 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;">';
  5333. html += res.weightList[i].paramsName;
  5334. html += '</span></button>';
  5335. }
  5336. html += '</div><div style="clear:both"></div></div>';
  5337. }
  5338. if (res.temperatureList != null && res.temperatureList.length > 0) {
  5339. html += '<div id="temperatureDiv">';
  5340. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">体温:</div>';
  5341. html += '<div style="width: calc(100% - 80px); float: left;">';
  5342. for (var i = 0; i < res.temperatureList.length; i++) {
  5343. 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;">';
  5344. html += res.temperatureList[i].paramsName;
  5345. html += '</span></button>';
  5346. }
  5347. html += '</div><div style="clear:both"></div></div>';
  5348. }
  5349. if (res.sphygmusList != null && res.sphygmusList.length > 0) {
  5350. html += '<div id="sphygmusDiv">';
  5351. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">脉搏:</div>';
  5352. html += '<div style="width: calc(100% - 80px); float: left;">';
  5353. for (var i = 0; i < res.sphygmusList.length; i++) {
  5354. 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;">';
  5355. html += res.sphygmusList[i].paramsName;
  5356. html += '</span></button>';
  5357. }
  5358. html += '</div><div style="clear:both"></div></div>';
  5359. }
  5360. if (res.breatheList != null && res.breatheList.length > 0) {
  5361. html += '<div id="breatheDiv">';
  5362. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">呼吸:</div>';
  5363. html += '<div style="width: calc(100% - 80px); float: left;">';
  5364. for (var i = 0; i < res.breatheList.length; i++) {
  5365. 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;">';
  5366. html += res.breatheList[i].paramsName;
  5367. html += '</span></button>';
  5368. }
  5369. html += '</div><div style="clear:both"></div></div>';
  5370. }
  5371. if (res.pressureList != null && res.pressureList.length > 0) {
  5372. html += '<div id="pressureDiv">';
  5373. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">血压:</div>';
  5374. html += '<div style="width: calc(100% - 80px); float: left;">';
  5375. for (var i = 0; i < res.pressureList.length; i++) {
  5376. 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;">';
  5377. html += res.pressureList[i].paramsName;
  5378. html += '</span></button>';
  5379. }
  5380. html += '</div><div style="clear:both"></div></div>';
  5381. }
  5382. } else {
  5383. errorMesage(res);
  5384. }
  5385. $("#healthCheckupContentHtml").html(html);
  5386. }
  5387. });
  5388. }
  5389. /**
  5390. * 加载诊断参数列表
  5391. * @param value
  5392. */
  5393. function loadDiagnose(value) {
  5394. if (!$("#webuiPopover3").hasClass("in")) {
  5395. return;
  5396. }
  5397. var isNeedPrevent = $("#paramsDiagnose").attr("isNeedPrevent");
  5398. if (isNeedPrevent == "true") {
  5399. return;
  5400. }
  5401. $.ajax({
  5402. type: "GET",
  5403. url: '/thmz/getIcdCodeByParams?commonParams=' + value,
  5404. contentType: "application/json;charset=UTF-8",
  5405. dataType: "json",
  5406. async: false,
  5407. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5408. success: function (res) {
  5409. if (res == '401' || res == 401) {
  5410. window.location.href = '/thmz/login/view'
  5411. return;
  5412. }
  5413. var html = '';
  5414. if (res.code == 0) {
  5415. if (res.data != null && res.data.length > 0) {
  5416. html += '<div>';
  5417. for (var i = 0; i < res.data.length; i++) {
  5418. html += '<button type="button" class="button_color" style="background-color: rgb(255, 255, 255);border: none;" onclick="fitDiagnoseValue(\'' + res.data[i].name + '\',\'' + res.data[i].code + '\')"><span style="padding: 0px 5px;font-size: 20px;">';
  5419. html += res.data[i].name;
  5420. html += '<small>&nbsp;&nbsp;(' + res.data[i].code + ')</small>';
  5421. html += '</span></button>';
  5422. }
  5423. html += '</div>';
  5424. }
  5425. } else {
  5426. errorMesage(res);
  5427. }
  5428. $("#diagnoseContentHtml").html(html);
  5429. }
  5430. });
  5431. }
  5432. /**
  5433. * 填充诊断
  5434. * @param value
  5435. * @param code
  5436. */
  5437. function fitDiagnoseValue(value, code) {
  5438. if (code === null || code === "") {
  5439. return;
  5440. }
  5441. var html = '';
  5442. var childrenNum = $("#diagnoseTags").children().length;
  5443. if (childrenNum == 6) {
  5444. errorMesageSimaple("最多填写六个诊断!");
  5445. return;
  5446. }
  5447. var diagnoseValue = $("#diagnoseValue").val();
  5448. if (diagnoseValue == null || diagnoseValue == "") {
  5449. diagnoseValue = code;
  5450. } else {
  5451. if (diagnoseValue.indexOf(code) != -1) {
  5452. errorMesageSimaple("诊断已存在,请勿重复添加!");
  5453. return;
  5454. }
  5455. diagnoseValue += "," + code;
  5456. }
  5457. $("#diagnoseValue").val(diagnoseValue);
  5458. if (childrenNum == 0) {
  5459. html += '<span class="el-tag--mainDiagnosis" ';
  5460. } else {
  5461. html += '<span class="el-tag--secondaryDiagnosis" ';
  5462. }
  5463. 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>';
  5464. $("#diagnoseTags").append(html);
  5465. $("#diagnoseTags").parent().parent().css("height", $("#diagnoseTags").height());
  5466. }
  5467. /**
  5468. * 移除诊断
  5469. * @param code
  5470. */
  5471. function removeDiagnoseValue(code) {
  5472. var childrenIndex = 0;
  5473. var children = $("#diagnoseTags").children();
  5474. for (var i = 0; i < children.length; i++) {
  5475. if ($(children[i]).attr("id") == code) {
  5476. childrenIndex = i;
  5477. break;
  5478. }
  5479. }
  5480. $($("#diagnoseTags").children("span")[childrenIndex]).remove();
  5481. if (childrenIndex == 0) {
  5482. $($("#diagnoseTags").children("span")[childrenIndex]).removeClass("el-tag--secondaryDiagnosis").addClass("el-tag--mainDiagnosis");
  5483. }
  5484. var diagnoseValue = $("#diagnoseValue").val();
  5485. $("#diagnoseValue").val(diagnoseValue.replace(code, ""));
  5486. $("#diagnoseTags").parent().parent().css("height", $("#diagnoseTags").height());
  5487. }
  5488. /**
  5489. * 点击通用参数属性值时设置值到对应的区域
  5490. * @param value
  5491. * @param id
  5492. */
  5493. function fitValue(value, id) {
  5494. //当选择的是血压时
  5495. if (id == "pressure_") {
  5496. var arr = value.split("/");
  5497. $("#pressure_high").val(arr[0]);
  5498. $("#pressure_floor").val(arr[1]);
  5499. if ($("#pressureLeftFlag").hasClass("in")) {
  5500. $("#pressure_high_left").val(arr[0]);
  5501. $("#pressure_floor_left").val(arr[1]);
  5502. }
  5503. //当选的是体重,体温,脉搏和呼吸时
  5504. } else if (id == "weight" || id == "temperature" || id == "sphygmus" || id == "breathe") {
  5505. $("#" + id).val(value);
  5506. } else {
  5507. //主诉拼写时
  5508. var valueExist = $("#" + id).val();
  5509. if (valueExist != null && valueExist != "") {
  5510. value = valueExist + value;
  5511. }
  5512. $("#" + id).val(value);
  5513. }
  5514. }
  5515. /**
  5516. * 加载药品列表数列表
  5517. * @param index
  5518. */
  5519. function loadYpList(index, event) {
  5520. if (event != null) {
  5521. if (event.keyCode == 38 || event.keyCode == 40 || event.keyCode == 13) {
  5522. //上下键不刷新表格
  5523. return;
  5524. }
  5525. }
  5526. var medicinePopoverContent = null;
  5527. var tableMedicine = null;
  5528. var MedicineName = null;
  5529. //var groupNo=null;
  5530. if (index == 0) {
  5531. medicinePopoverContent = "westernMedicinePopoverContent";
  5532. tableMedicine = "tb_table_western_medicine";
  5533. MedicineName = "western_medicine_name";
  5534. // groupNo=71;
  5535. }
  5536. if (index == 1) {
  5537. medicinePopoverContent = "chineseMedicinePopoverContent";
  5538. tableMedicine = "tb_table_chinese_medicine";
  5539. MedicineName = "chinese_medicine_name";
  5540. // groupNo=$("#zyClassType").val();
  5541. }
  5542. // if (!$("#" + medicinePopoverContent).parent().parent().parent().hasClass("in")) {
  5543. // return;
  5544. // }
  5545. $('#' + MedicineName).webuiPopover('show');
  5546. $('#' + tableMedicine).bootstrapTable('refresh');
  5547. $('#' + tableMedicine).bootstrapTable({
  5548. url: '/thmz/getYpListByCommonParams', //请求后台的URL(*)
  5549. method: 'GET', //请求方式(*)
  5550. toolbar: '#toolbar', //工具按钮用哪个容器
  5551. striped: true, //是否显示行间隔色
  5552. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  5553. pagination: false, //是否显示分页(*)
  5554. sortable: true, //是否启用排序
  5555. sortOrder: "asc", //排序方式
  5556. queryParams: function (params) {
  5557. var groupNo = null;
  5558. if (index == 0) {
  5559. groupNo = 71;
  5560. }
  5561. if (index == 1) {
  5562. groupNo = $("#zyClassType").val();
  5563. }
  5564. var temp = {
  5565. groupNo: groupNo,
  5566. commonParams: $("#" + MedicineName).val()
  5567. };
  5568. return temp;
  5569. }, //传递参数(*)
  5570. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  5571. pageNumber: 1, //初始化加载第一页,默认第一页
  5572. pageSize: 5, //每页的记录行数(*)
  5573. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  5574. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  5575. strictSearch: true,
  5576. showColumns: false, //是否显示所有的列
  5577. showRefresh: false, //是否显示刷新按钮
  5578. minimumCountColumns: 2, //最少允许的列数
  5579. clickToSelect: true, //是否启用点击选中行
  5580. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  5581. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  5582. cardView: false, //是否显示详细视图
  5583. detailView: false,
  5584. //rowStyle:rowStyle,//通过自定义函数设置行样式
  5585. ajaxOptions: {
  5586. headers: {
  5587. 'Accept': 'application/json',
  5588. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  5589. }
  5590. },
  5591. columns: [
  5592. {
  5593. field: 'code',
  5594. title: '编码',
  5595. align: "center",
  5596. valign: 'middle',
  5597. // sortable: true
  5598. }, {
  5599. field: 'name',
  5600. title: '药品名称',
  5601. align: "center",
  5602. valign: 'middle',
  5603. // sortable: true
  5604. }
  5605. , {
  5606. field: 'specification',
  5607. title: '规格',
  5608. align: "center",
  5609. valign: 'middle',
  5610. // sortable: true
  5611. }, {
  5612. field: 'manufactory',
  5613. title: '生产厂家',
  5614. align: "center",
  5615. valign: 'middle',
  5616. // sortable: true
  5617. }, {
  5618. field: 'miniUnitName',
  5619. title: '单位',
  5620. align: "center",
  5621. valign: 'middle',
  5622. // sortable: true
  5623. }, {
  5624. field: 'chargeAmount',
  5625. title: '零售价',
  5626. align: "center",
  5627. valign: 'middle',
  5628. // sortable: true
  5629. formatter: function (value, row, index) {
  5630. if (value == null) {
  5631. return '0.0元';
  5632. }
  5633. return value.toFixed(2) + "元";
  5634. }
  5635. }, {
  5636. field: 'drugWinDesc',
  5637. title: '剂量',
  5638. align: "center",
  5639. valign: 'middle',
  5640. // sortable: true
  5641. }, {
  5642. field: 'stockAmountVirtual',
  5643. title: '库存数量',
  5644. align: "center",
  5645. valign: 'middle',
  5646. // sortable: true
  5647. }
  5648. ],
  5649. responseHandler: function (res) {
  5650. if (res == '401' || res == 401) {
  5651. window.location.href = '/thmz/login/view'
  5652. return;
  5653. }
  5654. var ress = eval(res);
  5655. if (ress.code == -1) {
  5656. errorMesage(res);
  5657. return {
  5658. "total": 0,//总页数
  5659. "rows": {} //数据
  5660. };
  5661. }
  5662. $("#" + medicinePopoverContent).parent().css("background", "#EBEBE4");
  5663. return {
  5664. "total": ress.data.length,//总页数
  5665. "rows": ress.data //数据
  5666. };
  5667. },
  5668. onClickRow: function (row, $element) {
  5669. $('#' + MedicineName).webuiPopover('hide');
  5670. if (index == 0) {
  5671. checkYpInfo(row.code, row.serial, row.ypType, true, null);
  5672. }
  5673. if (index == 1) {
  5674. checkZyInfo(row.code, row.serial, true);
  5675. }
  5676. }
  5677. });
  5678. }
  5679. /**
  5680. * 按照药品的编码 和药品拆零规格查询药品信息 西药
  5681. * @param code
  5682. * @param serial
  5683. * @param groupNo
  5684. * @param needNotice 是否需要提示 当用户操作的时候 true 需要提示, 范文和处方回写的时候false不需要提示
  5685. * @param orderNo 处方号,回写的时候需要用,因为有的处方没有满5个
  5686. */
  5687. function checkYpInfo(code, serial, groupNo, needNotice, orderNo) {
  5688. //判断是否有重复的项目 返回true 说明有重复的
  5689. if (verifyRepeat(code, serial, null, 0)) {
  5690. return;
  5691. }
  5692. $("#current_groupNo").val(groupNo);
  5693. //不需要每次都关闭这个帮助字典
  5694. //$("#treeButton").webuiPopover('hide');
  5695. $.ajax({
  5696. type: "GET",
  5697. url: '/thmz/getYpZdDictByCodeAndSerial?code=' + code + "&serial=" + serial,
  5698. contentType: "application/json;charset=UTF-8",
  5699. dataType: "json",
  5700. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5701. async: needNotice,//当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  5702. success: function (res) {
  5703. if (res == '401' || res == 401) {
  5704. window.location.href = '/thmz/login/view'
  5705. return;
  5706. }
  5707. if (res.code == 0) {
  5708. if (res.data != null) {
  5709. //如果
  5710. if ($("#xyTab").find("li") == null || $("#xyTab").find("li").length == 0) {
  5711. initNavTabs(0);
  5712. }
  5713. var cfdesc = '普药';
  5714. if (groupNo == '91') {
  5715. cfdesc = '医材';
  5716. } else if (groupNo == '111') {
  5717. cfdesc = '麻、精一';
  5718. } else if (groupNo == '131') {
  5719. cfdesc = '精二';
  5720. }
  5721. // else if(groupNo=='151'){
  5722. // cfdesc='诊疗';
  5723. // }
  5724. //每个处方不能超过5个药品
  5725. var tableId = $("#xyTab li.active").find("a").attr("href");
  5726. var childrens = $(tableId).find("div:eq(0)").children().length;
  5727. var currentGroupNo = $(tableId).find("input.current_groupNo").val();
  5728. if (childrens === 5) {
  5729. if (needNotice) {
  5730. $("#messageModal").modal();
  5731. $("#messageContent").html("单张处方最多只能开具5个药品,是否需要新增处方?");
  5732. $("#messageButton").off("click").on("click", function (t) {
  5733. $("#messageModal").modal("hide");
  5734. refreshNavTabs(0, groupNo);
  5735. fitWesternMedicine(res, groupNo);
  5736. // //选中药品后,光标默认到用法
  5737. // $("#supplyType").next().click();
  5738. });
  5739. $("#cancelButton").off("click");
  5740. } else {
  5741. refreshNavTabs(0, groupNo);
  5742. fitWesternMedicine(res, groupNo);
  5743. }
  5744. } else if (currentGroupNo != null && currentGroupNo != '' && groupNo != currentGroupNo) {
  5745. //当前编辑的处方与选中的品类非同一处方能保存的
  5746. var currentGroupNos = $("#xyTabContent").find("input.current_groupNo");
  5747. //是否需要新增处方页,以保存医材处方
  5748. var needAddTable = true;
  5749. for (var i = 0; i < currentGroupNos.length; i++) {
  5750. if ($(currentGroupNos[i]).val() == groupNo) {
  5751. var next = $(currentGroupNos[i]).next();
  5752. if (needAddTable && $(next).children().length < 5) {
  5753. var parentId = $(currentGroupNos[i]).parent().attr("id");
  5754. //切换处方
  5755. $("#xyTab").find("a[href='#" + parentId + "']").off("click").tab('show');
  5756. //因为存在没有满5个的处方页,直接保存到该页
  5757. needAddTable = false;
  5758. fitWesternMedicine(res, groupNo);
  5759. }
  5760. }
  5761. }
  5762. if (needAddTable) {
  5763. //91 医材
  5764. var message = "医材需要单独处方,是否需要新增医材处方?";
  5765. if (groupNo == '71') {
  5766. message = "普通西成药需要单独处方,是否需要新增处方?"
  5767. } else if (groupNo == '111') {
  5768. message = "麻、精一药物需要单独处方,是否需要新增处方?"
  5769. } else if (groupNo == '131') {
  5770. message = "精二药物需要单独处方,是否需要新增处方?"
  5771. }
  5772. if (needNotice) {
  5773. $("#messageModal").modal();
  5774. $("#messageContent").html(message);
  5775. $("#messageButton").off("click").on("click", function (t) {
  5776. $("#messageModal").modal("hide");
  5777. refreshNavTabs(0, groupNo);
  5778. fitWesternMedicine(res, groupNo);
  5779. // //选中药品后,光标默认到用法
  5780. // $("#supplyType").next().click();
  5781. });
  5782. $("#cancelButton").off("click");
  5783. } else {
  5784. refreshNavTabs(0, groupNo);
  5785. fitWesternMedicine(res, groupNo);
  5786. }
  5787. }
  5788. //当前编辑的处方非普通西药处方
  5789. } else {
  5790. //修改药品
  5791. if (orderNo != null) {
  5792. //西药处方数量
  5793. var xyTabLiLength = $("#xyTab li").length;
  5794. if (xyTabLiLength < orderNo) {
  5795. refreshNavTabs(0, groupNo);
  5796. } else {
  5797. $("#xyTab li.active").find("a").find("small.cfdesc").text("(" + cfdesc + ")");
  5798. }
  5799. fitWesternMedicine(res, groupNo);
  5800. } else {
  5801. $("#xyTab li.active").find("a").find("small.cfdesc").text("(" + cfdesc + ")");
  5802. fitWesternMedicine(res, groupNo);
  5803. }
  5804. }
  5805. // if (needNotice) {
  5806. // //选中药品后,光标默认到用法
  5807. // $("#supplyType").next().click();
  5808. // // prevEleId = 'supplyType';
  5809. // }
  5810. }
  5811. } else {
  5812. errorMesage(res);
  5813. }
  5814. }
  5815. });
  5816. }
  5817. /**
  5818. * 按照药品的编码 和药品拆零规格查询药品信息 中药
  5819. * @param code
  5820. * @param serial
  5821. * @param async 当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  5822. */
  5823. function checkZyInfo(code, serial, async) {
  5824. //判断是否有重复的项目 返回true 说明有重复的
  5825. if (verifyRepeat(code, serial, null, 1)) {
  5826. return;
  5827. }
  5828. $.ajax({
  5829. type: "GET",
  5830. url: '/thmz/getYpZdDictByCodeAndSerial?code=' + code + "&serial=" + serial,
  5831. contentType: "application/json;charset=UTF-8",
  5832. dataType: "json",
  5833. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5834. async: async,//当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  5835. success: function (res) {
  5836. if (res == '401' || res == 401) {
  5837. window.location.href = '/thmz/login/view'
  5838. return;
  5839. }
  5840. if (res.code == 0) {
  5841. if (res.data != null) {
  5842. //如果
  5843. if ($("#zyTab").find("li") == null || $("#zyTab").find("li").length == 0) {
  5844. initNavTabs(1);
  5845. //$("input.zyfs").val(1);
  5846. }
  5847. $("#chinese_medicine_name").val(res.data.name);
  5848. $("#chinese_medicine_name").blur();
  5849. //$("#zy_drugWin").val(res.data.weight);
  5850. $("#zy_packRetprice").val(res.data.packRetprice);
  5851. $("#chinese_medicine_current_code").val(res.data.code);
  5852. $("#chinese_medicine_current_serial").val(res.data.serial);
  5853. if (async) {
  5854. //选中药品后,光标默认到数量输入框
  5855. $("#zy_drugWin").focus();
  5856. // prevEleId = 'zy_drugWin';
  5857. }
  5858. }
  5859. } else {
  5860. errorMesage(res);
  5861. }
  5862. }
  5863. });
  5864. }
  5865. /**
  5866. * 加载辅助检查、检验列表
  5867. * @param index
  5868. */
  5869. function loadjcJyItemList(event) {
  5870. if (event != null) {
  5871. if (event.keyCode == 38 || event.keyCode == 40 || event.keyCode == 13) {
  5872. //上下键不刷新表格
  5873. return;
  5874. }
  5875. }
  5876. // if (!$("#jcJyItemPopoverContent").parent().parent().parent().hasClass("in")) {
  5877. // return;
  5878. // }
  5879. $('#jcJyItem').webuiPopover('show');
  5880. $('#tb_table_jc_jy_item').bootstrapTable('refresh');
  5881. $('#tb_table_jc_jy_item').bootstrapTable({
  5882. url: '/thmz/getJcJyItemByCommonParams', //请求后台的URL(*)
  5883. method: 'GET', //请求方式(*)
  5884. toolbar: '#toolbar', //工具按钮用哪个容器
  5885. striped: true, //是否显示行间隔色
  5886. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  5887. pagination: false, //是否显示分页(*)
  5888. sortable: true, //是否启用排序
  5889. sortOrder: "asc", //排序方式
  5890. queryParams: function (params) {
  5891. var temp = {
  5892. commonParams: $("#jcJyItem").val()
  5893. };
  5894. return temp;
  5895. }, //传递参数(*)
  5896. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  5897. pageNumber: 1, //初始化加载第一页,默认第一页
  5898. pageSize: 5, //每页的记录行数(*)
  5899. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  5900. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  5901. strictSearch: true,
  5902. showColumns: false, //是否显示所有的列
  5903. showRefresh: false, //是否显示刷新按钮
  5904. minimumCountColumns: 2, //最少允许的列数
  5905. clickToSelect: true, //是否启用点击选中行
  5906. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  5907. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  5908. cardView: false, //是否显示详细视图
  5909. detailView: false,
  5910. //rowStyle:rowStyle,//通过自定义函数设置行样式
  5911. ajaxOptions: {
  5912. headers: {
  5913. 'Accept': 'application/json',
  5914. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  5915. }
  5916. },
  5917. columns: [
  5918. {
  5919. field: 'code',
  5920. title: '编码',
  5921. align: "center",
  5922. valign: 'middle',
  5923. // sortable: true
  5924. }, {
  5925. field: 'name',
  5926. title: '名称',
  5927. align: "center",
  5928. valign: 'middle',
  5929. // sortable: true
  5930. }
  5931. , {
  5932. field: 'execUnitName',
  5933. title: '执行科室',
  5934. align: "center",
  5935. valign: 'middle',
  5936. // sortable: true
  5937. }, {
  5938. field: 'type',
  5939. title: '项目类型',
  5940. align: "center",
  5941. valign: 'middle',
  5942. // sortable: true
  5943. formatter: function (value, row, index) {
  5944. if (value == 1 || value == "1") {
  5945. return "检验";
  5946. }
  5947. if (value == 2 || value == "2") {
  5948. return "辅助检查";
  5949. }
  5950. if (value == 3 || value == "3") {
  5951. return "诊疗";
  5952. }
  5953. return "";
  5954. }
  5955. },
  5956. ],
  5957. responseHandler: function (res) {
  5958. if (res == '401' || res == 401) {
  5959. window.location.href = '/thmz/login/view'
  5960. return;
  5961. }
  5962. var ress = eval(res);
  5963. if (ress.code == -1) {
  5964. errorMesage(res);
  5965. return {
  5966. "total": 0,//总页数
  5967. "rows": {} //数据
  5968. };
  5969. }
  5970. $("#jcJyItemPopoverContent").parent().css("background", "#EBEBE4");
  5971. return {
  5972. "total": ress.data.length,//总页数
  5973. "rows": ress.data //数据
  5974. };
  5975. },
  5976. onClickRow: function (row, $element) {
  5977. $('#jcJyItem').webuiPopover('hide');
  5978. $("#jcJyZltype").val(row.type);
  5979. $("#execUnit").selectpicker('val', row.execUnit);//默认不选中
  5980. $("#execUnit").selectpicker('refresh');
  5981. if (row.type == 1) {
  5982. //检验
  5983. $("#jyZdSampleDiv").removeClass("hide").addClass("in");
  5984. $("#yshPartDiv").removeClass("in").addClass("hide");
  5985. if (row.sampleCode != null && row.sampleCode != "") {
  5986. $("#jyZdSample").selectpicker('val', row.sampleCode);
  5987. $('#jyZdSample').selectpicker('refresh');
  5988. }
  5989. } else if (row.type == 2) {
  5990. //检查
  5991. $("#yshPartDiv").removeClass("hide").addClass("in");
  5992. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  5993. if (row.bwCode != null && row.bwCode != "") {
  5994. $("#yshPart").selectpicker('val', row.bwCode);
  5995. $('#yshPart').selectpicker('refresh');
  5996. }
  5997. }
  5998. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  5999. checkJcJyItemInfo(row.code, row.name, row.type, true);
  6000. }
  6001. });
  6002. }
  6003. /**
  6004. * 加载诊疗列表
  6005. * @param index
  6006. */
  6007. function loadZlItemList(event) {
  6008. if (event != null) {
  6009. if (event.keyCode == 38 || event.keyCode == 40 || event.keyCode == 13) {
  6010. //上下键不刷新表格
  6011. return;
  6012. }
  6013. }
  6014. $('#zlItem').webuiPopover('show');
  6015. $('#tb_table_zl_item').bootstrapTable('refresh');
  6016. $('#tb_table_zl_item').bootstrapTable({
  6017. url: '/thmz/getZlItemByCommonParams', //请求后台的URL(*)
  6018. method: 'GET', //请求方式(*)
  6019. toolbar: '#toolbar', //工具按钮用哪个容器
  6020. striped: true, //是否显示行间隔色
  6021. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  6022. pagination: false, //是否显示分页(*)
  6023. sortable: true, //是否启用排序
  6024. sortOrder: "asc", //排序方式
  6025. queryParams: function (params) {
  6026. var temp = {
  6027. commonParams: $("#zlItem").val()
  6028. };
  6029. return temp;
  6030. }, //传递参数(*)
  6031. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  6032. pageNumber: 1, //初始化加载第一页,默认第一页
  6033. pageSize: 5, //每页的记录行数(*)
  6034. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  6035. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  6036. strictSearch: true,
  6037. showColumns: false, //是否显示所有的列
  6038. showRefresh: false, //是否显示刷新按钮
  6039. minimumCountColumns: 2, //最少允许的列数
  6040. clickToSelect: true, //是否启用点击选中行
  6041. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  6042. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  6043. cardView: false, //是否显示详细视图
  6044. detailView: false,
  6045. //rowStyle:rowStyle,//通过自定义函数设置行样式
  6046. ajaxOptions: {
  6047. headers: {
  6048. 'Accept': 'application/json',
  6049. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  6050. }
  6051. },
  6052. columns: [
  6053. {
  6054. field: 'code',
  6055. title: '编码',
  6056. align: "center",
  6057. valign: 'middle',
  6058. // sortable: true
  6059. }, {
  6060. field: 'name',
  6061. title: '名称',
  6062. align: "center",
  6063. valign: 'middle',
  6064. // sortable: true
  6065. }
  6066. , {
  6067. field: 'execUnitName',
  6068. title: '执行科室',
  6069. align: "center",
  6070. valign: 'middle',
  6071. // sortable: true
  6072. }
  6073. , {
  6074. field: 'chargeAmount',
  6075. title: '价格',
  6076. align: "center",
  6077. valign: 'middle',
  6078. // sortable: true
  6079. formatter: function (value, row, index) {
  6080. if (value == null) {
  6081. return "0.00元";
  6082. }
  6083. return value.toFixed(2) + "元";
  6084. }
  6085. }, {
  6086. field: 'descriptions',
  6087. title: '规格',
  6088. align: "center",
  6089. valign: 'middle',
  6090. // sortable: true
  6091. }
  6092. ],
  6093. responseHandler: function (res) {
  6094. if (res == '401' || res == 401) {
  6095. window.location.href = '/thmz/login/view'
  6096. return;
  6097. }
  6098. var ress = eval(res);
  6099. if (ress.code == -1) {
  6100. errorMesage(res);
  6101. return {
  6102. "total": 0,//总页数
  6103. "rows": {} //数据
  6104. };
  6105. }
  6106. $("#zlItemPopoverContent").parent().css("background", "#EBEBE4");
  6107. return {
  6108. "total": ress.data.length,//总页数
  6109. "rows": ress.data //数据
  6110. };
  6111. },
  6112. onClickRow: function (row, $element) {
  6113. $('#zlItem').webuiPopover('hide');
  6114. $("#zlExecUnit").selectpicker('val', row.execUnit);//默认不选中
  6115. $("#zlExecUnit").selectpicker('refresh');
  6116. //诊疗
  6117. if ($("#zlTab").find("li") == null || $("#zlTab").find("li").length == 0) {
  6118. initNavTabs(3);
  6119. }
  6120. $("#zlItem").val(row.name);
  6121. $("#zlItem").blur();
  6122. $("#zlItemPrice").val(row.chargeAmount);
  6123. $("#chargeUnit").val(row.specification);
  6124. $("#zl_current_code").val(row.code);
  6125. $("#itemQuantity").val(1);
  6126. $("#chargeUnit").focus();
  6127. return;
  6128. }
  6129. });
  6130. }
  6131. /**
  6132. * 诊疗与医技选中
  6133. * @param code
  6134. * @param name 回写的时候可以设置null
  6135. * @param type 1 检验 2 检查 3 诊疗
  6136. * @param async 当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  6137. */
  6138. //function checkJcJyItemInfo(code, name, type) {
  6139. function checkJcJyItemInfo(code, name, type, async) {
  6140. // //判断是否有重复的项目 返回true 说明有重复的
  6141. // if (verifyRepeat(code, null, 2)) {
  6142. // return;
  6143. // }
  6144. //不需要每次都关闭帮助树
  6145. //$("#treeButton").webuiPopover('hide');
  6146. $.ajax({
  6147. type: "GET",
  6148. url: '/thmz/getJcJyItemChargeByCode?code=' + code + '&jcJyZltype=' + type,
  6149. contentType: "application/json;charset=UTF-8",
  6150. dataType: "json",
  6151. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6152. async: async,//当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  6153. success: function (res) {
  6154. if (res == '401' || res == 401) {
  6155. window.location.href = '/thmz/login/view'
  6156. return;
  6157. }
  6158. if (res.code == 0) {
  6159. if (res.data != null) {
  6160. //如果
  6161. if ($("#jcjyTab").find("li") == null || $("#jcjyTab").find("li").length == 0) {
  6162. initNavTabs(2);
  6163. }
  6164. if (name == null) {
  6165. name = res.name;
  6166. }
  6167. $("#jcJyItem").val(name);
  6168. $("#jcJyItem").blur();
  6169. $("#jcjyItemPrice").val(res.totalAmount);
  6170. $("#jcjy_current_code").val(code);
  6171. $("#execUnit").selectpicker('val', res.execUnit);//默认不选中
  6172. $("#execUnit").selectpicker('refresh');
  6173. // if (async) {
  6174. // if (type == 1) {
  6175. // //选中项目后,光标默认到数量输入框
  6176. // $("#jyZdSample").next().click();
  6177. // // prevEleId = 'jyZdSample';
  6178. // } else if (type == 2) {
  6179. // $("#yshPart").next().click();
  6180. // // prevEleId = 'yshPart';
  6181. // }
  6182. // }
  6183. }
  6184. } else {
  6185. errorMesage(res);
  6186. }
  6187. }
  6188. });
  6189. }
  6190. /**
  6191. * 查询辅助检查、检验项目明细
  6192. * @param code 编码
  6193. * @param jcJyZltype 1 检验 2 检查
  6194. */
  6195. function getJcJyItemChargeByCode(code, jcJyZltype) {
  6196. if (code != null) {
  6197. $("#itemCodeSearch").val(code);
  6198. $("#jcJyZltypeSearch").val(jcJyZltype);
  6199. } else if ($("#jcjy_current_code").val() == null || $("#jcjy_current_code").val() == '') {
  6200. errorMesageSimaple("未选中任何项目!");
  6201. return;
  6202. }
  6203. $("#jcJyItemModal").modal("show");
  6204. $('#jcJyItemTable').bootstrapTable('refresh');
  6205. $('#jcJyItemTable').bootstrapTable({
  6206. url: '/thmz/getJcJyItemChargeByCode', //请求后台的URL(*)
  6207. method: 'GET', //请求方式(*)
  6208. toolbar: '#toolbar', //工具按钮用哪个容器
  6209. striped: true, //是否显示行间隔色
  6210. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  6211. pagination: false, //是否显示分页(*)
  6212. sortable: true, //是否启用排序
  6213. sortOrder: "asc", //排序方式
  6214. queryParams: function (params) {
  6215. var itemCodeSearch = $("#itemCodeSearch").val();
  6216. var jcJyZltypeSearch = $("#jcJyZltypeSearch").val();
  6217. if (itemCodeSearch == null || itemCodeSearch == "") {
  6218. itemCodeSearch = $("#jcjy_current_code").val();
  6219. jcJyZltypeSearch = $("#jcJyZltype").val();
  6220. }
  6221. var temp = {
  6222. code: itemCodeSearch,
  6223. jcJyZltype: jcJyZltypeSearch
  6224. };
  6225. return temp;
  6226. }, //传递参数(*)
  6227. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  6228. pageNumber: 1, //初始化加载第一页,默认第一页
  6229. pageSize: 5, //每页的记录行数(*)
  6230. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  6231. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  6232. strictSearch: true,
  6233. showColumns: false, //是否显示所有的列
  6234. showRefresh: false, //是否显示刷新按钮
  6235. minimumCountColumns: 2, //最少允许的列数
  6236. clickToSelect: true, //是否启用点击选中行
  6237. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  6238. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  6239. cardView: false, //是否显示详细视图
  6240. detailView: false,
  6241. //rowStyle:rowStyle,//通过自定义函数设置行样式
  6242. ajaxOptions: {
  6243. headers: {
  6244. 'Accept': 'application/json',
  6245. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  6246. }
  6247. },
  6248. columns: [
  6249. {
  6250. field: 'tcCode',
  6251. title: '项目编码',
  6252. align: "center",
  6253. valign: 'middle',
  6254. // sortable: true
  6255. }, {
  6256. field: 'code',
  6257. title: '收费编码',
  6258. align: "center",
  6259. valign: 'middle',
  6260. // sortable: true
  6261. }
  6262. , {
  6263. field: 'name',
  6264. title: '收费名称',
  6265. align: "center",
  6266. valign: 'middle',
  6267. // sortable: true
  6268. }, {
  6269. field: 'num',
  6270. title: '数量',
  6271. align: "center",
  6272. valign: 'middle',
  6273. // sortable: true
  6274. }, {
  6275. field: 'chargeAmount',
  6276. title: '单价',
  6277. align: "center",
  6278. valign: 'middle',
  6279. // sortable: true
  6280. formatter: function (value, row, index) {
  6281. if (value == null || value == "") {
  6282. return 0;
  6283. }
  6284. return value.toFixed(2);
  6285. }
  6286. }, {
  6287. field: 'totalAmount',
  6288. title: '总金额',
  6289. align: "center",
  6290. valign: 'middle',
  6291. // sortable: true
  6292. formatter: function (value, row, index) {
  6293. if (value == null || value == "") {
  6294. return 0;
  6295. }
  6296. return value.toFixed(2);
  6297. }
  6298. }
  6299. ],
  6300. responseHandler: function (res) {
  6301. if (res == '401' || res == 401) {
  6302. window.location.href = '/thmz/login/view'
  6303. return;
  6304. }
  6305. $("#itemCodeSearch").val(null);
  6306. var ress = eval(res);
  6307. if (ress.code == -1) {
  6308. errorMesage(res);
  6309. return {
  6310. "total": 0,//总页数
  6311. "rows": {} //数据
  6312. };
  6313. }
  6314. return {
  6315. "total": ress.data.length,//总页数
  6316. "rows": ress.data //数据
  6317. };
  6318. }
  6319. });
  6320. }
  6321. /**
  6322. * 判断是否有重复的项目 返回true 说明有重复的
  6323. * @param code 编码
  6324. * @param serial 药品规格 null 时是非药品
  6325. * @param chargeUnitCode 检查部位或者检验物 null 时是 诊疗
  6326. * @param index
  6327. */
  6328. function verifyRepeat(code, serial, chargeUnitCode, index) {
  6329. //是新增药品还是编辑 true 修改 默认false
  6330. var updateFlag = null;
  6331. if (index == 0) {
  6332. updateFlag = $("#western_medicine_update_flag").val();
  6333. } else if (index == 1) {
  6334. updateFlag = $("#chinese_medicine_update_flag").val();
  6335. } else if (index == 2) {
  6336. updateFlag = $("#jcjy_update_flag").val();
  6337. } else if (index == 3) {
  6338. updateFlag = $("#zl_update_flag").val();
  6339. }
  6340. if (updateFlag == undefined || updateFlag == null) {
  6341. updateFlag = false;
  6342. }
  6343. if (updateFlag == "true" || updateFlag == true) {
  6344. return false;
  6345. }
  6346. var tabId = null;
  6347. //西药
  6348. if (index == 0) {
  6349. tabId = "xyTab";
  6350. } else if (index == 1) {
  6351. //中成药
  6352. tabId = "zyTab";
  6353. } else if (index == 2) {
  6354. //辅助检查、检验
  6355. tabId = "jcjyTab";
  6356. } else if (index == 3) {
  6357. //诊疗
  6358. tabId = "zlTab";
  6359. } else if (index == 4) {
  6360. //入院
  6361. tabId = "zyReqTab";
  6362. }
  6363. var tableId = $("#" + tabId + " li.active").find("a").attr("href");
  6364. var items = $(tableId).find("div:eq(0)").find("div.form-group");
  6365. var groupId = null;
  6366. if (index == 0) {
  6367. groupId = $("#groupId").val();
  6368. }
  6369. if (items != null && items.length > 0) {
  6370. for (var i = 0; i < items.length; i++) {
  6371. if (serial == null) {
  6372. var temporary_items_code = $(items[i]).find("input.temporary_items_code").val();
  6373. var temporary_items_desc_value = $(items[i]).find("input.temporary_items_desc_value").val();
  6374. if (chargeUnitCode == null && code === temporary_items_code) {
  6375. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  6376. return true;
  6377. }
  6378. if (code === temporary_items_code && chargeUnitCode === temporary_items_desc_value) {
  6379. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  6380. return true;
  6381. }
  6382. } else {
  6383. if (index == 0) {
  6384. //西药需要判断组号,因为可能会有不同组的皮试用药,需要相同的药品
  6385. var temporary_items_groupId = $(items[i]).find("input.temporary_items_groupId").val();
  6386. var temporary_items_code = $(items[i]).find("input.temporary_items_code").val();
  6387. var temporary_items_serial = $(items[i]).find("input.temporary_items_serial").val();
  6388. if (code === temporary_items_code && serial === temporary_items_serial && groupId === temporary_items_groupId) {
  6389. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  6390. return true;
  6391. }
  6392. } else {
  6393. var temporary_items_code = $(items[i]).find("input.temporary_items_code").val();
  6394. var temporary_items_serial = $(items[i]).find("input.temporary_items_serial").val();
  6395. if (code === temporary_items_code && serial === temporary_items_serial) {
  6396. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  6397. return true;
  6398. }
  6399. }
  6400. }
  6401. }
  6402. }
  6403. return false;
  6404. }
  6405. /**
  6406. * 初始化处方分页
  6407. * @param index 0 西药 1 中药 2 诊疗 3 入院
  6408. */
  6409. function initNavTabs(index) {
  6410. var tabId = null;
  6411. var tabContentId = null;
  6412. var paneId = null;
  6413. var cfdesc = '普药';
  6414. //西药
  6415. if (index == 0) {
  6416. tabId = "xyTab";
  6417. tabContentId = "xyTabContent";
  6418. paneId = "xycf_" + getUID();
  6419. } else if (index == 1) {
  6420. //中草药
  6421. tabId = "zyTab";
  6422. tabContentId = "zyTabContent";
  6423. paneId = "zycf_" + getUID();
  6424. cfdesc = '中草药';
  6425. } else if (index == 2) {
  6426. //医技
  6427. tabId = "jcjyTab";
  6428. tabContentId = "jcjyTabContent";
  6429. paneId = "jcjycf_" + getUID();
  6430. cfdesc = '辅助检查、检验';
  6431. } else if (index == 3) {
  6432. //诊疗
  6433. tabId = "zlTab";
  6434. tabContentId = "zlTabContent";
  6435. paneId = "zlcf_" + getUID();
  6436. cfdesc = '诊疗';
  6437. } else if (index == 4) {
  6438. //住院
  6439. tabId = "zyReqTab";
  6440. tabContentId = "zyReqTabContent";
  6441. paneId = "zyReqcf_" + getUID();
  6442. cfdesc = '入院';
  6443. }
  6444. var tabHtml = '<li class="active"><a href="#' + paneId + '" role="tab" data-toggle="tab" ';
  6445. if (index == 0) {
  6446. tabHtml += ' onclick=xyTableOnClick("' + paneId + '")';
  6447. }
  6448. tabHtml += '>处方 <small class="cfdesc">(' + cfdesc + ')</small></a></li>';
  6449. $("#" + tabId).html(tabHtml);
  6450. var html = '<div class="tab-pane fade in active" id="' + paneId + '" style="height: 100%;min-height: 285px;position: relative;">';
  6451. html += '<img src="/thmz/images/prescription.png" style="margin-top: 5px;"/>';
  6452. html += '<input class="current_groupNo" type="hidden"/>';
  6453. html += ' <div class="cf_content rb_item" style="height: 230px;padding-top: 5px;overflow-y: auto;"></div>' +
  6454. ' <div style="height: 30px;border-top: 1px solid #ddd;width: 100%;position: absolute;bottom:0;padding-top: 10px;">';
  6455. html += '<div style="width: 460px;">'
  6456. if (index == 1) {
  6457. html += '<div style="width: 130px;float: left;line-height: 34px;">' +
  6458. ' <label class="my_label_2">复煎:</label>' +
  6459. ' <div style="width: 69px;float: left;">' +
  6460. ' <input type="number" class="form-control " id="cyFj" placeholder="请输入" value="1"/>' +
  6461. ' </div>次' +
  6462. ' </div>';
  6463. html += '<div style="width: 130px;float: left;line-height: 34px;">' +
  6464. ' <label class="my_label_2">分服:</label>' +
  6465. ' <div style="width: 69px;float: left;">' +
  6466. ' <input type="number" class="form-control " id="cyFfcs" placeholder="请输入" value="2"/>' +
  6467. ' </div>次' +
  6468. ' </div>';
  6469. html += '<div style="width: 180px;float: left;">' +
  6470. ' <label class="my_label_2">用法:</label>' +
  6471. ' <div style="width: 135px;float: left;">' +
  6472. ' <select class="form-control selectpicker show-tick useType"' +
  6473. ' title="请选择" id="useType_1">' +
  6474. ' </select>' +
  6475. ' </div>' +
  6476. ' </div>';
  6477. html += '</div><div style="width: 460px;">'
  6478. html += '<input id="singleAmount" type="hidden"/>';
  6479. }
  6480. html += '<div style="width: 130px;float: left;padding-left: 7px;padding-top: 8px;">金额:<span class="cf_amount">0.0</span><span>元</span></div>';
  6481. if (index == 0) {
  6482. html += '<div style="width: 310px;float: left;color: red;padding-top: 8px;">说明:此费用包含药品给药方式所产生的费用!</div>';
  6483. }
  6484. // else if (index == 1) {
  6485. // html += '<div style="width: 310px;float: left;color: red;padding-top: 8px;">说明:此费用包含药品代煎所产生的费用!</div>';
  6486. // }
  6487. html += '</div></div></div>';
  6488. $("#" + tabContentId).html(html);
  6489. if (index == 1) {
  6490. var water = '<option value="加凉水">加凉水</option><option value="加温水">加温水</option><option value="加开水">加开水</option><option value="加冰水">加冰水</option><option value="加糖水">加糖水</option>';
  6491. $('#cyJssm').html(water);
  6492. $('#cyJssm').selectpicker('refresh');
  6493. $("#cyJssm").selectpicker('val', "加凉水");
  6494. $('#cyJssm').selectpicker('refresh');
  6495. initAllMzYshZdFysm();
  6496. //initZyOrderFrequencys("zy_orderFrequency_1", false);
  6497. initZySupplyTypes("zy_supplyType_1", false);
  6498. }
  6499. }
  6500. /**
  6501. * 清空处方分页
  6502. * @param index 0 西药 1 中药 2 诊疗 3 入院
  6503. */
  6504. function clearNavTabs(index) {
  6505. var tabId = null;
  6506. var tabContentId = null;
  6507. //西药
  6508. if (index == 0) {
  6509. tabId = "xyTab";
  6510. tabContentId = "xyTabContent";
  6511. } else if (index == 1) {
  6512. //中草药
  6513. tabId = "zyTab";
  6514. tabContentId = "zyTabContent";
  6515. $("#cyJsl").val(400);
  6516. $("#cyZql").val(200);
  6517. $("#cyFj").val(1);
  6518. $("#cyFfcs").val(2);
  6519. $("#cyMtjs").val(1);
  6520. $("#zyfs").val(null);
  6521. $("#cyJssm").selectpicker('val', "加凉水");
  6522. $('#cyJssm').selectpicker('refresh');
  6523. $("#zy_supplyType_1").selectpicker('val', null);
  6524. $('#zy_supplyType_1').selectpicker('refresh');
  6525. } else if (index == 2) {
  6526. //辅助检查、检验
  6527. tabId = "jcjyTab";
  6528. tabContentId = "jcjyTabContent";
  6529. } else if (index == 3) {
  6530. //医技
  6531. tabId = "zlTab";
  6532. tabContentId = "zlTabContent";
  6533. } else if (index == 4) {
  6534. //医技
  6535. tabId = "zyReqTab";
  6536. tabContentId = "zyReqTabContent";
  6537. }
  6538. $("#" + tabId).html(null);
  6539. $("#" + tabContentId).html(null);
  6540. }
  6541. /**
  6542. * 添加处方分页
  6543. * @param index 0 西药 1 中药 2 诊疗 3 入院
  6544. * @param groupNo 71 普通西药 91 医材 111 麻、精一 131 精二 151 诊疗
  6545. */
  6546. function refreshNavTabs(index, groupNo) {
  6547. var tabId = null;
  6548. var tabContentId = null;
  6549. var paneIdPrfix = null;
  6550. var cfdesc = '普药';
  6551. //西药
  6552. if (index == 0) {
  6553. tabId = "xyTab";
  6554. tabContentId = "xyTabContent";
  6555. paneIdPrfix = "xycf_";
  6556. if (groupNo == '91') {
  6557. cfdesc = '医材';
  6558. } else if (groupNo == '111') {
  6559. cfdesc = '麻、精一';
  6560. } else if (groupNo == '131') {
  6561. cfdesc = '精二';
  6562. }
  6563. // else if(groupNo=='151'){
  6564. // cfdesc='诊疗';
  6565. // }
  6566. } else if (index == 1) {
  6567. //中草药
  6568. tabId = "zyTab";
  6569. tabContentId = "zyTabContent";
  6570. paneIdPrfix = "zycf_";
  6571. cfdesc = '中草药';
  6572. } else if (index == 2) {
  6573. //辅助检查、检验
  6574. tabId = "jcjyTab";
  6575. tabContentId = "jcjyTabContent";
  6576. paneIdPrfix = "jcjycf_";
  6577. cfdesc = '辅助检查、检验';
  6578. } else if (index == 3) {
  6579. //诊疗
  6580. tabId = "zlTab";
  6581. tabContentId = "zlTabContent";
  6582. paneIdPrfix = "zlcf_";
  6583. cfdesc = '诊疗';
  6584. } else if (index == 4) {
  6585. //入院
  6586. tabId = "zyReqTab";
  6587. tabContentId = "zyReqTabContent";
  6588. paneIdPrfix = "zyReqcf_";
  6589. cfdesc = '入院';
  6590. }
  6591. // var tableId = $("#"+tabId+" li.active").find("a").attr("href");
  6592. // var length = $(tableId).find("div:eq(0)").children().length;
  6593. // if(length==0){
  6594. // //当前处方是空白的,不需要新增处方
  6595. // return;
  6596. // }
  6597. var cfTitle = "处方" + " <small class=\"cfdesc\">(" + cfdesc + ")</small>";
  6598. var paneId = paneIdPrfix + getUID();
  6599. //清除选中的样式
  6600. $("#" + tabId).find("li.active").removeClass("active");
  6601. var tabHtml = '<li><a href="#' + paneId + '" role="tab" data-toggle="tab"';
  6602. if (index == 0) {
  6603. tabHtml += ' onclick=xyTableOnClick("' + paneId + '")';
  6604. }
  6605. tabHtml += '>' + cfTitle + '</a';
  6606. tabHtml += '</li>';
  6607. $("#" + tabId).append(tabHtml);
  6608. var html = '<div class="tab-pane fade in active" id="' + paneId + '" style="height: 100%;min-height: 285px;position: relative;">' +
  6609. '<img src="/thmz/images/prescription.png" style="margin-top: 5px;"/>' +
  6610. '<input class="current_groupNo" type="hidden"/>' +
  6611. ' <div class="cf_content rb_item" style="height: 230px;padding-top: 5px;overflow-y: auto;"></div>' +
  6612. ' <div style="height: 30px;border-top: 1px solid #ddd;width: 100%;position: absolute;bottom:0;">' +
  6613. '<div style="width: 460px;">' +
  6614. '<div style="width: 130px;float: left;padding-left: 7px;padding-top: 8px;">金额:<span class="cf_amount">0.0</span><span>元</span></div>';
  6615. if (index == 0) {
  6616. html += '<div style="width: 310px;float: left;color: red;padding-top: 8px;">说明:此费用包含药品给药方式所产生的费用!</div>';
  6617. }
  6618. html += '</div></div>';
  6619. $("#" + tabContentId).append(html);
  6620. //切换处方
  6621. $("#" + tabId).find("a[href='#" + paneId + "']").off("click").tab('show');
  6622. }
  6623. /**
  6624. * 判断是否需要自动增加组号
  6625. * @param res
  6626. */
  6627. function autoAddGroupId(res) {
  6628. var tableId = $("#xyTab li.active").find("a").attr("href");
  6629. var childrens = $(tableId).find("div:eq(0)").children();
  6630. var prevCategoriesFlag = null;
  6631. if (childrens != null && childrens.length > 0) {
  6632. prevCategoriesFlag = $(childrens[childrens.length - 1]).find("input.temporary_items_categoriesFlag").val();
  6633. if (prevCategoriesFlag == "" || prevCategoriesFlag == undefined) {
  6634. prevCategoriesFlag = null;
  6635. }
  6636. }
  6637. if (!(res.data.categoriesFlag == 2 || res.data.categoriesFlag == "2" || res.data.categoriesFlag == 1 || res.data.categoriesFlag == "1") ||
  6638. ((res.data.categoriesFlag == 2 || res.data.categoriesFlag == "2" || res.data.categoriesFlag == 1 || res.data.categoriesFlag == "1") && prevCategoriesFlag != null && prevCategoriesFlag != "1" && prevCategoriesFlag != 1 && prevCategoriesFlag != "2" && prevCategoriesFlag != 2)) {
  6639. //非针剂默认要切换组号 或者 是针剂,但是上一个药品不是针剂,这时候也要新换一个组号
  6640. var last = parseInt($("#groupId > option:last").val());
  6641. $("#groupId").selectpicker('val', last);
  6642. $('#groupId').selectpicker('refresh');
  6643. }
  6644. }
  6645. /**
  6646. * 填充西药选中的内容
  6647. * @param res
  6648. * @param groupNo
  6649. */
  6650. function fitWesternMedicine(res, groupNo) {
  6651. autoAddGroupId(res);
  6652. $("#categoriesFlag").val(res.data.categoriesFlag);
  6653. //prevCategoriesFlag = res.data.categoriesFlag;
  6654. $("#western_medicine_name").val(res.data.name);
  6655. $("#western_medicine_name").blur();
  6656. var drugWinHtml = '';
  6657. var index = null;
  6658. if (res.data.weight != null) {
  6659. $("#drugWin").val(res.data.weight);
  6660. $("#drugWinDb").val(res.data.weight);
  6661. drugWinHtml = '<option value="' + res.data.weighUnit + '" desc="' + res.data.weight + '">' + res.data.weighUnitDesc + '</option>';
  6662. index = res.data.weighUnit;
  6663. }
  6664. if (res.data.volum != null) {
  6665. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  6666. $("#drugWin").val(res.data.volum);
  6667. $("#drugWinDb").val(res.data.volum);
  6668. }
  6669. drugWinHtml += '<option value="' + res.data.volUnit + '" desc="' + res.data.volum + '">' + res.data.volUnitDesc + '</option>';
  6670. if (index == null) {
  6671. index = res.data.volUnit;
  6672. }
  6673. }
  6674. if (res.data.miniUnit != null && res.data.miniUnit != "") {
  6675. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  6676. $("#drugWin").val(1);
  6677. $("#drugWinDb").val(1);
  6678. }
  6679. drugWinHtml += '<option value="' + res.data.miniUnit + '" desc="1">' + res.data.miniUnitDesc + '</option>';
  6680. if (index == null) {
  6681. index = res.data.miniUnit;
  6682. }
  6683. }
  6684. $('#drugWinUnit').html(drugWinHtml);
  6685. $('#drugWinUnit').selectpicker('refresh');
  6686. $("#drugWinUnit").selectpicker('val', index);
  6687. $('#drugWinUnit').selectpicker('refresh');
  6688. if (res.data.packUnitDesc != null && res.data.packUnitDesc != "") {
  6689. var html = '<option value="' + res.data.packUnitDesc + '" >' + res.data.packUnitDesc + '</option>';
  6690. $('#packUnit').html(html);
  6691. $('#packUnit').selectpicker('refresh');
  6692. $("#packUnit").selectpicker('val', res.data.packUnitDesc);
  6693. $('#packUnit').selectpicker('refresh');
  6694. }
  6695. $("#packRetprice").val(res.data.packRetprice);
  6696. $("#packSize").val(res.data.packSize);
  6697. $("#western_medicine_current_code").val(res.data.code);
  6698. $("#western_medicine_current_serial").val(res.data.serial);
  6699. if ($("#dayNum").val() == null) {
  6700. //天数 同组药品天数相同
  6701. $("#dayNum").selectpicker('val', 1);
  6702. $('#dayNum').selectpicker('refresh');
  6703. }
  6704. if ($("#supplyType").val() == null && res.data.supplyType != null) {
  6705. // 给药方式 同组药品给药方式相同
  6706. $("#supplyType").selectpicker('val', res.data.supplyType);
  6707. $('#supplyType').selectpicker('refresh');
  6708. }
  6709. if ($("#orderFrequency").val() == null && res.data.frequency != null) {
  6710. //频次编码 同组药品频次编码相同
  6711. $("#orderFrequency").selectpicker('val', res.data.frequency);
  6712. $('#orderFrequency').selectpicker('refresh');
  6713. }
  6714. if ($("#orderFrequency").val() == null) {
  6715. //频次编码 防止频次为空
  6716. $("#orderFrequency").selectpicker('val', "ONCE");
  6717. $('#orderFrequency').selectpicker('refresh');
  6718. }
  6719. $("#tryResult").parent().parent().parent().removeClass("in").addClass("hide");
  6720. if (res.data.psFlag != null && (res.data.psFlag == 1 || res.data.psFlag == "1")) {
  6721. if (res.data.categoriesFlag == 0 || res.data.categoriesFlag == "0" || res.data.categoriesFlag == 2 || res.data.categoriesFlag == "2") {
  6722. initTryResultSelect(res.data.categoriesFlag);
  6723. }
  6724. }
  6725. $("#manufactoryName").val(res.data.manufactoryName);
  6726. $("#specification").val(res.data.specification);
  6727. // if (groupNo == "91") {
  6728. // //医材
  6729. // $("#gross").removeAttr("readonly")
  6730. // } else {
  6731. // $("#gross").attr("readonly", "readonly");
  6732. // }
  6733. calculate();
  6734. $("#western_medicine_name").focus();
  6735. }
  6736. /**
  6737. * 剂量单位改变事件
  6738. */
  6739. function drugWinUnitChange() {
  6740. var desc = $('#drugWinUnit').find("option:selected").attr('desc');
  6741. $("#drugWin").val(desc);
  6742. $("#drugWinDb").val(desc);
  6743. calculate();
  6744. }
  6745. /**
  6746. * 根据选择的内容计算总的用药量
  6747. */
  6748. function calculate() {
  6749. //最小规格剂量
  6750. var drugWinDb = $("#drugWinDb").val();
  6751. //天数
  6752. var dayNum = $("#dayNum").val();
  6753. //当前使用的最小剂量
  6754. var drugWin = $("#drugWin").val();
  6755. //频率
  6756. var times = $('#orderFrequency').find("option:selected").attr('desc');
  6757. //包装规格数量
  6758. var packSize = $("#packSize").val();
  6759. //单价
  6760. var packRetprice = $("#packRetprice").val();
  6761. //当前药房编码
  6762. var currentGroupNo = $("#current_groupNo").val();
  6763. if (drugWinDb == null || drugWinDb === "") {
  6764. if (currentGroupNo == '71') {
  6765. return;
  6766. }
  6767. drugWinDb = 1;
  6768. }
  6769. if (dayNum == null || dayNum === "") {
  6770. if (currentGroupNo == '71') {
  6771. return;
  6772. }
  6773. dayNum = 1;
  6774. }
  6775. if (drugWin == null || drugWin === "") {
  6776. if (currentGroupNo == '71') {
  6777. return;
  6778. }
  6779. drugWin = 1;
  6780. }
  6781. if (times == null || times === "") {
  6782. if (currentGroupNo == '71') {
  6783. return;
  6784. }
  6785. times = 1;
  6786. }
  6787. if (packSize == null || packSize === "") {
  6788. return;
  6789. }
  6790. //拆零总量
  6791. var scatteredTotalNum = Multiply(Multiply(dayNum, drugWin), times);
  6792. //整包装的数量
  6793. var totalNum = Math.ceil(Division(scatteredTotalNum, Multiply(packSize, drugWinDb)));
  6794. $("#gross").val(totalNum);
  6795. $("#totalRetprice").val(Multiply(totalNum, packRetprice).toFixed(2));
  6796. }
  6797. /**
  6798. * 根据选择的总量计算金额 只有医材的时候需要计算
  6799. */
  6800. function calculateSimple() {
  6801. //总量
  6802. var gross = $("#gross").val();
  6803. //单价
  6804. var packRetprice = $("#packRetprice").val();
  6805. $("#totalRetprice").val(Multiply(gross, packRetprice).toFixed(2));
  6806. //当前药房编码
  6807. var currentGroupNo = $("#current_groupNo").val();
  6808. if (currentGroupNo == '91') {
  6809. //医材默认天数为1
  6810. $("#dayNum").selectpicker('val', 1);
  6811. $('#dayNum').selectpicker('refresh');
  6812. $("#orderFrequency").selectpicker('val', "ONCE");
  6813. $('#orderFrequency').selectpicker('refresh');
  6814. }
  6815. }
  6816. /**
  6817. * 根据中药付数计算金额
  6818. */
  6819. function calculateZyAmount() {
  6820. var singleAmount = $("#singleAmount").val();
  6821. var tableId = $("#zyTab li.active").find("a").attr("href");
  6822. //获取中药付数
  6823. //var zyfs = $(tableId).find("input.zyfs").val();
  6824. var zyfs = $("#zyfs").val();
  6825. var cfAmount = Multiply(zyfs, singleAmount);
  6826. $(tableId).find("span.cf_amount").html(cfAmount);
  6827. calculateTotalAmount();
  6828. }
  6829. /**
  6830. * 将病人信息填入患者信息修改form
  6831. * @param patinet
  6832. */
  6833. function fillPlusPatinet(patinet) {
  6834. if (patinet != null) {
  6835. $("#editUserCode").val(patinet.patientId);
  6836. $("#editUserName").val(patinet.name);
  6837. $("#editUserName").blur();
  6838. $("#editUserAge").val(patinet.age);
  6839. $("#editUserAge").blur();
  6840. $("#editUserGender").selectpicker('val', patinet.sex);
  6841. $("#editUserGender").selectpicker('refresh');
  6842. $("#editUserGender").blur();
  6843. $("#editUserBirthDay").val(patinet.birthDayStr);
  6844. $("#editUserBirthDay").blur();
  6845. $('#editUserCertificateType').selectpicker('val', patinet.certificateType);
  6846. $('#editUserCertificateType').selectpicker('refresh');
  6847. $("#editUserCardNo").val(patinet.icCardNo);
  6848. $("#editUserCardNo").attr("title", patinet.icCardNo);
  6849. $("#editUserCardNo").blur();
  6850. $("#editUserPhoneNum").val(patinet.phoneNo);
  6851. $("#editUserPhoneNum").attr("title", patinet.phoneNo);
  6852. $("#editUserPhoneNum").blur();
  6853. $("#editUserPatientsNature").selectpicker('val', patinet.responseType);//默认选中
  6854. $('#editUserPatientsNature').selectpicker('refresh');
  6855. $("#editUserPatientsNature").blur();
  6856. $("#editUserIdCard").val(patinet.socialNo);
  6857. $("#editUserIdCard").attr("title", patinet.socialNo);
  6858. $("#editUserIdCard").blur();
  6859. $("#editUserAddress").val(patinet.address);
  6860. $("#editUserAddress").blur();
  6861. $("#editUserContact").val(patinet.relName);
  6862. $("#editUserContactPhone").val(patinet.contractName);
  6863. }
  6864. }
  6865. /**
  6866. * 修改病人信息
  6867. */
  6868. function modifyPatient() {
  6869. $.ajax({
  6870. type: "POST",
  6871. url: '/thmz/modifyPatient',
  6872. contentType: "application/json;charset=UTF-8",
  6873. dataType: "json",
  6874. data: JSON.stringify({
  6875. "name": $("#editUserName").val(),
  6876. "age": $("#editUserAge").val(),
  6877. "sex": $("#editUserGender").val(),
  6878. "birthDay": $("#editUserBirthDay").val(),
  6879. "certificateType": $("#editUserCertificateType").val(),
  6880. "icCardNo": $("#editUserCardNo").val(),
  6881. "phoneNo": $("#editUserPhoneNum").val(),
  6882. "responseType": $("#editUserPatientsNature").val(),
  6883. "socialNo": $("#editUserIdCard").val(),
  6884. "address": $("#editUserAddress").val(),
  6885. "patientId": $("#editUserCode").val(),
  6886. "relName": $("#editUserContact").val(),
  6887. "contractName": $("#editUserContactPhone").val()
  6888. }),
  6889. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6890. success: function (res) {
  6891. if (res == '401' || res == 401) {
  6892. window.location.href = '/thmz/login/view'
  6893. return;
  6894. }
  6895. if (res.code == 0) {
  6896. $('#editUserModal').modal('hide');
  6897. var patientId = $("#patientId").text();
  6898. if (patientId != null && patientId != 'null' && patientId != "") {
  6899. realClinicalReception(patientId, $("#mzfzSerialNoInClick").val(), $("#mzfzReqTypeNoInClick").val());
  6900. }
  6901. clearPlusPatinet();
  6902. } else {
  6903. errorMesage(res);
  6904. }
  6905. }
  6906. });
  6907. }
  6908. /**
  6909. * 将病人信息修改域置空
  6910. * @param patinet
  6911. */
  6912. function clearPlusPatinet() {
  6913. $("#editUserCode").val(null);
  6914. $("#editUserName").val(null);
  6915. $("#editUserAge").val(null);
  6916. $("#editUserGender").selectpicker('val', '1');
  6917. $("#editUserGender").selectpicker('refresh');
  6918. $("#editUserBirthDay").val(null);
  6919. $('#editUserCertificateType').selectpicker('val', '01');
  6920. $('#editUserCertificateType').selectpicker('refresh');
  6921. $("#editUserCardNo").val(null);
  6922. $("#editUserCardNo").attr("title", null);
  6923. $("#editUserPhoneNum").val(null);
  6924. $("#editUserPhoneNum").attr("title", null);
  6925. $("#editUserPatientsNature").selectpicker('val', '01');//默认选中
  6926. $('#editUserPatientsNature').selectpicker('refresh');
  6927. $("#editUserIdCard").val(null);
  6928. $("#editUserIdCard").attr("title", null);
  6929. $("#editUserAddress").val(null);
  6930. $("#editUserContact").val(null);
  6931. $("#editUserContactPhone").val(null);
  6932. }
  6933. // /**
  6934. // * 保存入院证
  6935. // */
  6936. // function saveBeHospitalized() {
  6937. // $.ajax({
  6938. // type: "POST",
  6939. // url: '/thmz/saveMzZyReq',
  6940. // contentType: "application/json;charset=UTF-8",
  6941. // dataType: "json",
  6942. // data: JSON.stringify({
  6943. // "patientId": $("#patientId").text(),
  6944. // "icdCode": $("#icdCodeBeHospitalized").val(),
  6945. // "icdText": $("#icdTextBeHospitalized").val(),
  6946. // "reqDept": $("#inpatientWardBeHospitalized").val(),
  6947. // "smallDept": $("#smallWardBeHospitalized").val(),
  6948. // "admissStatus": $("#admissStatus").val()
  6949. // }),
  6950. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6951. // success: function (res) {
  6952. // if (res == '401' || res == 401) {
  6953. // window.location.href = '/thmz/login/view'
  6954. // return;
  6955. // }
  6956. // if (res.code == 0) {
  6957. // successMesage(res);
  6958. // $('#beHospitalizedModal').modal('hide');
  6959. // loadInClinicTableList();
  6960. // loadClinicTableList();
  6961. // clearWorkSpace();
  6962. // } else {
  6963. // errorMesage(res);
  6964. // }
  6965. // }
  6966. // });
  6967. // }
  6968. /**
  6969. * 获取按钮组选择的下标
  6970. * @param id
  6971. * @returns {number}
  6972. */
  6973. function getIndex(id) {
  6974. var index = 0;
  6975. var item = $("#" + id).find("button");
  6976. for (var i = 0; i <= item.length; i++) {
  6977. if ($(item[i]).hasClass("btn-primary")) {
  6978. index = i;
  6979. break;
  6980. }
  6981. }
  6982. return index;
  6983. }
  6984. /**
  6985. * 获取时间选择器的时间数组
  6986. * @returns {string[]}
  6987. */
  6988. function getRePortRangeArr() {
  6989. var rePortRange = $('#reportrange span').html();
  6990. var rePortRangeArr = rePortRange.split(" - ");
  6991. rePortRangeArr[0] = rePortRangeArr[0] + " 00:00:00"
  6992. rePortRangeArr[1] = rePortRangeArr[1] + " 23:59:59"
  6993. return rePortRangeArr;
  6994. }
  6995. /**
  6996. * 初始医生工作太配置
  6997. */
  6998. function initWorkspaceConfigForCurrent() {
  6999. $.ajax({
  7000. type: "GET",
  7001. url: '/thmz/getWorkspaceConfigForCurrent',
  7002. dataType: "json",
  7003. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7004. success: function (res) {
  7005. if (res == '401' || res == 401) {
  7006. window.location.href = '/thmz/login/view'
  7007. return;
  7008. }
  7009. if (res.code == 0) {
  7010. if (res.data.symptomFlag == 1) {
  7011. $("#symptomFlag").removeClass("in").addClass("hide");
  7012. if ($("#symptomFlagCheck").parent().hasClass("checked")) {
  7013. $("#symptomFlagCheck").parent().parent().click();//当前选中改为不选中
  7014. }
  7015. } else if (res.data.symptomFlag == 0) {
  7016. $("#symptomFlag").removeClass("hide").addClass("in");
  7017. if (!$("#symptomFlagCheck").parent().hasClass("checked")) {
  7018. $("#symptomFlagCheck").parent().parent().click();//当前不选中改为选中
  7019. }
  7020. }
  7021. if (res.data.emrHpiFlag == 1) {
  7022. $("#emrHpiFlag").removeClass("in").addClass("hide");
  7023. if ($("#emrHpiFlagCheck").parent().hasClass("checked")) {
  7024. $("#emrHpiFlagCheck").parent().parent().click();//当前选中改为不选中
  7025. }
  7026. } else if (res.data.emrHpiFlag == 0) {
  7027. $("#emrHpiFlag").removeClass("hide").addClass("in");
  7028. if (!$("#emrHpiFlagCheck").parent().hasClass("checked")) {
  7029. $("#emrHpiFlagCheck").parent().parent().click();//当前不选中改为选中
  7030. }
  7031. }
  7032. if (res.data.emrPsFlag == 1) {
  7033. $("#emrPsFlag").removeClass("in").addClass("hide");
  7034. if ($("#emrPsFlagCheck").parent().hasClass("checked")) {
  7035. $("#emrPsFlagCheck").parent().parent().click();//当前选中改为不选中
  7036. }
  7037. } else if (res.data.emrPsFlag == 0) {
  7038. $("#emrPsFlag").removeClass("hide").addClass("in");
  7039. if (!$("#emrPsFlagCheck").parent().hasClass("checked")) {
  7040. $("#emrPsFlagCheck").parent().parent().click();//当前不选中改为选中
  7041. }
  7042. }
  7043. if (res.data.personalHistoryFlag == 1) {
  7044. $("#personalHistoryFlag").removeClass("in").addClass("hide");
  7045. if ($("#personalHistoryFlagCheck").parent().hasClass("checked")) {
  7046. $("#personalHistoryFlagCheck").parent().parent().click();//当前选中改为不选中
  7047. }
  7048. } else if (res.data.personalHistoryFlag == 0) {
  7049. $("#personalHistoryFlag").removeClass("hide").addClass("in");
  7050. if (!$("#personalHistoryFlagCheck").parent().hasClass("checked")) {
  7051. $("#personalHistoryFlagCheck").parent().parent().click();//当前不选中改为选中
  7052. }
  7053. }
  7054. if (res.data.familyHistoryFlag == 1) {
  7055. $("#familyHistoryFlag").removeClass("in").addClass("hide");
  7056. if ($("#familyHistoryFlagCheck").parent().hasClass("checked")) {
  7057. $("#familyHistoryFlagCheck").parent().parent().click();//当前选中改为不选中
  7058. }
  7059. } else if (res.data.familyHistoryFlag == 0) {
  7060. $("#familyHistoryFlag").removeClass("hide").addClass("in");
  7061. if (!$("#familyHistoryFlagCheck").parent().hasClass("checked")) {
  7062. $("#familyHistoryFlagCheck").parent().parent().click();//当前不选中改为选中
  7063. }
  7064. }
  7065. if (res.data.obstericalHistoryFlag == 1) {
  7066. $("#obstericalHistoryFlag").removeClass("in").addClass("hide");
  7067. if ($("#obstericalHistoryFlagCheck").parent().hasClass("checked")) {
  7068. $("#obstericalHistoryFlagCheck").parent().parent().click();//当前选中改为不选中
  7069. }
  7070. } else if (res.data.obstericalHistoryFlag == 0) {
  7071. $("#obstericalHistoryFlag").removeClass("hide").addClass("in");
  7072. if (!$("#obstericalHistoryFlagCheck").parent().hasClass("checked")) {
  7073. $("#obstericalHistoryFlagCheck").parent().parent().click();//当前不选中改为选中
  7074. }
  7075. }
  7076. if (res.data.pressureLeftFlag == 1) {
  7077. $("#pressureLeftFlag").removeClass("in").addClass("hide");
  7078. if ($("#pressureLeftFlagCheck").parent().hasClass("checked")) {
  7079. $("#pressureLeftFlagCheck").parent().parent().click();//当前选中改为不选中
  7080. }
  7081. } else if (res.data.pressureLeftFlag == 0) {
  7082. $("#pressureLeftFlag").removeClass("hide").addClass("in");
  7083. if (!$("#pressureLeftFlagCheck").parent().hasClass("checked")) {
  7084. $("#pressureLeftFlagCheck").parent().parent().click();//当前不选中改为选中
  7085. }
  7086. }
  7087. if (res.data.tentativeDiagnosisFlag == 1) {
  7088. $("#tentativeDiagnosisFlag").removeClass("in").addClass("hide");
  7089. if ($("#tentativeDiagnosisFlagCheck").parent().hasClass("checked")) {
  7090. $("#tentativeDiagnosisFlagCheck").parent().parent().click();//当前选中改为不选中
  7091. }
  7092. } else if (res.data.tentativeDiagnosisFlag == 0) {
  7093. $("#tentativeDiagnosisFlag").removeClass("hide").addClass("in");
  7094. if (!$("#tentativeDiagnosisFlagCheck").parent().hasClass("checked")) {
  7095. $("#tentativeDiagnosisFlagCheck").parent().parent().click();//当前不选中改为选中
  7096. }
  7097. }
  7098. if (res.data.checkboxFlag == 1) {
  7099. if ($("#checkboxFlagCheck").parent().hasClass("checked")) {
  7100. $("#checkboxFlagCheck").parent().parent().click();//当前选中改为不选中
  7101. }
  7102. } else if (res.data.checkboxFlag == 0) {
  7103. if (!$("#checkboxFlagCheck").parent().hasClass("checked")) {
  7104. $("#checkboxFlagCheck").parent().parent().click();//当前不选中改为选中
  7105. }
  7106. }
  7107. //设置是否默认勾选处方回调
  7108. localStorage.setItem("checkboxFlag", res.data.checkboxFlag);
  7109. } else {
  7110. errorMesage(res);
  7111. }
  7112. }
  7113. });
  7114. }
  7115. /**
  7116. * 保存医生工作台配置
  7117. */
  7118. function saveWorkspaceConfig() {
  7119. var symptomFlag = $("#symptomFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  7120. var emrHpiFlag = $("#emrHpiFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  7121. var emrPsFlag = $("#emrPsFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  7122. var personalHistoryFlag = $("#personalHistoryFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  7123. var familyHistoryFlag = $("#familyHistoryFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  7124. var obstericalHistoryFlag = $("#obstericalHistoryFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  7125. var pressureLeftFlag = $("#pressureLeftFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  7126. var tentativeDiagnosisFlag = $("#tentativeDiagnosisFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  7127. var checkboxFlag = $("#checkboxFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  7128. $.ajax({
  7129. type: "POST",
  7130. url: '/thmz/saveWorkspaceConfig',
  7131. contentType: "application/json;charset=UTF-8",
  7132. dataType: "json",
  7133. data: JSON.stringify({
  7134. "symptomFlag": symptomFlag,
  7135. "emrHpiFlag": emrHpiFlag,
  7136. "emrPsFlag": emrPsFlag,
  7137. "personalHistoryFlag": personalHistoryFlag,
  7138. "familyHistoryFlag": familyHistoryFlag,
  7139. "obstericalHistoryFlag": obstericalHistoryFlag,
  7140. "pressureLeftFlag": pressureLeftFlag,
  7141. "tentativeDiagnosisFlag": tentativeDiagnosisFlag,
  7142. "checkboxFlag": checkboxFlag
  7143. }),
  7144. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7145. success: function (res) {
  7146. if (res == '401' || res == 401) {
  7147. window.location.href = '/thmz/login/view'
  7148. return;
  7149. }
  7150. if (res.code == 0) {
  7151. //successMesage(res);
  7152. initWorkspaceConfigForCurrent();
  7153. $("#configWorkspaceModal").modal("hide");
  7154. } else {
  7155. errorMesage(res);
  7156. }
  7157. }
  7158. });
  7159. }
  7160. /**
  7161. * 初始化药品,检查检验菜单树
  7162. */
  7163. function initzTree() {
  7164. var index = getIndex("bill_item_group");
  7165. if (index == 0) {
  7166. $("#western_medicine_name").webuiPopover('hide');
  7167. $.ajax({
  7168. type: "GET",
  7169. url: '/thmz/getYpZdClasses',
  7170. contentType: "application/json;charset=UTF-8",
  7171. dataType: "json",
  7172. async: false,
  7173. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7174. success: function (res) {
  7175. if (res == '401' || res == 401) {
  7176. window.location.href = '/thmz/login/view'
  7177. return;
  7178. }
  7179. if (res.code == 0) {
  7180. // zTree 的参数配置,深入使用请参考 API 文档(setting 配置详解)
  7181. var setting = {
  7182. callback: {
  7183. onClick: zTreeOnClick
  7184. }
  7185. };
  7186. $.fn.zTree.init($("#treeDemo"), setting, res.data);
  7187. var webuiId = $("#treeButton").attr("data-target");
  7188. var top = $("#" + webuiId).css("top");
  7189. if (top.indexOf("-") == 0) {
  7190. $("#" + webuiId).css("top", '0px');
  7191. }
  7192. } else {
  7193. errorMesage(res);
  7194. }
  7195. }
  7196. });
  7197. } else if (index == 2) {
  7198. $("#jcJyItem").webuiPopover('hide');
  7199. $.ajax({
  7200. type: "GET",
  7201. url: '/thmz/getJyJcZdClasses',
  7202. contentType: "application/json;charset=UTF-8",
  7203. dataType: "json",
  7204. async: false,
  7205. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7206. success: function (res) {
  7207. if (res == '401' || res == 401) {
  7208. window.location.href = '/thmz/login/view'
  7209. return;
  7210. }
  7211. if (res.code == 0) {
  7212. // zTree 的参数配置,深入使用请参考 API 文档(setting 配置详解)
  7213. var setting = {
  7214. callback: {
  7215. onClick: zTreeOnClick
  7216. }
  7217. };
  7218. $.fn.zTree.init($("#treeDemo"), setting, res.data);
  7219. var webuiId = $("#treeButton").attr("data-target");
  7220. var top = $("#" + webuiId).css("top");
  7221. if (top.indexOf("-") == 0) {
  7222. $("#" + webuiId).css("top", '0px');
  7223. }
  7224. } else {
  7225. errorMesage(res);
  7226. }
  7227. }
  7228. });
  7229. } else if (index == 1) {
  7230. $("#treeButton").webuiPopover('hide');
  7231. warningMesageSimaple("中药暂无帮助字典");
  7232. } else if (index == 3) {
  7233. $("#treeButton").webuiPopover('hide');
  7234. warningMesageSimaple("诊疗暂无帮助字典");
  7235. } else {
  7236. $("#treeButton").webuiPopover('hide');
  7237. warningMesageSimaple("入院暂无帮助字典");
  7238. }
  7239. }
  7240. /**
  7241. * 节点点击事件
  7242. * @param event
  7243. * @param treeId
  7244. * @param treeNode
  7245. */
  7246. function zTreeOnClick(event, treeId, treeNode) {
  7247. var index = getIndex("bill_item_group");
  7248. if (index == 0) {
  7249. $("#western_medicine_name").val(treeNode.id);
  7250. $('#western_medicine_name').webuiPopover('show');
  7251. loadYpList(0, null);
  7252. } else if (index == 2) {
  7253. $("#jcJyItem").val(treeNode.id);
  7254. $('#jcJyItem').webuiPopover('show');
  7255. loadjcJyItemList(null);
  7256. }
  7257. }
  7258. /**
  7259. * 构建处方参数
  7260. * @param type 1 保存处方 2 保存模板 3 计算金额
  7261. * @returns {any}
  7262. */
  7263. function getParamsForpPrescription(type) {
  7264. var codes = $("#diagnoseValue").val();
  7265. var icdCode = null;
  7266. if (codes != null && codes.length > 0) {
  7267. var arr = codes.split(",");
  7268. if (arr != null) {
  7269. for (i = 0; i < arr.length; i++) {
  7270. if (arr[i] != "") {
  7271. if (icdCode == null) {
  7272. icdCode = arr[i];
  7273. } else {
  7274. icdCode += "," + arr[i];
  7275. }
  7276. }
  7277. }
  7278. }
  7279. }
  7280. var jsonData = JSON.parse('' +
  7281. '{"patientId": "",' +
  7282. '"firstOrNot":"",' +
  7283. '"icdCode": "",' +
  7284. '"icdText": null,' +
  7285. '"jzFlag": "0",' +
  7286. '"serialNo":"",' +
  7287. '"mzBlRecord": ' +
  7288. '{"firstOrNot": "",' +
  7289. '"emrChiefComplaint": "",' +
  7290. '"emrHpi": "",' +
  7291. '"emrPs": "",' +
  7292. '"emrPe": "",' +
  7293. '"emrFzjc": null,' +
  7294. '"emrProcess": null,' +
  7295. '"emrXyy": "无",' +
  7296. '"emrYypg": "无",' +
  7297. '"emrGnpg": "无",' +
  7298. '"emrJkjy": "",' +
  7299. '"personalHistory": "",' +
  7300. '"familyHistory": "",' +
  7301. '"obstericalHistory": "",' +
  7302. '"weight": "",' +
  7303. '"temperature": "",' +
  7304. '"sphygmus": "",' +
  7305. '"breathe": "",' +
  7306. '"pressureHigh": "",' +
  7307. '"pressureFloor": "",' +
  7308. '"pressureHighLeft": "",' +
  7309. '"pressureFloorLeft": "",' +
  7310. '"tentativeDiagnosis":"",' +
  7311. '"prescriptionDetail":""},' +
  7312. '"mzChargeDetailList": [],' +
  7313. '"mzYjReqList": [],' +
  7314. '"mzZyReq": {"reqDept": "","smallDept": "","admissStatus": ""},' +
  7315. '"zgmztczf":"",' +
  7316. '"grzhzf":"",' +
  7317. '"readCardResult":"",' +
  7318. '"readCardType":"01"}');
  7319. jsonData.patientId = $("#patientId").text();
  7320. jsonData.firstOrNot = $("input[name='firstOrNot']:checked").val();
  7321. jsonData.icdCode = icdCode;
  7322. jsonData.serialNo = $("#mzfzSerialNoInClick").val();
  7323. if (type == 1) {
  7324. jsonData.turnToConsultationId = $("#turnToConsultationIdInClick").val();
  7325. }
  7326. jsonData.mzBlRecord.firstOrNot = jsonData.firstOrNot;
  7327. jsonData.mzBlRecord.emrChiefComplaint = $("#symptom").val();
  7328. jsonData.mzBlRecord.emrHpi = $("#emrHpi").val();
  7329. jsonData.mzBlRecord.emrPs = $("#emrPs").val();
  7330. jsonData.mzBlRecord.emrPe = $("#otherCheck").val();
  7331. jsonData.mzBlRecord.emrJkjy = $("#healthEducation").val();
  7332. jsonData.mzBlRecord.personalHistory = $("#personalHistory").val();
  7333. jsonData.mzBlRecord.familyHistory = $("#familyHistory").val();
  7334. jsonData.mzBlRecord.obstericalHistory = $("#obstericalHistory").val();
  7335. jsonData.mzBlRecord.weight = $("#weight").val();
  7336. jsonData.mzBlRecord.temperature = $("#temperature").val();
  7337. jsonData.mzBlRecord.sphygmus = $("#sphygmus").val();
  7338. jsonData.mzBlRecord.breathe = $("#breathe").val();
  7339. jsonData.mzBlRecord.pressureHigh = $("#pressure_high").val();
  7340. jsonData.mzBlRecord.pressureFloor = $("#pressure_floor").val();
  7341. jsonData.mzBlRecord.pressureHighLeft = $("#pressure_high_left").val();
  7342. jsonData.mzBlRecord.pressureFloorLeft = $("#pressure_floor_left").val();
  7343. jsonData.mzBlRecord.tentativeDiagnosis = $("#tentativeDiagnosis").val();
  7344. //职工统筹部分参数
  7345. jsonData.zgmztczf = $("#zgmztczf").val();
  7346. jsonData.grzhzf = $("#grzhzf").val();
  7347. jsonData.readCardResult = $("#readCardResult").val();
  7348. //设置处方详情
  7349. var emrFzjc = null;
  7350. var xyTabContents = $("#xyTabContent").find("div.tab-pane");
  7351. //处方号
  7352. var orderNo = 0;
  7353. var arrs = $("span.cf_amount");
  7354. //西药设置
  7355. if (xyTabContents != null && xyTabContents.length > 0) {
  7356. for (var i = 0; i < xyTabContents.length; i++) {
  7357. //当前药品类型
  7358. var currentGroupNo = $(xyTabContents[i]).find("input.current_groupNo").val();
  7359. var formGroups = $(xyTabContents[i]).find("div.form-group");
  7360. if (formGroups != null && formGroups.length > 0) {
  7361. for (var j = 0; j < formGroups.length; j++) {
  7362. var tempJson = JSON.parse('{"chargeItemCode": "","serial": "","quantity": "","drugQuan": "","drugUnit": "","frequency": "","orderDays": "","paySelf": "0","drugWin": "1","instructionCode":"",' +
  7363. '"instructionText":"","orderNo":"","groupOrder":"","supplyCode":"","tryFlag":"0","tryResult":"0","groupNo":"","cyJssm":"","cyDj":"","cyFysm":"","cyJsl":"","cyZql":"","cyFj":"","cyFfcs":"","cyMtjs":""}');
  7364. tempJson.chargeItemCode = $(formGroups[j]).find("input.temporary_items_code").val();
  7365. tempJson.serial = $(formGroups[j]).find("input.temporary_items_serial").val();
  7366. tempJson.quantity = $(formGroups[j]).find("input.temporary_items_gross").val();
  7367. tempJson.drugQuan = $(formGroups[j]).find("input.temporary_items_drugWin").val();
  7368. tempJson.drugUnit = $(formGroups[j]).find("input.temporary_items_drugWinUnit").val();
  7369. tempJson.frequency = $(formGroups[j]).find("input.temporary_items_orderFrequency").val();
  7370. tempJson.orderDays = $(formGroups[j]).find("input.temporary_items_dayNum").val();
  7371. tempJson.instructionCode = $(formGroups[j]).find("input.temporary_items_medicalAdvice").val();
  7372. tempJson.instructionText = $(formGroups[j]).find("input.temporary_items_medicalAdviceText").val();
  7373. tempJson.supplyCode = $(formGroups[j]).find("input.temporary_items_supplyType").val();
  7374. orderNo = i + 1;
  7375. tempJson.orderNo = orderNo;
  7376. tempJson.groupOrder = $(formGroups[j]).find("input.temporary_items_groupId").val();
  7377. tempJson.groupNo = currentGroupNo;
  7378. var tryResult = $(formGroups[j]).find("input.temporary_items_tryResult").val();
  7379. if (tryResult != undefined || tryResult != null || tryResult != "") {
  7380. if (tryResult == 100 || tryResult == "100") {
  7381. tempJson.tryFlag = 1;
  7382. } else {
  7383. tempJson.tryResult = tryResult;
  7384. }
  7385. }
  7386. jsonData.mzChargeDetailList[jsonData.mzChargeDetailList.length] = tempJson;
  7387. }
  7388. }
  7389. }
  7390. }
  7391. //中草药
  7392. var zyTabContents = $("#zyTabContent").find("div.form-group");
  7393. if (zyTabContents != null && zyTabContents.length > 0) {
  7394. orderNo++;
  7395. var zyfs = $("#zyfs").val();
  7396. if (zyfs == null || zyfs == "") {
  7397. if (type == 3) {
  7398. zyfs = 1;
  7399. } else {
  7400. errorMesageSimaple("中药付数为空,请设置!");
  7401. $("#messageButton").attr("disabled", false);
  7402. throw new Error('中药付数为空,请设置!');
  7403. }
  7404. }
  7405. //中药的类型
  7406. var currentZyClassType = $("#current_zyClassType").val();
  7407. for (var i = 0; i < zyTabContents.length; i++) {
  7408. var tempJson = JSON.parse('{"chargeItemCode": "","serial": "","quantity": "","drugQuan": "","drugUnit": "g","frequency": "","orderDays": "1","paySelf": "0","drugWin": "","instructionCode":"",' +
  7409. '"instructionText":"","orderNo":"1","groupOrder":"1","supplyCode":"","tryFlag":"0","tryResult":"0","groupNo":"","cyJssm":"","cyDj":"","cyFysm":"","cyJsl":"","cyZql":"","cyFj":"","cyFfcs":"","cyMtjs":""}');
  7410. tempJson.chargeItemCode = $(zyTabContents[i]).find("input.temporary_items_code").val();
  7411. tempJson.serial = $(zyTabContents[i]).find("input.temporary_items_serial").val();
  7412. tempJson.quantity = $(zyTabContents[i]).find("input.temporary_items_drugWin").val();
  7413. tempJson.drugQuan = $(zyTabContents[i]).find("input.temporary_items_drugWin").val();
  7414. tempJson.drugWin = zyfs;
  7415. //tempJson.frequency = $("#zy_orderFrequency_1").val();
  7416. tempJson.instructionCode = $(zyTabContents[i]).find("input.temporary_items_zyInstruction").val();
  7417. tempJson.instructionText = $(zyTabContents[i]).find("input.temporary_items_zyInstructionText").val();
  7418. tempJson.cyFysm = $("#useType_1").val();
  7419. tempJson.cyJssm = $("#cyJssm").val();
  7420. tempJson.cyDj = $("#zy_supplyType_1").val();
  7421. tempJson.cyJsl = $("#cyJsl").val();
  7422. tempJson.cyZql = $("#cyZql").val();
  7423. tempJson.cyFj = $("#cyFj").val();
  7424. tempJson.cyFfcs = $("#cyFfcs").val();
  7425. tempJson.cyMtjs = $("#cyMtjs").val();
  7426. tempJson.orderNo = orderNo;
  7427. tempJson.groupNo = currentZyClassType;
  7428. jsonData.mzChargeDetailList[jsonData.mzChargeDetailList.length] = tempJson;
  7429. }
  7430. }
  7431. //辅助检查、检验
  7432. var jcjyTabContents = $("#jcjyTabContent").find("div.form-group");
  7433. if (jcjyTabContents != null && jcjyTabContents.length > 0) {
  7434. orderNo++;
  7435. for (var i = 0; i < jcjyTabContents.length; i++) {
  7436. if (emrFzjc == null) {
  7437. emrFzjc = $(jcjyTabContents[i]).text();
  7438. } else {
  7439. emrFzjc += "," + $(jcjyTabContents[i]).text();
  7440. }
  7441. var tempJson = null;
  7442. //项目类型
  7443. var itemsType = $(jcjyTabContents[i]).find("input.temporary_items_type").val();
  7444. //执行科室
  7445. var execUnit = $(jcjyTabContents[i]).find("input.temporary_items_execUnit").val();
  7446. tempJson = JSON.parse('{"orderCode":"","inspectPart":"","inspectStuff":"","jyRemark":"","orderNo":"1","execDept":""}');
  7447. tempJson.orderCode = $(jcjyTabContents[i]).find("input.temporary_items_code").val();
  7448. if (itemsType == "1" || itemsType == 1) {
  7449. //检验
  7450. tempJson.inspectStuff = $(jcjyTabContents[i]).find("input.temporary_items_desc_value").val();
  7451. } else if (itemsType == "2" || itemsType == 2) {
  7452. //检查
  7453. tempJson.inspectPart = $(jcjyTabContents[i]).find("input.temporary_items_desc_value").val();
  7454. }
  7455. tempJson.jyRemark = $(jcjyTabContents[i]).find("input.temporary_items_remark").val();
  7456. tempJson.orderNo = orderNo;
  7457. tempJson.execDept = execUnit;
  7458. jsonData.mzYjReqList[jsonData.mzYjReqList.length] = tempJson;
  7459. }
  7460. }
  7461. //诊疗
  7462. var zlTabContents = $("#zlTabContent").find("div.form-group");
  7463. if (zlTabContents != null && zlTabContents.length > 0) {
  7464. orderNo++;
  7465. for (var i = 0; i < zlTabContents.length; i++) {
  7466. var tempJson = null;
  7467. //执行科室
  7468. var execUnit = $(zlTabContents[i]).find("input.temporary_items_execUnit").val();
  7469. //诊疗,放入药品类型中入库,因为诊疗是与药品一样直接入明细库,但是是与医技在同一处方开立页面开立
  7470. 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":""}');
  7471. tempJson.chargeItemCode = $(zlTabContents[i]).find("input.temporary_items_code").val();
  7472. tempJson.instructionText = $(zlTabContents[i]).find("input.temporary_items_remark").val();
  7473. tempJson.quantity = $(zlTabContents[i]).find("input.temporary_items_itemQuantity").val();
  7474. tempJson.orderNo = orderNo;
  7475. tempJson.execDept = execUnit;
  7476. jsonData.mzChargeDetailList[jsonData.mzChargeDetailList.length] = tempJson;
  7477. }
  7478. }
  7479. //入院
  7480. var zyReqTabContents = $("#zyReqTabContent").find("div.form-group");
  7481. if (zyReqTabContents != null && zyReqTabContents.length > 0) {
  7482. jsonData.mzZyReq.reqDept = $(zyReqTabContents[0]).find("input.temporary_inpatient_ward").val();
  7483. jsonData.mzZyReq.smallDept = $(zyReqTabContents[0]).find("input.temporary_items_small_ward").val();
  7484. jsonData.mzZyReq.admissStatus = $(zyReqTabContents[0]).find("input.temporary_items_admiss_status").val();
  7485. }
  7486. //设置诊断名称
  7487. var icdText = null;
  7488. var tagsTexts = $("span.el-select__tags-text");
  7489. if (tagsTexts != null && tagsTexts.length > 0) {
  7490. for (var i = 0; i < tagsTexts.length; i++) {
  7491. if (icdText == null) {
  7492. icdText = $(tagsTexts[i]).text();
  7493. } else {
  7494. icdText += "," + $(tagsTexts[i]).text();
  7495. }
  7496. }
  7497. }
  7498. jsonData.icdText = icdText;
  7499. jsonData.mzBlRecord.emrFzjc = emrFzjc;
  7500. return jsonData;
  7501. }
  7502. /**
  7503. * 保存处方
  7504. */
  7505. function savePrescription() {
  7506. //关闭帮助框
  7507. $("#treeButton").webuiPopover('hide');
  7508. $("#western_medicine_name").webuiPopover('hide');
  7509. $("#chinese_medicine_name").webuiPopover('hide');
  7510. $("#jcJyItem").webuiPopover('hide');
  7511. $("#zlItem").webuiPopover('hide');
  7512. var zgmztczf = $("#zgmztczf").val();
  7513. var readCardResult = $("#readCardResult").val();
  7514. if ((zgmztczf == 1 || zgmztczf == "1") && (readCardResult == null || readCardResult == "")) {
  7515. $("#messageModal").modal();
  7516. $("#messageContent").html("门诊统筹处方必须读卡,是否立即读卡?");
  7517. $("#messageButton").off("click").bind("click", function (t) {
  7518. mztczfSiReadCard(true);
  7519. realSavePrescription(false);
  7520. });
  7521. $("#cancelButton").off("click").bind("click", function (t) {
  7522. t.stopPropagation();
  7523. t.preventDefault();
  7524. realSavePrescription(false);
  7525. });
  7526. } else {
  7527. realSavePrescription(true);
  7528. }
  7529. }
  7530. /**
  7531. * 最终保存处方方法
  7532. * @param openModel 是否需要打开提示弹层 true 需要 false 不需要
  7533. */
  7534. function realSavePrescription(openModel) {
  7535. if (openModel) {
  7536. $("#messageModal").modal();
  7537. }
  7538. $("#messageContent").html("确认保存处方吗?");
  7539. $("#messageButton").off("click").bind("click", function (t) {
  7540. if (mztczfSiReadCardStatus) {
  7541. $("#messageContent").html("门诊统筹正在读卡中,次操作需与医保中心交互,耗时较长,请耐心等待...");
  7542. return;
  7543. }
  7544. $("#messageButton").attr("disabled", true);
  7545. var jsonData = getParamsForpPrescription(1);
  7546. $.ajax({
  7547. type: "POST",
  7548. url: '/thmz/savePrescription',
  7549. contentType: "application/json;charset=UTF-8",
  7550. dataType: "json",
  7551. data: JSON.stringify(jsonData),
  7552. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7553. success: function (res) {
  7554. if (res == '401' || res == 401) {
  7555. window.location.href = '/thmz/login/view'
  7556. return;
  7557. }
  7558. $("#messageButton").attr("disabled", false);
  7559. if (res.code == 0) {
  7560. successMesage(res);
  7561. clearWorkSpace();
  7562. loadInClinicTableList();
  7563. loadClinicTableList();
  7564. //$("#messageModal").modal();
  7565. $("#messageContent").html("门诊处方保存成功,是否打印处方和门诊指引单?");
  7566. $("#messageButton").off("click").on("click", function (t) {
  7567. $("#messageModal").modal("hide");
  7568. printPrescription(res.data.patientId, res.data.times, res.data.id, 5, 1);
  7569. });
  7570. $("#cancelButton").off("click");
  7571. } else {
  7572. $("#messageModal").modal("hide");
  7573. errorMesage(res);
  7574. }
  7575. }
  7576. });
  7577. });
  7578. $("#cancelButton").off("click");
  7579. }
  7580. /**
  7581. * 保存医疗范文
  7582. */
  7583. function saveapidAccepts() {
  7584. var templateName = $("#templateName").val();
  7585. if (templateName == null || templateName == "") {
  7586. errorMesageSimaple("范文名称不能为空!");
  7587. return;
  7588. }
  7589. var templateKindType = $("#templateKindType").val();
  7590. if (templateKindType == null || templateKindType == "") {
  7591. errorMesageSimaple("范文类型不能为空!");
  7592. return;
  7593. }
  7594. var templateType = $("#templateType").val();
  7595. if (templateType == null || templateType == "") {
  7596. errorMesageSimaple("范文范围不能为空!");
  7597. return;
  7598. }
  7599. var templateStatus = $("#templateStatus").val();
  7600. if (templateStatus == null || templateStatus == "") {
  7601. errorMesageSimaple("范文状态不能为空!");
  7602. return;
  7603. }
  7604. $("#saveapidAcceptsModal").modal("hide");
  7605. $("#messageModal").modal();
  7606. $("#messageContent").html("确认保存医疗范文吗?");
  7607. $("#messageButton").off("click").on("click", function (t) {
  7608. $("#messageModal").modal("hide");
  7609. var jsonData = getParamsForpPrescription(2);
  7610. $.ajax({
  7611. type: "POST",
  7612. url: '/thmz/saveTemplate',
  7613. contentType: "application/json;charset=UTF-8",
  7614. dataType: "json",
  7615. data: JSON.stringify({
  7616. "id": $("#templateId").val(),
  7617. "name": templateName,
  7618. "icdText": jsonData.icdText != null ? jsonData.icdText : jsonData.mzBlRecord.tentativeDiagnosis,
  7619. "templateKindType": templateKindType,
  7620. "templateType": templateType,
  7621. "templateStatus": templateStatus,
  7622. "templateData": JSON.stringify(jsonData),
  7623. "emrChiefComplaint": $("#symptom").val(),
  7624. "emrHpi": $("#emrHpi").val(),
  7625. "emrPs": $("#emrPs").val(),
  7626. "icdCode": $("#diagnoseValue").val()
  7627. }),
  7628. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7629. success: function (res) {
  7630. if (res == '401' || res == 401) {
  7631. window.location.href = '/thmz/login/view'
  7632. return;
  7633. }
  7634. if (res.code == 0) {
  7635. successMesage(res);
  7636. //范本保存完不清空
  7637. //clearWorkSpace();
  7638. } else {
  7639. $("#saveapidAcceptsModal").modal();
  7640. errorMesage(res);
  7641. }
  7642. }
  7643. });
  7644. });
  7645. $("#cancelButton").off("click");
  7646. }
  7647. /**
  7648. * 停用医疗范文
  7649. */
  7650. function removeTemplate() {
  7651. $("#messageModal").modal();
  7652. $("#messageContent").html("确认停用医疗范文吗?");
  7653. $("#messageButton").off("click").on("click", function (t) {
  7654. $("#messageModal").modal("hide");
  7655. $.ajax({
  7656. type: "POST",
  7657. url: '/thmz/removeTemplate',
  7658. contentType: "application/json;charset=UTF-8",
  7659. dataType: "json",
  7660. data: JSON.stringify({
  7661. "id": $("#idTemplate").val()
  7662. }),
  7663. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7664. success: function (res) {
  7665. if (res == '401' || res == 401) {
  7666. window.location.href = '/thmz/login/view'
  7667. return;
  7668. }
  7669. if (res.code == 0) {
  7670. successMesage(res);
  7671. $("#medicalModelModal").modal("hide");
  7672. fitTemplateData();
  7673. } else {
  7674. errorMesage(res);
  7675. }
  7676. }
  7677. });
  7678. });
  7679. $("#cancelButton").off("click");
  7680. }
  7681. /**
  7682. * 清空医疗范文模块内容
  7683. */
  7684. function clearApidAcceptsModal() {
  7685. $("#templateId").val(null);
  7686. $("#templateName").val(null);
  7687. $("#templateKindType").selectpicker('val', 0);
  7688. $("#templateKindType").selectpicker('refresh');
  7689. $("#templateType").selectpicker('val', 0);
  7690. $("#templateType").selectpicker('refresh');
  7691. $("#templateStatus").selectpicker('val', 0);
  7692. $("#templateStatus").selectpicker('refresh');
  7693. }
  7694. /**
  7695. * 查询病人未缴费处方信息 加载到处方修改
  7696. * @param patientId
  7697. * @param times
  7698. * @param clnicId 就诊记录id
  7699. */
  7700. function getMzPrescriptionVoUnPaid(patientId, times, clnicId) {
  7701. var currentPatientId = $("#patientId").text();
  7702. //当前接诊的用户和操作接诊的是同一个人,不做任何操作
  7703. if (currentPatientId == patientId) {
  7704. warningMesageSimaple("当前病人正在接诊中,请勿重复操作!");
  7705. return;
  7706. }
  7707. if (currentPatientId == null || currentPatientId == "") {
  7708. //当前没有人接诊,直接接诊
  7709. getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId);
  7710. } else {
  7711. //当前有人在接诊,提示是否需要切换和保存
  7712. $("#messagePrescriptionModal").modal();
  7713. $("#confirmPrescriptionButton").off("click").on("click", function (t) {
  7714. $("#messagePrescriptionModal").modal("hide");
  7715. //先保存目前接诊信息,再切换就诊人
  7716. var jsonData = getParamsForpPrescription(1);
  7717. $.ajax({
  7718. type: "POST",
  7719. url: '/thmz/savePrescription',
  7720. contentType: "application/json;charset=UTF-8",
  7721. dataType: "json",
  7722. data: JSON.stringify(jsonData),
  7723. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7724. success: function (res) {
  7725. if (res == '401' || res == 401) {
  7726. window.location.href = '/thmz/login/view'
  7727. return;
  7728. }
  7729. if (res.code == 0) {
  7730. loadInClinicTableList();
  7731. loadClinicTableList();
  7732. getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId);
  7733. } else {
  7734. errorMesage(res);
  7735. }
  7736. }
  7737. });
  7738. });
  7739. $("#cancelPrescriptionButton").off("click").on("click", function (t) {
  7740. $("#messagePrescriptionModal").modal("hide");
  7741. getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId);
  7742. });
  7743. }
  7744. }
  7745. /**
  7746. * 查询病人未缴费处方信息 加载到处方修改 通用方法
  7747. * @param patientId
  7748. * @param times
  7749. * @param clnicId 就诊记录id
  7750. */
  7751. function getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId) {
  7752. $.ajax({
  7753. type: "GET",
  7754. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + "&times=" + times + "&MzBlRecordFlag=false&payMark=5&clnicId=null",
  7755. contentType: "application/json;charset=UTF-8",
  7756. dataType: "json",
  7757. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7758. success: function (res) {
  7759. if (res == '401' || res == 401) {
  7760. window.location.href = '/thmz/login/view'
  7761. return;
  7762. }
  7763. if (res.code == 0) {
  7764. clearWorkSpace();
  7765. setMzPatientInfo(res.mzPatientMi);
  7766. editPrescription(res.data, 0)
  7767. //修改患者的时候,将原纪录的就诊记录id带上,并借用分诊流水号字段传参
  7768. $("#mzfzSerialNoInClick").val("clnicId_" + clnicId);
  7769. //查询患者的门诊统筹信息
  7770. queryInsuinfo(patientId);
  7771. } else {
  7772. errorMesage(res);
  7773. }
  7774. }
  7775. });
  7776. }
  7777. /**
  7778. * 查询病人已缴费处方信息 调用处方
  7779. * @param patientId
  7780. * @param times
  7781. * @param clnicId 就诊记录id
  7782. */
  7783. function getMzPrescriptionVoPaid(patientId, times, clnicId) {
  7784. $("#visitingDetailModal").modal("hide");
  7785. $("#messageModal").modal();
  7786. $("#messageContent").html("确认调用选中处方吗?将会覆盖当前处方。");
  7787. $("#messageButton").off("click").on("click", function (t) {
  7788. $("#messageModal").modal("hide");
  7789. $.ajax({
  7790. type: "GET",
  7791. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + "&times=" + times + "&MzBlRecordFlag=false&payMark=0&clnicId=null",
  7792. contentType: "application/json;charset=UTF-8",
  7793. dataType: "json",
  7794. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7795. success: function (res) {
  7796. if (res == '401' || res == 401) {
  7797. window.location.href = '/thmz/login/view'
  7798. return;
  7799. }
  7800. if (res.code == 0) {
  7801. var mzfzSerialNoInClick = $("#mzfzSerialNoInClick").val();
  7802. var mzfzReqTypeNoInClick = $("#mzfzReqTypeNoInClick").val();
  7803. clearUser(false);
  7804. clearWorkSpaceExcludeUser(3);
  7805. setMzPatientInfo(res.mzPatientMi);
  7806. editPrescription(res.data, 2)
  7807. $("#mzfzSerialNoInClick").val(mzfzSerialNoInClick);
  7808. $("#mzfzReqTypeNoInClick").val(mzfzReqTypeNoInClick);
  7809. } else {
  7810. errorMesage(res);
  7811. }
  7812. }
  7813. });
  7814. });
  7815. $("#cancelButton").off("click");
  7816. }
  7817. /**
  7818. * 重复接诊
  7819. * @param patientId
  7820. * @param times
  7821. * @param clnicId
  7822. * @param deptCode 就诊科室编码
  7823. */
  7824. function repeatAccepts(patientId, times, clnicId, deptCode) {
  7825. $.ajax({
  7826. type: "GET",
  7827. url: '/thmz/validMzyReqrec?patientId=' + patientId + "&deptCode=" + deptCode,
  7828. contentType: "application/json;charset=UTF-8",
  7829. dataType: "json",
  7830. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7831. success: function (res) {
  7832. if (res == '401' || res == 401) {
  7833. window.location.href = '/thmz/login/view'
  7834. return;
  7835. }
  7836. if (res.code == 0) {
  7837. if (res.data == 0) {
  7838. $("#messageModal").modal();
  7839. $("#messageContent").html("挂号失效,确定继续就诊?");
  7840. $("#messageButton").off("click").on("click", function (t) {
  7841. $("#messageModal").modal("hide");
  7842. repeatAcceptsConfirm(patientId, times, clnicId);
  7843. });
  7844. $("#cancelButton").off("click");
  7845. return;
  7846. }
  7847. repeatAcceptsConfirm(patientId, times, clnicId);
  7848. } else {
  7849. errorMesage(res);
  7850. }
  7851. }
  7852. });
  7853. }
  7854. /**
  7855. * 重复接诊提示方法
  7856. * @param patientId
  7857. * @param times
  7858. * @param clnicId
  7859. */
  7860. function repeatAcceptsConfirm(patientId, times, clnicId) {
  7861. var currentPatientId = $("#patientId").text();
  7862. //当前接诊的用户和操作接诊的是同一个人,不做任何操作
  7863. if (currentPatientId == patientId) {
  7864. return;
  7865. }
  7866. if (currentPatientId == null || currentPatientId == "") {
  7867. //当前没有人接诊,直接接诊
  7868. repeatAcceptsCommon(patientId, times, clnicId);
  7869. } else {
  7870. //当前有人在接诊,提示是否需要切换和保存
  7871. $("#messagePrescriptionModal").modal();
  7872. $("#confirmPrescriptionButton").off("click").on("click", function (t) {
  7873. $("#messagePrescriptionModal").modal("hide");
  7874. //先保存目前接诊信息,再切换就诊人
  7875. var jsonData = getParamsForpPrescription(1);
  7876. $.ajax({
  7877. type: "POST",
  7878. url: '/thmz/savePrescription',
  7879. contentType: "application/json;charset=UTF-8",
  7880. dataType: "json",
  7881. data: JSON.stringify(jsonData),
  7882. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7883. success: function (res) {
  7884. if (res == '401' || res == 401) {
  7885. window.location.href = '/thmz/login/view'
  7886. return;
  7887. }
  7888. if (res.code == 0) {
  7889. repeatAcceptsCommon(patientId, times, clnicId);
  7890. //加载已接诊患者列表
  7891. loadClinicTableList();
  7892. } else {
  7893. errorMesage(res);
  7894. }
  7895. }
  7896. });
  7897. });
  7898. $("#cancelPrescriptionButton").off("click").on("click", function (t) {
  7899. $("#messagePrescriptionModal").modal("hide");
  7900. repeatAcceptsCommon(patientId, times, clnicId);
  7901. });
  7902. }
  7903. }
  7904. /**
  7905. * 重复接诊通用方法
  7906. * @param patientId
  7907. * @param times
  7908. * @param clnicId
  7909. */
  7910. function repeatAcceptsCommon(patientId, times, clnicId) {
  7911. $.ajax({
  7912. type: "GET",
  7913. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + "&times=" + times + "&MzBlRecordFlag=true&payMark=null&clnicId=null",
  7914. contentType: "application/json;charset=UTF-8",
  7915. dataType: "json",
  7916. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7917. success: function (res) {
  7918. if (res == '401' || res == 401) {
  7919. window.location.href = '/thmz/login/view'
  7920. return;
  7921. }
  7922. if (res.code == 0) {
  7923. clearWorkSpace();
  7924. setMzPatientInfo(res.mzPatientMi);
  7925. editPrescription(res.data, 0)
  7926. //修改患者的时候,将原纪录的就诊记录id带上,并借用分诊流水号字段传参
  7927. $("#mzfzSerialNoInClick").val("clnicId_" + clnicId);
  7928. //查询患者的门诊统筹信息
  7929. queryInsuinfo(patientId);
  7930. } else {
  7931. errorMesage(res);
  7932. }
  7933. }
  7934. });
  7935. }
  7936. /**
  7937. * 就诊详情 已诊患者列表发起
  7938. * @param patientId
  7939. * @param times
  7940. * @param clnicId
  7941. * @param payMark
  7942. */
  7943. function prescriptionDetail(patientId, times, clnicId, payMark) {
  7944. prescriptionDetailCommon(patientId, times, clnicId, payMark, 0);
  7945. }
  7946. /**
  7947. * 就诊详情 历史轨迹发起
  7948. * @param patientId
  7949. * @param times
  7950. * @param clnicId
  7951. * @param clinicStatus
  7952. */
  7953. function visitingDetailModal(patientId, times, clnicId, clinicStatus) {
  7954. var payMark = null;
  7955. if (clinicStatus == 5) {
  7956. payMark = 5;
  7957. } else {
  7958. payMark = 0;
  7959. }
  7960. prescriptionDetailCommon(patientId, times, clnicId, payMark, 1);
  7961. }
  7962. /**
  7963. * 就诊详情通用方法
  7964. * @param patientId
  7965. * @param times
  7966. * @param clnicId
  7967. * @param payMark
  7968. * @param type 0 已诊患者列表发起 1 历史轨迹发起
  7969. */
  7970. function prescriptionDetailCommon(patientId, times, clnicId, payMark, type) {
  7971. $('#baseMzBlTimes').val(null);
  7972. var oriPayMark = payMark;
  7973. if (payMark == 1) {
  7974. //退费时,查看的明细还是处方开立的情况
  7975. payMark = 0;
  7976. }
  7977. //是否默认勾选处方回调
  7978. var checkboxFlag = localStorage.getItem("checkboxFlag");
  7979. if (checkboxFlag != null && (checkboxFlag == "0" || checkboxFlag == 0)) {
  7980. $("#conciseRecordsJzxq").prop("checked", true);
  7981. $("#prescriptionSubsidiaryJzxq").prop("checked", true);
  7982. } else {
  7983. $("#conciseRecordsJzxq").prop("checked", false);
  7984. $("#prescriptionSubsidiaryJzxq").prop("checked", false);
  7985. }
  7986. $.ajax({
  7987. type: "GET",
  7988. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + '&times=' + times + '&MzBlRecordFlag=false&payMark=' + payMark + '&clnicId=' + clnicId,
  7989. contentType: "application/json;charset=UTF-8",
  7990. dataType: "json",
  7991. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7992. success: function (res) {
  7993. if (res == '401' || res == 401) {
  7994. window.location.href = '/thmz/login/view'
  7995. return;
  7996. }
  7997. if (res.code == 0) {
  7998. $("#visitingDetailModal").modal();
  7999. var jsonData = res.data;
  8000. var mzPatientMi = res.mzPatientMi;
  8001. $("#visitingDetailPatientName").text(mzPatientMi.name);
  8002. $("#visitingDetailPatientAge").text(mzPatientMi.ageString);
  8003. $("#visitingDetailPatientGender").val(mzPatientMi.gender);
  8004. $("#prescriptionDetail_zd").html("");
  8005. $("#prescriptionDetail_xyzlContent").html("");
  8006. $("#prescriptionDetail_zyzlContent").html("");
  8007. $("#prescriptionDetail_zlyjContent").html("");
  8008. if (res.opDate != null) {
  8009. $("#visitingDetailDate").text(res.opDate);
  8010. }
  8011. if (res.deptName != null) {
  8012. $("#visitingDetailDept").text(res.deptName);
  8013. }
  8014. if (res.doctorName != null) {
  8015. $("#visitingDetailDoctor").text(res.doctorName);
  8016. }
  8017. var firstOrNot = jsonData.mzBlRecord.firstOrNot;
  8018. if (firstOrNot == 0) {
  8019. $("#visitFlag").html("初诊");
  8020. $("#first").next().click();
  8021. } else if (firstOrNot == 1) {
  8022. $("#visitFlag").html("复诊");
  8023. $("#not").next().click();
  8024. }
  8025. if (oriPayMark == 0) {
  8026. $("#chargeImage").attr("src", "/thmz/images/charge.png");
  8027. } else if (oriPayMark == 1) {
  8028. $("#chargeImage").attr("src", "/thmz/images/refund.png");
  8029. } else if (oriPayMark == 5) {
  8030. $("#chargeImage").attr("src", "/thmz/images/nocharge.png");
  8031. }
  8032. $("#prescriptionDetail_zs").html(jsonData.mzBlRecord.emrChiefComplaint);
  8033. $("#prescriptionDetail_xbs").html(jsonData.mzBlRecord.emrHpi);
  8034. var icdText = jsonData.icdText;
  8035. if (icdText != null) {
  8036. var arr = icdText.split(",");
  8037. var html = "";
  8038. for (var i = 0; i < arr.length; i++) {
  8039. if (i == 0) {
  8040. html += ' <div class="tagZdy tagZdy-back">';
  8041. } else {
  8042. html += ' <div class="tagZdy tagZdy-back-green">';
  8043. }
  8044. html += arr[i];
  8045. html += '</div>';
  8046. }
  8047. $("#prescriptionDetail_zd").html(html);
  8048. } else {
  8049. $("#prescriptionDetail_zd").html(jsonData.mzBlRecord.tentativeDiagnosis);
  8050. }
  8051. var prescriptionDetail = jsonData.mzBlRecord.prescriptionDetail;
  8052. if (prescriptionDetail != null) {
  8053. var checkBox = type == 1;
  8054. prescriptionDetail = JSON.parse(prescriptionDetail);
  8055. var xyPrescription = prescriptionDetail.xyPrescription;
  8056. if (xyPrescription != null) {
  8057. fitxyContent(xyPrescription.pyPrescription, "prescriptionDetail_xypyContent", "prescriptionDetail_xypyTitle", checkBox);
  8058. fitxyContent(xyPrescription.mjPrescription, "prescriptionDetail_xymjContent", "prescriptionDetail_xymjTitle", checkBox);
  8059. fitxyContent(xyPrescription.jePrescription, "prescriptionDetail_xyjeContent", "prescriptionDetail_xyjeTitle", checkBox);
  8060. fitxyContent(xyPrescription.ycPrescription, "prescriptionDetail_yczlContent", "prescriptionDetail_yczlTitle", checkBox);
  8061. } else {
  8062. $("#prescriptionDetail_xypyTitle").removeClass("in").addClass("hide");
  8063. $("#prescriptionDetail_xypyContent").html("");
  8064. $("#prescriptionDetail_xymjTitle").removeClass("in").addClass("hide");
  8065. $("#prescriptionDetail_xymjContent").html("");
  8066. $("#prescriptionDetail_xyjeTitle").removeClass("in").addClass("hide");
  8067. $("#prescriptionDetail_xyjeContent").html("");
  8068. $("#prescriptionDetail_yczlTitle").removeClass("in").addClass("hide");
  8069. $("#prescriptionDetail_yczlContent").html("");
  8070. }
  8071. var zyPrescription = prescriptionDetail.zyPrescription;
  8072. if (zyPrescription != null) {
  8073. fitzyContent(zyPrescription, "prescriptionDetail_zyzlContent", "prescriptionDetail_zyzlTitle", checkBox);
  8074. } else {
  8075. $("#prescriptionDetail_zyzlTitle").removeClass("in").addClass("hide");
  8076. $("#prescriptionDetail_zyzlContent").html("");
  8077. }
  8078. var jcjyPrescription = prescriptionDetail.jcjyPrescription;
  8079. if (jcjyPrescription != null) {
  8080. fitJcjyContent(jcjyPrescription, "prescriptionDetail_jcjyContent", "prescriptionDetail_jcjyTitle", checkBox);
  8081. } else {
  8082. ("#prescriptionDetail_jcjyTitle").removeClass("in").addClass("hide");
  8083. $("#prescriptionDetail_jcjyContent").html("");
  8084. }
  8085. var zlPrescription = prescriptionDetail.zlPrescription;
  8086. if (zlPrescription != null) {
  8087. fitJcjyContent(zlPrescription, "prescriptionDetail_zlContent", "prescriptionDetail_zlTitle", checkBox);
  8088. } else {
  8089. $("#prescriptionDetail_zlTitle").removeClass("in").addClass("hide");
  8090. $("#prescriptionDetail_zlContent").html("");
  8091. }
  8092. var zyReqPrescription = prescriptionDetail.zyReqPrescription;
  8093. if (zyReqPrescription != null) {
  8094. fitZyReqContent(zyReqPrescription, "prescriptionDetail_zyReqContent", "prescriptionDetail_zyReqTitle", true);
  8095. } else {
  8096. $("#prescriptionDetail_zyReqTitle").removeClass("in").addClass("hide");
  8097. $("#prescriptionDetail_zyReqContent").html("");
  8098. }
  8099. } else {
  8100. $("#prescriptionDetail_xypyTitle").removeClass("in").addClass("hide");
  8101. $("#prescriptionDetail_xypyContent").html("");
  8102. $("#prescriptionDetail_xymjTitle").removeClass("in").addClass("hide");
  8103. $("#prescriptionDetail_xymjContent").html("");
  8104. $("#prescriptionDetail_xyjeTitle").removeClass("in").addClass("hide");
  8105. $("#prescriptionDetail_xyjeContent").html("");
  8106. $("#prescriptionDetail_yczlTitle").removeClass("in").addClass("hide");
  8107. $("#prescriptionDetail_yczlContent").html("");
  8108. $("#prescriptionDetail_zyzlTitle").removeClass("in").addClass("hide");
  8109. $("#prescriptionDetail_zyzlContent").html("");
  8110. $("#prescriptionDetail_jcjyTitle").removeClass("in").addClass("hide");
  8111. $("#prescriptionDetail_jcjyContent").html("");
  8112. $("#prescriptionDetail_zlTitle").removeClass("in").addClass("hide");
  8113. $("#prescriptionDetail_zlContent").html("");
  8114. $("#prescriptionDetail_zyReqTitle").removeClass("in").addClass("hide");
  8115. $("#prescriptionDetail_zyReqContent").html("");
  8116. }
  8117. $("#printJcReq").removeClass("in").addClass("hide");
  8118. $("#printJcReq").off("click");
  8119. $("#printJyReq").removeClass("in").addClass("hide");
  8120. $("#printJyReq").off("click");
  8121. $("#printJcReqSetup").removeClass("in").addClass("hide");
  8122. $("#printJcReqSetup").off("click");
  8123. $("#printJyReqSetup").removeClass("in").addClass("hide");
  8124. $("#printJyReqSetup").off("click");
  8125. $("#previewYjReq").removeClass("in").addClass("hide");
  8126. $("#previewYjReq").off("click");
  8127. $("#previewYjReqAll").removeClass("in").addClass("hide");
  8128. $("#previewYjReqAll").off("click");
  8129. $("#deletePrescription").removeClass("in").addClass("hide");
  8130. $("#deletePrescription").off("click");
  8131. $("#consultationCliniced").removeClass("in").addClass("hide");
  8132. $("#consultationCliniced").off("click");
  8133. if (jsonData.mzYjReqList != null && jsonData.mzYjReqList.length > 0) {
  8134. $("#previewYjReq").removeClass("hide").addClass("in");
  8135. $("#previewYjReq").off("click").on("click", function (t) {
  8136. previewYjReq(patientId, times);
  8137. });
  8138. }
  8139. if (res.yjReqCount != null && res.yjReqCount > 0) {
  8140. $("#previewYjReqAll").removeClass("hide").addClass("in");
  8141. $("#previewYjReqAll").off("click").on("click", function (t) {
  8142. previewYjReqAll(patientId);
  8143. });
  8144. }
  8145. if (type == 0) {
  8146. $("#callPrescription").removeClass("in").addClass("hide");
  8147. if ((jsonData.mzChargeDetailList == null || jsonData.mzChargeDetailList.length == 0) && (jsonData.mzYjReqList == null || jsonData.mzYjReqList.length == 0)) {
  8148. $("#printPrescription").removeClass("in").addClass("hide");
  8149. $("#printPrescriptionSetup").removeClass("in").addClass("hide");
  8150. } else {
  8151. $("#printPrescription").removeClass("hide").addClass("in");
  8152. $("#printPrescription").off("click").on("click", function (t) {
  8153. printPrescription(patientId, times, clnicId, payMark, 1);
  8154. });
  8155. $("#printPrescriptionSetup").removeClass("hide").addClass("in");
  8156. $("#printPrescriptionSetup").off("click").on("click", function (t) {
  8157. printPrescription(patientId, times, clnicId, payMark, 2);
  8158. });
  8159. }
  8160. if (jsonData.mzYjReqList != null && jsonData.mzYjReqList.length > 0) {
  8161. var hadJc = false;
  8162. var hadJy = false;
  8163. for (var i = 0; i < jsonData.mzYjReqList.length; i++) {
  8164. var mzYjReq = jsonData.mzYjReqList[i];
  8165. if (mzYjReq.reqType == 2) {
  8166. hadJy = true;
  8167. } else if (mzYjReq.reqType == 3) {
  8168. hadJc = true;
  8169. }
  8170. }
  8171. if (hadJc) {
  8172. $("#printJcReq").removeClass("hide").addClass("in");
  8173. $("#printJcReq").off("click").on("click", function (t) {
  8174. printYjReq(patientId, times, 3, 1);
  8175. });
  8176. $("#printJcReqSetup").removeClass("hide").addClass("in");
  8177. $("#printJcReqSetup").off("click").on("click", function (t) {
  8178. printYjReq(patientId, times, 3, 2);
  8179. });
  8180. }
  8181. if (hadJy) {
  8182. $("#printJyReq").removeClass("hide").addClass("in");
  8183. $("#printJyReq").off("click").on("click", function (t) {
  8184. printYjReq(patientId, times, 2, 1);
  8185. });
  8186. $("#printJyReqSetup").removeClass("hide").addClass("in");
  8187. $("#printJyReqSetup").off("click").on("click", function (t) {
  8188. printYjReq(patientId, times, 2, 2);
  8189. });
  8190. }
  8191. }
  8192. if (jsonData.mzZyReq == null || jsonData.mzZyReq.reqDept == null || jsonData.mzZyReq.reqDept == "") {
  8193. $("#printZyReq").removeClass("in").addClass("hide");
  8194. $("#printZyReq").off("click");
  8195. $("#printZyReqSetup").removeClass("in").addClass("hide");
  8196. $("#printZyReqSetup").off("click");
  8197. } else {
  8198. $("#printZyReq").removeClass("hide").addClass("in");
  8199. $("#printZyReq").off("click").on("click", function (t) {
  8200. printZyReq(patientId, 1);
  8201. });
  8202. $("#printZyReqSetup").removeClass("hide").addClass("in");
  8203. $("#printZyReqSetup").off("click").on("click", function (t) {
  8204. printZyReq(patientId, 2);
  8205. });
  8206. }
  8207. //未缴费状态的时候可以删除处方
  8208. if (oriPayMark == 5 || oriPayMark == "5") {
  8209. $("#deletePrescription").removeClass("hide").addClass("in");
  8210. $("#deletePrescription").off("click").on("click", function (t) {
  8211. deletePrescription(clnicId);
  8212. });
  8213. }
  8214. //已诊列表发起会诊
  8215. $("#consultationCliniced").removeClass("hide").addClass("in");
  8216. $("#consultationCliniced").off("click").on("click", function (t) {
  8217. consultationCliniced(patientId);
  8218. });
  8219. } else {
  8220. $("#printPrescription").removeClass("in").addClass("hide");
  8221. $("#printZyReq").removeClass("in").addClass("hide");
  8222. $("#printBlRecord").removeClass("in").addClass("hide");
  8223. $("#printJcReq").removeClass("in").addClass("hide");
  8224. $("#printJyReq").removeClass("in").addClass("hide");
  8225. $("#callPrescription").removeClass("hide").addClass("in");
  8226. $("#callPrescription").off("click").on("click", function (t) {
  8227. getMzPrescriptionVoPaid(patientId, times, clnicId);
  8228. });
  8229. }
  8230. if (oriPayMark == 1) {
  8231. $("#printPrescription").removeClass("in").addClass("hide");
  8232. $("#printPrescriptionSetup").removeClass("in").addClass("hide");
  8233. } else {
  8234. if ((jsonData.mzChargeDetailList == null || jsonData.mzChargeDetailList.length == 0) && (jsonData.mzYjReqList == null || jsonData.mzYjReqList.length == 0)) {
  8235. $("#printPrescription").removeClass("in").addClass("hide");
  8236. $("#printPrescriptionSetup").removeClass("in").addClass("hide");
  8237. } else {
  8238. $("#printPrescription").removeClass("hide").addClass("in");
  8239. $("#printPrescription").off("click").on("click", function (t) {
  8240. printPrescription(patientId, times, clnicId, payMark, 1);
  8241. });
  8242. $("#printPrescriptionSetup").removeClass("hide").addClass("in");
  8243. $("#printPrescriptionSetup").off("click").on("click", function (t) {
  8244. printPrescription(patientId, times, clnicId, payMark, 2);
  8245. });
  8246. }
  8247. }
  8248. $("#printBlRecord").removeClass("hide").addClass("in");
  8249. $("#printBlRecord").off("click").on("click", function (t) {
  8250. printBlRecord(patientId, times, 1);
  8251. });
  8252. $("#printBlRecordSetup").removeClass("hide").addClass("in");
  8253. $("#printBlRecordSetup").off("click").on("click", function (t) {
  8254. printBlRecord(patientId, times, 2);
  8255. });
  8256. $("#showMzBlRecordModal").removeClass("hide").addClass("in");
  8257. $("#showMzBlRecordModal").off("click").on("click", function (t) {
  8258. showMzBlRecordModal(patientId, times, 1);
  8259. });
  8260. if ($("#setupId").hasClass("fa-chevron-up")) {
  8261. //默认不展开打印设置
  8262. $("#setupId").parent().click();
  8263. }
  8264. // setTimeout(function () {
  8265. // if ($("#setupId").hasClass("fa-chevron-up")) {
  8266. // //默认不展开打印设置
  8267. // $("#setupId").parent().click();
  8268. // }
  8269. // }, 400);
  8270. //就诊详情的时候,隐藏复选框
  8271. if (type == 0) {
  8272. $("#visitingDetailModal").find("input[type=checkbox]").each(function (index, obj) {
  8273. $(obj).css("display", "none");
  8274. });
  8275. } else {
  8276. //历史处方显示复选框
  8277. $("#visitingDetailModal").find("input[type=checkbox]").each(function (index, obj) {
  8278. $(obj).css("display", "inline-block");
  8279. });
  8280. }
  8281. } else {
  8282. errorMesage(res);
  8283. }
  8284. }
  8285. });
  8286. $("#selfAmountView").html(0.00);
  8287. $("#fundPayView").html(0.00);
  8288. $("#acctPayView").html(0.00);
  8289. $("#totalAmountView").html(0.00);
  8290. $.ajax({
  8291. type: "GET",
  8292. url: '/thmz/getChargeDetailFee?patientId=&times=&receiptNo=&clnicId=' + clnicId,
  8293. contentType: "application/json;charset=UTF-8",
  8294. dataType: "json",
  8295. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8296. async: false,
  8297. success: function (res) {
  8298. if (res == '401' || res == 401) {
  8299. window.location.href = '/thmz/login/view'
  8300. return;
  8301. }
  8302. if (res.code == 0) {
  8303. if (res.fundPay != undefined && res.fundPay != null) {
  8304. $("#fundPayView").text("¥" + res.fundPay);
  8305. }
  8306. if (res.acctPay != undefined && res.acctPay != null) {
  8307. $("#acctPayView").text("¥" + res.acctPay);
  8308. }
  8309. $("#selfAmountView").text("¥" + res.selfAmount);
  8310. $("#totalAmountView").text("¥" + res.totalAmount);
  8311. } else {
  8312. printIndex = -1;
  8313. }
  8314. }
  8315. });
  8316. }
  8317. /**
  8318. * 查询默认打印机
  8319. */
  8320. function setPrint() {
  8321. if (printIndex >= 0) {
  8322. return;
  8323. }
  8324. $.ajax({
  8325. type: "GET",
  8326. url: '/thmz/getLastWindowsByCurrentUser',
  8327. contentType: "application/json;charset=UTF-8",
  8328. dataType: "json",
  8329. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8330. async: false,
  8331. success: function (res) {
  8332. if (res == '401' || res == 401) {
  8333. window.location.href = '/thmz/login/view'
  8334. return;
  8335. }
  8336. if (res.code == 0) {
  8337. printIndex = res.data.cgPrintIndex;
  8338. } else {
  8339. printIndex = -1;
  8340. }
  8341. }
  8342. });
  8343. }
  8344. function setTableHtml(prescriptionDetail) {
  8345. //设置成组处方符号
  8346. if (prescriptionDetail.length > 1) {
  8347. var map = new Map();
  8348. var groupOrderlist = [];
  8349. for (var j = 0; j < prescriptionDetail.length; j++) {
  8350. var detail = prescriptionDetail[j];
  8351. var list = map.get(detail.groupOrder);
  8352. if (list == null) {
  8353. list = [];
  8354. map.put(detail.groupOrder, list);
  8355. groupOrderlist[groupOrderlist.length] = detail.groupOrder;
  8356. }
  8357. list[list.length] = detail;
  8358. }
  8359. for (var j = 0; j < groupOrderlist.length; j++) {
  8360. var list = map.get(groupOrderlist[j]);
  8361. if (list.length == 1) {
  8362. continue;
  8363. }
  8364. list[0].groupFlag = "┒";
  8365. list[list.length - 1].groupFlag = "┛";
  8366. if (list.length > 2) {
  8367. for (var t = 1; t < list.length - 1; t++) {
  8368. list[t].groupFlag = "┃";
  8369. }
  8370. }
  8371. }
  8372. }
  8373. var html = "";
  8374. for (var j = 0; j < prescriptionDetail.length; j++) {
  8375. var detail = prescriptionDetail[j];
  8376. html += "<tr><td>" + detail.groupOrder + "</td>";
  8377. html += "<td colspan='2'>";
  8378. html += detail.name + "(" + detail.specification + ")";
  8379. html += "</td>";
  8380. html += "<td colspan='2'></td>";
  8381. html += "<td>X</td>";
  8382. html += "<td rowspan='2' style='height: 100%;line-height: 100%;font-size: 40px;'>";
  8383. if (detail.groupFlag != undefined && detail.groupFlag != null) {
  8384. html += detail.groupFlag;
  8385. }
  8386. html += "</td><td>" + detail.quantity + detail.packUnit + "</td>";
  8387. html += "</tr>";
  8388. html += "<tr><td></td>";
  8389. if (detail.tryResult != undefined && detail.tryResult != null && detail.tryResult != "null" && detail.tryResult != "") {
  8390. html += "<td>" + detail.tryResult + "</td>";
  8391. } else if (detail.tryFlag != undefined && detail.tryFlag != null && detail.tryFlag != "null" && detail.tryFlag != "") {
  8392. html += "<td>" + detail.tryFlag + "</td>";
  8393. } else {
  8394. html += "<td></td>";
  8395. }
  8396. html += "<td style='font-weight: bold;text-align: right;'>用法:</td>";
  8397. html += "<td>" + detail.drugQuan + detail.unitDesc + "/次</td>";
  8398. html += "<td>" + detail.frequency + "</td>";
  8399. html += "<td>" + detail.orderDays + "天</td>";
  8400. html += "<td>" + detail.supplyName + "</td>";
  8401. html += "</tr>";
  8402. }
  8403. html += "<tr><td colspan='7'>&nbsp;&nbsp;&nbsp;&nbsp;------(以下空白)------</td></tr>";
  8404. return {html: html, j: j};
  8405. }
  8406. // /**
  8407. // * 打印门诊指引单
  8408. // * @param patientId
  8409. // * @param times
  8410. // */
  8411. // function printGuideCard(patientId, times) {
  8412. //
  8413. // }
  8414. /**
  8415. * 打印门诊处方
  8416. * @param patientId
  8417. * @param times
  8418. * @param clnicId
  8419. * @param payMark
  8420. * @param printType 打印模式 1 预览打印 2 打印设置
  8421. */
  8422. function printPrescription(patientId, times, clnicId, payMark, printType) {
  8423. $.ajax({
  8424. type: "GET",
  8425. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + '&times=' + times + '&MzBlRecordFlag=false&payMark=' + payMark + '&clnicId=' + clnicId,
  8426. contentType: "application/json;charset=UTF-8",
  8427. dataType: "json",
  8428. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8429. success: function (res) {
  8430. if (res == '401' || res == 401) {
  8431. window.location.href = '/thmz/login/view'
  8432. return;
  8433. }
  8434. if (res.code == 0) {
  8435. var prescriptionDetail = res.data.mzBlRecord.prescriptionDetail;
  8436. if (prescriptionDetail != null && prescriptionDetail != "") {
  8437. var prescriptionDetailJson = JSON.parse(prescriptionDetail);
  8438. //当前处方只开了住院证则只打印住院证
  8439. 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) {
  8440. printZyReq(patientId, 1);
  8441. return;
  8442. }
  8443. var index = 0;
  8444. setPrint();
  8445. LODOP = getLodop();
  8446. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院处方笺");
  8447. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  8448. //设置默认打印机
  8449. LODOP.SET_PRINTER_INDEX(printIndex);
  8450. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  8451. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  8452. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  8453. //LODOP.SET_SHOW_MODE("SETUP_ENABLESS",getCheckSS());
  8454. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊处方笺");//对新建的纸张重命名
  8455. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  8456. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  8457. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  8458. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  8459. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  8460. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  8461. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  8462. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  8463. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  8464. var mzPatientMi = res.mzPatientMi;
  8465. $("#patientNamePrescription").text(mzPatientMi.name);
  8466. $("#patientGenderPrescription").text(mzPatientMi.gender);
  8467. $("#patientAgePrescription").text(mzPatientMi.ageString);
  8468. $("#patientIdPrescription").text(mzPatientMi.patientId);
  8469. $("#deptPrescription").text(res.deptName);
  8470. $("#doctorPrescription").text(res.doctorName);
  8471. $("#cfTime").text(res.opDate);
  8472. $("#socialNo").text(mzPatientMi.socialNo);
  8473. $("#zdPrescription").text(res.data.icdText);
  8474. $("#patientIdGuideCard").text(mzPatientMi.patientId);
  8475. $("#patientNameGuideCard").text(mzPatientMi.name);
  8476. $("#patientDateGuideCard").text(format(new Date(), "yyyy-MM-dd"));
  8477. //普药处方
  8478. var pyPrescription = prescriptionDetailJson.xyPrescription.pyPrescription;
  8479. if (pyPrescription != null && pyPrescription.length > 0) {
  8480. for (var i = 0; i < pyPrescription.length; i++) {
  8481. if (index > 0) {
  8482. LODOP.NewPageA();
  8483. }
  8484. var prescriptionDetail = pyPrescription[i].detail;
  8485. var __ret = setTableHtml(prescriptionDetail);
  8486. var html = __ret.html;
  8487. var j = __ret.j;
  8488. if (res.deptName != undefined && res.deptName != null) {
  8489. if (res.deptName.indexOf("儿") > 0) {
  8490. $("#typePrescription").text("儿科");
  8491. $("#cfTitle").text("儿科");
  8492. } else if (res.deptName.indexOf("急诊科") > 0) {
  8493. $("#typePrescription").text("急诊");
  8494. $("#cfTitle").text("急诊");
  8495. } else {
  8496. $("#typePrescription").text("普通处方");
  8497. $("#cfTitle").text("普通");
  8498. }
  8499. }
  8500. $("#prescriptionDetail").html(html);
  8501. $("#cfAmountPrint").text(pyPrescription[i].amount + "元 (不含注射费)");
  8502. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  8503. index++;
  8504. }
  8505. }
  8506. //医材处方
  8507. var ycPrescription = prescriptionDetailJson.xyPrescription.ycPrescription;
  8508. if (ycPrescription != null && ycPrescription.length > 0) {
  8509. for (var i = 0; i < ycPrescription.length; i++) {
  8510. if (index > 0) {
  8511. LODOP.NewPageA();
  8512. }
  8513. var prescriptionDetail = ycPrescription[i].detail;
  8514. var __ret = setTableHtml(prescriptionDetail);
  8515. var html = __ret.html;
  8516. var j = __ret.j;
  8517. if (res.deptName != undefined && res.deptName != null) {
  8518. if (res.deptName.indexOf("儿") > 0) {
  8519. $("#typePrescription").text("儿科");
  8520. $("#cfTitle").text("儿科");
  8521. } else if (res.deptName.indexOf("急诊科") > 0) {
  8522. $("#typePrescription").text("急诊");
  8523. $("#cfTitle").text("急诊");
  8524. } else {
  8525. $("#typePrescription").text("医材处方");
  8526. $("#cfTitle").text("普通");
  8527. }
  8528. }
  8529. $("#prescriptionDetail").html(html);
  8530. $("#cfAmountPrint").text(ycPrescription[i].amount + "元 ");
  8531. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  8532. index++;
  8533. }
  8534. }
  8535. //麻精处方
  8536. var mjPrescription = prescriptionDetailJson.xyPrescription.mjPrescription;
  8537. if (mjPrescription != null && mjPrescription.length > 0) {
  8538. for (var i = 0; i < mjPrescription.length; i++) {
  8539. if (index > 0) {
  8540. LODOP.NewPageA();
  8541. }
  8542. var prescriptionDetail = mjPrescription[i].detail;
  8543. var __ret = setTableHtml(prescriptionDetail);
  8544. var html = __ret.html;
  8545. var j = __ret.j;
  8546. $("#typePrescription").text("麻、精一处方");
  8547. $("#cfTitle").text("麻、精一");
  8548. $("#prescriptionDetail").html(html);
  8549. $("#cfAmountPrint").text(mjPrescription[i].amount + "元 (不含注射费)");
  8550. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  8551. index++;
  8552. }
  8553. }
  8554. //精二处方
  8555. var jePrescription = prescriptionDetailJson.xyPrescription.jePrescription;
  8556. if (jePrescription != null && jePrescription.length > 0) {
  8557. for (var i = 0; i < jePrescription.length; i++) {
  8558. if (index > 0) {
  8559. LODOP.NewPageA();
  8560. }
  8561. var prescriptionDetail = jePrescription[i].detail;
  8562. var __ret = setTableHtml(prescriptionDetail);
  8563. var html = __ret.html;
  8564. var j = __ret.j;
  8565. $("#typePrescription").text("精二处方");
  8566. $("#cfTitle").text("精二");
  8567. $("#prescriptionDetail").html(html);
  8568. $("#cfAmountPrint").text(jePrescription[i].amount + "元 (不含注射费)");
  8569. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  8570. index++;
  8571. }
  8572. }
  8573. //中药处方
  8574. if (prescriptionDetailJson.zyPrescription != null && prescriptionDetailJson.zyPrescription.length > 0) {
  8575. var zyPrescription = prescriptionDetailJson.zyPrescription[0].detail;
  8576. if (zyPrescription != null && zyPrescription.length > 0) {
  8577. var html = "";
  8578. for (var i = 0; i < zyPrescription.length; i++) {
  8579. if (i % 3 == 0) {
  8580. html += "<tr>";
  8581. }
  8582. html += "<td>";
  8583. html += zyPrescription[i].name;
  8584. html += zyPrescription[i].quantity + "g";
  8585. if (zyPrescription[i].instructionText != null) {
  8586. html += "[" + zyPrescription[i].instructionText + "]";
  8587. }
  8588. if (i % 3 == 2) {
  8589. html += "</td></tr>";
  8590. } else {
  8591. html += "</td>";
  8592. }
  8593. }
  8594. if (zyPrescription.length % 3 != 0) {
  8595. html += "</tr>";
  8596. }
  8597. html += "<tr><td></td><td></td><td>X " + prescriptionDetailJson.zyPrescription[0].zyfs + "付</td></tr>";
  8598. var cyMtjs = prescriptionDetailJson.zyPrescription[0].cyMtjs;
  8599. if (cyMtjs == null || cyMtjs == "null") {
  8600. cyMtjs = "";
  8601. }
  8602. var cyJssm = prescriptionDetailJson.zyPrescription[0].cyJssm;
  8603. if (cyJssm == null || cyJssm == "null") {
  8604. cyJssm = "";
  8605. }
  8606. var cyJsl = prescriptionDetailJson.zyPrescription[0].cyJsl;
  8607. if (cyJsl == null || cyJsl == "null") {
  8608. cyJsl = "";
  8609. }
  8610. var cyZql = prescriptionDetailJson.zyPrescription[0].cyZql;
  8611. if (cyZql == null || cyZql == "null") {
  8612. cyZql = "";
  8613. }
  8614. var cyFj = prescriptionDetailJson.zyPrescription[0].cyFj;
  8615. if (cyFj == null || cyFj == "null") {
  8616. cyFj = "";
  8617. }
  8618. var cyFfcs = prescriptionDetailJson.zyPrescription[0].cyFfcs;
  8619. if (cyFfcs == null || cyFfcs == "null") {
  8620. cyFfcs = "";
  8621. }
  8622. var cyFysm = prescriptionDetailJson.zyPrescription[0].cyFysm;
  8623. if (cyFysm == null || cyFysm == "null") {
  8624. cyFysm = "";
  8625. }
  8626. html += "<tr><td colspan='3'>每天" + cyMtjs + "剂," + cyJssm + cyJsl + "ml,煮取量" + cyZql + "ml,复煎" + cyFj + "次。分" + cyFfcs + "次" + cyFysm + "。</td></tr>";
  8627. html += "<tr><td colspan='3'>&nbsp;&nbsp;&nbsp;&nbsp;------(以下空白)------</td></tr>";
  8628. if (index > 0) {
  8629. LODOP.NewPageA();
  8630. }
  8631. if (res.deptName != undefined && res.deptName != null) {
  8632. if (res.deptName.indexOf("儿") > 0) {
  8633. $("#typePrescription").text("儿科");
  8634. $("#cfTitle").text("儿科");
  8635. } else if (res.deptName.indexOf("急诊科") > 0) {
  8636. $("#typePrescription").text("急诊");
  8637. $("#cfTitle").text("急诊");
  8638. } else {
  8639. $("#typePrescription").text("中药处方");
  8640. $("#cfTitle").text("普通");
  8641. }
  8642. }
  8643. $("#prescriptionDetail").html(html);
  8644. $("#cfAmountPrint").text(prescriptionDetailJson.zyPrescription[0].amount + "元 (不含代煎费)");
  8645. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  8646. index++;
  8647. }
  8648. }
  8649. //暂时不打印 诊疗了
  8650. var printZlPrescription = false;
  8651. if (printZlPrescription) {
  8652. if (prescriptionDetailJson.zlPrescription != null && prescriptionDetailJson.zlPrescription.length > 0) {
  8653. //诊疗处方
  8654. var zlPrescription = prescriptionDetailJson.zlPrescription[0].detail;
  8655. if (zlPrescription != null && zlPrescription.length > 0) {
  8656. var html = "";
  8657. for (var i = 0; i < zlPrescription.length; i++) {
  8658. html += "<tr><td>";
  8659. html += zlPrescription[i];
  8660. html += "</td></tr>";
  8661. }
  8662. if (index > 0) {
  8663. LODOP.NewPageA();
  8664. }
  8665. if (res.deptName != undefined && res.deptName != null) {
  8666. if (res.deptName.indexOf("儿") > 0) {
  8667. $("#typePrescription").text("儿科");
  8668. $("#cfTitle").text("儿科");
  8669. } else if (res.deptName.indexOf("急诊科") > 0) {
  8670. $("#typePrescription").text("急诊");
  8671. $("#cfTitle").text("急诊");
  8672. } else {
  8673. $("#typePrescription").text("诊疗处方");
  8674. $("#cfTitle").text("普通");
  8675. }
  8676. }
  8677. $("#prescriptionDetail").html(html);
  8678. $("#cfAmountPrint").text(prescriptionDetailJson.zlPrescription[0].amount + "元 ");
  8679. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  8680. index++;
  8681. }
  8682. }
  8683. }
  8684. //检查申请单打印
  8685. var mzYjReqList = res.data.mzYjReqList;
  8686. if (mzYjReqList != null && mzYjReqList.length > 0) {
  8687. $("#patientIdJcReq").text(mzPatientMi.patientId);
  8688. $("#patientNameJcReq").text(mzPatientMi.name);
  8689. $("#patientGenderJcReq").text(mzPatientMi.gender);
  8690. $("#patientAgeJcReq").text(mzPatientMi.ageString);
  8691. $("#responseTypeJcReq").text(mzPatientMi.responseTypeName);
  8692. $("#patientCardNoJcReq").text(mzPatientMi.icCardNo);
  8693. $("#icdTextJcReq").text(res.data.icdText);
  8694. var mzBlRecord = res.data.mzBlRecord;
  8695. $("#jcReqEmrChiefComplaint").text(mzBlRecord.emrChiefComplaint);
  8696. $("#jcReqHis").text(mzBlRecord.emrHpi);
  8697. var tz = getTz(mzBlRecord);
  8698. $("#jcReqTz").text(tz);
  8699. $("#jcReqReqDept").text(res.deptName);
  8700. $("#jcReqReqDoctor").text(res.doctorName);
  8701. for (var i = 0; i < mzYjReqList.length; i++) {
  8702. var mzYjReq = mzYjReqList[i];
  8703. if (i == 0) {
  8704. var dateStr = format(mzYjReq.reqDate, "yyyy-MM-dd");
  8705. $("#jcReqReqDate").text(dateStr);
  8706. }
  8707. if (mzYjReq == null || mzYjReq.reqType == 2) {
  8708. continue;
  8709. }
  8710. if ((i == 0 && index > 0) || i > 0) {
  8711. LODOP.NewPageA();
  8712. }
  8713. $("#reqNoJcReq").text(mzYjReq.reqNo);
  8714. $("#jcReqItem").text(mzYjReq.groupName);
  8715. $("#jcReqRemark").text(mzYjReq.jyRemark);
  8716. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("jc_card_table").innerHTML);
  8717. index++;
  8718. }
  8719. }
  8720. $.ajax({
  8721. type: "GET",
  8722. url: '/thmz/getChargeDetailForGuideCard?patientId=' + patientId + '&times=' + times,
  8723. contentType: "application/json;charset=UTF-8",
  8724. dataType: "json",
  8725. headers: {
  8726. 'Accept': 'application/json',
  8727. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  8728. },
  8729. success: function (res) {
  8730. if (res == '401' || res == 401) {
  8731. window.location.href = '/thmz/login/view'
  8732. return;
  8733. }
  8734. if (res.code == 0) {
  8735. if (res.data != null && res.data.length > 0) {
  8736. var html = "";
  8737. for (var i = 0; i < res.data.length; i++) {
  8738. 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>"
  8739. }
  8740. $("#guideCardDetail").html(html);
  8741. }
  8742. if (res.payQrcode != null && res.payQrcode != "") {
  8743. $("#selfAmountGuideCard").html(0.00);
  8744. $("#fundPayGuideCard").html(0.00);
  8745. $("#acctPayGuideCard").html(0.00);
  8746. $("#payQrcodeGuideCard").html(0.00);
  8747. new QRCode(document.getElementById("payQrcodeGuideCard"), res.payQrcode); // 设置要生成二维码的链接
  8748. $("canvas").attr("id", "erw");
  8749. var canvas = document.getElementById('erw');
  8750. var src = canvas.toDataURL("image/png");
  8751. //var strDataURI =canvas.toDataURL("image/png");
  8752. $("#payQrcodeGuideCard").html("<img src='" + src + "' style='width:100px;height:100px;'/><div style='width: 100px;margin-top: 10px;text-align: center;'>微信支付</div>");
  8753. }
  8754. if (res.fundPay != undefined && res.fundPay != null) {
  8755. $("#fundPayGuideCard").text("¥" + res.fundPay);
  8756. }
  8757. if (res.acctPay != undefined && res.acctPay != null) {
  8758. $("#acctPayGuideCard").text("¥" + res.acctPay);
  8759. }
  8760. $("#selfAmountGuideCard").text("¥" + res.selfAmount);
  8761. $("#totalAmountGuideCard").text("¥" + res.totalAmount);
  8762. // $("#imgcode").JsBarcode(patientId);
  8763. console.log(patientId);
  8764. JsBarcode('#imgcode', patientId, {
  8765. lineColor: '#333', //线条颜色
  8766. width: 2, //线宽
  8767. height: 60, //条码高度
  8768. displayValue: false, //是否显示文字信息
  8769. });
  8770. if (index > 0) {
  8771. LODOP.NewPageA();
  8772. }
  8773. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("guide_card_table").innerHTML);
  8774. //LODOP.PRINT();
  8775. if (printType == 1) {
  8776. LODOP.PREVIEW();
  8777. } else if (printType == 2) {
  8778. LODOP.PRINT_SETUP();
  8779. }
  8780. } else if (res.code == -2) {
  8781. if (printType == 1) {
  8782. LODOP.PREVIEW();
  8783. } else if (printType == 2) {
  8784. LODOP.PRINT_SETUP();
  8785. }
  8786. } else {
  8787. errorMesage(res);
  8788. }
  8789. }
  8790. });
  8791. // printGuideCard(patientId, times);
  8792. }
  8793. } else {
  8794. errorMesage(res);
  8795. }
  8796. }
  8797. });
  8798. }
  8799. /**
  8800. * 构建体征描述
  8801. * @param mzBlRecord
  8802. * @returns {*}
  8803. */
  8804. function getTz(mzBlRecord) {
  8805. var tz = null;
  8806. if (mzBlRecord.weight != null && mzBlRecord.weight != 0) {
  8807. var temp = "体重:" + mzBlRecord.weight + "kg ";
  8808. if (tz == null) {
  8809. tz = temp;
  8810. } else {
  8811. tz += " " + temp;
  8812. }
  8813. }
  8814. if (mzBlRecord.temperature != null && mzBlRecord.temperature != 0) {
  8815. var temp = "体温:" + mzBlRecord.temperature + "℃ ";
  8816. if (tz == null) {
  8817. tz = temp;
  8818. } else {
  8819. tz += " " + temp;
  8820. }
  8821. }
  8822. if (mzBlRecord.sphygmus != null && mzBlRecord.sphygmus != 0) {
  8823. var temp = "脉搏:" + mzBlRecord.sphygmus + "次/分 ";
  8824. if (tz == null) {
  8825. tz = temp;
  8826. } else {
  8827. tz += " " + temp;
  8828. }
  8829. }
  8830. if (mzBlRecord.breathe != null && mzBlRecord.breathe != 0) {
  8831. var temp = "呼吸:" + mzBlRecord.breathe + "次/分 ";
  8832. if (tz == null) {
  8833. tz = temp;
  8834. } else {
  8835. tz += " " + temp;
  8836. }
  8837. }
  8838. if (mzBlRecord.pressureHigh != null && mzBlRecord.pressureFloor != null && mzBlRecord.pressureHigh != 0 && mzBlRecord.pressureFloor != 0) {
  8839. var temp = "血压:" + mzBlRecord.pressureHigh + "/" + mzBlRecord.pressureFloor;
  8840. if (tz == null) {
  8841. tz = temp;
  8842. } else {
  8843. tz += " " + temp;
  8844. }
  8845. }
  8846. if (mzBlRecord.pressureHighLeft != null && mzBlRecord.pressureFloorLeft != null && mzBlRecord.pressureHighLeft != 0 && mzBlRecord.pressureFloorLeft != 0) {
  8847. var temp = "左血压:" + mzBlRecord.pressureHighLeft + "/" + mzBlRecord.pressureFloorLeft;
  8848. if (tz == null) {
  8849. tz = temp;
  8850. } else {
  8851. tz += " " + temp;
  8852. }
  8853. }
  8854. if (mzBlRecord.emrPe != null && mzBlRecord.emrPe != "") {
  8855. if (tz == null) {
  8856. tz = mzBlRecord.emrPe;
  8857. } else {
  8858. tz += "," + mzBlRecord.emrPe;
  8859. }
  8860. }
  8861. return tz;
  8862. }
  8863. /**
  8864. * 打印医技申请单
  8865. * @param patientId
  8866. * @param times
  8867. * @param type 申请单类型:2:检验;3:检查
  8868. * @param printType 打印模式 1 预览打印 2 打印设置
  8869. */
  8870. function printYjReq(patientId, times, type, printType) {
  8871. $.ajax({
  8872. type: "GET",
  8873. url: '/thmz/printYjReq?patientId=' + patientId + '&times=' + times + "&reqType=" + type,
  8874. contentType: "application/json;charset=UTF-8",
  8875. dataType: "json",
  8876. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8877. success: function (res) {
  8878. if (res == '401' || res == 401) {
  8879. window.location.href = '/thmz/login/view'
  8880. return;
  8881. }
  8882. if (res.code == 0) {
  8883. if (res.data == null || res.data.mzYjReqList == null || res.data.mzYjReqList.length == 0) {
  8884. errorMesageSimaple("没有医技申请单可以打印");
  8885. return;
  8886. }
  8887. setPrint();
  8888. LODOP = getLodop();
  8889. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院检查申请单");
  8890. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  8891. //设置默认打印机
  8892. LODOP.SET_PRINTER_INDEX(printIndex);
  8893. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  8894. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  8895. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  8896. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "检查申请单");//对新建的纸张重命名
  8897. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  8898. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  8899. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  8900. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  8901. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  8902. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  8903. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  8904. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  8905. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  8906. var mzPatientMi = res.data.mzPatientMi;
  8907. $("#patientIdJcReq").text(mzPatientMi.patientId);
  8908. $("#patientNameJcReq").text(mzPatientMi.name);
  8909. $("#patientGenderJcReq").text(mzPatientMi.gender);
  8910. $("#patientAgeJcReq").text(mzPatientMi.ageString);
  8911. $("#responseTypeJcReq").text(mzPatientMi.responseTypeName);
  8912. $("#patientCardNoJcReq").text(mzPatientMi.icCardNo);
  8913. $("#icdTextJcReq").text(res.data.icdText);
  8914. $("#patientIdJyReq").text(mzPatientMi.patientId);
  8915. $("#patientNameJyReq").text(mzPatientMi.name);
  8916. $("#patientGenderJyReq").text(mzPatientMi.gender);
  8917. $("#patientAgeJyReq").text(mzPatientMi.ageString);
  8918. $("#responseTypeJyReq").text(mzPatientMi.responseTypeName);
  8919. $("#patientCardNoJyReq").text(mzPatientMi.icCardNo);
  8920. $("#icdTextJyReq").text(res.data.icdText);
  8921. var mzBlRecord = res.data.mzBlRecord;
  8922. $("#jcReqEmrChiefComplaint").text(mzBlRecord.emrChiefComplaint);
  8923. $("#jcReqHis").text(mzBlRecord.emrHpi);
  8924. $("#jyReqEmrChiefComplaint").text(mzBlRecord.emrChiefComplaint);
  8925. $("#jyReqHis").text(mzBlRecord.emrHpi);
  8926. var tz = getTz(mzBlRecord);
  8927. $("#jcReqTz").text(tz);
  8928. $("#jcReqReqDept").text(res.data.deptName);
  8929. $("#jcReqReqDoctor").text(res.data.doctorName);
  8930. $("#jyReqTz").text(tz);
  8931. $("#jyReqReqDept").text(res.data.deptName);
  8932. $("#jyReqReqDoctor").text(res.data.doctorName);
  8933. //检验报告列表名
  8934. 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>';
  8935. var jyContent = "";
  8936. var needNewPageA = false;
  8937. for (var i = 0; i < res.data.mzYjReqList.length; i++) {
  8938. var obj = res.data.mzYjReqList[i];
  8939. if (i == 0) {
  8940. var dateStr = format(obj.reqDate, "yyyy-MM-dd");
  8941. $("#jcReqReqDate").text(dateStr);
  8942. $("#jyReqReqDate").text(dateStr);
  8943. }
  8944. if (obj.reqType == "3") {
  8945. if (i > 0) {
  8946. LODOP.NewPageA();
  8947. }
  8948. $("#reqNoJcReq").text(obj.reqNo);
  8949. $("#jcReqItem").text(obj.groupName);
  8950. $("#jcReqRemark").text(obj.jyRemark);
  8951. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("jc_card_table").innerHTML);
  8952. needNewPageA = true;
  8953. } else if (obj.reqType == "2") {
  8954. var inspectStuff = (obj.inspectStuff == null || obj.inspectStuff == "null") ? "" : obj.inspectStuff;
  8955. jyContent += '<tr><td style="min-height: 30px;">' + obj.groupName + '</td><td>' + inspectStuff + '</td><td>' + obj.reqNo + '</td></tr>';
  8956. }
  8957. }
  8958. if (jyContent != null && jyContent != "" && jyContent.length > 0) {
  8959. if (needNewPageA) {
  8960. LODOP.NewPageA();
  8961. }
  8962. jyContent = jyTitle + jyContent;
  8963. $("#jyContent").html(jyContent);
  8964. //检验
  8965. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("jy_card_table").innerHTML);
  8966. }
  8967. if (printType == 1) {
  8968. LODOP.PREVIEW();
  8969. } else if (printType == 2) {
  8970. LODOP.PRINT_SETUP();
  8971. }
  8972. } else {
  8973. errorMesage(res);
  8974. }
  8975. }
  8976. });
  8977. }
  8978. /**
  8979. * 打印门诊病历
  8980. * @param patientId
  8981. * @param times
  8982. * @param clnicId
  8983. * @param payMark
  8984. * @param printType 打印模式 1 预览打印 2 打印设置
  8985. */
  8986. function printBlRecord(patientId, times, printType) {
  8987. $.ajax({
  8988. type: "GET",
  8989. url: '/thmz/getMzBlrecord?patientId=' + patientId + '&times=' + times,
  8990. contentType: "application/json;charset=UTF-8",
  8991. dataType: "json",
  8992. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8993. success: function (res) {
  8994. if (res == '401' || res == 401) {
  8995. window.location.href = '/thmz/login/view'
  8996. return;
  8997. }
  8998. if (res.code == 0) {
  8999. setPrint();
  9000. LODOP = getLodop();
  9001. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院门诊病历");
  9002. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  9003. //设置默认打印机
  9004. LODOP.SET_PRINTER_INDEX(printIndex);
  9005. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  9006. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  9007. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  9008. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊病历");//对新建的纸张重命名
  9009. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  9010. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  9011. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  9012. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  9013. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  9014. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  9015. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  9016. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  9017. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  9018. var mzPatientMi = res.mzPatientMi;
  9019. $("#patientIdBlrecord").text(mzPatientMi.patientId);
  9020. $("#patientNameBlrecord").text(mzPatientMi.name);
  9021. $("#patientGenderBlrecord").text(mzPatientMi.gender);
  9022. $("#patientAgeBlrecord").text(mzPatientMi.ageString);
  9023. var mzBlRecord = res.mzBlRecord;
  9024. if (mzBlRecord.firstOrNot == "1") {
  9025. $("#firstOrNotTitle").text("复诊");
  9026. } else {
  9027. $("#firstOrNotTitle").text("初诊");
  9028. }
  9029. if (mzBlRecord.emrChiefComplaint != null && mzBlRecord.emrChiefComplaint != "") {
  9030. $("#emrChiefComplaintBlrecord").text(mzBlRecord.emrChiefComplaint);
  9031. $("#emrChiefComplaintBlrecord").parent().css("display", "block");
  9032. } else {
  9033. $("#emrChiefComplaintBlrecord").parent().css("display", "none");
  9034. }
  9035. if (mzBlRecord.emrHpi != null && mzBlRecord.emrHpi != "") {
  9036. $("#emrHpiBlrecord").text(mzBlRecord.emrHpi);
  9037. $("#emrHpiBlrecord").parent().css("display", "block");
  9038. } else {
  9039. $("#emrHpiBlrecord").parent().css("display", "none");
  9040. }
  9041. if (mzBlRecord.emrPs != null && mzBlRecord.emrPs != "") {
  9042. $("#emrPsBlrecord").text(mzBlRecord.emrPs);
  9043. $("#emrPsBlrecord").parent().css("display", "block");
  9044. } else {
  9045. $("#emrPsBlrecord").parent().css("display", "none");
  9046. }
  9047. if (mzBlRecord.personalHistory != null && mzBlRecord.personalHistory != "") {
  9048. $("#personalHistoryBlrecord").text(mzBlRecord.personalHistory);
  9049. $("#personalHistoryBlrecord").parent().css("display", "block");
  9050. } else {
  9051. $("#personalHistoryBlrecord").parent().css("display", "none");
  9052. }
  9053. if (mzBlRecord.familyHistory != null && mzBlRecord.familyHistory != "") {
  9054. $("#familyHistoryBlrecord").text(mzBlRecord.familyHistory);
  9055. $("#familyHistoryBlrecord").parent().css("display", "block");
  9056. } else {
  9057. $("#familyHistoryBlrecord").parent().css("display", "none");
  9058. }
  9059. if (mzBlRecord.obstericalHistory != null && mzBlRecord.obstericalHistory != "") {
  9060. $("#obstericalHistoryBlrecord").text(mzBlRecord.obstericalHistory);
  9061. $("#obstericalHistoryBlrecord").parent().css("display", "block");
  9062. } else {
  9063. $("#obstericalHistoryBlrecord").parent().css("display", "none");
  9064. }
  9065. var tz = getTz(mzBlRecord);
  9066. if (tz != null && tz != "") {
  9067. $("#emrPeBlrecord").text(tz);
  9068. $("#emrPeBlrecord").parent().css("display", "block");
  9069. } else {
  9070. $("#emrPeBlrecord").parent().css("display", "none");
  9071. }
  9072. // if (mzBlRecord.emrPe != null && mzBlRecord.emrPe != "") {
  9073. // $("#emrPeBlrecord").text(mzBlRecord.emrPe);
  9074. // $("#emrPeBlrecord").parent().css("display", "block");
  9075. // } else {
  9076. // $("#emrPeBlrecord").parent().css("display", "none");
  9077. // }
  9078. if (res.icdText != null && res.icdText != "") {
  9079. $("#icdTextBlrecord").text(res.icdText);
  9080. $("#icdTextBlrecord").parent().css("display", "block");
  9081. } else {
  9082. $("#icdTextBlrecord").parent().css("display", "none");
  9083. }
  9084. if (mzBlRecord.emrProcess != null && mzBlRecord.emrProcess != "") {
  9085. $("#emrProcessBlrecord").html(mzBlRecord.emrProcess);
  9086. $("#emrProcessBlrecord").parent().css("display", "block");
  9087. } else {
  9088. $("#emrProcessBlrecord").parent().css("display", "none");
  9089. }
  9090. if (mzBlRecord.emrJkjy != null && mzBlRecord.emrJkjy != "") {
  9091. $("#emrJkjyBlrecord").text(mzBlRecord.emrJkjy);
  9092. $("#emrJkjyBlrecord").parent().css("display", "block");
  9093. } else {
  9094. $("#emrJkjyBlrecord").parent().css("display", "none");
  9095. }
  9096. $("#visitDeptBlrecord").text(res.deptName);
  9097. $("#visitDoctorBlrecord").text(res.doctorName);
  9098. $("#visitDateBlrecord").text(res.visitDate);
  9099. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("mz_blrecord_card_table").innerHTML);
  9100. if (printType == 1) {
  9101. LODOP.PREVIEW();
  9102. } else if (printType == 2) {
  9103. LODOP.PRINT_SETUP();
  9104. }
  9105. } else {
  9106. errorMesage(res);
  9107. }
  9108. }
  9109. });
  9110. }
  9111. /**
  9112. * 将内容拼接空格,这样才会有下划线
  9113. * @param mzPatientMi
  9114. * @param maxLength 最大长度
  9115. * @returns {*}
  9116. */
  9117. function formatUnderline(params, maxLength) {
  9118. var length = 0;
  9119. if (params == null || params.length == 0) {
  9120. length = maxLength;
  9121. } else {
  9122. length = maxLength - params.length;
  9123. }
  9124. for (var i = 0; i < length; i++) {
  9125. params += " ";
  9126. }
  9127. return params;
  9128. }
  9129. /**
  9130. * 打印入院通知单
  9131. * @param patientId
  9132. * @param times
  9133. * @param clnicId
  9134. * @param payMark
  9135. * @param printType 打印模式 1 预览打印 2 打印设置
  9136. */
  9137. function printZyReq(patientId, printType) {
  9138. $.ajax({
  9139. type: "GET",
  9140. url: '/thmz/printZyReq?patientId=' + patientId,
  9141. contentType: "application/json;charset=UTF-8",
  9142. dataType: "json",
  9143. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9144. success: function (res) {
  9145. if (res == '401' || res == 401) {
  9146. window.location.href = '/thmz/login/view'
  9147. return;
  9148. }
  9149. if (res.code == 0) {
  9150. setPrint();
  9151. LODOP = getLodop();
  9152. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院入院通知单");
  9153. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  9154. //设置默认打印机
  9155. LODOP.SET_PRINTER_INDEX(printIndex);
  9156. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  9157. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  9158. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  9159. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "入院通知单");//对新建的纸张重命名
  9160. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  9161. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  9162. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  9163. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  9164. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  9165. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  9166. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  9167. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  9168. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  9169. var mzPatientMi = res.mzPatientMi;
  9170. var mzZyReq = res.mzZyReq;
  9171. var mzPatientId = formatUnderline(mzPatientMi.patientId, 15);
  9172. $("#patientIdZyReq").text(mzPatientId);
  9173. var mzPatientMiName = formatUnderline(mzPatientMi.name, 22);
  9174. $("#patientNameZyReq").text(mzPatientMiName);
  9175. var mzPatientGender = formatUnderline(mzPatientMi.gender, 10);
  9176. $("#patientGenderZyReq").text(mzPatientGender);
  9177. var mzPatientAge = formatUnderline(mzPatientMi.ageString, 6);
  9178. $("#patientAgeZyReq").text(mzPatientAge);
  9179. var mzPatientSocialNo = formatUnderline(mzPatientMi.socialNo, 48);
  9180. $("#sfzZyReq").text(mzPatientSocialNo);
  9181. $("#birthDateZyReq").text(format(mzPatientMi.birthDay, "yyyy-MM-dd"));
  9182. var mzPatientPhoneNo = formatUnderline(mzPatientMi.phoneNo, 55);
  9183. $("#phoneZyReq").text(mzPatientPhoneNo);
  9184. $("#responseTypeZyReq").text(mzPatientMi.responseTypeName);
  9185. var mzPatientMiAddress = formatUnderline(mzPatientMi.address, 31);
  9186. $("#addressZyReq").text(mzPatientMiAddress);
  9187. if (mzZyReq.icdCode == null || mzZyReq.icdCode == "" || mzZyReq.icdCode.length == 0) {
  9188. $("#icsCodeZyReq").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
  9189. var mzPatientMiIcdText = formatUnderline(mzZyReq.icdText, 29);
  9190. $("#icsTextZyReq").text(" " + mzPatientMiIcdText);
  9191. } else {
  9192. var mzPatientMiIcdCode = formatUnderline(mzZyReq.icdCode, 12);
  9193. $("#icsCodeZyReq").text(mzPatientMiIcdCode);
  9194. var mzPatientMiIcdText = formatUnderline(mzZyReq.icdText, 29);
  9195. $("#icsTextZyReq").text(mzPatientMiIcdText);
  9196. }
  9197. var mzZyReqReqWard = formatUnderline(mzZyReq.reqWard, 6);
  9198. $("#reqDeptZyReq").text(mzZyReqReqWard);
  9199. var mzZyReqSmallDept = formatUnderline(mzZyReq.smallDept, 27);
  9200. $("#smallDeptZyReq").text(mzZyReqSmallDept);
  9201. //$("#admissStatusZyReq").text(mzZyReq.admissStatus);
  9202. $("input:checkbox[value='" + mzZyReq.admissStatus + "']").attr('checked', 'true');
  9203. var mzZyReqVisitDate = formatUnderline(format(mzZyReq.visitDate, "yyyy-MM-dd HH:mm:ss"), 37);
  9204. $("#visitDateZyReq").text(mzZyReqVisitDate);
  9205. var mzZyReqDeptCode = formatUnderline(mzZyReq.deptCode, 15);
  9206. $("#deptCodeZyReq").text(mzZyReqDeptCode);
  9207. var mzZyReqDoctorCode = formatUnderline(mzZyReq.doctorCode, 16);
  9208. $("#doctorCodeZyReq").text(mzZyReqDoctorCode);
  9209. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("mz_zy_req_table").innerHTML);
  9210. if (printType == 1) {
  9211. LODOP.PREVIEW();
  9212. } else if (printType == 2) {
  9213. LODOP.PRINT_SETUP();
  9214. }
  9215. } else {
  9216. errorMesage(res);
  9217. }
  9218. }
  9219. });
  9220. }
  9221. /**
  9222. * 打开查看检查检验报告窗口(含往期)
  9223. * @param patientId
  9224. */
  9225. function previewYjReqAll(patientId) {
  9226. $("#visitingDetailModal").modal("hide");
  9227. $("#previewYjReqModal").modal();
  9228. $("#previewYjReqModalPatientId").val(patientId);
  9229. $("#previewYjReqModalTimes").val(null);
  9230. //重置参数
  9231. retryCount = 0;
  9232. initJcJyTable();
  9233. }
  9234. /**
  9235. * 打开查看检查检验报告窗口
  9236. * @param patientId 门诊病人ID
  9237. * @param times 就诊次数
  9238. */
  9239. function previewYjReq(patientId, times) {
  9240. $("#visitingDetailModal").modal("hide");
  9241. $("#previewYjReqModal").modal();
  9242. $("#previewYjReqModalPatientId").val(patientId);
  9243. $("#previewYjReqModalTimes").val(times);
  9244. //重置参数
  9245. retryCount = 0;
  9246. initJcJyTable();
  9247. }
  9248. /**
  9249. * 删除本次处方
  9250. * @param clnicId 就诊记录id
  9251. */
  9252. function deletePrescription(clnicId) {
  9253. $("#visitingDetailModal").modal("hide");
  9254. $("#messageModal").modal();
  9255. $("#messageContent").html("确认要删除本次处方信息吗?");
  9256. $("#messageButton").off("click").on("click", function (t) {
  9257. $("#messageModal").modal("hide");
  9258. $.ajax({
  9259. type: "GET",
  9260. url: '/thmz/deletePrescription?clnicId=' + clnicId,
  9261. contentType: "application/json;charset=UTF-8",
  9262. dataType: "json",
  9263. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9264. success: function (res) {
  9265. if (res == '401' || res == 401) {
  9266. window.location.href = '/thmz/login/view'
  9267. return;
  9268. }
  9269. if (res.code == 0) {
  9270. successMesage(res);
  9271. $("#tb_table_clinic").bootstrapTable('refresh');
  9272. } else {
  9273. errorMesage(res);
  9274. }
  9275. }
  9276. });
  9277. });
  9278. $("#cancelButton").off("click").on("click", function (t) {
  9279. $("#visitingDetailModal").modal();
  9280. });
  9281. ;
  9282. }
  9283. /**
  9284. * 检查检验列表类型按钮切换事件
  9285. * @param object
  9286. */
  9287. function jcjyButtonChange(object) {
  9288. $("#jcjy_group").find("button").each(function (index, element) {
  9289. if ($(element).hasClass("btn-primary")) {
  9290. $(element).removeClass("btn-primary").addClass("btn-default");
  9291. }
  9292. });
  9293. $(object).removeClass("btn-default").addClass("btn-primary");
  9294. initJcJyTable();
  9295. }
  9296. /**
  9297. * 初始化检查检验报告列表
  9298. */
  9299. function initJcJyTable() {
  9300. clearInspectionDetail();
  9301. clearJcDetail();
  9302. var typeIndex = getIndex("jcjy_group");
  9303. if (typeIndex == 0) {
  9304. //检查
  9305. $('#tb_jy_pName_table_list').bootstrapTable("destroy");
  9306. $('#tb_jy_table_list').bootstrapTable("destroy");
  9307. initJcListTable();
  9308. $("#jy_detail").removeClass("in").addClass("hide");
  9309. $("#jc_detail").removeClass("hide").addClass("in");
  9310. } else {
  9311. $('#tb_table_list').bootstrapTable("destroy");
  9312. initJyListTable();
  9313. $("#jc_detail").removeClass("in").addClass("hide");
  9314. $("#jy_detail").removeClass("hide").addClass("in");
  9315. }
  9316. }
  9317. /**
  9318. * 初始化检查报告列表
  9319. */
  9320. function initJcListTable() {
  9321. $('#tb_table_list').bootstrapTable("destroy");
  9322. $('#tb_table_list').bootstrapTable({
  9323. url: '/thmz/getJcJyList', //请求后台的URL(*)
  9324. method: 'post', //请求方式(*)
  9325. toolbar: '#toolbar', //工具按钮用哪个容器
  9326. striped: true, //是否显示行间隔色
  9327. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  9328. pagination: true, //是否显示分页(*)
  9329. sortable: true, //是否启用排序
  9330. sortOrder: "asc", //排序方式
  9331. queryParams: queryParams, //传递参数(*)
  9332. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  9333. pageNumber: 1, //初始化加载第一页,默认第一页
  9334. pageSize: 5, //每页的记录行数(*)
  9335. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  9336. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  9337. strictSearch: true,
  9338. showColumns: false, //是否显示所有的列
  9339. showRefresh: false, //是否显示刷新按钮
  9340. minimumCountColumns: 2, //最少允许的列数
  9341. clickToSelect: true, //是否启用点击选中行
  9342. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  9343. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  9344. cardView: false, //是否显示详细视图
  9345. detailView: false,
  9346. //rowStyle:rowStyle,//通过自定义函数设置行样式
  9347. ajaxOptions: {
  9348. headers: {
  9349. 'Accept': 'application/json',
  9350. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  9351. }
  9352. },
  9353. columns: [
  9354. {
  9355. field: 'groupName',
  9356. title: '项目名称',
  9357. align: "center",
  9358. valign: 'middle',
  9359. }, {
  9360. field: 'reqDate',
  9361. title: '申请时间',
  9362. align: "center",
  9363. valign: 'middle',
  9364. formatter: function (value, row, index) {
  9365. if (value == null || value == "") {
  9366. return "";
  9367. }
  9368. return format(value, "yyyy-MM-dd HH:mm:ss");
  9369. }
  9370. }
  9371. ],
  9372. onClickRow: function (row) {
  9373. clearJcDetail();
  9374. $("#patientId_t").text(row.patientId);
  9375. $("#name_t").text(row.patientName);
  9376. $("#date_t").text(format(row.reqDate, "yyyy-MM-dd HH:mm:ss"));
  9377. fitJcDetail(row.reqNo, row.patientId);
  9378. },
  9379. responseHandler: function (res) {
  9380. if (res == '401' || res == 401) {
  9381. window.location.href = '/thmz/login/view'
  9382. return;
  9383. }
  9384. var ress = eval(res);
  9385. if (ress.code == -1) {
  9386. if (ress.message != null && ress.message != '') {
  9387. errorMesage(ress);
  9388. }
  9389. if (retryCount == 0) {
  9390. retryCount++;
  9391. $("#jyButton").click();
  9392. return;
  9393. }
  9394. return {
  9395. "total": 0,//总页数
  9396. "rows": {} //数据
  9397. };
  9398. }
  9399. if (ress.count <= 0 && retryCount == 0) {
  9400. retryCount++;
  9401. $("#jyButton").click();
  9402. return;
  9403. }
  9404. //有数据的时候,计数也需要加1,防止这时医生自己候点击检验没数据又跳回检查
  9405. retryCount++;
  9406. return {
  9407. "total": ress.count,//总页数
  9408. "rows": ress.data //数据
  9409. };
  9410. },
  9411. onLoadSuccess: function (data) {
  9412. $(".pagination-detail").css("display", "none");
  9413. }
  9414. });
  9415. }
  9416. /**
  9417. * 构建列表查询参数
  9418. * @param params
  9419. * @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}}
  9420. */
  9421. function queryParams(params) {
  9422. var patientId = $("#previewYjReqModalPatientId").val();
  9423. var times = $("#previewYjReqModalTimes").val();
  9424. return {
  9425. reqType: "3",
  9426. patientId: patientId,
  9427. times: times,
  9428. pageSize: params.limit, //页面大小
  9429. pageIndex: params.offset / params.limit //页码
  9430. };
  9431. };
  9432. /**
  9433. * 加载检查明细
  9434. * @param reqNo
  9435. */
  9436. function fitJcDetail(reqNo, patientId) {
  9437. $.ajax({
  9438. type: "GET",
  9439. url: '/thmz/getYjJcRecordReport?hisReqNo=' + reqNo + "&patientId=" + patientId,
  9440. contentType: "application/json;charset=UTF-8",
  9441. dataType: "json",
  9442. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9443. success: function (res) {
  9444. if (res == '401' || res == 401) {
  9445. window.location.href = '/thmz/login/view'
  9446. return;
  9447. }
  9448. if (res.code == 0) {
  9449. canBePrintJc = true;
  9450. $("#jy_detail").removeClass("in").addClass("hide");
  9451. $("#jc_detail").removeClass("hide").addClass("in");
  9452. var mzPatientMi = res.data.mzPatientMi;
  9453. $("#gender_jc").text(mzPatientMi.gender);
  9454. $("#age_jc").text(mzPatientMi.ageString);
  9455. var yjJcRecordReport = res.data.yjJcRecordReport;
  9456. $("#groupName").text(res.data.groupName);
  9457. $("#textJc").text(yjJcRecordReport.textJc);
  9458. $("#textZd").text(yjJcRecordReport.textZd);
  9459. var jcRecord = res.data.jcRecord;
  9460. $("#report_no").text(jcRecord.reportNo);
  9461. $("#reportId").text(jcRecord.reportId);
  9462. if (jcRecord.reportDate == null || jcRecord.reportDate == "") {
  9463. $("#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;");
  9464. } else {
  9465. $("#reportDate").text(format(jcRecord.reportDate, "yyyy-MM-dd HH:mm:ss"));
  9466. }
  9467. $("#confirmId").text(jcRecord.confirmId);
  9468. if (jcRecord.confirmDate == null || jcRecord.confirmDate == "") {
  9469. $("#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;");
  9470. } else {
  9471. $("#confirmDate").text(format(jcRecord.confirmDate, "yyyy-MM-dd HH:mm:ss"));
  9472. }
  9473. } else {
  9474. errorMesage(res);
  9475. }
  9476. }
  9477. });
  9478. }
  9479. /**
  9480. * 清空检查明细
  9481. * @param reqNo
  9482. */
  9483. function clearJcDetail() {
  9484. canBePrintJc = false;
  9485. $("#patientId_t").text("");
  9486. $("#name_t").text("");
  9487. $("#date_t").text("");
  9488. $("#gender_jc").text("");
  9489. $("#age_jc").text("");
  9490. $("#groupName").text("");
  9491. $("#textJc").text("");
  9492. $("#textZd").text("");
  9493. $("#report_no").text("");
  9494. $("#reportId").text("");
  9495. $("#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;");
  9496. $("#confirmId").text("");
  9497. $("#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;");
  9498. }
  9499. /**
  9500. * 初始化检验报告列表
  9501. */
  9502. function initJyListTable() {
  9503. var patientId = $("#previewYjReqModalPatientId").val();
  9504. var times = $("#previewYjReqModalTimes").val();
  9505. $('#tb_table_list').bootstrapTable("destroy");
  9506. $('#tb_table_list').bootstrapTable({
  9507. url: '/thmz/getJyListByPatientIdAndTimes?patientId=' + patientId + "&times=" + times, //请求后台的URL(*)
  9508. method: 'get', //请求方式(*)
  9509. toolbar: '#toolbar', //工具按钮用哪个容器
  9510. striped: true, //是否显示行间隔色
  9511. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  9512. pagination: true, //是否显示分页(*)
  9513. sortable: true, //是否启用排序
  9514. sortOrder: "asc", //排序方式
  9515. //queryParams: queryJyPNameParams, //传递参数(*)
  9516. sidePagination: "client", //分页方式:client客户端分页,server服务端分页(*)
  9517. pageNumber: 1, //初始化加载第一页,默认第一页
  9518. pageSize: 5, //每页的记录行数(*)
  9519. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  9520. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  9521. strictSearch: true,
  9522. showColumns: false, //是否显示所有的列
  9523. showRefresh: false, //是否显示刷新按钮
  9524. minimumCountColumns: 2, //最少允许的列数
  9525. clickToSelect: true, //是否启用点击选中行
  9526. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  9527. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  9528. cardView: false, //是否显示详细视图
  9529. detailView: false,
  9530. //rowStyle:rowStyle,//通过自定义函数设置行样式
  9531. ajaxOptions: {
  9532. headers: {
  9533. 'Accept': 'application/json',
  9534. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  9535. }
  9536. },
  9537. columns: [
  9538. {
  9539. field: 'aply_CTNT',
  9540. title: '检验名称',
  9541. align: "center",
  9542. valign: 'middle',
  9543. }, {
  9544. field: 'ordr_CREATE_DATE',
  9545. title: '检验时间',
  9546. align: "center",
  9547. valign: 'middle',
  9548. formatter: function (value, row, index) {
  9549. if (value == null || value == "") {
  9550. return "";
  9551. }
  9552. return format(value, "yyyy-MM-dd HH:mm:ss");
  9553. }
  9554. }
  9555. ],
  9556. onClickRow: function (row) {
  9557. queryInspectionDetail(row.ordr_ID);
  9558. },
  9559. responseHandler: function (res) {
  9560. if (res == '401' || res == 401) {
  9561. window.location.href = '/thmz/login/view'
  9562. return;
  9563. }
  9564. var ress = eval(res);
  9565. if (ress.code == -1) {
  9566. if (retryCount == 0) {
  9567. retryCount++;
  9568. $("#jcButton").click();
  9569. return;
  9570. }
  9571. if (ress.message != null && ress.message != '') {
  9572. errorMesage(ress);
  9573. }
  9574. return {
  9575. "total": ress.data.length,//总页数
  9576. "rows": ress.data //数据
  9577. };
  9578. }
  9579. if (ress.data.length <= 0 && retryCount == 0) {
  9580. retryCount++;
  9581. $("#jcButton").click();
  9582. return;
  9583. }
  9584. //有数据的时候,计数也需要加1,防止这时医生自己候点击检查没数据又跳回检验
  9585. retryCount++;
  9586. return {
  9587. "total": ress.data.length,//总页数
  9588. "rows": ress.data //数据
  9589. };
  9590. },
  9591. onLoadSuccess: function (data) {
  9592. $("#jy_table_table_div").find(".pagination-detail").css("display", "none");
  9593. }
  9594. });
  9595. }
  9596. /**
  9597. * 清空检验明细
  9598. * @param orderId
  9599. */
  9600. function clearInspectionDetail() {
  9601. canBePrintJy = false;
  9602. $("#patientId_t_jy").text("");
  9603. $("#name_t_jy").text("");
  9604. $("#gender_jy").text("");
  9605. $("#age_jy").text("");
  9606. $("#reqDept_t_jy").text("");
  9607. $("#bed_no_jy").text("");
  9608. $("#smpl_jy").text("");
  9609. $("#item_jy").text("");
  9610. $("#applyDate").text("");
  9611. $("#orderCreateDate").text("");
  9612. $("#auditTime").text("");
  9613. $("#orderUsrName").text("");
  9614. $("#testUsrName").text("");
  9615. $("#auditUsrName").text("");
  9616. $("#jyBody").html("");
  9617. }
  9618. /**
  9619. * 加载检验明细
  9620. * @param orderId
  9621. */
  9622. function queryInspectionDetail(orderId) {
  9623. clearInspectionDetail();
  9624. $.ajax({
  9625. type: "GET",
  9626. url: '/thmz/getInspectionDetail?orderId=' + orderId,
  9627. contentType: "application/json;charset=UTF-8",
  9628. dataType: "json",
  9629. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9630. success: function (res) {
  9631. if (res == '401' || res == 401) {
  9632. window.location.href = '/thmz/login/view'
  9633. return;
  9634. }
  9635. if (res.code == 0) {
  9636. canBePrintJy = true;
  9637. $("#jc_detail").removeClass("in").addClass("hide");
  9638. $("#jy_detail").removeClass("hide").addClass("in");
  9639. var mzPatientMi = res.mzPatientMi;
  9640. $("#patientId_t_jy").text(mzPatientMi.patientId);
  9641. $("#name_t_jy").text(mzPatientMi.name);
  9642. $("#gender_jy").text(mzPatientMi.gender);
  9643. $("#age_jy").text(mzPatientMi.ageString);
  9644. var html = "";
  9645. if (res.data != null) {
  9646. var inspectionHeader = res.data.inspectionHeader;
  9647. $("#reqDept_t_jy").text(inspectionHeader.dept_NAME);
  9648. $("#bed_no_jy").text(inspectionHeader.ptnt_BED_NO);
  9649. $("#smpl_jy").text(inspectionHeader.smpl_NAME);
  9650. $("#item_jy").text(inspectionHeader.aply_CNTN);
  9651. $("#applyDate").text(format(inspectionHeader.aply_DATE, "yyyy-MM-dd HH:mm:ss"));
  9652. $("#orderCreateDate").text(format(inspectionHeader.ordr_CREATE_DATE, "yyyy-MM-dd HH:mm:ss"));
  9653. $("#auditTime").text(format(inspectionHeader.audt_TIME, "yyyy-MM-dd HH:mm:ss"));
  9654. $("#orderUsrName").text(inspectionHeader.ordr_USR_NAME);
  9655. $("#testUsrName").text(inspectionHeader.test_USR_NAME);
  9656. $("#auditUsrName").text(inspectionHeader.audt_USR_NAME);
  9657. var inspectionItems = res.data.inspectionItems;
  9658. if (inspectionItems != null && inspectionItems.length > 0) {
  9659. for (var i = 0; i < inspectionItems.length; i++) {
  9660. html += "<tr>";
  9661. var obj = inspectionItems[i];
  9662. var itm_VALUE = obj.itm_VALUE;
  9663. if (itm_VALUE == null || itm_VALUE == "null") {
  9664. itm_VALUE = "";
  9665. }
  9666. itm_VALUE += (obj.itm_STR_VALUE == null || obj.itm_STR_VALUE == "null") ? "" : obj.itm_STR_VALUE;
  9667. var range = obj.range;
  9668. if (range == null || range == "null") {
  9669. range = "";
  9670. }
  9671. range += (obj.range_STR == null || obj.range_STR == "null") ? "" : obj.range_STR;
  9672. html += "<td width='25%'>" + obj.itm_NAME + "</td>";
  9673. html += "<td width='16.66%'>" + itm_VALUE + "</td>";
  9674. html += "<td width='16.66%'>" + obj.itm_UNIT + "</td>";
  9675. if (obj.itm_ALERT == null || obj.itm_ALERT == "") {
  9676. html += "<td width='16.66%'><span style=\"color:#67C23A;font-weight:bold\"></span></td>";
  9677. } else if (obj.itm_ALERT == "H") {
  9678. html += "<td width='16.66%'><span style=\"color:#F56C6C;font-weight:bold\">↑</span></td>";
  9679. } else if (obj.itm_ALERT == "L") {
  9680. html += "<td width='16.66%'><span style=\"color:#F56C6C;font-weight:bold\">↓</span></td>";
  9681. }
  9682. html += "<td width='25%'>" + range + "</td>";
  9683. html += "</tr>";
  9684. var bacteriaResults = obj.bacteriaResults;
  9685. if (bacteriaResults == null || bacteriaResults.length == 0) {
  9686. continue;
  9687. }
  9688. var bacteriaResult = bacteriaResults[0];
  9689. if (bacteriaResult == null || bacteriaResult.length == 0) {
  9690. continue;
  9691. }
  9692. var antibioticResults = bacteriaResult.antibioticResults;
  9693. if (antibioticResults == null || antibioticResults.length == 0) {
  9694. continue;
  9695. }
  9696. 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>';
  9697. for (var j = 0; j < antibioticResults.length; j++) {
  9698. var antibioticResultsObj = antibioticResults[j];
  9699. html += "<tr>";
  9700. html += "<td width='35%' style='padding-left: 2%;";
  9701. if (j == 0) {
  9702. html += "border-top: 1px solid black;";
  9703. }
  9704. html += "'>" + antibioticResultsObj.anti_NAME_CN + "</td>";
  9705. html += "<td width='20%' ";
  9706. if (j == 0) {
  9707. html += "style='border-top: 1px solid black;'";
  9708. }
  9709. html += ">" + antibioticResultsObj.anti_ABB + "</td>";
  9710. html += "<td width='25%' ";
  9711. if (j == 0) {
  9712. html += "style='border-top: 1px solid black;'";
  9713. }
  9714. html += ">" + antibioticResultsObj.anti_MIC + "</td>";
  9715. html += "<td width='20%' style='padding-right: 2%;";
  9716. if (j == 0) {
  9717. html += "border-top: 1px solid black;";
  9718. }
  9719. html += "'>" + antibioticResultsObj.anti_VALUE + "</td>";
  9720. html += "</tr>";
  9721. }
  9722. }
  9723. }
  9724. }
  9725. $("#jyBody").html(html);
  9726. } else {
  9727. errorMesage(res);
  9728. }
  9729. }
  9730. });
  9731. }
  9732. /**
  9733. * 打印检查检验报告单
  9734. * @param printType 打印模式 1 预览打印 2 打印设置
  9735. */
  9736. function printJyJcReport(printType) {
  9737. var typeIndex = getIndex("jcjy_group");
  9738. var title = "检查报告单";
  9739. if (typeIndex == 1) {
  9740. title = "检验报告单"
  9741. if (!canBePrintJy) {
  9742. warningMesageSimaple("没有任何【" + title + "】可供打印!");
  9743. return;
  9744. }
  9745. } else {
  9746. if (!canBePrintJc) {
  9747. warningMesageSimaple("没有任何【" + title + "】可供打印!");
  9748. return;
  9749. }
  9750. }
  9751. setPrint();
  9752. LODOP = getLodop();
  9753. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院" + title);
  9754. LODOP.SET_PRINT_STYLE("FontSize", 7); //字体大小
  9755. //设置默认打印机
  9756. LODOP.SET_PRINTER_INDEX(printIndex);
  9757. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  9758. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  9759. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  9760. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", title);//对新建的纸张重命名
  9761. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  9762. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  9763. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  9764. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  9765. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  9766. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  9767. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  9768. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  9769. var strStyle = "<style>table{width: 96%;} #jy_detail_content thead {border-bottom: 1px solid black;border-collapse: collapse;}</style>";
  9770. if (typeIndex == 0) {
  9771. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("jc_detail").innerHTML);
  9772. }
  9773. if (typeIndex == 1) {
  9774. LODOP.ADD_PRINT_TABLE("37mm", "5mm", "130mm", "138mm", strStyle + document.getElementById("jy_detail_content").innerHTML);
  9775. LODOP.SET_PRINT_STYLEA(0, "Vorient", 3);
  9776. LODOP.ADD_PRINT_HTM("0mm", "5mm", "130mm", "200mm", strStyle + document.getElementById("jy_detail_title").innerHTML);
  9777. LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
  9778. LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
  9779. LODOP.ADD_PRINT_HTM("177mm", "5mm", "130mm", "200mm", strStyle + document.getElementById("jy_detail_foot").innerHTML);
  9780. LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
  9781. LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
  9782. }
  9783. if (printType == 1) {
  9784. LODOP.PREVIEW();
  9785. } else if (printType == 2) {
  9786. LODOP.PRINT_SETUP();
  9787. }
  9788. }
  9789. /**
  9790. * 初始化科室下拉选
  9791. */
  9792. function initExecUnit() {
  9793. //父科室列表
  9794. $.ajax({
  9795. type: "GET",
  9796. url: '/thmz/allUnitCode',
  9797. dataType: "json",
  9798. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9799. success: function (data) {
  9800. if (data == '401' || data == 401) {
  9801. window.location.href = '/thmz/login/view'
  9802. return;
  9803. }
  9804. $('#execUnit').empty(); //清空resText里面的所有内容
  9805. $('#zlExecUnit').empty(); //清空resText里面的所有内容
  9806. var html = '';
  9807. $.each(data.data, function (commentIndex, comment) {
  9808. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + '-' + comment.code + ')</option>';
  9809. });
  9810. $('#execUnit').html(html);
  9811. $('#execUnit').selectpicker('refresh');
  9812. $('#zlExecUnit').html(html);
  9813. $('#zlExecUnit').selectpicker('refresh');
  9814. }
  9815. });
  9816. }
  9817. /**
  9818. * 初始化证件类型下拉选
  9819. */
  9820. function initCertificateTypeSelect() {
  9821. $.ajax({
  9822. type: "GET",
  9823. url: '/thmz/listCertificateType',
  9824. contentType: "application/json;charset=UTF-8",
  9825. dataType: "json",
  9826. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9827. success: function (res) {
  9828. if (res == '401' || res == 401) {
  9829. window.location.href = '/thmz/login/view'
  9830. return;
  9831. }
  9832. if (res.code == 0) {
  9833. res.data.forEach(function (item, index) {
  9834. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  9835. $('#rapidAcceptsUserCertificateType').append(html);
  9836. $('#editUserCertificateType').append(html);
  9837. });
  9838. $('#rapidAcceptsUserCertificateType').selectpicker('refresh');
  9839. $('#editUserCertificateType').selectpicker('refresh');
  9840. } else {
  9841. errorMesage(res);
  9842. }
  9843. }
  9844. });
  9845. }
  9846. /**
  9847. * 加载病历信息编辑预览
  9848. * @param patientId
  9849. * @param times
  9850. * @param type 1 编辑 2 预览
  9851. */
  9852. function showMzBlRecordModal(patientId, times, type) {
  9853. $.ajax({
  9854. type: "GET",
  9855. url: '/thmz/getMzBlrecord?patientId=' + patientId + '&times=' + times,
  9856. contentType: "application/json;charset=UTF-8",
  9857. dataType: "json",
  9858. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9859. success: function (res) {
  9860. if (res == '401' || res == 401) {
  9861. window.location.href = '/thmz/login/view'
  9862. return;
  9863. }
  9864. if (res.code == 0) {
  9865. var mzPatientMi = res.mzPatientMi;
  9866. $("#editPatientId").text(mzPatientMi.patientId);
  9867. $("#editPatientName").text(mzPatientMi.name);
  9868. $("#editPatientGender").text(mzPatientMi.gender);
  9869. $("#editPatientAge").text(mzPatientMi.ageString);
  9870. var mzBlRecord = res.mzBlRecord;
  9871. $("#editEmrChiefComplaint").val(mzBlRecord.emrChiefComplaint == null ? "" : mzBlRecord.emrChiefComplaint);
  9872. $("#editEmrHpi").val(mzBlRecord.emrHpi == null ? "" : mzBlRecord.emrHpi);
  9873. $("#editEmrPs").val(mzBlRecord.emrPs == null ? "" : mzBlRecord.emrPs);
  9874. $("#editPersonalHistory").val(mzBlRecord.personalHistory == null ? "" : mzBlRecord.personalHistory);
  9875. $("#editFamilyHistory").val(mzBlRecord.familyHistory == null ? "" : mzBlRecord.familyHistory);
  9876. $("#editObstericalHistory").val(mzBlRecord.obstericalHistory == null ? "" : mzBlRecord.obstericalHistory);
  9877. $("#editQtjc").val(mzBlRecord.emrPe == null ? "" : mzBlRecord.emrPe);
  9878. if (mzBlRecord.icdCode != null && mzBlRecord.icdText != null) {
  9879. setSelectedAttr("editZd", mzBlRecord.icdCode, mzBlRecord.icdText)
  9880. }
  9881. $("#edittentativeDiagnosis").val(mzBlRecord.tentativeDiagnosis == null ? "" : mzBlRecord.tentativeDiagnosis);
  9882. $("#editEmrJkjy").val(mzBlRecord.emrJkjy == null ? "" : mzBlRecord.emrJkjy);
  9883. $("#bl_weight").val(mzBlRecord.weight == 0 ? null : mzBlRecord.weight);
  9884. $("#bl_temperature").val(mzBlRecord.temperature == 0 ? null : mzBlRecord.temperature);
  9885. $("#bl_sphygmus").val(mzBlRecord.sphygmus == 0 ? null : mzBlRecord.sphygmus);
  9886. $("#bl_breathe").val(mzBlRecord.breathe == 0 ? null : mzBlRecord.breathe);
  9887. $("#bl_pressure_high").val(mzBlRecord.pressureHigh == 0 ? null : mzBlRecord.pressureHigh);
  9888. $("#bl_pressure_floor").val(mzBlRecord.pressureFloor == 0 ? null : mzBlRecord.pressureFloor);
  9889. $("#bl_pressure_high_left").val(mzBlRecord.pressureHighLeft == 0 ? null : mzBlRecord.pressureHighLeft);
  9890. $("#bl_pressure_floor_left").val(mzBlRecord.pressureFloorLeft == 0 ? null : mzBlRecord.pressureFloorLeft);
  9891. if (mzBlRecord.emrProcess != null && mzBlRecord.emrProcess != "") {
  9892. var reg = new RegExp("</br>", "g");//g,表示全部替换。
  9893. var editEmrProcess = mzBlRecord.emrProcess.replace(reg, "\n");
  9894. reg = new RegExp("&nbsp;", "g");//g,表示全部替换。
  9895. editEmrProcess = editEmrProcess.replace(reg, "");
  9896. $("#editEmrProcess").val(editEmrProcess);
  9897. } else {
  9898. $("#editEmrProcess").val("");
  9899. }
  9900. if (type == 1) {
  9901. $("#mzBlRecorTitle").html("门诊病历【编辑】");
  9902. $("#setOtherEmrProcess").removeClass("in").addClass("hide");
  9903. $("#openBlRecordModel").removeClass("hide").addClass("in");
  9904. $("#setEmrProcess").removeClass("hide").addClass("in");
  9905. $("#visitingDetailModal").modal("hide");
  9906. } else if (type == 2) {
  9907. $("#mzBlRecorTitle").html("门诊病历【预览】");
  9908. $("#setOtherEmrProcess").removeClass("hide").addClass("in");
  9909. $("#openBlRecordModel").removeClass("in").addClass("hide");
  9910. $("#setEmrProcess").removeClass("in").addClass("hide");
  9911. //因为预览的时候,关闭预览框没有清空数据,且 此时基础数据的病历次数被清空
  9912. if ($("#mzBlTimes").val() != null && $("#mzBlTimes").val() != "" && ($("#baseMzBlTimes").val() == null || $("#baseMzBlTimes").val() == "")) {
  9913. $("#baseMzBlTimes").val($("#mzBlTimes").val());
  9914. }
  9915. $("#otherBlRecordModal").modal("hide");
  9916. }
  9917. $("#mzBlTimes").val(mzBlRecord.times);
  9918. $("#editMzBlRecordModal").modal();
  9919. } else {
  9920. errorMesage(res);
  9921. }
  9922. }
  9923. });
  9924. }
  9925. /**
  9926. * 清空区域
  9927. */
  9928. function clearInput() {
  9929. //编辑病历的时候,没有基础病历的就诊次数,如果是预览病历的时候,有基础病历的次数
  9930. var baseMzBlTimes = $("#baseMzBlTimes").val();
  9931. $("#editPatientId").text(null);
  9932. $("#editPatientName").text(null);
  9933. $("#editPatientGender").text(null);
  9934. $("#editPatientAge").text(null);
  9935. $("#editEmrChiefComplaint").val(null);
  9936. $("#editEmrHpi").val(null);
  9937. $("#editEmrPs").val(null);
  9938. $("#editPersonalHistory").val(null);
  9939. $("#editFamilyHistory").val(null);
  9940. $("#editObstericalHistory").val(null);
  9941. $("#bl_weight").val(null);
  9942. $("#bl_sphygmus").val(null);
  9943. $("#bl_breathe").val(null);
  9944. $("#bl_pressure_high").val(null);
  9945. $("#bl_pressure_floor").val(null);
  9946. $("#bl_pressure_high_left").val(null);
  9947. $("#bl_pressure_floor_left").val(null);
  9948. $("#editQtjc").val(null);
  9949. $("#editZd").selectpicker('val', null);
  9950. $("#editZd").selectpicker('refresh');
  9951. $("#edittentativeDiagnosis").val(null);
  9952. $("#editEmrProcess").val(null);
  9953. $("#editEmrJkjy").val(null);
  9954. $("#mzBlTimes").val(null);
  9955. if (baseMzBlTimes != null && baseMzBlTimes != "") {
  9956. $("#otherBlRecordModal").modal();
  9957. }
  9958. }
  9959. /**
  9960. * 保存门诊病历
  9961. */
  9962. function setEmrProcess() {
  9963. $("#editMzBlRecordModal").modal("hide");
  9964. $("#messageModal").modal();
  9965. $("#messageContent").html("确认修改当前门诊病历吗?");
  9966. $("#messageButton").off("click").on("click", function (t) {
  9967. $("#messageModal").modal("hide");
  9968. sendEmrProcess();
  9969. });
  9970. $("#cancelButton").off("click").on("click", function (t) {
  9971. $("#editMzBlRecordModal").modal();
  9972. });
  9973. }
  9974. /**
  9975. * 提交保存门诊病历
  9976. */
  9977. function sendEmrProcess() {
  9978. //修改告警人员
  9979. var icdCodes = $("#editZd").val();
  9980. var icdCodeStr = null;
  9981. if (icdCodes != null && icdCodes.length > 0) {
  9982. for (var i = 0; i < icdCodes.length; i++) {
  9983. if (icdCodeStr == null) {
  9984. icdCodeStr = icdCodes[i];
  9985. } else {
  9986. icdCodeStr += "," + icdCodes[i];
  9987. }
  9988. }
  9989. }
  9990. $.ajax({
  9991. type: "POST",
  9992. url: '/thmz/setEmrProcess',
  9993. contentType: "application/json;charset=UTF-8",
  9994. dataType: "json",
  9995. data: JSON.stringify({
  9996. "patientId": $("#editPatientId").text(),
  9997. "times": $("#mzBlTimes").val(),
  9998. "emrChiefComplaint": $("#editEmrChiefComplaint").val(),
  9999. "emrHpi": $("#editEmrHpi").val(),
  10000. "emrPs": $("#editEmrPs").val(),
  10001. "personalHistory": $("#editPersonalHistory").val(),
  10002. "familyHistory": $("#editFamilyHistory").val(),
  10003. "obstericalHistory": $("#editObstericalHistory").val(),
  10004. "emrPe": $("#editQtjc").val(),
  10005. "weight": $("#bl_weight").val(),
  10006. "temperature": $("#bl_temperature").val(),
  10007. "sphygmus": $("#bl_sphygmus").val(),
  10008. "breathe": $("#bl_breathe").val(),
  10009. "pressureHigh": $("#bl_pressure_high").val(),
  10010. "pressureFloor": $("#bl_pressure_floor").val(),
  10011. "pressureHighLeft": $("#bl_pressure_high_left").val(),
  10012. "pressureFloorLeft": $("#bl_pressure_floor_left").val(),
  10013. "icdCode": icdCodeStr,
  10014. "icdText": $('#editZd').next().attr("title"),
  10015. "tentativeDiagnosis": $("#edittentativeDiagnosis").val(),
  10016. "emrJkjy": $("#editEmrJkjy").val(),
  10017. "emrProcess": $("#editEmrProcess").val()
  10018. }),
  10019. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10020. success: function (res) {
  10021. if (res == '401' || res == 401) {
  10022. window.location.href = '/thmz/login/view'
  10023. return;
  10024. }
  10025. if (res.code == 0) {
  10026. clearInput();
  10027. successMesage(res);
  10028. $("#editMzBlRecordModal").modal("hide");
  10029. } else {
  10030. errorMesage(res);
  10031. }
  10032. }
  10033. });
  10034. }
  10035. /**
  10036. * 打开待合并病历列表弹框
  10037. */
  10038. function openBlRecordModel() {
  10039. $("#editMzBlRecordModal").modal("hide");
  10040. $("#otherBlRecordModal").modal();
  10041. initOtherMzBlRecordList();
  10042. }
  10043. /**
  10044. * 关闭待合并病历列表
  10045. */
  10046. function closeBlRecordModel() {
  10047. $('#baseMzBlTimes').val(null);
  10048. $("#visitingDetailModal").modal();
  10049. }
  10050. /**
  10051. * 病历列表
  10052. */
  10053. function initOtherMzBlRecordList() {
  10054. $('#other_bl_record_table').bootstrapTable("destroy");
  10055. $('#other_bl_record_table').bootstrapTable({
  10056. url: '/thmz/getMzBlRecordList', //请求后台的URL(*)
  10057. method: 'post', //请求方式(*)
  10058. toolbar: '#toolbar', //工具按钮用哪个容器
  10059. striped: true, //是否显示行间隔色
  10060. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  10061. pagination: true, //是否显示分页(*)
  10062. sortable: true, //是否启用排序
  10063. sortOrder: "desc", //排序方式
  10064. queryParams: queryOtherParams, //传递参数(*)
  10065. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  10066. pageNumber: 1, //初始化加载第一页,默认第一页
  10067. pageSize: 5, //每页的记录行数(*)
  10068. pageList: [10, 15, 25, 50, 100], //可供选择的每页的行数(*)
  10069. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  10070. strictSearch: true,
  10071. showColumns: false, //是否显示所有的列
  10072. showRefresh: false, //是否显示刷新按钮
  10073. minimumCountColumns: 2, //最少允许的列数
  10074. clickToSelect: true, //是否启用点击选中行
  10075. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  10076. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  10077. cardView: false, //是否显示详细视图
  10078. detailView: false,
  10079. //rowStyle:rowStyle,//通过自定义函数设置行样式
  10080. ajaxOptions: {
  10081. headers: {
  10082. 'Accept': 'application/json',
  10083. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  10084. }
  10085. },
  10086. columns: [
  10087. {
  10088. title: '操作',
  10089. field: 'op',
  10090. align: "center",
  10091. valign: 'middle',
  10092. formatter: function (value, row, index) {
  10093. 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>';
  10094. return [str].join('');
  10095. }
  10096. },
  10097. {
  10098. field: 'patientId',
  10099. title: '门诊ID',
  10100. align: "center",
  10101. valign: 'middle'
  10102. }, {
  10103. field: 'patientName',
  10104. title: '患者姓名',
  10105. align: "center",
  10106. valign: 'middle'
  10107. }, {
  10108. field: 'deptCode',
  10109. title: '就诊科室',
  10110. align: "center",
  10111. valign: 'middle'
  10112. }, {
  10113. field: 'doctorCode',
  10114. title: '接诊医师',
  10115. align: "center",
  10116. valign: 'middle'
  10117. }, {
  10118. field: 'firstOrNot',
  10119. title: '初/复诊',
  10120. align: "center",
  10121. valign: 'middle',
  10122. formatter: function (value, row, index) {
  10123. if (value == '1') {
  10124. return "复诊";
  10125. }
  10126. return "初诊";
  10127. }
  10128. }
  10129. , {
  10130. field: 'visitDate',
  10131. title: '就诊时间',
  10132. align: "center",
  10133. valign: 'middle',
  10134. formatter: function (value, row, index) {
  10135. if (value == null || value == "") {
  10136. return "";
  10137. }
  10138. return format(value, "yyyy-MM-dd HH:mm:ss");
  10139. }
  10140. }
  10141. ],
  10142. responseHandler: function (res) {
  10143. if (res == '401' || res == 401) {
  10144. window.location.href = '/thmz/login/view'
  10145. return;
  10146. }
  10147. var ress = eval(res);
  10148. if (ress.code == -1) {
  10149. if (ress.message != null && ress.message != '') {
  10150. errorMesage(ress);
  10151. }
  10152. return {
  10153. "total": 0,//总页数
  10154. "rows": {} //数据
  10155. };
  10156. }
  10157. return {
  10158. "total": ress.total,//总页数
  10159. "rows": ress.data //数据
  10160. };
  10161. },
  10162. });
  10163. }
  10164. /**
  10165. * 构建列表查询参数
  10166. * @param params
  10167. * @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}}
  10168. */
  10169. function queryOtherParams(params) {
  10170. var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
  10171. patientId: $("#editPatientId").text(),
  10172. exceptTimes: $("#mzBlTimes").val(),
  10173. pageSize: params.limit, //页面大小
  10174. pageIndex: params.offset / params.limit, //页码
  10175. };
  10176. return temp;
  10177. }
  10178. /**
  10179. * 提取处理意见保存
  10180. */
  10181. function setOtherEmrProcess() {
  10182. $("#editMzBlRecordModal").modal("hide");
  10183. $("#messageModal").modal();
  10184. $("#messageContent").html("确定要执行此次提取处理意见操作吗?");
  10185. $("#messageButton").off("click").on("click", function (t) {
  10186. $("#messageModal").modal("hide");
  10187. $.ajax({
  10188. type: "GET",
  10189. url: '/thmz/extractEmrProcess?patientId=' + $("#editPatientId").html() + '&baseTimes=' + $("#baseMzBlTimes").val() + '&times=' + $("#mzBlTimes").val(),
  10190. contentType: "application/json;charset=UTF-8",
  10191. dataType: "json",
  10192. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10193. success: function (res) {
  10194. if (res == '401' || res == 401) {
  10195. window.location.href = '/thmz/login/view'
  10196. return;
  10197. }
  10198. if (res.code == 0) {
  10199. successMesage(res);
  10200. $("#editMzBlRecordModal").modal("hide");
  10201. } else {
  10202. errorMesage(res);
  10203. }
  10204. }
  10205. });
  10206. });
  10207. $("#cancelButton").off("click").on("click", function (t) {
  10208. $("#editMzBlRecordModal").modal();
  10209. });
  10210. }
  10211. /**
  10212. * 医保电子凭证读卡
  10213. */
  10214. function siReadCard() {
  10215. $.ajax({
  10216. type: "GET",
  10217. url: 'http://localhost:8321/readcard/entry?param=qrcode_01101',
  10218. contentType: "application/json;charset=UTF-8",
  10219. dataType: "json",
  10220. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10221. success: function (res) {
  10222. if (res == '401' || res == 401) {
  10223. window.location.href = '/thmz/login/view'
  10224. return;
  10225. }
  10226. //console.log(res);
  10227. if (res.code == 200) {
  10228. var data = JSON.parse(res.data);
  10229. queryUserInfoBySocialNoNotFillPatient('rapidAcceptsUserCardNo', "" + data.data.idNo + "", queryUserInfoByCardNo, 'rapidAcceptsModal');
  10230. } else {
  10231. errorMesage(res);
  10232. }
  10233. }
  10234. });
  10235. // window.open('ReadCard://'+prm, '_self')
  10236. }
  10237. /**
  10238. * 西药品类按钮点击事件 因为原插件有点未解决bug,点击title的时候,加载的列表非对应的,
  10239. * @param paneId
  10240. */
  10241. function xyTableOnClick(paneId) {
  10242. setTimeout(function () {
  10243. $("#xyTabContent div.tab-pane").each(function (index, obj) {
  10244. var targetId = $(obj).attr("id");
  10245. //如果处方内容是空的,就删除没有处方
  10246. if ($(obj).find("div.cf_content").children().length == 0) {
  10247. $(obj).remove();
  10248. $("[href='#" + targetId + "']").parent().remove();
  10249. } else if (targetId == paneId) {
  10250. $(obj).addClass("active").addClass("in");
  10251. } else {
  10252. $(obj).removeClass("active").removeClass("in");
  10253. }
  10254. });
  10255. }, 400);
  10256. }
  10257. /**
  10258. * 打开转诊弹层
  10259. */
  10260. function transferTreatment() {
  10261. $("#turnDept").selectpicker({
  10262. size: 5
  10263. });
  10264. $("#turnToConsultationTitle").html("转诊");
  10265. $("#opType").val(1);
  10266. $("#turnToConsultationDoctorDiv").removeClass("hide").addClass("in");
  10267. $("#turnDeptDiv").removeClass("hide").addClass("in");
  10268. $("#consultationDeptDiv").removeClass("in").addClass("hide");
  10269. //科室列表
  10270. $.ajax({
  10271. type: "GET",
  10272. url: '/thmz/getUnitCodeByRequestDay?ampm=',
  10273. dataType: "json",
  10274. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10275. success: function (data) {
  10276. if (data == '401' || data == 401) {
  10277. window.location.href = '/thmz/login/view'
  10278. return;
  10279. }
  10280. var html = '';
  10281. $.each(data.data, function (commentIndex, comment) {
  10282. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';
  10283. });
  10284. $('#turnDept').empty();
  10285. $('#turnDept').html(html);
  10286. $('#turnDept').selectpicker('refresh');
  10287. }
  10288. });
  10289. $("#turnToConsultationModal").modal();
  10290. }
  10291. /**
  10292. * 打开会诊弹层
  10293. */
  10294. function consultation() {
  10295. $("#consultationDept").selectpicker({
  10296. size: 5
  10297. });
  10298. $("#turnToConsultationTitle").html("发起会诊");
  10299. $("#opType").val(2);
  10300. $("#turnToConsultationDoctorDiv").removeClass("in").addClass("hide");
  10301. $("#consultationDeptDiv").removeClass("hide").addClass("in");
  10302. $("#turnDeptDiv").removeClass("in").addClass("hide");
  10303. //科室列表
  10304. $.ajax({
  10305. type: "GET",
  10306. url: '/thmz/allMzUnitCode',
  10307. dataType: "json",
  10308. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10309. success: function (res) {
  10310. if (res == '401' || res == 401) {
  10311. window.location.href = '/thmz/login/view'
  10312. return;
  10313. }
  10314. var html = '';
  10315. $.each(res.data, function (commentIndex, comment) {
  10316. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';
  10317. });
  10318. $('#consultationDept').empty();
  10319. $('#consultationDept').html(html);
  10320. $('#consultationDept').selectpicker('refresh');
  10321. $.ajax({
  10322. type: "GET",
  10323. url: '/thmz/getUnConsultation?serialNo=' + $("#mzfzSerialNoInClick").val(),
  10324. dataType: "json",
  10325. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10326. success: function (res) {
  10327. if (res == '401' || res == 401) {
  10328. window.location.href = '/thmz/login/view'
  10329. return;
  10330. }
  10331. var data = res.data;
  10332. if (data != null && data.length > 0) {
  10333. $('#consultationDept').selectpicker('val', data);
  10334. $('#consultationDept').selectpicker('refresh');
  10335. }
  10336. }
  10337. });
  10338. }
  10339. });
  10340. $("#turnToConsultationModal").modal();
  10341. }
  10342. /**
  10343. * 清空转诊和发起会诊区域
  10344. */
  10345. function clearTurnToConsultationInput() {
  10346. $("#turnDept").selectpicker('val', null);
  10347. $("#turnDept").selectpicker('refresh');
  10348. $("#consultationDept").selectpicker('val', null);
  10349. $("#consultationDept").selectpicker('refresh');
  10350. $("#turnToConsultationDoctor").selectpicker('val', null);
  10351. $("#turnToConsultationDoctor").selectpicker('refresh');
  10352. $("#turnToConsultationId").val(null);
  10353. $("#opType").val(null);
  10354. $("#turnToConsultationDoctorDiv").removeClass("in").addClass("hide");
  10355. $("#turnDeptDiv").removeClass("in").addClass("hide");
  10356. $("#consultationDeptDiv").removeClass("in").addClass("hide");
  10357. }
  10358. /**
  10359. * 清空门诊统筹支付参数区域
  10360. */
  10361. function clearZgtczfInput() {
  10362. $("#zgmztczfDiv").removeClass("in").addClass("hide");
  10363. $("#mztczfSiReadCard").removeClass("in").addClass("hide");
  10364. $("#grzhzfDiv").removeClass("in").addClass("hide");
  10365. $("#zgmztczf").selectpicker('val', null);
  10366. $("#zgmztczf").selectpicker('refresh');
  10367. $("#grzhzf").selectpicker('val', null);
  10368. $("#grzhzf").selectpicker('refresh');
  10369. $("#readCardResult").val(null);
  10370. }
  10371. /**
  10372. * 保存转诊/会诊
  10373. */
  10374. function setTurnToConsultation() {
  10375. $("#turnToConsultationModal").modal("hide");
  10376. $("#messageModal").modal();
  10377. var opType = $("#opType").val();
  10378. var targetDeptNo = $("#turnDept").val();
  10379. var title = "确认提交转诊操作吗,提交后您将无法继续接诊该患者?";
  10380. if (opType == 2 || opType == "2") {
  10381. title = "确认提交本次会诊操作吗?";
  10382. var consultationDept = $("#consultationDept").val();
  10383. if (consultationDept != null && consultationDept.length > 0) {
  10384. targetDeptNo = null;
  10385. for (var i = 0; i < consultationDept.length; i++) {
  10386. if (targetDeptNo == null) {
  10387. targetDeptNo = consultationDept[i];
  10388. } else {
  10389. targetDeptNo += "," + consultationDept[i];
  10390. }
  10391. }
  10392. }
  10393. }
  10394. $("#messageContent").html(title);
  10395. $("#messageButton").off("click").on("click", function (t) {
  10396. $("#messageModal").modal("hide");
  10397. $.ajax({
  10398. type: "POST",
  10399. url: '/thmz/saveTurnToConsultation',
  10400. contentType: "application/json;charset=UTF-8",
  10401. dataType: "json",
  10402. data: JSON.stringify({
  10403. "id": $("#turnToConsultationId").val(),
  10404. "opType": opType,
  10405. "targetDeptNo": targetDeptNo,
  10406. "targetDoctorNo": $("#turnToConsultationDoctor").val(),
  10407. "serialNo": $("#mzfzSerialNoInClick").val(),
  10408. "remark": $("#turnToConsultationRemark").val(),
  10409. }),
  10410. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10411. success: function (res) {
  10412. if (res == '401' || res == 401) {
  10413. window.location.href = '/thmz/login/view'
  10414. return;
  10415. }
  10416. if (res.code == 0) {
  10417. successMesage(res);
  10418. clearTurnToConsultationInput();
  10419. if (opType == 1 || opType == "1") {
  10420. //加载候诊患者列表
  10421. loadUnClinicTableList();
  10422. //加载接诊中患者列表
  10423. loadInClinicTableList();
  10424. clearWorkSpace();
  10425. }
  10426. } else {
  10427. $("#turnToConsultationModal").modal();
  10428. errorMesage(res);
  10429. }
  10430. }
  10431. });
  10432. });
  10433. $("#cancelButton").off("click");
  10434. }
  10435. /**
  10436. * 初始医生下拉选
  10437. * @param ampm 时间段区间
  10438. */
  10439. function initEmployee() {
  10440. var opType = $("#opType").val();
  10441. if (opType == 2) {
  10442. return;
  10443. }
  10444. $("#turnToConsultationDoctor").selectpicker({
  10445. size: 5
  10446. });
  10447. //医生列表
  10448. $.ajax({
  10449. type: "GET",
  10450. url: '/thmz/getDoctorCodeByRequestDay?unitCode=' + $('#turnDept').val() + "&ampm=&chargeType=",
  10451. dataType: "json",
  10452. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10453. success: function (res) {
  10454. if (res == '401' || res == 401) {
  10455. window.location.href = '/thmz/login/view'
  10456. return;
  10457. }
  10458. var html = '';
  10459. var defaultCode = null;
  10460. $.each(res.data, function (commentIndex, comment) {
  10461. var employeeName = comment.employee.employeeName;
  10462. if (comment.leftNum != null) {
  10463. employeeName = employeeName + " 余号(" + comment.leftNum + ")"
  10464. }
  10465. html += '<option value="' + comment.employee.employeeCode + '" data-chargeType="' + comment.chargeType + '" data-checkFee="' + comment.checkFee + '" data-mzyRequestId="' + comment.mzyRequestId + '">' + employeeName + '</option>';
  10466. if (res.data.length == 1) {
  10467. //如果只有一个号别,默认选中
  10468. defaultCode = comment.employee.employeeCode;
  10469. }
  10470. });
  10471. $('#turnToConsultationDoctor').empty();
  10472. $('#turnToConsultationDoctor').html(html);
  10473. $('#turnToConsultationDoctor').selectpicker('refresh');
  10474. if (defaultCode != null) {
  10475. //如果有无需选择医生的选项,默认选择
  10476. $('#turnToConsultationDoctor').selectpicker('val', defaultCode);
  10477. $('#turnToConsultationDoctor').selectpicker('refresh');
  10478. }
  10479. }
  10480. });
  10481. }
  10482. /**
  10483. * 选择门诊统筹支付时校验门诊诊断是否是标准诊断,校验医生是否具有医保编码
  10484. */
  10485. function verifyInsuranceInfo() {
  10486. var zgmztczf = $("#zgmztczf").val();
  10487. if (zgmztczf != null && zgmztczf == 1 || zgmztczf == "1") {
  10488. var diagnoseValue = $("#diagnoseValue").val();
  10489. if (diagnoseValue == null || diagnoseValue == "" || diagnoseValue.length == 0) {
  10490. errorMesageSimaple("门诊统筹就诊必须使用标准的医保诊断,请修改诊断");
  10491. $("#zgmztczf").selectpicker('val', null);
  10492. $("#zgmztczf").selectpicker('refresh');
  10493. return;
  10494. }
  10495. diagnoseValue = diagnoseValue.replace(/,/g, "");
  10496. if (diagnoseValue == null || diagnoseValue == "" || diagnoseValue.length == 0) {
  10497. errorMesageSimaple("门诊统筹就诊必须使用标准的医保诊断,请修改诊断");
  10498. $("#zgmztczf").selectpicker('val', null);
  10499. $("#zgmztczf").selectpicker('refresh');
  10500. return;
  10501. }
  10502. var ybCode = localStorage.getItem("ybCode");
  10503. if (ybCode == null || ybCode == "" || ybCode.length == 0) {
  10504. errorMesageSimaple("您还没有医保赋码,无法进行门诊统筹接诊");
  10505. $("#zgmztczf").selectpicker('val', null);
  10506. $("#zgmztczf").selectpicker('refresh');
  10507. return;
  10508. }
  10509. }
  10510. }
  10511. /**
  10512. * 已诊列表发起会诊
  10513. * @param patientId
  10514. */
  10515. function consultationCliniced(patientId) {
  10516. $.ajax({
  10517. type: "GET",
  10518. url: '/thmz/getLastClinicedFzOrder?patientId=' + patientId,
  10519. dataType: "json",
  10520. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10521. success: function (res) {
  10522. if (res == '401' || res == 401) {
  10523. window.location.href = '/thmz/login/view'
  10524. return;
  10525. }
  10526. if (res.code == 0) {
  10527. $("#visitingDetailModal").modal("hide");
  10528. $("#mzfzSerialNoInClick").val(res.data.serialNo);
  10529. consultation();
  10530. } else {
  10531. errorMesage(res);
  10532. }
  10533. }
  10534. });
  10535. }