clinic.js 536 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495
  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. //处方回调和修改的时候处方号与处方tab的关系
  22. var orderNoAndTableIdMap = null;
  23. //处方回调和修改的时候处方tab与处方号的关系
  24. var tableIdAndOrderNoMap = null;
  25. //合理用药查询审核结果url
  26. var getResultUrl = null;
  27. //定时器
  28. var timer;
  29. $(function () {
  30. initGenderSelect();
  31. iniAdmissStatus();
  32. initListDeptSelect();
  33. //initTryResultSelect();
  34. initResponceTypeSelect();
  35. initTemplateTypeSelect("templateType");
  36. initTemplateKindTypeSelect('templateKindType');
  37. initZyClassTypeSelect();
  38. initInstructionSelect();
  39. setSelectSize();
  40. initCertificateTypeSelect();
  41. initMztcSelect();
  42. $('#editUserBirthDayGroup').datetimepicker({
  43. format: 'yyyy-mm-dd',
  44. language: 'zh-CN',
  45. minView: "month",
  46. });
  47. initDaterangepickerWithId('reportrange', "right");
  48. formatCheck();
  49. //数据校验
  50. init_validator();
  51. //初始频次下拉选
  52. initOrderFrequencys("orderFrequency", true);
  53. //初始频次下拉选
  54. initOrderFrequencys("orderFrequencyZl", true);
  55. //初始用药方式下拉选
  56. initSupplyTypes();
  57. //加载候诊患者列表
  58. loadUnClinicTableList();
  59. //加载接诊中患者列表
  60. loadInClinicTableList();
  61. //加载已接诊患者列表
  62. loadClinicTableList();
  63. //每隔一分钟秒读加载候诊患者列表
  64. refreshList();
  65. // setInterval(function () {
  66. // //加载候诊患者列表
  67. // loadUnClinicTableList();
  68. // //加载已接诊患者列表 病人会缴费,需要刷新状态
  69. // loadClinicTableList();
  70. // }, 60000);
  71. //初始化快速接诊病人姓名栏事件
  72. initUserList();
  73. //初始化主诉弹出层
  74. initRecommendList();
  75. //卡号输入改变事件
  76. cardNoChange();
  77. //初始化省份
  78. initProvince(3);
  79. /**
  80. * 患者信息修改
  81. */
  82. $("#saveEditUser").on("click", function (t) {
  83. modifyPatient();
  84. });
  85. // /**
  86. // * 保存入院证
  87. // */
  88. // $("#saveBeHospitalized").on("click", function (t) {
  89. // saveBeHospitalized();
  90. // });
  91. /**
  92. * 打印入院证
  93. */
  94. $("#printBeHospitalized").on("click", function (t) {
  95. modifyPatient();
  96. });
  97. //折叠按钮初始化
  98. $('.collapse-link').on('click', function () {
  99. var $BOX_PANEL = $(this).closest('.x_panel_mine'),
  100. $ICON = $(this).find('i'),
  101. $BOX_CONTENT = $BOX_PANEL.find('.x_content');
  102. // fix for some div with hardcoded fix class
  103. if ($BOX_PANEL.attr('style')) {
  104. $BOX_CONTENT.slideToggle(200, function () {
  105. $BOX_PANEL.removeAttr('style');
  106. });
  107. } else {
  108. $BOX_CONTENT.slideToggle(200);
  109. $BOX_PANEL.css('height', 'auto');
  110. }
  111. $ICON.toggleClass('fa-chevron-up fa-chevron-down');
  112. });
  113. /**
  114. * 接诊
  115. */
  116. $("#clinicalReception").on("click", function (t) {
  117. var patientIdDb = $("#patientIdDb").val();
  118. if (patientIdDb == null || patientIdDb == "") {
  119. errorMesageSimaple("当前未选择病人,无法接诊");
  120. return;
  121. }
  122. $.ajax({
  123. type: "GET",
  124. url: '/thmz/getMzfzPatientOrderByPatientId?patientId=' + patientIdDb,
  125. contentType: "application/json;charset=UTF-8",
  126. dataType: "json",
  127. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  128. success: function (res) {
  129. if (res == '401' || res == 401) {
  130. window.location.href = '/thmz/login/view'
  131. return;
  132. }
  133. if (res.code == 0) {
  134. if (res.data != null && res.data.length > 0) {
  135. if (res.data.length == 1) {
  136. $("#turnToConsultationIdInClick").val(res.data[0].turnToConsultationId);
  137. clinicalReception(patientIdDb, res.data[0].serialNo, res.data[0].reqType);
  138. } else {
  139. $("#mzfzPatientOrderModal").modal();
  140. $("#mzfzPatientOrderTable").html(null);
  141. for (var i = 0; i < res.data.length; i++) {
  142. var roomCode = res.data[i].roomCode;
  143. if (roomCode == null || roomCode == "null") {
  144. roomCode = "";
  145. }
  146. var doctorCode = (res.data[i].doctorCode == null || res.data[i].doctorCode == 'null') ? '' : res.data[i].doctorCode;
  147. $("<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 () {
  148. $("#mzfzPatientOrderModal").modal("hide");
  149. $("#turnToConsultationIdInClick").val($(this).attr("data-target-turnToConsultationId"));
  150. clinicalReception(patientIdDb, $(this).attr("data-target"), $(this).attr("data-target-reqType"));
  151. });
  152. }
  153. }
  154. clearRapidAcceptsModal();
  155. $("#rapidAcceptsModal").modal("hide");
  156. } else {
  157. errorMesageSimaple("当前病人没有分诊信息");
  158. }
  159. } else if (res.code == 200) {
  160. clearRapidAcceptsModal();
  161. $("#rapidAcceptsModal").modal("hide");
  162. clinicalReception(patientIdDb, null, null);
  163. } else {
  164. errorMesage(res);
  165. }
  166. }
  167. });
  168. });
  169. /**
  170. * 存为范本
  171. */
  172. $("#saveapidAccepts").on("click", function (t) {
  173. //关闭帮助框
  174. $("#treeButton").webuiPopover('hide');
  175. $("#western_medicine_name").webuiPopover('hide');
  176. $("#chinese_medicine_name").webuiPopover('hide');
  177. $("#jcJyItem").webuiPopover('hide');
  178. $("#zlItem").webuiPopover('hide');
  179. $("#saveapidAcceptsModal").modal("show");
  180. });
  181. /**
  182. * 实例化智能问诊弹窗
  183. */
  184. // $("[data-toggle='popover']").popover();
  185. $("#box-arrow-left").popover({
  186. html: 'true',
  187. content: '<div id="smartAssistPopoverContent"></div>'
  188. });
  189. //初始化药品分组下拉选
  190. initGroupOrder();
  191. // 初始化用药天数下拉选
  192. initDayNum();
  193. //页面加载完成初始化西药处方
  194. //initNavTabs(0);
  195. //页面加载完成初始化住院处方
  196. //initNavTabs(3);
  197. //初始医生工作太配置
  198. initWorkspaceConfigForCurrent();
  199. initExecUnit();
  200. /**
  201. * 西药点击事件
  202. */
  203. $("#western_medicine_name").on("click", function (t) {
  204. var obj = $("#westernMedicinePopoverContent").parent().parent().parent();
  205. if ($(obj).hasClass("in") || $(obj).css("display") == "block") {
  206. $('#western_medicine_name').webuiPopover('hide');
  207. $("#treeButton").webuiPopover('hide');
  208. return;
  209. }
  210. $('#western_medicine_name').webuiPopover('show');
  211. loadYpList(0, null);
  212. });
  213. /**
  214. * 中药点击事件
  215. */
  216. $("#chinese_medicine_name").on("click", function (t) {
  217. var obj = $("#chineseMedicinePopoverContent").parent().parent().parent();
  218. if ($(obj).hasClass("in") || $(obj).css("display") == "block") {
  219. $('#chinese_medicine_name').webuiPopover('hide');
  220. $("#treeButton").webuiPopover('hide');
  221. return;
  222. }
  223. $('#chinese_medicine_name').webuiPopover('show');
  224. loadYpList(1, null);
  225. });
  226. /**
  227. * 辅助检查、检验点击事件
  228. */
  229. $("#jcJyItem").on("click", function (t) {
  230. var obj = $("#jcJyItemPopoverContent").parent().parent().parent();
  231. if ($(obj).hasClass("in") || $(obj).css("display") == "block") {
  232. $('#jcJyItem').webuiPopover('hide');
  233. $("#treeButton").webuiPopover('hide');
  234. return;
  235. }
  236. $('#jcJyItem').webuiPopover('show');
  237. loadjcJyItemList(null);
  238. });
  239. /**
  240. * 诊疗点击事件
  241. */
  242. $("#zlItem").on("click", function (t) {
  243. var obj = $("#zlItemPopoverContent").parent().parent().parent();
  244. if ($(obj).hasClass("in") || $(obj).css("display") == "block") {
  245. $('#zlItem').webuiPopover('hide');
  246. $("#treeButton").webuiPopover('hide');
  247. return;
  248. }
  249. $('#zlItem').webuiPopover('show');
  250. loadZlItemList(null);
  251. });
  252. initYshPart();
  253. initJyZdSample();
  254. initClinicDeptNo();
  255. setTimeout(function () {
  256. getLodop();
  257. }, 800);
  258. //键盘监听回车键
  259. $(document).unbind("keyup").keyup(function (event) {
  260. var index = getIndex("bill_item_group");
  261. if (event.keyCode == 13) { //是否是回车
  262. var el = event.srcElement || event.target;
  263. var id = el.getAttribute("id");
  264. var current_code = null;
  265. if (index == 0) {
  266. current_code = $("#western_medicine_current_code").val();
  267. } else if (index == 1) {
  268. current_code = $("#chinese_medicine_current_code").val();
  269. } else if (index == 2) {
  270. current_code = $("#jcjy_current_code").val();
  271. } else if (index == 3) {
  272. current_code = $("#zl_current_code").val();
  273. }
  274. if (id == null || id == "") {
  275. id = el.getAttribute("data-id");
  276. }
  277. if (id == null || id == "") {
  278. var search = el.getAttribute("aria-label");
  279. if (search == "Search") {
  280. id = $(el).parent().parent().prev().attr("data-id");
  281. }
  282. }
  283. if (id != null && id != "") {
  284. //将当前点击的id记录下
  285. //prevEleId = id;
  286. } else if (prevEleId != null) {
  287. id = prevEleId;
  288. }
  289. //回车时,光标不在任何区域判断是不是在药品和诊疗开立区域
  290. if (id == null || id == "") {
  291. var index = getIndex("bill_item_group");
  292. if (index == 0) {
  293. if (current_code != null && current_code != "") {
  294. //当前页面是西药保存页面,且有药品选中
  295. $("#supplyType").next().click();
  296. }
  297. } else if (index == 1) {
  298. //当前页面是中草药保存页面,且有药品选中
  299. } else if (index == 2) {
  300. if (current_code != null && current_code != "") {
  301. //当前页面是医技保存页面,且有选中
  302. if ($("#jyZdSampleDiv").hasClass('in')) {
  303. //此时是检验
  304. $("#jyZdSample").next().click();
  305. } else if ($("#yshPartDiv").hasClass('in')) {
  306. //说明现在是检查
  307. $("#yshPart").next().click();
  308. }
  309. }
  310. } else if (index == 3) {
  311. //诊疗
  312. $("#yshPart").next().click();
  313. return;
  314. } else if (index == 4) {
  315. //当前页面是住院保存页面
  316. $("#inpatientWardBeHospitalized").next().click();
  317. return;
  318. }
  319. }
  320. var customization = $("div.customization").not(".hide");
  321. // //回车时,光标不在任何区域,默认点击主诉
  322. // if (id == null || id == "") {
  323. // var eleId = $(customization[0]).attr("target-id");
  324. // $("#" + eleId).focus();
  325. // if (eleId == 'symptom') {
  326. // $("#" + eleId).click();
  327. // }
  328. // console.log("eleId=" + eleId);
  329. // } else
  330. if (id == 'symptom' || id == 'emrHpi' || id == 'emrPs' || id == 'personalHistory' || id == 'familyHistory' || id == 'obstericalHistory' || id == 'otherCheck' || id == 'diagnose' || id == 'tentativeDiagnosis') {
  331. console.log("1id=" + id);
  332. if (id != $(customization[customization.length - 1]).attr("target-id")) {
  333. var next = $("#" + id + "Flag").next();
  334. while ($(next).hasClass("foreclose") || $(next).hasClass("hide")) {
  335. next = $(next).next();
  336. }
  337. var eleId = $(next).attr("target-id");
  338. $("#" + eleId).focus();
  339. if (eleId == 'diagnose' || id == 'diagnose' || id == 'symptom') {
  340. $("#" + eleId).click();
  341. }
  342. console.log("1eleId=" + eleId);
  343. } else {
  344. var data_target = $("#symptom").attr("data-target");
  345. $("#" + data_target).find("a.close").click();
  346. data_target = $("#diagnose").attr("data-target");
  347. $("#" + data_target).find("a.close").click();
  348. if (index == 0) {
  349. $("#western_medicine_name").focus();
  350. } else if (index == 1) {
  351. $("#chinese_medicine_name").focus();
  352. } else if (index == 2) {
  353. $("#jcJyItem").focus();
  354. } else if (index == 3) {
  355. $("#zlItem").focus();
  356. } else if (index == 4) {
  357. $("#inpatientWardBeHospitalized").next().click();
  358. }
  359. }
  360. } else if (id == 'zy_drugWin') {
  361. $("#zyInstruction").next().click();
  362. } else if (id == 'zyInstruction') {
  363. var ariaExpanded = $("#zyInstruction").next().attr("aria-expanded");
  364. if (ariaExpanded == true || ariaExpanded == "true") {
  365. $("#zyInstruction").next().click();
  366. }
  367. $("#saveChineseMedicine").click();
  368. $("#chinese_medicine_name").focus();
  369. $("#chinese_medicine_name").click();
  370. }
  371. else if (id == 'cyJssm') {
  372. $("#cyJsl").focus();
  373. } else if (id == 'cyJsl') {
  374. $("#cyZql").focus();
  375. } else if (id == 'cyZql') {
  376. $("#cyFj").focus();
  377. } else if (id == 'cyFj') {
  378. $("#cyFfcs").focus();
  379. } else if (id == 'cyFj') {
  380. $("#cyFfcs").focus();
  381. } else if (id == 'cyFfcs') {
  382. $("#useType_1").next().click();
  383. } else if (id == 'useType_1') {
  384. $("#cyMtjs").focus();
  385. } else if (id == 'cyMtjs') {
  386. $("#zyfs").focus();
  387. } else if (id == 'zyfs') {
  388. $("#zy_supplyType_1").next().click();
  389. } else if (id == 'supplyType') {
  390. $("#drugWinUnit").next().click();
  391. } else if (id == 'drugWinUnit') {
  392. $("#drugWin").focus();
  393. } else if (id == 'drugWin') {
  394. $("#dayNum").next().click();
  395. } else if (id == 'dayNum') {
  396. $("#orderFrequency").next().click();
  397. } else if (id == 'orderFrequency') {
  398. $("#gross").focus();
  399. } else if (id == 'gross') {
  400. $("#packUnit").next().click();
  401. } else if (id == 'packUnit') {
  402. $("#medicalAdvice").next().click();
  403. } else if (id == 'medicalAdvice') {
  404. var ariaExpanded = $("#medicalAdvice").next().attr("aria-expanded");
  405. if (ariaExpanded == true || ariaExpanded == "true") {
  406. $("#medicalAdvice").next().click();
  407. }
  408. saveMedicine(0);
  409. $("#western_medicine_name").focus();
  410. } else if (id == 'saveWesternMedicine') {
  411. $("#western_medicine_name").focus();
  412. $("#western_medicine_name").click();
  413. } else if (id == 'jyZdSample' || id == 'yshPart') {
  414. $("#execUnit").next().click();
  415. } else if (id == 'execUnit') {
  416. var ariaExpanded = $("#execUnit").next().attr("aria-expanded");
  417. if (ariaExpanded == true || ariaExpanded == "true") {
  418. $("#execUnit").next().click();
  419. }
  420. $("#remark").focus();
  421. } else if (id == 'remark') {
  422. saveJyJcItem(true);
  423. $("#jcJyItem").focus();
  424. } else if (id == 'chargeUnit') {
  425. $("#itemQuantity").focus();
  426. } else if (id == 'itemQuantity') {
  427. $("#dayZlNum").next().click();
  428. } else if (id == 'dayZlNum') {
  429. var ariaExpanded = $("#dayZlNum").next().attr("aria-expanded");
  430. if (ariaExpanded == true || ariaExpanded == "true") {
  431. $("#dayZlNum").next().click();
  432. }
  433. $("#orderFrequencyZl").next().click();
  434. } else if (id == 'orderFrequencyZl') {
  435. var ariaExpanded = $("#orderFrequencyZl").next().attr("aria-expanded");
  436. if (ariaExpanded == true || ariaExpanded == "true") {
  437. $("#orderFrequencyZl").next().click();
  438. }
  439. $("#totalNumZl").focus();
  440. } else if (id == 'totalNumZl') {
  441. $("#zlExecUnit").next().click();
  442. } else if (id == 'zlExecUnit') {
  443. var ariaExpanded = $("#zlExecUnit").next().attr("aria-expanded");
  444. if (ariaExpanded == true || ariaExpanded == "true") {
  445. $("#zlExecUnit").next().click();
  446. }
  447. $("#zlRemark").focus();
  448. } else if (id == 'zlRemark') {
  449. saveZlItem(true);
  450. $("#zlItem").focus();
  451. } else if (id == 'inpatientWardBeHospitalized') {
  452. $("#smallWardBeHospitalized").next().click();
  453. } else if (id == 'smallWardBeHospitalized') {
  454. $("#conditionCode").next().click();
  455. } else if (id == 'conditionCode') {
  456. $("#routeOfAdmission").next().click();
  457. } else if (id == 'routeOfAdmission') {
  458. $("#admissStatus").next().click();
  459. } else if (id == 'admissStatus') {
  460. saveZyReq(true);
  461. $("#zy_req_button").focus();
  462. } else if (id == 'western_medicine_name') {
  463. var webuiID = $("#western_medicine_name").attr("data-target");
  464. if (webuiID == null || webuiID == "null" || webuiID == "") {
  465. //药品查询框是空白的,打开查询框
  466. $("#western_medicine_name").click();
  467. return;
  468. }
  469. //选择框打开
  470. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  471. var arr = $("#tb_table_western_medicine").find("tbody").find("tr.trhover");
  472. if (arr != undefined && arr != null && arr.length > 0) {
  473. var dataIndex = $(arr).attr("data-index");
  474. var tableData = $("#tb_table_western_medicine").bootstrapTable('getData');
  475. if (tableData != null && tableData.length > 0 && dataIndex != null) {
  476. var trData = tableData[dataIndex];
  477. checkYpInfo(trData.code, trData.serial, trData.ypType, true, null, 3);
  478. $("#western_medicine_name").click();
  479. }
  480. } else {
  481. //药品查询框是空白的,打开查询框
  482. $("#western_medicine_name").click();
  483. }
  484. } else {
  485. if (current_code != null && current_code != "") {
  486. //已经选中药品,跳到用法
  487. $("#supplyType").next().click();
  488. } else {
  489. //药品查询框是空白的,打开查询框
  490. $("#western_medicine_name").click();
  491. }
  492. }
  493. } else if (id == 'chinese_medicine_name') {
  494. var webuiID = $("#chinese_medicine_name").attr("data-target");
  495. if (webuiID == null || webuiID == "null" || webuiID == "") {
  496. $("#chinese_medicine_name").click();
  497. return;
  498. }
  499. //选择框打开
  500. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  501. var arr = $("#tb_table_chinese_medicine").find("tbody").find("tr.trhover");
  502. if (arr != undefined && arr != null && arr.length > 0) {
  503. var dataIndex = $(arr).attr("data-index");
  504. var tableData = $("#tb_table_chinese_medicine").bootstrapTable('getData');
  505. if (tableData != null && tableData.length > 0 && dataIndex != null) {
  506. var trData = tableData[dataIndex];
  507. checkZyInfo(trData.code, trData.serial, $("#zyClassType").val(), true);
  508. $("#chinese_medicine_name").click();
  509. }
  510. } else {
  511. //药品查询框是空白的,打开查询框
  512. $("#chinese_medicine_name").click();
  513. }
  514. } else {
  515. if (current_code != null && current_code != "") {
  516. //已经选中药品,跳到剂量
  517. $("#zy_drugWin").next().click();
  518. } else {
  519. //药品查询框是空白的,打开查询框
  520. $("#chinese_medicine_name").click();
  521. }
  522. }
  523. } else if (id == 'jcJyItem') {
  524. var webuiID = $("#jcJyItem").attr("data-target");
  525. if (webuiID == null || webuiID == "null" || webuiID == "") {
  526. $("#jcJyItem").click();
  527. return;
  528. }
  529. //选择框打开
  530. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  531. var arr = $("#tb_table_jc_jy_item").find("tbody").find("tr.trhover");
  532. if (arr != undefined && arr != null && arr.length > 0) {
  533. var dataIndex = $(arr).attr("data-index");
  534. var tableData = $("#tb_table_jc_jy_item").bootstrapTable('getData');
  535. if (tableData != null && tableData.length > 0 && dataIndex != null) {
  536. var trData = tableData[dataIndex];
  537. $('#jcJyItem').webuiPopover('hide');
  538. $("#jcJyZltype").val(trData.type);
  539. $("#execUnit").selectpicker('val', trData.execUnit);//默认不选中
  540. $("#execUnit").selectpicker('refresh');
  541. if (trData.type == 1) {
  542. //检验
  543. $("#jyZdSampleDiv").removeClass("hide").addClass("in");
  544. $("#chargeUnitDiv").removeClass("in").addClass("hide");
  545. $("#yshPartDiv").removeClass("in").addClass("hide");
  546. if (trData.sampleCode != null && trData.sampleCode != "") {
  547. $("#jyZdSample").selectpicker('val', trData.sampleCode);
  548. $('#jyZdSample').selectpicker('refresh');
  549. }
  550. } else if (trData.type == 2) {
  551. //检查
  552. $("#yshPartDiv").removeClass("hide").addClass("in");
  553. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  554. $("#chargeUnitDiv").removeClass("in").addClass("hide");
  555. if (trData.bwCode != null && trData.bwCode != "") {
  556. $("#yshPart").selectpicker('val', trData.bwCode);
  557. $('#yshPart').selectpicker('refresh');
  558. }
  559. }
  560. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  561. checkJcJyItemInfo(trData.code, trData.name, trData.type, true);
  562. }
  563. } else {
  564. //药品查询框是空白的,打开查询框
  565. $("#jcJyItem").click();
  566. }
  567. } else {
  568. if (current_code != null && current_code != "") {
  569. //如果是保存失败的,重新打开输入框查询
  570. if (prevEleId == 'remark') {
  571. $("#jcJyItem").click();
  572. } else {
  573. //当前页面是医技保存页面,且有选中
  574. if ($("#jyZdSampleDiv").hasClass('in')) {
  575. //此时是检验
  576. $("#jyZdSample").next().click();
  577. } else if ($("#yshPartDiv").hasClass('in')) {
  578. //说明现在是检查
  579. $("#yshPart").next().click();
  580. }
  581. }
  582. } else {
  583. //药品查询框是空白的,打开查询框
  584. $("#jcJyItem").click();
  585. }
  586. }
  587. } else if (id == 'zlItem') {
  588. var webuiID = $("#zlItem").attr("data-target");
  589. if (webuiID == null || webuiID == "null" || webuiID == "") {
  590. $("#zlItem").click();
  591. return;
  592. }
  593. //选择框打开
  594. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  595. var arr = $("#tb_table_zl_item").find("tbody").find("tr.trhover");
  596. if (arr != undefined && arr != null && arr.length > 0) {
  597. var dataIndex = $(arr).attr("data-index");
  598. var tableData = $("#tb_table_zl_item").bootstrapTable('getData');
  599. if (tableData != null && tableData.length > 0 && dataIndex != null) {
  600. var trData = tableData[dataIndex];
  601. $('#zlItem').webuiPopover('hide');
  602. $("#zlExecUnit").selectpicker('val', trData.execUnit);//默认不选中
  603. $("#zlExecUnit").selectpicker('refresh');
  604. //诊疗
  605. if ($("#zlTab").find("li") == null || $("#zlTab").find("li").length == 0) {
  606. initNavTabs(3, null, null);
  607. }
  608. $("#zlItem").val(trData.name);
  609. $("#zlItem").blur();
  610. $("#zlItemPrice").val(trData.chargeAmount);
  611. $("#chargeUnit").val(trData.specification);
  612. $("#zl_current_code").val(trData.code);
  613. $("#itemQuantity").val(1);
  614. $("#chargeUnit").focus();
  615. }
  616. } else {
  617. //药品查询框是空白的,打开查询框
  618. $("#zlItem").click();
  619. }
  620. } else {
  621. if (current_code != null && current_code != "") {
  622. //如果是保存失败的,重新打开输入框查询
  623. if (prevEleId == 'zlRemark') {
  624. $("#zlItem").click();
  625. } else {
  626. $("#chargeUnit").focus();
  627. }
  628. } else {
  629. //药品查询框是空白的,打开查询框
  630. $("#zlItem").click();
  631. }
  632. }
  633. } else if (id == 'zy_req_button') {
  634. //当前页面是住院保存页面,此时光标在入院按钮上
  635. console.log("入院按钮")
  636. $("#inpatientWardBeHospitalized").next().click();
  637. }
  638. if (id != null && id != "") {
  639. //将当前点击的id记录下
  640. prevEleId = id;
  641. }
  642. } else if (event.keyCode == 37) {
  643. // //左键事件
  644. // if(index==0){
  645. // return;
  646. // }
  647. // var prevObject=$("#bill_item_group").find("button")[index-1];
  648. // $(prevObject).click();
  649. } else if (event.keyCode == 38) {
  650. //上键事件
  651. var tableId = null;
  652. var inputId = null;
  653. var contentId = null;
  654. if (index == 0) {
  655. tableId = "tb_table_western_medicine";
  656. inputId = "western_medicine_name";
  657. contentId = "westernMedicinePopoverContent";
  658. } else if (index == 1) {
  659. tableId = "tb_table_chinese_medicine";
  660. inputId = "chinese_medicine_name";
  661. contentId = "chineseMedicinePopoverContent";
  662. } else if (index == 2) {
  663. tableId = "tb_table_jc_jy_item";
  664. inputId = "jcJyItem";
  665. contentId = "jcJyItemPopoverContent";
  666. } else if (index == 3) {
  667. tableId = "tb_table_zl_item";
  668. inputId = "zlItem";
  669. contentId = "zlItemPopoverContent";
  670. }
  671. if (inputId == null) {
  672. return;
  673. }
  674. var webuiID = $("#" + inputId).attr("data-target");
  675. if (webuiID == null || webuiID == "null" || webuiID == "") {
  676. return;
  677. }
  678. //选择框打开
  679. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  680. var arr = $("#" + tableId).find("tbody").find("tr.trhover");
  681. var prev = $(arr).prev();
  682. if (arr != undefined && arr != null && arr.length > 0) {
  683. if (prev != undefined && prev != null && prev.length > 0) {
  684. $(arr).removeClass("trhover");
  685. $(prev).addClass("trhover");
  686. var height = $(arr).css("height");
  687. $("#" + contentId).parent().animate({scrollTop: "-=" + height}, 100);
  688. }
  689. } else {
  690. var arrs = $("#" + tableId).find("tbody").find("tr");
  691. $(arrs[0]).addClass("trhover");
  692. var height = $(arrs[0]).css("height");
  693. $("#" + contentId).parent().animate({scrollTop: "+=" + height}, 100);
  694. }
  695. }
  696. } else if (event.keyCode == 39) {
  697. // //右键事件
  698. // if(index==4){
  699. // return;
  700. // }
  701. // var nextObject=$("#bill_item_group").find("button")[index+1];
  702. // $(nextObject).click();
  703. } else if (event.keyCode == 40) {
  704. //下键事件
  705. var tableId = null;
  706. var inputId = null;
  707. var contentId = null;
  708. if (index == 0) {
  709. tableId = "tb_table_western_medicine";
  710. inputId = "western_medicine_name";
  711. contentId = "westernMedicinePopoverContent";
  712. } else if (index == 1) {
  713. tableId = "tb_table_chinese_medicine";
  714. inputId = "chinese_medicine_name";
  715. contentId = "chineseMedicinePopoverContent";
  716. } else if (index == 2) {
  717. tableId = "tb_table_jc_jy_item";
  718. inputId = "jcJyItem";
  719. contentId = "jcJyItemPopoverContent";
  720. } else if (index == 3) {
  721. tableId = "tb_table_zl_item";
  722. inputId = "zlItem";
  723. contentId = "zlItemPopoverContent";
  724. }
  725. if (inputId == null) {
  726. return;
  727. }
  728. var webuiID = $("#" + inputId).attr("data-target");
  729. if (webuiID == null || webuiID == "null" || webuiID == "") {
  730. return;
  731. }
  732. //选择框打开
  733. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  734. var arr = $("#" + tableId).find("tbody").find("tr.trhover");
  735. var next = $(arr).next();
  736. if (arr != undefined && arr != null && arr.length > 0) {
  737. if (next != undefined && next != null && next.length > 0) {
  738. $(arr).removeClass("trhover");
  739. $(next).addClass("trhover");
  740. var height = $(arr).css("height");
  741. $("#" + contentId).parent().animate({scrollTop: "+=" + height}, 100);
  742. }
  743. } else {
  744. var arrs = $("#" + tableId).find("tbody").find("tr");
  745. $(arrs[0]).addClass("trhover");
  746. var height = $(arrs[0]).css("height");
  747. $("#" + contentId).parent().animate({scrollTop: "+=" + height}, 100);
  748. }
  749. }
  750. }
  751. });
  752. //打印检查检验报告单
  753. $('#btn_print').click(function () {
  754. printJyJcReport(1);
  755. });
  756. //打印设置检查检验报告单
  757. $('#btn_print_setup').click(function () {
  758. printJyJcReport(2);
  759. });
  760. /**
  761. * 医保电子凭证读卡
  762. */
  763. $("#siReadCard").on("click", function (t) {
  764. siReadCard();
  765. });
  766. /**
  767. * 门诊统筹支付医额外内容弹窗
  768. */
  769. $("#expContentRequired").on("click", function (t) {
  770. expContentRequiredModal();
  771. });
  772. /**
  773. * 门诊统筹支付医保电子凭证读卡
  774. */
  775. $("#mztczfSiReadCard").on("click", function (t) {
  776. mztczfSiReadCard(true);
  777. });
  778. /**
  779. * 快速接诊页面 -未挂号患者信息查询处编辑患者信息
  780. */
  781. $("#rapidAcceptsEditUser").on("click", function (t) {
  782. editUserModal($("#rapidAcceptsUserCode").val(), 2);
  783. });
  784. //监听滚动停止处理逻辑开始
  785. let t1 = 0;
  786. let t2 = 0;
  787. let timer = null; // 定时器
  788. $("#scroll-wrap").on("scroll", function () {
  789. // 滚动
  790. clearTimeout(timer)
  791. timer = setTimeout(isScrollEnd, 100)
  792. t1 = $("#scroll-wrap").scrollTop();
  793. })
  794. function isScrollEnd() {
  795. t2 = $("#scroll-wrap").scrollTop();
  796. if (t2 == t1) {
  797. clearTimeout(timer)
  798. closeObjectWebui(true);
  799. console.log("滚动停止", t2) // 这里处理
  800. }
  801. }
  802. //监听滚动停止处理逻辑结束
  803. //合理用药预警系统(医药学知识查询助手)
  804. $("#hlyyButton").on("click", function (t) {
  805. $("#hlyyTitle").html("合理用药预警系统(医药学知识查询助手)");
  806. showHlyyModel('hlyysmsDiv', 'hlyysmsLoading', 'hlyysmsModal', "http://172.16.32.121:9097/index.html#");
  807. });
  808. //预约挂号日期控件注册
  809. $('#registrationTime').datetimepicker({
  810. language: 'zh-CN',
  811. //format: 'yyyy-mm-dd hh:ii:ss'
  812. format: 'yyyy-mm-dd',
  813. // showHour:false,
  814. // showMinute:false,
  815. // showSecond:false,
  816. // timeText:"",
  817. // timeFormat:"",
  818. minView:"month",
  819. autoclose: true,//选中自动关闭
  820. });
  821. //初始化号段下拉选
  822. initMzWorkTime();
  823. });
  824. /**
  825. * 刷新列表,解决越来越快的问题
  826. */
  827. function refreshList() {
  828. //clearInterval要放在方法开始,不然的话,下面的代码还没运行到clearInterval,又开始了循环了。
  829. clearInterval(timer);
  830. //加载候诊患者列表
  831. loadUnClinicTableList();
  832. //加载已接诊患者列表 病人会缴费,需要刷新状态
  833. loadClinicTableList();
  834. timer = setInterval(()=>{
  835. refreshList()
  836. },60000);
  837. }
  838. /**
  839. * 门诊统筹额外内容
  840. */
  841. function expContentRequiredModal() {
  842. $("#expContentRequiredModal").modal("show");
  843. }
  844. /**
  845. * 打开科室选择页面
  846. */
  847. function selectDeptModal() {
  848. $("#selectDeptModal").modal("show");
  849. }
  850. /**
  851. * 打开配置页面
  852. */
  853. function configWorkspaceModal() {
  854. initWorkspaceConfigForCurrent();
  855. $("#configWorkspaceModal").modal("show");
  856. }
  857. /**
  858. * 初始化用药天数下拉选
  859. */
  860. function initDayNum() {
  861. var html = '';
  862. for (var i = 1; i <= 112; i++) {
  863. html += '<option value="' + i + '">' + i + '</option>';
  864. }
  865. $('#dayNum').html(html);
  866. $('#dayNum').selectpicker('refresh');
  867. $('#dayZlNum').html(html);
  868. $('#dayZlNum').selectpicker('refresh');
  869. }
  870. /**
  871. * 处方回调
  872. */
  873. function resetGroupIdSelect() {
  874. var groupIds = $("#groupId option");
  875. var usedGroupIdInputs = $("#xyTabContent").find("input.temporary_items_groupId");
  876. if (usedGroupIdInputs != null && usedGroupIdInputs.length > 0) {
  877. let lastGroupId = 0;
  878. for (var i = 0; i < usedGroupIdInputs.length; i++) {
  879. var groupId = Number($(usedGroupIdInputs[i]).val());
  880. if (groupId > lastGroupId) {
  881. lastGroupId = groupId;
  882. }
  883. }
  884. if (groupIds != null && groupIds.length > 1) {
  885. for (var i = 0; i < groupIds.length; i++) {
  886. var groupId = $(groupIds[i]).val();
  887. if (groupId <= lastGroupId) {
  888. continue;
  889. }
  890. $(groupIds[i]).remove();
  891. //删除给药方式与其他属性的缓存
  892. groupIdMap.remove(groupId);
  893. }
  894. appendGroupOrder();
  895. }
  896. } else if (groupIds != null && groupIds.length > 1) {
  897. initGroupOrder();
  898. }
  899. }
  900. /**
  901. * 初始化药品分组下拉选
  902. */
  903. function initGroupOrder() {
  904. var html = '<option value="1">1</option>';
  905. $('#groupId').html(html);
  906. $('#groupId').selectpicker('refresh');
  907. $("#groupId").selectpicker('val', 1);
  908. $('#groupId').selectpicker('refresh');
  909. groupIdMap = new Map();
  910. }
  911. /**
  912. * 追加分组
  913. */
  914. function appendGroupOrder() {
  915. var last = parseInt($("#groupId > option:last").val());
  916. last++;
  917. var html = '<option value="' + last + '">' + last + '</option>';
  918. $('#groupId').append(html);
  919. $('#groupId').selectpicker('refresh');
  920. }
  921. /**
  922. * 组号改变事件
  923. */
  924. function groupIdChange() {
  925. //var last = parseInt($("#groupId > option:last").val());
  926. var groupId = $("#groupId").val();
  927. var keys = groupIdMap.keySet();
  928. if (keys.indexOf(groupId) < 0) {
  929. //是新增药品清空药品输入区域
  930. var updateFlag = $("#western_medicine_update_flag").val();
  931. var currentCode = $("#western_medicine_current_code").val();
  932. //当前时新增药品,而且没有选择药品的时候,组号变更,清空区域
  933. if ((updateFlag == undefined || updateFlag == null || updateFlag == "false" || updateFlag == false) && (currentCode == null || currentCode == "")) {
  934. clearWesternMedicine(true);
  935. }
  936. } else {
  937. var map = groupIdMap.get(groupId);
  938. if (map != null) {
  939. var supplyType = map.get("supplyType");
  940. var orderFrequency = map.get("orderFrequency");
  941. var dayNum = map.get("dayNum");
  942. //用法编码
  943. $("#supplyType").selectpicker('val', supplyType);
  944. $('#supplyType').selectpicker('refresh');
  945. //$("#supplyType").attr("disabled", "disabled");
  946. //天数
  947. $("#dayNum").selectpicker('val', dayNum);
  948. $('#dayNum').selectpicker('refresh');
  949. // $("#dayNum").attr("disabled", "disabled");
  950. //频次编码
  951. $("#orderFrequency").selectpicker('val', orderFrequency);
  952. $('#orderFrequency').selectpicker('refresh');
  953. // $("#orderFrequency").attr("disabled", "disabled");
  954. }
  955. }
  956. }
  957. /**
  958. * 关闭智能问诊弹框
  959. */
  960. function closePopover() {
  961. //$(".popover").popover('hide');
  962. $("#box-arrow-left").click();
  963. }
  964. /**
  965. * 关闭项目选择框
  966. * ReOpen 是否重新打开 true 打开 false 不打开
  967. */
  968. function closeObjectWebui(ReOpen) {
  969. var index = getIndex("bill_item_group");
  970. var currentCode = "western_medicine_name";
  971. if (index == 1) {
  972. currentCode = "chinese_medicine_name";
  973. } else if (index == 2) {
  974. currentCode = "jcJyItem";
  975. } else if (index == 3) {
  976. currentCode = "zlItem";
  977. }
  978. var webuiID = $("#" + currentCode).attr("data-target");
  979. if (webuiID != null && webuiID != "null" && webuiID != "") {
  980. //选择框打开
  981. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  982. $("#" + currentCode).click();
  983. if (ReOpen) {
  984. $("#" + currentCode).click();
  985. }
  986. }
  987. }
  988. var symptomID = $("#symptom").attr("data-target");
  989. if (symptomID != null && symptomID != "null" && symptomID != "") {
  990. //选择框打开
  991. if ($("#" + symptomID).hasClass("in") || $("#" + symptomID).css("display") == "block") {
  992. $("#symptom").click();
  993. if (ReOpen) {
  994. $("#symptom").click();
  995. }
  996. }
  997. }
  998. var weightID = $("#weight").attr("data-target");
  999. if (weightID != null && weightID != "null" && weightID != "") {
  1000. //选择框打开
  1001. if ($("#" + weightID).hasClass("in") || $("#" + weightID).css("display") == "block") {
  1002. $("#weight").click();
  1003. if (ReOpen) {
  1004. $("#weight").click();
  1005. }
  1006. }
  1007. }
  1008. var diagnoseID = $("#diagnose").attr("data-target");
  1009. if (diagnoseID != null && diagnoseID != "null" && diagnoseID != "") {
  1010. //选择框打开
  1011. if ($("#" + diagnoseID).hasClass("in") || $("#" + diagnoseID).css("display") == "block") {
  1012. $("#diagnose").click();
  1013. if (ReOpen) {
  1014. $("#diagnose").click();
  1015. }
  1016. }
  1017. }
  1018. }
  1019. /**
  1020. * 加载智能问诊弹框内容
  1021. */
  1022. function contentMethod() {
  1023. setTimeout(function () {
  1024. closeObjectWebui(false);
  1025. $(".popover div.arrow").css("display", "none");
  1026. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  1027. if (popoverId == undefined) {
  1028. return;
  1029. }
  1030. var left = $("#" + popoverId).css("left");
  1031. left = left.replace("px", "");
  1032. left = parseInt(left);
  1033. left = left + 55;
  1034. $("#" + popoverId).css("height", "100%").css("top", "0px").css("left", left + "px").css("border-radius", "0px").css("z-index", "11");
  1035. $("#" + popoverId + " .popover-content").css("height", "100%");
  1036. $("#smartAssistPopoverContent").css("height", "100%");
  1037. var html = ' <div style="height: 24%;padding-left: 15px;width: 100%;">' +
  1038. ' <button type="button" style="cursor: default;margin-bottom: 0px;margin-right: 0px; font-size: 12px;"' +
  1039. ' class="btn btn-primary">' +
  1040. ' <span id="patientHisData"></span>就医轨迹' +
  1041. ' </button>' +
  1042. ' <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true" onclick="closePopover()">×</span>' +
  1043. ' </button>' +
  1044. ' <div style="height: calc(100% - 39px);border: 1px solid #DDDDDD;margin-top: 5px;width: 100%;">' +
  1045. ' <form class="form-horizontal form-label-left mz-fixed-form" novalidate autocomplete="off"' +
  1046. ' style="height: 100%;overflow-y: auto;width: 100%;text-align: -webkit-center;position: relative;" id="patientHisDataForm">' +
  1047. ' </form>' +
  1048. ' </div>' +
  1049. ' </div>' +
  1050. ' <div style="height: 23%;padding-left: 15px;width: 100%;">' +
  1051. ' <button type="button" style="cursor: default;margin-bottom: 0px;margin-right: 0px;margin-top: 5px;"' +
  1052. ' class="btn btn-primary">' +
  1053. ' <span id="recommendType"></span>推荐' +
  1054. ' </button>' +
  1055. ' <div style="height: calc(100% - 44px);border: 1px solid #DDDDDD;overflow-y: auto;margin-top: 5px;width: 100%;">' +
  1056. ' <form class="form-horizontal form-label-left mz-fixed-form" novalidate autocomplete="off"' +
  1057. ' style="height: 100%;overflow-y: auto;width: 100%;text-align: -webkit-center;position: relative;" id="recommendForm">' +
  1058. ' <img src="/thmz/images/no-recommend.png" style="height: 120px;position: absolute;top: 50%;transform: translateY(-50%);margin-left: -30px;">' +
  1059. ' </form>' +
  1060. ' </div>' +
  1061. ' </div>' +
  1062. ' <div style="height: 53%;padding-left: 15px;width: 100%;">' +
  1063. ' <button type="button"' +
  1064. ' style="cursor: default;margin-bottom: 0px;margin-right: 0px;margin-top: 5px; font-size: 12px;"' +
  1065. ' class="btn btn-primary">' +
  1066. ' 医疗范本' +
  1067. ' </button>' +
  1068. ' <div class="item" style="width: 230px;height: 35px;float: right;line-height: 35px;margin-right: 40px;">' +
  1069. ' <div class="col-md-6 col-sm-6 col-xs-12">' +
  1070. ' <select class="form-control selectpicker show-tick" title="范文范围" onchange="fitTemplateData()"' +
  1071. ' id="templateTypeForm">' +
  1072. ' </select>' +
  1073. ' </div>' +
  1074. ' <div class="col-md-6 col-sm-6 col-xs-12">' +
  1075. ' <select class="form-control selectpicker show-tick" title="范文类型" onchange="fitTemplateData()"' +
  1076. ' id="templateKindTypeForm">' +
  1077. ' </select>' +
  1078. ' </div>' +
  1079. ' </div>' +
  1080. ' <div style="height: calc(100% - 44px);border: 1px solid #DDDDDD;overflow-y: auto;margin-top: 5px;width: 100%;position: relative;">' +
  1081. ' <form class="form-horizontal form-label-left mz-fixed-form" novalidate autocomplete="off"' +
  1082. ' style="height: 100%;overflow-y: auto;width: 100%;" id="TemplateData">' +
  1083. ' </form>' +
  1084. ' </div>' +
  1085. ' </div>';
  1086. $("#smartAssistPopoverContent").html(html);
  1087. initTemplateTypeSelect("templateTypeForm");
  1088. initTemplateKindTypeSelect('templateKindTypeForm');
  1089. fitPatientHisData();
  1090. fitSymptomData();
  1091. fitEmrHpiData();
  1092. fitEmrPsData();
  1093. fitDiagnoseData();
  1094. fitTemplateData();
  1095. }, 100);
  1096. // setTimeout(function () {
  1097. // $("#patientHisDataForm").html("aadsasfasdfasdfasdfasdfsdfasdfasdfasdfdfafda");
  1098. // },1000);
  1099. }
  1100. /**
  1101. * 设置患者的就诊轨迹
  1102. */
  1103. function fitPatientHisData() {
  1104. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  1105. if (!$("#" + popoverId).hasClass("in")) {
  1106. return;
  1107. }
  1108. var emptyHtml = '<img src="/thmz/images/locus.png" style="height: 120px;position: absolute;top: 50%;transform: translateY(-50%);margin-left: -30px;">';
  1109. if (($("#patientId").text() == null || $("#patientId").text() == "") && ($("#userName").val() == null || $("#userName").val() == "")) {
  1110. $("#patientHisDataForm").html(emptyHtml);
  1111. return;
  1112. }
  1113. var patientId = $("#patientId").text();
  1114. if (patientId == null || patientId == "") {
  1115. patientId = $("#userName").val();
  1116. }
  1117. $.ajax({
  1118. type: "POST",
  1119. url: '/thmz/getClinicWithPage',
  1120. contentType: "application/json;charset=UTF-8",
  1121. dataType: "json",
  1122. data: JSON.stringify({
  1123. "commonParams": patientId,
  1124. //"clinicStatuses": [5, 6],
  1125. "clinicStatuses": [6],
  1126. "pageSize": 10000,
  1127. "offset": 0,
  1128. "beginDate": "2012-02-01 00:00:00",
  1129. "endDate": "",
  1130. "doctorCode": "-1"
  1131. }),
  1132. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1133. success: function (res) {
  1134. if (res == '401' || res == 401) {
  1135. window.location.href = '/thmz/login/view'
  1136. return;
  1137. }
  1138. if (res.code == 0) {
  1139. var html = '';
  1140. var data = res.data;
  1141. if (data == null || data.length == 0) {
  1142. html += emptyHtml;
  1143. } else {
  1144. for (var i = 0; i < data.length; i++) {
  1145. var icdText = data[i].icdText;
  1146. if (icdText == null) {
  1147. // continue;
  1148. icdText = "空白诊断";
  1149. }
  1150. icdText = icdText.trim();
  1151. html += ' <div class="item form-group thmz_alert" style="width: 100%;">';
  1152. html += ' <div style="float: left;width: 172px;">';
  1153. html += ' <img src="/thmz/css/bootstrap/bootstrap-icons-1.5.0/stopwatch.svg"';
  1154. html += ' style="margin-left: 10px!important;vertical-align: -.15em;margin-right: 10px!important;"/>';
  1155. html += ' <span style="width: 120px;margin-right: 20px!important;">' + format(data[i].opDay, "yyyy-MM-dd HH:mm") + '</span>';
  1156. html += ' </div>';
  1157. html += ' <div style="text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 172px);"';
  1158. html += ' title="' + icdText + '">诊断:<a style="cursor: pointer; color: #2e69eb;"';
  1159. html += ' onclick="visitingDetailModal(\'' + data[i].patientId + '\',' + data[i].times + ',' + data[i].id + ',' + data[i].clinicStatus + ')">' + icdText + '</a>';
  1160. html += ' </div>';
  1161. html += ' </div>';
  1162. }
  1163. }
  1164. var patientName = $("#patientName").text();
  1165. if (patientName == null || patientName == "") {
  1166. if (res.mzPatientMi != null) {
  1167. patientName = res.mzPatientMi.name;
  1168. } else {
  1169. patientName = patientId;
  1170. }
  1171. }
  1172. $("#patientHisData").text(patientName + "的");
  1173. if (($("#patientId").text() == null || $("#patientId").text() == "") && ($("#userName").val() == null || $("#userName").val() == "")) {
  1174. $("#patientHisDataForm").html(emptyHtml);
  1175. } else {
  1176. $("#patientHisDataForm").html(html);
  1177. }
  1178. } else {
  1179. errorMesage(res);
  1180. }
  1181. }
  1182. });
  1183. }
  1184. /**
  1185. * 设置主诉推荐
  1186. */
  1187. function fitSymptomData() {
  1188. fitRecommendData(12);
  1189. }
  1190. /**
  1191. * 设置现病史推荐
  1192. */
  1193. function fitEmrHpiData() {
  1194. fitRecommendData(5);
  1195. }
  1196. /**
  1197. * 设置既往史推荐
  1198. */
  1199. function fitEmrPsData() {
  1200. fitRecommendData(6);
  1201. }
  1202. /**
  1203. * 设置诊断推荐
  1204. */
  1205. function fitDiagnoseData() {
  1206. fitRecommendData(13);
  1207. }
  1208. /**
  1209. * 设置推荐通用方法
  1210. */
  1211. function fitRecommendData(paramsType) {
  1212. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  1213. if (!$("#" + popoverId).hasClass("in")) {
  1214. return;
  1215. }
  1216. var inputId = "symptom";
  1217. var text = "主诉";
  1218. if (paramsType == 5) {
  1219. inputId = "emrHpi";
  1220. text = "现病史";
  1221. } else if (paramsType == 6) {
  1222. inputId = "emrPs";
  1223. text = "既往史";
  1224. } else if (paramsType == 13) {
  1225. inputId = "diagnose";
  1226. text = "诊断";
  1227. }
  1228. //光标不在现病史上
  1229. if (document.activeElement.id != inputId) {
  1230. return;
  1231. }
  1232. $("#recommendType").html(text);
  1233. var emptyHtml = '<img src="/thmz/images/no-recommend.png" style="height: 120px;position: absolute;top: 50%;transform: translateY(-50%);margin-left: -30px;">';
  1234. $.ajax({
  1235. type: "GET",
  1236. url: '/thmz/getTCommonParamsByParamsType?paramsType=' + paramsType + '&commonParams=&pageSize=10',
  1237. contentType: "application/json;charset=UTF-8",
  1238. dataType: "json",
  1239. async: false,
  1240. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1241. success: function (res) {
  1242. if (res == '401' || res == 401) {
  1243. window.location.href = '/thmz/login/view'
  1244. return;
  1245. }
  1246. if (res.code == 0) {
  1247. var html = '';
  1248. var data = res.data;
  1249. if (data == null || data.length == 0) {
  1250. html += emptyHtml;
  1251. } else {
  1252. for (var i = 0; i < data.length; i++) {
  1253. var paramsContent = data[i].paramsContent;
  1254. html += ' <div class="item form-group thmz_alert" style="width: 100%;">';
  1255. html += ' <div style="margin-left: 10px;float: left;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 60px);" title="' + paramsContent + '">';
  1256. html += paramsContent;
  1257. html += ' </div>';
  1258. html += ' <div style="float: left;width: 36px;cursor: pointer;"';
  1259. html += ' onclick="fitAppeal(\'' + paramsContent + '\',' + paramsType + ',' + data[i].id + ')">';
  1260. html += ' <img';
  1261. html += ' src="/thmz/css/bootstrap/bootstrap-icons-1.5.0/cursor-fill.svg"';
  1262. html += ' style="margin-left: 10px!important;vertical-align: -.15em;margin-right: 10px!important;"/>';
  1263. html += ' </div>';
  1264. html += ' </div>';
  1265. }
  1266. }
  1267. $("#recommendForm").html(html);
  1268. } else {
  1269. errorMesage(res);
  1270. }
  1271. }
  1272. });
  1273. }
  1274. /**
  1275. * 设置医疗范文方法
  1276. */
  1277. function fitTemplateData() {
  1278. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  1279. if (!$("#" + popoverId).hasClass("in")) {
  1280. return;
  1281. }
  1282. 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;">';
  1283. $.ajax({
  1284. type: "GET",
  1285. url: '/thmz/getTemplate?templateKindType=' + $("#templateKindTypeForm").val() + '&templateType=' + $("#templateTypeForm").val(),
  1286. contentType: "application/json;charset=UTF-8",
  1287. dataType: "json",
  1288. async: false,
  1289. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1290. success: function (res) {
  1291. if (res == '401' || res == 401) {
  1292. window.location.href = '/thmz/login/view'
  1293. return;
  1294. }
  1295. if (res.code == 0) {
  1296. var html = '';
  1297. var data = res.data;
  1298. if (data == null || data.length == 0) {
  1299. html += emptyHtml;
  1300. } else {
  1301. for (var i = 0; i < data.length; i++) {
  1302. var template = data[i];
  1303. var icdText = (template.icdText == null || template.icdText == "") ? "无" : template.icdText;
  1304. html += ' <div class="item form-group thmz_alert" style="width: 100%;">';
  1305. html += ' <div title="' + template.name + '"';
  1306. html += ' style="margin-left: 10px!important;float: left;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: 100px;">';
  1307. html += template.name;
  1308. html += ' </div>';
  1309. html += ' <div style="float: left;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 160px);"';
  1310. html += ' title="' + template.icdText + '">诊断:<a';
  1311. html += ' style="cursor: pointer; color: #2e69eb;"';
  1312. html += ' onclick="medicalModelModal(' + template.id + ')">' + icdText + '</a>';
  1313. html += ' </div>';
  1314. html += ' <div style="float: left;width: 36px;cursor: pointer;" onclick="medicalModelModal(' + template.id + ')"><img';
  1315. html += ' src="/thmz/css/bootstrap/bootstrap-icons-1.5.0/cursor-fill.svg"';
  1316. html += ' style="margin-left: 10px!important;vertical-align: -.15em;margin-right: 10px!important;"/>';
  1317. html += ' </div>';
  1318. html += ' </div>';
  1319. }
  1320. }
  1321. $("#TemplateData").html(html);
  1322. } else {
  1323. errorMesage(res);
  1324. }
  1325. }
  1326. });
  1327. }
  1328. /**
  1329. * 清空快速接诊弹窗
  1330. */
  1331. function clearRapidAcceptsModal() {
  1332. $("#rapidAcceptsUserName").val(null);
  1333. $("#rapidAcceptsUserCode").val(null);
  1334. $("#patientIdDb").val(null);
  1335. $("#rapidAcceptsUserCardNo").val(null);
  1336. $("#rapidAcceptsUserGender").selectpicker('val', 0);
  1337. $("#rapidAcceptsUserGender").selectpicker('refresh');
  1338. $("#rapidAcceptsUserPhoneNum").val(null);
  1339. $('#rapidAcceptsUserCertificateType').selectpicker('val', '01');
  1340. $('#rapidAcceptsUserCertificateType').selectpicker('refresh');
  1341. $("#rapidAcceptsUserIdCard").val(null);
  1342. $("#rapidAcceptsUserIdCard").attr("title", null);
  1343. $("#rapidAcceptsUserPhoneNum").attr("title", null);
  1344. $('#rapidAcceptsProvinceCode').selectpicker('val', null);
  1345. $('#rapidAcceptsProvinceCode').selectpicker('refresh');
  1346. $('#rapidAcceptsCityCode').selectpicker('val', null);
  1347. $('#rapidAcceptsCityCode').selectpicker('refresh');
  1348. $('#rapidAcceptsDistrictCode').selectpicker('val', null);
  1349. $('#rapidAcceptsDistrictCode').selectpicker('refresh');
  1350. $("#rapidAcceptsDetail").val(null);
  1351. $("#rapidAcceptsDetail").attr("title", null);
  1352. $("#rapidAcceptsUserContact").val(null);
  1353. $("#rapidAcceptsUserContactPhone").val(null);
  1354. }
  1355. /**
  1356. * 清空接诊台用户信息
  1357. * @param flag 是否清空分诊流水哈 true 清空
  1358. */
  1359. function clearUser(flag) {
  1360. $("#patientName").html("");
  1361. $("#patientAge").html("");
  1362. $("#patientGender").html("");
  1363. $("#patientId").text(null);
  1364. $("#editUser").css("display", "none");
  1365. $("#clearUser").css("display", "none");
  1366. $("#fetchSpcSlwinfo").css("display", "none");
  1367. $("#patientPhone").html("");
  1368. $("#patientPhoneLabel").hide();
  1369. $("#patientResponseType").html("");
  1370. $("#first").next().click();
  1371. $("#patientHisData").text("");
  1372. if (flag) {
  1373. $("#transferTreatment").css("display", "none");
  1374. $("#consultation").css("display", "none");
  1375. $("#mzfzSerialNoInClick").val(null);
  1376. $("#mzfzReqTypeNoInClick").val(null);
  1377. $("#turnToConsultationIdInClick").val(null);
  1378. }
  1379. }
  1380. /**
  1381. * 卡号输入改变事件
  1382. */
  1383. function cardNoChange() {
  1384. if (window.ActiveXObject || "ActiveXObject" in window) {
  1385. $("#rapidAcceptsUserCardNo").on('input propertychange', function () {
  1386. queryUserInfoByCardNo();
  1387. });
  1388. } else {
  1389. $("#rapidAcceptsUserCardNo").on('input οninput', function () {
  1390. queryUserInfoByCardNo();
  1391. });
  1392. }
  1393. }
  1394. /**
  1395. * 刷新就诊列表
  1396. */
  1397. function refreshClinic() {
  1398. loadInClinicTableList();
  1399. loadClinicTableList();
  1400. fitPatientHisData();
  1401. }
  1402. /**
  1403. * 加载已接诊患者列表
  1404. */
  1405. function loadClinicTableList() {
  1406. //loadCommonClinicTableList("tb_table_clinic","/thmz/getClinicWithPage");
  1407. loadCommonClinicTableList("tb_table_clinic", queryParamsClinic);
  1408. }
  1409. /**
  1410. * 加载患者列表通用方法
  1411. * @param id
  1412. * @param queryParams
  1413. */
  1414. function loadCommonClinicTableList(id, queryParams) {
  1415. $('#' + id).bootstrapTable('refresh');
  1416. $('#' + id).bootstrapTable({
  1417. url: "/thmz/getClinicWithPage", //请求后台的URL(*)
  1418. method: 'post', //请求方式(*)
  1419. toolbar: '#toolbar', //工具按钮用哪个容器
  1420. striped: true, //是否显示行间隔色
  1421. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  1422. pagination: true, //是否显示分页(*)
  1423. sortable: true, //是否启用排序
  1424. sortOrder: "asc", //排序方式
  1425. queryParams: queryParams, //传递参数(*)
  1426. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  1427. pageNumber: 1, //初始化加载第一页,默认第一页
  1428. pageSize: 5, //每页的记录行数(*)
  1429. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  1430. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  1431. strictSearch: true,
  1432. showColumns: false, //是否显示所有的列
  1433. showRefresh: false, //是否显示刷新按钮
  1434. minimumCountColumns: 2, //最少允许的列数
  1435. clickToSelect: true, //是否启用点击选中行
  1436. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  1437. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  1438. cardView: false, //是否显示详细视图
  1439. detailView: false,
  1440. //rowStyle:rowStyle,//通过自定义函数设置行样式
  1441. ajaxOptions: {
  1442. headers: {
  1443. 'Accept': 'application/json',
  1444. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  1445. }
  1446. },
  1447. columns: [
  1448. {
  1449. field: 'patientName',
  1450. title: '姓名/性别/年龄',
  1451. align: "center",
  1452. valign: 'middle',
  1453. // sortable: true
  1454. formatter: function (value, row, index) {
  1455. var age = row.age;
  1456. if (age == null || age == "null") {
  1457. age = "";
  1458. }
  1459. return value + "/" + row.gender + "/" + age;
  1460. }
  1461. }, {
  1462. field: 'opDay',
  1463. title: '接诊时间',
  1464. align: "center",
  1465. valign: 'middle',
  1466. // sortable: true
  1467. formatter: function (value, row, index) {
  1468. return format(value, "MM/dd HH:mm");
  1469. }
  1470. }
  1471. , {
  1472. title: '操作',
  1473. align: "center",
  1474. valign: 'middle',
  1475. // sortable: true,
  1476. formatter: function (value, row, index) {
  1477. if (row.clinicStatus == 5) {
  1478. 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>';
  1479. // 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>';
  1480. } else if (row.clinicStatus == 6) {
  1481. 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>';
  1482. } else if (row.clinicStatus == 7) {
  1483. 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>';
  1484. }
  1485. }
  1486. }
  1487. ],
  1488. responseHandler: function (res) {
  1489. if (res == '401' || res == 401) {
  1490. window.location.href = '/thmz/login/view'
  1491. return;
  1492. }
  1493. var ress = eval(res);
  1494. if (ress.code == -1) {
  1495. new PNotify({
  1496. title: '错误提示',
  1497. text: ress.message,
  1498. type: 'error',
  1499. hide: false,
  1500. styling: 'bootstrap3'
  1501. });
  1502. return {
  1503. "total": 0,//总页数
  1504. "rows": {} //数据
  1505. };
  1506. }
  1507. return {
  1508. "total": ress.total,//总页数
  1509. "rows": ress.data //数据
  1510. };
  1511. },
  1512. onLoadSuccess: function (data) {
  1513. $(".pagination-detail").css("display", "none");
  1514. if (id == "tb_table_clinic") {
  1515. $("#ClinicNum").html(data.total);
  1516. } else {
  1517. $("#inClinicNum").html(data.total);
  1518. }
  1519. }
  1520. });
  1521. }
  1522. /**
  1523. * 得到查询的参数 接诊中
  1524. * @param params
  1525. * @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}}
  1526. */
  1527. function queryParamsInClinic(params) {
  1528. var temp = {
  1529. pageSize: params.limit,
  1530. pageIndex: params.offset / params.limit, //页码
  1531. statusFlagList: [8]
  1532. };
  1533. return temp;
  1534. };
  1535. /**
  1536. * 得到查询的参数
  1537. * @param params
  1538. * @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}}
  1539. */
  1540. function queryParamsClinic(params) {
  1541. var rePortRangeArr = getRePortRangeArr();
  1542. var commonParams = $("#userName").val();
  1543. var needDateParams = commonParams == null || commonParams == "null" || commonParams == "";
  1544. var temp = {
  1545. beginDate: needDateParams ? rePortRangeArr[0] : "2012-02-01 00:00:00",
  1546. endDate: needDateParams ? rePortRangeArr[1] : format(new Date(), "yyyy-MM-dd HH:mm:ss"),
  1547. commonParams: commonParams,
  1548. clinicStatuses: [5, 6, 7],
  1549. pageSize: params.limit,
  1550. offset: params.offset
  1551. };
  1552. return temp;
  1553. };
  1554. /**
  1555. * 加载待诊患者列表方法
  1556. */
  1557. function loadUnClinicTableList() {
  1558. loadCanClinicTableList("tb_table_un_clinic", queryParamsUnClinic);
  1559. }
  1560. /**
  1561. * 加载接诊中患者列表方法
  1562. */
  1563. function loadInClinicTableList() {
  1564. loadCanClinicTableList("tb_table_in_clinic", queryParamsInClinic);
  1565. }
  1566. /**
  1567. * 加载待诊和接诊中患者列表通用方法方法
  1568. */
  1569. function loadCanClinicTableList(id, queryParams) {
  1570. $('#' + id).bootstrapTable('refresh');
  1571. $('#' + id).bootstrapTable({
  1572. url: "/thmz/getUnClinicWithPage", //请求后台的URL(*)
  1573. method: 'post', //请求方式(*)
  1574. toolbar: '#toolbar', //工具按钮用哪个容器
  1575. striped: true, //是否显示行间隔色
  1576. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  1577. pagination: true, //是否显示分页(*)
  1578. sortable: true, //是否启用排序
  1579. sortOrder: "asc", //排序方式
  1580. queryParams: queryParams, //传递参数(*)
  1581. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  1582. pageNumber: 1, //初始化加载第一页,默认第一页
  1583. pageSize: 5, //每页的记录行数(*)
  1584. pageList: [2, 5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  1585. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  1586. strictSearch: true,
  1587. showColumns: false, //是否显示所有的列
  1588. showRefresh: false, //是否显示刷新按钮
  1589. minimumCountColumns: 2, //最少允许的列数
  1590. clickToSelect: true, //是否启用点击选中行
  1591. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  1592. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  1593. cardView: false, //是否显示详细视图
  1594. detailView: false,
  1595. //rowStyle:rowStyle,//通过自定义函数设置行样式
  1596. ajaxOptions: {
  1597. headers: {
  1598. 'Accept': 'application/json',
  1599. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  1600. }
  1601. },
  1602. columns: [
  1603. {
  1604. field: 'name',
  1605. title: '姓名/性别/年龄',
  1606. align: "center",
  1607. valign: 'middle',
  1608. // sortable: true
  1609. formatter: function (value, row, index) {
  1610. return value + "/" + row.gender + "/" + row.age;
  1611. }
  1612. }, {
  1613. field: 'visitDate',
  1614. title: '分诊时间',
  1615. align: "center",
  1616. valign: 'middle',
  1617. // sortable: true
  1618. formatter: function (value, row, index) {
  1619. return format(value, "MM/dd HH:mm");
  1620. }
  1621. }
  1622. , {
  1623. title: '操作',
  1624. align: "center",
  1625. valign: 'middle',
  1626. // sortable: true,
  1627. formatter: function (value, row, index) {
  1628. if (row.statusFlag == 0) {
  1629. return '<a title="接诊" onclick="clinicalReception(\'' + row.patientId + '\',\'' + row.serialNo + '\',' + row.reqType + ')" style="cursor: pointer">接诊</a>';
  1630. } else if (row.statusFlag == 8) {
  1631. //TODO 继续接诊需要新方法
  1632. 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>';
  1633. } else if (row.statusFlag == 1 || row.statusFlag == 2 || row.statusFlag == 3) {
  1634. var userIdCode= localStorage.getItem("userIdCode");
  1635. if(userIdCode===row.doctorCode){
  1636. 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>';
  1637. }
  1638. return '<a title="接诊" onclick="clinicalReception(\'' + row.patientId + '\',\'' + row.serialNo + '\',' + row.reqType + ')" style="cursor: pointer">接诊</a>';
  1639. }
  1640. }
  1641. }
  1642. ],
  1643. responseHandler: function (res) {
  1644. if (res == '401' || res == 401) {
  1645. window.location.href = '/thmz/login/view'
  1646. return;
  1647. }
  1648. var ress = eval(res);
  1649. if (ress.code == -1) {
  1650. new PNotify({
  1651. title: '错误提示',
  1652. text: ress.message,
  1653. type: 'error',
  1654. hide: false,
  1655. styling: 'bootstrap3'
  1656. });
  1657. return {
  1658. "total": 0,//总页数
  1659. "rows": {} //数据
  1660. };
  1661. }
  1662. return {
  1663. "total": ress.total,//总页数
  1664. "rows": ress.data //数据
  1665. };
  1666. },
  1667. onLoadSuccess: function (data) {
  1668. $(".pagination-detail").css("display", "none");
  1669. $("#unClinicNum").html(data.total);
  1670. }
  1671. });
  1672. }
  1673. /**
  1674. * 得到查询的参数
  1675. * @param params
  1676. * @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}}
  1677. */
  1678. function queryParamsUnClinic(params) {
  1679. var temp = {
  1680. pageSize: params.limit,
  1681. pageIndex: params.offset / params.limit, //页码
  1682. statusFlagList: [0, 1, 2, 3]
  1683. };
  1684. return temp;
  1685. };
  1686. /**
  1687. * 通知叫号
  1688. * @param serialNo
  1689. */
  1690. function clinicCallNumber(serialNo) {
  1691. $.ajax({
  1692. type: "GET",
  1693. url: '/thmz/clinicCallNumber?serialNo=' + serialNo,
  1694. contentType: "application/json;charset=UTF-8",
  1695. dataType: "json",
  1696. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1697. success: function (res) {
  1698. if (res == '401' || res == 401) {
  1699. window.location.href = '/thmz/login/view'
  1700. return;
  1701. }
  1702. if (res.code == 0) {
  1703. successMesage(res);
  1704. } else {
  1705. errorMesage(res);
  1706. }
  1707. }
  1708. });
  1709. }
  1710. /**
  1711. * 接诊方法
  1712. * @param patientId 门诊id
  1713. * @param serialNo 分诊流水号
  1714. * @param reqType 号表类别
  1715. */
  1716. function clinicalReception(patientId, serialNo, reqType) {
  1717. var existPatientId = $("#patientId").text();
  1718. if (existPatientId != null && existPatientId != "" && existPatientId != patientId) {
  1719. $("#messageModal").modal();
  1720. $("#messageContent").html("当前有病人正在接诊,是否切换?");
  1721. $("#messageButton").off("click").on("click", function (t) {
  1722. $("#messageModal").modal("hide");
  1723. //当前有人在接诊,提示是否需要切换和保存
  1724. $("#messagePrescriptionModal").modal();
  1725. $("#confirmPrescriptionButton").off("click").on("click", function (t) {
  1726. $("#messagePrescriptionModal").modal("hide");
  1727. //先保存目前接诊信息,再切换就诊人
  1728. var jsonData = getParamsForpPrescription(1);
  1729. $.ajax({
  1730. type: "POST",
  1731. url: '/thmz/savePrescription',
  1732. contentType: "application/json;charset=UTF-8",
  1733. dataType: "json",
  1734. data: JSON.stringify(jsonData),
  1735. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1736. success: function (res) {
  1737. if (res == '401' || res == 401) {
  1738. window.location.href = '/thmz/login/view'
  1739. return;
  1740. }
  1741. if (res.code == 0) {
  1742. clearWorkSpace();
  1743. realClinicalReception(patientId, serialNo, reqType);
  1744. //加载已接诊患者列表
  1745. loadClinicTableList();
  1746. } else {
  1747. errorMesage(res);
  1748. }
  1749. }
  1750. });
  1751. });
  1752. $("#cancelPrescriptionButton").off("click").on("click", function (t) {
  1753. $("#messagePrescriptionModal").modal("hide");
  1754. clearWorkSpace();
  1755. realClinicalReception(patientId, serialNo, reqType);
  1756. });
  1757. });
  1758. $("#cancelButton").off("click");
  1759. } else {
  1760. realClinicalReception(patientId, serialNo, reqType);
  1761. }
  1762. }
  1763. /**
  1764. * 取消接诊
  1765. * @param patientId
  1766. */
  1767. function cancelClinic(patientId, times) {
  1768. $("#messageModal").modal();
  1769. $("#messageContent").html("确认取消当前病人的接诊记录吗?");
  1770. $("#messageButton").off("click").on("click", function (t) {
  1771. $("#messageModal").modal("hide");
  1772. $.ajax({
  1773. type: "GET",
  1774. url: '/thmz/cancelClinic?patientId=' + patientId + "&times=" + times,
  1775. contentType: "application/json;charset=UTF-8",
  1776. dataType: "json",
  1777. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1778. success: function (res) {
  1779. if (res == '401' || res == 401) {
  1780. window.location.href = '/thmz/login/view'
  1781. return;
  1782. }
  1783. if (res.code == 0) {
  1784. if (res.data == null || res.data.length == 0) {
  1785. return;
  1786. }
  1787. successMesage(res);
  1788. if (times > 0) {
  1789. loadUnClinicTableList();
  1790. loadInClinicTableList();
  1791. clearWorkSpace();
  1792. }
  1793. } else if (res.code == -1) {
  1794. errorMesage(res);
  1795. }
  1796. }
  1797. });
  1798. });
  1799. $("#cancelButton").off("click");
  1800. };
  1801. /**
  1802. * 设置当前接诊病人信息
  1803. * @param mzPatientMi
  1804. */
  1805. function setMzPatientInfo(mzPatientMi) {
  1806. $.ajax({
  1807. type: "GET",
  1808. url: '/thmz/getDeptNoByCurrentPatientId?patientId=' + mzPatientMi.patientId,
  1809. contentType: "application/json;charset=UTF-8",
  1810. dataType: "json",
  1811. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1812. success: function (res) {
  1813. if (res == '401' || res == 401) {
  1814. window.location.href = '/thmz/login/view'
  1815. return;
  1816. }
  1817. if (res.code == 0) {
  1818. //当前患者就诊科室编码
  1819. localStorage.setItem("currentDeptNo", res.data);
  1820. } else if (res.code == -1) {
  1821. errorMesage(res);
  1822. }
  1823. }
  1824. });
  1825. $("#patientName").html(mzPatientMi.name);
  1826. //var age = getAge(mzPatientMi);
  1827. $("#patientAge").html(mzPatientMi.ageString);
  1828. $("#patientGender").html(mzPatientMi.gender);
  1829. $("#patientId").text(mzPatientMi.patientId);
  1830. $("#editUser").css("display", "inline-block");
  1831. $("#clearUser").css("display", "inline-block");
  1832. if (mzPatientMi.phoneNo != null && mzPatientMi.phoneNo != '') {
  1833. $("#patientPhone").html(mzPatientMi.phoneNo);
  1834. $("#patientPhoneLabel").show();
  1835. } else {
  1836. $("#patientPhoneLabel").hide();
  1837. }
  1838. $("#patientResponseType").html(mzPatientMi.responseTypeName);
  1839. if (mzPatientMi.times == 1) {
  1840. $("#first").next().click();
  1841. } else {
  1842. $("#not").next().click();
  1843. }
  1844. $("#patientHisData").text(mzPatientMi.name);
  1845. fitPatientHisData();
  1846. setTmResponseType(mzPatientMi.patientId);
  1847. }
  1848. /**
  1849. * 判断是否是特门病人
  1850. * @param patientId
  1851. */
  1852. function setTmResponseType(patientId) {
  1853. $.ajax({
  1854. type: "GET",
  1855. url: '/thmz/fetchSpcSlwinfo?patientId=' + patientId,
  1856. contentType: "application/json;charset=UTF-8",
  1857. dataType: "json",
  1858. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1859. success: function (res) {
  1860. if (res == '401' || res == 401) {
  1861. window.location.href = '/thmz/login/view'
  1862. return;
  1863. }
  1864. if (res.code == 0) {
  1865. if (res.data != null && res.data.length > 0) {
  1866. $("#patientResponseType").html("特殊门诊");
  1867. $("#fetchSpcSlwinfo").css("display", "inline-block");
  1868. }
  1869. }
  1870. }
  1871. });
  1872. }
  1873. /**
  1874. * 特门详情
  1875. * @param patientId
  1876. */
  1877. function fetchSpcSlwinfo() {
  1878. var patientId = $("#patientId").text();
  1879. $.ajax({
  1880. type: "GET",
  1881. url: '/thmz/fetchSpcSlwinfo?patientId=' + patientId,
  1882. contentType: "application/json;charset=UTF-8",
  1883. dataType: "json",
  1884. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1885. success: function (res) {
  1886. if (res == '401' || res == 401) {
  1887. window.location.href = '/thmz/login/view'
  1888. return;
  1889. }
  1890. if (res.code == 0) {
  1891. if (res.data != null && res.data.length > 0) {
  1892. $("#fetchSpcSlwinfoModal").modal();
  1893. $("#fetchSpcSlwinfoTable").html(null);
  1894. for (var i = 0; i < res.data.length; i++) {
  1895. var begndate = res.data[i].begndate;
  1896. if (begndate == null || begndate == "null") {
  1897. begndate = "";
  1898. }
  1899. var enddate = res.data[i].enddate;
  1900. if (enddate == null || enddate == "null") {
  1901. enddate = "";
  1902. }
  1903. var opspDiseName = res.data[i].opspDiseName;
  1904. if (opspDiseName == null || opspDiseName == "null") {
  1905. opspDiseName = "";
  1906. }
  1907. var opspDiseCode = res.data[i].opspDiseCode;
  1908. if (opspDiseCode == null || opspDiseCode == "null") {
  1909. opspDiseCode = "";
  1910. }
  1911. var ideFixmedinsName = res.data[i].ideFixmedinsName;
  1912. if (ideFixmedinsName == null || ideFixmedinsName == "null") {
  1913. ideFixmedinsName = "";
  1914. }
  1915. $("<tr><td>" + begndate + "</td><td>" + enddate + "</td><td>" + opspDiseCode + "</td><td>" + opspDiseName + "</td><td>" + ideFixmedinsName + "</td></tr>").appendTo("#fetchSpcSlwinfoTable");
  1916. // .bind('click', function () {
  1917. // $("#fetchSpcSlwinfoModal").modal("hide");
  1918. // clinicalReception(patientIdDb, $(this).attr("data-target"));
  1919. // });
  1920. }
  1921. } else {
  1922. errorMesage(res);
  1923. }
  1924. } else {
  1925. errorMesage(res);
  1926. }
  1927. }
  1928. });
  1929. }
  1930. /**
  1931. * 初诊的时候设置患者生命体征
  1932. * @param res
  1933. */
  1934. function setMzSmtz(res) {
  1935. var mzYshTzxx = res.mzYshTzxx;
  1936. if (mzYshTzxx != null) {
  1937. if (mzYshTzxx.valueTz != null) {
  1938. $("#weight").val(mzYshTzxx.valueTz);
  1939. }
  1940. if (mzYshTzxx.valueTw != null) {
  1941. $("#temperature").val(mzYshTzxx.valueTw);
  1942. }
  1943. if (mzYshTzxx.valueMb != null) {
  1944. $("#sphygmus").val(mzYshTzxx.valueMb);
  1945. }
  1946. if (mzYshTzxx.valueHx != null) {
  1947. $("#breathe").val(mzYshTzxx.valueHx);
  1948. }
  1949. if (mzYshTzxx.valueSsy != null) {
  1950. $("#pressure_high").val(mzYshTzxx.valueSsy);
  1951. }
  1952. if (mzYshTzxx.valueSzy != null) {
  1953. $("#pressure_floor").val(mzYshTzxx.valueSzy);
  1954. }
  1955. }
  1956. }
  1957. /**
  1958. * 真实的接诊方法
  1959. * @param patientId
  1960. * @param serialNo 分诊流水号
  1961. * @param reqType 号表类别
  1962. */
  1963. function realClinicalReception(patientId, serialNo, reqType) {
  1964. var turnToConsultationIdInClick = $("#turnToConsultationIdInClick").val();
  1965. if (turnToConsultationIdInClick == null || turnToConsultationIdInClick == "null") {
  1966. turnToConsultationIdInClick = 0;
  1967. }
  1968. var userIdCode = localStorage.getItem("userIdCode");
  1969. var deptNo = localStorage.getItem(userIdCode);
  1970. if (deptNo == null) {
  1971. deptNo = "";
  1972. }
  1973. $.ajax({
  1974. type: "GET",
  1975. url: '/thmz/saveClinic?patientId=' + patientId + "&serialNo=" + serialNo + "&turnToConsultationId=" + turnToConsultationIdInClick + "&deptNo=" + deptNo,
  1976. contentType: "application/json;charset=UTF-8",
  1977. dataType: "json",
  1978. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1979. success: function (res) {
  1980. if (res == '401' || res == 401) {
  1981. window.location.href = '/thmz/login/view'
  1982. return;
  1983. }
  1984. if (res.code == 0) {
  1985. if (res.data != null) {
  1986. var mzPatientMi = res.data;
  1987. setMzPatientInfo(mzPatientMi);
  1988. setMzSmtz(res);
  1989. $("#mzfzSerialNoInClick").val(serialNo);
  1990. $("#mzfzReqTypeNoInClick").val(reqType);
  1991. //有分诊流水号 且 不是简易门诊 或 会诊目标科室接诊
  1992. if (serialNo != null && serialNo != "null") {
  1993. if (!(reqType == 10 || reqType == "10" || reqType == "16" || reqType == 16 || reqType == -200)) {
  1994. $("#transferTreatment").css("display", "inline-block");
  1995. }
  1996. $("#consultation").css("display", "inline-block");
  1997. }
  1998. //加载候诊患者列表
  1999. loadUnClinicTableList();
  2000. //加载接诊中患者列表
  2001. loadInClinicTableList();
  2002. //查询患者的门诊统筹信息
  2003. queryInsuinfo(patientId);
  2004. }
  2005. } else {
  2006. errorMesage(res);
  2007. }
  2008. }
  2009. });
  2010. }
  2011. /**
  2012. * 查询患者的门诊统筹信息
  2013. * @param patientId
  2014. */
  2015. function queryInsuinfo(patientId) {
  2016. $.ajax({
  2017. type: "GET",
  2018. url: '/thmz/queryInsuinfo?patientId=' + patientId,
  2019. contentType: "application/json;charset=UTF-8",
  2020. dataType: "json",
  2021. headers: {
  2022. 'Accept': 'application/json',
  2023. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  2024. },
  2025. success: function (res) {
  2026. if (res == '401' || res == 401) {
  2027. window.location.href = '/thmz/login/view'
  2028. return;
  2029. }
  2030. if (res.code == 0) {
  2031. $("#zgmztczfDiv").removeClass("hide").addClass("in");
  2032. $("#mztczfSiReadCard").removeClass("hide").addClass("in");
  2033. var ybCode = localStorage.getItem("ybCode");
  2034. if (ybCode != null && ybCode != "" && ybCode.length > 0) {
  2035. $("#zgmztczf").selectpicker('val', 1);
  2036. $("#zgmztczf").selectpicker('refresh');
  2037. }
  2038. if (res.balc != null) {
  2039. var balc = Number(res.balc);
  2040. if (balc > 0) {
  2041. $("#grzhzfDiv").removeClass("hide").addClass("in");
  2042. }
  2043. }
  2044. if (res.expContentRequired != null && res.expContentRequired == 1) {
  2045. $("#expContentRequired").removeClass("hide").addClass("in");
  2046. }
  2047. } else if (res.code == -1) {
  2048. errorMesageSimaple(res.message);
  2049. } else if (res.code == -2) {
  2050. warningMesageSimaple(res.message);
  2051. }
  2052. }
  2053. });
  2054. }
  2055. /**
  2056. * 读医保电子凭证
  2057. * @param asyncFlag true 异步 false 同步
  2058. */
  2059. function mztczfSiReadCard(asyncFlag) {
  2060. mztczfSiReadCardStatus = true;
  2061. $.ajax({
  2062. type: "GET",
  2063. url: 'http://localhost:8321/readcard/entry?param=qrcode_01101',
  2064. contentType: "application/json;charset=UTF-8",
  2065. dataType: "json",
  2066. async: asyncFlag,
  2067. headers: {
  2068. 'Accept': 'application/json',
  2069. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  2070. },
  2071. success: function (res) {
  2072. mztczfSiReadCardStatus = false;
  2073. if (res == '401' || res == 401) {
  2074. window.location.href = '/thmz/login/view'
  2075. return;
  2076. }
  2077. //console.log(res);
  2078. if (res.code == 200) {
  2079. var data = JSON.parse(res.data);
  2080. $("#readCardResult").val(JSON.stringify(data.data));
  2081. $("#messageContent").html("读卡成功,是否保存处方?");
  2082. } else {
  2083. $("#messageContent").html("读卡失败,是否保存处方(不享受门诊统筹)?");
  2084. errorMesage(res);
  2085. }
  2086. },
  2087. error: function (XMLHttpRequest, textStatus, errorThrown) {
  2088. mztczfSiReadCardStatus = false;
  2089. $("#messageContent").html("读卡异常,是否保存处方(不享受门诊统筹)?");
  2090. }
  2091. });
  2092. }
  2093. /**
  2094. * 实际读医保电子凭证
  2095. * @param asyncFlag true 异步 false 同步
  2096. */
  2097. function realMztczfSiReadCard(asyncFlag) {
  2098. }
  2099. /**
  2100. * 清空工作台
  2101. */
  2102. function clearWorkSpace() {
  2103. clearUser(true);
  2104. clearWorkSpaceExcludeUser(1);
  2105. }
  2106. /**
  2107. * 清空工作台除了用户信息
  2108. * @param source 1 清空工作台 2 调用模板 3 调用历史处方
  2109. */
  2110. function clearWorkSpaceExcludeUser(source) {
  2111. var conciseRecordsFlag = false;
  2112. if (source == 2) {
  2113. conciseRecordsFlag = $("#conciseRecordsYlfw").prop("checked");
  2114. } else if (source == 3) {
  2115. conciseRecordsFlag = $("#conciseRecordsJzxq").prop("checked");
  2116. }
  2117. if (source == 1 || conciseRecordsFlag) {
  2118. $("#symptom").val(null);
  2119. $("#emrHpi").val(null);
  2120. $("#emrPs").val(null);
  2121. $("#personalHistory").val(null);
  2122. $("#familyHistory").val(null);
  2123. $("#obstericalHistory").val(null);
  2124. $("#weight").val(null);
  2125. $("#temperature").val(null);
  2126. $("#sphygmus").val(null);
  2127. $("#breathe").val(null);
  2128. $("#pressure_high").val(null);
  2129. $("#pressure_floor").val(null);
  2130. $("#pressure_high_left").val(null);
  2131. $("#pressure_floor_left").val(null);
  2132. $("#tentativeDiagnosis").val(null);
  2133. $("#otherCheck").val(null);
  2134. $("#diagnoseValue").val(null);
  2135. $("#diagnoseTags").html(null);
  2136. $("#healthEducation").val(null);
  2137. }
  2138. //清空工作台的时候需要调用
  2139. if (source == 1) {
  2140. clearWesternMedicine(true);
  2141. clearChineseMedicine();
  2142. clearJyJcItem();
  2143. clearZlItem();
  2144. clearZyReq();
  2145. //initNavTabs(0);
  2146. clearNavTabs(0);
  2147. clearNavTabs(1);
  2148. clearNavTabs(2);
  2149. clearNavTabs(3);
  2150. clearNavTabs(4);
  2151. clearApidAcceptsModal();
  2152. clearTurnToConsultationInput();
  2153. clearZgtczfInput();
  2154. clearExpContentRequired();
  2155. gropuIdAndOrderNoMap = null;
  2156. //prevCategoriesFlag = null;
  2157. initGroupOrder();
  2158. localStorage.removeItem("currentDeptNo");
  2159. getResultUrl = null;
  2160. }
  2161. $("#totalAmount").text(0);
  2162. }
  2163. /**
  2164. * 构造西药处方详情和模板预览方法
  2165. * @param pyPrescription
  2166. * @param contentId 内容ID
  2167. * @param titleId 标题ID
  2168. * @param checkBox 是否需要增加ckeckBox
  2169. */
  2170. function fitxyContent(pyPrescription, contentId, titleId, checkBox) {
  2171. if (pyPrescription != null && pyPrescription.length > 0) {
  2172. var xypyHtml = "";
  2173. for (var i = 0; i < pyPrescription.length; i++) {
  2174. var py = pyPrescription[i];
  2175. if (py == null || py.length == 0) {
  2176. continue;
  2177. }
  2178. var detail = py.detail;
  2179. if (detail == null || detail.length == 0) {
  2180. continue;
  2181. }
  2182. for (var j = 0; j < detail.length; j++) {
  2183. var pyDetail = detail[j];
  2184. if (checkBox) {
  2185. xypyHtml += "<div style='cursor: pointer;' data-id='" + pyDetail.orderCode + "'>";
  2186. xypyHtml += "<input type='checkbox'/>";
  2187. xypyHtml += "<span onclick='rowDataClick(this)'>";
  2188. } else {
  2189. xypyHtml += "<div>";
  2190. }
  2191. xypyHtml += "<span style='color: red;'>" + pyDetail.groupOrder + "." + "</span>";
  2192. xypyHtml += pyDetail.name;
  2193. xypyHtml += " ";
  2194. xypyHtml += pyDetail.specification;
  2195. xypyHtml += " X ";
  2196. xypyHtml += pyDetail.quantity;
  2197. xypyHtml += pyDetail.packUnit;
  2198. xypyHtml += " 用法: ";
  2199. xypyHtml += pyDetail.supplyName;
  2200. xypyHtml += " ";
  2201. xypyHtml += pyDetail.drugQuan;
  2202. xypyHtml += pyDetail.unitDesc;
  2203. xypyHtml += " ";
  2204. xypyHtml += pyDetail.frequency;
  2205. xypyHtml += " ";
  2206. xypyHtml += pyDetail.orderDays;
  2207. xypyHtml += "天 ";
  2208. if (pyDetail.tryFlag != undefined && pyDetail.tryFlag != null && pyDetail.tryFlag != "null" && pyDetail.tryFlag != "") {
  2209. xypyHtml += pyDetail.tryFlag;
  2210. } else if (pyDetail.tryResult != undefined && pyDetail.tryResult != null && pyDetail.tryResult != "null" && pyDetail.tryResult != "") {
  2211. xypyHtml += pyDetail.tryResult;
  2212. }
  2213. if (checkBox) {
  2214. xypyHtml += "</span>";
  2215. }
  2216. xypyHtml += "</div>";
  2217. }
  2218. }
  2219. afterFitContent(contentId, xypyHtml, titleId);
  2220. } else {
  2221. $("#" + titleId).removeClass("in").addClass("hide");
  2222. $("#" + contentId).html("");
  2223. }
  2224. }
  2225. /**
  2226. * 构造中药处方详情和模板预览方法
  2227. * @param zyPrescription
  2228. * @param contentId 内容ID
  2229. * @param titleId 标题ID
  2230. * @param checkBox 是否需要增加ckeckBox
  2231. */
  2232. function fitzyContent(zyPrescription, contentId, titleId, checkBox) {
  2233. if (zyPrescription == null || zyPrescription.length == 0) {
  2234. $("#" + titleId).removeClass("in").addClass("hide");
  2235. $("#" + contentId).html("");
  2236. return;
  2237. }
  2238. var zyDetail = zyPrescription[0];
  2239. if (zyDetail == null || zyDetail.length == 0) {
  2240. $("#" + titleId).removeClass("in").addClass("hide");
  2241. $("#" + contentId).html("");
  2242. return;
  2243. }
  2244. var detail = zyDetail.detail;
  2245. if (detail == null || detail.length == 0) {
  2246. $("#" + titleId).removeClass("in").addClass("hide");
  2247. $("#" + contentId).html("");
  2248. return;
  2249. }
  2250. var zypyHtml = "";
  2251. for (var i = 0; i < detail.length; i++) {
  2252. //zypyHtml += '<div class="item form-group" style="margin-bottom: -5px;">';
  2253. var zy = detail[i];
  2254. if (zy == null || zy.length == 0) {
  2255. continue;
  2256. }
  2257. if (checkBox) {
  2258. zypyHtml += "<div class=\"col-md-3 col-sm-3 col-xs-12\" style='cursor: pointer;' data-id='" + zy.orderCode + "'>";
  2259. zypyHtml += "<input type='checkbox'/>";
  2260. zypyHtml += "<span onclick='rowDataClick(this)'>";
  2261. } else {
  2262. zypyHtml += "<div class=\"col-md-3 col-sm-3 col-xs-12\">";
  2263. }
  2264. zypyHtml += zy.name;
  2265. var instructionText = zy.instructionText;
  2266. if (instructionText != null && instructionText != "") {
  2267. zypyHtml += "[";
  2268. zypyHtml += instructionText;
  2269. zypyHtml += "]";
  2270. }
  2271. zypyHtml += zy.quantity;
  2272. zypyHtml += "g";
  2273. if (checkBox) {
  2274. zypyHtml += "</span>";
  2275. }
  2276. zypyHtml += "</div>";
  2277. // if (i % 4 == 0) {
  2278. // zypyHtml += '</div>';
  2279. // }
  2280. }
  2281. // if(detail.length%4!=0){
  2282. // for(var i=0;i<4-(detail.length%4);i++){
  2283. // zypyHtml += "<div class=\"col-md-3 col-sm-3 col-xs-12\"></div>";
  2284. // }
  2285. // }
  2286. var zyfs = zyDetail.zyfs;
  2287. if (zyfs != null && zyfs != "") {
  2288. zypyHtml += " <div class=\"col-md-12 col-sm-12 col-xs-12\">";
  2289. zypyHtml += ' <div style="text-indent: 2em;">';
  2290. zypyHtml += ' <div>';
  2291. zypyHtml += 'x<span>';
  2292. zypyHtml += zyfs;
  2293. zypyHtml += '</span> 付</div>';
  2294. }
  2295. afterFitContent(contentId, zypyHtml, titleId);
  2296. }
  2297. /**
  2298. * 构造辅助检查、检验处方详情和模板预览方法
  2299. * @param jcjyPrescription
  2300. * @param contentId 内容ID
  2301. * @param titleId 标题ID
  2302. * @param checkBox 是否需要增加ckeckBox
  2303. */
  2304. function fitJcjyContent(jcjyPrescription, contentId, titleId, checkBox) {
  2305. if (jcjyPrescription == null || jcjyPrescription.length == 0) {
  2306. $("#" + titleId).removeClass("in").addClass("hide");
  2307. $("#" + contentId).html("");
  2308. return;
  2309. }
  2310. var jcjyDetail = jcjyPrescription[0];
  2311. if (jcjyDetail == null || jcjyDetail.length == 0) {
  2312. $("#" + titleId).removeClass("in").addClass("hide");
  2313. $("#" + contentId).html("");
  2314. return;
  2315. }
  2316. var detail = jcjyDetail.detail;
  2317. if (detail == null || detail.length == 0) {
  2318. $("#" + titleId).removeClass("in").addClass("hide");
  2319. $("#" + contentId).html("");
  2320. return;
  2321. }
  2322. var jcjyHtml = "";
  2323. for (var i = 0; i < detail.length; i++) {
  2324. var jcjy = detail[i];
  2325. if (jcjy == null || jcjy.length == 0) {
  2326. continue;
  2327. }
  2328. if (checkBox) {
  2329. jcjyHtml += "<div style='cursor: pointer;' data-id='" + jcjy.orderCode + "'>";
  2330. jcjyHtml += "<input type='checkbox'/>";
  2331. jcjyHtml += "<span onclick='rowDataClick(this)'>";
  2332. } else {
  2333. jcjyHtml += "<div>";
  2334. }
  2335. jcjyHtml += jcjy.index + ".";
  2336. jcjyHtml += jcjy.name;
  2337. var drugUnit = jcjy.drugUnit;
  2338. if (drugUnit == undefined || drugUnit == null || drugUnit == "") {
  2339. drugUnit = "";
  2340. }
  2341. var drugQuan = jcjy.drugQuan;
  2342. if (drugQuan != undefined && drugQuan != null && drugQuan != "") {
  2343. jcjyHtml += " 单量:" + drugQuan + drugUnit;
  2344. }
  2345. var orderDays = jcjy.orderDays;
  2346. if (orderDays != undefined && orderDays != null && orderDays != "") {
  2347. jcjyHtml += " 天数:" + orderDays + "天";
  2348. }
  2349. var frequency = jcjy.frequency;
  2350. if (frequency != undefined && frequency != null && frequency != "") {
  2351. jcjyHtml += " 频次:" + frequency;
  2352. }
  2353. var quantity = jcjy.quantity;
  2354. if (quantity != undefined && quantity != null && quantity != "") {
  2355. jcjyHtml += " 总量:" + quantity + drugUnit;
  2356. }
  2357. if (checkBox) {
  2358. jcjyHtml += "</span>";
  2359. }
  2360. jcjyHtml += "</div>";
  2361. }
  2362. afterFitContent(contentId, jcjyHtml, titleId);
  2363. }
  2364. /**
  2365. * 构造入院处方详情和模板预览方法
  2366. * @param jcjyPrescription
  2367. * @param contentId 内容ID
  2368. * @param titleId 标题ID
  2369. * @param checkBox 是否需要增加ckeckBox
  2370. */
  2371. function fitZyReqContent(zyReqPrescription, contentId, titleId, checkBox) {
  2372. if (zyReqPrescription == null || zyReqPrescription.length == 0) {
  2373. $("#" + titleId).removeClass("in").addClass("hide");
  2374. $("#" + contentId).html("");
  2375. return;
  2376. }
  2377. var zyReqHtml = "";
  2378. if (checkBox) {
  2379. zyReqHtml += "<div style='cursor: pointer;'>";
  2380. zyReqHtml += "<input type='checkbox'/>";
  2381. zyReqHtml += "<span onclick='rowDataClick(this)'>";
  2382. } else {
  2383. zyReqHtml += "<div>";
  2384. }
  2385. zyReqHtml += "收住院 [";
  2386. zyReqHtml += zyReqPrescription.reqDept;
  2387. if (zyReqPrescription.smallDept != null && zyReqPrescription.smallDept != "") {
  2388. zyReqHtml += "(" + zyReqPrescription.smallDept + ")";
  2389. }
  2390. zyReqHtml += "]";
  2391. if (zyReqPrescription.admissStatus != null && zyReqPrescription.admissStatus != "") {
  2392. zyReqHtml += zyReqPrescription.admissStatus;
  2393. }
  2394. if (zyReqPrescription.conditionCode != null && zyReqPrescription.conditionCode != "") {
  2395. zyReqHtml += " " + zyReqPrescription.conditionCode;
  2396. }
  2397. if (zyReqPrescription.routeOfAdmission != null && zyReqPrescription.routeOfAdmission != "") {
  2398. zyReqHtml += " " + zyReqPrescription.routeOfAdmission;
  2399. }
  2400. zyReqHtml += " 侯床";
  2401. if (checkBox) {
  2402. zyReqHtml += "</span>";
  2403. }
  2404. zyReqHtml += "</div>";
  2405. afterFitContent(contentId, zyReqHtml, titleId);
  2406. }
  2407. /**
  2408. * 处方详情构造方法后续事件,如所有的复选框默认勾选
  2409. * @param contentId
  2410. * @param zyReqHtml
  2411. * @param titleId
  2412. */
  2413. function afterFitContent(contentId, zyReqHtml, titleId) {
  2414. $("#" + contentId).html(zyReqHtml);
  2415. $("#" + titleId).removeClass("hide").addClass("in");
  2416. //是否默认勾选处方回调
  2417. var checkboxFlag = localStorage.getItem("checkboxFlag");
  2418. if (checkboxFlag != null && (checkboxFlag == "0" || checkboxFlag == 0)) {
  2419. $("#" + titleId).find("input[type='checkbox']").prop("checked", true);
  2420. $("#" + contentId).find("input[type='checkbox']").each(function (index, obj) {
  2421. $(obj).prop("checked", true);
  2422. });
  2423. } else {
  2424. $("#" + titleId).find("input[type='checkbox']").prop("checked", false);
  2425. }
  2426. }
  2427. /**
  2428. * 模板、详情页行数据点击事件
  2429. * @param obj
  2430. */
  2431. function rowDataClick(obj) {
  2432. $(obj).prev().click();
  2433. }
  2434. /**
  2435. * 模板、详情页治疗分类标题点击事件
  2436. * @param obj
  2437. * @param source 0 是标题的行点击事件 1 标题的checkbox本身触发
  2438. */
  2439. function titleClick(obj, source) {
  2440. var contentObj = $(obj).parent().next();
  2441. var check = $(obj).prop("checked");
  2442. if (source == 0) {
  2443. var prev = $(obj).prev();
  2444. check = !$(prev).prop("checked");
  2445. $(prev).prop("checked", check)
  2446. }
  2447. if (contentObj != null) {
  2448. $(contentObj).children().each(function (index, object) {
  2449. //以下两个方法,单独调用一个可能不行
  2450. $(object).find("input[type='checkbox']").prop("checked", check) //如果鼠标点击选中了,执行后可以取消选中
  2451. });
  2452. }
  2453. }
  2454. /**
  2455. * 处方明细复选框点击事件
  2456. * @param obj
  2457. * @param source 0 是标题的行点击事件 1 标题的checkbox本身触发
  2458. */
  2459. function prescriptionCfmxChosice(obj, source) {
  2460. var check = $(obj).prop("checked");
  2461. if (source == 0) {
  2462. var prev = $(obj).prev();
  2463. check = !$(prev).prop("checked");
  2464. //以下两个方法,单独调用一个可能不行
  2465. $(prev).prop("checked", check) //如果鼠标点击选中了,执行后可以取消选中
  2466. }
  2467. var conents = $(obj).parent().parent().nextAll();
  2468. if (conents == null || conents.length == 0) {
  2469. return;
  2470. }
  2471. $(conents).each(function (index, object) {
  2472. //以下两个方法,单独调用一个可能不行
  2473. $(object).find("div:eq(0)").find("input[type='checkbox']").prop("checked", check) //如果鼠标点击选中了,执行后可以取消选中
  2474. var contentObj = $(object).find("div:eq(1)");
  2475. if (contentObj != null) {
  2476. $(contentObj).children().each(function (contentIndex, contentObject) {
  2477. $(contentObject).find("input[type='checkbox']").prop("checked", check) //如果鼠标点击选中了,执行后可以取消选中
  2478. });
  2479. }
  2480. });
  2481. }
  2482. /**
  2483. * 简明病历标题点击事件
  2484. * @param obj
  2485. */
  2486. function prescriptionJmblChosice(obj) {
  2487. var prev = $(obj).prev();
  2488. var check = !$(prev).prop("checked");
  2489. $(prev).prop("checked", check); //如果鼠标点击选中了,执行后可以取消选中
  2490. }
  2491. /**
  2492. * 医疗范文详情预览
  2493. * @param id
  2494. */
  2495. function medicalModelModal(id) {
  2496. closeObjectWebui(false);
  2497. //是否默认勾选处方回调
  2498. var checkboxFlag = localStorage.getItem("checkboxFlag");
  2499. if (checkboxFlag != null && (checkboxFlag == "0" || checkboxFlag == 0)) {
  2500. $("#conciseRecordsYlfw").prop("checked", true);
  2501. $("#prescriptionSubsidiaryYlfw").prop("checked", true);
  2502. } else {
  2503. $("#conciseRecordsYlfw").prop("checked", false);
  2504. $("#prescriptionSubsidiaryYlfw").prop("checked", false);
  2505. }
  2506. $.ajax({
  2507. type: "GET",
  2508. url: '/thmz/getTemplateById?id=' + id,
  2509. contentType: "application/json;charset=UTF-8",
  2510. dataType: "json",
  2511. async: false,
  2512. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2513. success: function (res) {
  2514. if (res == '401' || res == 401) {
  2515. window.location.href = '/thmz/login/view'
  2516. return;
  2517. }
  2518. if (res.code == 0) {
  2519. var jsonData = JSON.parse(res.data.templateData);
  2520. $("#vmedicalModelName").text(res.data.name);
  2521. $("#idTemplate").val(res.data.id);
  2522. $("#zsTemplate").html(jsonData.mzBlRecord.emrChiefComplaint);
  2523. $("#xbsTemplate").html(jsonData.mzBlRecord.emrHpi);
  2524. $("#tgjcTemplate").html(jsonData.mzBlRecord.emrPe);
  2525. $("#jkjyTemplate").html(jsonData.mzBlRecord.emrJkjy);
  2526. var icdText = res.data.icdText;
  2527. $("#zdTemplate").html("");
  2528. $("#xypyContent").html("");
  2529. $("#xymjContent").html("");
  2530. $("#xyjeContent").html("");
  2531. $("#yczlContent").html("");
  2532. $("#zyzlContent").html("");
  2533. $("#zlyjContent").html("");
  2534. if (icdText != null) {
  2535. var arr = icdText.split(",");
  2536. var html = "";
  2537. for (var i = 0; i < arr.length; i++) {
  2538. if (i == 0) {
  2539. html += ' <div class="tagZdy tagZdy-back">';
  2540. } else {
  2541. html += ' <div class="tagZdy tagZdy-back-green">';
  2542. }
  2543. html += arr[i];
  2544. html += '</div>';
  2545. }
  2546. $("#zdTemplate").html(html);
  2547. }
  2548. var prescriptionDetail = jsonData.mzBlRecord.prescriptionDetail;
  2549. if (prescriptionDetail != null && prescriptionDetail != "") {
  2550. prescriptionDetail = JSON.parse(prescriptionDetail);
  2551. var xyPrescription = prescriptionDetail.xyPrescription;
  2552. if (xyPrescription != null) {
  2553. fitxyContent(xyPrescription.pyPrescription, "xypyContent", "xypyTitle", true);
  2554. fitxyContent(xyPrescription.mjPrescription, "xymjContent", "xymjTitle", true);
  2555. fitxyContent(xyPrescription.jePrescription, "xyjeContent", "xyjeTitle", true);
  2556. fitxyContent(xyPrescription.ycPrescription, "yczlContent", "yczlTitle", true);
  2557. } else {
  2558. $("#xypyTitle").removeClass("in").addClass("hide");
  2559. $("#xypyContent").html("");
  2560. $("#xymjTitle").removeClass("in").addClass("hide");
  2561. $("#xymjContent").html("");
  2562. $("#xyjeTitle").removeClass("in").addClass("hide");
  2563. $("#xyjeContent").html("");
  2564. $("#yczlTitle").removeClass("in").addClass("hide");
  2565. $("#yczlContent").html("");
  2566. }
  2567. var zyPrescription = prescriptionDetail.zyPrescription;
  2568. if (zyPrescription != null) {
  2569. fitzyContent(zyPrescription, "zyzlContent", "zyzlTitle", true);
  2570. } else {
  2571. $("#zyzlTitle").removeClass("in").addClass("hide");
  2572. $("#zyzlContent").html("");
  2573. }
  2574. var jcjyPrescription = prescriptionDetail.jcjyPrescription;
  2575. if (jcjyPrescription != null) {
  2576. fitJcjyContent(jcjyPrescription, "jcjyContent", "jcjyTitle", true);
  2577. } else {
  2578. $("#jcjyTitle").removeClass("in").addClass("hide");
  2579. $("#jcjyContent").html("");
  2580. }
  2581. var zlPrescription = prescriptionDetail.zlPrescription;
  2582. if (zlPrescription != null) {
  2583. fitJcjyContent(zlPrescription, "zlContent", "zlTitle", true);
  2584. } else {
  2585. $("#zlTitle").removeClass("in").addClass("hide");
  2586. $("#zlContent").html("");
  2587. }
  2588. var zyReqPrescription = prescriptionDetail.zyReqPrescription;
  2589. if (zyReqPrescription != null) {
  2590. fitZyReqContent(zyReqPrescription, "zyReqContent", "zyReqTitle", true);
  2591. } else {
  2592. $("#zyReqTitle").removeClass("in").addClass("hide");
  2593. $("#zyReqContent").html("");
  2594. }
  2595. } else {
  2596. $("#xypyTitle").removeClass("in").addClass("hide");
  2597. $("#xypyContent").html("");
  2598. $("#xymjTitle").removeClass("in").addClass("hide");
  2599. $("#xymjContent").html("");
  2600. $("#xyjeTitle").removeClass("in").addClass("hide");
  2601. $("#xyjeContent").html("");
  2602. $("#yczlTitle").removeClass("in").addClass("hide");
  2603. $("#yczlContent").html("");
  2604. $("#zyzlTitle").removeClass("in").addClass("hide");
  2605. $("#zyzlContent").html("");
  2606. $("#jcjyTitle").removeClass("in").addClass("hide");
  2607. $("#jcjyContent").html("");
  2608. $("#zlTitle").removeClass("in").addClass("hide");
  2609. $("#zlContent").html("");
  2610. $("#zyReqTitle").removeClass("in").addClass("hide");
  2611. $("#zyReqContent").html("");
  2612. }
  2613. } else {
  2614. errorMesage(res);
  2615. }
  2616. }
  2617. });
  2618. $("#medicalModelModal").modal();
  2619. }
  2620. /**
  2621. * 诊疗项目回写
  2622. * @param code
  2623. * @param mzChargeDetail
  2624. */
  2625. function callBackZlDetail(code, mzChargeDetail) {
  2626. //诊疗项目
  2627. $.ajax({
  2628. type: "GET",
  2629. url: '/thmz/getZdChargeItemByCode?code=' + code,
  2630. contentType: "application/json;charset=UTF-8",
  2631. dataType: "json",
  2632. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2633. async: false,
  2634. success: function (res) {
  2635. if (res == '401' || res == 401) {
  2636. window.location.href = '/thmz/login/view'
  2637. return;
  2638. }
  2639. if (res.code == 0) {
  2640. //如果
  2641. if ($("#zlTab").find("li") == null || $("#zlTab").find("li").length == 0) {
  2642. initNavTabs(3, null, null);
  2643. }
  2644. $("#zlItem").val(res.data.name);
  2645. $("#zlItem").blur();
  2646. $("#descriptions").val(res.data.descriptions);
  2647. $("#zlItemPrice").val(res.data.chargeAmount);
  2648. $("#chargeUnit").val(res.data.chargeUnit);
  2649. $("#zl_current_code").val(res.data.code);
  2650. $("#zlRemark").val(mzChargeDetail.instructionText);
  2651. $("#dayZlNum").selectpicker('val', mzChargeDetail.orderDays);
  2652. $('#dayZlNum').selectpicker('refresh');
  2653. $("#orderFrequencyZl").selectpicker('val', mzChargeDetail.frequency);
  2654. $('#orderFrequencyZl').selectpicker('refresh');
  2655. if (mzChargeDetail.execDept != null && mzChargeDetail.execDept != "") {
  2656. $("#zlExecUnit").selectpicker('val', mzChargeDetail.execDept);
  2657. $('#zlExecUnit').selectpicker('refresh');
  2658. }
  2659. $("#itemQuantity").val(mzChargeDetail.drugQuan);
  2660. $("#totalNumZl").val(mzChargeDetail.quantity);
  2661. saveZlItem(false);
  2662. } else {
  2663. errorMesage(res);
  2664. }
  2665. }
  2666. });
  2667. }
  2668. /**
  2669. * 处方模板回调和历史处方调用自动重置组号
  2670. * @param type
  2671. */
  2672. function resetNewGroupId(type) {
  2673. if (type == 1 || type == 2) {
  2674. var xyTabContents = $("#xyTabContent").find("div.tab-pane");
  2675. //西药设置
  2676. if (xyTabContents != null && xyTabContents.length > 0) {
  2677. groupIdMap = new Map();
  2678. gropuIdAndOrderNoMap = new Map();
  2679. var newGroupId = 1;
  2680. gropuIdAndOrderNoMap.put(1, 0);
  2681. var prevGroupId = null;
  2682. for (var i = 0; i < xyTabContents.length; i++) {
  2683. var formGroups = $(xyTabContents[i]).find("div.form-group");
  2684. if (formGroups != null && formGroups.length > 0) {
  2685. for (var j = 0; j < formGroups.length; j++) {
  2686. var tempGroupId = $(formGroups[j]).find("input.temporary_items_groupId").val();
  2687. if (prevGroupId != null && tempGroupId != prevGroupId) {
  2688. newGroupId++;
  2689. gropuIdAndOrderNoMap.put(newGroupId, i);
  2690. }
  2691. $(formGroups[j]).find("span.groupId").text(newGroupId);
  2692. $(formGroups[j]).find("input.temporary_items_groupId").val(newGroupId);
  2693. var map = groupIdMap.get(newGroupId + '');
  2694. if (map == null) {
  2695. map = new Map();
  2696. map.put("supplyType", $(formGroups[j]).find("input.temporary_items_supplyType").val());
  2697. map.put("orderFrequency", $(formGroups[j]).find("input.temporary_items_orderFrequency").val());
  2698. map.put("dayNum", $(formGroups[j]).find("input.temporary_items_dayNum").val());
  2699. groupIdMap.put(newGroupId + '', map);
  2700. }
  2701. if (prevGroupId == null || tempGroupId != prevGroupId) {
  2702. prevGroupId = tempGroupId;
  2703. }
  2704. }
  2705. }
  2706. }
  2707. resetGroupIdSelect();
  2708. }
  2709. }
  2710. }
  2711. /**
  2712. * 处方回写
  2713. * @param jsonData 处方数据
  2714. * @param type 回写类型 0 全部回写 1 医疗范文 2 就诊详情
  2715. */
  2716. function editPrescription(jsonData, type) {
  2717. orderNoAndTableIdMap = new Map();
  2718. tableIdAndOrderNoMap = new Map();
  2719. var firstOrNot = jsonData.firstOrNot;
  2720. var conciseRecordsFlag = false;
  2721. if (type == 1) {
  2722. conciseRecordsFlag = $("#conciseRecordsYlfw").prop("checked");
  2723. } else if (type == 2) {
  2724. conciseRecordsFlag = $("#conciseRecordsJzxq").prop("checked");
  2725. }
  2726. if (firstOrNot == 0) {
  2727. $("#first").next().click();
  2728. } else if (firstOrNot == 1) {
  2729. $("#not").next().click();
  2730. }
  2731. if (type == 0 || conciseRecordsFlag) {
  2732. $("#symptom").val(jsonData.mzBlRecord.emrChiefComplaint);
  2733. $("#emrHpi").val(jsonData.mzBlRecord.emrHpi);
  2734. $("#emrPs").val(jsonData.mzBlRecord.emrPs);
  2735. $("#personalHistory").val(jsonData.mzBlRecord.personalHistory);
  2736. $("#familyHistory").val(jsonData.mzBlRecord.familyHistory);
  2737. $("#obstericalHistory").val(jsonData.mzBlRecord.obstericalHistory);
  2738. if (jsonData.mzBlRecord.weight != null && jsonData.mzBlRecord.weight != 0) {
  2739. $("#weight").val(jsonData.mzBlRecord.weight);
  2740. } else {
  2741. $("#weight").val("");
  2742. }
  2743. if (jsonData.mzBlRecord.temperature != null && jsonData.mzBlRecord.temperature != 0) {
  2744. $("#temperature").val(jsonData.mzBlRecord.temperature);
  2745. } else {
  2746. $("#temperature").val("");
  2747. }
  2748. if (jsonData.mzBlRecord.sphygmus != null && jsonData.mzBlRecord.sphygmus != 0) {
  2749. $("#sphygmus").val(jsonData.mzBlRecord.sphygmus);
  2750. } else {
  2751. $("#sphygmus").val("");
  2752. }
  2753. if (jsonData.mzBlRecord.breathe != null && jsonData.mzBlRecord.breathe != 0) {
  2754. $("#breathe").val(jsonData.mzBlRecord.breathe);
  2755. } else {
  2756. $("#breathe").val("");
  2757. }
  2758. if (jsonData.mzBlRecord.pressureHigh != null && jsonData.mzBlRecord.pressureHigh != 0) {
  2759. $("#pressure_high").val(jsonData.mzBlRecord.pressureHigh);
  2760. } else {
  2761. $("#pressure_high").val("");
  2762. }
  2763. if (jsonData.mzBlRecord.pressureFloor != null && jsonData.mzBlRecord.pressureFloor != 0) {
  2764. $("#pressure_floor").val(jsonData.mzBlRecord.pressureFloor);
  2765. } else {
  2766. $("#pressure_floor").val("");
  2767. }
  2768. if (jsonData.mzBlRecord.pressureHighLeft != null && jsonData.mzBlRecord.pressureHighLeft != 0) {
  2769. $("#pressure_high_left").val(jsonData.mzBlRecord.pressureHighLeft);
  2770. } else {
  2771. $("#pressure_high_left").val("");
  2772. }
  2773. if (jsonData.mzBlRecord.pressureFloorLeft != null && jsonData.mzBlRecord.pressureFloorLeft != 0) {
  2774. $("#pressure_floor_left").val(jsonData.mzBlRecord.pressureFloorLeft);
  2775. } else {
  2776. $("#pressure_floor_left").val("");
  2777. }
  2778. $("#tentativeDiagnosis").val(jsonData.mzBlRecord.tentativeDiagnosis);
  2779. $("#otherCheck").val(jsonData.mzBlRecord.emrPe);
  2780. var icdCode = jsonData.icdCode;
  2781. if (icdCode != null && icdCode != "" && icdCode.length > 0) {
  2782. $.ajax({
  2783. type: "GET",
  2784. url: '/thmz/getZdIcdByCodes?icdCode=' + icdCode,
  2785. contentType: "application/json;charset=UTF-8",
  2786. dataType: "json",
  2787. async: false,
  2788. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2789. success: function (res) {
  2790. if (res == '401' || res == 401) {
  2791. window.location.href = '/thmz/login/view'
  2792. return;
  2793. }
  2794. if (res.code == 0) {
  2795. if (res.data != null && res.data.length > 0) {
  2796. for (var i = 0; i < res.data.length; i++) {
  2797. fitDiagnoseValue(res.data[i].name, res.data[i].code);
  2798. }
  2799. }
  2800. } else {
  2801. errorMesage(res);
  2802. }
  2803. }
  2804. });
  2805. }
  2806. $("#healthEducation").val(jsonData.mzBlRecord.emrJkjy);
  2807. }
  2808. //西药选中的数据组
  2809. var xyArrays = [];
  2810. //中药选中的数据组
  2811. var zyArrays = [];
  2812. //辅助检查、检验选中的数据组
  2813. var jcjyArrays = [];
  2814. //诊疗选中的数据组
  2815. var zlArrays = [];
  2816. //住院选中的数据组
  2817. var zyReqArrays = [];
  2818. //组号与同组药数量的map
  2819. var groupOrderAndLengthMap = new Map();
  2820. //处方号与同处方号药数量的map
  2821. var orderNoAndLengthMap = new Map();
  2822. //住院回写
  2823. var zyReqCallBack = false;
  2824. if (type == 1) {
  2825. setCallBackArrays("xypyContent", xyArrays, groupOrderAndLengthMap, orderNoAndLengthMap);
  2826. setCallBackArrays("xymjContent", xyArrays, groupOrderAndLengthMap, orderNoAndLengthMap);
  2827. setCallBackArrays("xyjeContent", xyArrays, groupOrderAndLengthMap, orderNoAndLengthMap);
  2828. setCallBackArrays("yczlContent", xyArrays, groupOrderAndLengthMap, orderNoAndLengthMap);
  2829. setCallBackArrays("zyzlContent", zyArrays, null, null);
  2830. setCallBackArrays("jcjyContent", jcjyArrays, null, null);
  2831. setCallBackArrays("zlContent", zlArrays, null, null);
  2832. zyReqCallBack = $("#zyReqContent").find("input").prop("checked");
  2833. } else if (type == 2) {
  2834. setCallBackArrays("prescriptionDetail_xypyContent", xyArrays, groupOrderAndLengthMap, orderNoAndLengthMap);
  2835. setCallBackArrays("prescriptionDetail_xymjContent", xyArrays, groupOrderAndLengthMap, orderNoAndLengthMap);
  2836. setCallBackArrays("prescriptionDetail_xyjeContent", xyArrays, groupOrderAndLengthMap, orderNoAndLengthMap);
  2837. setCallBackArrays("prescriptionDetail_yczlContent", xyArrays, groupOrderAndLengthMap, orderNoAndLengthMap);
  2838. setCallBackArrays("prescriptionDetail_zyzlContent", zyArrays, null, null);
  2839. setCallBackArrays("prescriptionDetail_jcjyContent", jcjyArrays, null, null);
  2840. setCallBackArrays("prescriptionDetail_zlContent", zlArrays, null, null);
  2841. zyReqCallBack = $("#prescriptionDetail_zyReqContent").find("input").prop("checked");
  2842. } else if (type == 0) {
  2843. zyReqCallBack = true;
  2844. }
  2845. var mzChargeDetailList = jsonData.mzChargeDetailList;
  2846. var mzZyReq = jsonData.mzZyReq;
  2847. //中药的公共参数是否已经设置了
  2848. var hadSetZyFullParams = false;
  2849. //西药,成药,医材,麻精,中药,诊疗
  2850. if (mzChargeDetailList != null && mzChargeDetailList.length > 0) {
  2851. //当前实际回写的组号
  2852. var currentOrderNo = null;
  2853. //处方号与药品类型关系
  2854. var orderAndGroupNoMap = new Map();
  2855. // mzChargeDetailList.sort(function (a, b) {
  2856. // return a.groupNo - b.groupNo
  2857. // });
  2858. for (var i = 0; i < mzChargeDetailList.length; i++) {
  2859. var mzChargeDetail = mzChargeDetailList[i];
  2860. var groupNo = mzChargeDetail.groupNo;
  2861. var code = mzChargeDetail.chargeItemCode;
  2862. var serial = mzChargeDetail.serial;
  2863. if (groupNo == "00") {
  2864. if (type != 0 && !isInArray(code, zlArrays)) {
  2865. continue;
  2866. }
  2867. callBackZlDetail(code, mzChargeDetail);
  2868. } else if (groupNo == "71" || groupNo == "91" || groupNo == "111" || groupNo == "131") {
  2869. // 71 西成药 91 医材 111 精一 131 精二
  2870. var groupOrder = mzChargeDetail.groupOrder;
  2871. if (groupOrder == null || groupOrder == 'null' || groupOrder == "") {
  2872. groupOrder = 1;
  2873. }
  2874. var orderNo = mzChargeDetail.orderNo;
  2875. orderAndGroupNoMap.put(orderNo, groupNo);
  2876. if (type != 0 && !isInArray(code + "_" + serial + "_" + groupOrder + "_" + orderNo, xyArrays)) {
  2877. continue;
  2878. }
  2879. var lastGroupOrder = parseInt($("#groupId > option:last").val());
  2880. while (lastGroupOrder < groupOrder) {
  2881. appendGroupOrder();
  2882. lastGroupOrder = parseInt($("#groupId > option:last").val());
  2883. }
  2884. //appendGroupOrder()
  2885. $("#groupId").selectpicker('val', groupOrder);
  2886. $('#groupId').selectpicker('refresh');
  2887. if (type == 1 || type == 2) {
  2888. //模板和历史轨迹回调的时候,如果前一个处方不满5个,就将后面的处方的药品添加到上一个处方中,但如果同一组药不能全部添加到上一个处方,就不会追加到该处方中
  2889. var orderNoLength = orderNoAndLengthMap.get(orderNo);
  2890. if (currentOrderNo == null) {
  2891. currentOrderNo = orderNo;
  2892. } else if (orderAndGroupNoMap.get(currentOrderNo) != orderAndGroupNoMap.get(orderNo)) {
  2893. var currentGroupNos = $("#xyTabContent").find("input.current_groupNo");
  2894. //查询还没有满5个的处方页
  2895. var tempOrderNo = null;
  2896. for (var k = 0; k < currentGroupNos.length; k++) {
  2897. if ($(currentGroupNos[k]).val() == groupNo) {
  2898. var next = $(currentGroupNos[k]).next();
  2899. if ($(next).children().length < 4) {
  2900. var parentId = $(currentGroupNos[k]).parent().attr("id");
  2901. tempOrderNo = tableIdAndOrderNoMap.get(parentId);
  2902. }
  2903. }
  2904. }
  2905. currentOrderNo = tempOrderNo;
  2906. } else if (currentOrderNo != orderNo && orderNoLength < 5) {
  2907. var currentOrderNoLength = orderNoAndLengthMap.get(currentOrderNo);
  2908. var groupOrderLength = groupOrderAndLengthMap.get(groupOrder);
  2909. if (groupOrderLength + currentOrderNoLength <= 5) {
  2910. currentOrderNoLength = currentOrderNoLength + 1;
  2911. orderNoLength = orderNoLength - 1;
  2912. groupOrderLength = groupOrderLength - 1;
  2913. orderNoAndLengthMap.put(currentOrderNo, currentOrderNoLength);
  2914. orderNoAndLengthMap.put(orderNo, orderNoLength);
  2915. groupOrderAndLengthMap.put(groupOrder, groupOrderLength);
  2916. orderNo = currentOrderNo;
  2917. if (currentOrderNoLength == 5) {
  2918. var currentGroupNos = $("#xyTabContent").find("input.current_groupNo");
  2919. //查询还没有满5个的处方页,
  2920. var tempOrderNo = null;
  2921. for (var k = 0; k < currentGroupNos.length; k++) {
  2922. if ($(currentGroupNos[k]).val() == groupNo) {
  2923. var next = $(currentGroupNos[k]).next();
  2924. //这里判断是4,是因为已经把组号设置了,所以要减去1
  2925. if ($(next).children().length < 4) {
  2926. var parentId = $(currentGroupNos[k]).parent().attr("id");
  2927. tempOrderNo = tableIdAndOrderNoMap.get(parentId);
  2928. }
  2929. }
  2930. }
  2931. currentOrderNo = tempOrderNo;
  2932. }
  2933. } else {
  2934. currentOrderNo = orderNo;
  2935. }
  2936. }
  2937. }
  2938. checkYpInfo(code, serial, groupNo, false, orderNo, type);
  2939. // 给药方式 同组药品给药方式相同
  2940. $("#supplyType").selectpicker('val', mzChargeDetail.supplyCode);
  2941. $('#supplyType').selectpicker('refresh');
  2942. $("#drugWin").val(mzChargeDetail.drugQuan);
  2943. $("#drugWinUnit").selectpicker('val', mzChargeDetail.drugUnit);
  2944. $('#drugWinUnit').selectpicker('refresh');
  2945. //天数 同组药品天数相同
  2946. $("#dayNum").selectpicker('val', mzChargeDetail.orderDays);
  2947. $('#dayNum').selectpicker('refresh');
  2948. //频次编码 同组药品频次编码相同
  2949. $("#orderFrequency").selectpicker('val', mzChargeDetail.frequency);
  2950. $('#orderFrequency').selectpicker('refresh');
  2951. if (mzChargeDetail.tryFlag == 1 || mzChargeDetail.tryFlag == "1") {
  2952. $("#tryResult").selectpicker('val', 100);
  2953. $('#tryResult').selectpicker('refresh');
  2954. } else if (mzChargeDetail.tryResult != null && mzChargeDetail.tryResult != "null" && mzChargeDetail.tryResult != "") {
  2955. $("#tryResult").selectpicker('val', mzChargeDetail.tryResult);
  2956. $('#tryResult').selectpicker('refresh');
  2957. }
  2958. $("#gross").val(mzChargeDetail.quantity);
  2959. $("#totalRetprice").val(Multiply(mzChargeDetail.quantity, $("#packRetprice").val()).toFixed(2));
  2960. $("#medicalAdvice").selectpicker('val', mzChargeDetail.instructionCode);
  2961. $('#medicalAdvice').selectpicker('refresh');
  2962. saveWesternMedicineWithCheck(false, orderNo);
  2963. $("#western_medicine_button").click();
  2964. $("#xyTab").find("li:eq(0) a").off("click").click();
  2965. } else {
  2966. if (type != 0 && !isInArray(code + "_" + serial, zyArrays)) {
  2967. continue;
  2968. }
  2969. //中药与颗粒剂
  2970. checkZyInfo(code, serial, groupNo, false);
  2971. //类型
  2972. $("#zyClassType").selectpicker('val', groupNo);
  2973. $('#zyClassType').selectpicker('refresh');
  2974. $("#zy_drugWin").val(mzChargeDetail.quantity);
  2975. $("#zyInstruction").selectpicker('val', mzChargeDetail.instructionCode);
  2976. $('#zyInstruction').selectpicker('refresh');
  2977. saveChineseMedicine(false);
  2978. if (!hadSetZyFullParams) {
  2979. hadSetZyFullParams = true;
  2980. $("input.zyfs").val(mzChargeDetail.drugWin);
  2981. // $("#zy_orderFrequency_1").selectpicker('val', mzChargeDetail.frequency);
  2982. // $('#zy_orderFrequency_1').selectpicker('refresh');
  2983. $("#useType_1").selectpicker('val', mzChargeDetail.cyFysm);
  2984. $('#useType_1').selectpicker('refresh');
  2985. $("#cyJssm").selectpicker('val', mzChargeDetail.cyJssm);
  2986. $('#cyJssm').selectpicker('refresh');
  2987. $("#cyJsl").val(mzChargeDetail.cyJsl);
  2988. $("#cyZql").val(mzChargeDetail.cyZql);
  2989. $("#cyFj").val(mzChargeDetail.cyFj);
  2990. $("#cyFfcs").val(mzChargeDetail.cyFfcs);
  2991. $("#cyMtjs").val(mzChargeDetail.cyMtjs);
  2992. $("#zy_supplyType_1").selectpicker('val', mzChargeDetail.cyDj);
  2993. $('#zy_supplyType_1').selectpicker('refresh');
  2994. }
  2995. $("#chinese_medicine_button").click();
  2996. }
  2997. }
  2998. }
  2999. //检验与检查
  3000. var mzYjReqList = jsonData.mzYjReqList;
  3001. if (mzYjReqList != null && mzYjReqList.length > 0) {
  3002. for (var i = 0; i < mzYjReqList.length; i++) {
  3003. var mzYjReq = mzYjReqList[i];
  3004. var code = mzYjReq.orderCode;
  3005. if (type != 0 && !isInArray(code, jcjyArrays)) {
  3006. continue;
  3007. }
  3008. var jcJyZltype = null;
  3009. if (mzYjReq.reqType == 2) {
  3010. jcJyZltype = 1;
  3011. $("#jyZdSample").selectpicker('val', mzYjReq.inspectStuff);
  3012. $('#jyZdSample').selectpicker('refresh');
  3013. } else if (mzYjReq.reqType == 3) {
  3014. jcJyZltype = 2;
  3015. $("#yshPart").selectpicker('val', mzYjReq.inspectPart);
  3016. $('#yshPart').selectpicker('refresh');
  3017. }
  3018. $("#jcJyZltype").val(jcJyZltype);
  3019. checkJcJyItemInfo(code, null, jcJyZltype, false);
  3020. $("#remark").val(mzYjReq.jyRemark);
  3021. if (mzYjReq.execDept != null && mzYjReq.execDept != "") {
  3022. $("#execUnit").selectpicker('val', mzYjReq.execDept);
  3023. $('#execUnit').selectpicker('refresh');
  3024. }
  3025. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  3026. saveJyJcItem(false);
  3027. $("#jcJyItemChargeDetail").removeClass("in").addClass("hide");
  3028. }
  3029. $("#yj_req_button").click();
  3030. }
  3031. //入院证
  3032. if (zyReqCallBack && mzZyReq != null && mzZyReq.reqDept != null && mzZyReq.reqDept != "") {
  3033. $("#inpatientWardBeHospitalized").selectpicker('val', mzZyReq.reqDept);
  3034. $('#inpatientWardBeHospitalized').selectpicker('refresh');
  3035. initSmallDeptByDept();
  3036. $("#admissStatus").selectpicker('val', mzZyReq.admissStatus);
  3037. $('#admissStatus').selectpicker('refresh');
  3038. $("#conditionCode").selectpicker('val', mzZyReq.conditionCode);
  3039. $('#conditionCode').selectpicker('refresh');
  3040. $("#routeOfAdmission").selectpicker('val', mzZyReq.routeOfAdmission);
  3041. $('#routeOfAdmission').selectpicker('refresh');
  3042. setTimeout(function () {
  3043. $("#smallWardBeHospitalized").selectpicker('val', mzZyReq.smallDept);
  3044. $('#smallWardBeHospitalized').selectpicker('refresh');
  3045. saveZyReq(false);
  3046. }, 500);
  3047. $("#zy_req_button").click();
  3048. }
  3049. setTimeout(function () {
  3050. //设置总金额 计算金额的时候,可能处方还没有回写完
  3051. calculateTotalAmount(false);
  3052. }, 1000);
  3053. //清空映射map
  3054. orderNoAndTableIdMap = null;
  3055. tableIdAndOrderNoMap = null;
  3056. resetNewGroupId(type);
  3057. }
  3058. /**
  3059. * 根据勾选内容设置选中集合
  3060. * @param id 区域id
  3061. * @param arrays 集合
  3062. * @param groupOrderAndLengthMap 组号与同组药数量的map
  3063. * @param orderNoAndLengthMap 处方号与同处方号药数量的map
  3064. */
  3065. function setCallBackArrays(id, arrays, groupOrderAndLengthMap, orderNoAndLengthMap) {
  3066. var contents = $("#" + id).children();
  3067. if (contents == null || contents.length == 0) {
  3068. return;
  3069. }
  3070. $(contents).each(function (index, obj) {
  3071. var checked = $(obj).find("input").prop("checked");
  3072. var data_id = $(obj).attr("data-id");
  3073. if (checked && data_id != undefined && data_id != null && data_id != "null" && data_id != "") {
  3074. arrays[arrays.length] = data_id;
  3075. var dataArr = null;
  3076. //设置组号与同组药品数量关系
  3077. if (groupOrderAndLengthMap != null) {
  3078. dataArr = data_id.split("_");
  3079. if (dataArr != null && dataArr.length >= 3) {
  3080. var groupOrder = Number(dataArr[2]);
  3081. var length = groupOrderAndLengthMap.get(groupOrder);
  3082. if (length == null || length == "") {
  3083. length = 0;
  3084. }
  3085. length++;
  3086. groupOrderAndLengthMap.put(groupOrder, length);
  3087. }
  3088. }
  3089. //设置处方号与同处方号药品数量关系
  3090. if (orderNoAndLengthMap != null) {
  3091. if (dataArr == null) {
  3092. dataArr = data_id.split("_");
  3093. }
  3094. if (dataArr != null && dataArr.length >= 4) {
  3095. var orderNo = Number(dataArr[3]);
  3096. var length = orderNoAndLengthMap.get(orderNo);
  3097. if (length == null || length == "") {
  3098. length = 0;
  3099. }
  3100. length++;
  3101. orderNoAndLengthMap.put(orderNo, length);
  3102. }
  3103. }
  3104. }
  3105. });
  3106. }
  3107. /**
  3108. * 调用医疗范文
  3109. */
  3110. function callTemplate() {
  3111. clearWorkSpaceExcludeUser(2);
  3112. $.ajax({
  3113. type: "GET",
  3114. url: '/thmz/increaseNumber?id=' + $("#idTemplate").val(),
  3115. contentType: "application/json;charset=UTF-8",
  3116. dataType: "json",
  3117. async: false,
  3118. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3119. success: function (res) {
  3120. if (res == '401' || res == 401) {
  3121. window.location.href = '/thmz/login/view'
  3122. return;
  3123. }
  3124. if (res.code == 0) {
  3125. var jsonData = JSON.parse(res.data.templateData);
  3126. editPrescription(jsonData, 1);
  3127. $("#templateId").val(res.data.id);
  3128. $("#templateName").val(res.data.name);
  3129. $("#templateKindType").selectpicker('val', res.data.templateKindType);
  3130. $("#templateKindType").selectpicker('refresh');
  3131. $("#templateType").selectpicker('val', res.data.templateType);
  3132. $("#templateType").selectpicker('refresh');
  3133. $('#operationType').selectpicker('val', 1);
  3134. $('#operationType').selectpicker('refresh');
  3135. $("#operationTypeDiv").removeClass("hide").addClass("in");
  3136. $("#medicalModelModal").modal("hide");
  3137. closePopover();
  3138. } else {
  3139. errorMesage(res);
  3140. }
  3141. }
  3142. });
  3143. }
  3144. /**
  3145. * 底层填充推荐方法
  3146. * @param paramsType
  3147. * @param appeal
  3148. * @param inputId
  3149. */
  3150. function extracted(paramsType, appeal, inputId) {
  3151. if (paramsType == 13) {
  3152. var contentArr = appeal.split(",");
  3153. if (contentArr != null && contentArr.length > 0) {
  3154. for (var i = 0; i < contentArr.length; i++) {
  3155. var content = contentArr[i].replace(")", "").replace("(", "-");
  3156. var diagnoseArr = content.split("-");
  3157. if (diagnoseArr == null || diagnoseArr.length == 0) {
  3158. continue;
  3159. }
  3160. fitDiagnoseValue(diagnoseArr[0], diagnoseArr[1]);
  3161. }
  3162. }
  3163. } else {
  3164. $("#" + inputId).val(appeal);
  3165. }
  3166. }
  3167. /**
  3168. * 填充推荐
  3169. * @param appeal
  3170. * @param paramsType
  3171. * @param id
  3172. */
  3173. function fitAppeal(appeal, paramsType, id) {
  3174. var inputId = "symptom";
  3175. var text = "主诉项已经录入,是否覆盖?";
  3176. if (paramsType == 5) {
  3177. inputId = "emrHpi";
  3178. text = "现病史项已经录入,是否覆盖?";
  3179. } else if (paramsType == 6) {
  3180. inputId = "emrPs";
  3181. text = "既往史项已经录入,是否覆盖?";
  3182. } else if (paramsType == 13) {
  3183. inputId = "diagnoseValue";
  3184. text = "诊断项已经录入,是否覆盖?";
  3185. }
  3186. var symptom = $("#" + inputId).val();
  3187. if (paramsType == 13 && (symptom == ",," || symptom == ",")) {
  3188. symptom = null;
  3189. }
  3190. if (symptom != null && symptom != "") {
  3191. $("#messageModal").modal();
  3192. $("#messageContent").html(text);
  3193. $("#messageButton").off("click").on("click", function (t) {
  3194. $("#messageModal").modal("hide");
  3195. if (paramsType == 13) {
  3196. $("#" + inputId).val(null);
  3197. $("#diagnoseTags").html(null);
  3198. }
  3199. extracted(paramsType, appeal, inputId);
  3200. });
  3201. $("#cancelButton").off("click");
  3202. } else {
  3203. extracted(paramsType, appeal, inputId);
  3204. }
  3205. $.ajax({
  3206. type: "GET",
  3207. url: '/thmz/increaseTcCommonParamsNumber?id=' + id,
  3208. contentType: "application/json;charset=UTF-8",
  3209. dataType: "json",
  3210. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3211. success: function (res) {
  3212. }
  3213. });
  3214. }
  3215. /**
  3216. * 初始嘱托下拉选
  3217. */
  3218. function initInstructionSelect() {
  3219. //西药医嘱
  3220. $.ajax({
  3221. type: "GET",
  3222. url: '/thmz/getMzZdInstructionByType?instructionType=0',
  3223. contentType: "application/json;charset=UTF-8",
  3224. dataType: "json",
  3225. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3226. success: function (res) {
  3227. if (res == '401' || res == 401) {
  3228. window.location.href = '/thmz/login/view'
  3229. return;
  3230. }
  3231. if (res.code == 0) {
  3232. res.data.forEach(function (item, index) {
  3233. var html = '<option value="' + item.code + '">' + item.instructionText + '</option>';
  3234. $('#medicalAdvice').append(html);
  3235. });
  3236. $('#medicalAdvice').selectpicker('refresh');
  3237. } else {
  3238. errorMesage(res);
  3239. }
  3240. }
  3241. });
  3242. //中药医嘱
  3243. $.ajax({
  3244. type: "GET",
  3245. url: '/thmz/getMzZdInstructionByType?instructionType=1',
  3246. contentType: "application/json;charset=UTF-8",
  3247. dataType: "json",
  3248. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3249. success: function (res) {
  3250. if (res == '401' || res == 401) {
  3251. window.location.href = '/thmz/login/view'
  3252. return;
  3253. }
  3254. if (res.code == 0) {
  3255. res.data.forEach(function (item, index) {
  3256. var html = '<option value="' + item.code + '">' + item.instructionText.trim() + '</option>';
  3257. $('#zyInstruction').append(html);
  3258. });
  3259. $('#zyInstruction').selectpicker('refresh');
  3260. } else {
  3261. errorMesage(res);
  3262. }
  3263. }
  3264. });
  3265. }
  3266. /**
  3267. * 设置下拉选的尺寸
  3268. */
  3269. function setSelectSize() {
  3270. $(".selectpicker").selectpicker({
  3271. dropuAuto: false,
  3272. size: 10
  3273. });
  3274. //select 从后台加载数据,并保留之前选择的内容
  3275. dynamicSelectWithOri("editZd", '/thmz/getAllZdIcdCommonParams?commonParams=');
  3276. }
  3277. /**
  3278. * 初始化性别下拉选
  3279. */
  3280. function initGenderSelect() {
  3281. var gender = '<option value="1">男</option><option value="2">女</option><option value="0">未知</option>';
  3282. $('#rapidAcceptsUserGender').html(gender);
  3283. $('#rapidAcceptsUserGender').selectpicker('refresh');
  3284. $('#editUserGender').html(gender);
  3285. $('#editUserGender').selectpicker('refresh');
  3286. //医疗范文状态
  3287. var templateStatus = '<option value="0">启用</option><option value="1">停用</option>';
  3288. $('#templateStatus').html(templateStatus);
  3289. $('#templateStatus').selectpicker('refresh');
  3290. //医疗范文操作类型
  3291. var operationType = '<option value="0">新增</option><option value="1">修改</option>';
  3292. $('#operationType').html(operationType);
  3293. $('#operationType').selectpicker('refresh');
  3294. //入院病情
  3295. var conditionCode = '<option value="1">有</option><option value="2">临床未确定</option><option value="3">情况不明</option><option value="4">无</option>';
  3296. $('#conditionCode').html(conditionCode);
  3297. $('#conditionCode').selectpicker('refresh');
  3298. //入院途径
  3299. var routeOfAdmission = '<option value="1">急诊</option><option value="2">门诊</option><option value="3">其他医疗机构转入</option><option value="9">其他</option>';
  3300. $('#routeOfAdmission').html(routeOfAdmission);
  3301. $('#routeOfAdmission').selectpicker('refresh');
  3302. //就诊人群类型
  3303. var mdtrtGrpType = '<option value="-1">无</option><option value="1">新冠肺炎确诊患者</option><option value="2">其他国家突发公共事件</option><option value="3">新冠肺炎疑似患者</option><option value="4">无症状感染者</option>';
  3304. $('#mdtrtGrpType').html(mdtrtGrpType);
  3305. $('#mdtrtGrpType').selectpicker('refresh');
  3306. //外伤标志
  3307. var trumFlag = '<option value="0">否</option><option value="1">是</option>';
  3308. $('#trumFlag').html(trumFlag);
  3309. $('#trumFlag').selectpicker('refresh');
  3310. //涉及第三方标志
  3311. var relTtpFlag = '<option value="0">否</option><option value="1">是</option>';
  3312. $('#relTtpFlag').html(relTtpFlag);
  3313. $('#relTtpFlag').selectpicker('refresh');
  3314. //门诊急诊转诊标志
  3315. var otpErReflFlag = '<option value="-1">无</option><option value="1">急诊</option><option value="2">转诊</option><option value="3">转诊合并急诊</option>';
  3316. $('#otpErReflFlag').html(otpErReflFlag);
  3317. $('#otpErReflFlag').selectpicker('refresh');
  3318. }
  3319. /**
  3320. * 初始化中药类型下拉选
  3321. */
  3322. function initZyClassTypeSelect() {
  3323. var gender = '<option value="81">普通</option><option value="82">颗粒剂</option>';
  3324. $('#zyClassType').html(gender);
  3325. $('#zyClassType').selectpicker('refresh');
  3326. //$('#zyClassType').selectpicker('val', "81");
  3327. // $('#zyClassType').selectpicker('refresh');
  3328. }
  3329. /**
  3330. * 初始化皮试结果下拉选
  3331. * @param categoriesFlag 0 口服 2 注射针剂
  3332. */
  3333. function initTryResultSelect(categoriesFlag) {
  3334. var tryResult = '';
  3335. if (categoriesFlag == 2 || categoriesFlag == "2") {
  3336. tryResult += '<option value="100">皮试</option>';
  3337. }
  3338. tryResult += '<option value="0">阴性</option><option value="3">免试</option>';
  3339. //var tryResult = '<option value="100">皮试</option><option value="0">阴性</option><option value="3">免试</option>';
  3340. $('#tryResult').html(tryResult);
  3341. $('#tryResult').selectpicker('refresh');
  3342. //口服药选择皮试结果
  3343. $("#tryResult").parent().parent().parent().removeClass("hide").addClass("in");
  3344. }
  3345. /**
  3346. * 初始化病人身份类别下拉选
  3347. */
  3348. function initResponceTypeSelect() {
  3349. $.ajax({
  3350. type: "GET",
  3351. url: '/thmz/getMzResponceType',
  3352. contentType: "application/json;charset=UTF-8",
  3353. dataType: "json",
  3354. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3355. success: function (res) {
  3356. if (res == '401' || res == 401) {
  3357. window.location.href = '/thmz/login/view'
  3358. return;
  3359. }
  3360. if (res.code == 0) {
  3361. res.data.forEach(function (item, index) {
  3362. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  3363. $('#patientsNature').append(html);
  3364. $('#editUserPatientsNature').append(html);
  3365. // $('#responeTypeBeHospitalized').append(html);
  3366. });
  3367. $('#patientsNature').selectpicker('refresh');
  3368. $('#editUserPatientsNature').selectpicker('refresh');
  3369. } else {
  3370. errorMesage(res);
  3371. }
  3372. }
  3373. });
  3374. }
  3375. /**
  3376. * 所有的入院状态
  3377. */
  3378. function iniAdmissStatus() {
  3379. $.ajax({
  3380. type: "GET",
  3381. url: '/thmz/getAdmissStatus',
  3382. dataType: "json",
  3383. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3384. success: function (res) {
  3385. if (res == '401' || res == 401) {
  3386. window.location.href = '/thmz/login/view'
  3387. return;
  3388. }
  3389. var html = '';
  3390. $.each(res.data, function (commentIndex, comment) {
  3391. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  3392. });
  3393. $('#admissStatus').empty();
  3394. $('#admissStatus').html(html);
  3395. $('#admissStatus').selectpicker('destroy').selectpicker('refresh');
  3396. }
  3397. });
  3398. }
  3399. /**
  3400. * 入院登记的病区列表
  3401. */
  3402. function initListDeptSelect() {
  3403. //科室列表
  3404. $.ajax({
  3405. type: "GET",
  3406. url: '/thmz/allInpatientWard',
  3407. dataType: "json",
  3408. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3409. success: function (data) {
  3410. if (data == '401' || data == 401) {
  3411. window.location.href = '/thmz/login/view'
  3412. return;
  3413. }
  3414. var html = '';
  3415. $.each(data.data, function (commentIndex, comment) {
  3416. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';
  3417. });
  3418. $('#inpatientWardBeHospitalized').empty();
  3419. $('#inpatientWardBeHospitalized').html(html);
  3420. $('#inpatientWardBeHospitalized').selectpicker('refresh');
  3421. initSmallDeptByDept();
  3422. }
  3423. });
  3424. }
  3425. /**
  3426. * 小科室列表
  3427. */
  3428. function initSmallDeptByDept() {
  3429. let code = escape($('#inpatientWardBeHospitalized').val()).replace(/\+/g, '%2B');
  3430. //小科室列表
  3431. $.ajax({
  3432. type: "GET",
  3433. url: '/thmz/getSmallDeptByDept?code=' + code,
  3434. dataType: "json",
  3435. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3436. success: function (res) {
  3437. if (res == '401' || res == 401) {
  3438. window.location.href = '/thmz/login/view'
  3439. return;
  3440. }
  3441. var html = '';
  3442. $.each(res.data, function (commentIndex, comment) {
  3443. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  3444. });
  3445. $('#smallWardBeHospitalized').empty();
  3446. $('#smallWardBeHospitalized').html(html);
  3447. $('#smallWardBeHospitalized').selectpicker('destroy').selectpicker('refresh');
  3448. }
  3449. });
  3450. //病床数
  3451. $.ajax({
  3452. type: "GET",
  3453. url: '/thmz/getBedStatusNumByDept?code=' + code,
  3454. dataType: "json",
  3455. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3456. success: function (res) {
  3457. if (res == '401' || res == 401) {
  3458. window.location.href = '/thmz/login/view'
  3459. return;
  3460. }
  3461. if (res.code == 0) {
  3462. var data = res.data;
  3463. if (data == null) {
  3464. $("#totalBedNum").val(0);
  3465. $("#freeBedNum").val(0);
  3466. $("#occupationBedNum").val(0);
  3467. } else {
  3468. $("#totalBedNum").val(data.total);
  3469. $("#freeBedNum").val(data.free);
  3470. $("#occupationBedNum").val(data.occupation);
  3471. }
  3472. } else {
  3473. errorMesage(res);
  3474. }
  3475. }
  3476. });
  3477. }
  3478. /**
  3479. * 初始化门诊统筹下拉选
  3480. */
  3481. function initMztcSelect() {
  3482. var selectHtml = '<option value="0">否</option><option value="1">是</option>';
  3483. $('#zgmztczf').html(selectHtml);
  3484. $('#zgmztczf').selectpicker('refresh');
  3485. $('#grzhzf').html(selectHtml);
  3486. $('#grzhzf').selectpicker('refresh');
  3487. }
  3488. /**
  3489. * 初始化医疗范文范围下拉选
  3490. * @param templateTypeId
  3491. */
  3492. function initTemplateTypeSelect(templateTypeId) {
  3493. $.ajax({
  3494. type: "GET",
  3495. url: '/thmz/getTemplateTypes',
  3496. contentType: "application/json;charset=UTF-8",
  3497. dataType: "json",
  3498. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3499. success: function (res) {
  3500. if (res == '401' || res == 401) {
  3501. window.location.href = '/thmz/login/view'
  3502. return;
  3503. }
  3504. if (res.code == 0) {
  3505. res.data.forEach(function (item) {
  3506. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  3507. $('#' + templateTypeId).append(html);
  3508. });
  3509. $('#' + templateTypeId).selectpicker('refresh');
  3510. // $('#'+templateTypeId).selectpicker('val', "0");
  3511. // $('#'+templateTypeId).selectpicker('refresh');
  3512. } else {
  3513. errorMesage(res);
  3514. }
  3515. }
  3516. });
  3517. }
  3518. /**
  3519. * 初始化医疗范文类型下拉选
  3520. * @param templateKindTypeId
  3521. */
  3522. function initTemplateKindTypeSelect(templateKindTypeId) {
  3523. $.ajax({
  3524. type: "GET",
  3525. url: '/thmz/getTemplateKindTypes',
  3526. contentType: "application/json;charset=UTF-8",
  3527. dataType: "json",
  3528. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3529. success: function (res) {
  3530. if (res == '401' || res == 401) {
  3531. window.location.href = '/thmz/login/view'
  3532. return;
  3533. }
  3534. if (res.code == 0) {
  3535. res.data.forEach(function (item) {
  3536. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  3537. $('#' + templateKindTypeId).append(html);
  3538. });
  3539. $('#' + templateKindTypeId).selectpicker('refresh');
  3540. } else {
  3541. errorMesage(res);
  3542. }
  3543. }
  3544. });
  3545. }
  3546. /**
  3547. * 初始频次下拉选
  3548. * @param id
  3549. * @param async 是否是异步 true 异步 false 同步
  3550. */
  3551. function initOrderFrequencys(id, async) {
  3552. $.ajax({
  3553. type: "GET",
  3554. url: '/thmz/getXyOrderFrequencys',
  3555. dataType: "json",
  3556. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3557. async: async,
  3558. success: function (res) {
  3559. if (res == '401' || res == 401) {
  3560. window.location.href = '/thmz/login/view'
  3561. return;
  3562. }
  3563. var html = '';
  3564. $.each(res.data, function (commentIndex, comment) {
  3565. html += '<option value="' + comment.code + '" desc="' + comment.times + '">' + comment.name + '(' + comment.code + ')' + '</option>';
  3566. });
  3567. $('#' + id).empty();
  3568. $('#' + id).html(html);
  3569. $('#' + id).selectpicker('refresh');
  3570. }
  3571. });
  3572. }
  3573. /**
  3574. * 初始中药频次下拉选
  3575. * @param id
  3576. * @param async 是否是异步 true 异步 false 同步
  3577. */
  3578. function initZyOrderFrequencys(id, async) {
  3579. $.ajax({
  3580. type: "GET",
  3581. url: '/thmz/getZyOrderFrequencys',
  3582. dataType: "json",
  3583. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3584. async: async,
  3585. success: function (res) {
  3586. if (res == '401' || res == 401) {
  3587. window.location.href = '/thmz/login/view'
  3588. return;
  3589. }
  3590. var html = '';
  3591. $.each(res.data, function (commentIndex, comment) {
  3592. html += '<option value="' + comment.code + '" desc="' + comment.times + '">' + comment.name + '(' + comment.code + ')' + '</option>';
  3593. });
  3594. $('#' + id).empty();
  3595. $('#' + id).html(html);
  3596. $('#' + id).selectpicker('refresh');
  3597. }
  3598. });
  3599. }
  3600. /**
  3601. * 初始中药服用说明
  3602. */
  3603. function initAllMzYshZdFysm() {
  3604. $.ajax({
  3605. type: "GET",
  3606. url: '/thmz/getAllMzYshZdFysm',
  3607. dataType: "json",
  3608. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3609. async: false,
  3610. success: function (res) {
  3611. if (res == '401' || res == 401) {
  3612. window.location.href = '/thmz/login/view'
  3613. return;
  3614. }
  3615. var html = '';
  3616. $.each(res.data, function (commentIndex, comment) {
  3617. if (comment.name.indexOf(",") < 0) {
  3618. //过滤组合的用法
  3619. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  3620. }
  3621. });
  3622. $('.useType').empty();
  3623. $('.useType').html(html);
  3624. $('.useType').selectpicker('refresh');
  3625. $('.useType').selectpicker('val', "2");
  3626. $('.useType').selectpicker('refresh');
  3627. }
  3628. });
  3629. }
  3630. /**
  3631. * 初始用药方式下拉选
  3632. */
  3633. function initSupplyTypes() {
  3634. $.ajax({
  3635. type: "GET",
  3636. url: '/thmz/getSupplyTypes',
  3637. dataType: "json",
  3638. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3639. success: function (res) {
  3640. if (res == '401' || res == 401) {
  3641. window.location.href = '/thmz/login/view'
  3642. return;
  3643. }
  3644. var html = '';
  3645. $.each(res.data, function (commentIndex, comment) {
  3646. if (comment.supplyOcc === "71") {
  3647. html += '<option value="' + comment.supplyCode + '">' + comment.supplyName + '[' + comment.pyCode + ']' + '</option>';
  3648. }
  3649. });
  3650. $('#supplyType').empty();
  3651. $('#supplyType').html(html);
  3652. $('#supplyType').selectpicker('refresh');
  3653. }
  3654. });
  3655. }
  3656. /**
  3657. * 初始煎药方式下拉选
  3658. * @param async 是否是异步 true 异步 false 同步
  3659. */
  3660. function initZySupplyTypes(id, async) {
  3661. setSelectSize();
  3662. $.ajax({
  3663. type: "GET",
  3664. url: '/thmz/getSupplyTypes',
  3665. dataType: "json",
  3666. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3667. async: async,
  3668. success: function (res) {
  3669. if (res == '401' || res == 401) {
  3670. window.location.href = '/thmz/login/view'
  3671. return;
  3672. }
  3673. var html = '';
  3674. $.each(res.data, function (commentIndex, comment) {
  3675. if (comment.supplyOcc === "81") {
  3676. // html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  3677. html += '<option value="' + comment.supplyCode + '">' + comment.supplyName + '[' + comment.pyCode + ']' + '</option>';
  3678. }
  3679. });
  3680. $('#' + id).empty();
  3681. $('#' + id).html(html);
  3682. $('#' + id).selectpicker('refresh');
  3683. }
  3684. });
  3685. }
  3686. /**
  3687. * 初始查检查部位
  3688. */
  3689. function initYshPart() {
  3690. setSelectSize();
  3691. $.ajax({
  3692. type: "GET",
  3693. url: '/thmz/getYshPart',
  3694. dataType: "json",
  3695. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3696. success: function (res) {
  3697. if (res == '401' || res == 401) {
  3698. window.location.href = '/thmz/login/view'
  3699. return;
  3700. }
  3701. var html = '';
  3702. $.each(res.data, function (commentIndex, comment) {
  3703. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')' + '</option>';
  3704. });
  3705. $('#yshPart').empty();
  3706. $('#yshPart').html(html);
  3707. $('#yshPart').selectpicker('refresh');
  3708. }
  3709. });
  3710. }
  3711. /**
  3712. * 初始化验物下拉选
  3713. */
  3714. function initJyZdSample() {
  3715. setSelectSize();
  3716. $.ajax({
  3717. type: "GET",
  3718. url: '/thmz/getJyZdSample',
  3719. dataType: "json",
  3720. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3721. success: function (res) {
  3722. if (res == '401' || res == 401) {
  3723. window.location.href = '/thmz/login/view'
  3724. return;
  3725. }
  3726. var html = '';
  3727. $.each(res.data, function (commentIndex, comment) {
  3728. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')' + '</option>';
  3729. });
  3730. $('#jyZdSample').empty();
  3731. $('#jyZdSample').html(html);
  3732. $('#jyZdSample').selectpicker('refresh');
  3733. }
  3734. });
  3735. }
  3736. /**
  3737. * 初始化当前医生说书科室
  3738. */
  3739. function initClinicDeptNo() {
  3740. $.ajax({
  3741. type: "GET",
  3742. url: '/thmz/getUnitCodeByCurrentUser',
  3743. dataType: "json",
  3744. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3745. success: function (res) {
  3746. if (res == '401' || res == 401) {
  3747. window.location.href = '/thmz/login/view'
  3748. return;
  3749. }
  3750. var html = '';
  3751. $.each(res.data, function (commentIndex, comment) {
  3752. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  3753. });
  3754. $('#clinicDeptNo').empty();
  3755. $('#clinicDeptNo').html(html);
  3756. $('#clinicDeptNo').selectpicker('refresh');
  3757. var userIdCode = localStorage.getItem("userIdCode");
  3758. var deptNo = localStorage.getItem(userIdCode);
  3759. if (deptNo != null && deptNo != "") {
  3760. $('#clinicDeptNo').selectpicker('val', deptNo);
  3761. $('#clinicDeptNo').selectpicker('refresh');
  3762. }
  3763. }
  3764. });
  3765. }
  3766. /**
  3767. * 保存当前药品到右边处方区域
  3768. * @param index 0 西药 1中药 2 诊疗和社备
  3769. */
  3770. function saveMedicine(index) {
  3771. if (index == 0) {
  3772. saveWesternMedicineWithCheck(true, null);
  3773. } else if (index == 1) {
  3774. saveChineseMedicine(true);
  3775. }
  3776. }
  3777. /**
  3778. * 保存当前药品到右边处方区域 西药
  3779. * calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  3780. * orderNoParmams
  3781. */
  3782. function saveWesternMedicineWithCheck(calculateTotalAmountFlag, orderNoParmams) {
  3783. //是新增药品还是编辑 true 修改 默认false
  3784. var updateFlag = $("#western_medicine_update_flag").val();
  3785. if (updateFlag == "true" || updateFlag == true) {
  3786. saveWesternMedicine(calculateTotalAmountFlag);
  3787. } else {
  3788. //当前药房编码
  3789. var currentGroupNo = $("#current_groupNo").val();
  3790. if (currentGroupNo == "") {
  3791. errorMesageSimaple("您未选择任何药品");
  3792. return;
  3793. }
  3794. if ($("#xyTab").find("li") == null || $("#xyTab").find("li").length == 0) {
  3795. initNavTabs(0, currentGroupNo, orderNoParmams);
  3796. }
  3797. var tableId = $("#xyTab li.active").find("a").attr("href");
  3798. var childrens = $(tableId).find("div:eq(0)").children().length;
  3799. var thisGroupNo = $(tableId).find("input.current_groupNo").val();
  3800. var flag = childrens === 5;
  3801. if (!calculateTotalAmountFlag) {
  3802. flag = childrens === 5 && $(tableId).is(':last-child');
  3803. }
  3804. if (thisGroupNo != null && thisGroupNo != '' && currentGroupNo != thisGroupNo) {
  3805. //当前编辑的处方与选中的品类非同一处方能保存的
  3806. var currentGroupNos = $("#xyTabContent").find("input.current_groupNo");
  3807. //是否需要新增处方页,以保存医材处方
  3808. var needAddTable = true;
  3809. for (var i = 0; i < currentGroupNos.length; i++) {
  3810. if ($(currentGroupNos[i]).val() == currentGroupNo) {
  3811. var next = $(currentGroupNos[i]).next();
  3812. if (needAddTable && $(next).children().length < 5) {
  3813. var parentId = $(currentGroupNos[i]).parent().attr("id");
  3814. //切换处方
  3815. $("#xyTab").find("a[href='#" + parentId + "']").off("click").tab('show');
  3816. //$("#xyTab").find("a[href='#" + tableId + "']").off("click").click();
  3817. //因为存在没有满5个的处方页,直接保存到该页
  3818. needAddTable = false;
  3819. }
  3820. }
  3821. }
  3822. if (needAddTable) {
  3823. //91 医材
  3824. var message = "医材需要单独处方,是否需要新增医材处方?";
  3825. if (currentGroupNo == '71') {
  3826. message = "普通西成药需要单独处方,是否需要新增处方?"
  3827. } else if (currentGroupNo == '111') {
  3828. message = "麻、精一药物需要单独处方,是否需要新增处方?"
  3829. } else if (currentGroupNo == '131') {
  3830. message = "精二药物需要单独处方,是否需要新增处方?"
  3831. }
  3832. if (calculateTotalAmountFlag) {
  3833. $("#messageModal").modal();
  3834. $("#messageContent").html(message);
  3835. $("#messageButton").off("click").on("click", function (t) {
  3836. $("#messageModal").modal("hide");
  3837. refreshNavTabs(0, currentGroupNo, orderNoParmams);
  3838. saveWesternMedicine(calculateTotalAmountFlag);
  3839. });
  3840. $("#cancelButton").off("click").on("click", function (t) {
  3841. return;
  3842. });
  3843. }
  3844. }
  3845. } else if (flag) {
  3846. if (calculateTotalAmountFlag) {
  3847. $("#messageModal").modal();
  3848. $("#messageContent").html("单张处方最多只能开具5个药品,是否需要新增处方?");
  3849. $("#messageButton").off("click").on("click", function (t) {
  3850. $("#messageModal").modal("hide");
  3851. refreshNavTabs(0, currentGroupNo, orderNoParmams);
  3852. saveWesternMedicine(calculateTotalAmountFlag);
  3853. });
  3854. $("#cancelButton").off("click").on("click", function (t) {
  3855. return;
  3856. });
  3857. }
  3858. } else {
  3859. saveWesternMedicine(calculateTotalAmountFlag);
  3860. }
  3861. }
  3862. }
  3863. /**
  3864. * 保存当前药品到右边处方区域 西药
  3865. * calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  3866. */
  3867. function saveWesternMedicine(calculateTotalAmountFlag) {
  3868. //当前药房编码
  3869. var currentGroupNo = $("#current_groupNo").val();
  3870. //药品名称
  3871. var westernMedicineNamme = $("#western_medicine_name").val();
  3872. var tableId = $("#xyTab li.active").find("a").attr("href");
  3873. if (tableId == undefined) {
  3874. refreshNavTabs(0, currentGroupNo, null);
  3875. tableId = $("#xyTab li.active").find("a").attr("href");
  3876. }
  3877. var thisGroupNo = $(tableId).find("input.current_groupNo").val();
  3878. if (currentGroupNo != thisGroupNo) {
  3879. //91 医材
  3880. var type = "医材";
  3881. if (currentGroupNo == '71') {
  3882. type = "普通西成药"
  3883. } else if (currentGroupNo == '111') {
  3884. type = "麻、精一药物"
  3885. } else if (currentGroupNo == '131') {
  3886. type = "精二药物"
  3887. }
  3888. errorMesageSimaple("【" + westernMedicineNamme + "】是" + type + ",无法保存到当前处方,请切换或者新增相应的处方进行保存。");
  3889. return;
  3890. }
  3891. //当前处方选项卡下标
  3892. var xyTabIndex = $("#xyTab li.active").index();
  3893. //组号
  3894. var groupId = $("#groupId").val();
  3895. if (groupId == null || groupId == '') {
  3896. errorMesageSimaple("组号为空,请选择组号!");
  3897. return;
  3898. }
  3899. groupId = parseInt(groupId);
  3900. if (groupId == null || isNaN(groupId)) {
  3901. errorMesageSimaple("组号为空,请选择组号!");
  3902. return;
  3903. }
  3904. if (gropuIdAndOrderNoMap == null) {
  3905. gropuIdAndOrderNoMap = new Map();
  3906. }
  3907. var exitIndex = gropuIdAndOrderNoMap.get(groupId);
  3908. if (exitIndex == null) {
  3909. exitIndex = xyTabIndex;
  3910. gropuIdAndOrderNoMap.put(groupId, xyTabIndex);
  3911. }
  3912. if (xyTabIndex != exitIndex) {
  3913. var westernMedicineUpdateFlag = $("#western_medicine_update_flag").val();
  3914. var westernMedicineOriGroupId = $("#western_medicine_ori_group_id").val();
  3915. //非修改组号的情况下就需要切换组号
  3916. if (!((westernMedicineUpdateFlag == true || westernMedicineUpdateFlag == "true") && westernMedicineOriGroupId != groupId)) {
  3917. groupId = parseInt($("#groupId > option:last").val());
  3918. $("#groupId").selectpicker('val', groupId);
  3919. $('#groupId').selectpicker('refresh');
  3920. gropuIdAndOrderNoMap.put(groupId, xyTabIndex);
  3921. appendGroupOrder();
  3922. }
  3923. warningMesageSimaple("同一组药必须出现在同一个处方中,当前组号已经被其他处方使用,系统已自动为您重新分配组号!");
  3924. //return;
  3925. }
  3926. //当前药品编码
  3927. var currentCode = $("#western_medicine_current_code").val();
  3928. //当前药品规格
  3929. var currentSerial = $("#western_medicine_current_serial").val();
  3930. //用法编码
  3931. var supplyType = $("#supplyType").val();
  3932. //用法描述
  3933. var supplyTypeText = $('#supplyType option:selected').text();
  3934. supplyTypeText = supplyTypeText.substring(0, supplyTypeText.indexOf("["));
  3935. //药品默认单次使用剂量
  3936. var drugWinDb = $("#drugWinDb").val();
  3937. //处方实际单次使用剂量
  3938. var drugWin = $("#drugWin").val();
  3939. //剂量单位
  3940. var drugWinUnit = $('#drugWinUnit option:selected').text();
  3941. //drugWinUnit = drugWinUnit.substring(0, drugWinUnit.indexOf("("));
  3942. //天数
  3943. var dayNum = $("#dayNum").val();
  3944. //频次编码
  3945. var orderFrequency = $("#orderFrequency").val();
  3946. //频次描述
  3947. var orderFrequencyText = $('#orderFrequency option:selected').text();
  3948. orderFrequencyText = orderFrequencyText.substring(0, orderFrequencyText.indexOf("("));
  3949. //总量
  3950. var gross = $("#gross").val();
  3951. //包装单位
  3952. var packUnit = $("#packUnit").val();
  3953. if (packUnit == null) {
  3954. packUnit = "";
  3955. }
  3956. //医嘱码
  3957. var medicalAdvice = $("#medicalAdvice").val();
  3958. //医嘱内容
  3959. var medicalAdviceText = $('#medicalAdvice option:selected').text();
  3960. medicalAdviceText = medicalAdviceText.substring(0, medicalAdviceText.indexOf("("));
  3961. //金额
  3962. var totalRetprice = parseFloat($("#totalRetprice").val());
  3963. //单价
  3964. var packRetprice = $("#packRetprice").val();
  3965. //皮试结果
  3966. var tryResult = $("#tryResult").val();
  3967. //药品大类标志
  3968. var categoriesFlag = $("#categoriesFlag").val();
  3969. if (currentCode == null || currentCode == '') {
  3970. if(calculateTotalAmountFlag){
  3971. errorMesageSimaple("未选择任何药品!");
  3972. }
  3973. return;
  3974. }
  3975. if (currentGroupNo != '91') {
  3976. if (supplyType == null || supplyType == "") {
  3977. errorMesageSimaple("用法为空!");
  3978. return;
  3979. }
  3980. if (drugWin == null || drugWin == "") {
  3981. errorMesageSimaple("剂量为空!");
  3982. return;
  3983. }
  3984. if (dayNum == null || dayNum == "") {
  3985. errorMesageSimaple("天数为空!");
  3986. return;
  3987. }
  3988. if (orderFrequency == null || orderFrequency == "") {
  3989. errorMesageSimaple("频次为空!");
  3990. return;
  3991. }
  3992. }
  3993. if (gross == null || gross == "") {
  3994. errorMesageSimaple("总量为空!");
  3995. return;
  3996. }
  3997. var manufactoryName = $("#manufactoryName").val();
  3998. var html = '<div class="form-group">';
  3999. html += '<span class="groupId">' + groupId + '</span>' + '.<span style="margin-left: 5px"></span>';
  4000. html += westernMedicineNamme;
  4001. if (manufactoryName != null && manufactoryName != 'null' && manufactoryName != "") {
  4002. html += "(" + manufactoryName + ")"
  4003. }
  4004. html += '&nbsp;&nbsp;&nbsp;&nbsp;';
  4005. html += $("#specification").val();
  4006. html += '&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;';
  4007. //html += drugWinDb + drugWinUnit + ' 共';
  4008. html += gross + packUnit + " " + '<br/><span style="margin-left: 15px"></span>';
  4009. html += '用法:' + supplyTypeText + ' ';
  4010. html += drugWin + drugWinUnit + ' ';
  4011. html += '频次:' + orderFrequencyText + ' ';
  4012. html += dayNum + '天 ';
  4013. if (tryResult != null && tryResult != 'null' && tryResult != "") {
  4014. if (tryResult == "100" || tryResult == 100) {
  4015. html += '皮试 ';
  4016. } else {
  4017. html += '皮试结果: ' + $('#tryResult option:selected').text();
  4018. }
  4019. }
  4020. if (medicalAdvice != null && medicalAdvice != '') {
  4021. html += '医嘱:' + medicalAdviceText;
  4022. }
  4023. 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>';
  4024. 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>';
  4025. html += ' <i class="fa fa-long-arrow-left" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;" onclick="editWesternMedicine(this)"></i>';
  4026. 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>';
  4027. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  4028. html += '<input type="hidden" class="temporary_items_serial" value="' + currentSerial + '"/>';
  4029. html += '<input type="hidden" class="temporary_items_amount" value="' + totalRetprice + '"/>';
  4030. html += '<input type="hidden" class="temporary_items_groupId" value="' + groupId + '"/>';
  4031. html += '<input type="hidden" class="temporary_items_westernMedicineNamme" value="' + westernMedicineNamme + '"/>';
  4032. html += '<input type="hidden" class="temporary_items_drugWinDb" value="' + drugWinDb + '"/>';
  4033. html += '<input type="hidden" class="temporary_items_drugWin" value="' + drugWin + '"/>';
  4034. html += '<input type="hidden" class="temporary_items_drugWinUnit" value="' + $("#drugWinUnit").val() + '"/>';
  4035. html += '<input type="hidden" class="temporary_items_gross" value="' + gross + '"/>';
  4036. html += '<input type="hidden" class="temporary_items_packUnit" value="' + packUnit + '"/>';
  4037. html += '<input type="hidden" class="temporary_items_supplyType" value="' + supplyType + '"/>';
  4038. html += '<input type="hidden" class="temporary_items_orderFrequency" value="' + orderFrequency + '"/>';
  4039. html += '<input type="hidden" class="temporary_items_dayNum" value="' + dayNum + '"/>';
  4040. html += '<input type="hidden" class="temporary_items_medicalAdvice" value="' + medicalAdvice + '"/>';
  4041. html += '<input type="hidden" class="temporary_items_medicalAdviceText" value="' + medicalAdviceText + '"/>';
  4042. html += '<input type="hidden" class="temporary_items_packRetprice" value="' + packRetprice + '"/>';
  4043. html += '<input type="hidden" class="temporary_items_tryResult" value="' + tryResult + '"/>';
  4044. html += '<input type="hidden" class="temporary_items_currentGroupNo" value="' + currentGroupNo + '"/>';
  4045. html += '<input type="hidden" class="temporary_items_categoriesFlag" value="' + categoriesFlag + '"/>';
  4046. html += '</div>';
  4047. var tableId = $("#xyTab li.active").find("a").attr("href");
  4048. //是新增药品还是编辑 true 修改 默认false
  4049. var updateFlag = $("#western_medicine_update_flag").val();
  4050. if (updateFlag == undefined || updateFlag == null) {
  4051. updateFlag = false;
  4052. }
  4053. // //原药品金额 如果是修改则需要设置
  4054. // var temporaryItemsAmount = 0;
  4055. //当前需要被移除元素的下个兄弟节点
  4056. var nextObj = null;
  4057. //当前修改的药品是不是最后一个
  4058. var isLast = false;
  4059. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  4060. if (formGroups != null && formGroups.length > 0) {
  4061. //如果是修改,需要减去原来的费用
  4062. if (updateFlag == "true" || updateFlag == true) {
  4063. //药品有可能会修改,所以,判断的时候要用原药品编码
  4064. var updateOriCode = $("#update_ori_code").val();
  4065. //规格有可能会修改,所以,判断的时候要用原规格
  4066. var updateOriSerial = $("#update_ori_serial").val();
  4067. //组号有可能会修改,所以,判断的时候要用原组号
  4068. var westernMedicineOriGroupId = $("#western_medicine_ori_group_id").val();
  4069. for (var i = 0; i < formGroups.length; i++) {
  4070. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  4071. var temporaryItemsSerial = $(formGroups[i]).find("input.temporary_items_serial").val();
  4072. var temporaryItemsGroupId = $(formGroups[i]).find("input.temporary_items_groupId").val();
  4073. if (temporaryItemsCode === updateOriCode && temporaryItemsSerial === updateOriSerial && temporaryItemsGroupId == westernMedicineOriGroupId) {
  4074. //temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  4075. if (formGroups.length > 1) {
  4076. nextObj = $(formGroups[i]).next();
  4077. }
  4078. isLast = (i + 1) === formGroups.length;
  4079. $(formGroups[i]).remove();
  4080. break;
  4081. }
  4082. }
  4083. } else {
  4084. //因为药品可以换组号,要保证相同组号的在一起
  4085. for (var i = 0; i < formGroups.length; i++) {
  4086. var temporaryItemsGroupId = parseInt($(formGroups[i]).find("input.temporary_items_groupId").val());
  4087. //如果当前的组号小与遍历到的组号,说明是原组号的下一个兄弟节点,新的药品插入到兄弟节点前就可以了
  4088. if (temporaryItemsGroupId > groupId) {
  4089. nextObj = $(formGroups[i]);
  4090. break;
  4091. }
  4092. }
  4093. }
  4094. }
  4095. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  4096. if (nextObj == null || isLast) {
  4097. $(tableId).find("div:eq(0)").append(html);
  4098. } else {
  4099. $(nextObj).before(html);
  4100. }
  4101. //设置当前处方金额
  4102. //calculateCfAmount(tableId, totalRetprice, temporaryItemsAmount, 0, 0);
  4103. if (calculateTotalAmountFlag) {
  4104. //设置总金额
  4105. calculateTotalAmount(true);
  4106. resetGroupIdSelect();
  4107. }
  4108. //判断当前组号是不是最后一个,是最后一个组号,就需要新增组号
  4109. var groupIdLast = $("#groupId option:last-child").text();
  4110. if (groupId === groupIdLast) {
  4111. appendGroupOrder();
  4112. }
  4113. //设置药品的用法,频次,天数
  4114. var map = groupIdMap.get(groupId);
  4115. if (map == null) {
  4116. map = new Map();
  4117. map.put("supplyType", supplyType);
  4118. map.put("orderFrequency", orderFrequency);
  4119. map.put("dayNum", dayNum);
  4120. groupIdMap.put(groupId, map);
  4121. }
  4122. //设置当前药品的品类
  4123. $(tableId).find("input.current_groupNo").val($("#current_groupNo").val());
  4124. clearWesternMedicine(false);
  4125. resetGroupIdMap();
  4126. }
  4127. /**
  4128. * 上移
  4129. * @param obj
  4130. */
  4131. function arrowUp(obj) {
  4132. var parentObject = $(obj).parent();
  4133. if ($(parentObject).prev() == null) {
  4134. return;
  4135. }
  4136. //当前元素的序号
  4137. var thisJcjyItemGroupId = null;
  4138. //前一个兄弟节点的序号
  4139. var prevJcjyItemGroupId = null;
  4140. //当是项目时有序号,进行序号调整
  4141. if ($(parentObject).find("span.jcjyItemGroupId") != null) {
  4142. thisJcjyItemGroupId = $(parentObject).find("span.jcjyItemGroupId").html();
  4143. prevJcjyItemGroupId = $(parentObject).prev().find("span.jcjyItemGroupId").html();
  4144. $(parentObject).find("span.jcjyItemGroupId").html(prevJcjyItemGroupId);
  4145. $(parentObject).prev().find("span.jcjyItemGroupId").html(thisJcjyItemGroupId);
  4146. }
  4147. $(parentObject).prev().before($(parentObject));
  4148. }
  4149. /**
  4150. * 下移
  4151. * @param obj
  4152. */
  4153. function arrowDown(obj) {
  4154. var parentObject = $(obj).parent();
  4155. if ($(parentObject).next() == null) {
  4156. return;
  4157. }
  4158. //当前元素的序号
  4159. var thisJcjyItemGroupId = null;
  4160. //后一个兄弟节点的序号
  4161. var afterJcjyItemGroupId = null;
  4162. //当是项目时有序号,进行序号调整
  4163. if ($(parentObject).find("span.jcjyItemGroupId") != null) {
  4164. thisJcjyItemGroupId = $(parentObject).find("span.jcjyItemGroupId").html();
  4165. afterJcjyItemGroupId = $(parentObject).after().find("span.jcjyItemGroupId").html();
  4166. $(parentObject).find("span.jcjyItemGroupId").html(afterJcjyItemGroupId);
  4167. $(parentObject).after().find("span.jcjyItemGroupId").html(thisJcjyItemGroupId);
  4168. }
  4169. $(parentObject).next().after($(parentObject));
  4170. }
  4171. /**
  4172. * 修改西药
  4173. * @param obj
  4174. */
  4175. function editWesternMedicine(obj) {
  4176. clearWesternMedicine(true);
  4177. //是新增药品还是编辑 true 修改 默认false
  4178. $("#western_medicine_update_flag").val(true);
  4179. var parentObject = $(obj).parent();
  4180. //组号
  4181. $("#groupId").val($(parentObject).find("input.temporary_items_groupId").val());
  4182. //组号有可能会修改,所以,判断的时候要用原组号
  4183. $("#western_medicine_ori_group_id").val($(parentObject).find("input.temporary_items_groupId").val());
  4184. $('#groupId').selectpicker('refresh');
  4185. //药品名称
  4186. $("#western_medicine_name").val($(parentObject).find("input.temporary_items_westernMedicineNamme").val());
  4187. var code = $(parentObject).find("input.temporary_items_code").val();
  4188. var serial = $(parentObject).find("input.temporary_items_serial").val();
  4189. //当前药品编码
  4190. $("#western_medicine_current_code").val(code);
  4191. //当前药品规格
  4192. $("#western_medicine_current_serial").val(serial);
  4193. //当前修改药品原始编码
  4194. $("#update_ori_code").val(code);
  4195. //当前修改的药品原始规格
  4196. $("#update_ori_serial").val(serial);
  4197. //用法编码
  4198. $("#supplyType").val($(parentObject).find("input.temporary_items_supplyType").val());
  4199. $('#supplyType').selectpicker('refresh');
  4200. //药品默认单次使用剂量
  4201. $("#drugWinDb").val($(parentObject).find("input.temporary_items_drugWinDb").val());
  4202. //处方实际单次使用剂量
  4203. $("#drugWin").val($(parentObject).find("input.temporary_items_drugWin").val());
  4204. //天数
  4205. $("#dayNum").val($(parentObject).find("input.temporary_items_dayNum").val());
  4206. $('#dayNum').selectpicker('refresh');
  4207. //频次编码
  4208. $("#orderFrequency").val($(parentObject).find("input.temporary_items_orderFrequency").val());
  4209. $('#orderFrequency').selectpicker('refresh');
  4210. //总量
  4211. $("#gross").val($(parentObject).find("input.temporary_items_gross").val());
  4212. //医嘱
  4213. $("#medicalAdvice").val($(parentObject).find("input.temporary_items_medicalAdvice").val());
  4214. $('#medicalAdvice').selectpicker('refresh');
  4215. //金额
  4216. $("#totalRetprice").val($(parentObject).find("input.temporary_items_amount").val());
  4217. //单价
  4218. $("#packRetprice").val($(parentObject).find("input.temporary_items_packRetprice").val());
  4219. //皮试结果
  4220. var tryResult = $(parentObject).find("input.temporary_items_tryResult").val();
  4221. //设置当前药品类型
  4222. $("#current_groupNo").val($(parentObject).find("input.temporary_items_currentGroupNo").val());
  4223. //设置当前药品大类
  4224. $("#categoriesFlag").val($(parentObject).find("input.temporary_items_categoriesFlag").val());
  4225. $.ajax({
  4226. type: "GET",
  4227. url: '/thmz/getYpZdDictByCodeAndSerial?code=' + code + "&serial=" + serial + "&deptNo=" + localStorage.getItem("currentDeptNo") + "&groupNo=71",
  4228. contentType: "application/json;charset=UTF-8",
  4229. dataType: "json",
  4230. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4231. success: function (res) {
  4232. if (res == '401' || res == 401) {
  4233. window.location.href = '/thmz/login/view'
  4234. return;
  4235. }
  4236. if (res.code == 0) {
  4237. if (res.data != null) {
  4238. var drugWinHtml = '';
  4239. if (res.data.weight != null) {
  4240. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  4241. $("#drugWin").val(res.data.weight);
  4242. $("#drugWinDb").val(res.data.weight);
  4243. }
  4244. drugWinHtml = '<option value="' + res.data.weighUnit + '" desc="' + res.data.weight + '">' + res.data.weighUnitDesc + '</option>';
  4245. }
  4246. if (res.data.volum != null) {
  4247. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  4248. $("#drugWin").val(res.data.volum);
  4249. $("#drugWinDb").val(res.data.volum);
  4250. }
  4251. drugWinHtml += '<option value="' + res.data.volUnit + '" desc="' + res.data.volum + '">' + res.data.volUnitDesc + '</option>';
  4252. }
  4253. if (res.data.miniUnit != null && res.data.miniUnit != "") {
  4254. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  4255. $("#drugWin").val(1);
  4256. $("#drugWinDb").val(1);
  4257. }
  4258. drugWinHtml += '<option value="' + res.data.miniUnit + '" desc="1">' + res.data.miniUnitDesc + '</option>';
  4259. }
  4260. $('#drugWinUnit').html(drugWinHtml);
  4261. $('#drugWinUnit').selectpicker('refresh');
  4262. //剂量单位
  4263. $("#drugWinUnit").val($(parentObject).find("input.temporary_items_drugWinUnit").val());
  4264. $('#drugWinUnit').selectpicker('refresh');
  4265. if (res.data.packUnitDesc != null && res.data.packUnitDesc != "") {
  4266. var html = '<option value="' + res.data.packUnitDesc + '" >' + res.data.packUnitDesc + '</option>';
  4267. $('#packUnit').html(html);
  4268. $('#packUnit').selectpicker('refresh');
  4269. //包装单位
  4270. $("#packUnit").val($(parentObject).find("input.temporary_items_packUnit").val());
  4271. $('#packUnit').selectpicker('refresh');
  4272. }
  4273. if (res.data.psFlag != null && (res.data.psFlag == 1 || res.data.psFlag == "1")) {
  4274. if (res.data.categoriesFlag == 0 || res.data.categoriesFlag == "0" || res.data.categoriesFlag == 2 || res.data.categoriesFlag == "2") {
  4275. initTryResultSelect(res.data.categoriesFlag);
  4276. $("#tryResult").val(tryResult);
  4277. $('#tryResult').selectpicker('refresh');
  4278. }
  4279. }
  4280. $("#packSize").val(res.data.packSize);
  4281. //厂家名称
  4282. $("#manufactoryName").val(res.data.manufactoryName);
  4283. //规格
  4284. $("#specification").val(res.data.specification);
  4285. }
  4286. } else {
  4287. errorMesage(res);
  4288. }
  4289. }
  4290. });
  4291. }
  4292. /**
  4293. * 修改中药
  4294. * @param obj
  4295. */
  4296. function editChineseMedicine(obj) {
  4297. //是新增药品还是编辑 true 修改 默认false
  4298. $("#chinese_medicine_update_flag").val(true);
  4299. var parentObject = $(obj).parent();
  4300. //当前药品编码
  4301. $("#chinese_medicine_current_code").val($(parentObject).find("input.temporary_items_code").val());
  4302. //当前药品规格
  4303. $("#chinese_medicine_current_serial").val($(parentObject).find("input.temporary_items_serial").val());
  4304. //当前修改药品原始编码
  4305. $("#update_ori_code").val($(parentObject).find("input.temporary_items_code").val());
  4306. //当前修改的药品原始规格
  4307. $("#update_ori_serial").val($(parentObject).find("input.temporary_items_serial").val());
  4308. //中药类型
  4309. $("#zyClassType").val($(parentObject).find("input.temporary_items_zyClassType").val());
  4310. $('#zyClassType').selectpicker('refresh');
  4311. //药品名称
  4312. $("#chinese_medicine_name").val($(parentObject).find("input.temporary_items_chineseMedicineNamme").val());
  4313. //单价
  4314. $("#zy_packRetprice").val($(parentObject).find("input.temporary_items_zyPackRetprice").val());
  4315. //处方实际单次使用剂量
  4316. $("#zy_drugWin").val($(parentObject).find("input.temporary_items_drugWin").val());
  4317. //医嘱码
  4318. $("#zyInstruction").val($(parentObject).find("input.temporary_items_zyInstruction").val());
  4319. $('#zyInstruction').selectpicker('refresh');
  4320. }
  4321. /**
  4322. * 修改辅助检查、检验项目
  4323. * @param obj
  4324. */
  4325. function editJyJcItem(obj) {
  4326. //是新增药品还是编辑 true 修改 默认false
  4327. $("#jcjy_update_flag").val(true);
  4328. var parentObject = $(obj).parent();
  4329. //当前项目编码
  4330. $("#jcjy_current_code").val($(parentObject).find("input.temporary_items_code").val());
  4331. $("#update_ori_code").val($(parentObject).find("input.temporary_items_code").val());
  4332. //项目名称
  4333. $("#jcJyItem").val($(parentObject).find("input.temporary_items_jcJyItemName").val());
  4334. //单价
  4335. $("#jcjyItemPrice").val($(parentObject).find("input.temporary_items_amount").val());
  4336. //备注
  4337. $("#remark").val($(parentObject).find("input.temporary_items_remark").val());
  4338. var chargeUnit = $(parentObject).find("input.temporary_items_desc_value").val();
  4339. var jcJyZltype = $(parentObject).find("input.temporary_items_type").val();
  4340. //执行科室
  4341. var execUnit = $(parentObject).find("input.temporary_items_execUnit").val();
  4342. $("#execUnit").selectpicker('val', execUnit);
  4343. $('#execUnit').selectpicker('refresh');
  4344. if (jcJyZltype == 1 || jcJyZltype == "1") {
  4345. $("#jyZdSample").selectpicker('val', chargeUnit);
  4346. $('#jyZdSample').selectpicker('refresh');
  4347. $("#jyZdSampleDiv").removeClass("hide").addClass("in");
  4348. $("#yshPartDiv").removeClass("in").addClass("hide");
  4349. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  4350. } else if (jcJyZltype == 2 || jcJyZltype == "2") {
  4351. $("#yshPart").selectpicker('val', chargeUnit);
  4352. $('#yshPart').selectpicker('refresh');
  4353. $("#yshPartDiv").removeClass("hide").addClass("in");
  4354. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  4355. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  4356. }
  4357. $("#jcJyZltype").val(jcJyZltype);
  4358. }
  4359. /**
  4360. * 修改诊疗项目
  4361. * @param obj
  4362. */
  4363. function editZlItem(obj) {
  4364. //是新增药品还是编辑 true 修改 默认false
  4365. $("#zl_update_flag").val(true);
  4366. var parentObject = $(obj).parent();
  4367. //当前项目编码
  4368. $("#zl_current_code").val($(parentObject).find("input.temporary_items_code").val());
  4369. $("#update_ori_code").val($(parentObject).find("input.temporary_items_code").val());
  4370. //项目名称
  4371. $("#zlItem").val($(parentObject).find("input.temporary_items_zlItemName").val());
  4372. //单价
  4373. $("#zlItemPrice").val($(parentObject).find("input.temporary_items_amount").val());
  4374. //备注
  4375. $("#zlRemark").val($(parentObject).find("input.temporary_items_remark").val());
  4376. var chargeUnit = $(parentObject).find("input.temporary_items_desc_value").val();
  4377. //数量
  4378. var itemQuantity = $(parentObject).find("input.temporary_items_itemQuantity").val();
  4379. //执行科室
  4380. var execUnit = $(parentObject).find("input.temporary_items_execUnit").val();
  4381. var descriptions = $(parentObject).find("input.temporary_items_code").val();
  4382. if (descriptions != null && descriptions != "" && descriptions != 'null') {
  4383. $("#descriptions").val(descriptions);
  4384. }
  4385. var dayZlNum = $(parentObject).find("input.temporary_items_dayZlNum").val();
  4386. if (dayZlNum != null && dayZlNum != "" && dayZlNum != 'null') {
  4387. $("#dayZlNum").selectpicker('val', dayZlNum);
  4388. $('#dayZlNum').selectpicker('refresh');
  4389. }
  4390. var orderFrequencyZl = $(parentObject).find("input.temporary_items_orderFrequencyZl").val();
  4391. if (orderFrequencyZl != null && orderFrequencyZl != "" && orderFrequencyZl != 'null') {
  4392. $("#orderFrequencyZl").selectpicker('val', orderFrequencyZl);
  4393. $('#orderFrequencyZl').selectpicker('refresh');
  4394. }
  4395. var totalNumZl = $(parentObject).find("input.temporary_items_totalNumZl").val();
  4396. if (totalNumZl != null && totalNumZl != "" && totalNumZl != 'null') {
  4397. $("#totalNumZl").val(totalNumZl);
  4398. }
  4399. $("#zlExecUnit").selectpicker('val', execUnit);
  4400. $('#zlExecUnit').selectpicker('refresh');
  4401. //描述
  4402. $("#chargeUnit").val(chargeUnit);
  4403. $("#itemQuantity").val(itemQuantity);
  4404. calculateZl(true);
  4405. }
  4406. /**
  4407. * 保存当前辅助检查、检验项目到右边处方区域 需要提示加价
  4408. * @param calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  4409. */
  4410. function saveJyJcItem(calculateTotalAmountFlag) {
  4411. //6岁内提示加价
  4412. var patientAge = $("#patientAge").text();
  4413. if (calculateTotalAmountFlag && patientAge != null && patientAge != "" && patientAge < 6) {
  4414. $.ajax({
  4415. type: "GET",
  4416. url: '/thmz/checkAdditionally?code=' + $("#jcjy_current_code").val() + "&jcJyZltype=" + $("#jcJyZltype").val(),
  4417. contentType: "application/json;charset=UTF-8",
  4418. dataType: "json",
  4419. async: false,
  4420. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4421. success: function (res) {
  4422. if (res == '401' || res == 401) {
  4423. window.location.href = '/thmz/login/view'
  4424. return;
  4425. }
  4426. if (res.code == 0) {
  4427. if (res.data != undefined && res.data != null && res.data.co != null && res.data.co == 1 && res.data.xlCode != null && res.data.xlCode != "") {
  4428. var xlCode = res.data.xlCode;
  4429. xlCode = Multiply(100, xlCode);
  4430. $("#messageModal").modal();
  4431. $("#messageContent").html("根据【湘医保发〔2020〕51 号】价格通知,6岁以内的小朋友诊疗费上调" + xlCode + "%,是否需要继续添加该项目?");
  4432. $("#messageButton").off("click").on("click", function (t) {
  4433. $("#messageModal").modal("hide");
  4434. saveJyJcItemReal(calculateTotalAmountFlag);
  4435. });
  4436. $("#cancelButton").off("click");
  4437. } else {
  4438. //虽然是不满6岁,但是也没有需要加收的项目,直接保存
  4439. saveJyJcItemReal(calculateTotalAmountFlag);
  4440. }
  4441. } else {
  4442. errorMesage(res);
  4443. }
  4444. }
  4445. });
  4446. } else {
  4447. saveJyJcItemReal(calculateTotalAmountFlag);
  4448. }
  4449. }
  4450. /**
  4451. * 保存当前项目到右边处方区域
  4452. * @param calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  4453. */
  4454. function saveJyJcItemReal(calculateTotalAmountFlag) {
  4455. var tableId = $("#jcjyTab li.active").find("a").attr("href");
  4456. //组号
  4457. var groupId = $(tableId).find("div:eq(0)").children().length + 1;
  4458. //项目名称
  4459. var jcJyItem = $("#jcJyItem").val();
  4460. //当前项目编码
  4461. var currentCode = $("#jcjy_current_code").val();
  4462. //当前项目价格
  4463. var jcjyItemPrice = $("#jcjyItemPrice").val();
  4464. //执行科室
  4465. var execUnit = $("#execUnit").val();
  4466. //执行科室
  4467. var execUnitName = $('#execUnit option:selected').text();
  4468. execUnitName = execUnitName.substring(0, execUnitName.indexOf("("));
  4469. //描述编码
  4470. var chargeUnitCode = null;
  4471. var chargeUnitName = "";
  4472. //检验物或者检查部位
  4473. var chargeUnit = null;
  4474. //备注
  4475. var remark = $("#remark").val();
  4476. //项目类型
  4477. var jcJyZltype = $("#jcJyZltype").val();
  4478. if (jcJyZltype == "1" || jcJyZltype == 1) {
  4479. //检验
  4480. chargeUnit = $('#jyZdSample option:selected').text();
  4481. chargeUnit = chargeUnit.substring(0, chargeUnit.indexOf("("));
  4482. chargeUnitCode = $('#jyZdSample').val();
  4483. chargeUnitName = " 检验物:";
  4484. } else if (jcJyZltype == "2" || jcJyZltype == 2) {
  4485. //检查
  4486. chargeUnit = $('#yshPart option:selected').text();
  4487. chargeUnit = chargeUnit.substring(0, chargeUnit.indexOf("("));
  4488. chargeUnitCode = $('#yshPart').val();
  4489. chargeUnitName = " 检查部位:";
  4490. }
  4491. if (currentCode == null || currentCode == '') {
  4492. if (calculateTotalAmountFlag == true) {
  4493. errorMesageSimaple("未选择任何项目!");
  4494. }
  4495. return;
  4496. }
  4497. //判断是否有重复的项目 返回true 说明有重复的
  4498. //彩超加收一个部位的不限制多开
  4499. if ("003913" != currentCode && verifyRepeat(currentCode, null, chargeUnitCode, 2)) {
  4500. return;
  4501. }
  4502. //原药品金额 如果是修改则需要设置
  4503. var temporaryItemsAmount = 0;
  4504. //当前需要被移除元素的下个兄弟节点
  4505. var nextObj = null;
  4506. //当前修改的药品是不是最后一个
  4507. var isLast = false;
  4508. //是新增药品还是编辑 true 修改 默认false
  4509. var updateFlag = $("#jcjy_update_flag").val();
  4510. if (updateFlag == undefined || updateFlag == null) {
  4511. updateFlag = false;
  4512. }
  4513. //如果是修改,需要减去原来的费用
  4514. //原组号
  4515. var oriGroupId = null;
  4516. if (updateFlag == "true" || updateFlag == true) {
  4517. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  4518. if (formGroups != null && formGroups.length > 0) {
  4519. var updateOriCode = $("#update_ori_code").val();
  4520. for (var i = 0; i < formGroups.length; i++) {
  4521. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  4522. if (temporaryItemsCode === updateOriCode) {
  4523. temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  4524. if (formGroups.length > 1) {
  4525. nextObj = $(formGroups[i]).next();
  4526. }
  4527. isLast = (i + 1) === formGroups.length;
  4528. oriGroupId = $(formGroups[i]).find("span.jcjyItemGroupId").text();
  4529. $(formGroups[i]).remove();
  4530. break;
  4531. }
  4532. }
  4533. }
  4534. }
  4535. if (oriGroupId != null) {
  4536. groupId = oriGroupId;
  4537. }
  4538. var html = '<div class="form-group">';
  4539. html += '<span class="jcjyItemGroupId">' + groupId + '</span>.<span style="margin-left: 5px"></span>'
  4540. html += jcJyItem + ' ';
  4541. if (jcJyZltype == "3" || jcJyZltype == 3) {
  4542. html += " 数量:" + itemQuantity;
  4543. }
  4544. if (execUnit != null && execUnit != "") {
  4545. html += " 执行科室:" + execUnitName;
  4546. }
  4547. if (chargeUnit != null && chargeUnit != '') {
  4548. html += chargeUnitName + chargeUnit;
  4549. }
  4550. if (remark != null && remark != '') {
  4551. html += ' 备注:' + remark;
  4552. }
  4553. 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>';
  4554. 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>';
  4555. 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>';
  4556. 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>';
  4557. if ($("#jcJyItemChargeDetail").hasClass("in")) {
  4558. 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>';
  4559. }
  4560. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  4561. html += '<input type="hidden" class="temporary_items_jcJyItemName" value="' + jcJyItem + '"/>';
  4562. html += '<input type="hidden" class="temporary_items_amount" value="' + jcjyItemPrice + '"/>';
  4563. html += '<input type="hidden" class="temporary_items_remark" value="' + remark + '"/>';
  4564. html += '<input type="hidden" class="temporary_items_type" value="' + jcJyZltype + '"/>';
  4565. html += '<input type="hidden" class="temporary_items_desc_value" value="' + chargeUnitCode + '"/>';
  4566. html += '<input type="hidden" class="temporary_items_execUnit" value="' + execUnit + '"/>';
  4567. html += '</div>';
  4568. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  4569. if (nextObj == null || isLast) {
  4570. $(tableId).find("div:eq(0)").append(html);
  4571. } else {
  4572. $(nextObj).before(html);
  4573. }
  4574. //设置当前处方金额
  4575. //calculateCfAmount(tableId, jcjyItemPrice, temporaryItemsAmount, 2, 0);
  4576. if (calculateTotalAmountFlag) {
  4577. //设置总金额
  4578. calculateTotalAmount(true);
  4579. }
  4580. clearJyJcItem();
  4581. }
  4582. /**
  4583. * 保存当前诊疗项目到右边处方区域 需要提示加价
  4584. * @param calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  4585. */
  4586. function saveZlItem(calculateTotalAmountFlag) {
  4587. //6岁内提示加价
  4588. var patientAge = $("#patientAge").text();
  4589. if (calculateTotalAmountFlag && patientAge != null && patientAge != "" && patientAge < 6) {
  4590. $.ajax({
  4591. type: "GET",
  4592. url: '/thmz/checkAdditionally?code=' + $("#zl_current_code").val() + "&jcJyZltype=3",
  4593. contentType: "application/json;charset=UTF-8",
  4594. dataType: "json",
  4595. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4596. async: false,
  4597. success: function (res) {
  4598. if (res == '401' || res == 401) {
  4599. window.location.href = '/thmz/login/view'
  4600. return;
  4601. }
  4602. if (res.code == 0) {
  4603. if (res.data != undefined && res.data != null && res.data.co != null && res.data.co == 1 && res.data.xlCode != null && res.data.xlCode != "") {
  4604. var xlCode = res.data.xlCode;
  4605. xlCode = Multiply(100, xlCode);
  4606. $("#messageModal").modal();
  4607. $("#messageContent").html("根据【湘医保发〔2020〕51 号】价格通知,6岁以内的小朋友诊疗费上调" + xlCode + "%,是否需要继续添加该项目?");
  4608. $("#messageButton").off("click").on("click", function (t) {
  4609. $("#messageModal").modal("hide");
  4610. saveZlItemReal(calculateTotalAmountFlag);
  4611. });
  4612. $("#cancelButton").off("click");
  4613. } else {
  4614. //虽然是不满6岁,但是也没有需要加收的项目,直接保存
  4615. saveZlItemReal(calculateTotalAmountFlag);
  4616. }
  4617. } else {
  4618. errorMesage(res);
  4619. }
  4620. }
  4621. });
  4622. } else {
  4623. saveZlItemReal(calculateTotalAmountFlag);
  4624. }
  4625. }
  4626. /**
  4627. * 保存当前项目到右边处方区域
  4628. * @param calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  4629. */
  4630. function saveZlItemReal(calculateTotalAmountFlag) {
  4631. var tableId = $("#zlTab li.active").find("a").attr("href");
  4632. //组号
  4633. var groupId = $(tableId).find("div:eq(0)").children().length + 1;
  4634. //项目名称
  4635. var zlItem = $("#zlItem").val();
  4636. //当前项目编码
  4637. var currentCode = $("#zl_current_code").val();
  4638. //当前项目价格
  4639. var zlItemPrice = $("#zlItemPrice").val();
  4640. //单位
  4641. var chargeUnit = $("#chargeUnit").val();
  4642. //执行科室
  4643. var zlExecUnit = $("#zlExecUnit").val();
  4644. //执行科室
  4645. var zlExecUnitName = $('#zlExecUnit option:selected').text();
  4646. zlExecUnitName = zlExecUnitName.substring(0, zlExecUnitName.indexOf("("));
  4647. //单量
  4648. var itemQuantity = $("#itemQuantity").val();
  4649. //规格
  4650. var descriptions = $("#descriptions").val();
  4651. //天数
  4652. var dayZlNum = $("#dayZlNum").val();
  4653. //频次
  4654. var orderFrequencyZl = $("#orderFrequencyZl").val();
  4655. //总量
  4656. var totalNumZl = $("#totalNumZl").val();
  4657. //描述编码
  4658. var chargeUnitCode = chargeUnit;
  4659. //备注
  4660. var remark = $("#zlRemark").val();
  4661. if (calculateTotalAmountFlag == true) {
  4662. if (currentCode == null || currentCode == '') {
  4663. errorMesageSimaple("未选择任何项目!");
  4664. return;
  4665. }
  4666. if (totalNumZl == null || totalNumZl == "" || totalNumZl == "null") {
  4667. errorMesageSimaple("项目使用总量为空!");
  4668. return;
  4669. }
  4670. }
  4671. //判断是否有重复的项目 返回true 说明有重复的
  4672. if (verifyRepeat(currentCode, null, null, 3)) {
  4673. return;
  4674. }
  4675. //原药品金额 如果是修改则需要设置
  4676. var temporaryItemsAmount = 0;
  4677. //当前需要被移除元素的下个兄弟节点
  4678. var nextObj = null;
  4679. //当前修改的药品是不是最后一个
  4680. var isLast = false;
  4681. //是新增药品还是编辑 true 修改 默认false
  4682. var updateFlag = $("#zl_update_flag").val();
  4683. if (updateFlag == undefined || updateFlag == null) {
  4684. updateFlag = false;
  4685. }
  4686. //如果是修改,需要减去原来的费用
  4687. //原组号
  4688. var oriGroupId = null;
  4689. if (updateFlag == "true" || updateFlag == true) {
  4690. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  4691. if (formGroups != null && formGroups.length > 0) {
  4692. var updateOriCode = $("#update_ori_code").val();
  4693. for (var i = 0; i < formGroups.length; i++) {
  4694. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  4695. if (temporaryItemsCode === updateOriCode) {
  4696. temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  4697. if (formGroups.length > 1) {
  4698. nextObj = $(formGroups[i]).next();
  4699. }
  4700. isLast = (i + 1) === formGroups.length;
  4701. oriGroupId = $(formGroups[i]).find("span.zlItemGroupId").text();
  4702. $(formGroups[i]).remove();
  4703. break;
  4704. }
  4705. }
  4706. }
  4707. }
  4708. if (oriGroupId != null) {
  4709. groupId = oriGroupId;
  4710. }
  4711. var html = '<div class="form-group">';
  4712. html += '<span class="zlItemGroupId">' + groupId + '</span>.<span style="margin-left: 5px"></span>'
  4713. html += zlItem + ' ';
  4714. if (descriptions != null && descriptions != "") {
  4715. html += " 规格:" + descriptions;
  4716. }
  4717. html += " 单量:" + itemQuantity;
  4718. if (chargeUnit != null && chargeUnit != '') {
  4719. html += chargeUnit;
  4720. }
  4721. if (dayZlNum != null && dayZlNum != "") {
  4722. html += " 天数:" + dayZlNum + "天";
  4723. }
  4724. if (orderFrequencyZl != null && orderFrequencyZl != "") {
  4725. html += " 频次:" + orderFrequencyZl;
  4726. }
  4727. if (totalNumZl != null && totalNumZl != "") {
  4728. html += " 总量:" + totalNumZl;
  4729. if (chargeUnit != null && chargeUnit != '') {
  4730. html += chargeUnit;
  4731. }
  4732. }
  4733. if (zlExecUnit != null && zlExecUnit != "") {
  4734. html += " 执行科室:" + zlExecUnitName;
  4735. }
  4736. if (remark != null && remark != '') {
  4737. html += ' 备注:' + remark;
  4738. }
  4739. 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>';
  4740. 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>';
  4741. 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>';
  4742. 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>';
  4743. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  4744. html += '<input type="hidden" class="temporary_items_zlItemName" value="' + zlItem + '"/>';
  4745. html += '<input type="hidden" class="temporary_items_amount" value="' + zlItemPrice + '"/>';
  4746. html += '<input type="hidden" class="temporary_items_remark" value="' + remark + '"/>';
  4747. html += '<input type="hidden" class="temporary_items_desc_value" value="' + chargeUnitCode + '"/>';
  4748. html += '<input type="hidden" class="temporary_items_itemQuantity" value="' + itemQuantity + '"/>';
  4749. html += '<input type="hidden" class="temporary_items_execUnit" value="' + zlExecUnit + '"/>';
  4750. html += '<input type="hidden" class="temporary_items_descriptions" value="' + descriptions + '"/>';
  4751. html += '<input type="hidden" class="temporary_items_dayZlNum" value="' + dayZlNum + '"/>';
  4752. html += '<input type="hidden" class="temporary_items_orderFrequencyZl" value="' + orderFrequencyZl + '"/>';
  4753. html += '<input type="hidden" class="temporary_items_totalNumZl" value="' + totalNumZl + '"/>';
  4754. html += '</div>';
  4755. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  4756. if (nextObj == null || isLast) {
  4757. $(tableId).find("div:eq(0)").append(html);
  4758. } else {
  4759. $(nextObj).before(html);
  4760. }
  4761. //设置当前处方金额
  4762. //calculateCfAmount(tableId, jcjyItemPrice, temporaryItemsAmount, 2, 0);
  4763. if (calculateTotalAmountFlag) {
  4764. //设置总金额
  4765. calculateTotalAmount(true);
  4766. }
  4767. clearZlItem();
  4768. }
  4769. /**
  4770. * 临时保存住院证
  4771. * @param messageFlag 是否需要提醒已经存在的入院申请 true 提示
  4772. */
  4773. function saveZyReq(messageFlag) {
  4774. //如果
  4775. if ($("#zyReqTab").find("li") == null || $("#zyReqTab").find("li").length == 0) {
  4776. initNavTabs(4, null, null);
  4777. }
  4778. var tableId = $("#zyReqTab li.active").find("a").attr("href");
  4779. //病区编码
  4780. var inpatientWardBeHospitalized = $("#inpatientWardBeHospitalized").val();
  4781. //小病室编码
  4782. var smallWardBeHospitalized = $("#smallWardBeHospitalized").val();
  4783. //入院状态编码
  4784. var admissStatus = $("#admissStatus").val();
  4785. //病区名称
  4786. var inpatientWardText = $('#inpatientWardBeHospitalized option:selected').text();
  4787. //小科室名称
  4788. var smallWardText = $('#smallWardBeHospitalized option:selected').text();
  4789. //入院状态名称
  4790. var admissStatusText = $('#admissStatus option:selected').text();
  4791. //入院病情代码
  4792. var conditionCode = $("#conditionCode").val();
  4793. //入院途径代码
  4794. var routeOfAdmission = $("#routeOfAdmission").val();
  4795. //入院病情代码
  4796. var conditionCodeText = $('#conditionCode option:selected').text();
  4797. //入院途径代码
  4798. var routeOfAdmissionText = $('#routeOfAdmission option:selected').text();
  4799. if (admissStatusText == null || admissStatusText == '') {
  4800. errorMesageSimaple("未选择入院状态!");
  4801. return;
  4802. }
  4803. if (conditionCode == null || conditionCode == '') {
  4804. errorMesageSimaple("未选择入院病情!");
  4805. return;
  4806. }
  4807. if (routeOfAdmission == null || routeOfAdmission == '') {
  4808. errorMesageSimaple("未选择入院途径!");
  4809. return;
  4810. }
  4811. if (inpatientWardBeHospitalized == null || inpatientWardBeHospitalized == '') {
  4812. errorMesageSimaple("未选择入院病区!");
  4813. return;
  4814. }
  4815. if (admissStatus == null || admissStatus == '') {
  4816. errorMesageSimaple("未选择入院状态!");
  4817. return;
  4818. }
  4819. if (messageFlag == "true" || messageFlag == true) {
  4820. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  4821. if (formGroups != null && formGroups.length > 0) {
  4822. $("#messageModal").modal();
  4823. $("#messageContent").html("当前病人已经有一个暂存的入院申请,是否需要替换该申请?");
  4824. $("#messageButton").off("click").on("click", function (t) {
  4825. $("#messageModal").modal("hide");
  4826. saveZyReq(false);
  4827. });
  4828. $("#cancelButton").off("click");
  4829. return;
  4830. }
  4831. }
  4832. var html = '<div class="form-group"> 收住院';
  4833. if (inpatientWardText != null) {
  4834. html += " [" + inpatientWardText;
  4835. }
  4836. if (smallWardText != null) {
  4837. html += " (" + smallWardText + ") ";
  4838. }
  4839. if (inpatientWardText != null) {
  4840. html += "]";
  4841. }
  4842. if (admissStatusText != null) {
  4843. html += " " + admissStatusText;
  4844. }
  4845. if (conditionCodeText != null) {
  4846. html += " " + conditionCodeText;
  4847. }
  4848. if (routeOfAdmissionText != null) {
  4849. html += " " + routeOfAdmissionText;
  4850. }
  4851. html += ' 侯床';
  4852. //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>';
  4853. 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>';
  4854. html += '<input type="hidden" class="temporary_inpatient_ward" value="' + inpatientWardBeHospitalized + '"/>';
  4855. html += '<input type="hidden" class="temporary_items_small_ward" value="' + smallWardBeHospitalized + '"/>';
  4856. html += '<input type="hidden" class="temporary_items_admiss_status" value="' + admissStatus + '"/>';
  4857. html += '<input type="hidden" class="temporary_items_condition_code" value="' + conditionCode + '"/>';
  4858. html += '<input type="hidden" class="temporary_items_route_of_admission" value="' + routeOfAdmission + '"/>';
  4859. html += '</div>';
  4860. $(tableId).find("div:eq(0)").html(html);
  4861. clearZyReq();
  4862. }
  4863. /**
  4864. * 删除药品或者项目
  4865. * @param index 0 西药 1 中药 2 检查检验 3诊疗
  4866. * @param obj 当前点击的对象
  4867. */
  4868. function removeYpOrProject(index, obj) {
  4869. var tabId = null;
  4870. var className = null;
  4871. //西药
  4872. if (index == 0) {
  4873. tabId = "xyTab";
  4874. } else if (index == 1) {
  4875. //中成药
  4876. tabId = "zyTab";
  4877. } else if (index == 2) {
  4878. //辅助检查、检验
  4879. className = ".jcjyItemGroupId";
  4880. tabId = "jcjyTab";
  4881. } else if (index == 3) {
  4882. //诊疗
  4883. className = ".zlItemGroupId";
  4884. tabId = "zlTab";
  4885. } else if (index == 4) {
  4886. //入院
  4887. tabId = "zyReqTab";
  4888. }
  4889. var tableId = $("#" + tabId + " li.active").find("a").attr("href");
  4890. //var totalRetprice = $(obj).parent().find("input.temporary_items_amount").val();
  4891. //calculateCfAmount(tableId, totalRetprice, null, index, 1);
  4892. //医技和诊疗的序号调整一下
  4893. if (index == 2 || index == 3) {
  4894. var nextAll = $(obj).parent().nextAll();
  4895. if (nextAll != null && nextAll.length > 0) {
  4896. for (var i = 0; i < nextAll.length; i++) {
  4897. var index = $(nextAll[i]).find(className).text();
  4898. $(nextAll[i]).find(className).text(index - 1);
  4899. }
  4900. }
  4901. }
  4902. var temporaryItemsGroupId = $(obj).parent().find("input.temporary_items_groupId").val();
  4903. var temporaryItemsGroupIds = $(obj).parent().parent().find("input.temporary_items_groupId");
  4904. if (temporaryItemsGroupIds != null && temporaryItemsGroupIds.length > 0) {
  4905. var count = 0;
  4906. for (var i = 0; i < temporaryItemsGroupIds.length; i++) {
  4907. if (temporaryItemsGroupId == $(temporaryItemsGroupIds[i]).val()) {
  4908. count++;
  4909. }
  4910. }
  4911. //当前删除的药品组号是最后一个的时候,清空缓存
  4912. if (count == 1) {
  4913. groupIdMap.remove(temporaryItemsGroupId);
  4914. gropuIdAndOrderNoMap.remove(temporaryItemsGroupId);
  4915. }
  4916. }
  4917. $(obj).parent().remove();
  4918. if (index != 4) {
  4919. calculateTotalAmount(false);
  4920. }
  4921. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  4922. if (formGroups == null || formGroups.length == 0) {
  4923. if (index == 0) {
  4924. //西药被清空后,重置药房类型编码
  4925. $(tableId).find("input.current_groupNo").val(null);
  4926. //当本处方内容都被删除完后,也删除处方table
  4927. $("#" + tabId).find("a[href=\"" + tableId + "\"]").parent().remove();
  4928. $(tableId).remove();
  4929. //切换处方 最后一个被选中
  4930. $("#" + tabId).find("li:last > a").off("click").tab('show');
  4931. } else if (index == 1) {
  4932. //当中药处方被清空完后,重置当前中药类型为空
  4933. $("#current_zyClassType").val(null);
  4934. }
  4935. }
  4936. if (index == 0) {
  4937. resetGroupIdMap();
  4938. }
  4939. }
  4940. /**
  4941. * 重置组号与用法、频率天数缓存关系
  4942. */
  4943. function resetGroupIdMap() {
  4944. var temporaryItemsGroupIds = $("#xyTabContent").find("input.temporary_items_groupId");
  4945. if (temporaryItemsGroupIds != null && temporaryItemsGroupIds.length > 0) {
  4946. var list = [];
  4947. for (var i = 0; i < temporaryItemsGroupIds.length; i++) {
  4948. var groupId = $(temporaryItemsGroupIds[i]).val();
  4949. if (list.indexOf(groupId) < 0) {
  4950. list.push(groupId);
  4951. }
  4952. }
  4953. var keys = groupIdMap.keySet();
  4954. for (var i = 0; i < keys.length; i++) {
  4955. var key = keys[i];
  4956. if (list.indexOf(key) < 0) {
  4957. groupIdMap.remove(key);
  4958. }
  4959. }
  4960. }
  4961. }
  4962. /**
  4963. * 清空西药
  4964. * @param flag 是否全部清空 因为 西药有分组,同一组的药品用药方式和频率以及天数一样,不能改变。所以不换组是不能改变 并且设置成不可编辑
  4965. */
  4966. function clearWesternMedicine(flag) {
  4967. $("#addPDiv").css("margin-left", "125px");
  4968. $("#hlyyypsms").removeClass("in").addClass("hide");
  4969. $("#western_medicine_update_flag").val(false);
  4970. $("#western_medicine_ori_group_id").val(null);
  4971. $("#update_ori_code").val(null);
  4972. $("#update_ori_serial").val(null);
  4973. //药品名称
  4974. $("#western_medicine_name").val(null);
  4975. //当前药品编码
  4976. $("#western_medicine_current_code").val(null);
  4977. //当前药品规格
  4978. $("#western_medicine_current_serial").val(null);
  4979. //当前药房编码
  4980. $("#current_groupNo").val(null);
  4981. if (flag) {
  4982. //用法编码
  4983. $("#supplyType").selectpicker('val', null);
  4984. $('#supplyType').selectpicker('refresh');
  4985. //$("#supplyType").removeAttr("disabled");
  4986. //天数
  4987. $("#dayNum").selectpicker('val', null);
  4988. $('#dayNum').selectpicker('refresh');
  4989. // $("#dayNum").removeAttr("disabled");
  4990. //频次编码
  4991. $("#orderFrequency").selectpicker('val', null);
  4992. $('#orderFrequency').selectpicker('refresh');
  4993. // $("#orderFrequency").removeAttr("disabled");
  4994. }
  4995. //药品默认单次使用剂量
  4996. $("#drugWinDb").val(null);
  4997. //处方实际单次使用剂量
  4998. $("#drugWin").val(null);
  4999. //剂量单位
  5000. $("#drugWinUnit").selectpicker('val', null);
  5001. $('#drugWinUnit').selectpicker('refresh');
  5002. //总量
  5003. $("#gross").val(null);
  5004. //包装单位
  5005. $("#packUnit").selectpicker('val', null);
  5006. $('#packUnit').selectpicker('refresh');
  5007. //单价
  5008. $("#packRetprice").val(null);
  5009. //金额
  5010. $("#totalRetprice").val(null);
  5011. //医嘱
  5012. $("#medicalAdvice").selectpicker('val', null);
  5013. $('#medicalAdvice').selectpicker('refresh');
  5014. $("#tryResult").parent().parent().parent().removeClass("in").addClass("hide");
  5015. //皮试结果
  5016. $("#tryResult").selectpicker('val', null);
  5017. $('#tryResult').selectpicker('refresh');
  5018. //$("#gross").attr("readonly", "readonly");
  5019. $("#manufactoryName").val(null);
  5020. $("#specification").val(null);
  5021. $("#categoriesFlag").val(null);
  5022. }
  5023. /**
  5024. * 保存当前药品到右边处方区域 中药
  5025. * calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  5026. */
  5027. function saveChineseMedicine(calculateTotalAmountFlag) {
  5028. //药品名称
  5029. var chineseMedicineNamme = $("#chinese_medicine_name").val();
  5030. //当前药品编码
  5031. var currentCode = $("#chinese_medicine_current_code").val();
  5032. //当前药品规格
  5033. var currentSerial = $("#chinese_medicine_current_serial").val();
  5034. //处方实际单次使用剂量
  5035. var drugWin = $("#zy_drugWin").val();
  5036. //医嘱码
  5037. var zyInstruction = $("#zyInstruction").val();
  5038. //医嘱
  5039. var zyInstructionText = $('#zyInstruction option:selected').text();
  5040. //单价
  5041. var zyPackRetprice = parseFloat($("#zy_packRetprice").val());
  5042. //当前中药的总价
  5043. var totalRetprice = Multiply(drugWin, zyPackRetprice);
  5044. //中药类型
  5045. var zyClassType = $("#zyClassType").val();
  5046. //已经选中的药品类型, 中药不允许一个处方里有普通中药和颗粒剂
  5047. var currentYyClassType = $("#current_zyClassType").val();
  5048. if (currentYyClassType == null || currentYyClassType == "") {
  5049. //中药此时是第一次选择药品,不控制类型
  5050. $("#current_zyClassType").val(zyClassType);
  5051. } else if (currentYyClassType != zyClassType) {
  5052. errorMesageSimaple("同一个中药处方不允许同时出现普通中药和颗粒剂中药!");
  5053. return;
  5054. }
  5055. if (currentCode == null || currentCode == '') {
  5056. errorMesageSimaple("未选择任何药品!");
  5057. return;
  5058. }
  5059. var html = '<div class="form-group" style="float: left;">';
  5060. html += chineseMedicineNamme;
  5061. if (zyInstruction != null && zyInstruction != '') {
  5062. html += '[' + zyInstructionText + ']';
  5063. }
  5064. html += '<span style="margin-left: 5px"></span>';
  5065. html += drugWin + 'g';
  5066. 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>';
  5067. 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>';
  5068. 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>';
  5069. 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>';
  5070. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  5071. html += '<input type="hidden" class="temporary_items_serial" value="' + currentSerial + '"/>';
  5072. html += '<input type="hidden" class="temporary_items_amount" value="' + totalRetprice + '"/>';
  5073. html += '<input type="hidden" class="temporary_items_zyClassType" value="' + zyClassType + '"/>';
  5074. html += '<input type="hidden" class="temporary_items_chineseMedicineNamme" value="' + chineseMedicineNamme + '"/>';
  5075. html += '<input type="hidden" class="temporary_items_zyPackRetprice" value="' + zyPackRetprice + '"/>';
  5076. html += '<input type="hidden" class="temporary_items_drugWin" value="' + drugWin + '"/>';
  5077. html += '<input type="hidden" class="temporary_items_zyInstruction" value="' + zyInstruction + '"/>';
  5078. html += '<input type="hidden" class="temporary_items_zyInstructionText" value="' + zyInstructionText + '"/>';
  5079. html += '</div>';
  5080. var tableId = $("#zyTab li.active").find("a").attr("href");
  5081. //原药品金额 如果是修改则需要设置
  5082. var temporaryItemsAmount = 0;
  5083. //当前需要被移除元素的下个兄弟节点
  5084. var nextObj = null;
  5085. //当前修改的药品是不是最后一个
  5086. var isLast = false;
  5087. //是新增药品还是编辑 true 修改 默认false
  5088. var updateFlag = $("#chinese_medicine_update_flag").val();
  5089. if (updateFlag == undefined || updateFlag == null) {
  5090. updateFlag = false;
  5091. }
  5092. //如果是修改,需要减去原来的费用
  5093. if (updateFlag == "true" || updateFlag == true) {
  5094. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  5095. if (formGroups != null && formGroups.length > 0) {
  5096. //药品有可能会修改,所以,判断的时候要用原药品编码
  5097. var updateOriCode = $("#update_ori_code").val();
  5098. //规格有可能会修改,所以,判断的时候要用原规格
  5099. var updateOriSerial = $("#update_ori_serial").val();
  5100. for (var i = 0; i < formGroups.length; i++) {
  5101. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  5102. var temporaryItemsSerial = $(formGroups[i]).find("input.temporary_items_serial").val();
  5103. if (temporaryItemsCode === updateOriCode && temporaryItemsSerial === updateOriSerial) {
  5104. temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  5105. if (formGroups.length > 1) {
  5106. nextObj = $(formGroups[i]).next();
  5107. }
  5108. isLast = (i + 1) === formGroups.length;
  5109. $(formGroups[i]).remove();
  5110. break;
  5111. }
  5112. }
  5113. }
  5114. }
  5115. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  5116. if (nextObj == null || isLast) {
  5117. $(tableId).find("div:eq(0)").append(html);
  5118. } else {
  5119. $(nextObj).before(html);
  5120. }
  5121. //设置当前处方金额
  5122. // calculateCfAmount(tableId, totalRetprice, temporaryItemsAmount, 1, 0);
  5123. if (calculateTotalAmountFlag) {
  5124. //设置总金额
  5125. calculateTotalAmount(true);
  5126. }
  5127. clearChineseMedicine();
  5128. }
  5129. /**
  5130. * 清空中药
  5131. */
  5132. function clearChineseMedicine() {
  5133. $("#chinese_medicine_update_flag").val(false);
  5134. $("#update_ori_code").val(null);
  5135. $("#update_ori_serial").val(null);
  5136. //药品名称
  5137. $("#chinese_medicine_name").val(null);
  5138. //当前药品编码
  5139. $("#chinese_medicine_current_code").val(null);
  5140. //当前药品规格
  5141. $("#chinese_medicine_current_serial").val(null);
  5142. //医嘱
  5143. $("#zyInstruction").selectpicker('val', null);
  5144. $('#zyInstruction').selectpicker('refresh');
  5145. //剂量
  5146. $("#zy_drugWin").val(null);
  5147. //单价
  5148. $("#zy_packRetprice").val(null);
  5149. }
  5150. /**
  5151. * 清空辅助检查、检验项目
  5152. */
  5153. function clearJyJcItem() {
  5154. $("#update_ori_code").val(null);
  5155. $("#jcjy_update_flag").val(false);
  5156. //项目名称
  5157. $("#jcJyItem").val(null);
  5158. //当前项目编码
  5159. $("#jcjy_current_code").val(null);
  5160. //单价
  5161. $("#jcjyItemPrice").val(null);
  5162. //备注
  5163. $("#remark").val(null);
  5164. $("#jcJyZltype").val(null);
  5165. $("#jyZdSample").selectpicker('val', null);
  5166. $('#jyZdSample').selectpicker('refresh');
  5167. $("#yshPart").selectpicker('val', null);
  5168. $('#yshPart').selectpicker('refresh');
  5169. $("#execUnit").selectpicker('val', null);
  5170. $('#execUnit').selectpicker('refresh');
  5171. $("#jcJyItemChargeDetail").removeClass("in").addClass("hide");
  5172. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  5173. $("#yshPartDiv").removeClass("in").addClass("hide");
  5174. }
  5175. /**
  5176. * 清空诊疗项目
  5177. */
  5178. function clearZlItem() {
  5179. $("#update_ori_code").val(null);
  5180. $("#zl_update_flag").val(false);
  5181. //项目名称
  5182. $("#zlItem").val(null);
  5183. //当前项目编码
  5184. $("#zl_current_code").val(null);
  5185. //单价
  5186. $("#zlItemPrice").val(null);
  5187. //备注
  5188. $("#zlRemark").val(null);
  5189. //描述
  5190. $("#chargeUnit").val(null);
  5191. $("#itemQuantity").val(1);
  5192. $("#descriptions").val(null);
  5193. $("#dayZlNum").selectpicker('val', 1);
  5194. $('#dayZlNum').selectpicker('refresh');
  5195. $("#orderFrequencyZl").selectpicker('val', 'ONCE');
  5196. $('#orderFrequencyZl').selectpicker('refresh');
  5197. $("#totalNumZl").val(null);
  5198. $("#totalAmountZl").val(null);
  5199. $("#zlExecUnit").selectpicker('val', null);
  5200. $('#zlExecUnit').selectpicker('refresh');
  5201. }
  5202. /**
  5203. * 清空入院证输入框
  5204. */
  5205. function clearZyReq() {
  5206. $("#inpatientWardBeHospitalized").selectpicker('val', null);
  5207. $('#inpatientWardBeHospitalized').selectpicker('refresh');
  5208. $("#smallWardBeHospitalized").selectpicker('val', null);
  5209. $('#smallWardBeHospitalized').selectpicker('refresh');
  5210. $("#admissStatus").selectpicker('val', null);
  5211. $('#admissStatus').selectpicker('refresh');
  5212. $("#conditionCode").selectpicker('val', null);
  5213. $('#conditionCode').selectpicker('refresh');
  5214. $("#routeOfAdmission").selectpicker('val', null);
  5215. $('#routeOfAdmission').selectpicker('refresh');
  5216. $("#totalBedNum").val(null);
  5217. $("#freeBedNum").val(null);
  5218. $("#occupationBedNum").val(null);
  5219. initSmallDeptByDept();
  5220. }
  5221. /**
  5222. * 计算总金额
  5223. * @param needRemoveLastObject 是否需要删除最后一次加进来的项目
  5224. */
  5225. function calculateTotalAmount(needRemoveLastObject) {
  5226. //调用后去除所有的验证提示
  5227. $("div.alert ").each(function (index, obj) {
  5228. $(obj).remove();
  5229. });
  5230. var jsonData = getParamsForpPrescription(3);
  5231. $.ajax({
  5232. type: "POST",
  5233. url: '/thmz/getAmountForTempPrescription',
  5234. contentType: "application/json;charset=UTF-8",
  5235. dataType: "json",
  5236. data: JSON.stringify(jsonData),
  5237. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5238. success: function (res) {
  5239. if (res == '401' || res == 401) {
  5240. window.location.href = '/thmz/login/view'
  5241. return;
  5242. }
  5243. if (res.code == 0) {
  5244. $("#totalAmount").html(res.data.amount.toFixed(1));
  5245. var arrs = $("span.cf_amount");
  5246. for (var i = 0; i < arrs.length; i++) {
  5247. if (res.data.amountList[i] != undefined && res.data.amountList[i] != null) {
  5248. $(arrs[i]).html(res.data.amountList[i].toFixed(1));
  5249. }
  5250. }
  5251. } else {
  5252. if (needRemoveLastObject) {
  5253. var index = getIndex("bill_item_group");
  5254. var tabId = null;
  5255. //西药
  5256. if (index == 0) {
  5257. tabId = "xyTab";
  5258. } else if (index == 1) {
  5259. //中成药
  5260. tabId = "zyTab";
  5261. } else if (index == 2) {
  5262. //辅助检查、检验
  5263. tabId = "jcjyTab";
  5264. } else if (index == 3) {
  5265. //诊疗
  5266. tabId = "zlTab";
  5267. } else if (index == 4) {
  5268. //入院
  5269. tabId = "zyReqTab";
  5270. }
  5271. var tableId = $("#" + tabId + " li.active").find("a").attr("href");
  5272. var last = $(tableId).find("div:eq(0)").find("div:last");
  5273. if (last != null) {
  5274. $(last).find("i:eq(2)").click();
  5275. $(last).find("i:eq(3)").click();
  5276. }
  5277. }
  5278. errorMesage(res);
  5279. }
  5280. }
  5281. });
  5282. }
  5283. // /**
  5284. // * 打开住院处理窗口
  5285. // * @param data
  5286. // */
  5287. // function beHospitalized() {
  5288. // $("#beHospitalizedModal").modal();
  5289. // //根据病人门诊id查询病人的入院申请
  5290. // $.ajax({
  5291. // type: "GET",
  5292. // url: '/thmz/getMzZyReqByPatientId?patientId=' + $("#patientId").text(),
  5293. // contentType: "application/json;charset=UTF-8",
  5294. // dataType: "json",
  5295. // headers: {
  5296. // 'Accept': 'application/json',
  5297. // 'Authorization': 'Bearer ' + localStorage.getItem("token")
  5298. // },
  5299. // success: function (resZyz) {
  5300. // if (resZyz == '401' || resZyz == 401) {
  5301. // window.location.href = '/thmz/login/view'
  5302. // return;
  5303. // }
  5304. // if (resZyz.code == 0) {
  5305. // $("#icdCodeInputBeHospitalized").val(resZyz.data.icdCode);
  5306. // $("#icdTextBeHospitalized").val(resZyz.data.icdText);
  5307. // $("#icdTextBeHospitalized").attr("title", resZyz.data.icdText);
  5308. // $("#inpatientWardBeHospitalized").selectpicker('val', resZyz.data.reqDept);
  5309. // $("#inpatientWardBeHospitalized").selectpicker('refresh');
  5310. // initSmallDeptByDept();
  5311. // $("#smallWardBeHospitalized").selectpicker('val', resZyz.data.smallDept);
  5312. // $("#smallWardBeHospitalized").selectpicker('refresh');
  5313. // $("#admissStatus").selectpicker('val', resZyz.data.admissStatus);
  5314. // $("#admissStatus").selectpicker('refresh');
  5315. // $("#zyReqVisitDate").val(format(resZyz.data.visitDate, "yyyy-MM-dd HH:mm:ss"));
  5316. // }
  5317. // }
  5318. // });
  5319. // }
  5320. /**
  5321. * 打开编辑用户信息窗口
  5322. * @param data
  5323. * @param type 1 患者详情处编辑 2 快速接诊处编辑 3 就诊详情预览
  5324. */
  5325. function editUserModal(patientId, type) {
  5326. if (type == 3) {
  5327. $("#editUserModalTitle").html("患者档案【预览】");
  5328. $("#saveEditUser").removeClass("in").addClass("hide");
  5329. } else {
  5330. $("#editUserModalTitle").html("患者档案【修改】");
  5331. $("#saveEditUser").removeClass("hide").addClass("in");
  5332. }
  5333. $("#openSource").val(type);
  5334. if (patientId == null) {
  5335. //医生工作台发起
  5336. patientId = $("#patientId").text();
  5337. }
  5338. // else {
  5339. // //快速接诊界面发起
  5340. // clearRapidAccepts();
  5341. // }
  5342. if (patientId == null || patientId == "null" || patientId == "") {
  5343. errorMesageSimaple("请输入需要编辑的患者信息");
  5344. return;
  5345. }
  5346. $("#rapidAcceptsModal").modal("hide");
  5347. $("#visitingDetailModal").modal("hide");
  5348. $("#editUserModal").modal();
  5349. $.ajax({
  5350. type: "GET",
  5351. url: '/thmz/getByPatientId?patientId=' + patientId,
  5352. contentType: "application/json;charset=UTF-8",
  5353. dataType: "json",
  5354. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5355. success: function (res) {
  5356. if (res == '401' || res == 401) {
  5357. window.location.href = '/thmz/login/view'
  5358. return;
  5359. }
  5360. if (res.code == 0) {
  5361. if (res.data != null) {
  5362. //延时调用,因为当前弹框还没有加载出来,校验规则无法获取光标与模拟光标丢失事件,延时可以等弹框加载出来后模拟事件
  5363. setTimeout(function () {
  5364. fillPlusPatinet(res.data);
  5365. }, 400);
  5366. }
  5367. } else {
  5368. errorMesage(res);
  5369. $("#editUserModal").modal("hide");
  5370. }
  5371. }
  5372. });
  5373. }
  5374. /**
  5375. * 处方类型按钮切换事件
  5376. * @param object
  5377. * @param objectIndex
  5378. */
  5379. function billItemButtonChange(object, objectIndex) {
  5380. $(".nav-tabs").removeClass("in").addClass("hide");
  5381. $(".tab-content").removeClass("in").addClass("hide");
  5382. $(".nav-tabs:eq(" + objectIndex + ")").removeClass("hide").addClass("in");
  5383. $(".tab-content:eq(" + objectIndex + ")").removeClass("hide").addClass("in");
  5384. $("#bill_item_group").find("button").each(function (index, element) {
  5385. if ($(element).hasClass("btn-primary")) {
  5386. $(element).removeClass("btn-primary").addClass("btn-default");
  5387. }
  5388. $("#rp_form" + index).removeClass("show").addClass("hide");
  5389. });
  5390. $("#rp_form" + objectIndex).removeClass("hide").addClass("show");
  5391. $(object).removeClass("btn-default").addClass("btn-primary");
  5392. $("#western_medicine_name").webuiPopover('hide');
  5393. $("#chinese_medicine_name").webuiPopover('hide');
  5394. $("#jcJyItem").webuiPopover('hide');
  5395. $("#zlItem").webuiPopover('hide');
  5396. if (objectIndex == 0) {
  5397. $("#western_medicine_name").focus();
  5398. //有时候调用药品多了以后,会导致一个药品处方名对应多个content显现
  5399. var paneId = $("#xyTab li.active").find("a").attr("href");
  5400. if (paneId != null) {
  5401. //去除第一个字符 #
  5402. paneId = paneId.slice(1);
  5403. xyTableOnClick(paneId)
  5404. }
  5405. } else if (objectIndex == 1) {
  5406. $("#chinese_medicine_name").focus();
  5407. } else if (objectIndex == 2) {
  5408. $("#jcJyItem").focus();
  5409. } else if (objectIndex == 3) {
  5410. $("#zlItem").focus();
  5411. } else if (objectIndex == 4) {
  5412. // $("#inpatientWardBeHospitalized").next().click();
  5413. prevEleId = "zy_req_button";
  5414. }
  5415. }
  5416. /**
  5417. * 打开快速接诊窗口
  5418. * @param data
  5419. */
  5420. function rapidAcceptsModal() {
  5421. $("#rapidAcceptsModal").modal();
  5422. //延迟触发 默认光标在卡号输入框
  5423. setTimeout('$("#rapidAcceptsUserCardNo").focus();', 500);
  5424. }
  5425. /**
  5426. * checkBox样式
  5427. */
  5428. function formatCheck() {
  5429. if ($("input.flat")[0]) {
  5430. $(document).ready(function () {
  5431. $('input.flat').iCheck({
  5432. checkboxClass: 'icheckbox_flat-blue',
  5433. radioClass: 'iradio_flat-blue'
  5434. });
  5435. });
  5436. }
  5437. }
  5438. /**
  5439. * 卡号有变化后查询病人信息
  5440. */
  5441. function queryUserInfoByCardNo() {
  5442. //当反写的id不存在,说明不是查询后的改变事件,触发查询
  5443. var rapidAcceptsUserCardNo = $("#rapidAcceptsUserCardNo").val();
  5444. var index = rapidAcceptsUserCardNo.indexOf("-");
  5445. if (($("#patientIdDb").val() == null || $("#patientIdDb").val() == "") && ((index > 0 && index == rapidAcceptsUserCardNo.length - 2) || rapidAcceptsUserCardNo.length == 8)) {
  5446. $("#cardNo").attr("title", rapidAcceptsUserCardNo);
  5447. $.ajax({
  5448. type: "GET",
  5449. url: '/thmz/getByIcCardNo?icCardNo=' + rapidAcceptsUserCardNo,
  5450. contentType: "application/json;charset=UTF-8",
  5451. dataType: "json",
  5452. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5453. success: function (res) {
  5454. if (res == '401' || res == 401) {
  5455. window.location.href = '/thmz/login/view'
  5456. return;
  5457. }
  5458. if (res.code == 0) {
  5459. if (res.data != null) {
  5460. $("#rapidAcceptsUserName").val(res.data.name);
  5461. $("#rapidAcceptsUserCode").val(res.data.patientId);
  5462. $("#patientIdDb").val(res.data.patientId);
  5463. $("#rapidAcceptsUserCardNo").val(res.data.icCardNo);
  5464. $("#rapidAcceptsUserGender").selectpicker('val', res.data.sex);
  5465. $("#rapidAcceptsUserGender").selectpicker('refresh');
  5466. $("#rapidAcceptsUserPhoneNum").val(res.data.phoneNo);
  5467. $("#rapidAcceptsUserIdCard").val(res.data.socialNo);
  5468. $('#rapidAcceptsUserCertificateType').selectpicker('val', '01');
  5469. $('#rapidAcceptsUserCertificateType').selectpicker('refresh');
  5470. $("#rapidAcceptsUserIdCard").attr("title", res.data.socialNo);
  5471. $("#rapidAcceptsUserPhoneNum").attr("title", res.data.phoneNo);
  5472. $('#rapidAcceptsProvinceCode').selectpicker('val', res.data.provinceCode);
  5473. $('#rapidAcceptsProvinceCode').selectpicker('refresh');
  5474. initCity(3, res.data.cityCode);
  5475. initDistrict(3, res.data.cityCode, res.data.districtCode);
  5476. $("#rapidAcceptsDetail").val(res.data.detail);
  5477. $("#rapidAcceptsUserAddress").attr("title", res.data.address);
  5478. $("#rapidAcceptsUserAddress").val(res.data.address);
  5479. $("#rapidAcceptsUserContact").val(res.data.relName);
  5480. $("#rapidAcceptsUserContactPhone").val(res.data.contractName);
  5481. //查询分诊号
  5482. $.ajax({
  5483. type: "POST",
  5484. url: '/thmz/getUnClinicWithPage',
  5485. contentType: "application/json;charset=UTF-8",
  5486. dataType: "json",
  5487. data: JSON.stringify({"patientId": res.data.patientId}),
  5488. headers: {
  5489. 'Accept': 'application/json',
  5490. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  5491. },
  5492. success: function (resFz) {
  5493. if (resFz == '401' || resFz == 401) {
  5494. window.location.href = '/thmz/login/view'
  5495. return;
  5496. }
  5497. if (resFz.code == 0) {
  5498. if (resFz.data == null || resFz.data.length == 0) {
  5499. errorMesageSimaple("没有查询到符合条件的分诊记录!");
  5500. clearRapidAcceptsModal();
  5501. return;
  5502. }
  5503. $("#mzfzSerialNo").val(resFz.data[0].serialNo);
  5504. }
  5505. }
  5506. });
  5507. } else {
  5508. errorMesageSimaple("病人信息不存在!");
  5509. }
  5510. } else {
  5511. errorMesage(res);
  5512. }
  5513. }
  5514. });
  5515. }
  5516. }
  5517. /**
  5518. * 清空快速接诊查询框
  5519. */
  5520. function clearRapidAccepts() {
  5521. $("#rapidAcceptsUserName").val(null);
  5522. $("#rapidAcceptsUserCode").val(null);
  5523. $("#patientIdDb").val(null);
  5524. $("#rapidAcceptsUserCardNo").val(null);
  5525. $("#rapidAcceptsUserGender").selectpicker('val', 0);
  5526. $("#rapidAcceptsUserGender").selectpicker('refresh');
  5527. $("#rapidAcceptsUserPhoneNum").val(null);
  5528. $("#rapidAcceptsUserIdCard").val(null);
  5529. $("#rapidAcceptsUserIdCard").attr("title", null);
  5530. $("#rapidAcceptsUserPhoneNum").attr("title", null);
  5531. $("#rapidAcceptsUserAddress").attr("title", null);
  5532. $("#mzfzSerialNo").val(null);
  5533. $("#rapidAcceptsUserCardNo").focus();
  5534. $("#rapidAcceptsUserAddress").val(null);
  5535. $("#rapidAcceptsUserContact").val(null);
  5536. $("#rapidAcceptsUserContactPhone").val(null);
  5537. }
  5538. /**
  5539. * 根据病人姓名输入框内容动态加载病人列表
  5540. */
  5541. function initUserList() {
  5542. //var width=$("#userName").css("width");
  5543. var settings = {
  5544. trigger: 'click',
  5545. content: '',
  5546. width: 170,
  5547. multi: true,
  5548. closeable: false,
  5549. style: '',
  5550. delay: 300,
  5551. padding: true,
  5552. height: 300,
  5553. };
  5554. var webuiPopover = $('#rapidAcceptsUserName').webuiPopover('destroy').webuiPopover(settings);
  5555. //用户姓名选中事件
  5556. $("#rapidAcceptsUserName").on("click", function (t) {
  5557. if ($(webuiPopover).css("display") == "block") {
  5558. refeshPatinetList(true);
  5559. }
  5560. });
  5561. }
  5562. /**
  5563. * 刷新候诊病人列表
  5564. */
  5565. function refeshPatinetList(flag) {
  5566. //如果是重新加载病人列表,需要重置下标
  5567. if (flag) {
  5568. //重置下标
  5569. pageIndex = 0;
  5570. msg_list_loading = true;
  5571. }
  5572. var userName = $('#rapidAcceptsUserName').val();
  5573. if (!(userName == null || userName == "" || isChinese(userName))) {
  5574. return;
  5575. }
  5576. $.ajax({
  5577. type: "POST",
  5578. url: '/thmz/getUnClinicWithPage',
  5579. contentType: "application/json;charset=UTF-8",
  5580. dataType: "json",
  5581. data: JSON.stringify({"name": userName, "pageIndex": pageIndex}),
  5582. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5583. success: function (res) {
  5584. if (res == '401' || res == 401) {
  5585. window.location.href = '/thmz/login/view'
  5586. return;
  5587. }
  5588. if (res.code == 0) {
  5589. if (res.data != null && res.data.length > 0) {
  5590. $("#webuiPopover0").css("display", "block");
  5591. $("#webuiPopover0 .webui-popover-content").css("max-height", "300px").css("height", "auto");
  5592. var html = '<div class="list-group">';
  5593. for (var i = 0; i < res.data.length; i++) {
  5594. var mzPatientMi = res.data[i];
  5595. html += '<a href="#" class="list-group-item list-group-item-action" onclick="fillUnClinicPatinet(\'' + mzPatientMi.patientId + '\')">';
  5596. if (mzPatientMi.gender == "男") {
  5597. html += '<img src="/thmz/images/boy.png"/>'
  5598. } else if (mzPatientMi.gender == "女") {
  5599. html += '<img src="/thmz/images/girl.png"/>'
  5600. } else if (mzPatientMi.gender == "未知" || mzPatientMi.gender == null) {
  5601. html += '<img src="/thmz/images/girl_or_boy.png"/>'
  5602. }
  5603. html += '<div>' + mzPatientMi.name + '&nbsp;' + mzPatientMi.gender + '&nbsp;';
  5604. html += mzPatientMi.ageString;
  5605. if (mzPatientMi.phoneNo != null && mzPatientMi.phoneNo != "") {
  5606. html += '<span>' + mzPatientMi.phoneNo + '</span>';
  5607. }
  5608. html += '</div></a>';
  5609. }
  5610. html += '</div>';
  5611. if (flag) {
  5612. $("#webuiPopover0 div.webui-popover-content").html("");
  5613. }
  5614. $("#webuiPopover0 div.webui-popover-content").append(html);
  5615. $("#webuiPopover0 div.arrow").css("left", "23px");
  5616. refeshPatinetListScrollEvent();
  5617. } else {
  5618. $("#webuiPopover0").css("display", "none");
  5619. }
  5620. }
  5621. //查询完成,设置加载完成
  5622. msg_list_loading = false;
  5623. }
  5624. });
  5625. }
  5626. /**
  5627. * 病人下拉列表滚动条滚动到底部时继续加载新纪录
  5628. */
  5629. function refeshPatinetListScrollEvent() {
  5630. $('.webui-popover-content').scroll(function (event) {
  5631. var top = $(this).scrollTop();
  5632. var height = $(this).height();
  5633. var scrollHeight = $(this).get(0).scrollHeight;
  5634. if (scrollHeight <= top + height) {
  5635. if (!msg_list_loading) {
  5636. msg_list_loading = true;
  5637. pageIndex = pageIndex + 1;
  5638. refeshPatinetList(false);
  5639. }
  5640. }
  5641. });
  5642. }
  5643. /**
  5644. * 按照病人id查询病人信息
  5645. * @param patientId
  5646. */
  5647. function fillUnClinicPatinet(patientId) {
  5648. $("#rapidAcceptsUserCardNo").val(patientId);
  5649. $("#webuiPopover0").css("display", "none");
  5650. queryUserInfoByCardNo();
  5651. }
  5652. /**
  5653. * 加载主诉,体格检查,诊断窗口
  5654. */
  5655. function initRecommendList() {
  5656. var width = $("#symptom").parent().css("width");
  5657. var settings = {
  5658. placement: 'bottom-right',//值: auto,top,right,bottom,left,top-right,top-left,bottom-right,bottom-left 要显示的位置
  5659. trigger: 'click', //值:click,hover 触发方式 manual 手动
  5660. content: '',//内容,内容可以是函数
  5661. width: width,
  5662. //arrow:false,//是否显示箭头
  5663. multi: true,//在页面允许其他弹出层
  5664. closeable: true,//显示关闭按钮
  5665. style: '', //值:'',inverse
  5666. delay: 300,//延迟时间, 悬浮属性才执行
  5667. padding: true,//内容填充
  5668. height: 320,
  5669. //offsetTop:10,
  5670. cache: true,//如果缓存设置为false,则popover将销毁并重新创建
  5671. };
  5672. //主诉弹窗
  5673. var symptomWebuiPopover = $('#symptom').webuiPopover('destroy').webuiPopover(settings);
  5674. //体格检查弹窗
  5675. settings.height = 260;
  5676. $('#weight').webuiPopover('destroy').webuiPopover(settings);
  5677. //诊断弹窗
  5678. settings.height = 320;
  5679. var diagnoseWebuiPopover = $('#diagnose').webuiPopover('destroy').webuiPopover(settings);
  5680. //西药弹窗
  5681. settings.width = 680;
  5682. settings.closeable = false;
  5683. settings.arrow = false;//显示箭头或不显示箭头
  5684. settings.content = '<div id="westernMedicinePopoverContent"><table id="tb_table_western_medicine"></table></div>';
  5685. //手动触发
  5686. settings.trigger = 'manual';
  5687. var westernMedicineWebuiPopover = $('#western_medicine_name').webuiPopover('destroy').webuiPopover(settings);
  5688. //中药弹窗
  5689. settings.trigger = 'click';
  5690. settings.content = '<div id="chineseMedicinePopoverContent"><table id="tb_table_chinese_medicine"></table></div>';
  5691. //手动触发
  5692. settings.trigger = 'manual';
  5693. var chineseMedicineWebuiPopover = $('#chinese_medicine_name').webuiPopover('destroy').webuiPopover(settings);
  5694. //辅助检查、检验弹窗
  5695. settings.trigger = 'manual';
  5696. settings.content = '<div id="jcJyItemPopoverContent"><table id="tb_table_jc_jy_item"></table></div>';
  5697. var jcJyItemWebuiPopover = $('#jcJyItem').webuiPopover('destroy').webuiPopover(settings);
  5698. //诊疗弹窗
  5699. settings.trigger = 'manual';
  5700. settings.content = '<div id="zlItemPopoverContent"><table id="tb_table_zl_item"></table></div>';
  5701. var zlItemWebuiPopover = $('#zlItem').webuiPopover('destroy').webuiPopover(settings);
  5702. //主诉选中事件
  5703. $("#symptom").on("click", function (t) {
  5704. if ($(symptomWebuiPopover).css("display") == "block") {
  5705. $("#webuiPopover1 div.arrow").css("left", "23px");
  5706. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">主诉</span>';
  5707. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='contentHtml'>";
  5708. html += "</div>";
  5709. html += '<div style="height: 60px; line-height: 60px; font-size: 14px;">' +
  5710. '<div style="float: left">' +
  5711. '<span style="margin-left: 20px;">内容:</span> ' +
  5712. '</div>' +
  5713. '<div style="float: left;">' +
  5714. '<select class="form-control selectpicker show-tick" id="paramsType" dropupAuto="true">' +
  5715. '<option label="常用症状" value="0">常用症状</option>' +
  5716. '<option label="常用时间" value="1">常用时间</option>' +
  5717. '<option label="常用标点" value="2">常用标点</option>' +
  5718. '<option label="常用词" value="3">常用词</option>' +
  5719. '</select> ' +
  5720. '</div>' +
  5721. '<div style="width: 200px;float: left;margin-left: 10px;">' +
  5722. '<input id="paramsNameInput" class="form-control" type="text" style="position: relative;top: 13px;height: 34px;">' +
  5723. '</div>' +
  5724. '<div style="float: left;margin-left: 10px;">' +
  5725. ' <button type="button" class="btn" onclick="saveParams();"' +
  5726. ' style="height: 30px;line-height: 15px;border-color: #2e69eb!important;color: #2e69eb;background-color: white;">' +
  5727. ' <svg class="bi" width="1em" height="1em" fill="currentColor" style="vertical-align: -.15em;margin-right: 10px!important;color: #2e69eb;">' +
  5728. ' <use xlink:href="/thmz/css/bootstrap/bootstrap-icons-1.5.0/bootstrap-icons.svg#plus-circle"></use>' +
  5729. ' </svg>' +
  5730. '新增' +
  5731. ' </button>' +
  5732. ' </div>' +
  5733. '</div>';
  5734. $("#webuiPopover1 div.webui-popover-content").html(html);
  5735. $('#paramsType').selectpicker('refresh');
  5736. $("#paramsType").parent().css("width", "140px").css("height", "34px");
  5737. $("#webuiPopover1").css("z-index", "10");
  5738. if ($("#webuiPopover1").hasClass("in")) {
  5739. loadSymptom();
  5740. }
  5741. }
  5742. //加载智能接诊模块的主诉推荐
  5743. fitSymptomData();
  5744. });
  5745. //体格检查各输入框选中事件
  5746. $("#weight,#temperature,#sphygmus,#breathe,#pressure_high,#pressure_floor,#pressure_high_left,#pressure_floor_left").on("click", function (t) {
  5747. if ($("#webuiPopover2").css("display") == "block") {
  5748. $("#webuiPopover2").css("left", $("#webuiPopover1").css("left"));
  5749. if ($("#healthCheckupContentHtml").html() == null || $("#healthCheckupContentHtml").html() == "") {
  5750. $("#webuiPopover2 div.arrow").css("left", "23px");
  5751. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">体格检查</span>';
  5752. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='healthCheckupContentHtml'>";
  5753. html += "</div>";
  5754. $("#webuiPopover2 div.webui-popover-content").html(html);
  5755. $("#webuiPopover2").css("z-index", "10");
  5756. if ($("#webuiPopover2").hasClass("in")) {
  5757. loadHealthCheckup();
  5758. }
  5759. }
  5760. //loadSymptom();
  5761. } else {
  5762. $('#weight').webuiPopover('show');
  5763. $("#webuiPopover2").css("left", $("#webuiPopover1").css("left"));
  5764. if ($("#healthCheckupContentHtml").html() == null || $("#healthCheckupContentHtml").html() != "") {
  5765. $("#webuiPopover2 div.arrow").css("left", "23px");
  5766. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">体格检查</span>';
  5767. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='healthCheckupContentHtml'>";
  5768. html += "</div>";
  5769. $("#webuiPopover2 div.webui-popover-content").html(html);
  5770. $("#webuiPopover2").css("z-index", "10");
  5771. if ($("#webuiPopover2").hasClass("in")) {
  5772. loadHealthCheckup();
  5773. }
  5774. }
  5775. }
  5776. return false;
  5777. });
  5778. //诊断选中事件
  5779. $("#diagnose").on("click", function (t) {
  5780. $("#western_medicine_name").webuiPopover('hide');
  5781. $("#chinese_medicine_name").webuiPopover('hide');
  5782. $("#jcJyItem").webuiPopover('hide');
  5783. $("#zlItem").webuiPopover('hide');
  5784. if ($(diagnoseWebuiPopover).css("display") == "block") {
  5785. $("#webuiPopover3 div.arrow").css("left", "23px");
  5786. $("#webuiPopover3 a.close").css("margin-top", "15px");
  5787. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">诊断</span>';
  5788. html += '<div class="form-group has-feedback" style="float: right;width: 300px;margin-right: 20px;margin-top: 10px;">' +
  5789. ' <input type="text" class="form-control has-feedback-left" ' +
  5790. ' placeholder="搜索" style="padding-left: 10px;" onkeyup="debounce(loadDiagnose(this.value),100,true)" id="paramsDiagnose">' +
  5791. ' <span class="fa fa-search form-control-feedback right" aria-hidden="true" style="right: 0px;"></span>' +
  5792. ' </div>';
  5793. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='diagnoseContentHtml'>";
  5794. html += "</div>";
  5795. $("#webuiPopover3 div.webui-popover-content").html(html);
  5796. $("#webuiPopover3").css("z-index", "10");
  5797. //$("#paramsDiagnose").on('input propertychange', loadDiagnose($("#paramsDiagnose").val()));
  5798. //中文会导致查询混乱
  5799. $("#paramsDiagnose").on('compositionstart', function () {
  5800. $("#paramsDiagnose").attr("isNeedPrevent", true);
  5801. });
  5802. $("#paramsDiagnose").on('compositionend', function () {
  5803. $("#paramsDiagnose").attr("isNeedPrevent", false);
  5804. });
  5805. loadDiagnose("");
  5806. }
  5807. //加载智能接诊模块的诊断推荐推荐
  5808. fitDiagnoseData();
  5809. });
  5810. //现病史选中事件
  5811. $("#emrHpi").on("click", function (t) {
  5812. //加载智能接诊模块的现病史推荐推荐
  5813. fitEmrHpiData();
  5814. });
  5815. //既往史选中事件
  5816. $("#emrPs").on("click", function (t) {
  5817. //加载智能接诊模块的既往史推荐推荐
  5818. fitEmrPsData();
  5819. });
  5820. // //西药选中事件
  5821. // $("#western_medicine_name").on("click", function (t) {
  5822. // if ($(westernMedicineWebuiPopover).css("display") == "block") {
  5823. // $("#westernMedicinePopoverContent").parent().parent().prev().css("left", "23px");
  5824. // loadYpList(0);
  5825. // }
  5826. // });
  5827. // //中药选中事件
  5828. // $("#chinese_medicine_name").on("click", function (t) {
  5829. // if ($(chineseMedicineWebuiPopover).css("display") == "block") {
  5830. // $("#chineseMedicinePopoverContent").parent().parent().prev().css("left", "23px");
  5831. // loadYpList(1);
  5832. // }
  5833. // });
  5834. // //诊疗与医技弹窗选中事件
  5835. // $("#jcJyItem").on("click", function (t) {
  5836. // if ($(jcJyItemWebuiPopover).css("display") == "block") {
  5837. // $("#jcJyItemPopoverContent").parent().parent().prev().css("left", "23px");
  5838. // loadjcJyItemList();
  5839. // }
  5840. // });
  5841. //帮助字典弹窗
  5842. settings.width = 450;
  5843. settings.height = 500;
  5844. settings.placement = 'right';//值: auto,top,right,bottom,left,top-right,top-left,bottom-right,bottom-left 要显示的位置
  5845. settings.content = '<div id="treePopoverContent"><div><ul id="treeDemo" class="ztree"></ul></div></div>';
  5846. settings.trigger = 'click';
  5847. var treeWebuiPopover = $('#treeButton').webuiPopover('destroy').webuiPopover(settings);
  5848. $("#treeButton").on("click", function (t) {
  5849. // $("#treePopoverContent").parent().parent().prev().css("left", "23px");
  5850. //初始化药品,检查检验菜单树
  5851. initzTree();
  5852. });
  5853. }
  5854. /**
  5855. * 新增通用参数
  5856. */
  5857. function saveParams() {
  5858. $.ajax({
  5859. type: "POST",
  5860. url: '/thmz/saveTCommonParams',
  5861. contentType: "application/json;charset=UTF-8",
  5862. dataType: "json",
  5863. data: JSON.stringify({
  5864. "paramsType": $("#paramsType").val(),
  5865. "paramsName": $("#paramsNameInput").val()
  5866. }),
  5867. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5868. success: function (res) {
  5869. if (res == '401' || res == 401) {
  5870. window.location.href = '/thmz/login/view'
  5871. return;
  5872. }
  5873. if (res.code == 0) {
  5874. successMesage(res);
  5875. loadSymptom();
  5876. $("#paramsNameInput").val(null);
  5877. // $("#paramsType").selectpicker('val', 0);
  5878. // $("#paramsType").selectpicker('refresh');
  5879. } else {
  5880. errorMesage(res);
  5881. }
  5882. }
  5883. });
  5884. }
  5885. /**
  5886. * 加载主诉参数列表
  5887. */
  5888. function loadSymptom() {
  5889. $.ajax({
  5890. type: "GET",
  5891. url: '/thmz/loadSymptom',
  5892. contentType: "application/json;charset=UTF-8",
  5893. dataType: "json",
  5894. async: false,
  5895. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5896. success: function (res) {
  5897. if (res == '401' || res == 401) {
  5898. window.location.href = '/thmz/login/view'
  5899. return;
  5900. }
  5901. var html = '';
  5902. if (res.code == 0) {
  5903. if (res.featureList != null && res.featureList.length > 0) {
  5904. html += '<div id="feature">';
  5905. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用症状:</div>';
  5906. html += '<div style="width: calc(100% - 80px); float: left;">';
  5907. for (var i = 0; i < res.featureList.length; i++) {
  5908. 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;">';
  5909. html += res.featureList[i].paramsName;
  5910. html += '</span></button>';
  5911. }
  5912. html += '</div><div style="clear:both"></div></div>';
  5913. }
  5914. if (res.timeList != null && res.timeList.length > 0) {
  5915. html += '<div id="time">';
  5916. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用时间:</div>';
  5917. html += '<div style="width: calc(100% - 80px); float: left;">';
  5918. for (var i = 0; i < res.timeList.length; i++) {
  5919. 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;">';
  5920. html += res.timeList[i].paramsName;
  5921. html += '</span></button>';
  5922. }
  5923. html += '</div><div style="clear:both"></div></div>';
  5924. }
  5925. if (res.characterList != null && res.characterList.length > 0) {
  5926. html += '<div id="character">';
  5927. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用标点:</div>';
  5928. html += '<div style="width: calc(100% - 80px); float: left;">';
  5929. for (var i = 0; i < res.characterList.length; i++) {
  5930. 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;">';
  5931. html += res.characterList[i].paramsName;
  5932. html += '</span></button>';
  5933. }
  5934. html += '</div><div style="clear:both"></div></div>';
  5935. }
  5936. if (res.wordsList != null && res.wordsList.length > 0) {
  5937. html += '<div id="words">';
  5938. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用词:</div>';
  5939. html += '<div style="width: calc(100% - 80px); float: left;">';
  5940. for (var i = 0; i < res.wordsList.length; i++) {
  5941. 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;">';
  5942. html += res.wordsList[i].paramsName;
  5943. html += '</span></button>';
  5944. }
  5945. html += '</div><div style="clear:both"></div></div>';
  5946. }
  5947. } else {
  5948. errorMesage(res);
  5949. }
  5950. $("#contentHtml").html(html);
  5951. }
  5952. });
  5953. }
  5954. /**
  5955. * 加载体格检查参数列表
  5956. */
  5957. function loadHealthCheckup() {
  5958. $.ajax({
  5959. type: "GET",
  5960. url: '/thmz/loadHealthCheckup',
  5961. contentType: "application/json;charset=UTF-8",
  5962. dataType: "json",
  5963. async: false,
  5964. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5965. success: function (res) {
  5966. if (res == '401' || res == 401) {
  5967. window.location.href = '/thmz/login/view'
  5968. return;
  5969. }
  5970. var html = '';
  5971. if (res.code == 0) {
  5972. if (res.weightList != null && res.weightList.length > 0) {
  5973. html += '<div id="weightDiv">';
  5974. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">体重:</div>';
  5975. html += '<div style="width: calc(100% - 80px); float: left;">';
  5976. for (var i = 0; i < res.weightList.length; i++) {
  5977. 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;">';
  5978. html += res.weightList[i].paramsName;
  5979. html += '</span></button>';
  5980. }
  5981. html += '</div><div style="clear:both"></div></div>';
  5982. }
  5983. if (res.temperatureList != null && res.temperatureList.length > 0) {
  5984. html += '<div id="temperatureDiv">';
  5985. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">体温:</div>';
  5986. html += '<div style="width: calc(100% - 80px); float: left;">';
  5987. for (var i = 0; i < res.temperatureList.length; i++) {
  5988. 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;">';
  5989. html += res.temperatureList[i].paramsName;
  5990. html += '</span></button>';
  5991. }
  5992. html += '</div><div style="clear:both"></div></div>';
  5993. }
  5994. if (res.sphygmusList != null && res.sphygmusList.length > 0) {
  5995. html += '<div id="sphygmusDiv">';
  5996. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">脉搏:</div>';
  5997. html += '<div style="width: calc(100% - 80px); float: left;">';
  5998. for (var i = 0; i < res.sphygmusList.length; i++) {
  5999. 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;">';
  6000. html += res.sphygmusList[i].paramsName;
  6001. html += '</span></button>';
  6002. }
  6003. html += '</div><div style="clear:both"></div></div>';
  6004. }
  6005. if (res.breatheList != null && res.breatheList.length > 0) {
  6006. html += '<div id="breatheDiv">';
  6007. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">呼吸:</div>';
  6008. html += '<div style="width: calc(100% - 80px); float: left;">';
  6009. for (var i = 0; i < res.breatheList.length; i++) {
  6010. 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;">';
  6011. html += res.breatheList[i].paramsName;
  6012. html += '</span></button>';
  6013. }
  6014. html += '</div><div style="clear:both"></div></div>';
  6015. }
  6016. if (res.pressureList != null && res.pressureList.length > 0) {
  6017. html += '<div id="pressureDiv">';
  6018. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">血压:</div>';
  6019. html += '<div style="width: calc(100% - 80px); float: left;">';
  6020. for (var i = 0; i < res.pressureList.length; i++) {
  6021. 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;">';
  6022. html += res.pressureList[i].paramsName;
  6023. html += '</span></button>';
  6024. }
  6025. html += '</div><div style="clear:both"></div></div>';
  6026. }
  6027. } else {
  6028. errorMesage(res);
  6029. }
  6030. $("#healthCheckupContentHtml").html(html);
  6031. }
  6032. });
  6033. }
  6034. /**
  6035. * 加载诊断参数列表
  6036. * @param value
  6037. */
  6038. function loadDiagnose(value) {
  6039. if (!$("#webuiPopover3").hasClass("in")) {
  6040. return;
  6041. }
  6042. var isNeedPrevent = $("#paramsDiagnose").attr("isNeedPrevent");
  6043. if (isNeedPrevent == "true") {
  6044. return;
  6045. }
  6046. $.ajax({
  6047. type: "GET",
  6048. url: '/thmz/getIcdCodeByParams?commonParams=' + value,
  6049. contentType: "application/json;charset=UTF-8",
  6050. dataType: "json",
  6051. async: false,
  6052. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6053. success: function (res) {
  6054. if (res == '401' || res == 401) {
  6055. window.location.href = '/thmz/login/view'
  6056. return;
  6057. }
  6058. var html = '';
  6059. if (res.code == 0) {
  6060. if (res.data != null && res.data.length > 0) {
  6061. html += '<div>';
  6062. for (var i = 0; i < res.data.length; i++) {
  6063. 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;">';
  6064. html += res.data[i].name;
  6065. html += '<small>&nbsp;&nbsp;(' + res.data[i].code + ')</small>';
  6066. html += '</span></button>';
  6067. }
  6068. html += '</div>';
  6069. }
  6070. } else {
  6071. errorMesage(res);
  6072. }
  6073. $("#diagnoseContentHtml").html(html);
  6074. }
  6075. });
  6076. }
  6077. /**
  6078. * 填充诊断
  6079. * @param value
  6080. * @param code
  6081. */
  6082. function fitDiagnoseValue(value, code) {
  6083. if (code === null || code === "") {
  6084. return;
  6085. }
  6086. var html = '';
  6087. var childrenNum = $("#diagnoseTags").children().length;
  6088. if (childrenNum == 6) {
  6089. errorMesageSimaple("最多填写六个诊断!");
  6090. return;
  6091. }
  6092. var diagnoseValue = $("#diagnoseValue").val();
  6093. if (diagnoseValue == null || diagnoseValue == "") {
  6094. diagnoseValue = code;
  6095. } else {
  6096. if (diagnoseValue.indexOf(code) != -1) {
  6097. errorMesageSimaple("诊断已存在,请勿重复添加!");
  6098. return;
  6099. }
  6100. diagnoseValue += "," + code;
  6101. }
  6102. $("#diagnoseValue").val(diagnoseValue);
  6103. if (childrenNum == 0) {
  6104. html += '<span class="el-tag--mainDiagnosis" ';
  6105. } else {
  6106. html += '<span class="el-tag--secondaryDiagnosis" ';
  6107. }
  6108. 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>';
  6109. $("#diagnoseTags").append(html);
  6110. $("#diagnoseTags").parent().parent().css("height", $("#diagnoseTags").height());
  6111. }
  6112. /**
  6113. * 移除诊断
  6114. * @param code
  6115. */
  6116. function removeDiagnoseValue(code) {
  6117. var childrenIndex = 0;
  6118. var children = $("#diagnoseTags").children();
  6119. for (var i = 0; i < children.length; i++) {
  6120. if ($(children[i]).attr("id") == code) {
  6121. childrenIndex = i;
  6122. break;
  6123. }
  6124. }
  6125. $($("#diagnoseTags").children("span")[childrenIndex]).remove();
  6126. if (childrenIndex == 0) {
  6127. $($("#diagnoseTags").children("span")[childrenIndex]).removeClass("el-tag--secondaryDiagnosis").addClass("el-tag--mainDiagnosis");
  6128. }
  6129. var diagnoseValue = $("#diagnoseValue").val();
  6130. $("#diagnoseValue").val(diagnoseValue.replace(code, ""));
  6131. $("#diagnoseTags").parent().parent().css("height", $("#diagnoseTags").height());
  6132. }
  6133. /**
  6134. * 点击通用参数属性值时设置值到对应的区域
  6135. * @param value
  6136. * @param id
  6137. */
  6138. function fitValue(value, id) {
  6139. //当选择的是血压时
  6140. if (id == "pressure_") {
  6141. var arr = value.split("/");
  6142. $("#pressure_high").val(arr[0]);
  6143. $("#pressure_floor").val(arr[1]);
  6144. if ($("#pressureLeftFlag").hasClass("in")) {
  6145. $("#pressure_high_left").val(arr[0]);
  6146. $("#pressure_floor_left").val(arr[1]);
  6147. }
  6148. //当选的是体重,体温,脉搏和呼吸时
  6149. } else if (id == "weight" || id == "temperature" || id == "sphygmus" || id == "breathe") {
  6150. $("#" + id).val(value);
  6151. } else {
  6152. //主诉拼写时
  6153. var valueExist = $("#" + id).val();
  6154. if (valueExist != null && valueExist != "") {
  6155. value = valueExist + value;
  6156. }
  6157. $("#" + id).val(value);
  6158. }
  6159. }
  6160. /**
  6161. * 加载药品列表数列表
  6162. * @param index
  6163. */
  6164. function loadYpList(index, event) {
  6165. if (event != null) {
  6166. if (event.keyCode == 38 || event.keyCode == 40 || event.keyCode == 13) {
  6167. //上下键不刷新表格
  6168. return;
  6169. }
  6170. }
  6171. var medicinePopoverContent = null;
  6172. var tableMedicine = null;
  6173. var MedicineName = null;
  6174. //var groupNo=null;
  6175. if (index == 0) {
  6176. medicinePopoverContent = "westernMedicinePopoverContent";
  6177. tableMedicine = "tb_table_western_medicine";
  6178. MedicineName = "western_medicine_name";
  6179. // groupNo=71;
  6180. }
  6181. if (index == 1) {
  6182. medicinePopoverContent = "chineseMedicinePopoverContent";
  6183. tableMedicine = "tb_table_chinese_medicine";
  6184. MedicineName = "chinese_medicine_name";
  6185. // groupNo=$("#zyClassType").val();
  6186. }
  6187. // if (!$("#" + medicinePopoverContent).parent().parent().parent().hasClass("in")) {
  6188. // return;
  6189. // }
  6190. $('#' + MedicineName).webuiPopover('show');
  6191. $('#' + tableMedicine).bootstrapTable('refresh');
  6192. $('#' + tableMedicine).bootstrapTable({
  6193. url: '/thmz/getYpListByCommonParams', //请求后台的URL(*)
  6194. method: 'GET', //请求方式(*)
  6195. toolbar: '#toolbar', //工具按钮用哪个容器
  6196. striped: true, //是否显示行间隔色
  6197. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  6198. pagination: false, //是否显示分页(*)
  6199. sortable: true, //是否启用排序
  6200. sortOrder: "asc", //排序方式
  6201. queryParams: function (params) {
  6202. var groupNo = null;
  6203. if (index == 0) {
  6204. groupNo = 71;
  6205. }
  6206. if (index == 1) {
  6207. groupNo = $("#zyClassType").val();
  6208. }
  6209. var temp = {
  6210. groupNo: groupNo,
  6211. commonParams: $("#" + MedicineName).val()
  6212. };
  6213. return temp;
  6214. }, //传递参数(*)
  6215. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  6216. pageNumber: 1, //初始化加载第一页,默认第一页
  6217. pageSize: 5, //每页的记录行数(*)
  6218. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  6219. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  6220. strictSearch: true,
  6221. showColumns: false, //是否显示所有的列
  6222. showRefresh: false, //是否显示刷新按钮
  6223. minimumCountColumns: 2, //最少允许的列数
  6224. clickToSelect: true, //是否启用点击选中行
  6225. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  6226. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  6227. cardView: false, //是否显示详细视图
  6228. detailView: false,
  6229. //rowStyle:rowStyle,//通过自定义函数设置行样式
  6230. ajaxOptions: {
  6231. headers: {
  6232. 'Accept': 'application/json',
  6233. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  6234. }
  6235. },
  6236. columns: [
  6237. // {
  6238. // title: '药品说明书',
  6239. // field: 'op',
  6240. // align: "center",
  6241. // valign: 'middle',
  6242. // formatter: function (value, row, index) {
  6243. // var str = '<button type="button" class="btn btn-primary btn-sm" onclick="hlyyypsms(\'' + row.code + '\',\'' + row.serial + '\')">说明书</button>';
  6244. // return [str].join('');
  6245. // }
  6246. // },
  6247. {
  6248. field: 'code',
  6249. title: '编码',
  6250. align: "center",
  6251. valign: 'middle',
  6252. // sortable: true
  6253. }, {
  6254. field: 'name',
  6255. title: '药品名称',
  6256. align: "center",
  6257. valign: 'middle',
  6258. // sortable: true
  6259. }
  6260. , {
  6261. field: 'specification',
  6262. title: '规格',
  6263. align: "center",
  6264. valign: 'middle',
  6265. // sortable: true
  6266. }, {
  6267. field: 'manufactory',
  6268. title: '生产厂家',
  6269. align: "center",
  6270. valign: 'middle',
  6271. // sortable: true
  6272. }, {
  6273. field: 'miniUnitName',
  6274. title: '单位',
  6275. align: "center",
  6276. valign: 'middle',
  6277. // sortable: true
  6278. }, {
  6279. field: 'chargeAmount',
  6280. title: '零售价',
  6281. align: "center",
  6282. valign: 'middle',
  6283. // sortable: true
  6284. formatter: function (value, row, index) {
  6285. if (value == null) {
  6286. return '0.0元';
  6287. }
  6288. return value.toFixed(2) + "元";
  6289. }
  6290. }, {
  6291. field: 'drugWinDesc',
  6292. title: '剂量',
  6293. align: "center",
  6294. valign: 'middle',
  6295. // sortable: true
  6296. }, {
  6297. field: 'stockAmountVirtual',
  6298. title: '库存数量',
  6299. align: "center",
  6300. valign: 'middle',
  6301. // sortable: true
  6302. }, {
  6303. field: 'selfpayProp',
  6304. title: '自付比例',
  6305. align: "center",
  6306. valign: 'middle',
  6307. // sortable: true
  6308. formatter: function (value, row, index) {
  6309. if (value != null) {
  6310. return value + '%';
  6311. }
  6312. }
  6313. }, {
  6314. field: 'ybComment',
  6315. title: '医保说明',
  6316. align: "center",
  6317. valign: 'middle',
  6318. // sortable: true
  6319. }, {
  6320. field: 'nationalCode',
  6321. title: '医保编码',
  6322. align: "left",
  6323. valign: 'middle',
  6324. // sortable: true
  6325. }
  6326. ],
  6327. responseHandler: function (res) {
  6328. if (res == '401' || res == 401) {
  6329. window.location.href = '/thmz/login/view'
  6330. return;
  6331. }
  6332. var ress = eval(res);
  6333. if (ress.code == -1) {
  6334. errorMesage(res);
  6335. return {
  6336. "total": 0,//总页数
  6337. "rows": {} //数据
  6338. };
  6339. }
  6340. $("#" + medicinePopoverContent).parent().css("background", "#EBEBE4");
  6341. return {
  6342. "total": ress.data.length,//总页数
  6343. "rows": ress.data //数据
  6344. };
  6345. },
  6346. onClickRow: function (row, $element) {
  6347. $('#' + MedicineName).webuiPopover('hide');
  6348. if (index == 0) {
  6349. clearWesternMedicine(false);
  6350. checkYpInfo(row.code, row.serial, row.ypType, true, null, 3);
  6351. }
  6352. if (index == 1) {
  6353. checkZyInfo(row.code, row.serial, $("#zyClassType").val(), true);
  6354. }
  6355. }
  6356. });
  6357. }
  6358. /**
  6359. * 按照药品的编码 和药品拆零规格查询药品信息 西药
  6360. * @param code
  6361. * @param serial
  6362. * @param groupNo
  6363. * @param needNotice 是否需要提示 当用户操作的时候 true 需要提示, 范文和处方回写的时候false不需要提示
  6364. * @param orderNo 处方号,回写的时候需要用,因为有的处方没有满5个
  6365. * @param type 操作类型 0 修改 1 医疗范文 2 就诊详情 3 处方开立
  6366. */
  6367. function checkYpInfo(code, serial, groupNo, needNotice, orderNo, type) {
  6368. //判断是否有重复的项目 返回true 说明有重复的
  6369. if (verifyRepeat(code, serial, null, 0)) {
  6370. return;
  6371. }
  6372. $("#current_groupNo").val(groupNo);
  6373. //不需要每次都关闭这个帮助字典
  6374. //$("#treeButton").webuiPopover('hide');
  6375. $.ajax({
  6376. type: "GET",
  6377. url: '/thmz/getYpZdDictByCodeAndSerial?code=' + code + "&serial=" + serial + "&deptNo=" + localStorage.getItem("currentDeptNo") + "&groupNo=71",
  6378. contentType: "application/json;charset=UTF-8",
  6379. dataType: "json",
  6380. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6381. async: needNotice,//当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  6382. success: function (res) {
  6383. if (res == '401' || res == 401) {
  6384. window.location.href = '/thmz/login/view'
  6385. return;
  6386. }
  6387. if (res.code == 0) {
  6388. if (res.data != null) {
  6389. //如果
  6390. if ($("#xyTab").find("li") == null || $("#xyTab").find("li").length == 0) {
  6391. initNavTabs(0, groupNo, orderNo);
  6392. }
  6393. var cfdesc = '普药';
  6394. if (groupNo == '91') {
  6395. cfdesc = '医材';
  6396. } else if (groupNo == '111') {
  6397. cfdesc = '麻、精一';
  6398. } else if (groupNo == '131') {
  6399. cfdesc = '精二';
  6400. }
  6401. // else if(groupNo=='151'){
  6402. // cfdesc='诊疗';
  6403. // }
  6404. //每个处方不能超过5个药品
  6405. var tableId = $("#xyTab li.active").find("a").attr("href");
  6406. var childrens = $(tableId).find("div:eq(0)").children().length;
  6407. var currentGroupNo = $(tableId).find("input.current_groupNo").val();
  6408. var flag = childrens === 5;
  6409. if (!needNotice) {
  6410. flag = childrens === 5 && $(tableId).is(':last-child');
  6411. }
  6412. if (currentGroupNo != null && currentGroupNo != '' && groupNo != currentGroupNo) {
  6413. //当前编辑的处方与选中的品类非同一处方能保存的
  6414. var currentGroupNos = $("#xyTabContent").find("input.current_groupNo");
  6415. //是否需要新增处方页,以保存医材处方
  6416. var needAddTable = true;
  6417. for (var i = 0; i < currentGroupNos.length; i++) {
  6418. if ($(currentGroupNos[i]).val() == groupNo) {
  6419. var next = $(currentGroupNos[i]).next();
  6420. if (needAddTable && $(next).children().length < 5) {
  6421. var parentId = $(currentGroupNos[i]).parent().attr("id");
  6422. //切换处方
  6423. $("#xyTab").find("a[href='#" + parentId + "']").off("click").tab('show');
  6424. //$("#xyTab").find("a[href='#" + tableId + "']").off("click").click();
  6425. //因为存在没有满5个的处方页,直接保存到该页
  6426. needAddTable = false;
  6427. fitWesternMedicine(res, groupNo, type);
  6428. }
  6429. }
  6430. }
  6431. if (needAddTable) {
  6432. //91 医材
  6433. var message = "医材需要单独处方,是否需要新增医材处方?";
  6434. if (groupNo == '71') {
  6435. message = "普通西成药需要单独处方,是否需要新增处方?"
  6436. } else if (groupNo == '111') {
  6437. message = "麻、精一药物需要单独处方,是否需要新增处方?"
  6438. } else if (groupNo == '131') {
  6439. message = "精二药物需要单独处方,是否需要新增处方?"
  6440. }
  6441. if (needNotice) {
  6442. $("#messageModal").modal();
  6443. $("#messageContent").html(message);
  6444. $("#messageButton").off("click").on("click", function (t) {
  6445. $("#messageModal").modal("hide");
  6446. refreshNavTabs(0, groupNo, orderNo);
  6447. fitWesternMedicine(res, groupNo, type);
  6448. // //选中药品后,光标默认到用法
  6449. // $("#supplyType").next().click();
  6450. });
  6451. $("#cancelButton").off("click");
  6452. } else {
  6453. refreshNavTabs(0, groupNo, orderNo);
  6454. fitWesternMedicine(res, groupNo, type);
  6455. }
  6456. }
  6457. //当前编辑的处方非普通西药处方
  6458. } else if (flag) {
  6459. if (needNotice) {
  6460. $("#messageModal").modal();
  6461. $("#messageContent").html("单张处方最多只能开具5个药品,是否需要新增处方?");
  6462. $("#messageButton").off("click").on("click", function (t) {
  6463. $("#messageModal").modal("hide");
  6464. refreshNavTabs(0, groupNo, orderNo);
  6465. fitWesternMedicine(res, groupNo, type);
  6466. });
  6467. $("#cancelButton").off("click");
  6468. } else {
  6469. refreshNavTabs(0, groupNo, orderNo);
  6470. fitWesternMedicine(res, groupNo, type);
  6471. }
  6472. } else {
  6473. //修改药品
  6474. if (orderNo != null) {
  6475. //西药处方数量
  6476. // var xyTabLiLength = $("#xyTab li").length;
  6477. // if (xyTabLiLength < orderNo) {
  6478. //
  6479. // } else {
  6480. // $("#xyTab li.active").find("a").find("small.cfdesc").text("(" + cfdesc + ")");
  6481. // }
  6482. var tableId = orderNoAndTableIdMap.get(orderNo);
  6483. if (tableId != null && tableId != "") {
  6484. //切换处方
  6485. $("#xyTab").find("a[href='#" + tableId + "']").off("click").tab('show');
  6486. //$("#xyTab").find("a[href='#" + tableId + "']").off("click").click();
  6487. $("#xyTab li.active").find("a").find("small.cfdesc").text("(" + cfdesc + ")");
  6488. } else {
  6489. refreshNavTabs(0, groupNo, orderNo);
  6490. }
  6491. fitWesternMedicine(res, groupNo, type);
  6492. } else {
  6493. $("#xyTab li.active").find("a").find("small.cfdesc").text("(" + cfdesc + ")");
  6494. fitWesternMedicine(res, groupNo, type);
  6495. }
  6496. }
  6497. }
  6498. } else {
  6499. errorMesage(res);
  6500. }
  6501. }
  6502. });
  6503. }
  6504. /**
  6505. * 药品与项目自费信息提示
  6506. * @param res
  6507. * @param projectDesc
  6508. */
  6509. function hintProjectSelfPayInfo(selfpayProp, projectDesc) {
  6510. var zgmztczf = $("#zgmztczf").val();
  6511. if ((zgmztczf == 1 || zgmztczf == "1") && selfpayProp != null) {
  6512. selfpayProp = Number(selfpayProp);
  6513. if (selfpayProp > 0) {
  6514. var titile = "当前项目含自费" + projectDesc + ",请与患者提前确认是否继续使用,并签署自费承诺书!";
  6515. if (selfpayProp < 1) {
  6516. titile = "当前项目含部分自费" + projectDesc + ",请与患者提前确认是否继续使用,并签署自费承诺书!";
  6517. }
  6518. warningMesageSimaple(titile);
  6519. }
  6520. }
  6521. }
  6522. /**
  6523. * 按照药品的编码 和药品拆零规格查询药品信息 中药
  6524. * @param code
  6525. * @param serial
  6526. * @param groupNo 药房信息
  6527. * @param async 当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  6528. */
  6529. function checkZyInfo(code, serial, groupNo, async) {
  6530. //判断是否有重复的项目 返回true 说明有重复的
  6531. if (verifyRepeat(code, serial, null, 1)) {
  6532. return;
  6533. }
  6534. $.ajax({
  6535. type: "GET",
  6536. url: '/thmz/getYpZdDictByCodeAndSerial?code=' + code + "&serial=" + serial + "&deptNo=" + localStorage.getItem("currentDeptNo") + "&groupNo=" + groupNo,
  6537. contentType: "application/json;charset=UTF-8",
  6538. dataType: "json",
  6539. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6540. async: async,//当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  6541. success: function (res) {
  6542. if (res == '401' || res == 401) {
  6543. window.location.href = '/thmz/login/view'
  6544. return;
  6545. }
  6546. if (res.code == 0) {
  6547. if (res.data != null) {
  6548. hintProjectSelfPayInfo(res.data.selfpayProp, "药品");
  6549. //如果
  6550. if ($("#zyTab").find("li") == null || $("#zyTab").find("li").length == 0) {
  6551. initNavTabs(1, null, null);
  6552. //$("input.zyfs").val(1);
  6553. }
  6554. $("#chinese_medicine_name").val(res.data.name);
  6555. $("#chinese_medicine_name").blur();
  6556. //$("#zy_drugWin").val(res.data.weight);
  6557. $("#zy_packRetprice").val(res.data.packRetprice);
  6558. $("#chinese_medicine_current_code").val(res.data.code);
  6559. $("#chinese_medicine_current_serial").val(res.data.serial);
  6560. if (async) {
  6561. //选中药品后,光标默认到数量输入框
  6562. $("#zy_drugWin").focus();
  6563. // prevEleId = 'zy_drugWin';
  6564. }
  6565. }
  6566. } else {
  6567. errorMesage(res);
  6568. }
  6569. }
  6570. });
  6571. }
  6572. /**
  6573. * 加载辅助检查、检验列表
  6574. * @param index
  6575. */
  6576. function loadjcJyItemList(event) {
  6577. if (event != null) {
  6578. if (event.keyCode == 38 || event.keyCode == 40 || event.keyCode == 13) {
  6579. //上下键不刷新表格
  6580. return;
  6581. }
  6582. }
  6583. // if (!$("#jcJyItemPopoverContent").parent().parent().parent().hasClass("in")) {
  6584. // return;
  6585. // }
  6586. $('#jcJyItem').webuiPopover('show');
  6587. $('#tb_table_jc_jy_item').bootstrapTable('refresh');
  6588. $('#tb_table_jc_jy_item').bootstrapTable({
  6589. url: '/thmz/getJcJyItemByCommonParams', //请求后台的URL(*)
  6590. method: 'GET', //请求方式(*)
  6591. toolbar: '#toolbar', //工具按钮用哪个容器
  6592. striped: true, //是否显示行间隔色
  6593. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  6594. pagination: false, //是否显示分页(*)
  6595. sortable: true, //是否启用排序
  6596. sortOrder: "asc", //排序方式
  6597. queryParams: function (params) {
  6598. var temp = {
  6599. commonParams: $("#jcJyItem").val()
  6600. };
  6601. return temp;
  6602. }, //传递参数(*)
  6603. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  6604. pageNumber: 1, //初始化加载第一页,默认第一页
  6605. pageSize: 5, //每页的记录行数(*)
  6606. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  6607. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  6608. strictSearch: true,
  6609. showColumns: false, //是否显示所有的列
  6610. showRefresh: false, //是否显示刷新按钮
  6611. minimumCountColumns: 2, //最少允许的列数
  6612. clickToSelect: true, //是否启用点击选中行
  6613. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  6614. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  6615. cardView: false, //是否显示详细视图
  6616. detailView: false,
  6617. //rowStyle:rowStyle,//通过自定义函数设置行样式
  6618. ajaxOptions: {
  6619. headers: {
  6620. 'Accept': 'application/json',
  6621. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  6622. }
  6623. },
  6624. columns: [
  6625. {
  6626. field: 'code',
  6627. title: '编码',
  6628. align: "center",
  6629. valign: 'middle',
  6630. // sortable: true
  6631. }, {
  6632. field: 'name',
  6633. title: '名称',
  6634. align: "center",
  6635. valign: 'middle',
  6636. // sortable: true
  6637. }
  6638. , {
  6639. field: 'execUnitName',
  6640. title: '执行科室',
  6641. align: "center",
  6642. valign: 'middle',
  6643. // sortable: true
  6644. }, {
  6645. field: 'type',
  6646. title: '项目类型',
  6647. align: "center",
  6648. valign: 'middle',
  6649. // sortable: true
  6650. formatter: function (value, row, index) {
  6651. if (value == 1 || value == "1") {
  6652. return "检验";
  6653. }
  6654. if (value == 2 || value == "2") {
  6655. return "辅助检查";
  6656. }
  6657. if (value == 3 || value == "3") {
  6658. return "诊疗";
  6659. }
  6660. return "";
  6661. }
  6662. },
  6663. ],
  6664. responseHandler: function (res) {
  6665. if (res == '401' || res == 401) {
  6666. window.location.href = '/thmz/login/view'
  6667. return;
  6668. }
  6669. var ress = eval(res);
  6670. if (ress.code == -1) {
  6671. errorMesage(res);
  6672. return {
  6673. "total": 0,//总页数
  6674. "rows": {} //数据
  6675. };
  6676. }
  6677. $("#jcJyItemPopoverContent").parent().css("background", "#EBEBE4");
  6678. return {
  6679. "total": ress.data.length,//总页数
  6680. "rows": ress.data //数据
  6681. };
  6682. },
  6683. onClickRow: function (row, $element) {
  6684. $('#jcJyItem').webuiPopover('hide');
  6685. $("#jcJyZltype").val(row.type);
  6686. $("#execUnit").selectpicker('val', row.execUnit);//默认不选中
  6687. $("#execUnit").selectpicker('refresh');
  6688. if (row.type == 1) {
  6689. //检验
  6690. $("#jyZdSampleDiv").removeClass("hide").addClass("in");
  6691. $("#yshPartDiv").removeClass("in").addClass("hide");
  6692. if (row.sampleCode != null && row.sampleCode != "") {
  6693. $("#jyZdSample").selectpicker('val', row.sampleCode);
  6694. $('#jyZdSample').selectpicker('refresh');
  6695. }
  6696. } else if (row.type == 2) {
  6697. //检查
  6698. $("#yshPartDiv").removeClass("hide").addClass("in");
  6699. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  6700. if (row.bwCode != null && row.bwCode != "") {
  6701. $("#yshPart").selectpicker('val', row.bwCode);
  6702. $('#yshPart').selectpicker('refresh');
  6703. }
  6704. }
  6705. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  6706. checkJcJyItemInfo(row.code, row.name, row.type, true);
  6707. }
  6708. });
  6709. }
  6710. /**
  6711. * 加载诊疗列表
  6712. * @param index
  6713. */
  6714. function loadZlItemList(event) {
  6715. if (event != null) {
  6716. if (event.keyCode == 38 || event.keyCode == 40 || event.keyCode == 13) {
  6717. //上下键不刷新表格
  6718. return;
  6719. }
  6720. }
  6721. $('#zlItem').webuiPopover('show');
  6722. $('#tb_table_zl_item').bootstrapTable('refresh');
  6723. $('#tb_table_zl_item').bootstrapTable({
  6724. url: '/thmz/getZlItemByCommonParams', //请求后台的URL(*)
  6725. method: 'GET', //请求方式(*)
  6726. toolbar: '#toolbar', //工具按钮用哪个容器
  6727. striped: true, //是否显示行间隔色
  6728. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  6729. pagination: false, //是否显示分页(*)
  6730. sortable: true, //是否启用排序
  6731. sortOrder: "asc", //排序方式
  6732. queryParams: function (params) {
  6733. var temp = {
  6734. commonParams: $("#zlItem").val()
  6735. };
  6736. return temp;
  6737. }, //传递参数(*)
  6738. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  6739. pageNumber: 1, //初始化加载第一页,默认第一页
  6740. pageSize: 5, //每页的记录行数(*)
  6741. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  6742. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  6743. strictSearch: true,
  6744. showColumns: false, //是否显示所有的列
  6745. showRefresh: false, //是否显示刷新按钮
  6746. minimumCountColumns: 2, //最少允许的列数
  6747. clickToSelect: true, //是否启用点击选中行
  6748. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  6749. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  6750. cardView: false, //是否显示详细视图
  6751. detailView: false,
  6752. //rowStyle:rowStyle,//通过自定义函数设置行样式
  6753. ajaxOptions: {
  6754. headers: {
  6755. 'Accept': 'application/json',
  6756. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  6757. }
  6758. },
  6759. columns: [
  6760. {
  6761. field: 'code',
  6762. title: '编码',
  6763. align: "center",
  6764. valign: 'middle',
  6765. // sortable: true
  6766. }, {
  6767. field: 'name',
  6768. title: '名称',
  6769. align: "center",
  6770. valign: 'middle',
  6771. // sortable: true
  6772. }
  6773. , {
  6774. field: 'execUnitName',
  6775. title: '执行科室',
  6776. align: "center",
  6777. valign: 'middle',
  6778. // sortable: true
  6779. }
  6780. , {
  6781. field: 'chargeAmount',
  6782. title: '价格',
  6783. align: "center",
  6784. valign: 'middle',
  6785. // sortable: true
  6786. formatter: function (value, row, index) {
  6787. if (value == null) {
  6788. return "0.00元";
  6789. }
  6790. return value.toFixed(2) + "元";
  6791. }
  6792. }, {
  6793. field: 'descriptions',
  6794. title: '规格',
  6795. align: "center",
  6796. valign: 'middle',
  6797. // sortable: true
  6798. }, {
  6799. field: 'selfpayProp',
  6800. title: '自付比例',
  6801. align: "center",
  6802. valign: 'middle',
  6803. // sortable: true
  6804. formatter: function (value, row, index) {
  6805. if (value != null) {
  6806. return value + '%';
  6807. }
  6808. }
  6809. }, {
  6810. field: 'connotation',
  6811. title: '医保说明',
  6812. align: "center",
  6813. valign: 'middle',
  6814. // sortable: true
  6815. }, {
  6816. field: 'nationalCode',
  6817. title: '医保编码',
  6818. align: "center",
  6819. valign: 'left',
  6820. // sortable: true
  6821. }
  6822. ],
  6823. responseHandler: function (res) {
  6824. if (res == '401' || res == 401) {
  6825. window.location.href = '/thmz/login/view'
  6826. return;
  6827. }
  6828. var ress = eval(res);
  6829. if (ress.code == -1) {
  6830. errorMesage(res);
  6831. return {
  6832. "total": 0,//总页数
  6833. "rows": {} //数据
  6834. };
  6835. }
  6836. $("#zlItemPopoverContent").parent().css("background", "#EBEBE4");
  6837. return {
  6838. "total": ress.data.length,//总页数
  6839. "rows": ress.data //数据
  6840. };
  6841. },
  6842. onClickRow: function (row, $element) {
  6843. hintProjectSelfPayInfo(row.selfpayProp, "诊疗");
  6844. $('#zlItem').webuiPopover('hide');
  6845. $("#zlExecUnit").selectpicker('val', row.execUnit);//默认不选中
  6846. $("#zlExecUnit").selectpicker('refresh');
  6847. //诊疗
  6848. if ($("#zlTab").find("li") == null || $("#zlTab").find("li").length == 0) {
  6849. initNavTabs(3, null, null);
  6850. }
  6851. $("#zlItem").val(row.name);
  6852. $("#zlItem").blur();
  6853. $("#zlItemPrice").val(row.chargeAmount);
  6854. $("#chargeUnit").val(row.specification);
  6855. $("#zl_current_code").val(row.code);
  6856. $("#itemQuantity").val(1);
  6857. $("#descriptions").val(row.descriptions);
  6858. $("#descriptions").attr('title', row.descriptions);
  6859. $("#dayZlNum").selectpicker('val', 1);//默认不选中
  6860. $("#dayZlNum").selectpicker('refresh');
  6861. $("#orderFrequencyZl").selectpicker('val', 'ONCE');//默认不选中
  6862. $("#orderFrequencyZl").selectpicker('refresh');
  6863. calculateZl(false);
  6864. $("#chargeUnit").focus();
  6865. return;
  6866. }
  6867. });
  6868. }
  6869. /**
  6870. * 诊疗与医技选中
  6871. * @param code
  6872. * @param name 回写的时候可以设置null
  6873. * @param type 1 检验 2 检查
  6874. * @param async 当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  6875. */
  6876. //function checkJcJyItemInfo(code, name, type) {
  6877. function checkJcJyItemInfo(code, name, type, async) {
  6878. // //判断是否有重复的项目 返回true 说明有重复的
  6879. // if (verifyRepeat(code, null, 2)) {
  6880. // return;
  6881. // }
  6882. //不需要每次都关闭帮助树
  6883. //$("#treeButton").webuiPopover('hide');
  6884. $.ajax({
  6885. type: "GET",
  6886. url: '/thmz/getJcJyItemChargeByCode?code=' + code + '&jcJyZltype=' + type,
  6887. contentType: "application/json;charset=UTF-8",
  6888. dataType: "json",
  6889. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6890. async: async,//当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  6891. success: function (res) {
  6892. if (res == '401' || res == 401) {
  6893. window.location.href = '/thmz/login/view'
  6894. return;
  6895. }
  6896. if (res.code == 0) {
  6897. if (res.data != null) {
  6898. hintProjectSelfPayInfo(res.selfpayProp, type == 1 ? "检验" : "辅助检查");
  6899. //如果
  6900. if ($("#jcjyTab").find("li") == null || $("#jcjyTab").find("li").length == 0) {
  6901. initNavTabs(2, null, null);
  6902. }
  6903. if (name == null) {
  6904. name = res.name;
  6905. }
  6906. $("#jcJyItem").val(name);
  6907. $("#jcJyItem").blur();
  6908. $("#jcjyItemPrice").val(res.totalAmount);
  6909. $("#jcjy_current_code").val(code);
  6910. $("#execUnit").selectpicker('val', res.execUnit);//默认不选中
  6911. $("#execUnit").selectpicker('refresh');
  6912. // if (async) {
  6913. // if (type == 1) {
  6914. // //选中项目后,光标默认到数量输入框
  6915. // $("#jyZdSample").next().click();
  6916. // // prevEleId = 'jyZdSample';
  6917. // } else if (type == 2) {
  6918. // $("#yshPart").next().click();
  6919. // // prevEleId = 'yshPart';
  6920. // }
  6921. // }
  6922. }
  6923. } else {
  6924. errorMesage(res);
  6925. }
  6926. }
  6927. });
  6928. }
  6929. /**
  6930. * 查询辅助检查、检验项目明细
  6931. * @param code 编码
  6932. * @param jcJyZltype 1 检验 2 检查
  6933. */
  6934. function getJcJyItemChargeByCode(code, jcJyZltype) {
  6935. if (code != null) {
  6936. $("#itemCodeSearch").val(code);
  6937. $("#jcJyZltypeSearch").val(jcJyZltype);
  6938. } else if ($("#jcjy_current_code").val() == null || $("#jcjy_current_code").val() == '') {
  6939. errorMesageSimaple("未选中任何项目!");
  6940. return;
  6941. }
  6942. $("#jcJyItemModal").modal("show");
  6943. $('#jcJyItemTable').bootstrapTable('refresh');
  6944. $('#jcJyItemTable').bootstrapTable({
  6945. url: '/thmz/getJcJyItemChargeByCode', //请求后台的URL(*)
  6946. method: 'GET', //请求方式(*)
  6947. toolbar: '#toolbar', //工具按钮用哪个容器
  6948. striped: true, //是否显示行间隔色
  6949. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  6950. pagination: false, //是否显示分页(*)
  6951. sortable: true, //是否启用排序
  6952. sortOrder: "asc", //排序方式
  6953. queryParams: function (params) {
  6954. var itemCodeSearch = $("#itemCodeSearch").val();
  6955. var jcJyZltypeSearch = $("#jcJyZltypeSearch").val();
  6956. if (itemCodeSearch == null || itemCodeSearch == "") {
  6957. itemCodeSearch = $("#jcjy_current_code").val();
  6958. jcJyZltypeSearch = $("#jcJyZltype").val();
  6959. }
  6960. var temp = {
  6961. code: itemCodeSearch,
  6962. jcJyZltype: jcJyZltypeSearch
  6963. };
  6964. return temp;
  6965. }, //传递参数(*)
  6966. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  6967. pageNumber: 1, //初始化加载第一页,默认第一页
  6968. pageSize: 5, //每页的记录行数(*)
  6969. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  6970. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  6971. strictSearch: true,
  6972. showColumns: false, //是否显示所有的列
  6973. showRefresh: false, //是否显示刷新按钮
  6974. minimumCountColumns: 2, //最少允许的列数
  6975. clickToSelect: true, //是否启用点击选中行
  6976. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  6977. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  6978. cardView: false, //是否显示详细视图
  6979. detailView: false,
  6980. //rowStyle:rowStyle,//通过自定义函数设置行样式
  6981. ajaxOptions: {
  6982. headers: {
  6983. 'Accept': 'application/json',
  6984. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  6985. }
  6986. },
  6987. columns: [
  6988. {
  6989. field: 'tcCode',
  6990. title: '项目编码',
  6991. align: "center",
  6992. valign: 'middle',
  6993. // sortable: true
  6994. }, {
  6995. field: 'code',
  6996. title: '收费编码',
  6997. align: "center",
  6998. valign: 'middle',
  6999. // sortable: true
  7000. }
  7001. , {
  7002. field: 'name',
  7003. title: '收费名称',
  7004. align: "center",
  7005. valign: 'middle',
  7006. // sortable: true
  7007. }, {
  7008. field: 'num',
  7009. title: '数量',
  7010. align: "center",
  7011. valign: 'middle',
  7012. // sortable: true
  7013. }, {
  7014. field: 'chargeAmount',
  7015. title: '单价',
  7016. align: "center",
  7017. valign: 'middle',
  7018. // sortable: true
  7019. formatter: function (value, row, index) {
  7020. if (value == null || value == "") {
  7021. return 0;
  7022. }
  7023. return value.toFixed(2);
  7024. }
  7025. }, {
  7026. field: 'totalAmount',
  7027. title: '总金额',
  7028. align: "center",
  7029. valign: 'middle',
  7030. // sortable: true
  7031. formatter: function (value, row, index) {
  7032. if (value == null || value == "") {
  7033. return 0;
  7034. }
  7035. return value.toFixed(2);
  7036. }
  7037. }, {
  7038. field: 'selfpayProp',
  7039. title: '自付比例',
  7040. align: "center",
  7041. valign: 'middle',
  7042. // sortable: true
  7043. formatter: function (value, row, index) {
  7044. if (value != null) {
  7045. return value + '%';
  7046. }
  7047. }
  7048. }, {
  7049. field: 'connotation',
  7050. title: '医保说明',
  7051. align: "center",
  7052. valign: 'middle',
  7053. // sortable: true
  7054. }
  7055. ],
  7056. responseHandler: function (res) {
  7057. if (res == '401' || res == 401) {
  7058. window.location.href = '/thmz/login/view'
  7059. return;
  7060. }
  7061. $("#itemCodeSearch").val(null);
  7062. var ress = eval(res);
  7063. if (ress.code == -1) {
  7064. errorMesage(res);
  7065. return {
  7066. "total": 0,//总页数
  7067. "rows": {} //数据
  7068. };
  7069. }
  7070. return {
  7071. "total": ress.data.length,//总页数
  7072. "rows": ress.data //数据
  7073. };
  7074. }
  7075. });
  7076. }
  7077. /**
  7078. * 判断是否有重复的项目 返回true 说明有重复的
  7079. * @param code 编码
  7080. * @param serial 药品规格 null 时是非药品
  7081. * @param chargeUnitCode 检查部位或者检验物 null 时是 诊疗
  7082. * @param index
  7083. */
  7084. function verifyRepeat(code, serial, chargeUnitCode, index) {
  7085. //是新增药品还是编辑 true 修改 默认false
  7086. var updateFlag = null;
  7087. if (index == 0) {
  7088. updateFlag = $("#western_medicine_update_flag").val();
  7089. } else if (index == 1) {
  7090. updateFlag = $("#chinese_medicine_update_flag").val();
  7091. } else if (index == 2) {
  7092. updateFlag = $("#jcjy_update_flag").val();
  7093. } else if (index == 3) {
  7094. updateFlag = $("#zl_update_flag").val();
  7095. }
  7096. if (updateFlag == undefined || updateFlag == null) {
  7097. updateFlag = false;
  7098. }
  7099. if (updateFlag == "true" || updateFlag == true) {
  7100. return false;
  7101. }
  7102. var tabId = null;
  7103. //西药
  7104. if (index == 0) {
  7105. tabId = "xyTab";
  7106. } else if (index == 1) {
  7107. //中成药
  7108. tabId = "zyTab";
  7109. } else if (index == 2) {
  7110. //辅助检查、检验
  7111. tabId = "jcjyTab";
  7112. } else if (index == 3) {
  7113. //诊疗
  7114. tabId = "zlTab";
  7115. } else if (index == 4) {
  7116. //入院
  7117. tabId = "zyReqTab";
  7118. }
  7119. var tableId = $("#" + tabId + " li.active").find("a").attr("href");
  7120. var items = $(tableId).find("div:eq(0)").find("div.form-group");
  7121. var groupId = null;
  7122. if (index == 0) {
  7123. groupId = $("#groupId").val();
  7124. }
  7125. if (items != null && items.length > 0) {
  7126. for (var i = 0; i < items.length; i++) {
  7127. if (serial == null) {
  7128. var temporary_items_code = $(items[i]).find("input.temporary_items_code").val();
  7129. var temporary_items_desc_value = $(items[i]).find("input.temporary_items_desc_value").val();
  7130. if (chargeUnitCode == null && code === temporary_items_code) {
  7131. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  7132. return true;
  7133. }
  7134. if (code === temporary_items_code && chargeUnitCode === temporary_items_desc_value) {
  7135. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  7136. return true;
  7137. }
  7138. } else {
  7139. if (index == 0) {
  7140. //西药需要判断组号,因为可能会有不同组的皮试用药,需要相同的药品
  7141. var temporary_items_groupId = $(items[i]).find("input.temporary_items_groupId").val();
  7142. var temporary_items_code = $(items[i]).find("input.temporary_items_code").val();
  7143. var temporary_items_serial = $(items[i]).find("input.temporary_items_serial").val();
  7144. if (code === temporary_items_code && serial === temporary_items_serial && groupId === temporary_items_groupId) {
  7145. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  7146. return true;
  7147. }
  7148. } else {
  7149. var temporary_items_code = $(items[i]).find("input.temporary_items_code").val();
  7150. var temporary_items_serial = $(items[i]).find("input.temporary_items_serial").val();
  7151. if (code === temporary_items_code && serial === temporary_items_serial) {
  7152. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  7153. return true;
  7154. }
  7155. }
  7156. }
  7157. }
  7158. }
  7159. return false;
  7160. }
  7161. /**
  7162. * 初始化处方分页
  7163. * @param index 0 西药 1 中药 2 诊疗 3 入院
  7164. * @param groupNo 初始化时候的药房分类
  7165. * @param orderNo 初始化时候的处方组号
  7166. */
  7167. function initNavTabs(index, groupNo, orderNo) {
  7168. var tabId = null;
  7169. var tabContentId = null;
  7170. var paneId = null;
  7171. var cfdesc = '普药';
  7172. //西药
  7173. if (index == 0) {
  7174. tabId = "xyTab";
  7175. tabContentId = "xyTabContent";
  7176. paneId = "xycf_" + getUID();
  7177. } else if (index == 1) {
  7178. //中草药
  7179. tabId = "zyTab";
  7180. tabContentId = "zyTabContent";
  7181. paneId = "zycf_" + getUID();
  7182. cfdesc = '中草药';
  7183. } else if (index == 2) {
  7184. //医技
  7185. tabId = "jcjyTab";
  7186. tabContentId = "jcjyTabContent";
  7187. paneId = "jcjycf_" + getUID();
  7188. cfdesc = '辅助检查、检验';
  7189. } else if (index == 3) {
  7190. //诊疗
  7191. tabId = "zlTab";
  7192. tabContentId = "zlTabContent";
  7193. paneId = "zlcf_" + getUID();
  7194. cfdesc = '诊疗';
  7195. } else if (index == 4) {
  7196. //住院
  7197. tabId = "zyReqTab";
  7198. tabContentId = "zyReqTabContent";
  7199. paneId = "zyReqcf_" + getUID();
  7200. cfdesc = '入院';
  7201. }
  7202. var tabHtml = '<li class="active"><a href="#' + paneId + '" role="tab" data-toggle="tab" ';
  7203. if (index == 0) {
  7204. tabHtml += ' onclick=xyTableOnClick("' + paneId + '")';
  7205. }
  7206. tabHtml += '>处方 <small class="cfdesc">(' + cfdesc + ')</small></a></li>';
  7207. $("#" + tabId).html(tabHtml);
  7208. var html = '<div class="tab-pane fade in active" id="' + paneId + '" style="height: 100%;min-height: 285px;position: relative;">';
  7209. html += '<img src="/thmz/images/prescription.png" style="margin-top: 5px;"/>';
  7210. html += '<input class="current_groupNo" type="hidden"/>';
  7211. html += ' <div class="cf_content rb_item" style="height: 230px;padding-top: 5px;overflow-y: auto;"></div>' +
  7212. ' <div style="height: 30px;border-top: 1px solid #ddd;width: 100%;position: absolute;bottom:0;padding-top: 10px;">';
  7213. html += '<div style="width: 460px;">'
  7214. if (index == 1) {
  7215. html += '<div style="width: 130px;float: left;line-height: 34px;">' +
  7216. ' <label class="my_label_2">复煎:</label>' +
  7217. ' <div style="width: 69px;float: left;">' +
  7218. ' <input type="number" class="form-control " id="cyFj" placeholder="请输入" value="1"/>' +
  7219. ' </div>次' +
  7220. ' </div>';
  7221. html += '<div style="width: 130px;float: left;line-height: 34px;">' +
  7222. ' <label class="my_label_2">分服:</label>' +
  7223. ' <div style="width: 69px;float: left;">' +
  7224. ' <input type="number" class="form-control " id="cyFfcs" placeholder="请输入" value="2"/>' +
  7225. ' </div>次' +
  7226. ' </div>';
  7227. html += '<div style="width: 180px;float: left;">' +
  7228. ' <label class="my_label_2">用法:</label>' +
  7229. ' <div style="width: 135px;float: left;">' +
  7230. ' <select class="form-control selectpicker show-tick useType"' +
  7231. ' title="请选择" id="useType_1">' +
  7232. ' </select>' +
  7233. ' </div>' +
  7234. ' </div>';
  7235. html += '</div><div style="width: 460px;">'
  7236. html += '<input id="singleAmount" type="hidden"/>';
  7237. }
  7238. html += '<div style="width: 130px;float: left;padding-left: 7px;padding-top: 8px;">金额:<span class="cf_amount">0.0</span><span>元</span></div>';
  7239. if (index == 0) {
  7240. html += '<div style="width: 310px;float: left;color: red;padding-top: 8px;">说明:此费用包含药品给药方式所产生的费用!</div>';
  7241. }
  7242. // else if (index == 1) {
  7243. // html += '<div style="width: 310px;float: left;color: red;padding-top: 8px;">说明:此费用包含药品代煎所产生的费用!</div>';
  7244. // }
  7245. html += '</div></div></div>';
  7246. $("#" + tabContentId).html(html);
  7247. if (index == 1) {
  7248. var water = '<option value="加凉水">加凉水</option><option value="加温水">加温水</option><option value="加开水">加开水</option><option value="加冰水">加冰水</option><option value="加糖水">加糖水</option>';
  7249. $('#cyJssm').html(water);
  7250. $('#cyJssm').selectpicker('refresh');
  7251. $("#cyJssm").selectpicker('val', "加凉水");
  7252. $('#cyJssm').selectpicker('refresh');
  7253. initAllMzYshZdFysm();
  7254. //initZyOrderFrequencys("zy_orderFrequency_1", false);
  7255. initZySupplyTypes("zy_supplyType_1", false);
  7256. }
  7257. if (groupNo != null && groupNo != "") {
  7258. //设置当前药品的品类
  7259. $("#" + paneId).find("input.current_groupNo").val(groupNo);
  7260. }
  7261. if (orderNo != null && orderNo != "" && orderNoAndTableIdMap != null) {
  7262. orderNoAndTableIdMap.put(orderNo, paneId);
  7263. tableIdAndOrderNoMap.put(paneId, orderNo);
  7264. }
  7265. }
  7266. /**
  7267. * 清空处方分页
  7268. * @param index 0 西药 1 中药 2 诊疗 3 入院
  7269. */
  7270. function clearNavTabs(index) {
  7271. var tabId = null;
  7272. var tabContentId = null;
  7273. //西药
  7274. if (index == 0) {
  7275. tabId = "xyTab";
  7276. tabContentId = "xyTabContent";
  7277. } else if (index == 1) {
  7278. //中草药
  7279. tabId = "zyTab";
  7280. tabContentId = "zyTabContent";
  7281. $("#cyJsl").val(400);
  7282. $("#cyZql").val(200);
  7283. $("#cyFj").val(1);
  7284. $("#cyFfcs").val(2);
  7285. $("#cyMtjs").val(1);
  7286. $("#zyfs").val(null);
  7287. $("#cyJssm").selectpicker('val', "加凉水");
  7288. $('#cyJssm').selectpicker('refresh');
  7289. $("#zy_supplyType_1").selectpicker('val', null);
  7290. $('#zy_supplyType_1').selectpicker('refresh');
  7291. } else if (index == 2) {
  7292. //辅助检查、检验
  7293. tabId = "jcjyTab";
  7294. tabContentId = "jcjyTabContent";
  7295. } else if (index == 3) {
  7296. //医技
  7297. tabId = "zlTab";
  7298. tabContentId = "zlTabContent";
  7299. } else if (index == 4) {
  7300. //医技
  7301. tabId = "zyReqTab";
  7302. tabContentId = "zyReqTabContent";
  7303. }
  7304. $("#" + tabId).html(null);
  7305. $("#" + tabContentId).html(null);
  7306. }
  7307. /**
  7308. * 添加处方分页
  7309. * @param index 0 西药 1 中药 2 诊疗 3 入院
  7310. * @param groupNo 71 普通西药 91 医材 111 麻、精一 131 精二 151 诊疗
  7311. * @param orderNo 处方号
  7312. */
  7313. function refreshNavTabs(index, groupNo, orderNo) {
  7314. var tabId = null;
  7315. var tabContentId = null;
  7316. var paneIdPrfix = null;
  7317. var cfdesc = '普药';
  7318. //西药
  7319. if (index == 0) {
  7320. tabId = "xyTab";
  7321. tabContentId = "xyTabContent";
  7322. paneIdPrfix = "xycf_";
  7323. if (groupNo == '91') {
  7324. cfdesc = '医材';
  7325. } else if (groupNo == '111') {
  7326. cfdesc = '麻、精一';
  7327. } else if (groupNo == '131') {
  7328. cfdesc = '精二';
  7329. }
  7330. // else if(groupNo=='151'){
  7331. // cfdesc='诊疗';
  7332. // }
  7333. } else if (index == 1) {
  7334. //中草药
  7335. tabId = "zyTab";
  7336. tabContentId = "zyTabContent";
  7337. paneIdPrfix = "zycf_";
  7338. cfdesc = '中草药';
  7339. } else if (index == 2) {
  7340. //辅助检查、检验
  7341. tabId = "jcjyTab";
  7342. tabContentId = "jcjyTabContent";
  7343. paneIdPrfix = "jcjycf_";
  7344. cfdesc = '辅助检查、检验';
  7345. } else if (index == 3) {
  7346. //诊疗
  7347. tabId = "zlTab";
  7348. tabContentId = "zlTabContent";
  7349. paneIdPrfix = "zlcf_";
  7350. cfdesc = '诊疗';
  7351. } else if (index == 4) {
  7352. //入院
  7353. tabId = "zyReqTab";
  7354. tabContentId = "zyReqTabContent";
  7355. paneIdPrfix = "zyReqcf_";
  7356. cfdesc = '入院';
  7357. }
  7358. // var tableId = $("#"+tabId+" li.active").find("a").attr("href");
  7359. // var length = $(tableId).find("div:eq(0)").children().length;
  7360. // if(length==0){
  7361. // //当前处方是空白的,不需要新增处方
  7362. // return;
  7363. // }
  7364. var cfTitle = "处方" + " <small class=\"cfdesc\">(" + cfdesc + ")</small>";
  7365. var paneId = paneIdPrfix + getUID();
  7366. //清除选中的样式
  7367. $("#" + tabId).find("li.active").removeClass("active");
  7368. var tabHtml = '<li><a href="#' + paneId + '" role="tab" data-toggle="tab"';
  7369. if (index == 0) {
  7370. tabHtml += ' onclick=xyTableOnClick("' + paneId + '")';
  7371. }
  7372. tabHtml += '>' + cfTitle + '</a';
  7373. tabHtml += '</li>';
  7374. $("#" + tabId).append(tabHtml);
  7375. var html = '<div class="tab-pane fade in active" id="' + paneId + '" style="height: 100%;min-height: 285px;position: relative;">' +
  7376. '<img src="/thmz/images/prescription.png" style="margin-top: 5px;"/>' +
  7377. '<input class="current_groupNo" type="hidden"/>' +
  7378. ' <div class="cf_content rb_item" style="height: 230px;padding-top: 5px;overflow-y: auto;"></div>' +
  7379. ' <div style="height: 30px;border-top: 1px solid #ddd;width: 100%;position: absolute;bottom:0;">' +
  7380. '<div style="width: 460px;">' +
  7381. '<div style="width: 130px;float: left;padding-left: 7px;padding-top: 8px;">金额:<span class="cf_amount">0.0</span><span>元</span></div>';
  7382. if (index == 0) {
  7383. html += '<div style="width: 310px;float: left;color: red;padding-top: 8px;">说明:此费用包含药品给药方式所产生的费用!</div>';
  7384. }
  7385. html += '</div></div>';
  7386. $("#" + tabContentId).append(html);
  7387. //切换处方
  7388. $("#" + tabId).find("a[href='#" + paneId + "']").off("click").tab('show');
  7389. if (groupNo != null && groupNo != "") {
  7390. //设置当前药品的品类
  7391. $("#" + paneId).find("input.current_groupNo").val(groupNo);
  7392. }
  7393. if (orderNo != null && orderNo != "" && orderNoAndTableIdMap != null) {
  7394. orderNoAndTableIdMap.put(orderNo, paneId);
  7395. tableIdAndOrderNoMap.put(paneId, orderNo);
  7396. }
  7397. }
  7398. /**
  7399. * 判断是否需要自动增加组号
  7400. * @param res
  7401. */
  7402. function autoAddGroupId(res) {
  7403. var tableId = $("#xyTab li.active").find("a").attr("href");
  7404. var childrens = $(tableId).find("div:eq(0)").children();
  7405. var prevCategoriesFlag = null;
  7406. if (childrens != null && childrens.length > 0) {
  7407. prevCategoriesFlag = $(childrens[childrens.length - 1]).find("input.temporary_items_categoriesFlag").val();
  7408. if (prevCategoriesFlag == "" || prevCategoriesFlag == undefined) {
  7409. prevCategoriesFlag = null;
  7410. }
  7411. }
  7412. if (!(res.data.categoriesFlag == 2 || res.data.categoriesFlag == "2" || res.data.categoriesFlag == 1 || res.data.categoriesFlag == "1") ||
  7413. ((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)) {
  7414. //非针剂默认要切换组号 或者 是针剂,但是上一个药品不是针剂,这时候也要新换一个组号
  7415. var last = parseInt($("#groupId > option:last").val());
  7416. $("#groupId").selectpicker('val', last);
  7417. $('#groupId').selectpicker('refresh');
  7418. }
  7419. }
  7420. /**
  7421. * 填充西药选中的内容
  7422. * @param res
  7423. * @param groupNo
  7424. * @param type 操作类型 0 修改 1 医疗范文 2 就诊详情 3 处方开立
  7425. */
  7426. function fitWesternMedicine(res, groupNo, type) {
  7427. hintProjectSelfPayInfo(res.data.selfpayProp, "药品");
  7428. if (type != 0) {
  7429. //处方修改的时候不改变组号
  7430. autoAddGroupId(res);
  7431. }
  7432. $("#categoriesFlag").val(res.data.categoriesFlag);
  7433. //prevCategoriesFlag = res.data.categoriesFlag;
  7434. $("#western_medicine_name").val(res.data.name);
  7435. $("#western_medicine_name").blur();
  7436. var drugWinHtml = '';
  7437. var index = null;
  7438. if (res.data.weight != null) {
  7439. $("#drugWin").val(res.data.weight);
  7440. $("#drugWinDb").val(res.data.weight);
  7441. drugWinHtml = '<option value="' + res.data.weighUnit + '" desc="' + res.data.weight + '">' + res.data.weighUnitDesc + '</option>';
  7442. index = res.data.weighUnit;
  7443. }
  7444. if (res.data.volum != null) {
  7445. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  7446. $("#drugWin").val(res.data.volum);
  7447. $("#drugWinDb").val(res.data.volum);
  7448. }
  7449. drugWinHtml += '<option value="' + res.data.volUnit + '" desc="' + res.data.volum + '">' + res.data.volUnitDesc + '</option>';
  7450. if (index == null) {
  7451. index = res.data.volUnit;
  7452. }
  7453. }
  7454. if (res.data.miniUnit != null && res.data.miniUnit != "") {
  7455. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  7456. $("#drugWin").val(1);
  7457. $("#drugWinDb").val(1);
  7458. }
  7459. drugWinHtml += '<option value="' + res.data.miniUnit + '" desc="1">' + res.data.miniUnitDesc + '</option>';
  7460. if (index == null) {
  7461. index = res.data.miniUnit;
  7462. }
  7463. }
  7464. $('#drugWinUnit').html(drugWinHtml);
  7465. $('#drugWinUnit').selectpicker('refresh');
  7466. $("#drugWinUnit").selectpicker('val', index);
  7467. $('#drugWinUnit').selectpicker('refresh');
  7468. if (res.data.packUnitDesc != null && res.data.packUnitDesc != "") {
  7469. var html = '<option value="' + res.data.packUnitDesc + '" >' + res.data.packUnitDesc + '</option>';
  7470. $('#packUnit').html(html);
  7471. $('#packUnit').selectpicker('refresh');
  7472. $("#packUnit").selectpicker('val', res.data.packUnitDesc);
  7473. $('#packUnit').selectpicker('refresh');
  7474. }
  7475. $("#packRetprice").val(res.data.packRetprice);
  7476. $("#packSize").val(res.data.packSize);
  7477. $("#western_medicine_current_code").val(res.data.code);
  7478. $("#western_medicine_current_serial").val(res.data.serial);
  7479. if ($("#dayNum").val() == null) {
  7480. //天数 同组药品天数相同
  7481. $("#dayNum").selectpicker('val', 1);
  7482. $('#dayNum').selectpicker('refresh');
  7483. }
  7484. if (($("#supplyType").val() == null || $("#supplyType").val() == "") && res.data.supplyType != null) {
  7485. // 给药方式 同组药品给药方式相同
  7486. $("#supplyType").selectpicker('val', res.data.supplyType);
  7487. $('#supplyType').selectpicker('refresh');
  7488. }
  7489. if (($("#orderFrequency").val() == null || $("#orderFrequency").val() == "") && res.data.frequency != null) {
  7490. //频次编码 同组药品频次编码相同
  7491. $("#orderFrequency").selectpicker('val', res.data.frequency);
  7492. $('#orderFrequency').selectpicker('refresh');
  7493. }
  7494. if ($("#orderFrequency").val() == null || $("#orderFrequency").val() == "") {
  7495. //频次编码 防止频次为空
  7496. $("#orderFrequency").selectpicker('val', "ONCE");
  7497. $('#orderFrequency').selectpicker('refresh');
  7498. }
  7499. $("#tryResult").parent().parent().parent().removeClass("in").addClass("hide");
  7500. if (res.data.psFlag != null && (res.data.psFlag == 1 || res.data.psFlag == "1")) {
  7501. if (res.data.categoriesFlag == 0 || res.data.categoriesFlag == "0" || res.data.categoriesFlag == 2 || res.data.categoriesFlag == "2") {
  7502. initTryResultSelect(res.data.categoriesFlag);
  7503. }
  7504. }
  7505. $("#manufactoryName").val(res.data.manufactoryName);
  7506. $("#specification").val(res.data.specification);
  7507. calculate();
  7508. $("#addPDiv").css("margin-left", "50px");
  7509. $("#hlyyypsms").removeClass("hide").addClass("in");
  7510. $("#western_medicine_name").focus();
  7511. }
  7512. /**
  7513. * 剂量单位改变事件
  7514. */
  7515. function drugWinUnitChange() {
  7516. var desc = $('#drugWinUnit').find("option:selected").attr('desc');
  7517. $("#drugWin").val(desc);
  7518. $("#drugWinDb").val(desc);
  7519. calculate();
  7520. }
  7521. /**
  7522. * 根据选择的内容计算总的用药量
  7523. */
  7524. function calculate() {
  7525. //最小规格剂量
  7526. var drugWinDb = $("#drugWinDb").val();
  7527. //天数
  7528. var dayNum = $("#dayNum").val();
  7529. //当前使用的最小剂量
  7530. var drugWin = $("#drugWin").val();
  7531. //频率
  7532. var times = $('#orderFrequency').find("option:selected").attr('desc');
  7533. //包装规格数量
  7534. var packSize = $("#packSize").val();
  7535. //单价
  7536. var packRetprice = $("#packRetprice").val();
  7537. //当前药房编码
  7538. var currentGroupNo = $("#current_groupNo").val();
  7539. if (drugWinDb == null || drugWinDb === "") {
  7540. if (currentGroupNo == '71') {
  7541. return;
  7542. }
  7543. drugWinDb = 1;
  7544. }
  7545. if (dayNum == null || dayNum === "") {
  7546. if (currentGroupNo == '71') {
  7547. return;
  7548. }
  7549. dayNum = 1;
  7550. }
  7551. if (drugWin == null || drugWin === "") {
  7552. if (currentGroupNo == '71') {
  7553. return;
  7554. }
  7555. drugWin = 1;
  7556. }
  7557. if (times == null || times === "") {
  7558. if (currentGroupNo == '71') {
  7559. return;
  7560. }
  7561. times = 1;
  7562. }
  7563. if (packSize == null || packSize === "") {
  7564. return;
  7565. }
  7566. //拆零总量
  7567. var scatteredTotalNum = Multiply(Multiply(dayNum, drugWin), times);
  7568. //整包装的数量
  7569. var totalNum = Math.ceil(Division(scatteredTotalNum, Multiply(packSize, drugWinDb)));
  7570. $("#gross").val(totalNum);
  7571. $("#totalRetprice").val(Multiply(totalNum, packRetprice).toFixed(2));
  7572. }
  7573. /**
  7574. * 根据选择的总量计算金额 只有医材的时候需要计算
  7575. */
  7576. function calculateSimple() {
  7577. //总量
  7578. var gross = $("#gross").val();
  7579. //单价
  7580. var packRetprice = $("#packRetprice").val();
  7581. $("#totalRetprice").val(Multiply(gross, packRetprice).toFixed(2));
  7582. //当前药房编码
  7583. var currentGroupNo = $("#current_groupNo").val();
  7584. if (currentGroupNo == '91') {
  7585. var dayNum = $("#dayNum").val();
  7586. if (dayNum == null || dayNum == "") {
  7587. //医材默认天数为1
  7588. $("#dayNum").selectpicker('val', 1);
  7589. $('#dayNum').selectpicker('refresh');
  7590. }
  7591. var orderFrequency = $("#orderFrequency").val();
  7592. if (orderFrequency == null || orderFrequency == "") {
  7593. $("#orderFrequency").selectpicker('val', "ONCE");
  7594. $('#orderFrequency').selectpicker('refresh');
  7595. }
  7596. }
  7597. }
  7598. /**
  7599. * 根据中药付数计算金额
  7600. */
  7601. function calculateZyAmount() {
  7602. var singleAmount = $("#singleAmount").val();
  7603. var tableId = $("#zyTab li.active").find("a").attr("href");
  7604. //获取中药付数
  7605. //var zyfs = $(tableId).find("input.zyfs").val();
  7606. var zyfs = $("#zyfs").val();
  7607. var cfAmount = Multiply(zyfs, singleAmount);
  7608. $(tableId).find("span.cf_amount").html(cfAmount);
  7609. calculateTotalAmount(false);
  7610. }
  7611. /**
  7612. * 将病人信息填入患者信息修改form
  7613. * @param patinet
  7614. */
  7615. function fillPlusPatinet(patinet) {
  7616. if (patinet != null) {
  7617. $("#editUserCode").val(patinet.patientId);
  7618. $("#editUserName").val(patinet.name);
  7619. $("#editUserName").blur();
  7620. $("#editUserAge").val(patinet.age);
  7621. $("#editUserAge").blur();
  7622. $("#editUserGender").selectpicker('val', patinet.sex);
  7623. $("#editUserGender").selectpicker('refresh');
  7624. $("#editUserGender").blur();
  7625. $("#editUserBirthDay").val(patinet.birthDayStr);
  7626. $("#editUserBirthDay").blur();
  7627. $('#editUserCertificateType').selectpicker('val', patinet.certificateType);
  7628. $('#editUserCertificateType').selectpicker('refresh');
  7629. $("#editUserCardNo").val(patinet.icCardNo);
  7630. $("#editUserCardNo").attr("title", patinet.icCardNo);
  7631. $("#editUserCardNo").blur();
  7632. $("#editUserPhoneNum").val(patinet.phoneNo);
  7633. $("#editUserPhoneNum").attr("title", patinet.phoneNo);
  7634. $("#editUserPhoneNum").blur();
  7635. $("#editUserPatientsNature").selectpicker('val', patinet.responseType);//默认选中
  7636. $('#editUserPatientsNature').selectpicker('refresh');
  7637. $("#editUserPatientsNature").blur();
  7638. $("#editUserIdCard").val(patinet.socialNo);
  7639. $("#editUserIdCard").attr("title", patinet.socialNo);
  7640. $("#editUserIdCard").blur();
  7641. $('#editUserProvinceCode').selectpicker('val', patinet.provinceCode);
  7642. $('#editUserProvinceCode').selectpicker('refresh');
  7643. initCity(2, patinet.cityCode);
  7644. initDistrict(2, patinet.cityCode, patinet.districtCode);
  7645. $("#editUserDetail").val(patinet.detail);
  7646. $("#editUserDetail").blur();
  7647. $("#editUserContact").val(patinet.relName);
  7648. $("#editUserContactPhone").val(patinet.contractName);
  7649. }
  7650. }
  7651. /**
  7652. * 修改病人信息
  7653. */
  7654. function modifyPatient() {
  7655. $.ajax({
  7656. type: "POST",
  7657. url: '/thmz/modifyPatient',
  7658. contentType: "application/json;charset=UTF-8",
  7659. dataType: "json",
  7660. data: JSON.stringify({
  7661. "name": $("#editUserName").val(),
  7662. "age": $("#editUserAge").val(),
  7663. "sex": $("#editUserGender").val(),
  7664. "birthDay": $("#editUserBirthDay").val(),
  7665. "certificateType": $("#editUserCertificateType").val(),
  7666. "icCardNo": $("#editUserCardNo").val(),
  7667. "phoneNo": $("#editUserPhoneNum").val(),
  7668. "responseType": $("#editUserPatientsNature").val(),
  7669. "socialNo": $("#editUserIdCard").val(),
  7670. "provinceCode": $("#editUserProvinceCode").val(),
  7671. "cityCode": $("#editCityCode").val(),
  7672. "districtCode": $("#editUserDistrictCode").val(),
  7673. "detail": $("#editUserDetail").val(),
  7674. "patientId": $("#editUserCode").val(),
  7675. "relName": $("#editUserContact").val(),
  7676. "contractName": $("#editUserContactPhone").val()
  7677. }),
  7678. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7679. success: function (res) {
  7680. if (res == '401' || res == 401) {
  7681. window.location.href = '/thmz/login/view'
  7682. return;
  7683. }
  7684. if (res.code == 0) {
  7685. $('#editUserModal').modal('hide');
  7686. var patientId = $("#patientId").text();
  7687. if (patientId != null && patientId != 'null' && patientId != "") {
  7688. realClinicalReception(patientId, $("#mzfzSerialNoInClick").val(), $("#mzfzReqTypeNoInClick").val());
  7689. }
  7690. clearPlusPatinet();
  7691. } else {
  7692. errorMesage(res);
  7693. }
  7694. }
  7695. });
  7696. }
  7697. /**
  7698. * 将病人信息修改域置空
  7699. * @param patinet
  7700. */
  7701. function clearPlusPatinet() {
  7702. $("#editUserCode").val(null);
  7703. $("#editUserName").val(null);
  7704. $("#editUserAge").val(null);
  7705. $("#editUserGender").selectpicker('val', '1');
  7706. $("#editUserGender").selectpicker('refresh');
  7707. $("#editUserBirthDay").val(null);
  7708. $('#editUserCertificateType').selectpicker('val', '01');
  7709. $('#editUserCertificateType').selectpicker('refresh');
  7710. $("#editUserCardNo").val(null);
  7711. $("#editUserCardNo").attr("title", null);
  7712. $("#editUserPhoneNum").val(null);
  7713. $("#editUserPhoneNum").attr("title", null);
  7714. $("#editUserPatientsNature").selectpicker('val', '01');//默认选中
  7715. $('#editUserPatientsNature').selectpicker('refresh');
  7716. $("#editUserIdCard").val(null);
  7717. $("#editUserIdCard").attr("title", null);
  7718. $('#editUserProvinceCode').selectpicker('val', null);
  7719. $('#editUserProvinceCode').selectpicker('refresh');
  7720. $('#editCityCode').selectpicker('val', null);
  7721. $('#editCityCode').selectpicker('refresh');
  7722. $('#editUserDistrictCode').selectpicker('val', null);
  7723. $('#editUserDistrictCode').selectpicker('refresh');
  7724. $("#editUserDetail").val(null);
  7725. $("#editUserContact").val(null);
  7726. $("#editUserContactPhone").val(null);
  7727. var openSource = $("#openSource").val();
  7728. if (openSource == 2 || openSource == '2') {
  7729. $("#rapidAcceptsModal").modal();
  7730. } else if (openSource == 3 || openSource == '3') {
  7731. $("#visitingDetailModal").modal();
  7732. }
  7733. $("#openSource").val(null);
  7734. }
  7735. // /**
  7736. // * 保存入院证
  7737. // */
  7738. // function saveBeHospitalized() {
  7739. // $.ajax({
  7740. // type: "POST",
  7741. // url: '/thmz/saveMzZyReq',
  7742. // contentType: "application/json;charset=UTF-8",
  7743. // dataType: "json",
  7744. // data: JSON.stringify({
  7745. // "patientId": $("#patientId").text(),
  7746. // "icdCode": $("#icdCodeBeHospitalized").val(),
  7747. // "icdText": $("#icdTextBeHospitalized").val(),
  7748. // "reqDept": $("#inpatientWardBeHospitalized").val(),
  7749. // "smallDept": $("#smallWardBeHospitalized").val(),
  7750. // "admissStatus": $("#admissStatus").val()
  7751. // }),
  7752. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7753. // success: function (res) {
  7754. // if (res == '401' || res == 401) {
  7755. // window.location.href = '/thmz/login/view'
  7756. // return;
  7757. // }
  7758. // if (res.code == 0) {
  7759. // successMesage(res);
  7760. // $('#beHospitalizedModal').modal('hide');
  7761. // loadInClinicTableList();
  7762. // loadClinicTableList();
  7763. // clearWorkSpace();
  7764. // } else {
  7765. // errorMesage(res);
  7766. // }
  7767. // }
  7768. // });
  7769. // }
  7770. /**
  7771. * 获取按钮组选择的下标
  7772. * @param id
  7773. * @returns {number}
  7774. */
  7775. function getIndex(id) {
  7776. var index = 0;
  7777. var item = $("#" + id).find("button");
  7778. for (var i = 0; i <= item.length; i++) {
  7779. if ($(item[i]).hasClass("btn-primary")) {
  7780. index = i;
  7781. break;
  7782. }
  7783. }
  7784. return index;
  7785. }
  7786. /**
  7787. * 获取时间选择器的时间数组
  7788. * @returns {string[]}
  7789. */
  7790. function getRePortRangeArr() {
  7791. var rePortRange = $('#reportrange span').html();
  7792. var rePortRangeArr = rePortRange.split(" - ");
  7793. rePortRangeArr[0] = rePortRangeArr[0] + " 00:00:00"
  7794. rePortRangeArr[1] = rePortRangeArr[1] + " 23:59:59"
  7795. return rePortRangeArr;
  7796. }
  7797. /**
  7798. * 初始医生工作太配置
  7799. */
  7800. function initWorkspaceConfigForCurrent() {
  7801. $.ajax({
  7802. type: "GET",
  7803. url: '/thmz/getWorkspaceConfigForCurrent',
  7804. dataType: "json",
  7805. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7806. success: function (res) {
  7807. if (res == '401' || res == 401) {
  7808. window.location.href = '/thmz/login/view'
  7809. return;
  7810. }
  7811. if (res.code == 0) {
  7812. if (res.data.symptomFlag == 1) {
  7813. $("#symptomFlag").removeClass("in").addClass("hide");
  7814. if ($("#symptomFlagCheck").parent().hasClass("checked")) {
  7815. $("#symptomFlagCheck").parent().parent().click();//当前选中改为不选中
  7816. }
  7817. } else if (res.data.symptomFlag == 0) {
  7818. $("#symptomFlag").removeClass("hide").addClass("in");
  7819. if (!$("#symptomFlagCheck").parent().hasClass("checked")) {
  7820. $("#symptomFlagCheck").parent().parent().click();//当前不选中改为选中
  7821. }
  7822. }
  7823. if (res.data.emrHpiFlag == 1) {
  7824. $("#emrHpiFlag").removeClass("in").addClass("hide");
  7825. if ($("#emrHpiFlagCheck").parent().hasClass("checked")) {
  7826. $("#emrHpiFlagCheck").parent().parent().click();//当前选中改为不选中
  7827. }
  7828. } else if (res.data.emrHpiFlag == 0) {
  7829. $("#emrHpiFlag").removeClass("hide").addClass("in");
  7830. if (!$("#emrHpiFlagCheck").parent().hasClass("checked")) {
  7831. $("#emrHpiFlagCheck").parent().parent().click();//当前不选中改为选中
  7832. }
  7833. }
  7834. if (res.data.emrPsFlag == 1) {
  7835. $("#emrPsFlag").removeClass("in").addClass("hide");
  7836. if ($("#emrPsFlagCheck").parent().hasClass("checked")) {
  7837. $("#emrPsFlagCheck").parent().parent().click();//当前选中改为不选中
  7838. }
  7839. } else if (res.data.emrPsFlag == 0) {
  7840. $("#emrPsFlag").removeClass("hide").addClass("in");
  7841. if (!$("#emrPsFlagCheck").parent().hasClass("checked")) {
  7842. $("#emrPsFlagCheck").parent().parent().click();//当前不选中改为选中
  7843. }
  7844. }
  7845. if (res.data.personalHistoryFlag == 1) {
  7846. $("#personalHistoryFlag").removeClass("in").addClass("hide");
  7847. if ($("#personalHistoryFlagCheck").parent().hasClass("checked")) {
  7848. $("#personalHistoryFlagCheck").parent().parent().click();//当前选中改为不选中
  7849. }
  7850. } else if (res.data.personalHistoryFlag == 0) {
  7851. $("#personalHistoryFlag").removeClass("hide").addClass("in");
  7852. if (!$("#personalHistoryFlagCheck").parent().hasClass("checked")) {
  7853. $("#personalHistoryFlagCheck").parent().parent().click();//当前不选中改为选中
  7854. }
  7855. }
  7856. if (res.data.familyHistoryFlag == 1) {
  7857. $("#familyHistoryFlag").removeClass("in").addClass("hide");
  7858. if ($("#familyHistoryFlagCheck").parent().hasClass("checked")) {
  7859. $("#familyHistoryFlagCheck").parent().parent().click();//当前选中改为不选中
  7860. }
  7861. } else if (res.data.familyHistoryFlag == 0) {
  7862. $("#familyHistoryFlag").removeClass("hide").addClass("in");
  7863. if (!$("#familyHistoryFlagCheck").parent().hasClass("checked")) {
  7864. $("#familyHistoryFlagCheck").parent().parent().click();//当前不选中改为选中
  7865. }
  7866. }
  7867. if (res.data.obstericalHistoryFlag == 1) {
  7868. $("#obstericalHistoryFlag").removeClass("in").addClass("hide");
  7869. if ($("#obstericalHistoryFlagCheck").parent().hasClass("checked")) {
  7870. $("#obstericalHistoryFlagCheck").parent().parent().click();//当前选中改为不选中
  7871. }
  7872. } else if (res.data.obstericalHistoryFlag == 0) {
  7873. $("#obstericalHistoryFlag").removeClass("hide").addClass("in");
  7874. if (!$("#obstericalHistoryFlagCheck").parent().hasClass("checked")) {
  7875. $("#obstericalHistoryFlagCheck").parent().parent().click();//当前不选中改为选中
  7876. }
  7877. }
  7878. if (res.data.pressureLeftFlag == 1) {
  7879. $("#pressureLeftFlag").removeClass("in").addClass("hide");
  7880. if ($("#pressureLeftFlagCheck").parent().hasClass("checked")) {
  7881. $("#pressureLeftFlagCheck").parent().parent().click();//当前选中改为不选中
  7882. }
  7883. } else if (res.data.pressureLeftFlag == 0) {
  7884. $("#pressureLeftFlag").removeClass("hide").addClass("in");
  7885. if (!$("#pressureLeftFlagCheck").parent().hasClass("checked")) {
  7886. $("#pressureLeftFlagCheck").parent().parent().click();//当前不选中改为选中
  7887. }
  7888. }
  7889. if (res.data.tentativeDiagnosisFlag == 1) {
  7890. $("#tentativeDiagnosisFlag").removeClass("in").addClass("hide");
  7891. if ($("#tentativeDiagnosisFlagCheck").parent().hasClass("checked")) {
  7892. $("#tentativeDiagnosisFlagCheck").parent().parent().click();//当前选中改为不选中
  7893. }
  7894. } else if (res.data.tentativeDiagnosisFlag == 0) {
  7895. $("#tentativeDiagnosisFlag").removeClass("hide").addClass("in");
  7896. if (!$("#tentativeDiagnosisFlagCheck").parent().hasClass("checked")) {
  7897. $("#tentativeDiagnosisFlagCheck").parent().parent().click();//当前不选中改为选中
  7898. }
  7899. }
  7900. if (res.data.checkboxFlag == 1) {
  7901. if ($("#checkboxFlagCheck").parent().hasClass("checked")) {
  7902. $("#checkboxFlagCheck").parent().parent().click();//当前选中改为不选中
  7903. }
  7904. } else if (res.data.checkboxFlag == 0) {
  7905. if (!$("#checkboxFlagCheck").parent().hasClass("checked")) {
  7906. $("#checkboxFlagCheck").parent().parent().click();//当前不选中改为选中
  7907. }
  7908. }
  7909. if (res.data.zlPrintFlag == 1) {
  7910. if ($("#zlPrintFlagCheck").parent().hasClass("checked")) {
  7911. $("#zlPrintFlagCheck").parent().parent().click();//当前选中改为不选中
  7912. }
  7913. } else if (res.data.zlPrintFlag == 0) {
  7914. if (!$("#zlPrintFlagCheck").parent().hasClass("checked")) {
  7915. $("#zlPrintFlagCheck").parent().parent().click();//当前不选中改为选中
  7916. }
  7917. }
  7918. //设置是否默认勾选处方回调
  7919. localStorage.setItem("checkboxFlag", res.data.checkboxFlag);
  7920. } else {
  7921. errorMesage(res);
  7922. }
  7923. }
  7924. });
  7925. }
  7926. /**
  7927. * 保存医生工作台配置
  7928. */
  7929. function saveWorkspaceConfig() {
  7930. var symptomFlag = $("#symptomFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  7931. var emrHpiFlag = $("#emrHpiFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  7932. var emrPsFlag = $("#emrPsFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  7933. var personalHistoryFlag = $("#personalHistoryFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  7934. var familyHistoryFlag = $("#familyHistoryFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  7935. var obstericalHistoryFlag = $("#obstericalHistoryFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  7936. var pressureLeftFlag = $("#pressureLeftFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  7937. var tentativeDiagnosisFlag = $("#tentativeDiagnosisFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  7938. var checkboxFlag = $("#checkboxFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  7939. var zlPrintFlag = $("#zlPrintFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  7940. $.ajax({
  7941. type: "POST",
  7942. url: '/thmz/saveWorkspaceConfig',
  7943. contentType: "application/json;charset=UTF-8",
  7944. dataType: "json",
  7945. data: JSON.stringify({
  7946. "symptomFlag": symptomFlag,
  7947. "emrHpiFlag": emrHpiFlag,
  7948. "emrPsFlag": emrPsFlag,
  7949. "personalHistoryFlag": personalHistoryFlag,
  7950. "familyHistoryFlag": familyHistoryFlag,
  7951. "obstericalHistoryFlag": obstericalHistoryFlag,
  7952. "pressureLeftFlag": pressureLeftFlag,
  7953. "tentativeDiagnosisFlag": tentativeDiagnosisFlag,
  7954. "checkboxFlag": checkboxFlag,
  7955. "zlPrintFlag": zlPrintFlag
  7956. }),
  7957. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7958. success: function (res) {
  7959. if (res == '401' || res == 401) {
  7960. window.location.href = '/thmz/login/view'
  7961. return;
  7962. }
  7963. if (res.code == 0) {
  7964. successMesage(res);
  7965. initWorkspaceConfigForCurrent();
  7966. $("#configWorkspaceModal").modal("hide");
  7967. } else {
  7968. errorMesage(res);
  7969. }
  7970. }
  7971. });
  7972. }
  7973. /**
  7974. * 初始化药品,检查检验菜单树
  7975. */
  7976. function initzTree() {
  7977. var index = getIndex("bill_item_group");
  7978. if (index == 0) {
  7979. $("#western_medicine_name").webuiPopover('hide');
  7980. $.ajax({
  7981. type: "GET",
  7982. url: '/thmz/getYpZdClasses',
  7983. contentType: "application/json;charset=UTF-8",
  7984. dataType: "json",
  7985. async: false,
  7986. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7987. success: function (res) {
  7988. if (res == '401' || res == 401) {
  7989. window.location.href = '/thmz/login/view'
  7990. return;
  7991. }
  7992. if (res.code == 0) {
  7993. // zTree 的参数配置,深入使用请参考 API 文档(setting 配置详解)
  7994. var setting = {
  7995. callback: {
  7996. onClick: zTreeOnClick
  7997. }
  7998. };
  7999. $.fn.zTree.init($("#treeDemo"), setting, res.data);
  8000. var webuiId = $("#treeButton").attr("data-target");
  8001. var top = $("#" + webuiId).css("top");
  8002. if (top.indexOf("-") == 0) {
  8003. $("#" + webuiId).css("top", '0px');
  8004. }
  8005. } else {
  8006. errorMesage(res);
  8007. }
  8008. }
  8009. });
  8010. } else if (index == 2) {
  8011. $("#jcJyItem").webuiPopover('hide');
  8012. $.ajax({
  8013. type: "GET",
  8014. url: '/thmz/getJyJcZdClasses',
  8015. contentType: "application/json;charset=UTF-8",
  8016. dataType: "json",
  8017. async: false,
  8018. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8019. success: function (res) {
  8020. if (res == '401' || res == 401) {
  8021. window.location.href = '/thmz/login/view'
  8022. return;
  8023. }
  8024. if (res.code == 0) {
  8025. // zTree 的参数配置,深入使用请参考 API 文档(setting 配置详解)
  8026. var setting = {
  8027. callback: {
  8028. onClick: zTreeOnClick
  8029. }
  8030. };
  8031. $.fn.zTree.init($("#treeDemo"), setting, res.data);
  8032. var webuiId = $("#treeButton").attr("data-target");
  8033. var top = $("#" + webuiId).css("top");
  8034. if (top.indexOf("-") == 0) {
  8035. $("#" + webuiId).css("top", '0px');
  8036. }
  8037. } else {
  8038. errorMesage(res);
  8039. }
  8040. }
  8041. });
  8042. } else if (index == 1) {
  8043. $("#treeButton").webuiPopover('hide');
  8044. warningMesageSimaple("中药暂无帮助字典");
  8045. } else if (index == 3) {
  8046. $("#treeButton").webuiPopover('hide');
  8047. warningMesageSimaple("诊疗暂无帮助字典");
  8048. } else {
  8049. $("#treeButton").webuiPopover('hide');
  8050. warningMesageSimaple("入院暂无帮助字典");
  8051. }
  8052. }
  8053. /**
  8054. * 节点点击事件
  8055. * @param event
  8056. * @param treeId
  8057. * @param treeNode
  8058. */
  8059. function zTreeOnClick(event, treeId, treeNode) {
  8060. var index = getIndex("bill_item_group");
  8061. if (index == 0) {
  8062. $("#western_medicine_name").val(treeNode.id);
  8063. $('#western_medicine_name').webuiPopover('show');
  8064. loadYpList(0, null);
  8065. } else if (index == 2) {
  8066. $("#jcJyItem").val(treeNode.id);
  8067. $('#jcJyItem').webuiPopover('show');
  8068. loadjcJyItemList(null);
  8069. }
  8070. }
  8071. /**
  8072. * 构建处方参数
  8073. * @param type 1 保存处方 2 保存模板 3 计算金额
  8074. * @returns {any}
  8075. */
  8076. function getParamsForpPrescription(type) {
  8077. var codes = $("#diagnoseValue").val();
  8078. var icdCode = null;
  8079. if (codes != null && codes.length > 0) {
  8080. var arr = codes.split(",");
  8081. if (arr != null) {
  8082. for (i = 0; i < arr.length; i++) {
  8083. if (arr[i] != "") {
  8084. if (icdCode == null) {
  8085. icdCode = arr[i];
  8086. } else {
  8087. icdCode += "," + arr[i];
  8088. }
  8089. }
  8090. }
  8091. }
  8092. }
  8093. var jsonData = JSON.parse('' +
  8094. '{"patientId": "",' +
  8095. '"visitDeptCode":"",' +
  8096. '"firstOrNot":"",' +
  8097. '"icdCode": "",' +
  8098. '"icdText": null,' +
  8099. '"jzFlag": "0",' +
  8100. '"serialNo":"",' +
  8101. '"mzBlRecord": ' +
  8102. '{"firstOrNot": "",' +
  8103. '"emrChiefComplaint": "",' +
  8104. '"emrHpi": "",' +
  8105. '"emrPs": "",' +
  8106. '"emrPe": "",' +
  8107. '"emrFzjc": null,' +
  8108. '"emrProcess": null,' +
  8109. '"emrXyy": "无",' +
  8110. '"emrYypg": "无",' +
  8111. '"emrGnpg": "无",' +
  8112. '"emrJkjy": "",' +
  8113. '"personalHistory": "",' +
  8114. '"familyHistory": "",' +
  8115. '"obstericalHistory": "",' +
  8116. '"weight": "",' +
  8117. '"temperature": "",' +
  8118. '"sphygmus": "",' +
  8119. '"breathe": "",' +
  8120. '"pressureHigh": "",' +
  8121. '"pressureFloor": "",' +
  8122. '"pressureHighLeft": "",' +
  8123. '"pressureFloorLeft": "",' +
  8124. '"tentativeDiagnosis":"",' +
  8125. '"prescriptionDetail":""},' +
  8126. '"mzChargeDetailList": [],' +
  8127. '"mzYjReqList": [],' +
  8128. '"mzZyReq": {"reqDept": "","smallDept": "","admissStatus": "","conditionCode": "","routeOfAdmission": ""},' +
  8129. '"zgmztczf":"",' +
  8130. '"grzhzf":"",' +
  8131. '"readCardResult":"",' +
  8132. '"readCardType":"01"}');
  8133. jsonData.patientId = $("#patientId").text();
  8134. var userIdCode = localStorage.getItem("userIdCode");
  8135. var visitDeptCode = localStorage.getItem(userIdCode);
  8136. if (visitDeptCode == null) {
  8137. visitDeptCode = "";
  8138. }
  8139. jsonData.firstOrNot = visitDeptCode;
  8140. jsonData.firstOrNot = $("input[name='firstOrNot']:checked").val();
  8141. jsonData.icdCode = icdCode;
  8142. jsonData.serialNo = $("#mzfzSerialNoInClick").val();
  8143. if (type == 1) {
  8144. jsonData.turnToConsultationId = $("#turnToConsultationIdInClick").val();
  8145. var mdtrtGrpType = $("#mdtrtGrpType").val();
  8146. var trumFlag = $("#trumFlag").val();
  8147. var relTtpFlag = $("#relTtpFlag").val();
  8148. if (trumFlag == "1" && relTtpFlag == "") {
  8149. errorMesageSimaple("请注意【外伤标志】为【是】,【涉及第三方标志】不能为空!");
  8150. $("#messageButton").attr("disabled", false);
  8151. $("#messageModal").modal("hide");
  8152. throw new Error("请注意【外伤标志】为【是】,【涉及第三方标志】不能为空!");
  8153. }
  8154. var otpErReflFlag = $("#otpErReflFlag").val();
  8155. var expContent = JSON.parse("{}");
  8156. if (mdtrtGrpType != "" && mdtrtGrpType != "-1") {
  8157. expContent.MDTRT_GRP_TYPE = mdtrtGrpType;
  8158. }
  8159. if (trumFlag != "") {
  8160. expContent.TRUM_FLAG = trumFlag;
  8161. }
  8162. if (relTtpFlag != "") {
  8163. expContent.REL_TTP_FLAG = relTtpFlag;
  8164. }
  8165. if (otpErReflFlag != "" && otpErReflFlag != "-1") {
  8166. expContent.OTP_ER_REFL_FLAG = otpErReflFlag;
  8167. }
  8168. jsonData.expContent = JSON.stringify(expContent);
  8169. }
  8170. jsonData.mzBlRecord.firstOrNot = jsonData.firstOrNot;
  8171. jsonData.mzBlRecord.emrChiefComplaint = $("#symptom").val();
  8172. jsonData.mzBlRecord.emrHpi = $("#emrHpi").val();
  8173. jsonData.mzBlRecord.emrPs = $("#emrPs").val();
  8174. jsonData.mzBlRecord.emrPe = $("#otherCheck").val();
  8175. jsonData.mzBlRecord.emrJkjy = $("#healthEducation").val();
  8176. jsonData.mzBlRecord.personalHistory = $("#personalHistory").val();
  8177. jsonData.mzBlRecord.familyHistory = $("#familyHistory").val();
  8178. jsonData.mzBlRecord.obstericalHistory = $("#obstericalHistory").val();
  8179. jsonData.mzBlRecord.weight = $("#weight").val();
  8180. jsonData.mzBlRecord.temperature = $("#temperature").val();
  8181. jsonData.mzBlRecord.sphygmus = $("#sphygmus").val();
  8182. jsonData.mzBlRecord.breathe = $("#breathe").val();
  8183. jsonData.mzBlRecord.pressureHigh = $("#pressure_high").val();
  8184. jsonData.mzBlRecord.pressureFloor = $("#pressure_floor").val();
  8185. jsonData.mzBlRecord.pressureHighLeft = $("#pressure_high_left").val();
  8186. jsonData.mzBlRecord.pressureFloorLeft = $("#pressure_floor_left").val();
  8187. jsonData.mzBlRecord.tentativeDiagnosis = $("#tentativeDiagnosis").val();
  8188. //职工统筹部分参数
  8189. jsonData.zgmztczf = $("#zgmztczf").val();
  8190. jsonData.grzhzf = $("#grzhzf").val();
  8191. jsonData.readCardResult = $("#readCardResult").val();
  8192. //设置处方详情
  8193. var emrFzjc = null;
  8194. var xyTabContents = $("#xyTabContent").find("div.tab-pane");
  8195. //处方号
  8196. var orderNo = 0;
  8197. var arrs = $("span.cf_amount");
  8198. //西药设置
  8199. if (xyTabContents != null && xyTabContents.length > 0) {
  8200. for (var i = 0; i < xyTabContents.length; i++) {
  8201. //当前药品类型
  8202. var currentGroupNo = $(xyTabContents[i]).find("input.current_groupNo").val();
  8203. var formGroups = $(xyTabContents[i]).find("div.form-group");
  8204. if (formGroups != null && formGroups.length > 0) {
  8205. for (var j = 0; j < formGroups.length; j++) {
  8206. var tempJson = JSON.parse('{"chargeItemCode": "","serial": "","quantity": "","drugQuan": "","drugUnit": "","frequency": "","orderDays": "","paySelf": "0","drugWin": "1","instructionCode":"",' +
  8207. '"instructionText":"","orderNo":"","groupOrder":"","supplyCode":"","tryFlag":"","tryResult":"","groupNo":"","cyJssm":"","cyDj":"","cyFysm":"","cyJsl":"","cyZql":"","cyFj":"","cyFfcs":"","cyMtjs":""}');
  8208. tempJson.chargeItemCode = $(formGroups[j]).find("input.temporary_items_code").val();
  8209. tempJson.serial = $(formGroups[j]).find("input.temporary_items_serial").val();
  8210. tempJson.quantity = $(formGroups[j]).find("input.temporary_items_gross").val();
  8211. tempJson.drugQuan = $(formGroups[j]).find("input.temporary_items_drugWin").val();
  8212. tempJson.drugUnit = $(formGroups[j]).find("input.temporary_items_drugWinUnit").val();
  8213. tempJson.frequency = $(formGroups[j]).find("input.temporary_items_orderFrequency").val();
  8214. tempJson.orderDays = $(formGroups[j]).find("input.temporary_items_dayNum").val();
  8215. tempJson.instructionCode = $(formGroups[j]).find("input.temporary_items_medicalAdvice").val();
  8216. tempJson.instructionText = $(formGroups[j]).find("input.temporary_items_medicalAdviceText").val();
  8217. tempJson.supplyCode = $(formGroups[j]).find("input.temporary_items_supplyType").val();
  8218. orderNo = i + 1;
  8219. tempJson.orderNo = orderNo;
  8220. tempJson.groupOrder = $(formGroups[j]).find("input.temporary_items_groupId").val();
  8221. tempJson.groupNo = currentGroupNo;
  8222. var tryResult = $(formGroups[j]).find("input.temporary_items_tryResult").val();
  8223. if (tryResult != undefined || tryResult != null || tryResult != "") {
  8224. if (tryResult == 100 || tryResult == "100") {
  8225. tempJson.tryFlag = 1;
  8226. } else {
  8227. tempJson.tryResult = tryResult;
  8228. }
  8229. }
  8230. jsonData.mzChargeDetailList[jsonData.mzChargeDetailList.length] = tempJson;
  8231. }
  8232. }
  8233. }
  8234. }
  8235. //中草药
  8236. var zyTabContents = $("#zyTabContent").find("div.form-group");
  8237. if (zyTabContents != null && zyTabContents.length > 0) {
  8238. orderNo++;
  8239. var zyfs = $("#zyfs").val();
  8240. if (zyfs == null || zyfs == "") {
  8241. if (type == 3) {
  8242. zyfs = 1;
  8243. } else {
  8244. errorMesageSimaple("中药付数为空,请设置!");
  8245. $("#messageButton").attr("disabled", false);
  8246. throw new Error('中药付数为空,请设置!');
  8247. }
  8248. }
  8249. //中药的类型
  8250. var currentZyClassType = $("#current_zyClassType").val();
  8251. for (var i = 0; i < zyTabContents.length; i++) {
  8252. var tempJson = JSON.parse('{"chargeItemCode": "","serial": "","quantity": "","drugQuan": "","drugUnit": "g","frequency": "","orderDays": "1","paySelf": "0","drugWin": "","instructionCode":"",' +
  8253. '"instructionText":"","orderNo":"1","groupOrder":"1","supplyCode":"","tryFlag":"0","tryResult":"0","groupNo":"","cyJssm":"","cyDj":"","cyFysm":"","cyJsl":"","cyZql":"","cyFj":"","cyFfcs":"","cyMtjs":""}');
  8254. tempJson.chargeItemCode = $(zyTabContents[i]).find("input.temporary_items_code").val();
  8255. tempJson.serial = $(zyTabContents[i]).find("input.temporary_items_serial").val();
  8256. tempJson.quantity = $(zyTabContents[i]).find("input.temporary_items_drugWin").val();
  8257. tempJson.drugQuan = $(zyTabContents[i]).find("input.temporary_items_drugWin").val();
  8258. tempJson.drugWin = zyfs;
  8259. //tempJson.frequency = $("#zy_orderFrequency_1").val();
  8260. tempJson.instructionCode = $(zyTabContents[i]).find("input.temporary_items_zyInstruction").val();
  8261. tempJson.instructionText = $(zyTabContents[i]).find("input.temporary_items_zyInstructionText").val();
  8262. tempJson.cyFysm = $("#useType_1").val();
  8263. tempJson.cyJssm = $("#cyJssm").val();
  8264. tempJson.cyDj = $("#zy_supplyType_1").val();
  8265. tempJson.cyJsl = $("#cyJsl").val();
  8266. tempJson.cyZql = $("#cyZql").val();
  8267. tempJson.cyFj = $("#cyFj").val();
  8268. tempJson.cyFfcs = $("#cyFfcs").val();
  8269. tempJson.cyMtjs = $("#cyMtjs").val();
  8270. tempJson.orderNo = orderNo;
  8271. tempJson.groupNo = currentZyClassType;
  8272. jsonData.mzChargeDetailList[jsonData.mzChargeDetailList.length] = tempJson;
  8273. }
  8274. }
  8275. //辅助检查、检验
  8276. var jcjyTabContents = $("#jcjyTabContent").find("div.form-group");
  8277. if (jcjyTabContents != null && jcjyTabContents.length > 0) {
  8278. orderNo++;
  8279. for (var i = 0; i < jcjyTabContents.length; i++) {
  8280. if (emrFzjc == null) {
  8281. emrFzjc = $(jcjyTabContents[i]).text();
  8282. } else {
  8283. emrFzjc += "," + $(jcjyTabContents[i]).text();
  8284. }
  8285. var tempJson = null;
  8286. //项目类型
  8287. var itemsType = $(jcjyTabContents[i]).find("input.temporary_items_type").val();
  8288. //执行科室
  8289. var execUnit = $(jcjyTabContents[i]).find("input.temporary_items_execUnit").val();
  8290. tempJson = JSON.parse('{"orderCode":"","inspectPart":"","inspectStuff":"","jyRemark":"","orderNo":"1","execDept":""}');
  8291. tempJson.orderCode = $(jcjyTabContents[i]).find("input.temporary_items_code").val();
  8292. if (itemsType == "1" || itemsType == 1) {
  8293. //检验
  8294. tempJson.inspectStuff = $(jcjyTabContents[i]).find("input.temporary_items_desc_value").val();
  8295. } else if (itemsType == "2" || itemsType == 2) {
  8296. //检查
  8297. tempJson.inspectPart = $(jcjyTabContents[i]).find("input.temporary_items_desc_value").val();
  8298. }
  8299. tempJson.jyRemark = $(jcjyTabContents[i]).find("input.temporary_items_remark").val();
  8300. tempJson.orderNo = orderNo;
  8301. tempJson.execDept = execUnit;
  8302. jsonData.mzYjReqList[jsonData.mzYjReqList.length] = tempJson;
  8303. }
  8304. }
  8305. //诊疗
  8306. var zlTabContents = $("#zlTabContent").find("div.form-group");
  8307. if (zlTabContents != null && zlTabContents.length > 0) {
  8308. orderNo++;
  8309. for (var i = 0; i < zlTabContents.length; i++) {
  8310. var tempJson = null;
  8311. //执行科室
  8312. var execUnit = $(zlTabContents[i]).find("input.temporary_items_execUnit").val();
  8313. //诊疗,放入药品类型中入库,因为诊疗是与药品一样直接入明细库,但是是与医技在同一处方开立页面开立
  8314. 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":""}');
  8315. tempJson.chargeItemCode = $(zlTabContents[i]).find("input.temporary_items_code").val();
  8316. tempJson.instructionText = $(zlTabContents[i]).find("input.temporary_items_remark").val();
  8317. tempJson.quantity = $(zlTabContents[i]).find("input.temporary_items_totalNumZl").val();
  8318. tempJson.drugQuan = $(zlTabContents[i]).find("input.temporary_items_itemQuantity").val();
  8319. //因为收费表里的单位长度限制,无法存入库
  8320. //tempJson.drugUnit = $(zlTabContents[i]).find("input.temporary_items_desc_value").val();
  8321. tempJson.frequency = $(zlTabContents[i]).find("input.temporary_items_orderFrequencyZl").val();
  8322. tempJson.orderDays = $(zlTabContents[i]).find("input.temporary_items_dayZlNum").val();
  8323. tempJson.orderNo = orderNo;
  8324. tempJson.execDept = execUnit;
  8325. jsonData.mzChargeDetailList[jsonData.mzChargeDetailList.length] = tempJson;
  8326. }
  8327. }
  8328. //入院
  8329. var zyReqTabContents = $("#zyReqTabContent").find("div.form-group");
  8330. if (zyReqTabContents != null && zyReqTabContents.length > 0) {
  8331. jsonData.mzZyReq.reqDept = $(zyReqTabContents[0]).find("input.temporary_inpatient_ward").val();
  8332. jsonData.mzZyReq.smallDept = $(zyReqTabContents[0]).find("input.temporary_items_small_ward").val();
  8333. jsonData.mzZyReq.admissStatus = $(zyReqTabContents[0]).find("input.temporary_items_admiss_status").val();
  8334. jsonData.mzZyReq.conditionCode = $(zyReqTabContents[0]).find("input.temporary_items_condition_code").val();
  8335. jsonData.mzZyReq.routeOfAdmission = $(zyReqTabContents[0]).find("input.temporary_items_route_of_admission").val();
  8336. }
  8337. //设置诊断名称
  8338. var icdText = null;
  8339. var tagsTexts = $("span.el-select__tags-text");
  8340. if (tagsTexts != null && tagsTexts.length > 0) {
  8341. for (var i = 0; i < tagsTexts.length; i++) {
  8342. if (icdText == null) {
  8343. icdText = $(tagsTexts[i]).text();
  8344. } else {
  8345. icdText += "," + $(tagsTexts[i]).text();
  8346. }
  8347. }
  8348. }
  8349. jsonData.icdText = icdText;
  8350. jsonData.mzBlRecord.emrFzjc = emrFzjc;
  8351. return jsonData;
  8352. }
  8353. /**
  8354. * 保存处方
  8355. */
  8356. function savePrescription() {
  8357. var jsonData = getParamsForpPrescription(1);
  8358. $.ajax({
  8359. type: "POST",
  8360. url: '/thmz/rationalUseOfMedicine',
  8361. contentType: "application/json;charset=UTF-8",
  8362. dataType: "json",
  8363. data: JSON.stringify(jsonData),
  8364. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8365. success: function (res) {
  8366. if (res == '401' || res == 401) {
  8367. window.location.href = '/thmz/login/view'
  8368. return;
  8369. }
  8370. $("#messageButton").attr("disabled", false);
  8371. if (res.code == 0) {
  8372. var rationalUseMap = res.data;
  8373. var result_lv = rationalUseMap.result_lv;
  8374. if (result_lv == 0 || result_lv == "0") {
  8375. savePrescriptionForReadCard();
  8376. } else {
  8377. var showUrl = rationalUseMap.ShowUrl;
  8378. getResultUrl = rationalUseMap.getResultUrl;
  8379. showHlyyModel('hlyyDiv', 'loading', 'hlyyModal', showUrl);
  8380. }
  8381. } else {
  8382. savePrescriptionForReadCard();
  8383. }
  8384. }
  8385. });
  8386. }
  8387. /**
  8388. * 合理用药结果查询
  8389. */
  8390. function getResult() {
  8391. $.ajax({
  8392. type: "POST",
  8393. url: '/thmz/auditingInterface',
  8394. contentType: "application/json;charset=UTF-8",
  8395. dataType: "json",
  8396. data: JSON.stringify({"getResultUrl": getResultUrl}),
  8397. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8398. success: function (res) {
  8399. if (res == '401' || res == 401) {
  8400. window.location.href = '/thmz/login/view'
  8401. return;
  8402. }
  8403. $("#messageButton").attr("disabled", false);
  8404. $("#hlyyModal").modal("hide");
  8405. if (res.code == 0) {
  8406. var rationalUseMap = res.data;
  8407. if (rationalUseMap.length == 0) {
  8408. savePrescriptionForReadCard();
  8409. } else {
  8410. var resultcode = rationalUseMap.resultcode;
  8411. var success = rationalUseMap.success;
  8412. var sh_msg = rationalUseMap.sh_msg;
  8413. if (resultcode == -1) {
  8414. //为处方不存在分析结果 直接忽略
  8415. savePrescriptionForReadCard();
  8416. } else if (resultcode == 0) {
  8417. //2.success:药师审核完成标志,false未审核,true已审核/无需审核
  8418. if (success == true || success == "true") {
  8419. savePrescriptionForReadCard();
  8420. } else {
  8421. //提示消息
  8422. $("#messageModal").modal();
  8423. $("#messageContent").html("药师未审核,请点击右上方【继续保存】提交审核!");
  8424. $("#messageButton").off("click").bind("click", function (t) {
  8425. $("#messageModal").modal("hide");
  8426. $("#hlyyModal").modal();
  8427. });
  8428. $("#cancelButton").off("click").bind("click", function (t) {
  8429. $("#hlyyModal").modal();
  8430. });
  8431. ;
  8432. }
  8433. } else if (resultcode == 1) {
  8434. //提示消息
  8435. $("#messageModal").modal();
  8436. $("#messageContent").html(sh_msg);
  8437. $("#messageButton").off("click").bind("click", function (t) {
  8438. $("#messageModal").modal("hide");
  8439. });
  8440. $("#cancelButton").off("click");
  8441. }
  8442. }
  8443. } else {
  8444. savePrescriptionForReadCard();
  8445. }
  8446. }
  8447. });
  8448. }
  8449. /**
  8450. * 合理用药结果弹窗
  8451. * @param hlyyDiv
  8452. * @param loading
  8453. * @param hlyyModal
  8454. * @param showUrl
  8455. */
  8456. function showHlyyModel(hlyyDiv, loading, hlyyModal, showUrl) {
  8457. const iframeEle = document.getElementById(hlyyDiv);
  8458. const loadingEle = document.getElementById(loading);
  8459. //设置ififrame透明
  8460. iframeEle.style.opacity = 0;
  8461. loadingEle.style.display = 'block';
  8462. $("#" + hlyyDiv).attr("src", showUrl);
  8463. iframeEle.addEventListener('load', function () {
  8464. // Hide the loading indicator
  8465. loadingEle.style.display = 'none';
  8466. // Bring the iframe back
  8467. iframeEle.style.opacity = 1;
  8468. });
  8469. setTimeout(function () {
  8470. // iframe 重复加载不会触发上述事件
  8471. loadingEle.style.display = 'none';
  8472. iframeEle.style.opacity = 1;
  8473. }, 1000);
  8474. $("#" + hlyyModal).modal();
  8475. }
  8476. /**
  8477. * 点击保存处方时提示是否读卡
  8478. */
  8479. function savePrescriptionForReadCard() {
  8480. if (!verifyInsuranceInfo()) {
  8481. return;
  8482. }
  8483. //关闭帮助框
  8484. $("#treeButton").webuiPopover('hide');
  8485. $("#western_medicine_name").webuiPopover('hide');
  8486. $("#chinese_medicine_name").webuiPopover('hide');
  8487. $("#jcJyItem").webuiPopover('hide');
  8488. $("#zlItem").webuiPopover('hide');
  8489. var zgmztczf = $("#zgmztczf").val();
  8490. var readCardResult = $("#readCardResult").val();
  8491. if ((zgmztczf == 1 || zgmztczf == "1") && (readCardResult == null || readCardResult == "")) {
  8492. $("#messageModal").modal();
  8493. $("#messageContent").html("门诊统筹处方必须读卡,是否立即读卡?");
  8494. $("#messageButton").off("click").bind("click", function (t) {
  8495. mztczfSiReadCard(true);
  8496. realSavePrescription(false);
  8497. });
  8498. $("#cancelButton").off("click").bind("click", function (t) {
  8499. t.stopPropagation();
  8500. t.preventDefault();
  8501. realSavePrescription(false);
  8502. });
  8503. } else {
  8504. realSavePrescription(true);
  8505. }
  8506. }
  8507. /**
  8508. * 最终保存处方方法
  8509. * @param openModel 是否需要打开提示弹层 true 需要 false 不需要
  8510. */
  8511. function realSavePrescription(openModel) {
  8512. if (openModel) {
  8513. $("#messageModal").modal();
  8514. }
  8515. $("#messageContent").html("确认保存处方吗?");
  8516. $("#messageButton").off("click").bind("click", function (t) {
  8517. if (mztczfSiReadCardStatus) {
  8518. $("#messageContent").html("门诊统筹正在读卡中,次操作需与医保中心交互,耗时较长,请耐心等待...");
  8519. return;
  8520. }
  8521. $("#messageButton").attr("disabled", true);
  8522. var jsonData = getParamsForpPrescription(1);
  8523. $.ajax({
  8524. type: "POST",
  8525. url: '/thmz/savePrescription',
  8526. contentType: "application/json;charset=UTF-8",
  8527. dataType: "json",
  8528. data: JSON.stringify(jsonData),
  8529. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8530. success: function (res) {
  8531. if (res == '401' || res == 401) {
  8532. window.location.href = '/thmz/login/view'
  8533. return;
  8534. }
  8535. $("#messageButton").attr("disabled", false);
  8536. if (res.code == 0) {
  8537. successMesage(res);
  8538. clearWorkSpace();
  8539. loadInClinicTableList();
  8540. loadClinicTableList();
  8541. //$("#messageModal").modal();
  8542. $("#messageContent").html("门诊处方保存成功,是否打印处方和门诊指引单?");
  8543. $("#messageButton").off("click").on("click", function (t) {
  8544. $("#messageModal").modal("hide");
  8545. printPrescription(res.data.patientId, res.data.times, res.data.id, 5, 1);
  8546. });
  8547. $("#cancelButton").off("click");
  8548. } else {
  8549. $("#messageModal").modal("hide");
  8550. errorMesage(res);
  8551. }
  8552. }
  8553. });
  8554. });
  8555. $("#cancelButton").off("click");
  8556. }
  8557. /**
  8558. * 保存医疗范文
  8559. */
  8560. function saveapidAccepts() {
  8561. var templateName = $("#templateName").val();
  8562. if (templateName == null || templateName == "") {
  8563. errorMesageSimaple("范文名称不能为空!");
  8564. return;
  8565. }
  8566. var templateKindType = $("#templateKindType").val();
  8567. if (templateKindType == null || templateKindType == "") {
  8568. errorMesageSimaple("范文类型不能为空!");
  8569. return;
  8570. }
  8571. var templateType = $("#templateType").val();
  8572. if (templateType == null || templateType == "") {
  8573. errorMesageSimaple("范文范围不能为空!");
  8574. return;
  8575. }
  8576. var templateStatus = $("#templateStatus").val();
  8577. if (templateStatus == null || templateStatus == "") {
  8578. errorMesageSimaple("范文状态不能为空!");
  8579. return;
  8580. }
  8581. $("#saveapidAcceptsModal").modal("hide");
  8582. $("#messageModal").modal();
  8583. $("#messageContent").html("确认保存医疗范文吗?");
  8584. $("#messageButton").off("click").on("click", function (t) {
  8585. $("#messageModal").modal("hide");
  8586. var jsonData = getParamsForpPrescription(2);
  8587. var operationType = $("#operationType").val();
  8588. var templateId = $("#templateId").val();
  8589. if (operationType == 0 || operationType == '0') {
  8590. templateId = null;
  8591. }
  8592. $.ajax({
  8593. type: "POST",
  8594. url: '/thmz/saveTemplate',
  8595. contentType: "application/json;charset=UTF-8",
  8596. dataType: "json",
  8597. data: JSON.stringify({
  8598. "id": templateId,
  8599. "name": templateName,
  8600. "icdText": jsonData.icdText != null ? jsonData.icdText : jsonData.mzBlRecord.tentativeDiagnosis,
  8601. "templateKindType": templateKindType,
  8602. "templateType": templateType,
  8603. "templateStatus": templateStatus,
  8604. "templateData": JSON.stringify(jsonData),
  8605. "emrChiefComplaint": $("#symptom").val(),
  8606. "emrHpi": $("#emrHpi").val(),
  8607. "emrPs": $("#emrPs").val(),
  8608. "icdCode": $("#diagnoseValue").val()
  8609. }),
  8610. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8611. success: function (res) {
  8612. if (res == '401' || res == 401) {
  8613. window.location.href = '/thmz/login/view'
  8614. return;
  8615. }
  8616. if (res.code == 0) {
  8617. successMesage(res);
  8618. //范本保存完不清空
  8619. //clearWorkSpace();
  8620. } else {
  8621. $("#saveapidAcceptsModal").modal();
  8622. errorMesage(res);
  8623. }
  8624. }
  8625. });
  8626. });
  8627. $("#cancelButton").off("click");
  8628. }
  8629. /**
  8630. * 停用医疗范文
  8631. */
  8632. function removeTemplate() {
  8633. $("#messageModal").modal();
  8634. $("#messageContent").html("确认停用医疗范文吗?");
  8635. $("#messageButton").off("click").on("click", function (t) {
  8636. $("#messageModal").modal("hide");
  8637. $.ajax({
  8638. type: "POST",
  8639. url: '/thmz/removeTemplate',
  8640. contentType: "application/json;charset=UTF-8",
  8641. dataType: "json",
  8642. data: JSON.stringify({
  8643. "id": $("#idTemplate").val()
  8644. }),
  8645. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8646. success: function (res) {
  8647. if (res == '401' || res == 401) {
  8648. window.location.href = '/thmz/login/view'
  8649. return;
  8650. }
  8651. if (res.code == 0) {
  8652. successMesage(res);
  8653. $("#medicalModelModal").modal("hide");
  8654. fitTemplateData();
  8655. } else {
  8656. errorMesage(res);
  8657. }
  8658. }
  8659. });
  8660. });
  8661. $("#cancelButton").off("click");
  8662. }
  8663. /**
  8664. * 清空医疗范文模块内容
  8665. */
  8666. function clearApidAcceptsModal() {
  8667. $("#templateId").val(null);
  8668. $("#templateName").val(null);
  8669. $("#templateKindType").selectpicker('val', 0);
  8670. $("#templateKindType").selectpicker('refresh');
  8671. $("#templateType").selectpicker('val', 0);
  8672. $("#templateType").selectpicker('refresh');
  8673. $("#templateStatus").selectpicker('val', 0);
  8674. $("#templateStatus").selectpicker('refresh');
  8675. $('#operationType').selectpicker('val', 0);
  8676. $('#operationType').selectpicker('refresh');
  8677. $("#operationTypeDiv").removeClass("in").addClass("hide");
  8678. }
  8679. /**
  8680. * 查询病人未缴费处方信息 加载到处方修改
  8681. * @param patientId
  8682. * @param times
  8683. * @param clnicId 就诊记录id
  8684. */
  8685. function getMzPrescriptionVoUnPaid(patientId, times, clnicId) {
  8686. var currentPatientId = $("#patientId").text();
  8687. //当前接诊的用户和操作接诊的是同一个人,不做任何操作
  8688. if (currentPatientId == patientId) {
  8689. warningMesageSimaple("当前病人正在接诊中,请勿重复操作!");
  8690. return;
  8691. }
  8692. if (currentPatientId == null || currentPatientId == "") {
  8693. //当前没有人接诊,直接接诊
  8694. getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId);
  8695. } else {
  8696. //当前有人在接诊,提示是否需要切换和保存
  8697. $("#messagePrescriptionModal").modal();
  8698. $("#confirmPrescriptionButton").off("click").on("click", function (t) {
  8699. $("#messagePrescriptionModal").modal("hide");
  8700. //先保存目前接诊信息,再切换就诊人
  8701. var jsonData = getParamsForpPrescription(1);
  8702. $.ajax({
  8703. type: "POST",
  8704. url: '/thmz/savePrescription',
  8705. contentType: "application/json;charset=UTF-8",
  8706. dataType: "json",
  8707. data: JSON.stringify(jsonData),
  8708. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8709. success: function (res) {
  8710. if (res == '401' || res == 401) {
  8711. window.location.href = '/thmz/login/view'
  8712. return;
  8713. }
  8714. if (res.code == 0) {
  8715. loadInClinicTableList();
  8716. loadClinicTableList();
  8717. getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId);
  8718. } else {
  8719. errorMesage(res);
  8720. }
  8721. }
  8722. });
  8723. });
  8724. $("#cancelPrescriptionButton").off("click").on("click", function (t) {
  8725. $("#messagePrescriptionModal").modal("hide");
  8726. getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId);
  8727. });
  8728. }
  8729. }
  8730. /**
  8731. * 查询病人未缴费处方信息 加载到处方修改 通用方法
  8732. * @param patientId
  8733. * @param times
  8734. * @param clnicId 就诊记录id
  8735. */
  8736. function getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId) {
  8737. $.ajax({
  8738. type: "GET",
  8739. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + "&times=" + times + "&MzBlRecordFlag=false&payMark=5&clnicId=null",
  8740. contentType: "application/json;charset=UTF-8",
  8741. dataType: "json",
  8742. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8743. success: function (res) {
  8744. if (res == '401' || res == 401) {
  8745. window.location.href = '/thmz/login/view'
  8746. return;
  8747. }
  8748. if (res.code == 0) {
  8749. clearWorkSpace();
  8750. setMzPatientInfo(res.mzPatientMi);
  8751. editPrescription(res.data, 0)
  8752. //修改患者的时候,将原纪录的就诊记录id带上,并借用分诊流水号字段传参
  8753. $("#mzfzSerialNoInClick").val("clnicId_" + clnicId);
  8754. //查询患者的门诊统筹信息
  8755. queryInsuinfo(patientId);
  8756. } else {
  8757. errorMesage(res);
  8758. }
  8759. }
  8760. });
  8761. }
  8762. /**
  8763. * 查询病人已缴费处方信息 调用处方
  8764. * @param patientId
  8765. * @param times
  8766. * @param clnicId 就诊记录id
  8767. */
  8768. function getMzPrescriptionVoPaid(patientId, times, clnicId) {
  8769. $("#visitingDetailModal").modal("hide");
  8770. $("#messageModal").modal();
  8771. $("#messageContent").html("确认调用选中处方吗?将会覆盖当前处方。");
  8772. $("#messageButton").off("click").on("click", function (t) {
  8773. $("#messageModal").modal("hide");
  8774. $.ajax({
  8775. type: "GET",
  8776. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + "&times=" + times + "&MzBlRecordFlag=false&payMark=0&clnicId=null",
  8777. contentType: "application/json;charset=UTF-8",
  8778. dataType: "json",
  8779. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8780. success: function (res) {
  8781. if (res == '401' || res == 401) {
  8782. window.location.href = '/thmz/login/view'
  8783. return;
  8784. }
  8785. if (res.code == 0) {
  8786. var mzfzSerialNoInClick = $("#mzfzSerialNoInClick").val();
  8787. var mzfzReqTypeNoInClick = $("#mzfzReqTypeNoInClick").val();
  8788. clearUser(false);
  8789. clearWorkSpaceExcludeUser(3);
  8790. setMzPatientInfo(res.mzPatientMi);
  8791. editPrescription(res.data, 2)
  8792. $("#mzfzSerialNoInClick").val(mzfzSerialNoInClick);
  8793. $("#mzfzReqTypeNoInClick").val(mzfzReqTypeNoInClick);
  8794. } else {
  8795. errorMesage(res);
  8796. }
  8797. }
  8798. });
  8799. });
  8800. $("#cancelButton").off("click");
  8801. }
  8802. /**
  8803. * 重复接诊
  8804. * @param patientId
  8805. * @param times
  8806. * @param clnicId
  8807. * @param deptCode 就诊科室编码
  8808. */
  8809. function repeatAccepts(patientId, times, clnicId, deptCode) {
  8810. $.ajax({
  8811. type: "GET",
  8812. url: '/thmz/validMzyReqrec?patientId=' + patientId + "&deptCode=" + deptCode,
  8813. contentType: "application/json;charset=UTF-8",
  8814. dataType: "json",
  8815. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8816. success: function (res) {
  8817. if (res == '401' || res == 401) {
  8818. window.location.href = '/thmz/login/view'
  8819. return;
  8820. }
  8821. if (res.code == 0) {
  8822. if (res.data == 0) {
  8823. $("#messageModal").modal();
  8824. $("#messageContent").html("挂号失效,确定继续就诊?");
  8825. $("#messageButton").off("click").on("click", function (t) {
  8826. $("#messageModal").modal("hide");
  8827. repeatAcceptsConfirm(patientId, times, clnicId);
  8828. });
  8829. $("#cancelButton").off("click");
  8830. return;
  8831. }
  8832. repeatAcceptsConfirm(patientId, times, clnicId);
  8833. } else {
  8834. errorMesage(res);
  8835. }
  8836. }
  8837. });
  8838. }
  8839. /**
  8840. * 重复接诊提示方法
  8841. * @param patientId
  8842. * @param times
  8843. * @param clnicId
  8844. */
  8845. function repeatAcceptsConfirm(patientId, times, clnicId) {
  8846. var currentPatientId = $("#patientId").text();
  8847. //当前接诊的用户和操作接诊的是同一个人,不做任何操作
  8848. if (currentPatientId == patientId) {
  8849. return;
  8850. }
  8851. if (currentPatientId == null || currentPatientId == "") {
  8852. //当前没有人接诊,直接接诊
  8853. repeatAcceptsCommon(patientId, times, clnicId);
  8854. } else {
  8855. //当前有人在接诊,提示是否需要切换和保存
  8856. $("#messagePrescriptionModal").modal();
  8857. $("#confirmPrescriptionButton").off("click").on("click", function (t) {
  8858. $("#messagePrescriptionModal").modal("hide");
  8859. //先保存目前接诊信息,再切换就诊人
  8860. var jsonData = getParamsForpPrescription(1);
  8861. $.ajax({
  8862. type: "POST",
  8863. url: '/thmz/savePrescription',
  8864. contentType: "application/json;charset=UTF-8",
  8865. dataType: "json",
  8866. data: JSON.stringify(jsonData),
  8867. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8868. success: function (res) {
  8869. if (res == '401' || res == 401) {
  8870. window.location.href = '/thmz/login/view'
  8871. return;
  8872. }
  8873. if (res.code == 0) {
  8874. repeatAcceptsCommon(patientId, times, clnicId);
  8875. //加载已接诊患者列表
  8876. loadClinicTableList();
  8877. } else {
  8878. errorMesage(res);
  8879. }
  8880. }
  8881. });
  8882. });
  8883. $("#cancelPrescriptionButton").off("click").on("click", function (t) {
  8884. $("#messagePrescriptionModal").modal("hide");
  8885. repeatAcceptsCommon(patientId, times, clnicId);
  8886. });
  8887. }
  8888. }
  8889. /**
  8890. * 重复接诊通用方法
  8891. * @param patientId
  8892. * @param times
  8893. * @param clnicId
  8894. */
  8895. function repeatAcceptsCommon(patientId, times, clnicId) {
  8896. $.ajax({
  8897. type: "GET",
  8898. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + "&times=" + times + "&MzBlRecordFlag=true&payMark=null&clnicId=null",
  8899. contentType: "application/json;charset=UTF-8",
  8900. dataType: "json",
  8901. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8902. success: function (res) {
  8903. if (res == '401' || res == 401) {
  8904. window.location.href = '/thmz/login/view'
  8905. return;
  8906. }
  8907. if (res.code == 0) {
  8908. clearWorkSpace();
  8909. setMzPatientInfo(res.mzPatientMi);
  8910. editPrescription(res.data, 0)
  8911. //修改患者的时候,将原纪录的就诊记录id带上,并借用分诊流水号字段传参
  8912. $("#mzfzSerialNoInClick").val("clnicId_" + clnicId);
  8913. //查询患者的门诊统筹信息
  8914. queryInsuinfo(patientId);
  8915. } else {
  8916. errorMesage(res);
  8917. }
  8918. }
  8919. });
  8920. }
  8921. /**
  8922. * 就诊详情 已诊患者列表发起
  8923. * @param patientId
  8924. * @param times
  8925. * @param clnicId
  8926. * @param payMark
  8927. */
  8928. function prescriptionDetail(patientId, times, clnicId, payMark) {
  8929. prescriptionDetailCommon(patientId, times, clnicId, payMark, 0);
  8930. }
  8931. /**
  8932. * 就诊详情 历史轨迹发起
  8933. * @param patientId
  8934. * @param times
  8935. * @param clnicId
  8936. * @param clinicStatus
  8937. */
  8938. function visitingDetailModal(patientId, times, clnicId, clinicStatus) {
  8939. closeObjectWebui(false);
  8940. var payMark = null;
  8941. if (clinicStatus == 5) {
  8942. payMark = 5;
  8943. } else {
  8944. payMark = 0;
  8945. }
  8946. prescriptionDetailCommon(patientId, times, clnicId, payMark, 1);
  8947. }
  8948. /**
  8949. * 就诊详情通用方法
  8950. * @param patientId
  8951. * @param times
  8952. * @param clnicId
  8953. * @param payMark
  8954. * @param type 0 已诊患者列表发起 1 历史轨迹发起
  8955. */
  8956. function prescriptionDetailCommon(patientId, times, clnicId, payMark, type) {
  8957. $('#baseMzBlTimes').val(null);
  8958. var oriPayMark = payMark;
  8959. if (payMark == 1) {
  8960. //退费时,查看的明细还是处方开立的情况
  8961. payMark = 0;
  8962. }
  8963. //是否默认勾选处方回调
  8964. var checkboxFlag = localStorage.getItem("checkboxFlag");
  8965. if (checkboxFlag != null && (checkboxFlag == "0" || checkboxFlag == 0)) {
  8966. $("#conciseRecordsJzxq").prop("checked", true);
  8967. $("#prescriptionSubsidiaryJzxq").prop("checked", true);
  8968. } else {
  8969. $("#conciseRecordsJzxq").prop("checked", false);
  8970. $("#prescriptionSubsidiaryJzxq").prop("checked", false);
  8971. }
  8972. $.ajax({
  8973. type: "GET",
  8974. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + '&times=' + times + '&MzBlRecordFlag=false&payMark=' + payMark + '&clnicId=' + clnicId,
  8975. contentType: "application/json;charset=UTF-8",
  8976. dataType: "json",
  8977. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8978. success: function (res) {
  8979. if (res == '401' || res == 401) {
  8980. window.location.href = '/thmz/login/view'
  8981. return;
  8982. }
  8983. if (res.code == 0) {
  8984. $("#visitingDetailModal").modal();
  8985. var jsonData = res.data;
  8986. var mzPatientMi = res.mzPatientMi;
  8987. $("#visitingDetailPatientName").html('<a onclick="editUserModal(\'' + mzPatientMi.patientId + '\',3)" style=\'cursor: pointer;\'>' + mzPatientMi.name + '</a>');
  8988. $("#visitingDetailPatientAge").text(mzPatientMi.ageString);
  8989. $("#visitingDetailPatientGender").val(mzPatientMi.gender);
  8990. $("#prescriptionDetail_zd").html("");
  8991. $("#prescriptionDetail_xyzlContent").html("");
  8992. $("#prescriptionDetail_zyzlContent").html("");
  8993. $("#prescriptionDetail_zlyjContent").html("");
  8994. if (res.opDate != null) {
  8995. $("#visitingDetailDate").text(res.opDate);
  8996. }
  8997. if (res.deptName != null) {
  8998. $("#visitingDetailDept").text(res.deptName);
  8999. }
  9000. if (res.doctorName != null) {
  9001. $("#visitingDetailDoctor").text(res.doctorName);
  9002. }
  9003. var firstOrNot = jsonData.mzBlRecord.firstOrNot;
  9004. if (firstOrNot == 0) {
  9005. $("#visitFlag").html("初诊");
  9006. $("#first").next().click();
  9007. } else if (firstOrNot == 1) {
  9008. $("#visitFlag").html("复诊");
  9009. $("#not").next().click();
  9010. }
  9011. if (oriPayMark == 0) {
  9012. $("#chargeImage").attr("src", "/thmz/images/charge.png");
  9013. } else if (oriPayMark == 1) {
  9014. $("#chargeImage").attr("src", "/thmz/images/refund.png");
  9015. } else if (oriPayMark == 5) {
  9016. $("#chargeImage").attr("src", "/thmz/images/nocharge.png");
  9017. }
  9018. $("#prescriptionDetail_zs").html(jsonData.mzBlRecord.emrChiefComplaint);
  9019. $("#prescriptionDetail_xbs").html(jsonData.mzBlRecord.emrHpi);
  9020. $("#prescriptionDetail_tgjc").html(jsonData.mzBlRecord.emrPe);
  9021. $("#prescriptionDetail_jkjy").html(jsonData.mzBlRecord.emrJkjy);
  9022. var icdText = jsonData.icdText;
  9023. if (icdText != null) {
  9024. var arr = icdText.split(",");
  9025. var html = "";
  9026. for (var i = 0; i < arr.length; i++) {
  9027. if (i == 0) {
  9028. html += ' <div class="tagZdy tagZdy-back">';
  9029. } else {
  9030. html += ' <div class="tagZdy tagZdy-back-green">';
  9031. }
  9032. html += arr[i];
  9033. html += '</div>';
  9034. }
  9035. $("#prescriptionDetail_zd").html(html);
  9036. } else {
  9037. $("#prescriptionDetail_zd").html(jsonData.mzBlRecord.tentativeDiagnosis);
  9038. }
  9039. var prescriptionDetail = jsonData.mzBlRecord.prescriptionDetail;
  9040. if (prescriptionDetail != null) {
  9041. var checkBox = type == 1;
  9042. prescriptionDetail = JSON.parse(prescriptionDetail);
  9043. var xyPrescription = prescriptionDetail.xyPrescription;
  9044. if (xyPrescription != null) {
  9045. fitxyContent(xyPrescription.pyPrescription, "prescriptionDetail_xypyContent", "prescriptionDetail_xypyTitle", checkBox);
  9046. fitxyContent(xyPrescription.mjPrescription, "prescriptionDetail_xymjContent", "prescriptionDetail_xymjTitle", checkBox);
  9047. fitxyContent(xyPrescription.jePrescription, "prescriptionDetail_xyjeContent", "prescriptionDetail_xyjeTitle", checkBox);
  9048. fitxyContent(xyPrescription.ycPrescription, "prescriptionDetail_yczlContent", "prescriptionDetail_yczlTitle", checkBox);
  9049. } else {
  9050. $("#prescriptionDetail_xypyTitle").removeClass("in").addClass("hide");
  9051. $("#prescriptionDetail_xypyContent").html("");
  9052. $("#prescriptionDetail_xymjTitle").removeClass("in").addClass("hide");
  9053. $("#prescriptionDetail_xymjContent").html("");
  9054. $("#prescriptionDetail_xyjeTitle").removeClass("in").addClass("hide");
  9055. $("#prescriptionDetail_xyjeContent").html("");
  9056. $("#prescriptionDetail_yczlTitle").removeClass("in").addClass("hide");
  9057. $("#prescriptionDetail_yczlContent").html("");
  9058. }
  9059. var zyPrescription = prescriptionDetail.zyPrescription;
  9060. if (zyPrescription != null) {
  9061. fitzyContent(zyPrescription, "prescriptionDetail_zyzlContent", "prescriptionDetail_zyzlTitle", checkBox);
  9062. } else {
  9063. $("#prescriptionDetail_zyzlTitle").removeClass("in").addClass("hide");
  9064. $("#prescriptionDetail_zyzlContent").html("");
  9065. }
  9066. var jcjyPrescription = prescriptionDetail.jcjyPrescription;
  9067. if (jcjyPrescription != null) {
  9068. fitJcjyContent(jcjyPrescription, "prescriptionDetail_jcjyContent", "prescriptionDetail_jcjyTitle", checkBox);
  9069. } else {
  9070. ("#prescriptionDetail_jcjyTitle").removeClass("in").addClass("hide");
  9071. $("#prescriptionDetail_jcjyContent").html("");
  9072. }
  9073. var zlPrescription = prescriptionDetail.zlPrescription;
  9074. if (zlPrescription != null) {
  9075. fitJcjyContent(zlPrescription, "prescriptionDetail_zlContent", "prescriptionDetail_zlTitle", checkBox);
  9076. } else {
  9077. $("#prescriptionDetail_zlTitle").removeClass("in").addClass("hide");
  9078. $("#prescriptionDetail_zlContent").html("");
  9079. }
  9080. var zyReqPrescription = prescriptionDetail.zyReqPrescription;
  9081. if (zyReqPrescription != null) {
  9082. fitZyReqContent(zyReqPrescription, "prescriptionDetail_zyReqContent", "prescriptionDetail_zyReqTitle", true);
  9083. } else {
  9084. $("#prescriptionDetail_zyReqTitle").removeClass("in").addClass("hide");
  9085. $("#prescriptionDetail_zyReqContent").html("");
  9086. }
  9087. } else {
  9088. $("#prescriptionDetail_xypyTitle").removeClass("in").addClass("hide");
  9089. $("#prescriptionDetail_xypyContent").html("");
  9090. $("#prescriptionDetail_xymjTitle").removeClass("in").addClass("hide");
  9091. $("#prescriptionDetail_xymjContent").html("");
  9092. $("#prescriptionDetail_xyjeTitle").removeClass("in").addClass("hide");
  9093. $("#prescriptionDetail_xyjeContent").html("");
  9094. $("#prescriptionDetail_yczlTitle").removeClass("in").addClass("hide");
  9095. $("#prescriptionDetail_yczlContent").html("");
  9096. $("#prescriptionDetail_zyzlTitle").removeClass("in").addClass("hide");
  9097. $("#prescriptionDetail_zyzlContent").html("");
  9098. $("#prescriptionDetail_jcjyTitle").removeClass("in").addClass("hide");
  9099. $("#prescriptionDetail_jcjyContent").html("");
  9100. $("#prescriptionDetail_zlTitle").removeClass("in").addClass("hide");
  9101. $("#prescriptionDetail_zlContent").html("");
  9102. $("#prescriptionDetail_zyReqTitle").removeClass("in").addClass("hide");
  9103. $("#prescriptionDetail_zyReqContent").html("");
  9104. }
  9105. $("#printJcReq").removeClass("in").addClass("hide");
  9106. $("#printJcReq").off("click");
  9107. $("#printJyReq").removeClass("in").addClass("hide");
  9108. $("#printJyReq").off("click");
  9109. $("#printJcReqSetup").removeClass("in").addClass("hide");
  9110. $("#printJcReqSetup").off("click");
  9111. $("#printJyReqSetup").removeClass("in").addClass("hide");
  9112. $("#printJyReqSetup").off("click");
  9113. $("#previewYjReq").removeClass("in").addClass("hide");
  9114. $("#previewYjReq").off("click");
  9115. $("#previewYjReqAll").removeClass("in").addClass("hide");
  9116. $("#previewYjReqAll").off("click");
  9117. $("#deletePrescription").removeClass("in").addClass("hide");
  9118. $("#deletePrescription").off("click");
  9119. $("#consultationCliniced").removeClass("in").addClass("hide");
  9120. $("#consultationCliniced").off("click");
  9121. if (jsonData.mzYjReqList != null && jsonData.mzYjReqList.length > 0) {
  9122. $("#previewYjReq").removeClass("hide").addClass("in");
  9123. $("#previewYjReq").off("click").on("click", function (t) {
  9124. previewYjReq(patientId, times);
  9125. });
  9126. }
  9127. if (res.yjReqCount != null && res.yjReqCount > 0) {
  9128. $("#previewYjReqAll").removeClass("hide").addClass("in");
  9129. $("#previewYjReqAll").off("click").on("click", function (t) {
  9130. previewYjReqAll(patientId);
  9131. });
  9132. }
  9133. if (type == 0) {
  9134. $("#callPrescription").removeClass("in").addClass("hide");
  9135. if ((jsonData.mzChargeDetailList == null || jsonData.mzChargeDetailList.length == 0) && (jsonData.mzYjReqList == null || jsonData.mzYjReqList.length == 0)) {
  9136. $("#printPrescription").removeClass("in").addClass("hide");
  9137. $("#printPrescriptionSetup").removeClass("in").addClass("hide");
  9138. } else {
  9139. $("#printPrescription").removeClass("hide").addClass("in");
  9140. $("#printPrescription").off("click").on("click", function (t) {
  9141. printPrescription(patientId, times, clnicId, payMark, 1);
  9142. });
  9143. $("#printPrescriptionSetup").removeClass("hide").addClass("in");
  9144. $("#printPrescriptionSetup").off("click").on("click", function (t) {
  9145. printPrescription(patientId, times, clnicId, payMark, 2);
  9146. });
  9147. }
  9148. if (jsonData.mzYjReqList != null && jsonData.mzYjReqList.length > 0) {
  9149. var hadJc = false;
  9150. var hadJy = false;
  9151. for (var i = 0; i < jsonData.mzYjReqList.length; i++) {
  9152. var mzYjReq = jsonData.mzYjReqList[i];
  9153. if (mzYjReq.reqType == 2) {
  9154. hadJy = true;
  9155. } else if (mzYjReq.reqType == 3) {
  9156. hadJc = true;
  9157. }
  9158. }
  9159. if (hadJc) {
  9160. $("#printJcReq").removeClass("hide").addClass("in");
  9161. $("#printJcReq").off("click").on("click", function (t) {
  9162. printYjReq(patientId, times, 3, 1);
  9163. });
  9164. $("#printJcReqSetup").removeClass("hide").addClass("in");
  9165. $("#printJcReqSetup").off("click").on("click", function (t) {
  9166. printYjReq(patientId, times, 3, 2);
  9167. });
  9168. }
  9169. if (hadJy) {
  9170. $("#printJyReq").removeClass("hide").addClass("in");
  9171. $("#printJyReq").off("click").on("click", function (t) {
  9172. printYjReq(patientId, times, 2, 1);
  9173. });
  9174. $("#printJyReqSetup").removeClass("hide").addClass("in");
  9175. $("#printJyReqSetup").off("click").on("click", function (t) {
  9176. printYjReq(patientId, times, 2, 2);
  9177. });
  9178. }
  9179. }
  9180. if (jsonData.mzZyReq == null || jsonData.mzZyReq.reqDept == null || jsonData.mzZyReq.reqDept == "") {
  9181. $("#printZyReq").removeClass("in").addClass("hide");
  9182. $("#printZyReq").off("click");
  9183. $("#printZyReqSetup").removeClass("in").addClass("hide");
  9184. $("#printZyReqSetup").off("click");
  9185. } else {
  9186. $("#printZyReq").removeClass("hide").addClass("in");
  9187. $("#printZyReq").off("click").on("click", function (t) {
  9188. printZyReq(patientId, 1);
  9189. });
  9190. $("#printZyReqSetup").removeClass("hide").addClass("in");
  9191. $("#printZyReqSetup").off("click").on("click", function (t) {
  9192. printZyReq(patientId, 2);
  9193. });
  9194. }
  9195. //未缴费状态的时候可以删除处方
  9196. if (oriPayMark == 5 || oriPayMark == "5") {
  9197. $("#deletePrescription").removeClass("hide").addClass("in");
  9198. $("#deletePrescription").off("click").on("click", function (t) {
  9199. deletePrescription(clnicId);
  9200. });
  9201. }
  9202. //已诊列表发起会诊
  9203. $("#consultationCliniced").removeClass("hide").addClass("in");
  9204. $("#consultationCliniced").off("click").on("click", function (t) {
  9205. consultationCliniced(patientId);
  9206. });
  9207. //已诊列表发起预约挂号
  9208. $("#registration").off("click").on("click", function (t) {
  9209. registration(patientId);
  9210. });
  9211. } else {
  9212. $("#printPrescription").removeClass("in").addClass("hide");
  9213. $("#printZyReq").removeClass("in").addClass("hide");
  9214. $("#printBlRecord").removeClass("in").addClass("hide");
  9215. $("#printJcReq").removeClass("in").addClass("hide");
  9216. $("#printJyReq").removeClass("in").addClass("hide");
  9217. $("#callPrescription").removeClass("hide").addClass("in");
  9218. $("#callPrescription").off("click").on("click", function (t) {
  9219. getMzPrescriptionVoPaid(patientId, times, clnicId);
  9220. });
  9221. }
  9222. if (oriPayMark == 1) {
  9223. $("#printPrescription").removeClass("in").addClass("hide");
  9224. $("#printPrescriptionSetup").removeClass("in").addClass("hide");
  9225. } else {
  9226. if ((jsonData.mzChargeDetailList == null || jsonData.mzChargeDetailList.length == 0) && (jsonData.mzYjReqList == null || jsonData.mzYjReqList.length == 0)) {
  9227. $("#printPrescription").removeClass("in").addClass("hide");
  9228. $("#printPrescriptionSetup").removeClass("in").addClass("hide");
  9229. } else {
  9230. $("#printPrescription").removeClass("hide").addClass("in");
  9231. $("#printPrescription").off("click").on("click", function (t) {
  9232. printPrescription(patientId, times, clnicId, payMark, 1);
  9233. });
  9234. $("#printPrescriptionSetup").removeClass("hide").addClass("in");
  9235. $("#printPrescriptionSetup").off("click").on("click", function (t) {
  9236. printPrescription(patientId, times, clnicId, payMark, 2);
  9237. });
  9238. }
  9239. }
  9240. $("#printBlRecord").removeClass("hide").addClass("in");
  9241. $("#printBlRecord").off("click").on("click", function (t) {
  9242. printBlRecord(patientId, times, 1);
  9243. });
  9244. $("#printBlRecordSetup").removeClass("hide").addClass("in");
  9245. $("#printBlRecordSetup").off("click").on("click", function (t) {
  9246. printBlRecord(patientId, times, 2);
  9247. });
  9248. $("#showMzBlRecordModal").removeClass("hide").addClass("in");
  9249. $("#showMzBlRecordModal").off("click").on("click", function (t) {
  9250. showMzBlRecordModal(patientId, times, 1);
  9251. });
  9252. if ($("#setupId").hasClass("fa-chevron-up")) {
  9253. //默认不展开打印设置
  9254. $("#setupId").parent().click();
  9255. }
  9256. // setTimeout(function () {
  9257. // if ($("#setupId").hasClass("fa-chevron-up")) {
  9258. // //默认不展开打印设置
  9259. // $("#setupId").parent().click();
  9260. // }
  9261. // }, 400);
  9262. //就诊详情的时候,隐藏复选框
  9263. if (type == 0) {
  9264. $("#visitingDetailModal").find("input[type=checkbox]").each(function (index, obj) {
  9265. $(obj).css("display", "none");
  9266. });
  9267. } else {
  9268. //历史处方显示复选框
  9269. $("#visitingDetailModal").find("input[type=checkbox]").each(function (index, obj) {
  9270. $(obj).css("display", "inline-block");
  9271. });
  9272. }
  9273. } else {
  9274. errorMesage(res);
  9275. }
  9276. }
  9277. });
  9278. $("#selfAmountView").html(0.00);
  9279. $("#fundPayView").html(0.00);
  9280. $("#acctPayView").html(0.00);
  9281. $("#totalAmountView").html(0.00);
  9282. $.ajax({
  9283. type: "GET",
  9284. url: '/thmz/getChargeDetailFee?patientId=&times=&receiptNo=&clnicId=' + clnicId,
  9285. contentType: "application/json;charset=UTF-8",
  9286. dataType: "json",
  9287. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9288. async: false,
  9289. success: function (res) {
  9290. if (res == '401' || res == 401) {
  9291. window.location.href = '/thmz/login/view'
  9292. return;
  9293. }
  9294. if (res.code == 0) {
  9295. if (res.fundPay != undefined && res.fundPay != null) {
  9296. $("#fundPayView").text("¥" + res.fundPay);
  9297. }
  9298. if (res.acctPay != undefined && res.acctPay != null) {
  9299. $("#acctPayView").text("¥" + res.acctPay);
  9300. }
  9301. $("#selfAmountView").text("¥" + res.selfAmount);
  9302. $("#totalAmountView").text("¥" + res.totalAmount);
  9303. } else {
  9304. printIndex = -1;
  9305. }
  9306. }
  9307. });
  9308. }
  9309. /**
  9310. * 查询默认打印机
  9311. */
  9312. function setPrint() {
  9313. if (printIndex >= 0) {
  9314. return;
  9315. }
  9316. $.ajax({
  9317. type: "GET",
  9318. url: '/thmz/getLastWindowsByCurrentUser',
  9319. contentType: "application/json;charset=UTF-8",
  9320. dataType: "json",
  9321. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9322. async: false,
  9323. success: function (res) {
  9324. if (res == '401' || res == 401) {
  9325. window.location.href = '/thmz/login/view'
  9326. return;
  9327. }
  9328. if (res.code == 0) {
  9329. printIndex = res.data.cgPrintIndex;
  9330. } else {
  9331. printIndex = -1;
  9332. }
  9333. }
  9334. });
  9335. }
  9336. function setTableHtml(prescriptionDetail) {
  9337. //设置成组处方符号
  9338. if (prescriptionDetail.length > 1) {
  9339. var map = new Map();
  9340. var groupOrderlist = [];
  9341. for (var j = 0; j < prescriptionDetail.length; j++) {
  9342. var detail = prescriptionDetail[j];
  9343. var list = map.get(detail.groupOrder);
  9344. if (list == null) {
  9345. list = [];
  9346. map.put(detail.groupOrder, list);
  9347. groupOrderlist[groupOrderlist.length] = detail.groupOrder;
  9348. }
  9349. list[list.length] = detail;
  9350. }
  9351. for (var j = 0; j < groupOrderlist.length; j++) {
  9352. var list = map.get(groupOrderlist[j]);
  9353. if (list.length == 1) {
  9354. continue;
  9355. }
  9356. list[0].groupFlag = "┒";
  9357. list[list.length - 1].groupFlag = "┛";
  9358. if (list.length > 2) {
  9359. for (var t = 1; t < list.length - 1; t++) {
  9360. list[t].groupFlag = "┃";
  9361. }
  9362. }
  9363. }
  9364. }
  9365. var html = "";
  9366. for (var j = 0; j < prescriptionDetail.length; j++) {
  9367. var detail = prescriptionDetail[j];
  9368. html += "<tr><td>" + detail.groupOrder + "</td>";
  9369. html += "<td colspan='2'>";
  9370. html += detail.name + "(" + detail.specification + ")";
  9371. html += "</td>";
  9372. html += "<td colspan='2'></td>";
  9373. html += "<td>X</td>";
  9374. html += "<td rowspan='2' style='height: 100%;line-height: 100%;font-size: 40px;'>";
  9375. if (detail.groupFlag != undefined && detail.groupFlag != null) {
  9376. html += detail.groupFlag;
  9377. }
  9378. html += "</td><td>" + detail.quantity + detail.packUnit + "</td>";
  9379. html += "</tr>";
  9380. html += "<tr><td></td>";
  9381. if (detail.tryResult != undefined && detail.tryResult != null && detail.tryResult != "null" && detail.tryResult != "") {
  9382. html += "<td>" + detail.tryResult + "</td>";
  9383. } else if (detail.tryFlag != undefined && detail.tryFlag != null && detail.tryFlag != "null" && detail.tryFlag != "") {
  9384. html += "<td>" + detail.tryFlag + "</td>";
  9385. } else {
  9386. html += "<td></td>";
  9387. }
  9388. html += "<td style='font-weight: bold;text-align: right;'>用法:</td>";
  9389. html += "<td>" + detail.drugQuan + detail.unitDesc + "/次</td>";
  9390. html += "<td>" + detail.frequency + "</td>";
  9391. html += "<td>" + detail.orderDays + "天</td>";
  9392. html += "<td>" + detail.supplyName + "</td>";
  9393. html += "</tr>";
  9394. }
  9395. html += "<tr><td colspan='7'>&nbsp;&nbsp;&nbsp;&nbsp;------(以下空白)------</td></tr>";
  9396. return {html: html, j: j};
  9397. }
  9398. // /**
  9399. // * 打印门诊指引单
  9400. // * @param patientId
  9401. // * @param times
  9402. // */
  9403. // function printGuideCard(patientId, times) {
  9404. //
  9405. // }
  9406. /**
  9407. * 打印门诊处方
  9408. * @param patientId
  9409. * @param times
  9410. * @param clnicId
  9411. * @param payMark
  9412. * @param printType 打印模式 1 预览打印 2 打印设置
  9413. */
  9414. function printPrescription(patientId, times, clnicId, payMark, printType) {
  9415. $.ajax({
  9416. type: "GET",
  9417. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + '&times=' + times + '&MzBlRecordFlag=false&payMark=' + payMark + '&clnicId=' + clnicId,
  9418. contentType: "application/json;charset=UTF-8",
  9419. dataType: "json",
  9420. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9421. success: function (res) {
  9422. if (res == '401' || res == 401) {
  9423. window.location.href = '/thmz/login/view'
  9424. return;
  9425. }
  9426. if (res.code == 0) {
  9427. var prescriptionDetail = res.data.mzBlRecord.prescriptionDetail;
  9428. if (prescriptionDetail != null && prescriptionDetail != "") {
  9429. var prescriptionDetailJson = JSON.parse(prescriptionDetail);
  9430. //当前处方只开了住院证则只打印住院证
  9431. 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) {
  9432. printZyReq(patientId, 1);
  9433. return;
  9434. }
  9435. var index = 0;
  9436. setPrint();
  9437. LODOP = getLodop();
  9438. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院处方笺");
  9439. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  9440. //设置默认打印机
  9441. LODOP.SET_PRINTER_INDEX(printIndex);
  9442. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  9443. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  9444. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  9445. //LODOP.SET_SHOW_MODE("SETUP_ENABLESS",getCheckSS());
  9446. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊处方笺");//对新建的纸张重命名
  9447. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  9448. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  9449. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  9450. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  9451. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  9452. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  9453. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  9454. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  9455. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  9456. var mzPatientMi = res.mzPatientMi;
  9457. var deptName = res.deptName;
  9458. $("#patientNamePrescription").text(mzPatientMi.name);
  9459. $("#patientGenderPrescription").text(mzPatientMi.gender);
  9460. $("#patientAgePrescription").text(mzPatientMi.ageString);
  9461. $("#patientIdPrescription").text(mzPatientMi.patientId);
  9462. $("#deptPrescription").text(deptName);
  9463. $("#doctorPrescription").text(res.doctorName);
  9464. $("#cfTime").text(res.opDate);
  9465. $("#socialNo").text(mzPatientMi.socialNo);
  9466. $("#zdPrescription").text(res.data.icdText);
  9467. $("#patientIdGuideCard").text(mzPatientMi.patientId);
  9468. $("#patientNameGuideCard").text(mzPatientMi.name);
  9469. $("#patientDateGuideCard").text(format(new Date(), "yyyy-MM-dd"));
  9470. //普药处方
  9471. var pyPrescription = prescriptionDetailJson.xyPrescription.pyPrescription;
  9472. if (pyPrescription != null && pyPrescription.length > 0) {
  9473. for (var i = 0; i < pyPrescription.length; i++) {
  9474. if (index > 0) {
  9475. LODOP.NewPageA();
  9476. }
  9477. var prescriptionDetail = pyPrescription[i].detail;
  9478. var __ret = setTableHtml(prescriptionDetail);
  9479. var html = __ret.html;
  9480. var j = __ret.j;
  9481. if (res.deptName != undefined && res.deptName != null) {
  9482. if (res.deptName.indexOf("儿") > 0) {
  9483. $("#typePrescription").text("儿科");
  9484. $("#cfTitle").text("儿科");
  9485. } else if (res.deptName.indexOf("急诊科") > 0) {
  9486. $("#typePrescription").text("急诊");
  9487. $("#cfTitle").text("急诊");
  9488. } else {
  9489. $("#typePrescription").text("普通处方");
  9490. $("#cfTitle").text("普通");
  9491. }
  9492. }
  9493. $("#prescriptionDetail").html(html);
  9494. $("#cfAmountPrint").text(pyPrescription[i].amount + "元 (不含注射费)");
  9495. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  9496. index++;
  9497. }
  9498. }
  9499. //医材处方
  9500. var ycPrescription = prescriptionDetailJson.xyPrescription.ycPrescription;
  9501. if (ycPrescription != null && ycPrescription.length > 0) {
  9502. for (var i = 0; i < ycPrescription.length; i++) {
  9503. if (index > 0) {
  9504. LODOP.NewPageA();
  9505. }
  9506. var prescriptionDetail = ycPrescription[i].detail;
  9507. var __ret = setTableHtml(prescriptionDetail);
  9508. var html = __ret.html;
  9509. var j = __ret.j;
  9510. if (res.deptName != undefined && res.deptName != null) {
  9511. if (res.deptName.indexOf("儿") > 0) {
  9512. $("#typePrescription").text("儿科");
  9513. $("#cfTitle").text("儿科");
  9514. } else if (res.deptName.indexOf("急诊科") > 0) {
  9515. $("#typePrescription").text("急诊");
  9516. $("#cfTitle").text("急诊");
  9517. } else {
  9518. $("#typePrescription").text("医材处方");
  9519. $("#cfTitle").text("普通");
  9520. }
  9521. }
  9522. $("#prescriptionDetail").html(html);
  9523. $("#cfAmountPrint").text(ycPrescription[i].amount + "元 ");
  9524. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  9525. index++;
  9526. }
  9527. }
  9528. //麻精处方
  9529. var mjPrescription = prescriptionDetailJson.xyPrescription.mjPrescription;
  9530. if (mjPrescription != null && mjPrescription.length > 0) {
  9531. for (var i = 0; i < mjPrescription.length; i++) {
  9532. if (index > 0) {
  9533. LODOP.NewPageA();
  9534. }
  9535. var prescriptionDetail = mjPrescription[i].detail;
  9536. var __ret = setTableHtml(prescriptionDetail);
  9537. var html = __ret.html;
  9538. var j = __ret.j;
  9539. $("#typePrescription").text("麻、精一处方");
  9540. $("#cfTitle").text("麻、精一");
  9541. $("#prescriptionDetail").html(html);
  9542. $("#cfAmountPrint").text(mjPrescription[i].amount + "元 (不含注射费)");
  9543. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  9544. index++;
  9545. }
  9546. }
  9547. //精二处方
  9548. var jePrescription = prescriptionDetailJson.xyPrescription.jePrescription;
  9549. if (jePrescription != null && jePrescription.length > 0) {
  9550. for (var i = 0; i < jePrescription.length; i++) {
  9551. if (index > 0) {
  9552. LODOP.NewPageA();
  9553. }
  9554. var prescriptionDetail = jePrescription[i].detail;
  9555. var __ret = setTableHtml(prescriptionDetail);
  9556. var html = __ret.html;
  9557. var j = __ret.j;
  9558. $("#typePrescription").text("精二处方");
  9559. $("#cfTitle").text("精二");
  9560. $("#prescriptionDetail").html(html);
  9561. $("#cfAmountPrint").text(jePrescription[i].amount + "元 (不含注射费)");
  9562. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  9563. index++;
  9564. }
  9565. }
  9566. //中药处方
  9567. if (prescriptionDetailJson.zyPrescription != null && prescriptionDetailJson.zyPrescription.length > 0) {
  9568. var zyPrescription = prescriptionDetailJson.zyPrescription[0].detail;
  9569. if (zyPrescription != null && zyPrescription.length > 0) {
  9570. var html = "";
  9571. for (var i = 0; i < zyPrescription.length; i++) {
  9572. if (i % 2 == 0) {
  9573. html += "<tr><td></td><td></td></tr><tr>";
  9574. }
  9575. html += "<td>";
  9576. html += zyPrescription[i].name;
  9577. html += zyPrescription[i].quantity + "g";
  9578. if (zyPrescription[i].instructionText != null) {
  9579. html += "[" + zyPrescription[i].instructionText + "]";
  9580. }
  9581. if (i % 2 == 1) {
  9582. html += "</td></tr>";
  9583. } else {
  9584. html += "</td>";
  9585. }
  9586. }
  9587. if (zyPrescription.length % 2 != 0) {
  9588. html += "</tr>";
  9589. }
  9590. html += "<tr><td></td><td>X " + prescriptionDetailJson.zyPrescription[0].zyfs + "付</td></tr>";
  9591. var cyMtjs = prescriptionDetailJson.zyPrescription[0].cyMtjs;
  9592. if (cyMtjs == null || cyMtjs == "null") {
  9593. cyMtjs = "";
  9594. }
  9595. var cyJssm = prescriptionDetailJson.zyPrescription[0].cyJssm;
  9596. if (cyJssm == null || cyJssm == "null") {
  9597. cyJssm = "";
  9598. }
  9599. var cyJsl = prescriptionDetailJson.zyPrescription[0].cyJsl;
  9600. if (cyJsl == null || cyJsl == "null") {
  9601. cyJsl = "";
  9602. }
  9603. var cyZql = prescriptionDetailJson.zyPrescription[0].cyZql;
  9604. if (cyZql == null || cyZql == "null") {
  9605. cyZql = "";
  9606. }
  9607. var cyFj = prescriptionDetailJson.zyPrescription[0].cyFj;
  9608. if (cyFj == null || cyFj == "null") {
  9609. cyFj = "";
  9610. }
  9611. var cyFfcs = prescriptionDetailJson.zyPrescription[0].cyFfcs;
  9612. if (cyFfcs == null || cyFfcs == "null") {
  9613. cyFfcs = "";
  9614. }
  9615. var cyFysm = prescriptionDetailJson.zyPrescription[0].cyFysm;
  9616. if (cyFysm == null || cyFysm == "null") {
  9617. cyFysm = "";
  9618. }
  9619. var cyDj = prescriptionDetailJson.zyPrescription[0].cyDj;
  9620. if (cyDj == null || cyDj == "null") {
  9621. cyDj = "";
  9622. } else {
  9623. cyDj = "(" + cyDj + ")";
  9624. }
  9625. html += "<tr><td colspan='2'>每天" + cyMtjs + "剂," + cyJssm + cyJsl + "ml,煮取量" + cyZql + "ml,复煎" + cyFj + "次。分" + cyFfcs + "次" + cyFysm + " " + cyDj + "。</td></tr>";
  9626. html += "<tr><td colspan='2'>&nbsp;&nbsp;&nbsp;&nbsp;------(以下空白)------</td></tr>";
  9627. if (index > 0) {
  9628. LODOP.NewPageA();
  9629. }
  9630. if (res.deptName != undefined && res.deptName != null) {
  9631. if (res.deptName.indexOf("儿") > 0) {
  9632. $("#typePrescription").text("儿科");
  9633. $("#cfTitle").text("儿科");
  9634. } else if (res.deptName.indexOf("急诊科") > 0) {
  9635. $("#typePrescription").text("急诊");
  9636. $("#cfTitle").text("急诊");
  9637. } else {
  9638. $("#typePrescription").text("中药处方");
  9639. $("#cfTitle").text("普通");
  9640. }
  9641. }
  9642. $("#prescriptionDetail").html(html);
  9643. $("#cfAmountPrint").text(prescriptionDetailJson.zyPrescription[0].amount + "元 (不含代煎费)");
  9644. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  9645. index++;
  9646. }
  9647. }
  9648. var printZlPrescription = $("#zlPrintFlagCheck").parent().hasClass("checked") == true ? true : false;
  9649. if (printZlPrescription) {
  9650. if (prescriptionDetailJson.zlPrescription != null && prescriptionDetailJson.zlPrescription.length > 0) {
  9651. //诊疗处方
  9652. var zlPrescription = prescriptionDetailJson.zlPrescription[0].detail;
  9653. if (zlPrescription != null && zlPrescription.length > 0) {
  9654. var html = "";
  9655. for (var i = 0; i < zlPrescription.length; i++) {
  9656. var zlPrescriptionTemp = zlPrescription[i];
  9657. html += "<tr>";
  9658. html += "<td colspan='2'>" + zlPrescriptionTemp.index + "." + zlPrescriptionTemp.name + "</td>";
  9659. html += "<td style='text-align: right;padding-right: 15px;'>X</td>";
  9660. html += "<td>总量:" + zlPrescriptionTemp.quantity + "</td>";
  9661. html += "</tr>";
  9662. html += "<tr>";
  9663. html += "<td width='40%'></td>";
  9664. html += "<td width='20%'>单量:" + zlPrescriptionTemp.drugQuan + "</td>";
  9665. html += "<td width='20%'>频率:" + zlPrescriptionTemp.frequency + "</td>";
  9666. html += "<td width='20%'>天数:" + zlPrescriptionTemp.orderDays + "天</td>";
  9667. html += "</tr>";
  9668. }
  9669. if (index > 0) {
  9670. LODOP.NewPageA();
  9671. }
  9672. if (res.deptName != undefined && res.deptName != null) {
  9673. if (res.deptName.indexOf("儿") > 0) {
  9674. $("#typePrescription").text("儿科");
  9675. $("#cfTitle").text("儿科");
  9676. } else if (res.deptName.indexOf("急诊科") > 0) {
  9677. $("#typePrescription").text("急诊");
  9678. $("#cfTitle").text("急诊");
  9679. } else {
  9680. $("#typePrescription").text("诊疗处方");
  9681. $("#cfTitle").text("普通");
  9682. }
  9683. }
  9684. $("#prescriptionDetail").html(html);
  9685. $("#cfAmountPrint").text(prescriptionDetailJson.zlPrescription[0].amount + "元 ");
  9686. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  9687. index++;
  9688. }
  9689. }
  9690. }
  9691. //检查申请单打印
  9692. var mzYjReqList = res.data.mzYjReqList;
  9693. if (mzYjReqList != null && mzYjReqList.length > 0) {
  9694. $("#patientIdJcReq").text(mzPatientMi.patientId);
  9695. $("#patientNameJcReq").text(mzPatientMi.name);
  9696. $("#patientGenderJcReq").text(mzPatientMi.gender);
  9697. $("#patientAgeJcReq").text(mzPatientMi.ageString);
  9698. $("#responseTypeJcReq").text(mzPatientMi.responseTypeName);
  9699. $("#patientCardNoJcReq").text(mzPatientMi.icCardNo);
  9700. $("#icdTextJcReq").text(res.data.icdText);
  9701. var mzBlRecord = res.data.mzBlRecord;
  9702. $("#jcReqEmrChiefComplaint").text(mzBlRecord.emrChiefComplaint);
  9703. $("#jcReqHis").text(mzBlRecord.emrHpi);
  9704. var tz = getTz(mzBlRecord);
  9705. $("#jcReqTz").text(tz);
  9706. $("#jcReqReqDept").text(res.deptName);
  9707. $("#jcReqReqDoctor").text(res.doctorName);
  9708. // $("#patientIdJyReq").text(mzPatientMi.patientId);
  9709. // $("#patientNameJyReq").text(mzPatientMi.name);
  9710. // $("#patientGenderJyReq").text(mzPatientMi.gender);
  9711. // $("#patientAgeJyReq").text(mzPatientMi.ageString);
  9712. // $("#patientCardNoJyReq").text(mzPatientMi.icCardNo);
  9713. // $("#responseTypeJyReq").text(mzPatientMi.responseTypeName);
  9714. // $("#icdTextJyReq").text(res.data.icdText);
  9715. // $("#jyReqEmrChiefComplaint").text(mzBlRecord.emrChiefComplaint);
  9716. // $("#jyReqHis").text(mzBlRecord.emrHpi);
  9717. // $("#jyReqTz").text(tz);
  9718. // $("#jyReqReqDept").text(res.deptName);
  9719. // $("#jyReqReqDoctor").text(res.doctorName);
  9720. for (var i = 0; i < mzYjReqList.length; i++) {
  9721. var mzYjReq = mzYjReqList[i];
  9722. if (mzYjReq == null) {
  9723. continue;
  9724. }
  9725. if (i == 0) {
  9726. var dateStr = format(mzYjReq.reqDate, "yyyy-MM-dd");
  9727. $("#jcReqReqDate").text(dateStr);
  9728. // $("#jyReqReqDoctor").text(dateStr);
  9729. }
  9730. if (mzYjReq.reqType == 2) {
  9731. continue;
  9732. }
  9733. if ((i == 0 && index > 0) || i > 0) {
  9734. LODOP.NewPageA();
  9735. }
  9736. $("#reqNoJcReq").text(mzYjReq.reqNo);
  9737. $("#jcReqItem").text(mzYjReq.groupName);
  9738. $("#jcReqRemark").text(mzYjReq.jyRemark);
  9739. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("jc_card_table").innerHTML);
  9740. index++;
  9741. }
  9742. }
  9743. //住院证打印
  9744. var mzZyReq = res.data.mzZyReq;
  9745. if (mzZyReq != null) {
  9746. $("#patientIdZyReq").text(mzPatientMi.patientId);
  9747. $("#patientNameZyReq").text(mzPatientMi.name);
  9748. $("#patientGenderZyReq").text(mzPatientMi.gender);
  9749. $("#patientAgeZyReq").text(mzPatientMi.ageString);
  9750. $("#sfzZyReq").text(mzPatientMi.socialNo);
  9751. $("#birthDateZyReq").text(format(mzPatientMi.birthDay, "yyyy-MM-dd"));
  9752. $("#phoneZyReq").text(mzPatientMi.phoneNo);
  9753. $("#responseTypeZyReq").text(mzPatientMi.responseTypeName);
  9754. $("#addressZyReq").text(mzPatientMi.address);
  9755. if (mzZyReq.icdCode == null || mzZyReq.icdCode == "" || mzZyReq.icdCode.length == 0) {
  9756. $("#icsCodeZyReq").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
  9757. $("#icsTextZyReq").text(mzZyReq.icdText);
  9758. } else {
  9759. $("#icsCodeZyReq").text(mzZyReq.icdCode);
  9760. $("#icsTextZyReq").text(mzZyReq.icdText);
  9761. }
  9762. $("#reqDeptZyReq").text(mzZyReq.reqWardName);
  9763. $("#smallDeptZyReq").text(mzZyReq.smallDeptName);
  9764. //$("#admissStatusZyReq").text(mzZyReq.admissStatus);
  9765. $("input:checkbox[value='" + mzZyReq.admissStatus + "']").attr('checked', 'true');
  9766. $("#visitDateZyReq").text(format(mzZyReq.visitDate, "yyyy-MM-dd HH:mm:ss"));
  9767. $("#deptCodeZyReq").text(mzZyReq.deptName);
  9768. $("#doctorCodeZyReq").text(mzZyReq.doctorName);
  9769. if (index > 0) {
  9770. LODOP.NewPageA();
  9771. }
  9772. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("mz_zy_req_table").innerHTML);
  9773. index++;
  9774. }
  9775. $("#selfAmountGuideCard").html(0.00);
  9776. $("#fundPayGuideCard").html(0.00);
  9777. $("#acctPayGuideCard").html(0.00);
  9778. $("#payQrcodeGuideCard").empty();
  9779. $("#selfPayDetail").empty();
  9780. $.ajax({
  9781. type: "GET",
  9782. url: '/thmz/getChargeDetailForGuideCard?patientId=' + patientId + '&times=' + times,
  9783. contentType: "application/json;charset=UTF-8",
  9784. dataType: "json",
  9785. headers: {
  9786. 'Accept': 'application/json',
  9787. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  9788. },
  9789. success: function (res) {
  9790. if (res == '401' || res == 401) {
  9791. window.location.href = '/thmz/login/view'
  9792. return;
  9793. }
  9794. if (res.code == 0) {
  9795. var selfPayList = res.selfPayList;
  9796. if (selfPayList != null && selfPayList.length > 0) {
  9797. $("#patientNameSelfPay").text(mzPatientMi.name);
  9798. $("#patientGenderSelfPay").text(mzPatientMi.gender);
  9799. $("#patientAgeSelfPay").text(mzPatientMi.ageString);
  9800. $("#patientIdSelfPay").text(mzPatientMi.patientId);
  9801. $("#deptSelfPay").text(deptName);
  9802. $("#zdSelfPay").text(res.icdText);
  9803. var selfPayListHtml = "";
  9804. for (var i = 1; i <= selfPayList.length; i++) {
  9805. selfPayListHtml += "<tr><td>";
  9806. selfPayListHtml += i + "." + selfPayList[i - 1];
  9807. selfPayListHtml += "</td></tr>";
  9808. }
  9809. $("#selfPayDetail").html(selfPayListHtml);
  9810. if (index > 0) {
  9811. LODOP.NewPageA();
  9812. }
  9813. //view-source:http://www.c-lodop.com/demolist/PrintSample43.html 分页看这里
  9814. LODOP.ADD_PRINT_TABLE(158, "5%", "90%", 400, strStyle + document.getElementById("self_pay_table_body").innerHTML);
  9815. LODOP.SET_PRINT_STYLEA(0, "Vorient", 3);
  9816. LODOP.ADD_PRINT_HTM(26, "5%", "90%", 119, document.getElementById("self_pay_table_header").innerHTML);
  9817. LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
  9818. LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1);
  9819. LODOP.ADD_PRINT_HTM(560, "5%", "90%", 200, document.getElementById("self_pay_table_foot").innerHTML);
  9820. LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
  9821. LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1);
  9822. // LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("self_pay_table").innerHTML);
  9823. index++;
  9824. }
  9825. if (res.data != null && res.data.length > 0) {
  9826. var html = "";
  9827. for (var i = 0; i < res.data.length; i++) {
  9828. 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>"
  9829. }
  9830. $("#guideCardDetail").html(html);
  9831. }
  9832. if (res.payQrcode != null && res.payQrcode != "") {
  9833. new QRCode(document.getElementById("payQrcodeGuideCard"), res.payQrcode); // 设置要生成二维码的链接
  9834. $("canvas").attr("id", "erw");
  9835. var canvas = document.getElementById('erw');
  9836. var src = canvas.toDataURL("image/png");
  9837. //var strDataURI =canvas.toDataURL("image/png");
  9838. $("#payQrcodeGuideCard").html("<img src='" + src + "' style='width:100px;height:100px;'/><div style='width: 100px;margin-top: 10px;text-align: center;'>微信支付</div>");
  9839. }
  9840. if (res.fundPay != undefined && res.fundPay != null) {
  9841. $("#fundPayGuideCard").text("¥" + res.fundPay);
  9842. }
  9843. if (res.acctPay != undefined && res.acctPay != null) {
  9844. $("#acctPayGuideCard").text("¥" + res.acctPay);
  9845. }
  9846. $("#selfAmountGuideCard").text("¥" + res.selfAmount);
  9847. $("#totalAmountGuideCard").text("¥" + res.totalAmount);
  9848. // $("#imgcode").JsBarcode(patientId);
  9849. console.log(patientId);
  9850. JsBarcode('#imgcode', patientId, {
  9851. lineColor: '#333', //线条颜色
  9852. width: 2, //线宽
  9853. height: 60, //条码高度
  9854. displayValue: false, //是否显示文字信息
  9855. });
  9856. if (index > 0) {
  9857. LODOP.NewPageA();
  9858. }
  9859. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("guide_card_table").innerHTML);
  9860. //LODOP.PRINT();
  9861. if (printType == 1) {
  9862. LODOP.PREVIEW();
  9863. } else if (printType == 2) {
  9864. LODOP.PRINT_SETUP();
  9865. }
  9866. } else if (res.code == -2) {
  9867. if (printType == 1) {
  9868. LODOP.PREVIEW();
  9869. } else if (printType == 2) {
  9870. LODOP.PRINT_SETUP();
  9871. }
  9872. } else {
  9873. errorMesage(res);
  9874. }
  9875. }
  9876. });
  9877. // printGuideCard(patientId, times);
  9878. }
  9879. } else {
  9880. errorMesage(res);
  9881. }
  9882. }
  9883. });
  9884. }
  9885. /**
  9886. * 构建体征描述
  9887. * @param mzBlRecord
  9888. * @returns {*}
  9889. */
  9890. function getTz(mzBlRecord) {
  9891. var tz = null;
  9892. if (mzBlRecord.weight != null && mzBlRecord.weight != 0) {
  9893. var temp = "体重:" + mzBlRecord.weight + "kg ";
  9894. if (tz == null) {
  9895. tz = temp;
  9896. } else {
  9897. tz += " " + temp;
  9898. }
  9899. }
  9900. if (mzBlRecord.temperature != null && mzBlRecord.temperature != 0) {
  9901. var temp = "体温:" + mzBlRecord.temperature + "℃ ";
  9902. if (tz == null) {
  9903. tz = temp;
  9904. } else {
  9905. tz += " " + temp;
  9906. }
  9907. }
  9908. if (mzBlRecord.sphygmus != null && mzBlRecord.sphygmus != 0) {
  9909. var temp = "脉搏:" + mzBlRecord.sphygmus + "次/分 ";
  9910. if (tz == null) {
  9911. tz = temp;
  9912. } else {
  9913. tz += " " + temp;
  9914. }
  9915. }
  9916. if (mzBlRecord.breathe != null && mzBlRecord.breathe != 0) {
  9917. var temp = "呼吸:" + mzBlRecord.breathe + "次/分 ";
  9918. if (tz == null) {
  9919. tz = temp;
  9920. } else {
  9921. tz += " " + temp;
  9922. }
  9923. }
  9924. if (mzBlRecord.pressureHigh != null && mzBlRecord.pressureFloor != null && mzBlRecord.pressureHigh != 0 && mzBlRecord.pressureFloor != 0) {
  9925. var temp = "血压:" + mzBlRecord.pressureHigh + "/" + mzBlRecord.pressureFloor;
  9926. if (tz == null) {
  9927. tz = temp;
  9928. } else {
  9929. tz += " " + temp;
  9930. }
  9931. }
  9932. if (mzBlRecord.pressureHighLeft != null && mzBlRecord.pressureFloorLeft != null && mzBlRecord.pressureHighLeft != 0 && mzBlRecord.pressureFloorLeft != 0) {
  9933. var temp = "左血压:" + mzBlRecord.pressureHighLeft + "/" + mzBlRecord.pressureFloorLeft;
  9934. if (tz == null) {
  9935. tz = temp;
  9936. } else {
  9937. tz += " " + temp;
  9938. }
  9939. }
  9940. if (mzBlRecord.emrPe != null && mzBlRecord.emrPe != "") {
  9941. if (tz == null) {
  9942. tz = mzBlRecord.emrPe;
  9943. } else {
  9944. tz += "," + mzBlRecord.emrPe;
  9945. }
  9946. }
  9947. return tz;
  9948. }
  9949. /**
  9950. * 打印医技申请单
  9951. * @param patientId
  9952. * @param times
  9953. * @param type 申请单类型:2:检验;3:检查
  9954. * @param printType 打印模式 1 预览打印 2 打印设置
  9955. */
  9956. function printYjReq(patientId, times, type, printType) {
  9957. $.ajax({
  9958. type: "GET",
  9959. url: '/thmz/printYjReq?patientId=' + patientId + '&times=' + times + "&reqType=" + type,
  9960. contentType: "application/json;charset=UTF-8",
  9961. dataType: "json",
  9962. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9963. success: function (res) {
  9964. if (res == '401' || res == 401) {
  9965. window.location.href = '/thmz/login/view'
  9966. return;
  9967. }
  9968. if (res.code == 0) {
  9969. if (res.data == null || res.data.mzYjReqList == null || res.data.mzYjReqList.length == 0) {
  9970. errorMesageSimaple("没有医技申请单可以打印");
  9971. return;
  9972. }
  9973. setPrint();
  9974. LODOP = getLodop();
  9975. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院检查申请单");
  9976. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  9977. //设置默认打印机
  9978. LODOP.SET_PRINTER_INDEX(printIndex);
  9979. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  9980. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  9981. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  9982. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "检查申请单");//对新建的纸张重命名
  9983. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  9984. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  9985. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  9986. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  9987. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  9988. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  9989. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  9990. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  9991. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  9992. var mzPatientMi = res.data.mzPatientMi;
  9993. $("#patientIdJcReq").text(mzPatientMi.patientId);
  9994. $("#patientNameJcReq").text(mzPatientMi.name);
  9995. $("#patientGenderJcReq").text(mzPatientMi.gender);
  9996. $("#patientAgeJcReq").text(mzPatientMi.ageString);
  9997. $("#responseTypeJcReq").text(mzPatientMi.responseTypeName);
  9998. $("#patientCardNoJcReq").text(mzPatientMi.icCardNo);
  9999. $("#icdTextJcReq").text(res.data.icdText);
  10000. $("#patientIdJyReq").text(mzPatientMi.patientId);
  10001. $("#patientNameJyReq").text(mzPatientMi.name);
  10002. $("#patientGenderJyReq").text(mzPatientMi.gender);
  10003. $("#patientAgeJyReq").text(mzPatientMi.ageString);
  10004. $("#responseTypeJyReq").text(mzPatientMi.responseTypeName);
  10005. $("#patientCardNoJyReq").text(mzPatientMi.icCardNo);
  10006. $("#icdTextJyReq").text(res.data.icdText);
  10007. var mzBlRecord = res.data.mzBlRecord;
  10008. $("#jcReqEmrChiefComplaint").text(mzBlRecord.emrChiefComplaint);
  10009. $("#jcReqHis").text(mzBlRecord.emrHpi);
  10010. $("#jyReqEmrChiefComplaint").text(mzBlRecord.emrChiefComplaint);
  10011. $("#jyReqHis").text(mzBlRecord.emrHpi);
  10012. var tz = getTz(mzBlRecord);
  10013. $("#jcReqTz").text(tz);
  10014. $("#jcReqReqDept").text(res.data.deptName);
  10015. $("#jcReqReqDoctor").text(res.data.doctorName);
  10016. $("#jyReqTz").text(tz);
  10017. $("#jyReqReqDept").text(res.data.deptName);
  10018. $("#jyReqReqDoctor").text(res.data.doctorName);
  10019. //检验报告列表名
  10020. 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>';
  10021. var jyContent = "";
  10022. var needNewPageA = false;
  10023. for (var i = 0; i < res.data.mzYjReqList.length; i++) {
  10024. var obj = res.data.mzYjReqList[i];
  10025. if (i == 0) {
  10026. var dateStr = format(obj.reqDate, "yyyy-MM-dd");
  10027. $("#jcReqReqDate").text(dateStr);
  10028. $("#jyReqReqDate").text(dateStr);
  10029. }
  10030. if (obj.reqType == "3") {
  10031. if (i > 0) {
  10032. LODOP.NewPageA();
  10033. }
  10034. $("#reqNoJcReq").text(obj.reqNo);
  10035. $("#jcReqItem").text(obj.groupName);
  10036. $("#jcReqRemark").text(obj.jyRemark);
  10037. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("jc_card_table").innerHTML);
  10038. needNewPageA = true;
  10039. } else if (obj.reqType == "2") {
  10040. var inspectStuff = (obj.inspectStuff == null || obj.inspectStuff == "null") ? "" : obj.inspectStuff;
  10041. jyContent += '<tr><td style="min-height: 30px;">' + obj.groupName + '</td><td>' + inspectStuff + '</td><td>' + obj.reqNo + '</td></tr>';
  10042. }
  10043. }
  10044. if (jyContent != null && jyContent != "" && jyContent.length > 0) {
  10045. if (needNewPageA) {
  10046. LODOP.NewPageA();
  10047. }
  10048. jyContent = jyTitle + jyContent;
  10049. $("#jyContent").html(jyContent);
  10050. //检验
  10051. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("jy_card_table").innerHTML);
  10052. }
  10053. if (printType == 1) {
  10054. LODOP.PREVIEW();
  10055. } else if (printType == 2) {
  10056. LODOP.PRINT_SETUP();
  10057. }
  10058. } else {
  10059. errorMesage(res);
  10060. }
  10061. }
  10062. });
  10063. }
  10064. /**
  10065. * 打印门诊病历
  10066. * @param patientId
  10067. * @param times
  10068. * @param clnicId
  10069. * @param payMark
  10070. * @param printType 打印模式 1 预览打印 2 打印设置
  10071. */
  10072. function printBlRecord(patientId, times, printType) {
  10073. $.ajax({
  10074. type: "GET",
  10075. url: '/thmz/getMzBlrecord?patientId=' + patientId + '&times=' + times,
  10076. contentType: "application/json;charset=UTF-8",
  10077. dataType: "json",
  10078. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10079. success: function (res) {
  10080. if (res == '401' || res == 401) {
  10081. window.location.href = '/thmz/login/view'
  10082. return;
  10083. }
  10084. if (res.code == 0) {
  10085. setPrint();
  10086. LODOP = getLodop();
  10087. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院门诊病历");
  10088. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  10089. //设置默认打印机
  10090. LODOP.SET_PRINTER_INDEX(printIndex);
  10091. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  10092. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  10093. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  10094. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊病历");//对新建的纸张重命名
  10095. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  10096. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  10097. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  10098. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  10099. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  10100. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  10101. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  10102. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  10103. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  10104. var mzPatientMi = res.mzPatientMi;
  10105. $("#patientIdBlrecord").text(mzPatientMi.patientId);
  10106. $("#patientNameBlrecord").text(mzPatientMi.name);
  10107. $("#patientGenderBlrecord").text(mzPatientMi.gender);
  10108. $("#patientAgeBlrecord").text(mzPatientMi.ageString);
  10109. var mzBlRecord = res.mzBlRecord;
  10110. if (mzBlRecord.firstOrNot == "1") {
  10111. $("#firstOrNotTitle").text("复诊");
  10112. } else {
  10113. $("#firstOrNotTitle").text("初诊");
  10114. }
  10115. if (mzBlRecord.emrChiefComplaint != null && mzBlRecord.emrChiefComplaint != "") {
  10116. $("#emrChiefComplaintBlrecord").text(mzBlRecord.emrChiefComplaint);
  10117. $("#emrChiefComplaintBlrecord").parent().css("display", "block");
  10118. } else {
  10119. $("#emrChiefComplaintBlrecord").parent().css("display", "none");
  10120. }
  10121. if (mzBlRecord.emrHpi != null && mzBlRecord.emrHpi != "") {
  10122. $("#emrHpiBlrecord").text(mzBlRecord.emrHpi);
  10123. $("#emrHpiBlrecord").parent().css("display", "block");
  10124. } else {
  10125. $("#emrHpiBlrecord").parent().css("display", "none");
  10126. }
  10127. if (mzBlRecord.emrPs != null && mzBlRecord.emrPs != "") {
  10128. $("#emrPsBlrecord").text(mzBlRecord.emrPs);
  10129. $("#emrPsBlrecord").parent().css("display", "block");
  10130. } else {
  10131. $("#emrPsBlrecord").parent().css("display", "none");
  10132. }
  10133. if (mzBlRecord.personalHistory != null && mzBlRecord.personalHistory != "") {
  10134. $("#personalHistoryBlrecord").text(mzBlRecord.personalHistory);
  10135. $("#personalHistoryBlrecord").parent().css("display", "block");
  10136. } else {
  10137. $("#personalHistoryBlrecord").parent().css("display", "none");
  10138. }
  10139. if (mzBlRecord.familyHistory != null && mzBlRecord.familyHistory != "") {
  10140. $("#familyHistoryBlrecord").text(mzBlRecord.familyHistory);
  10141. $("#familyHistoryBlrecord").parent().css("display", "block");
  10142. } else {
  10143. $("#familyHistoryBlrecord").parent().css("display", "none");
  10144. }
  10145. if (mzBlRecord.obstericalHistory != null && mzBlRecord.obstericalHistory != "") {
  10146. $("#obstericalHistoryBlrecord").text(mzBlRecord.obstericalHistory);
  10147. $("#obstericalHistoryBlrecord").parent().css("display", "block");
  10148. } else {
  10149. $("#obstericalHistoryBlrecord").parent().css("display", "none");
  10150. }
  10151. var tz = getTz(mzBlRecord);
  10152. if (tz != null && tz != "") {
  10153. $("#emrPeBlrecord").text(tz);
  10154. $("#emrPeBlrecord").parent().css("display", "block");
  10155. } else {
  10156. $("#emrPeBlrecord").parent().css("display", "none");
  10157. }
  10158. // if (mzBlRecord.emrPe != null && mzBlRecord.emrPe != "") {
  10159. // $("#emrPeBlrecord").text(mzBlRecord.emrPe);
  10160. // $("#emrPeBlrecord").parent().css("display", "block");
  10161. // } else {
  10162. // $("#emrPeBlrecord").parent().css("display", "none");
  10163. // }
  10164. if (res.icdText != null && res.icdText != "") {
  10165. $("#icdTextBlrecord").text(res.icdText);
  10166. $("#icdTextBlrecord").parent().css("display", "block");
  10167. } else {
  10168. $("#icdTextBlrecord").parent().css("display", "none");
  10169. }
  10170. if (mzBlRecord.emrProcess != null && mzBlRecord.emrProcess != "") {
  10171. $("#emrProcessBlrecord").html(mzBlRecord.emrProcess);
  10172. $("#emrProcessBlrecord").parent().css("display", "block");
  10173. } else {
  10174. $("#emrProcessBlrecord").parent().css("display", "none");
  10175. }
  10176. if (mzBlRecord.emrJkjy != null && mzBlRecord.emrJkjy != "") {
  10177. $("#emrJkjyBlrecord").text(mzBlRecord.emrJkjy);
  10178. $("#emrJkjyBlrecord").parent().css("display", "block");
  10179. } else {
  10180. $("#emrJkjyBlrecord").parent().css("display", "none");
  10181. }
  10182. $("#visitDeptBlrecord").text(res.deptName);
  10183. $("#visitDoctorBlrecord").text(res.doctorName);
  10184. $("#visitDateBlrecord").text(res.visitDate);
  10185. //LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("mz_blrecord_card_table").innerHTML);
  10186. //上边距 左边距 宽 高
  10187. LODOP.ADD_PRINT_HTM("20mm", "5mm", "130mm", "168mm", strStyle + document.getElementById("mz_bl_content").innerHTML);
  10188. LODOP.SET_PRINT_STYLEA(0, "Vorient", 3);
  10189. LODOP.ADD_PRINT_HTM("0mm", "5mm", "130mm", "20mm", strStyle + document.getElementById("mz_bl_title").innerHTML);
  10190. LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
  10191. LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
  10192. LODOP.ADD_PRINT_HTM("190mm", "5mm", "130mm", "20mm", strStyle + document.getElementById("mz_bl_foot").innerHTML);
  10193. LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
  10194. LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
  10195. if (printType == 1) {
  10196. LODOP.PREVIEW();
  10197. } else if (printType == 2) {
  10198. LODOP.PRINT_SETUP();
  10199. }
  10200. } else {
  10201. errorMesage(res);
  10202. }
  10203. }
  10204. });
  10205. }
  10206. /**
  10207. * 打印入院通知单
  10208. * @param patientId
  10209. * @param times
  10210. * @param clnicId
  10211. * @param payMark
  10212. * @param printType 打印模式 1 预览打印 2 打印设置
  10213. */
  10214. function printZyReq(patientId, printType) {
  10215. $.ajax({
  10216. type: "GET",
  10217. url: '/thmz/printZyReq?patientId=' + patientId,
  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. if (res.code == 0) {
  10227. setPrint();
  10228. LODOP = getLodop();
  10229. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院入院通知单");
  10230. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  10231. //设置默认打印机
  10232. LODOP.SET_PRINTER_INDEX(printIndex);
  10233. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  10234. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  10235. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  10236. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "入院通知单");//对新建的纸张重命名
  10237. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  10238. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  10239. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  10240. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  10241. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  10242. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  10243. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  10244. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  10245. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  10246. var mzPatientMi = res.mzPatientMi;
  10247. var mzZyReq = res.mzZyReq;
  10248. $("#patientIdZyReq").text(mzPatientMi.patientId);
  10249. $("#patientNameZyReq").text(mzPatientMi.name);
  10250. $("#patientGenderZyReq").text(mzPatientMi.gender);
  10251. $("#patientAgeZyReq").text(mzPatientMi.ageString);
  10252. $("#sfzZyReq").text(mzPatientMi.socialNo);
  10253. $("#birthDateZyReq").text(format(mzPatientMi.birthDay, "yyyy-MM-dd"));
  10254. $("#phoneZyReq").text(mzPatientMi.phoneNo);
  10255. $("#responseTypeZyReq").text(mzPatientMi.responseTypeName);
  10256. $("#addressZyReq").text(mzPatientMi.address);
  10257. if (mzZyReq.icdCode == null || mzZyReq.icdCode == "" || mzZyReq.icdCode.length == 0) {
  10258. $("#icsCodeZyReq").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
  10259. $("#icsTextZyReq").text(mzZyReq.icdText);
  10260. } else {
  10261. $("#icsCodeZyReq").text(mzZyReq.icdCode);
  10262. $("#icsTextZyReq").text(mzZyReq.icdText);
  10263. }
  10264. $("#reqDeptZyReq").text(mzZyReq.reqWardName);
  10265. $("#smallDeptZyReq").text(mzZyReq.smallDeptName);
  10266. //$("#admissStatusZyReq").text(mzZyReq.admissStatus);
  10267. $("input:checkbox[value='" + mzZyReq.admissStatus + "']").attr('checked', 'true');
  10268. $("#visitDateZyReq").text(format(mzZyReq.visitDate, "yyyy-MM-dd HH:mm:ss"));
  10269. $("#deptCodeZyReq").text(mzZyReq.deptName);
  10270. $("#doctorCodeZyReq").text(mzZyReq.doctorName);
  10271. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("mz_zy_req_table").innerHTML);
  10272. if (printType == 1) {
  10273. LODOP.PREVIEW();
  10274. } else if (printType == 2) {
  10275. LODOP.PRINT_SETUP();
  10276. }
  10277. } else {
  10278. errorMesage(res);
  10279. }
  10280. }
  10281. });
  10282. }
  10283. /**
  10284. * 打开查看检查检验报告窗口(含往期)
  10285. * @param patientId
  10286. */
  10287. function previewYjReqAll(patientId) {
  10288. $("#visitingDetailModal").modal("hide");
  10289. $("#previewYjReqModal").modal();
  10290. $("#previewYjReqModalPatientId").val(patientId);
  10291. $("#previewYjReqModalTimes").val(null);
  10292. //重置参数
  10293. retryCount = 0;
  10294. initJcJyTable();
  10295. }
  10296. /**
  10297. * 打开查看检查检验报告窗口
  10298. * @param patientId 门诊病人ID
  10299. * @param times 就诊次数
  10300. */
  10301. function previewYjReq(patientId, times) {
  10302. $("#visitingDetailModal").modal("hide");
  10303. $("#previewYjReqModal").modal();
  10304. $("#previewYjReqModalPatientId").val(patientId);
  10305. $("#previewYjReqModalTimes").val(times);
  10306. //重置参数
  10307. retryCount = 0;
  10308. initJcJyTable();
  10309. }
  10310. /**
  10311. * 删除本次处方
  10312. * @param clnicId 就诊记录id
  10313. */
  10314. function deletePrescription(clnicId) {
  10315. $("#visitingDetailModal").modal("hide");
  10316. $("#messageModal").modal();
  10317. $("#messageContent").html("确认要删除本次处方信息吗?");
  10318. $("#messageButton").off("click").on("click", function (t) {
  10319. $("#messageModal").modal("hide");
  10320. $.ajax({
  10321. type: "GET",
  10322. url: '/thmz/deletePrescription?clnicId=' + clnicId,
  10323. contentType: "application/json;charset=UTF-8",
  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. if (res.code == 0) {
  10332. successMesage(res);
  10333. $("#tb_table_clinic").bootstrapTable('refresh');
  10334. } else {
  10335. errorMesage(res);
  10336. }
  10337. }
  10338. });
  10339. });
  10340. $("#cancelButton").off("click").on("click", function (t) {
  10341. $("#visitingDetailModal").modal();
  10342. });
  10343. ;
  10344. }
  10345. /**
  10346. * 检查检验列表类型按钮切换事件
  10347. * @param object
  10348. */
  10349. function jcjyButtonChange(object) {
  10350. $("#jcjy_group").find("button").each(function (index, element) {
  10351. if ($(element).hasClass("btn-primary")) {
  10352. $(element).removeClass("btn-primary").addClass("btn-default");
  10353. }
  10354. });
  10355. $(object).removeClass("btn-default").addClass("btn-primary");
  10356. initJcJyTable();
  10357. }
  10358. /**
  10359. * 初始化检查检验报告列表
  10360. */
  10361. function initJcJyTable() {
  10362. clearInspectionDetail();
  10363. clearJcDetail();
  10364. var typeIndex = getIndex("jcjy_group");
  10365. if (typeIndex == 0) {
  10366. //检查
  10367. $('#tb_jy_pName_table_list').bootstrapTable("destroy");
  10368. $('#tb_jy_table_list').bootstrapTable("destroy");
  10369. initJcListTable();
  10370. $("#jy_detail").removeClass("in").addClass("hide");
  10371. $("#jc_detail").removeClass("hide").addClass("in");
  10372. } else {
  10373. $('#tb_table_list').bootstrapTable("destroy");
  10374. initJyListTable();
  10375. $("#jc_detail").removeClass("in").addClass("hide");
  10376. $("#jy_detail").removeClass("hide").addClass("in");
  10377. }
  10378. }
  10379. /**
  10380. * 初始化检查报告列表
  10381. */
  10382. function initJcListTable() {
  10383. $('#tb_table_list').bootstrapTable("destroy");
  10384. $('#tb_table_list').bootstrapTable({
  10385. url: '/thmz/getJcJyList', //请求后台的URL(*)
  10386. method: 'post', //请求方式(*)
  10387. toolbar: '#toolbar', //工具按钮用哪个容器
  10388. striped: true, //是否显示行间隔色
  10389. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  10390. pagination: true, //是否显示分页(*)
  10391. sortable: true, //是否启用排序
  10392. sortOrder: "asc", //排序方式
  10393. queryParams: queryParams, //传递参数(*)
  10394. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  10395. pageNumber: 1, //初始化加载第一页,默认第一页
  10396. pageSize: 5, //每页的记录行数(*)
  10397. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  10398. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  10399. strictSearch: true,
  10400. showColumns: false, //是否显示所有的列
  10401. showRefresh: false, //是否显示刷新按钮
  10402. minimumCountColumns: 2, //最少允许的列数
  10403. clickToSelect: true, //是否启用点击选中行
  10404. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  10405. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  10406. cardView: false, //是否显示详细视图
  10407. detailView: false,
  10408. //rowStyle:rowStyle,//通过自定义函数设置行样式
  10409. ajaxOptions: {
  10410. headers: {
  10411. 'Accept': 'application/json',
  10412. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  10413. }
  10414. },
  10415. columns: [
  10416. {
  10417. field: 'groupName',
  10418. title: '项目名称',
  10419. align: "center",
  10420. valign: 'middle',
  10421. }, {
  10422. field: 'reqDate',
  10423. title: '申请时间',
  10424. align: "center",
  10425. valign: 'middle',
  10426. formatter: function (value, row, index) {
  10427. if (value == null || value == "") {
  10428. return "";
  10429. }
  10430. return format(value, "yyyy-MM-dd HH:mm:ss");
  10431. }
  10432. }
  10433. ],
  10434. onClickRow: function (row) {
  10435. clearJcDetail();
  10436. $("#patientId_t").text(row.patientId);
  10437. $("#name_t").text(row.patientName);
  10438. $("#date_t").text(format(row.reqDate, "yyyy-MM-dd HH:mm:ss"));
  10439. fitJcDetail(row.reqNo, row.patientId);
  10440. },
  10441. responseHandler: function (res) {
  10442. if (res == '401' || res == 401) {
  10443. window.location.href = '/thmz/login/view'
  10444. return;
  10445. }
  10446. var ress = eval(res);
  10447. if (ress.code == -1) {
  10448. if (ress.message != null && ress.message != '') {
  10449. errorMesage(ress);
  10450. }
  10451. if (retryCount == 0) {
  10452. retryCount++;
  10453. $("#jyButton").click();
  10454. return;
  10455. }
  10456. return {
  10457. "total": 0,//总页数
  10458. "rows": {} //数据
  10459. };
  10460. }
  10461. if (ress.count <= 0 && retryCount == 0) {
  10462. retryCount++;
  10463. $("#jyButton").click();
  10464. return;
  10465. }
  10466. //有数据的时候,计数也需要加1,防止这时医生自己候点击检验没数据又跳回检查
  10467. retryCount++;
  10468. return {
  10469. "total": ress.count,//总页数
  10470. "rows": ress.data //数据
  10471. };
  10472. },
  10473. onLoadSuccess: function (data) {
  10474. $(".pagination-detail").css("display", "none");
  10475. }
  10476. });
  10477. }
  10478. /**
  10479. * 构建列表查询参数
  10480. * @param params
  10481. * @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}}
  10482. */
  10483. function queryParams(params) {
  10484. var patientId = $("#previewYjReqModalPatientId").val();
  10485. var times = $("#previewYjReqModalTimes").val();
  10486. return {
  10487. reqType: "3",
  10488. patientId: patientId,
  10489. times: times,
  10490. pageSize: params.limit, //页面大小
  10491. pageIndex: params.offset / params.limit //页码
  10492. };
  10493. };
  10494. /**
  10495. * 加载检查明细
  10496. * @param reqNo
  10497. */
  10498. function fitJcDetail(reqNo, patientId) {
  10499. $.ajax({
  10500. type: "GET",
  10501. url: '/thmz/getYjJcRecordReport?hisReqNo=' + reqNo + "&patientId=" + patientId,
  10502. contentType: "application/json;charset=UTF-8",
  10503. dataType: "json",
  10504. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10505. success: function (res) {
  10506. if (res == '401' || res == 401) {
  10507. window.location.href = '/thmz/login/view'
  10508. return;
  10509. }
  10510. if (res.code == 0) {
  10511. canBePrintJc = true;
  10512. $("#jy_detail").removeClass("in").addClass("hide");
  10513. $("#jc_detail").removeClass("hide").addClass("in");
  10514. var mzPatientMi = res.data.mzPatientMi;
  10515. $("#gender_jc").text(mzPatientMi.gender);
  10516. $("#age_jc").text(mzPatientMi.ageString);
  10517. var yjJcRecordReport = res.data.yjJcRecordReport;
  10518. $("#groupName").text(res.data.groupName);
  10519. $("#textJc").text(yjJcRecordReport.textJc);
  10520. $("#textZd").text(yjJcRecordReport.textZd);
  10521. var jcRecord = res.data.jcRecord;
  10522. $("#report_no").text(jcRecord.reportNo);
  10523. $("#reportId").text(jcRecord.reportId);
  10524. if (jcRecord.reportDate == null || jcRecord.reportDate == "") {
  10525. $("#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;");
  10526. } else {
  10527. $("#reportDate").text(format(jcRecord.reportDate, "yyyy-MM-dd HH:mm:ss"));
  10528. }
  10529. $("#confirmId").text(jcRecord.confirmId);
  10530. if (jcRecord.confirmDate == null || jcRecord.confirmDate == "") {
  10531. $("#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;");
  10532. } else {
  10533. $("#confirmDate").text(format(jcRecord.confirmDate, "yyyy-MM-dd HH:mm:ss"));
  10534. }
  10535. } else {
  10536. errorMesage(res);
  10537. }
  10538. }
  10539. });
  10540. }
  10541. /**
  10542. * 清空检查明细
  10543. * @param reqNo
  10544. */
  10545. function clearJcDetail() {
  10546. canBePrintJc = false;
  10547. $("#patientId_t").text("");
  10548. $("#name_t").text("");
  10549. $("#date_t").text("");
  10550. $("#gender_jc").text("");
  10551. $("#age_jc").text("");
  10552. $("#groupName").text("");
  10553. $("#textJc").text("");
  10554. $("#textZd").text("");
  10555. $("#report_no").text("");
  10556. $("#reportId").text("");
  10557. $("#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;");
  10558. $("#confirmId").text("");
  10559. $("#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;");
  10560. }
  10561. /**
  10562. * 初始化检验报告列表
  10563. */
  10564. function initJyListTable() {
  10565. var patientId = $("#previewYjReqModalPatientId").val();
  10566. var times = $("#previewYjReqModalTimes").val();
  10567. $('#tb_table_list').bootstrapTable("destroy");
  10568. $('#tb_table_list').bootstrapTable({
  10569. url: '/thmz/getJyListByPatientIdAndTimes?patientId=' + patientId + "&times=" + times, //请求后台的URL(*)
  10570. method: 'get', //请求方式(*)
  10571. toolbar: '#toolbar', //工具按钮用哪个容器
  10572. striped: true, //是否显示行间隔色
  10573. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  10574. pagination: true, //是否显示分页(*)
  10575. sortable: true, //是否启用排序
  10576. sortOrder: "asc", //排序方式
  10577. //queryParams: queryJyPNameParams, //传递参数(*)
  10578. sidePagination: "client", //分页方式:client客户端分页,server服务端分页(*)
  10579. pageNumber: 1, //初始化加载第一页,默认第一页
  10580. pageSize: 5, //每页的记录行数(*)
  10581. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  10582. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  10583. strictSearch: true,
  10584. showColumns: false, //是否显示所有的列
  10585. showRefresh: false, //是否显示刷新按钮
  10586. minimumCountColumns: 2, //最少允许的列数
  10587. clickToSelect: true, //是否启用点击选中行
  10588. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  10589. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  10590. cardView: false, //是否显示详细视图
  10591. detailView: false,
  10592. //rowStyle:rowStyle,//通过自定义函数设置行样式
  10593. ajaxOptions: {
  10594. headers: {
  10595. 'Accept': 'application/json',
  10596. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  10597. }
  10598. },
  10599. columns: [
  10600. {
  10601. field: 'aply_CTNT',
  10602. title: '检验名称',
  10603. align: "center",
  10604. valign: 'middle',
  10605. }, {
  10606. field: 'ordr_CREATE_DATE',
  10607. title: '检验时间',
  10608. align: "center",
  10609. valign: 'middle',
  10610. formatter: function (value, row, index) {
  10611. if (value == null || value == "") {
  10612. return "";
  10613. }
  10614. return format(value, "yyyy-MM-dd HH:mm:ss");
  10615. }
  10616. }
  10617. ],
  10618. onClickRow: function (row) {
  10619. queryInspectionDetail(row.ordr_ID);
  10620. },
  10621. responseHandler: function (res) {
  10622. if (res == '401' || res == 401) {
  10623. window.location.href = '/thmz/login/view'
  10624. return;
  10625. }
  10626. var ress = eval(res);
  10627. if (ress.code == -1) {
  10628. if (retryCount == 0) {
  10629. retryCount++;
  10630. $("#jcButton").click();
  10631. return;
  10632. }
  10633. if (ress.message != null && ress.message != '') {
  10634. errorMesage(ress);
  10635. }
  10636. return {
  10637. "total": ress.data.length,//总页数
  10638. "rows": ress.data //数据
  10639. };
  10640. }
  10641. if (ress.data.length <= 0 && retryCount == 0) {
  10642. retryCount++;
  10643. $("#jcButton").click();
  10644. return;
  10645. }
  10646. //有数据的时候,计数也需要加1,防止这时医生自己候点击检查没数据又跳回检验
  10647. retryCount++;
  10648. return {
  10649. "total": ress.data.length,//总页数
  10650. "rows": ress.data //数据
  10651. };
  10652. },
  10653. onLoadSuccess: function (data) {
  10654. $("#jy_table_table_div").find(".pagination-detail").css("display", "none");
  10655. }
  10656. });
  10657. }
  10658. /**
  10659. * 清空检验明细
  10660. * @param orderId
  10661. */
  10662. function clearInspectionDetail() {
  10663. canBePrintJy = false;
  10664. $("#patientId_t_jy").text("");
  10665. $("#name_t_jy").text("");
  10666. $("#gender_jy").text("");
  10667. $("#age_jy").text("");
  10668. $("#reqDept_t_jy").text("");
  10669. $("#bed_no_jy").text("");
  10670. $("#smpl_jy").text("");
  10671. $("#item_jy").text("");
  10672. $("#applyDate").text("");
  10673. $("#orderCreateDate").text("");
  10674. $("#auditTime").text("");
  10675. $("#orderUsrName").text("");
  10676. $("#testUsrName").text("");
  10677. $("#auditUsrName").text("");
  10678. $("#jyBody").html("");
  10679. }
  10680. /**
  10681. * 加载检验明细
  10682. * @param orderId
  10683. */
  10684. function queryInspectionDetail(orderId) {
  10685. clearInspectionDetail();
  10686. $.ajax({
  10687. type: "GET",
  10688. url: '/thmz/getInspectionDetail?orderId=' + orderId,
  10689. contentType: "application/json;charset=UTF-8",
  10690. dataType: "json",
  10691. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10692. success: function (res) {
  10693. if (res == '401' || res == 401) {
  10694. window.location.href = '/thmz/login/view'
  10695. return;
  10696. }
  10697. if (res.code == 0) {
  10698. canBePrintJy = true;
  10699. $("#jc_detail").removeClass("in").addClass("hide");
  10700. $("#jy_detail").removeClass("hide").addClass("in");
  10701. var mzPatientMi = res.mzPatientMi;
  10702. $("#patientId_t_jy").text(mzPatientMi.patientId);
  10703. $("#name_t_jy").text(mzPatientMi.name);
  10704. $("#gender_jy").text(mzPatientMi.gender);
  10705. $("#age_jy").text(mzPatientMi.ageString);
  10706. var html = "";
  10707. if (res.data != null) {
  10708. var inspectionHeader = res.data.inspectionHeader;
  10709. $("#reqDept_t_jy").text(inspectionHeader.dept_NAME);
  10710. $("#bed_no_jy").text(inspectionHeader.ptnt_BED_NO);
  10711. $("#smpl_jy").text(inspectionHeader.smpl_NAME);
  10712. $("#item_jy").text(inspectionHeader.aply_CNTN);
  10713. $("#applyDate").text(format(inspectionHeader.aply_DATE, "yyyy-MM-dd HH:mm:ss"));
  10714. $("#orderCreateDate").text(format(inspectionHeader.ordr_CREATE_DATE, "yyyy-MM-dd HH:mm:ss"));
  10715. $("#auditTime").text(format(inspectionHeader.audt_TIME, "yyyy-MM-dd HH:mm:ss"));
  10716. $("#orderUsrName").text(inspectionHeader.doc_NAME);
  10717. $("#testUsrName").text(inspectionHeader.test_USR_NAME);
  10718. $("#auditUsrName").text(inspectionHeader.audt_USR_NAME);
  10719. var inspectionItems = res.data.inspectionItems;
  10720. if (inspectionItems != null && inspectionItems.length > 0) {
  10721. for (var i = 0; i < inspectionItems.length; i++) {
  10722. html += "<tr>";
  10723. var obj = inspectionItems[i];
  10724. var itm_VALUE = obj.itm_VALUE;
  10725. if (itm_VALUE == null || itm_VALUE == "null") {
  10726. itm_VALUE = "";
  10727. }
  10728. itm_VALUE += (obj.itm_STR_VALUE == null || obj.itm_STR_VALUE == "null") ? "" : obj.itm_STR_VALUE;
  10729. var range = obj.range;
  10730. if (range == null || range == "null") {
  10731. range = "";
  10732. }
  10733. range += (obj.range_STR == null || obj.range_STR == "null") ? "" : obj.range_STR;
  10734. html += "<td width='25%'>" + obj.itm_NAME + "</td>";
  10735. html += "<td width='16.66%'>" + itm_VALUE + "</td>";
  10736. html += "<td width='16.66%'>" + obj.itm_UNIT + "</td>";
  10737. if (obj.itm_ALERT == null || obj.itm_ALERT == "") {
  10738. html += "<td width='16.66%'><span style=\"color:#67C23A;font-weight:bold\"></span></td>";
  10739. } else if (obj.itm_ALERT == "H") {
  10740. html += "<td width='16.66%'><span style=\"color:#F56C6C;font-weight:bold\">↑</span></td>";
  10741. } else if (obj.itm_ALERT == "L") {
  10742. html += "<td width='16.66%'><span style=\"color:#F56C6C;font-weight:bold\">↓</span></td>";
  10743. }
  10744. html += "<td width='25%'>" + range + "</td>";
  10745. html += "</tr>";
  10746. var bacteriaResults = obj.bacteriaResults;
  10747. if (bacteriaResults == null || bacteriaResults.length == 0) {
  10748. continue;
  10749. }
  10750. var bacteriaResult = bacteriaResults[0];
  10751. if (bacteriaResult == null || bacteriaResult.length == 0) {
  10752. continue;
  10753. }
  10754. var antibioticResults = bacteriaResult.antibioticResults;
  10755. if (antibioticResults == null || antibioticResults.length == 0) {
  10756. continue;
  10757. }
  10758. 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>';
  10759. for (var j = 0; j < antibioticResults.length; j++) {
  10760. var antibioticResultsObj = antibioticResults[j];
  10761. html += "<tr>";
  10762. html += "<td width='35%' style='padding-left: 2%;";
  10763. if (j == 0) {
  10764. html += "border-top: 1px solid black;";
  10765. }
  10766. html += "'>" + antibioticResultsObj.anti_NAME_CN + "</td>";
  10767. html += "<td width='20%' ";
  10768. if (j == 0) {
  10769. html += "style='border-top: 1px solid black;'";
  10770. }
  10771. html += ">" + antibioticResultsObj.anti_ABB + "</td>";
  10772. html += "<td width='25%' ";
  10773. if (j == 0) {
  10774. html += "style='border-top: 1px solid black;'";
  10775. }
  10776. html += ">" + antibioticResultsObj.anti_MIC + "</td>";
  10777. html += "<td width='20%' style='padding-right: 2%;";
  10778. if (j == 0) {
  10779. html += "border-top: 1px solid black;";
  10780. }
  10781. html += "'>" + antibioticResultsObj.anti_VALUE + "</td>";
  10782. html += "</tr>";
  10783. }
  10784. }
  10785. }
  10786. }
  10787. $("#jyBody").html(html);
  10788. } else {
  10789. errorMesage(res);
  10790. }
  10791. }
  10792. });
  10793. }
  10794. /**
  10795. * 打印检查检验报告单
  10796. * @param printType 打印模式 1 预览打印 2 打印设置
  10797. */
  10798. function printJyJcReport(printType) {
  10799. var typeIndex = getIndex("jcjy_group");
  10800. var title = "检查报告单";
  10801. if (typeIndex == 1) {
  10802. title = "检验报告单"
  10803. if (!canBePrintJy) {
  10804. warningMesageSimaple("没有任何【" + title + "】可供打印!");
  10805. return;
  10806. }
  10807. } else {
  10808. if (!canBePrintJc) {
  10809. warningMesageSimaple("没有任何【" + title + "】可供打印!");
  10810. return;
  10811. }
  10812. }
  10813. setPrint();
  10814. LODOP = getLodop();
  10815. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院" + title);
  10816. LODOP.SET_PRINT_STYLE("FontSize", 7); //字体大小
  10817. //设置默认打印机
  10818. LODOP.SET_PRINTER_INDEX(printIndex);
  10819. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  10820. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  10821. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  10822. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", title);//对新建的纸张重命名
  10823. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  10824. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  10825. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  10826. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  10827. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  10828. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  10829. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  10830. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  10831. var strStyle = "<style>table{width: 96%;} #jy_detail_content thead {border-bottom: 1px solid black;border-collapse: collapse;}</style>";
  10832. if (typeIndex == 0) {
  10833. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("jc_detail").innerHTML);
  10834. }
  10835. if (typeIndex == 1) {
  10836. LODOP.ADD_PRINT_TABLE("37mm", "5mm", "130mm", "138mm", strStyle + document.getElementById("jy_detail_content").innerHTML);
  10837. LODOP.SET_PRINT_STYLEA(0, "Vorient", 3);
  10838. LODOP.ADD_PRINT_HTM("0mm", "5mm", "130mm", "200mm", strStyle + document.getElementById("jy_detail_title").innerHTML);
  10839. LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
  10840. LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
  10841. LODOP.ADD_PRINT_HTM("177mm", "5mm", "130mm", "200mm", strStyle + document.getElementById("jy_detail_foot").innerHTML);
  10842. LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
  10843. LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
  10844. }
  10845. if (printType == 1) {
  10846. LODOP.PREVIEW();
  10847. } else if (printType == 2) {
  10848. LODOP.PRINT_SETUP();
  10849. }
  10850. }
  10851. /**
  10852. * 初始化科室下拉选
  10853. */
  10854. function initExecUnit() {
  10855. //父科室列表
  10856. $.ajax({
  10857. type: "GET",
  10858. url: '/thmz/allUnitCode',
  10859. dataType: "json",
  10860. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10861. success: function (data) {
  10862. if (data == '401' || data == 401) {
  10863. window.location.href = '/thmz/login/view'
  10864. return;
  10865. }
  10866. $('#execUnit').empty(); //清空resText里面的所有内容
  10867. $('#zlExecUnit').empty(); //清空resText里面的所有内容
  10868. var html = '';
  10869. $.each(data.data, function (commentIndex, comment) {
  10870. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + '-' + comment.code + ')</option>';
  10871. });
  10872. $('#execUnit').html(html);
  10873. $('#execUnit').selectpicker('refresh');
  10874. $('#zlExecUnit').html(html);
  10875. $('#zlExecUnit').selectpicker('refresh');
  10876. }
  10877. });
  10878. }
  10879. /**
  10880. * 初始化证件类型下拉选
  10881. */
  10882. function initCertificateTypeSelect() {
  10883. $.ajax({
  10884. type: "GET",
  10885. url: '/thmz/listCertificateType',
  10886. contentType: "application/json;charset=UTF-8",
  10887. dataType: "json",
  10888. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10889. success: function (res) {
  10890. if (res == '401' || res == 401) {
  10891. window.location.href = '/thmz/login/view'
  10892. return;
  10893. }
  10894. if (res.code == 0) {
  10895. res.data.forEach(function (item, index) {
  10896. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  10897. $('#rapidAcceptsUserCertificateType').append(html);
  10898. $('#editUserCertificateType').append(html);
  10899. });
  10900. $('#rapidAcceptsUserCertificateType').selectpicker('refresh');
  10901. $('#editUserCertificateType').selectpicker('refresh');
  10902. } else {
  10903. errorMesage(res);
  10904. }
  10905. }
  10906. });
  10907. }
  10908. /**
  10909. * 加载病历信息编辑预览
  10910. * @param patientId
  10911. * @param times
  10912. * @param type 1 编辑 2 预览
  10913. */
  10914. function showMzBlRecordModal(patientId, times, type) {
  10915. $.ajax({
  10916. type: "GET",
  10917. url: '/thmz/getMzBlrecord?patientId=' + patientId + '&times=' + times,
  10918. contentType: "application/json;charset=UTF-8",
  10919. dataType: "json",
  10920. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10921. success: function (res) {
  10922. if (res == '401' || res == 401) {
  10923. window.location.href = '/thmz/login/view'
  10924. return;
  10925. }
  10926. if (res.code == 0) {
  10927. var mzPatientMi = res.mzPatientMi;
  10928. $("#editPatientId").text(mzPatientMi.patientId);
  10929. $("#editPatientName").text(mzPatientMi.name);
  10930. $("#editPatientGender").text(mzPatientMi.gender);
  10931. $("#editPatientAge").text(mzPatientMi.ageString);
  10932. var mzBlRecord = res.mzBlRecord;
  10933. $("#editEmrChiefComplaint").val(mzBlRecord.emrChiefComplaint == null ? "" : mzBlRecord.emrChiefComplaint);
  10934. $("#editEmrHpi").val(mzBlRecord.emrHpi == null ? "" : mzBlRecord.emrHpi);
  10935. $("#editEmrPs").val(mzBlRecord.emrPs == null ? "" : mzBlRecord.emrPs);
  10936. $("#editPersonalHistory").val(mzBlRecord.personalHistory == null ? "" : mzBlRecord.personalHistory);
  10937. $("#editFamilyHistory").val(mzBlRecord.familyHistory == null ? "" : mzBlRecord.familyHistory);
  10938. $("#editObstericalHistory").val(mzBlRecord.obstericalHistory == null ? "" : mzBlRecord.obstericalHistory);
  10939. $("#editQtjc").val(mzBlRecord.emrPe == null ? "" : mzBlRecord.emrPe);
  10940. setSelectedAttr("editZd", mzBlRecord.icdCode, mzBlRecord.icdText);
  10941. var tentativeDiagnosis = mzBlRecord.tentativeDiagnosis == null ? "" : mzBlRecord.tentativeDiagnosis;
  10942. if ((mzBlRecord.icdCode == null || mzBlRecord.icdCode == "") && mzBlRecord.icdText != null && mzBlRecord.icdText != "") {
  10943. if (tentativeDiagnosis == null || tentativeDiagnosis == "") {
  10944. tentativeDiagnosis = mzBlRecord.icdText;
  10945. } else {
  10946. tentativeDiagnosis = mzBlRecord.icdText + " " + tentativeDiagnosis;
  10947. }
  10948. }
  10949. $("#edittentativeDiagnosis").val(tentativeDiagnosis);
  10950. $("#editEmrJkjy").val(mzBlRecord.emrJkjy == null ? "" : mzBlRecord.emrJkjy);
  10951. $("#bl_weight").val(mzBlRecord.weight == 0 ? null : mzBlRecord.weight);
  10952. $("#bl_temperature").val(mzBlRecord.temperature == 0 ? null : mzBlRecord.temperature);
  10953. $("#bl_sphygmus").val(mzBlRecord.sphygmus == 0 ? null : mzBlRecord.sphygmus);
  10954. $("#bl_breathe").val(mzBlRecord.breathe == 0 ? null : mzBlRecord.breathe);
  10955. $("#bl_pressure_high").val(mzBlRecord.pressureHigh == 0 ? null : mzBlRecord.pressureHigh);
  10956. $("#bl_pressure_floor").val(mzBlRecord.pressureFloor == 0 ? null : mzBlRecord.pressureFloor);
  10957. $("#bl_pressure_high_left").val(mzBlRecord.pressureHighLeft == 0 ? null : mzBlRecord.pressureHighLeft);
  10958. $("#bl_pressure_floor_left").val(mzBlRecord.pressureFloorLeft == 0 ? null : mzBlRecord.pressureFloorLeft);
  10959. if (mzBlRecord.emrProcess != null && mzBlRecord.emrProcess != "") {
  10960. var reg = new RegExp("</br>", "g");//g,表示全部替换。
  10961. var editEmrProcess = mzBlRecord.emrProcess.replace(reg, "\n");
  10962. reg = new RegExp("&nbsp;", "g");//g,表示全部替换。
  10963. editEmrProcess = editEmrProcess.replace(reg, "");
  10964. $("#editEmrProcess").val(editEmrProcess);
  10965. } else {
  10966. $("#editEmrProcess").val("");
  10967. }
  10968. if (type == 1) {
  10969. $("#mzBlRecorTitle").html("门诊病历【编辑】");
  10970. $("#setOtherEmrProcess").removeClass("in").addClass("hide");
  10971. $("#openBlRecordModel").removeClass("hide").addClass("in");
  10972. $("#setEmrProcess").removeClass("hide").addClass("in");
  10973. $("#visitingDetailModal").modal("hide");
  10974. } else if (type == 2) {
  10975. $("#mzBlRecorTitle").html("门诊病历【预览】");
  10976. $("#setOtherEmrProcess").removeClass("hide").addClass("in");
  10977. $("#openBlRecordModel").removeClass("in").addClass("hide");
  10978. $("#setEmrProcess").removeClass("in").addClass("hide");
  10979. //因为预览的时候,关闭预览框没有清空数据,且 此时基础数据的病历次数被清空
  10980. if ($("#mzBlTimes").val() != null && $("#mzBlTimes").val() != "" && ($("#baseMzBlTimes").val() == null || $("#baseMzBlTimes").val() == "")) {
  10981. $("#baseMzBlTimes").val($("#mzBlTimes").val());
  10982. }
  10983. $("#otherBlRecordModal").modal("hide");
  10984. }
  10985. $("#mzBlTimes").val(mzBlRecord.times);
  10986. $("#editMzBlRecordModal").modal();
  10987. } else {
  10988. errorMesage(res);
  10989. }
  10990. }
  10991. });
  10992. }
  10993. /**
  10994. * 清空区域
  10995. */
  10996. function clearInput() {
  10997. //编辑病历的时候,没有基础病历的就诊次数,如果是预览病历的时候,有基础病历的次数
  10998. var baseMzBlTimes = $("#baseMzBlTimes").val();
  10999. $("#editPatientId").text(null);
  11000. $("#editPatientName").text(null);
  11001. $("#editPatientGender").text(null);
  11002. $("#editPatientAge").text(null);
  11003. $("#editEmrChiefComplaint").val(null);
  11004. $("#editEmrHpi").val(null);
  11005. $("#editEmrPs").val(null);
  11006. $("#editPersonalHistory").val(null);
  11007. $("#editFamilyHistory").val(null);
  11008. $("#editObstericalHistory").val(null);
  11009. $("#bl_weight").val(null);
  11010. $("#bl_sphygmus").val(null);
  11011. $("#bl_breathe").val(null);
  11012. $("#bl_pressure_high").val(null);
  11013. $("#bl_pressure_floor").val(null);
  11014. $("#bl_pressure_high_left").val(null);
  11015. $("#bl_pressure_floor_left").val(null);
  11016. $("#editQtjc").val(null);
  11017. $("#editZd").selectpicker('val', null);
  11018. $("#editZd").selectpicker('refresh');
  11019. $("#edittentativeDiagnosis").val(null);
  11020. $("#editEmrProcess").val(null);
  11021. $("#editEmrJkjy").val(null);
  11022. $("#mzBlTimes").val(null);
  11023. if (baseMzBlTimes != null && baseMzBlTimes != "") {
  11024. $("#otherBlRecordModal").modal();
  11025. }
  11026. }
  11027. /**
  11028. * 保存门诊病历
  11029. */
  11030. function setEmrProcess() {
  11031. $("#editMzBlRecordModal").modal("hide");
  11032. $("#messageModal").modal();
  11033. $("#messageContent").html("确认修改当前门诊病历吗?");
  11034. $("#messageButton").off("click").on("click", function (t) {
  11035. $("#messageModal").modal("hide");
  11036. sendEmrProcess();
  11037. });
  11038. $("#cancelButton").off("click").on("click", function (t) {
  11039. $("#editMzBlRecordModal").modal();
  11040. });
  11041. }
  11042. /**
  11043. * 提交保存门诊病历
  11044. */
  11045. function sendEmrProcess() {
  11046. //修改告警人员
  11047. var icdCodes = $("#editZd").val();
  11048. var icdCodeStr = null;
  11049. if (icdCodes != null && icdCodes.length > 0) {
  11050. for (var i = 0; i < icdCodes.length; i++) {
  11051. if (icdCodeStr == null) {
  11052. icdCodeStr = icdCodes[i];
  11053. } else {
  11054. icdCodeStr += "," + icdCodes[i];
  11055. }
  11056. }
  11057. }
  11058. $.ajax({
  11059. type: "POST",
  11060. url: '/thmz/setEmrProcess',
  11061. contentType: "application/json;charset=UTF-8",
  11062. dataType: "json",
  11063. data: JSON.stringify({
  11064. "patientId": $("#editPatientId").text(),
  11065. "times": $("#mzBlTimes").val(),
  11066. "emrChiefComplaint": $("#editEmrChiefComplaint").val(),
  11067. "emrHpi": $("#editEmrHpi").val(),
  11068. "emrPs": $("#editEmrPs").val(),
  11069. "personalHistory": $("#editPersonalHistory").val(),
  11070. "familyHistory": $("#editFamilyHistory").val(),
  11071. "obstericalHistory": $("#editObstericalHistory").val(),
  11072. "emrPe": $("#editQtjc").val(),
  11073. "weight": $("#bl_weight").val(),
  11074. "temperature": $("#bl_temperature").val(),
  11075. "sphygmus": $("#bl_sphygmus").val(),
  11076. "breathe": $("#bl_breathe").val(),
  11077. "pressureHigh": $("#bl_pressure_high").val(),
  11078. "pressureFloor": $("#bl_pressure_floor").val(),
  11079. "pressureHighLeft": $("#bl_pressure_high_left").val(),
  11080. "pressureFloorLeft": $("#bl_pressure_floor_left").val(),
  11081. "icdCode": icdCodeStr,
  11082. "icdText": $('#editZd').next().attr("title"),
  11083. "tentativeDiagnosis": $("#edittentativeDiagnosis").val(),
  11084. "emrJkjy": $("#editEmrJkjy").val(),
  11085. "emrProcess": $("#editEmrProcess").val()
  11086. }),
  11087. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11088. success: function (res) {
  11089. if (res == '401' || res == 401) {
  11090. window.location.href = '/thmz/login/view'
  11091. return;
  11092. }
  11093. if (res.code == 0) {
  11094. clearInput();
  11095. successMesage(res);
  11096. $("#editMzBlRecordModal").modal("hide");
  11097. } else {
  11098. errorMesage(res);
  11099. }
  11100. }
  11101. });
  11102. }
  11103. /**
  11104. * 打开待合并病历列表弹框
  11105. */
  11106. function openBlRecordModel() {
  11107. $("#editMzBlRecordModal").modal("hide");
  11108. $("#otherBlRecordModal").modal();
  11109. initOtherMzBlRecordList();
  11110. }
  11111. /**
  11112. * 关闭待合并病历列表
  11113. */
  11114. function closeBlRecordModel() {
  11115. $('#baseMzBlTimes').val(null);
  11116. $("#visitingDetailModal").modal();
  11117. }
  11118. /**
  11119. * 病历列表
  11120. */
  11121. function initOtherMzBlRecordList() {
  11122. $('#other_bl_record_table').bootstrapTable("destroy");
  11123. $('#other_bl_record_table').bootstrapTable({
  11124. url: '/thmz/getMzBlRecordList', //请求后台的URL(*)
  11125. method: 'post', //请求方式(*)
  11126. toolbar: '#toolbar', //工具按钮用哪个容器
  11127. striped: true, //是否显示行间隔色
  11128. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  11129. pagination: true, //是否显示分页(*)
  11130. sortable: true, //是否启用排序
  11131. sortOrder: "desc", //排序方式
  11132. queryParams: queryOtherParams, //传递参数(*)
  11133. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  11134. pageNumber: 1, //初始化加载第一页,默认第一页
  11135. pageSize: 5, //每页的记录行数(*)
  11136. pageList: [10, 15, 25, 50, 100], //可供选择的每页的行数(*)
  11137. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  11138. strictSearch: true,
  11139. showColumns: false, //是否显示所有的列
  11140. showRefresh: false, //是否显示刷新按钮
  11141. minimumCountColumns: 2, //最少允许的列数
  11142. clickToSelect: true, //是否启用点击选中行
  11143. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  11144. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  11145. cardView: false, //是否显示详细视图
  11146. detailView: false,
  11147. //rowStyle:rowStyle,//通过自定义函数设置行样式
  11148. ajaxOptions: {
  11149. headers: {
  11150. 'Accept': 'application/json',
  11151. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  11152. }
  11153. },
  11154. columns: [
  11155. {
  11156. title: '操作',
  11157. field: 'op',
  11158. align: "center",
  11159. valign: 'middle',
  11160. formatter: function (value, row, index) {
  11161. 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>';
  11162. return [str].join('');
  11163. }
  11164. },
  11165. {
  11166. field: 'patientId',
  11167. title: '门诊ID',
  11168. align: "center",
  11169. valign: 'middle'
  11170. }, {
  11171. field: 'patientName',
  11172. title: '患者姓名',
  11173. align: "center",
  11174. valign: 'middle'
  11175. }, {
  11176. field: 'deptCode',
  11177. title: '就诊科室',
  11178. align: "center",
  11179. valign: 'middle'
  11180. }, {
  11181. field: 'doctorCode',
  11182. title: '接诊医师',
  11183. align: "center",
  11184. valign: 'middle'
  11185. }, {
  11186. field: 'firstOrNot',
  11187. title: '初/复诊',
  11188. align: "center",
  11189. valign: 'middle',
  11190. formatter: function (value, row, index) {
  11191. if (value == '1') {
  11192. return "复诊";
  11193. }
  11194. return "初诊";
  11195. }
  11196. }
  11197. , {
  11198. field: 'visitDate',
  11199. title: '就诊时间',
  11200. align: "center",
  11201. valign: 'middle',
  11202. formatter: function (value, row, index) {
  11203. if (value == null || value == "") {
  11204. return "";
  11205. }
  11206. return format(value, "yyyy-MM-dd HH:mm:ss");
  11207. }
  11208. }
  11209. ],
  11210. responseHandler: function (res) {
  11211. if (res == '401' || res == 401) {
  11212. window.location.href = '/thmz/login/view'
  11213. return;
  11214. }
  11215. var ress = eval(res);
  11216. if (ress.code == -1) {
  11217. if (ress.message != null && ress.message != '') {
  11218. errorMesage(ress);
  11219. }
  11220. return {
  11221. "total": 0,//总页数
  11222. "rows": {} //数据
  11223. };
  11224. }
  11225. return {
  11226. "total": ress.total,//总页数
  11227. "rows": ress.data //数据
  11228. };
  11229. },
  11230. });
  11231. }
  11232. /**
  11233. * 构建列表查询参数
  11234. * @param params
  11235. * @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}}
  11236. */
  11237. function queryOtherParams(params) {
  11238. var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
  11239. patientId: $("#editPatientId").text(),
  11240. exceptTimes: $("#mzBlTimes").val(),
  11241. pageSize: params.limit, //页面大小
  11242. pageIndex: params.offset / params.limit, //页码
  11243. };
  11244. return temp;
  11245. }
  11246. /**
  11247. * 提取处理意见保存
  11248. */
  11249. function setOtherEmrProcess() {
  11250. $("#editMzBlRecordModal").modal("hide");
  11251. $("#messageModal").modal();
  11252. $("#messageContent").html("确定要执行此次提取处理意见操作吗?");
  11253. $("#messageButton").off("click").on("click", function (t) {
  11254. $("#messageModal").modal("hide");
  11255. $.ajax({
  11256. type: "GET",
  11257. url: '/thmz/extractEmrProcess?patientId=' + $("#editPatientId").html() + '&baseTimes=' + $("#baseMzBlTimes").val() + '&times=' + $("#mzBlTimes").val(),
  11258. contentType: "application/json;charset=UTF-8",
  11259. dataType: "json",
  11260. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11261. success: function (res) {
  11262. if (res == '401' || res == 401) {
  11263. window.location.href = '/thmz/login/view'
  11264. return;
  11265. }
  11266. if (res.code == 0) {
  11267. successMesage(res);
  11268. $("#editMzBlRecordModal").modal("hide");
  11269. } else {
  11270. errorMesage(res);
  11271. }
  11272. }
  11273. });
  11274. });
  11275. $("#cancelButton").off("click").on("click", function (t) {
  11276. $("#editMzBlRecordModal").modal();
  11277. });
  11278. }
  11279. /**
  11280. * 医保电子凭证读卡
  11281. */
  11282. function siReadCard() {
  11283. $.ajax({
  11284. type: "GET",
  11285. url: 'http://localhost:8321/readcard/entry?param=qrcode_01101',
  11286. contentType: "application/json;charset=UTF-8",
  11287. dataType: "json",
  11288. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11289. success: function (res) {
  11290. if (res == '401' || res == 401) {
  11291. window.location.href = '/thmz/login/view'
  11292. return;
  11293. }
  11294. //console.log(res);
  11295. if (res.code == 200) {
  11296. var data = JSON.parse(res.data);
  11297. queryUserInfoBySocialNoNotFillPatient('rapidAcceptsUserCardNo', "" + data.data.idNo + "", queryUserInfoByCardNo, 'rapidAcceptsModal');
  11298. } else {
  11299. errorMesage(res);
  11300. }
  11301. }
  11302. });
  11303. // window.open('ReadCard://'+prm, '_self')
  11304. }
  11305. /**
  11306. * 西药品类按钮点击事件 因为原插件有点未解决bug,点击title的时候,加载的列表非对应的,
  11307. * @param paneId
  11308. */
  11309. function xyTableOnClick(paneId) {
  11310. setTimeout(function () {
  11311. $("#xyTabContent div.tab-pane").each(function (index, obj) {
  11312. var targetId = $(obj).attr("id");
  11313. //如果处方内容是空的,就删除没有处方
  11314. if ($(obj).find("div.cf_content").children().length == 0) {
  11315. $(obj).remove();
  11316. $("[href='#" + targetId + "']").parent().remove();
  11317. } else if (targetId == paneId) {
  11318. $(obj).addClass("active").addClass("in");
  11319. } else {
  11320. $(obj).removeClass("active").removeClass("in");
  11321. }
  11322. });
  11323. }, 400);
  11324. }
  11325. /**
  11326. * 打开转诊弹层
  11327. */
  11328. function transferTreatment() {
  11329. $("#turnDept").selectpicker({
  11330. size: 5
  11331. });
  11332. $("#turnToConsultationTitle").html("转诊");
  11333. $("#opType").val(1);
  11334. $("#turnToConsultationDoctorDiv").removeClass("hide").addClass("in");
  11335. $("#turnDeptDiv").removeClass("hide").addClass("in");
  11336. $("#consultationDeptDiv").removeClass("in").addClass("hide");
  11337. //科室列表
  11338. $.ajax({
  11339. type: "GET",
  11340. url: '/thmz/getUnitCodeByRequestDay?ampm=',
  11341. dataType: "json",
  11342. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11343. success: function (data) {
  11344. if (data == '401' || data == 401) {
  11345. window.location.href = '/thmz/login/view'
  11346. return;
  11347. }
  11348. var html = '';
  11349. $.each(data.data, function (commentIndex, comment) {
  11350. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';
  11351. });
  11352. $('#turnDept').empty();
  11353. $('#turnDept').html(html);
  11354. $('#turnDept').selectpicker('refresh');
  11355. }
  11356. });
  11357. $("#turnToConsultationModal").modal();
  11358. }
  11359. /**
  11360. * 打开会诊弹层
  11361. */
  11362. function consultation() {
  11363. $("#consultationDept").selectpicker({
  11364. size: 5
  11365. });
  11366. $("#turnToConsultationTitle").html("发起会诊");
  11367. $("#opType").val(2);
  11368. $("#turnToConsultationDoctorDiv").removeClass("in").addClass("hide");
  11369. $("#consultationDeptDiv").removeClass("hide").addClass("in");
  11370. $("#turnDeptDiv").removeClass("in").addClass("hide");
  11371. //科室列表
  11372. $.ajax({
  11373. type: "GET",
  11374. url: '/thmz/allMzUnitCode',
  11375. dataType: "json",
  11376. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11377. success: function (res) {
  11378. if (res == '401' || res == 401) {
  11379. window.location.href = '/thmz/login/view'
  11380. return;
  11381. }
  11382. var html = '';
  11383. $.each(res.data, function (commentIndex, comment) {
  11384. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';
  11385. });
  11386. $('#consultationDept').empty();
  11387. $('#consultationDept').html(html);
  11388. $('#consultationDept').selectpicker('refresh');
  11389. $.ajax({
  11390. type: "GET",
  11391. url: '/thmz/getUnConsultation?serialNo=' + $("#mzfzSerialNoInClick").val(),
  11392. dataType: "json",
  11393. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11394. success: function (res) {
  11395. if (res == '401' || res == 401) {
  11396. window.location.href = '/thmz/login/view'
  11397. return;
  11398. }
  11399. var data = res.data;
  11400. if (data != null && data.length > 0) {
  11401. $('#consultationDept').selectpicker('val', data);
  11402. $('#consultationDept').selectpicker('refresh');
  11403. }
  11404. }
  11405. });
  11406. }
  11407. });
  11408. $("#turnToConsultationModal").modal();
  11409. }
  11410. /**
  11411. * 清空转诊和发起会诊区域
  11412. */
  11413. function clearTurnToConsultationInput() {
  11414. $("#turnDept").selectpicker('val', null);
  11415. $("#turnDept").selectpicker('refresh');
  11416. $("#consultationDept").selectpicker('val', null);
  11417. $("#consultationDept").selectpicker('refresh');
  11418. $("#turnToConsultationDoctor").selectpicker('val', null);
  11419. $("#turnToConsultationDoctor").selectpicker('refresh');
  11420. $("#turnToConsultationId").val(null);
  11421. $("#opType").val(null);
  11422. $("#turnToConsultationDoctorDiv").removeClass("in").addClass("hide");
  11423. $("#turnDeptDiv").removeClass("in").addClass("hide");
  11424. $("#consultationDeptDiv").removeClass("in").addClass("hide");
  11425. }
  11426. /**
  11427. * 清空门诊统筹额外内容区域
  11428. */
  11429. function clearExpContentRequired() {
  11430. $("#mdtrtGrpType").selectpicker('val', null);
  11431. $("#mdtrtGrpType").selectpicker('refresh');
  11432. $("#trumFlag").selectpicker('val', null);
  11433. $("#trumFlag").selectpicker('refresh');
  11434. $("#relTtpFlag").selectpicker('val', null);
  11435. $("#relTtpFlag").selectpicker('refresh');
  11436. $("#otpErReflFlag").selectpicker('val', null);
  11437. $("#otpErReflFlag").selectpicker('refresh');
  11438. }
  11439. /**
  11440. * 清空门诊统筹支付参数区域
  11441. */
  11442. function clearZgtczfInput() {
  11443. $("#zgmztczfDiv").removeClass("in").addClass("hide");
  11444. $("#mztczfSiReadCard").removeClass("in").addClass("hide");
  11445. $("#expContentRequired").removeClass("in").addClass("hide");
  11446. $("#grzhzfDiv").removeClass("in").addClass("hide");
  11447. $("#zgmztczf").selectpicker('val', null);
  11448. $("#zgmztczf").selectpicker('refresh');
  11449. $("#grzhzf").selectpicker('val', null);
  11450. $("#grzhzf").selectpicker('refresh');
  11451. $("#readCardResult").val(null);
  11452. }
  11453. /**
  11454. * 保存转诊/会诊
  11455. */
  11456. function setTurnToConsultation() {
  11457. $("#turnToConsultationModal").modal("hide");
  11458. $("#messageModal").modal();
  11459. var opType = $("#opType").val();
  11460. var targetDeptNo = $("#turnDept").val();
  11461. var title = "确认提交转诊操作吗,提交后您将无法继续接诊该患者?";
  11462. if (opType == 2 || opType == "2") {
  11463. title = "确认提交本次会诊操作吗?";
  11464. var consultationDept = $("#consultationDept").val();
  11465. if (consultationDept != null && consultationDept.length > 0) {
  11466. targetDeptNo = null;
  11467. for (var i = 0; i < consultationDept.length; i++) {
  11468. if (targetDeptNo == null) {
  11469. targetDeptNo = consultationDept[i];
  11470. } else {
  11471. targetDeptNo += "," + consultationDept[i];
  11472. }
  11473. }
  11474. }
  11475. }
  11476. $("#messageContent").html(title);
  11477. $("#messageButton").off("click").on("click", function (t) {
  11478. $("#messageModal").modal("hide");
  11479. $.ajax({
  11480. type: "POST",
  11481. url: '/thmz/saveTurnToConsultation',
  11482. contentType: "application/json;charset=UTF-8",
  11483. dataType: "json",
  11484. data: JSON.stringify({
  11485. "id": $("#turnToConsultationId").val(),
  11486. "opType": opType,
  11487. "targetDeptNo": targetDeptNo,
  11488. "targetDoctorNo": $("#turnToConsultationDoctor").val(),
  11489. "serialNo": $("#mzfzSerialNoInClick").val(),
  11490. "remark": $("#turnToConsultationRemark").val(),
  11491. }),
  11492. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11493. success: function (res) {
  11494. if (res == '401' || res == 401) {
  11495. window.location.href = '/thmz/login/view'
  11496. return;
  11497. }
  11498. if (res.code == 0) {
  11499. successMesage(res);
  11500. clearTurnToConsultationInput();
  11501. if (opType == 1 || opType == "1") {
  11502. //加载候诊患者列表
  11503. loadUnClinicTableList();
  11504. //加载接诊中患者列表
  11505. loadInClinicTableList();
  11506. clearWorkSpace();
  11507. }
  11508. } else {
  11509. $("#turnToConsultationModal").modal();
  11510. errorMesage(res);
  11511. }
  11512. }
  11513. });
  11514. });
  11515. $("#cancelButton").off("click");
  11516. }
  11517. /**
  11518. * 初始医生下拉选
  11519. * @param ampm 时间段区间
  11520. */
  11521. function initEmployee() {
  11522. var opType = $("#opType").val();
  11523. if (opType == 2) {
  11524. return;
  11525. }
  11526. $("#turnToConsultationDoctor").selectpicker({
  11527. size: 5
  11528. });
  11529. //医生列表
  11530. $.ajax({
  11531. type: "GET",
  11532. url: '/thmz/getDoctorCodeByRequestDay?unitCode=' + $('#turnDept').val() + "&ampm=&chargeType=",
  11533. dataType: "json",
  11534. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11535. success: function (res) {
  11536. if (res == '401' || res == 401) {
  11537. window.location.href = '/thmz/login/view'
  11538. return;
  11539. }
  11540. var html = '';
  11541. var defaultCode = null;
  11542. $.each(res.data, function (commentIndex, comment) {
  11543. var employeeName = comment.employee.employeeName;
  11544. if (comment.leftNum != null) {
  11545. employeeName = employeeName + " 余号(" + comment.leftNum + ")"
  11546. }
  11547. html += '<option value="' + comment.employee.employeeCode + '" data-chargeType="' + comment.chargeType + '" data-checkFee="' + comment.checkFee + '" data-mzyRequestId="' + comment.mzyRequestId + '">' + employeeName + '</option>';
  11548. if (res.data.length == 1) {
  11549. //如果只有一个号别,默认选中
  11550. defaultCode = comment.employee.employeeCode;
  11551. }
  11552. });
  11553. $('#turnToConsultationDoctor').empty();
  11554. $('#turnToConsultationDoctor').html(html);
  11555. $('#turnToConsultationDoctor').selectpicker('refresh');
  11556. if (defaultCode != null) {
  11557. //如果有无需选择医生的选项,默认选择
  11558. $('#turnToConsultationDoctor').selectpicker('val', defaultCode);
  11559. $('#turnToConsultationDoctor').selectpicker('refresh');
  11560. }
  11561. }
  11562. });
  11563. }
  11564. /**
  11565. * 选择门诊统筹支付时校验门诊诊断是否是标准诊断,校验医生是否具有医保编码
  11566. */
  11567. function verifyInsuranceInfo() {
  11568. var zgmztczf = $("#zgmztczf").val();
  11569. if (zgmztczf != null && (zgmztczf == 1 || zgmztczf == "1")) {
  11570. var diagnoseValue = $("#diagnoseValue").val();
  11571. if (diagnoseValue == null || diagnoseValue == "" || diagnoseValue.length == 0) {
  11572. errorMesageSimaple("门诊统筹就诊必须使用标准的医保诊断,请修改诊断或者消门诊统筹选项");
  11573. // $("#zgmztczf").selectpicker('val', null);
  11574. // $("#zgmztczf").selectpicker('refresh');
  11575. return false;
  11576. }
  11577. diagnoseValue = diagnoseValue.replace(/,/g, "");
  11578. if (diagnoseValue == null || diagnoseValue == "" || diagnoseValue.length == 0) {
  11579. errorMesageSimaple("门诊统筹就诊必须使用标准的医保诊断,请修改诊断或者消门诊统筹选项");
  11580. // $("#zgmztczf").selectpicker('val', null);
  11581. // $("#zgmztczf").selectpicker('refresh');
  11582. return false;
  11583. }
  11584. var ybCode = localStorage.getItem("ybCode");
  11585. if (ybCode == null || ybCode == "" || ybCode.length == 0) {
  11586. errorMesageSimaple("您还没有医保赋码,无法进行门诊统筹接诊,请取消门诊统筹选项");
  11587. // $("#zgmztczf").selectpicker('val', null);
  11588. // $("#zgmztczf").selectpicker('refresh');
  11589. return false;
  11590. }
  11591. }
  11592. return true;
  11593. }
  11594. /**
  11595. * 已诊列表发起会诊
  11596. * @param patientId
  11597. */
  11598. function consultationCliniced(patientId) {
  11599. $.ajax({
  11600. type: "GET",
  11601. url: '/thmz/getLastClinicedFzOrder?patientId=' + patientId,
  11602. dataType: "json",
  11603. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11604. success: function (res) {
  11605. if (res == '401' || res == 401) {
  11606. window.location.href = '/thmz/login/view'
  11607. return;
  11608. }
  11609. if (res.code == 0) {
  11610. $("#visitingDetailModal").modal("hide");
  11611. $("#mzfzSerialNoInClick").val(res.data.serialNo);
  11612. consultation();
  11613. } else {
  11614. errorMesage(res);
  11615. }
  11616. }
  11617. });
  11618. }
  11619. /**
  11620. * 计算诊疗金额
  11621. * @param flag true ,直接计算总价, false 还要计算总量
  11622. */
  11623. function calculateZl(flag) {
  11624. if (!flag) {
  11625. var itemQuantity = $("#itemQuantity").val();
  11626. if (itemQuantity == null) {
  11627. return;
  11628. }
  11629. var dayZlNum = $("#dayZlNum").val();
  11630. if (dayZlNum == null) {
  11631. return;
  11632. }
  11633. //频率
  11634. var times = $('#orderFrequencyZl').find("option:selected").attr('desc');
  11635. if (times == null) {
  11636. return;
  11637. }
  11638. var totalNumZl = Multiply(Multiply(itemQuantity, dayZlNum), times);
  11639. $("#totalNumZl").val(totalNumZl);
  11640. }
  11641. //总量
  11642. var totalNumZl = $("#totalNumZl").val();
  11643. if (totalNumZl == null) {
  11644. return;
  11645. }
  11646. //单价
  11647. var zlItemPrice = $("#zlItemPrice").val();
  11648. if (zlItemPrice == null) {
  11649. return;
  11650. }
  11651. $("#totalAmountZl").val(Multiply(totalNumZl, zlItemPrice).toFixed(2));
  11652. }
  11653. /**
  11654. *打印外伤无第三方责任承诺书
  11655. */
  11656. function printNoThirdParty() {
  11657. printNoThirdPartyCommon(1);
  11658. }
  11659. /**
  11660. * 打印外伤无第三方责任承诺书
  11661. * @param printType 打印模式 1 预览打印 2 打印设置
  11662. */
  11663. function printNoThirdPartyCommon(printType) {
  11664. warningMesageSimaple("请提醒患者至医保窗口审核,审核通过方能报销!");
  11665. var title = "外伤无第三方责任承诺书";
  11666. setPrint();
  11667. LODOP = getLodop();
  11668. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院" + title);
  11669. LODOP.SET_PRINT_STYLE("FontSize", 7); //字体大小
  11670. //设置默认打印机
  11671. LODOP.SET_PRINTER_INDEX(printIndex);
  11672. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  11673. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  11674. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  11675. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", title);//对新建的纸张重命名
  11676. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  11677. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  11678. // var strStyle = "<style>table{width: 96%;}</style>";
  11679. var strStyle = "<style>table{width: 96%;margin-top: 20px;margin-bottom: 10px;} table,th {border-width: 1px;border-style: solid;border-collapse: collapse}</style>";
  11680. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("print_no_third_party_table").innerHTML);
  11681. if (printType == 1) {
  11682. LODOP.PREVIEW();
  11683. } else if (printType == 2) {
  11684. LODOP.PRINT_SETUP();
  11685. }
  11686. }
  11687. /**
  11688. * 打印自费承诺书
  11689. */
  11690. function printSelfPay() {
  11691. printSelfPayCommon(1);
  11692. }
  11693. /**
  11694. * 打印自费承诺书
  11695. * @param printType 打印模式 1 预览打印 2 打印设置
  11696. */
  11697. function printSelfPayCommon(printType) {
  11698. var title = "参保人员门诊统筹医保支付告知审核表";
  11699. setPrint();
  11700. LODOP = getLodop();
  11701. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院" + title);
  11702. LODOP.SET_PRINT_STYLE("FontSize", 7); //字体大小
  11703. //设置默认打印机
  11704. LODOP.SET_PRINTER_INDEX(printIndex);
  11705. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  11706. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  11707. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  11708. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", title);//对新建的纸张重命名
  11709. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  11710. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  11711. // var strStyle = "<style>table{width: 96%;}</style>";
  11712. //table,th {border-width: 1px;border-style: solid;border-collapse: collapse}
  11713. var strStyle = "<style>table{width: 96%;margin-top: 20px;margin-bottom: 10px;} </style>";
  11714. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("self_pay_table").innerHTML);
  11715. if (printType == 1) {
  11716. LODOP.PREVIEW();
  11717. } else if (printType == 2) {
  11718. LODOP.PRINT_SETUP();
  11719. }
  11720. }
  11721. /**
  11722. * 将科室缓存到内存中
  11723. */
  11724. function saveDeptConfig() {
  11725. var clinicDeptNo = $("#clinicDeptNo").val();
  11726. if (clinicDeptNo != null && clinicDeptNo != "") {
  11727. var userIdCode = localStorage.getItem("userIdCode");
  11728. localStorage.setItem(userIdCode, clinicDeptNo);
  11729. }
  11730. $("#selectDeptModal").modal("hide");
  11731. }
  11732. /**
  11733. * 合理用药药品说明书
  11734. */
  11735. function hlyyypsms() {
  11736. $("#western_medicine_name").webuiPopover('hide');
  11737. var code = $("#western_medicine_current_code").val();
  11738. var serial = $("#western_medicine_current_serial").val();
  11739. $("#hlyyTitle").html("药品说明书");
  11740. showHlyyModel('hlyysmsDiv', 'hlyysmsLoading', 'hlyysmsModal', "http://172.16.32.121:9097/web/sms/hpms_medi_show.aspx?his_code=" + code + "_" + serial);
  11741. }
  11742. /**
  11743. * 预约挂号
  11744. * @param patientId
  11745. */
  11746. function registration(patientId) {
  11747. clearRegistrationModal();
  11748. $("#patientIdRegistration").val(patientId);
  11749. $("#visitingDetailModal").modal('hide');
  11750. $("#registrationModal").modal();
  11751. }
  11752. /**
  11753. * 初始门诊时间区间下拉选
  11754. */
  11755. function initMzWorkTime() {
  11756. $("#ampm").selectpicker({
  11757. size: 10
  11758. });
  11759. $.ajax({
  11760. type: "GET",
  11761. url: '/thmz/getMzWorkTime',
  11762. dataType: "json",
  11763. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11764. success: function (res) {
  11765. if (res == '401' || res == 401) {
  11766. window.location.href = '/thmz/login/view'
  11767. return;
  11768. }
  11769. var html = '';
  11770. var ampm = null;
  11771. $.each(res.data, function (commentIndex, comment) {
  11772. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  11773. if (ampm == null || (ampm != "a" && ampm != "p")) {
  11774. var startTime = paseToFullTime(comment.startTime);
  11775. var endTime = paseToFullTime(comment.endTime);
  11776. if (range(startTime, endTime)) {
  11777. ampm = comment.code;
  11778. }
  11779. }
  11780. });
  11781. $('#ampm').empty(); //清空resText里面的所有内容
  11782. $('#ampm').html(html);
  11783. $('#ampm').selectpicker('refresh');
  11784. $("#ampm").selectpicker('val', ampm);
  11785. $('#ampm').selectpicker('refresh');
  11786. initDeptPlus();
  11787. }
  11788. });
  11789. }
  11790. /**
  11791. * 初始科室下拉选
  11792. * @param ampm 时间段区间
  11793. */
  11794. function initDeptPlus() {
  11795. $("#deptNo").selectpicker({
  11796. size: 10
  11797. });
  11798. //科室列表
  11799. $.ajax({
  11800. type: "GET",
  11801. url: '/thmz/getUnitCodeByRequestDayAndAmpm?ampm=' + $("#ampm").val()+'&date='+$("#registrationTime").val(),
  11802. dataType: "json",
  11803. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11804. success: function (data) {
  11805. if (data == '401' || data == 401) {
  11806. window.location.href = '/thmz/login/view'
  11807. return;
  11808. }
  11809. var html = '';
  11810. $.each(data.data, function (commentIndex, comment) {
  11811. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';
  11812. });
  11813. $('#deptNo').empty();
  11814. $('#deptNo').html(html);
  11815. $('#deptNo').selectpicker('refresh');
  11816. $('#chargeType').empty();
  11817. $('#chargeType').selectpicker('refresh');
  11818. emptyInput();
  11819. }
  11820. });
  11821. }
  11822. /**
  11823. * 初始门诊号别下拉选
  11824. */
  11825. function initChargeType() {
  11826. $.ajax({
  11827. type: "GET",
  11828. url: '/thmz/getChargeTypeByRequestDayAndDoctor?unitCode=' + $('#deptNo').val() + "&ampm=" + $("#ampm").val()+'&date='+$("#registrationTime").val(),
  11829. dataType: "json",
  11830. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11831. success: function (res) {
  11832. if (res == '401' || res == 401) {
  11833. window.location.href = '/thmz/login/view'
  11834. return;
  11835. }
  11836. var html = '';
  11837. var defaultCode = null;
  11838. $.each(res.data, function (commentIndex, comment) {
  11839. if (res.data.length == 1) {
  11840. //如果只有一个号别,默认选中
  11841. defaultCode = comment.code;
  11842. }
  11843. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  11844. });
  11845. $('#chargeType').empty(); //清空resText里面的所有内容
  11846. $('#chargeType').html(html);
  11847. $('#chargeType').selectpicker('refresh');
  11848. if (defaultCode != null) {
  11849. //如果有默认选项,默认选择
  11850. $('#chargeType').selectpicker('val', defaultCode);
  11851. $('#chargeType').selectpicker('refresh');
  11852. initDoctorInfo();
  11853. }
  11854. emptyInput();
  11855. }
  11856. });
  11857. }
  11858. /**
  11859. * 初始医生下拉选
  11860. * @param ampm 时间段区间
  11861. */
  11862. function initDoctorInfo() {
  11863. $("#doctorInfo").selectpicker({
  11864. size: 10
  11865. });
  11866. //医生列表
  11867. $.ajax({
  11868. type: "GET",
  11869. url: '/thmz/getDoctorCodeByRequestDayAndDoctor?unitCode=' + $('#deptNo').val() + "&ampm=" + $("#ampm").val() + "&chargeType=" + $("#chargeType").val()+'&date='+$("#registrationTime").val(),
  11870. dataType: "json",
  11871. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11872. success: function (res) {
  11873. if (res == '401' || res == 401) {
  11874. window.location.href = '/thmz/login/view'
  11875. return;
  11876. }
  11877. var html = '';
  11878. var defaultCode = null;
  11879. $.each(res.data, function (commentIndex, comment) {
  11880. var employeeName = comment.employee.employeeName;
  11881. if (comment.leftNum != null) {
  11882. employeeName = employeeName + " 余号(" + comment.leftNum + ")"
  11883. }
  11884. html += '<option value="' + comment.employee.employeeCode + '" data-chargeType="' + comment.chargeType + '" data-checkFee="' + comment.checkFee + '" data-mzyRequestId="' + comment.mzyRequestId + '">' + employeeName + '</option>';
  11885. if (res.data.length == 1) {
  11886. //如果只有一个号别,默认选中
  11887. defaultCode = comment.employee.employeeCode;
  11888. }
  11889. });
  11890. $('#doctorInfo').empty();
  11891. $('#doctorInfo').html(html);
  11892. $('#doctorInfo').selectpicker('refresh');
  11893. //validator.checkAll($("#regi_form"));
  11894. if (defaultCode != null) {
  11895. //如果有无需选择医生的选项,默认选择
  11896. $('#doctorInfo').selectpicker('val', defaultCode);
  11897. $('#doctorInfo').selectpicker('refresh');
  11898. fitFee();
  11899. }
  11900. }
  11901. });
  11902. }
  11903. /**
  11904. * 设置挂号费等费用
  11905. */
  11906. function fitFee() {
  11907. var mzyRequestId = $('#doctorInfo').find("option:selected").attr('data-mzyRequestId');
  11908. var checkFee = $('#doctorInfo').find("option:selected").attr('data-checkFee');
  11909. $("#checkFee").val(checkFee);
  11910. $("#totalFee").val(checkFee);
  11911. $.ajax({
  11912. type: "GET",
  11913. url: '/thmz/getMzChargeTypeByMzyRequestId?mzyRequestId=' + mzyRequestId + "&birthDay=&patientId="+$("#patientIdRegistration").val(),
  11914. dataType: "json",
  11915. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11916. success: function (res) {
  11917. if (res == '401' || res == 401) {
  11918. window.location.href = '/thmz/login/view'
  11919. return;
  11920. }
  11921. $("#registrationFee").val(res.data.reqFee);
  11922. $("#hospitalFee").val(res.data.clinicFee);
  11923. $("#othFee").val(parseFloat(res.data.othFee) - parseFloat(checkFee));
  11924. checkFee = parseFloat(res.data.reqFee) + parseFloat(res.data.clinicFee) + parseFloat(res.data.othFee);
  11925. $("#totalFee").val(checkFee);
  11926. }
  11927. });
  11928. }
  11929. /**
  11930. * 科室与时间区间下拉选改变时清空输入框内容
  11931. */
  11932. function emptyInput() {
  11933. $('#doctorInfo').empty();
  11934. $('#doctorInfo').selectpicker('refresh');
  11935. $("#registrationFee").val(0.00);
  11936. $("#hospitalFee").val(0.00);
  11937. $("#checkFee").val(0.00);
  11938. $("#othFee").val(0.00);
  11939. $("#totalFee").val(0.00);
  11940. }
  11941. /**
  11942. * 科室与时间区间下拉选改变时清空输入框内容
  11943. */
  11944. function clearRegistrationModal() {
  11945. $("#patientIdRegistration").val(null);
  11946. $("#registrationTime").val(null);
  11947. $('#ampm').selectpicker('val', null);
  11948. $('#ampm').selectpicker('refresh');
  11949. $('#deptNo').empty();
  11950. $('#deptNo').selectpicker('refresh');
  11951. $('#chargeType').empty();
  11952. $('#chargeType').selectpicker('refresh');
  11953. $('#doctorInfo').empty();
  11954. $('#doctorInfo').selectpicker('refresh');
  11955. $("#registrationFee").val(0.00);
  11956. $("#hospitalFee").val(0.00);
  11957. $("#checkFee").val(0.00);
  11958. $("#othFee").val(0.00);
  11959. $("#totalFee").val(0.00);
  11960. }
  11961. /**
  11962. * 保存挂号信息
  11963. */
  11964. function saveMzyReqrecUnPay() {
  11965. $("#registrationModal").modal('hide');
  11966. $("#messageModal").modal();
  11967. $("#messageContent").html("确定提交本次预约挂号申请吗?");
  11968. $("#messageButton").off("click").bind("click", function (t) {
  11969. $("#messageModal").modal('hide');
  11970. realSaveMzyReqrecUnPay();
  11971. });
  11972. $("#cancelButton").off("click").bind("click", function (t) {
  11973. $("#messageModal").modal('hide');
  11974. $("#registrationModal").modal();
  11975. });
  11976. }
  11977. /**
  11978. * 保存挂号信息
  11979. */
  11980. function realSaveMzyReqrecUnPay() {
  11981. $("#saveRegistration").attr("disabled", true);
  11982. var mzyRequestId = $('#doctorInfo').find("option:selected").attr('data-mzyRequestId');
  11983. var patientId = $("#patientIdRegistration").val();
  11984. var totalFee = $("#totalFee").val();
  11985. $.ajax({
  11986. type: "POST",
  11987. url: '/thmz/saveMzyReqrec',
  11988. contentType: "application/json;charset=UTF-8",
  11989. dataType: "json",
  11990. data: JSON.stringify({
  11991. "mzyReqrec": {
  11992. "patientId": patientId,
  11993. "ampm": $("#ampm").val(),
  11994. "unitCode": $("#deptNo").val(),
  11995. "chargeType": $("#chargeType").val(),
  11996. "requestDayStr":$("#registrationTime").val()
  11997. }, "mzyRequestId": mzyRequestId, "totalFee": totalFee,"payMark":"5"
  11998. }),
  11999. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  12000. success: function (res) {
  12001. if (res == '401' || res == 401) {
  12002. window.location.href = '/thmz/login/view'
  12003. return;
  12004. }
  12005. if (res.code == 0) {
  12006. successMesage(res);
  12007. clearRegistrationModal();
  12008. $("#registrationModal").modal('hide');
  12009. } else {
  12010. errorMesage(res);
  12011. }
  12012. $("#saveRegistration").attr("disabled", false);
  12013. }
  12014. });
  12015. }