clinic.js 612 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193
  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. var ksjzType = null;
  30. $(function () {
  31. initCopy();
  32. initMzOrderTypeSelect();
  33. initGenderSelect();
  34. iniAdmissStatus();
  35. initListDeptSelect();
  36. //initTryResultSelect();
  37. initResponceTypeSelect();
  38. initTemplateTypeSelect("templateType");
  39. initTemplateKindTypeSelect('templateKindType');
  40. initZyClassTypeSelect();
  41. initInstructionSelect();
  42. initSelectWithParams();
  43. initCertificateTypeSelect();
  44. initMztcSelect();
  45. initMzssSelect();
  46. //setSelectSize();
  47. $('#editUserBirthDayGroup').datetimepicker({
  48. format: 'yyyy-mm-dd',
  49. language: 'zh-CN',
  50. minView: "month",
  51. });
  52. initDaterangepickerWithId('reportrange', "right");
  53. formatCheck();
  54. //数据校验
  55. init_validator();
  56. //初始频次下拉选
  57. initOrderFrequencys("orderFrequency", true);
  58. //初始频次下拉选
  59. initOrderFrequencys("orderFrequencyZl", true);
  60. //初始用药方式下拉选
  61. initSupplyTypes();
  62. initAdvmPro('visitAdvmPro');
  63. //加载候诊患者列表
  64. loadUnClinicTableList();
  65. //加载接诊中患者列表
  66. loadInClinicTableList();
  67. //加载已接诊患者列表
  68. loadClinicTableList();
  69. //每隔一分钟秒读加载候诊患者列表
  70. refreshList();
  71. // setInterval(function () {
  72. // //加载候诊患者列表
  73. // loadUnClinicTableList();
  74. // //加载已接诊患者列表 病人会缴费,需要刷新状态
  75. // loadClinicTableList();
  76. // }, 60000);
  77. //初始化快速接诊病人姓名栏事件
  78. initUserList();
  79. //初始化主诉弹出层
  80. initRecommendList();
  81. //卡号输入改变事件
  82. cardNoChange();
  83. //初始化省份
  84. initProvince(3);
  85. //初始化省份
  86. initProvince(5);
  87. /**
  88. * 患者信息修改
  89. */
  90. $("#saveEditUser").on("click", function (t) {
  91. modifyPatient();
  92. });
  93. // /**
  94. // * 保存入院证
  95. // */
  96. // $("#saveBeHospitalized").on("click", function (t) {
  97. // saveBeHospitalized();
  98. // });
  99. /**
  100. * 打印入院证
  101. */
  102. $("#printBeHospitalized").on("click", function (t) {
  103. modifyPatient();
  104. });
  105. //折叠按钮初始化
  106. $('.collapse-link').on('click', function () {
  107. var $BOX_PANEL = $(this).closest('.x_panel_mine'),
  108. $ICON = $(this).find('i'),
  109. $BOX_CONTENT = $BOX_PANEL.find('.x_content');
  110. // fix for some div with hardcoded fix class
  111. if ($BOX_PANEL.attr('style')) {
  112. $BOX_CONTENT.slideToggle(200, function () {
  113. $BOX_PANEL.removeAttr('style');
  114. });
  115. } else {
  116. $BOX_CONTENT.slideToggle(200);
  117. $BOX_PANEL.css('height', 'auto');
  118. }
  119. $ICON.toggleClass('fa-chevron-up fa-chevron-down');
  120. });
  121. /**
  122. * 接诊
  123. */
  124. $("#clinicalReception").on("click", function (t) {
  125. var patientIdDb = $("#patientIdDb").val();
  126. if (patientIdDb == null || patientIdDb == "") {
  127. errorMesageSimaple("当前未选择病人,无法接诊");
  128. return;
  129. }
  130. $.ajax({
  131. type: "GET",
  132. url: '/thmz/getMzfzPatientOrderByPatientId?patientId=' + patientIdDb,
  133. contentType: "application/json;charset=UTF-8",
  134. dataType: "json",
  135. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  136. success: function (res) {
  137. if (res == '401' || res == 401) {
  138. window.location.href = '/thmz/login/view'
  139. return;
  140. }
  141. if (res.code == 0) {
  142. if (res.data != null && res.data.length > 0) {
  143. if (res.data.length == 1) {
  144. $("#turnToConsultationIdInClick").val(res.data[0].turnToConsultationId);
  145. clinicalReception(patientIdDb, res.data[0].serialNo, res.data[0].reqType);
  146. } else {
  147. $("#mzfzPatientOrderModal").modal();
  148. $("#mzfzPatientOrderTable").html(null);
  149. for (var i = 0; i < res.data.length; i++) {
  150. var roomCode = res.data[i].roomCode;
  151. if (roomCode == null || roomCode == "null") {
  152. roomCode = "";
  153. }
  154. var doctorCode = (res.data[i].doctorCode == null || res.data[i].doctorCode == 'null') ? '' : res.data[i].doctorCode;
  155. $("<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 () {
  156. $("#mzfzPatientOrderModal").modal("hide");
  157. $("#turnToConsultationIdInClick").val($(this).attr("data-target-turnToConsultationId"));
  158. clinicalReception(patientIdDb, $(this).attr("data-target"), $(this).attr("data-target-reqType"));
  159. });
  160. }
  161. }
  162. clearRapidAcceptsModal();
  163. $("#rapidAcceptsModal").modal("hide");
  164. } else {
  165. errorMesageSimaple("当前病人没有分诊信息");
  166. }
  167. } else if (res.code == 200) {
  168. clearRapidAcceptsModal();
  169. $("#rapidAcceptsModal").modal("hide");
  170. clinicalReception(patientIdDb, null, null);
  171. } else {
  172. errorMesage(res);
  173. }
  174. }
  175. });
  176. });
  177. /**
  178. * 存为范本
  179. */
  180. $("#saveapidAccepts").on("click", function (t) {
  181. //关闭帮助框
  182. $("#treeButton").webuiPopover('hide');
  183. $("#western_medicine_name").webuiPopover('hide');
  184. $("#chinese_medicine_name").webuiPopover('hide');
  185. $("#jcJyItem").webuiPopover('hide');
  186. $("#zlItem").webuiPopover('hide');
  187. $("#saveapidAcceptsModal").modal("show");
  188. });
  189. /**
  190. * 实例化智能问诊弹窗
  191. */
  192. // $("[data-toggle='popover']").popover();
  193. $("#box-arrow-left").popover({
  194. html: 'true',
  195. content: '<div id="smartAssistPopoverContent"></div>'
  196. });
  197. //初始化药品分组下拉选
  198. initGroupOrder();
  199. // 初始化用药天数下拉选
  200. initDayNum();
  201. //页面加载完成初始化西药处方
  202. //initNavTabs(0);
  203. //页面加载完成初始化住院处方
  204. //initNavTabs(3);
  205. //初始医生工作太配置
  206. initWorkspaceConfigForCurrent();
  207. initExecUnit();
  208. /**
  209. * 西药点击事件
  210. */
  211. $("#western_medicine_name").on("click", function (t) {
  212. var obj = $("#westernMedicinePopoverContent").parent().parent().parent();
  213. if ($(obj).hasClass("in") || $(obj).css("display") == "block") {
  214. $('#western_medicine_name').webuiPopover('hide');
  215. $("#treeButton").webuiPopover('hide');
  216. return;
  217. }
  218. $('#western_medicine_name').webuiPopover('show');
  219. loadYpList(0, null);
  220. });
  221. /**
  222. * 中药点击事件
  223. */
  224. $("#chinese_medicine_name").on("click", function (t) {
  225. var obj = $("#chineseMedicinePopoverContent").parent().parent().parent();
  226. if ($(obj).hasClass("in") || $(obj).css("display") == "block") {
  227. $('#chinese_medicine_name').webuiPopover('hide');
  228. $("#treeButton").webuiPopover('hide');
  229. return;
  230. }
  231. $('#chinese_medicine_name').webuiPopover('show');
  232. loadYpList(1, null);
  233. });
  234. /**
  235. * 辅助检查、检验点击事件
  236. */
  237. $("#jcJyItem").on("click", function (t) {
  238. var obj = $("#jcJyItemPopoverContent").parent().parent().parent();
  239. if ($(obj).hasClass("in") || $(obj).css("display") == "block") {
  240. $('#jcJyItem').webuiPopover('hide');
  241. $("#treeButton").webuiPopover('hide');
  242. return;
  243. }
  244. $('#jcJyItem').webuiPopover('show');
  245. loadjcJyItemList(null);
  246. });
  247. /**
  248. * 诊疗点击事件
  249. */
  250. $("#zlItem").on("click", function (t) {
  251. var obj = $("#zlItemPopoverContent").parent().parent().parent();
  252. if ($(obj).hasClass("in") || $(obj).css("display") == "block") {
  253. $('#zlItem').webuiPopover('hide');
  254. $("#treeButton").webuiPopover('hide');
  255. return;
  256. }
  257. $('#zlItem').webuiPopover('show');
  258. loadZlItemList(null);
  259. });
  260. initYshPart();
  261. initJyZdSample();
  262. initClinicDeptNo();
  263. setTimeout(function () {
  264. getLodop();
  265. }, 800);
  266. //键盘监听回车键
  267. $(document).unbind("keyup").keyup(function (event) {
  268. var index = getIndex("bill_item_group");
  269. if (event.keyCode == 13) { //是否是回车
  270. var el = event.srcElement || event.target;
  271. var id = el.getAttribute("id");
  272. var current_code = null;
  273. if (index == 0) {
  274. current_code = $("#western_medicine_current_code").val();
  275. } else if (index == 1) {
  276. current_code = $("#chinese_medicine_current_code").val();
  277. } else if (index == 2) {
  278. current_code = $("#jcjy_current_code").val();
  279. } else if (index == 3) {
  280. current_code = $("#zl_current_code").val();
  281. }
  282. if (id == null || id == "") {
  283. id = el.getAttribute("data-id");
  284. }
  285. if (id == null || id == "") {
  286. var search = el.getAttribute("aria-label");
  287. if (search == "Search") {
  288. id = $(el).parent().parent().prev().attr("data-id");
  289. }
  290. }
  291. if (id != null && id != "") {
  292. //将当前点击的id记录下
  293. //prevEleId = id;
  294. } else if (prevEleId != null) {
  295. id = prevEleId;
  296. }
  297. //回车时,光标不在任何区域判断是不是在药品和诊疗开立区域
  298. if (id == null || id == "") {
  299. var index = getIndex("bill_item_group");
  300. if (index == 0) {
  301. if (current_code != null && current_code != "") {
  302. //当前页面是西药保存页面,且有药品选中
  303. $("#supplyType").next().click();
  304. }
  305. } else if (index == 1) {
  306. //当前页面是中草药保存页面,且有药品选中
  307. } else if (index == 2) {
  308. if (current_code != null && current_code != "") {
  309. //当前页面是医技保存页面,且有选中
  310. if ($("#jyZdSampleDiv").hasClass('in')) {
  311. //此时是检验
  312. $("#jyZdSample").next().click();
  313. } else if ($("#yshPartDiv").hasClass('in')) {
  314. //说明现在是检查
  315. $("#yshPart").next().click();
  316. }
  317. }
  318. } else if (index == 3) {
  319. //诊疗
  320. $("#yshPart").next().click();
  321. return;
  322. } else if (index == 4) {
  323. //当前页面是住院保存页面
  324. $("#inpatientWardBeHospitalized").next().click();
  325. return;
  326. }
  327. }
  328. var customization = $("div.customization").not(".hide");
  329. // //回车时,光标不在任何区域,默认点击主诉
  330. // if (id == null || id == "") {
  331. // var eleId = $(customization[0]).attr("target-id");
  332. // $("#" + eleId).focus();
  333. // if (eleId == 'symptom') {
  334. // $("#" + eleId).click();
  335. // }
  336. // console.log("eleId=" + eleId);
  337. // } else
  338. if (id == 'symptom' || id == 'emrHpi' || id == 'emrPs' || id == 'personalHistory' || id == 'familyHistory' || id == 'obstericalHistory' || id == 'otherCheck' || id == 'diagnose' || id == 'tentativeDiagnosis' || id == 'fzZl' ) {
  339. console.log("1id=" + id);
  340. if (id != $(customization[customization.length - 1]).attr("target-id")) {
  341. var next = $("#" + id + "Flag").next();
  342. while ($(next).hasClass("foreclose") || $(next).hasClass("hide")) {
  343. next = $(next).next();
  344. }
  345. var eleId = $(next).attr("target-id");
  346. $("#" + eleId).focus();
  347. if (eleId == 'diagnose' || id == 'diagnose' || id == 'symptom') {
  348. $("#" + eleId).click();
  349. }
  350. console.log("1eleId=" + eleId);
  351. } else {
  352. var data_target = $("#symptom").attr("data-target");
  353. $("#" + data_target).find("a.close").click();
  354. data_target = $("#diagnose").attr("data-target");
  355. $("#" + data_target).find("a.close").click();
  356. if (index == 0) {
  357. $("#western_medicine_name").focus();
  358. } else if (index == 1) {
  359. $("#chinese_medicine_name").focus();
  360. } else if (index == 2) {
  361. $("#jcJyItem").focus();
  362. } else if (index == 3) {
  363. $("#zlItem").focus();
  364. } else if (index == 4) {
  365. $("#inpatientWardBeHospitalized").next().click();
  366. } else if (index == 5) {
  367. $("#opName").next().click();
  368. }
  369. }
  370. } else if (id == 'zy_drugWin') {
  371. $("#zyInstruction").next().click();
  372. } else if (id == 'zyInstruction') {
  373. var ariaExpanded = $("#zyInstruction").next().attr("aria-expanded");
  374. if (ariaExpanded == true || ariaExpanded == "true") {
  375. $("#zyInstruction").next().click();
  376. }
  377. $("#saveChineseMedicine").click();
  378. $("#chinese_medicine_name").focus();
  379. $("#chinese_medicine_name").click();
  380. } else if (id == 'cyJssm') {
  381. $("#cyJsl").focus();
  382. } else if (id == 'cyJsl') {
  383. $("#cyZql").focus();
  384. } else if (id == 'cyZql') {
  385. $("#cyFj").focus();
  386. } else if (id == 'cyFj') {
  387. $("#cyFfcs").focus();
  388. } else if (id == 'cyFj') {
  389. $("#cyFfcs").focus();
  390. } else if (id == 'cyFfcs') {
  391. $("#useType_1").next().click();
  392. } else if (id == 'useType_1') {
  393. $("#cyMtjs").focus();
  394. } else if (id == 'cyMtjs') {
  395. $("#zyfs").focus();
  396. } else if (id == 'zyfs') {
  397. $("#zy_supplyType_1").next().click();
  398. } else if (id == 'supplyType') {
  399. $("#drugWinUnit").next().click();
  400. } else if (id == 'drugWinUnit') {
  401. $("#drugWin").focus();
  402. } else if (id == 'drugWin') {
  403. $("#dayNum").next().click();
  404. } else if (id == 'dayNum') {
  405. $("#orderFrequency").next().click();
  406. } else if (id == 'orderFrequency') {
  407. $("#gross").focus();
  408. } else if (id == 'gross') {
  409. $("#packUnit").next().click();
  410. } else if (id == 'packUnit') {
  411. $("#medicalAdvice").next().click();
  412. } else if (id == 'medicalAdvice') {
  413. var ariaExpanded = $("#medicalAdvice").next().attr("aria-expanded");
  414. if (ariaExpanded == true || ariaExpanded == "true") {
  415. $("#medicalAdvice").next().click();
  416. }
  417. saveMedicine(0);
  418. $("#western_medicine_name").focus();
  419. } else if (id == 'saveWesternMedicine') {
  420. $("#western_medicine_name").focus();
  421. $("#western_medicine_name").click();
  422. } else if (id == 'yshPart' || id == 'jyQuantity') {
  423. $("#execUnit").next().click();
  424. } else if (id == 'jyZdSample') {
  425. $("#jyQuantity").focus();
  426. } else if (id == 'execUnit') {
  427. var ariaExpanded = $("#execUnit").next().attr("aria-expanded");
  428. if (ariaExpanded == true || ariaExpanded == "true") {
  429. $("#execUnit").next().click();
  430. }
  431. $("#remark").focus();
  432. } else if (id == 'remark') {
  433. saveJyJcItem(true);
  434. $("#jcJyItem").focus();
  435. } else if (id == 'chargeUnit') {
  436. $("#itemQuantity").focus();
  437. } else if (id == 'itemQuantity') {
  438. $("#dayZlNum").next().click();
  439. } else if (id == 'dayZlNum') {
  440. var ariaExpanded = $("#dayZlNum").next().attr("aria-expanded");
  441. if (ariaExpanded == true || ariaExpanded == "true") {
  442. $("#dayZlNum").next().click();
  443. }
  444. $("#orderFrequencyZl").next().click();
  445. } else if (id == 'orderFrequencyZl') {
  446. var ariaExpanded = $("#orderFrequencyZl").next().attr("aria-expanded");
  447. if (ariaExpanded == true || ariaExpanded == "true") {
  448. $("#orderFrequencyZl").next().click();
  449. }
  450. $("#totalNumZl").focus();
  451. } else if (id == 'totalNumZl') {
  452. $("#zlExecUnit").next().click();
  453. } else if (id == 'zlExecUnit') {
  454. var ariaExpanded = $("#zlExecUnit").next().attr("aria-expanded");
  455. if (ariaExpanded == true || ariaExpanded == "true") {
  456. $("#zlExecUnit").next().click();
  457. }
  458. $("#zlRemark").focus();
  459. } else if (id == 'zlRemark') {
  460. saveZlItem(true);
  461. $("#zlItem").focus();
  462. } else if (id == 'inpatientWardBeHospitalized') {
  463. $("#smallWardBeHospitalized").next().click();
  464. } else if (id == 'smallWardBeHospitalized') {
  465. $("#conditionCode").next().click();
  466. } else if (id == 'conditionCode') {
  467. $("#routeOfAdmission").next().click();
  468. } else if (id == 'routeOfAdmission') {
  469. $("#admissStatus").next().click();
  470. } else if (id == 'admissStatus') {
  471. saveZyReq(true);
  472. $("#zy_req_button").focus();
  473. } else if (id == 'western_medicine_name') {
  474. var webuiID = $("#western_medicine_name").attr("data-target");
  475. if (webuiID == null || webuiID == "null" || webuiID == "") {
  476. //药品查询框是空白的,打开查询框
  477. $("#western_medicine_name").click();
  478. return;
  479. }
  480. //选择框打开
  481. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  482. var arr = $("#tb_table_western_medicine").find("tbody").find("tr.trhover");
  483. if (arr != undefined && arr != null && arr.length > 0) {
  484. var dataIndex = $(arr).attr("data-index");
  485. var tableData = $("#tb_table_western_medicine").bootstrapTable('getData');
  486. if (tableData != null && tableData.length > 0 && dataIndex != null) {
  487. var trData = tableData[dataIndex];
  488. checkYpInfo(trData.code, trData.serial, trData.ypType, true, null, 3);
  489. $("#western_medicine_name").click();
  490. }
  491. } else {
  492. //药品查询框是空白的,打开查询框
  493. $("#western_medicine_name").click();
  494. }
  495. } else {
  496. if (current_code != null && current_code != "") {
  497. //已经选中药品,跳到用法
  498. $("#supplyType").next().click();
  499. } else {
  500. //药品查询框是空白的,打开查询框
  501. $("#western_medicine_name").click();
  502. }
  503. }
  504. } else if (id == 'chinese_medicine_name') {
  505. var webuiID = $("#chinese_medicine_name").attr("data-target");
  506. if (webuiID == null || webuiID == "null" || webuiID == "") {
  507. $("#chinese_medicine_name").click();
  508. return;
  509. }
  510. //选择框打开
  511. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  512. var arr = $("#tb_table_chinese_medicine").find("tbody").find("tr.trhover");
  513. if (arr != undefined && arr != null && arr.length > 0) {
  514. var dataIndex = $(arr).attr("data-index");
  515. var tableData = $("#tb_table_chinese_medicine").bootstrapTable('getData');
  516. if (tableData != null && tableData.length > 0 && dataIndex != null) {
  517. var trData = tableData[dataIndex];
  518. checkZyInfo(trData.code, trData.serial, $("#zyClassType").val(), true);
  519. $("#chinese_medicine_name").click();
  520. }
  521. } else {
  522. //药品查询框是空白的,打开查询框
  523. $("#chinese_medicine_name").click();
  524. }
  525. } else {
  526. if (current_code != null && current_code != "") {
  527. //已经选中药品,跳到剂量
  528. $("#zy_drugWin").next().click();
  529. } else {
  530. //药品查询框是空白的,打开查询框
  531. $("#chinese_medicine_name").click();
  532. }
  533. }
  534. } else if (id == 'jcJyItem') {
  535. var webuiID = $("#jcJyItem").attr("data-target");
  536. if (webuiID == null || webuiID == "null" || webuiID == "") {
  537. $("#jcJyItem").click();
  538. return;
  539. }
  540. //选择框打开
  541. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  542. var arr = $("#tb_table_jc_jy_item").find("tbody").find("tr.trhover");
  543. if (arr != undefined && arr != null && arr.length > 0) {
  544. var dataIndex = $(arr).attr("data-index");
  545. var tableData = $("#tb_table_jc_jy_item").bootstrapTable('getData');
  546. if (tableData != null && tableData.length > 0 && dataIndex != null) {
  547. var trData = tableData[dataIndex];
  548. $('#jcJyItem').webuiPopover('hide');
  549. $("#jcJyZltype").val(trData.type);
  550. $("#execUnit").selectpicker('val', trData.execUnit);//默认不选中
  551. $("#execUnit").selectpicker('refresh');
  552. if (trData.type == 1) {
  553. //检验
  554. $("#jyZdSampleDiv").removeClass("hide").addClass("in");
  555. $("#jyQuantityDiv").removeClass("hide").addClass("in");
  556. $("#chargeUnitDiv").removeClass("in").addClass("hide");
  557. $("#yshPartDiv").removeClass("in").addClass("hide");
  558. if (trData.sampleCode != null && trData.sampleCode != "") {
  559. $("#jyZdSample").selectpicker('val', trData.sampleCode);
  560. $('#jyZdSample').selectpicker('refresh');
  561. }
  562. } else if (trData.type == 2) {
  563. //检查
  564. $("#yshPartDiv").removeClass("hide").addClass("in");
  565. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  566. $("#jyQuantityDiv").removeClass("in").addClass("hide");
  567. $("#chargeUnitDiv").removeClass("in").addClass("hide");
  568. if (trData.bwCode != null && trData.bwCode != "") {
  569. $("#yshPart").selectpicker('val', trData.bwCode);
  570. $('#yshPart').selectpicker('refresh');
  571. }
  572. }
  573. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  574. checkJcJyItemInfo(trData.code, trData.name, trData.type, true);
  575. }
  576. } else {
  577. //药品查询框是空白的,打开查询框
  578. $("#jcJyItem").click();
  579. }
  580. } else {
  581. if (current_code != null && current_code != "") {
  582. //如果是保存失败的,重新打开输入框查询
  583. if (prevEleId == 'remark') {
  584. $("#jcJyItem").click();
  585. } else {
  586. //当前页面是医技保存页面,且有选中
  587. if ($("#jyZdSampleDiv").hasClass('in')) {
  588. //此时是检验
  589. $("#jyZdSample").next().click();
  590. } else if ($("#yshPartDiv").hasClass('in')) {
  591. //说明现在是检查
  592. $("#yshPart").next().click();
  593. }
  594. }
  595. } else {
  596. //药品查询框是空白的,打开查询框
  597. $("#jcJyItem").click();
  598. }
  599. }
  600. } else if (id == 'zlItem') {
  601. var webuiID = $("#zlItem").attr("data-target");
  602. if (webuiID == null || webuiID == "null" || webuiID == "") {
  603. $("#zlItem").click();
  604. return;
  605. }
  606. //选择框打开
  607. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  608. var arr = $("#tb_table_zl_item").find("tbody").find("tr.trhover");
  609. if (arr != undefined && arr != null && arr.length > 0) {
  610. var dataIndex = $(arr).attr("data-index");
  611. var tableData = $("#tb_table_zl_item").bootstrapTable('getData');
  612. if (tableData != null && tableData.length > 0 && dataIndex != null) {
  613. var trData = tableData[dataIndex];
  614. $('#zlItem').webuiPopover('hide');
  615. $("#zlExecUnit").selectpicker('val', trData.execUnit);//默认不选中
  616. $("#zlExecUnit").selectpicker('refresh');
  617. //诊疗
  618. if ($("#zlTab").find("li") == null || $("#zlTab").find("li").length == 0) {
  619. initNavTabs(3, null, null);
  620. }
  621. $("#zlItem").val(trData.name);
  622. $("#zlItem").blur();
  623. $("#zlItemPrice").val(trData.chargeAmount);
  624. $("#chargeUnit").val(trData.specification);
  625. $("#zl_current_code").val(trData.code);
  626. $("#itemQuantity").val(1);
  627. $("#chargeUnit").focus();
  628. }
  629. } else {
  630. //药品查询框是空白的,打开查询框
  631. $("#zlItem").click();
  632. }
  633. } else {
  634. if (current_code != null && current_code != "") {
  635. //如果是保存失败的,重新打开输入框查询
  636. if (prevEleId == 'zlRemark') {
  637. $("#zlItem").click();
  638. } else {
  639. $("#chargeUnit").focus();
  640. }
  641. } else {
  642. //药品查询框是空白的,打开查询框
  643. $("#zlItem").click();
  644. }
  645. }
  646. } else if (id == 'zy_req_button') {
  647. //当前页面是住院保存页面,此时光标在入院按钮上
  648. console.log("入院按钮")
  649. $("#inpatientWardBeHospitalized").next().click();
  650. } else if (id == 'op_record_button') {
  651. //当前页面是手术保存页面,此时光标在入院按钮上
  652. console.log("手术按钮")
  653. $("#opName").next().click();
  654. } else if (id == 'opName') {
  655. $("#opTime").click();
  656. var opTime = $("#opTime").val();
  657. if (opTime == null || opTime == "") {
  658. $("#opTime").datetimepicker('show');
  659. } else {
  660. $("#opTime").datetimepicker('hide');
  661. $("#urgentClinicFlag").next().click();
  662. }
  663. } else if (id == 'opTime') {
  664. $("#opTime").datetimepicker('hide');
  665. $("#urgentClinicFlag").next().click();
  666. } else if (id == 'urgentClinicFlag') {
  667. $("#ssbc").next().click();
  668. } else if (id == 'ssbc') {
  669. $("#partCode").next().click();
  670. } else if (id == 'partCode') {
  671. $("#opScale").next().click();
  672. } else if (id == 'opScale') {
  673. $("#hocusCode").next().click();
  674. } else if (id == 'hocusCode') {
  675. $("#doctorZd").next().click();
  676. } else if (id == 'doctorZd') {
  677. $("#opRecordRemark").click();
  678. } else if (id == 'opRecordRemark') {
  679. saveOpRecord(true);
  680. }
  681. if (id != null && id != "") {
  682. //将当前点击的id记录下
  683. prevEleId = id;
  684. }
  685. } else if (event.keyCode == 37) {
  686. // //左键事件
  687. // if(index==0){
  688. // return;
  689. // }
  690. // var prevObject=$("#bill_item_group").find("button")[index-1];
  691. // $(prevObject).click();
  692. } else if (event.keyCode == 38) {
  693. //上键事件
  694. var tableId = null;
  695. var inputId = null;
  696. var contentId = null;
  697. if (index == 0) {
  698. tableId = "tb_table_western_medicine";
  699. inputId = "western_medicine_name";
  700. contentId = "westernMedicinePopoverContent";
  701. } else if (index == 1) {
  702. tableId = "tb_table_chinese_medicine";
  703. inputId = "chinese_medicine_name";
  704. contentId = "chineseMedicinePopoverContent";
  705. } else if (index == 2) {
  706. tableId = "tb_table_jc_jy_item";
  707. inputId = "jcJyItem";
  708. contentId = "jcJyItemPopoverContent";
  709. } else if (index == 3) {
  710. tableId = "tb_table_zl_item";
  711. inputId = "zlItem";
  712. contentId = "zlItemPopoverContent";
  713. }
  714. if (inputId == null) {
  715. return;
  716. }
  717. var webuiID = $("#" + inputId).attr("data-target");
  718. if (webuiID == null || webuiID == "null" || webuiID == "") {
  719. return;
  720. }
  721. //选择框打开
  722. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  723. var arr = $("#" + tableId).find("tbody").find("tr.trhover");
  724. var prev = $(arr).prev();
  725. if (arr != undefined && arr != null && arr.length > 0) {
  726. if (prev != undefined && prev != null && prev.length > 0) {
  727. $(arr).removeClass("trhover");
  728. $(prev).addClass("trhover");
  729. var height = $(arr).css("height");
  730. $("#" + contentId).parent().animate({scrollTop: "-=" + height}, 100);
  731. }
  732. } else {
  733. var arrs = $("#" + tableId).find("tbody").find("tr");
  734. $(arrs[0]).addClass("trhover");
  735. var height = $(arrs[0]).css("height");
  736. $("#" + contentId).parent().animate({scrollTop: "+=" + height}, 100);
  737. }
  738. }
  739. } else if (event.keyCode == 39) {
  740. // //右键事件
  741. // if(index==4){
  742. // return;
  743. // }
  744. // var nextObject=$("#bill_item_group").find("button")[index+1];
  745. // $(nextObject).click();
  746. } else if (event.keyCode == 40) {
  747. //下键事件
  748. var tableId = null;
  749. var inputId = null;
  750. var contentId = null;
  751. if (index == 0) {
  752. tableId = "tb_table_western_medicine";
  753. inputId = "western_medicine_name";
  754. contentId = "westernMedicinePopoverContent";
  755. } else if (index == 1) {
  756. tableId = "tb_table_chinese_medicine";
  757. inputId = "chinese_medicine_name";
  758. contentId = "chineseMedicinePopoverContent";
  759. } else if (index == 2) {
  760. tableId = "tb_table_jc_jy_item";
  761. inputId = "jcJyItem";
  762. contentId = "jcJyItemPopoverContent";
  763. } else if (index == 3) {
  764. tableId = "tb_table_zl_item";
  765. inputId = "zlItem";
  766. contentId = "zlItemPopoverContent";
  767. }
  768. if (inputId == null) {
  769. return;
  770. }
  771. var webuiID = $("#" + inputId).attr("data-target");
  772. if (webuiID == null || webuiID == "null" || webuiID == "") {
  773. return;
  774. }
  775. //选择框打开
  776. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  777. var arr = $("#" + tableId).find("tbody").find("tr.trhover");
  778. var next = $(arr).next();
  779. if (arr != undefined && arr != null && arr.length > 0) {
  780. if (next != undefined && next != null && next.length > 0) {
  781. $(arr).removeClass("trhover");
  782. $(next).addClass("trhover");
  783. var height = $(arr).css("height");
  784. $("#" + contentId).parent().animate({scrollTop: "+=" + height}, 100);
  785. }
  786. } else {
  787. var arrs = $("#" + tableId).find("tbody").find("tr");
  788. $(arrs[0]).addClass("trhover");
  789. var height = $(arrs[0]).css("height");
  790. $("#" + contentId).parent().animate({scrollTop: "+=" + height}, 100);
  791. }
  792. }
  793. }
  794. });
  795. //打印检查检验报告单
  796. $('#btn_print').click(function () {
  797. printJyJcReport(1);
  798. });
  799. //打印设置检查检验报告单
  800. $('#btn_print_setup').click(function () {
  801. printJyJcReport(2);
  802. });
  803. /**
  804. * 医保电子凭证读卡
  805. */
  806. $("#siReadCard").on("click", function (t) {
  807. siReadCard("qrcode_01101");
  808. });
  809. /**
  810. * 医保刷脸
  811. */
  812. $("#siReadCardFace").on("click", function (t) {
  813. siReadCard("face_01101");
  814. });
  815. /**
  816. * 门诊统筹支付医额外内容弹窗
  817. */
  818. $("#expContentRequired").on("click", function (t) {
  819. expContentRequiredModal();
  820. });
  821. /**
  822. * 门诊统筹支付医保电子凭证读卡
  823. */
  824. // $("#mztczfSiReadCard").on("click", function (t) {
  825. // mztczfSiReadCard(true, "qrcode_01101");
  826. // });
  827. /**
  828. * 门诊统筹支付医保刷脸
  829. */
  830. // $("#mztczfSiReadCardFace").on("click", function (t) {
  831. // mztczfSiReadCard(true, "face_01101");
  832. // });
  833. /**
  834. * 快速接诊页面 -未挂号患者信息查询处编辑患者信息
  835. */
  836. $("#rapidAcceptsEditUser").on("click", function (t) {
  837. editUserModal($("#rapidAcceptsUserCode").val(), 2);
  838. ksjzType = 2 ;
  839. });
  840. //监听滚动停止处理逻辑开始
  841. let t1 = 0;
  842. let t2 = 0;
  843. let timer = null; // 定时器
  844. $("#scroll-wrap").on("scroll", function () {
  845. // 滚动
  846. clearTimeout(timer)
  847. timer = setTimeout(isScrollEnd, 100)
  848. t1 = $("#scroll-wrap").scrollTop();
  849. })
  850. function isScrollEnd() {
  851. t2 = $("#scroll-wrap").scrollTop();
  852. if (t2 == t1) {
  853. clearTimeout(timer)
  854. closeObjectWebui(true);
  855. console.log("滚动停止", t2) // 这里处理
  856. }
  857. }
  858. //监听滚动停止处理逻辑结束
  859. //合理用药预警系统(医药学知识查询助手)
  860. $("#hlyyButton").on("click", function (t) {
  861. $("#hlyyTitle").html("合理用药预警系统(医药学知识查询助手)");
  862. showHlyyModel('hlyysmsDiv', 'hlyysmsLoading', 'hlyysmsModal', "http://172.16.32.121:9097/index.html#");
  863. });
  864. //预约挂号日期控件注册
  865. $('#registrationTime').datetimepicker({
  866. language: 'zh-CN',
  867. //format: 'yyyy-mm-dd hh:ii:ss'
  868. format: 'yyyy-mm-dd',
  869. // showHour:false,
  870. // showMinute:false,
  871. // showSecond:false,
  872. // timeText:"",
  873. // timeFormat:"",
  874. minView: "month",
  875. autoclose: true,//选中自动关闭
  876. });
  877. //初始化号段下拉选
  878. initMzWorkTime();
  879. //挂号日期控件注册
  880. $('#opTime').datetimepicker({
  881. language: 'zh-CN',
  882. format: 'yyyy-mm-dd hh:ii:ss',
  883. showHour: true,
  884. showMinute: true,
  885. showSecond: true,
  886. minView: "1", // 1 小时 2 日视图 3 月视图 4 年视图
  887. autoclose: true,//选中自动关闭
  888. });
  889. //出生日期控件注册
  890. $('#crbMainCardBirthDay').datetimepicker({
  891. language: 'zh-CN',
  892. format: 'yyyy-mm-dd',
  893. minView: "month",
  894. autoclose: true,//选中自动关闭
  895. });
  896. //发病日期控件注册
  897. $('#illStartDate').datetimepicker({
  898. language: 'zh-CN',
  899. format: 'yyyy-mm-dd',
  900. minView: "month",
  901. autoclose: true,//选中自动关闭
  902. });
  903. //诊断日期控件注册
  904. $('#illFirstDate').datetimepicker({
  905. language: 'zh-CN',
  906. format: 'yyyy-mm-dd',
  907. minView: "month",
  908. autoclose: true,//选中自动关闭
  909. });
  910. //死亡日期控件注册
  911. $('#deathDate').datetimepicker({
  912. language: 'zh-CN',
  913. format: 'yyyy-mm-dd',
  914. minView: "month",
  915. autoclose: true,//选中自动关闭
  916. });
  917. });
  918. /**
  919. * 刷新列表,解决越来越快的问题
  920. */
  921. function refreshList() {
  922. //clearInterval要放在方法开始,不然的话,下面的代码还没运行到clearInterval,又开始了循环了。
  923. clearInterval(timer);
  924. //加载候诊患者列表
  925. loadUnClinicTableList();
  926. //加载已接诊患者列表 病人会缴费,需要刷新状态
  927. loadClinicTableList();
  928. timer = setInterval(() => {
  929. refreshList()
  930. }, 60000);
  931. }
  932. /**
  933. * 门诊统筹额外内容
  934. */
  935. function expContentRequiredModal() {
  936. $("#expContentRequiredModal").modal("show");
  937. }
  938. /**
  939. * 打开科室选择页面
  940. */
  941. function selectDeptModal() {
  942. $("#selectDeptModal").modal("show");
  943. }
  944. /**
  945. * 打开配置页面
  946. */
  947. function configWorkspaceModal() {
  948. initWorkspaceConfigForCurrent();
  949. $("#configWorkspaceModal").modal("show");
  950. }
  951. /**
  952. * 初始化用药天数下拉选
  953. */
  954. function initDayNum() {
  955. var html = '';
  956. for (var i = 1; i <= 112; i++) {
  957. html += '<option value="' + i + '">' + i + '</option>';
  958. }
  959. $('#dayNum').html(html);
  960. $('#dayNum').selectpicker('refresh');
  961. $('#dayZlNum').html(html);
  962. $('#dayZlNum').selectpicker('refresh');
  963. }
  964. /**
  965. * 处方回调
  966. */
  967. function resetGroupIdSelect() {
  968. var groupIds = $("#groupId option");
  969. var usedGroupIdInputs = $("#xyTabContent").find("input.temporary_items_groupId");
  970. if (usedGroupIdInputs != null && usedGroupIdInputs.length > 0) {
  971. let lastGroupId = 0;
  972. for (var i = 0; i < usedGroupIdInputs.length; i++) {
  973. var groupId = Number($(usedGroupIdInputs[i]).val());
  974. if (groupId > lastGroupId) {
  975. lastGroupId = groupId;
  976. }
  977. }
  978. if (groupIds != null && groupIds.length > 1) {
  979. for (var i = 0; i < groupIds.length; i++) {
  980. var groupId = $(groupIds[i]).val();
  981. if (groupId <= lastGroupId) {
  982. continue;
  983. }
  984. $(groupIds[i]).remove();
  985. //删除给药方式与其他属性的缓存
  986. groupIdMap.remove(groupId);
  987. }
  988. appendGroupOrder();
  989. }
  990. } else if (groupIds != null && groupIds.length > 1) {
  991. initGroupOrder();
  992. }
  993. }
  994. /**
  995. * 初始化药品分组下拉选
  996. */
  997. function initGroupOrder() {
  998. var html = '<option value="1">1</option>';
  999. $('#groupId').html(html);
  1000. $('#groupId').selectpicker('refresh');
  1001. $("#groupId").selectpicker('val', 1);
  1002. $('#groupId').selectpicker('refresh');
  1003. groupIdMap = new MyMap();
  1004. }
  1005. /**
  1006. * 追加分组
  1007. */
  1008. function appendGroupOrder() {
  1009. var last = parseInt($("#groupId > option:last").val());
  1010. last++;
  1011. var html = '<option value="' + last + '">' + last + '</option>';
  1012. $('#groupId').append(html);
  1013. $('#groupId').selectpicker('refresh');
  1014. }
  1015. /**
  1016. * 组号改变事件
  1017. */
  1018. function groupIdChange() {
  1019. //var last = parseInt($("#groupId > option:last").val());
  1020. var groupId = $("#groupId").val();
  1021. var keys = groupIdMap.keySet();
  1022. if (keys.indexOf(groupId) < 0) {
  1023. //是新增药品清空药品输入区域
  1024. var updateFlag = $("#western_medicine_update_flag").val();
  1025. var currentCode = $("#western_medicine_current_code").val();
  1026. //当前时新增药品,而且没有选择药品的时候,组号变更,清空区域
  1027. if ((updateFlag == undefined || updateFlag == null || updateFlag == "false" || updateFlag == false) && (currentCode == null || currentCode == "")) {
  1028. clearWesternMedicine(true);
  1029. }
  1030. } else {
  1031. var map = groupIdMap.get(groupId);
  1032. if (map != null) {
  1033. var supplyType = map.get("supplyType");
  1034. var orderFrequency = map.get("orderFrequency");
  1035. var dayNum = map.get("dayNum");
  1036. //用法编码
  1037. $("#supplyType").selectpicker('val', supplyType);
  1038. $('#supplyType').selectpicker('refresh');
  1039. //$("#supplyType").attr("disabled", "disabled");
  1040. //天数
  1041. $("#dayNum").selectpicker('val', dayNum);
  1042. $('#dayNum').selectpicker('refresh');
  1043. // $("#dayNum").attr("disabled", "disabled");
  1044. //频次编码
  1045. $("#orderFrequency").selectpicker('val', orderFrequency);
  1046. $('#orderFrequency').selectpicker('refresh');
  1047. // $("#orderFrequency").attr("disabled", "disabled");
  1048. }
  1049. }
  1050. }
  1051. /**
  1052. * 关闭智能问诊弹框
  1053. */
  1054. function closePopover() {
  1055. //$(".popover").popover('hide');
  1056. $("#box-arrow-left").click();
  1057. }
  1058. /**
  1059. * 关闭项目选择框
  1060. * ReOpen 是否重新打开 true 打开 false 不打开
  1061. */
  1062. function closeObjectWebui(ReOpen) {
  1063. var index = getIndex("bill_item_group");
  1064. var currentCode = "western_medicine_name";
  1065. if (index == 1) {
  1066. currentCode = "chinese_medicine_name";
  1067. } else if (index == 2) {
  1068. currentCode = "jcJyItem";
  1069. } else if (index == 3) {
  1070. currentCode = "zlItem";
  1071. }
  1072. var webuiID = $("#" + currentCode).attr("data-target");
  1073. if (webuiID != null && webuiID != "null" && webuiID != "") {
  1074. //选择框打开
  1075. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  1076. $("#" + currentCode).click();
  1077. if (ReOpen) {
  1078. $("#" + currentCode).click();
  1079. }
  1080. }
  1081. }
  1082. var symptomID = $("#symptom").attr("data-target");
  1083. if (symptomID != null && symptomID != "null" && symptomID != "") {
  1084. //选择框打开
  1085. if ($("#" + symptomID).hasClass("in") || $("#" + symptomID).css("display") == "block") {
  1086. $("#symptom").click();
  1087. if (ReOpen) {
  1088. $("#symptom").click();
  1089. }
  1090. }
  1091. }
  1092. var weightID = $("#weight").attr("data-target");
  1093. if (weightID != null && weightID != "null" && weightID != "") {
  1094. //选择框打开
  1095. if ($("#" + weightID).hasClass("in") || $("#" + weightID).css("display") == "block") {
  1096. $("#weight").click();
  1097. if (ReOpen) {
  1098. $("#weight").click();
  1099. }
  1100. }
  1101. }
  1102. var diagnoseID = $("#diagnose").attr("data-target");
  1103. if (diagnoseID != null && diagnoseID != "null" && diagnoseID != "") {
  1104. //选择框打开
  1105. if ($("#" + diagnoseID).hasClass("in") || $("#" + diagnoseID).css("display") == "block") {
  1106. $("#diagnose").click();
  1107. if (ReOpen) {
  1108. $("#diagnose").click();
  1109. }
  1110. }
  1111. }
  1112. }
  1113. /**
  1114. * 加载智能问诊弹框内容
  1115. */
  1116. function contentMethod() {
  1117. setTimeout(function () {
  1118. closeObjectWebui(false);
  1119. $(".popover div.arrow").css("display", "none");
  1120. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  1121. if (popoverId == undefined) {
  1122. return;
  1123. }
  1124. var left = $("#" + popoverId).css("left");
  1125. left = left.replace("px", "");
  1126. left = parseInt(left);
  1127. left = left + 55;
  1128. $("#" + popoverId).css("height", "100%").css("top", "0px").css("left", left + "px").css("border-radius", "0px").css("z-index", "11");
  1129. $("#" + popoverId + " .popover-content").css("height", "100%");
  1130. $("#smartAssistPopoverContent").css("height", "100%");
  1131. var html = ' <div style="height: 24%;padding-left: 15px;width: 100%;">' +
  1132. ' <button type="button" style="cursor: default;margin-bottom: 0px;margin-right: 0px; font-size: 12px;"' +
  1133. ' class="btn btn-primary">' +
  1134. ' <span id="patientHisData"></span>就医轨迹' +
  1135. ' </button>' +
  1136. ' <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true" onclick="closePopover()">×</span>' +
  1137. ' </button>' +
  1138. ' <div style="height: calc(100% - 39px);border: 1px solid #DDDDDD;margin-top: 5px;width: 100%;">' +
  1139. ' <form class="form-horizontal form-label-left mz-fixed-form" novalidate autocomplete="off"' +
  1140. ' style="height: 100%;overflow-y: auto;width: 100%;text-align: -webkit-center;position: relative;" id="patientHisDataForm">' +
  1141. ' </form>' +
  1142. ' </div>' +
  1143. ' </div>' +
  1144. ' <div style="height: 23%;padding-left: 15px;width: 100%;">' +
  1145. ' <button type="button" style="cursor: default;margin-bottom: 0px;margin-right: 0px;margin-top: 5px;"' +
  1146. ' class="btn btn-primary">' +
  1147. ' <span id="recommendType"></span>推荐' +
  1148. ' </button>' +
  1149. ' <div style="height: calc(100% - 44px);border: 1px solid #DDDDDD;overflow-y: auto;margin-top: 5px;width: 100%;">' +
  1150. ' <form class="form-horizontal form-label-left mz-fixed-form" novalidate autocomplete="off"' +
  1151. ' style="height: 100%;overflow-y: auto;width: 100%;text-align: -webkit-center;position: relative;" id="recommendForm">' +
  1152. ' <img src="/thmz/images/no-recommend.png" style="height: 120px;position: absolute;top: 50%;transform: translateY(-50%);margin-left: -30px;">' +
  1153. ' </form>' +
  1154. ' </div>' +
  1155. ' </div>' +
  1156. ' <div style="height: 53%;padding-left: 15px;width: 100%;">' +
  1157. ' <button type="button"' +
  1158. ' style="cursor: default;margin-bottom: 0px;margin-right: 0px;margin-top: 5px; font-size: 12px;"' +
  1159. ' class="btn btn-primary">' +
  1160. ' 医疗范本' +
  1161. ' </button>' +
  1162. ' <div class="item" style="width: 230px;height: 35px;float: right;line-height: 35px;margin-right: 40px;">' +
  1163. ' <div class="col-md-6 col-sm-6 col-xs-12">' +
  1164. ' <select class="form-control selectpicker show-tick" title="范文范围" onchange="fitTemplateData()"' +
  1165. ' id="templateTypeForm">' +
  1166. ' </select>' +
  1167. ' </div>' +
  1168. ' <div class="col-md-6 col-sm-6 col-xs-12">' +
  1169. ' <select class="form-control selectpicker show-tick" title="范文类型" onchange="fitTemplateData()"' +
  1170. ' id="templateKindTypeForm">' +
  1171. ' </select>' +
  1172. ' </div>' +
  1173. ' </div>' +
  1174. ' <div style="height: calc(100% - 44px);border: 1px solid #DDDDDD;overflow-y: auto;margin-top: 5px;width: 100%;position: relative;">' +
  1175. ' <form class="form-horizontal form-label-left mz-fixed-form" novalidate autocomplete="off"' +
  1176. ' style="height: 100%;overflow-y: auto;width: 100%;" id="TemplateData">' +
  1177. ' </form>' +
  1178. ' </div>' +
  1179. ' </div>';
  1180. $("#smartAssistPopoverContent").html(html);
  1181. initTemplateTypeSelect("templateTypeForm");
  1182. initTemplateKindTypeSelect('templateKindTypeForm');
  1183. fitPatientHisData();
  1184. fitSymptomData();
  1185. fitEmrHpiData();
  1186. fitEmrPsData();
  1187. fitDiagnoseData();
  1188. fitTemplateData();
  1189. }, 100);
  1190. // setTimeout(function () {
  1191. // $("#patientHisDataForm").html("aadsasfasdfasdfasdfasdfsdfasdfasdfasdfdfafda");
  1192. // },1000);
  1193. }
  1194. /**
  1195. * 设置患者的就诊轨迹
  1196. */
  1197. function fitPatientHisData() {
  1198. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  1199. if (!$("#" + popoverId).hasClass("in")) {
  1200. return;
  1201. }
  1202. var emptyHtml = '<img src="/thmz/images/locus.png" style="height: 120px;position: absolute;top: 50%;transform: translateY(-50%);margin-left: -30px;">';
  1203. if (($("#patientId").text() == null || $("#patientId").text() == "") && ($("#userName").val() == null || $("#userName").val() == "")) {
  1204. $("#patientHisDataForm").html(emptyHtml);
  1205. return;
  1206. }
  1207. var patientId = $("#patientId").text();
  1208. if (patientId == null || patientId == "") {
  1209. patientId = $("#userName").val();
  1210. }
  1211. $.ajax({
  1212. type: "POST",
  1213. url: '/thmz/getClinicWithPage',
  1214. contentType: "application/json;charset=UTF-8",
  1215. dataType: "json",
  1216. data: JSON.stringify({
  1217. "commonParams": patientId,
  1218. //"clinicStatuses": [5, 6],
  1219. "clinicStatuses": [6],
  1220. "pageSize": 10000,
  1221. "offset": 0,
  1222. "beginDate": "2012-02-01 00:00:00",
  1223. "endDate": "",
  1224. "doctorCode": "-1"
  1225. }),
  1226. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1227. success: function (res) {
  1228. if (res == '401' || res == 401) {
  1229. window.location.href = '/thmz/login/view'
  1230. return;
  1231. }
  1232. if (res.code == 0) {
  1233. var html = '';
  1234. var data = res.data;
  1235. if (data == null || data.length == 0) {
  1236. html += emptyHtml;
  1237. } else {
  1238. for (var i = 0; i < data.length; i++) {
  1239. var icdText = data[i].icdText;
  1240. if (icdText == null) {
  1241. // continue;
  1242. icdText = "空白诊断";
  1243. }
  1244. icdText = icdText.trim();
  1245. html += ' <div class="item form-group thmz_alert" style="width: 100%;">';
  1246. html += ' <div style="float: left;width: 172px;">';
  1247. html += ' <img src="/thmz/css/bootstrap/bootstrap-icons-1.5.0/stopwatch.svg"';
  1248. html += ' style="margin-left: 10px!important;vertical-align: -.15em;margin-right: 10px!important;"/>';
  1249. html += ' <span style="width: 120px;margin-right: 20px!important;">' + format(data[i].opDay, "yyyy-MM-dd HH:mm") + '</span>';
  1250. html += ' </div>';
  1251. html += ' <div style="text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 172px);"';
  1252. html += ' title="' + icdText + '">诊断:<a style="cursor: pointer; color: #2e69eb;"';
  1253. html += ' onclick="visitingDetailModal(\'' + data[i].patientId + '\',' + data[i].times + ',' + data[i].id + ',' + data[i].clinicStatus + ')">' + icdText + '</a>';
  1254. html += ' </div>';
  1255. html += ' </div>';
  1256. }
  1257. }
  1258. var patientName = $("#patientName").text();
  1259. if (patientName == null || patientName == "") {
  1260. if (res.mzPatientMi != null) {
  1261. patientName = res.mzPatientMi.name;
  1262. } else {
  1263. patientName = patientId;
  1264. }
  1265. }
  1266. $("#patientHisData").text(patientName + "的");
  1267. if (($("#patientId").text() == null || $("#patientId").text() == "") && ($("#userName").val() == null || $("#userName").val() == "")) {
  1268. $("#patientHisDataForm").html(emptyHtml);
  1269. } else {
  1270. $("#patientHisDataForm").html(html);
  1271. }
  1272. } else {
  1273. errorMesage(res);
  1274. }
  1275. }
  1276. });
  1277. }
  1278. /**
  1279. * 设置主诉推荐
  1280. */
  1281. function fitSymptomData() {
  1282. fitRecommendData(12);
  1283. }
  1284. /**
  1285. * 设置现病史推荐
  1286. */
  1287. function fitEmrHpiData() {
  1288. fitRecommendData(5);
  1289. }
  1290. /**
  1291. * 设置既往史推荐
  1292. */
  1293. function fitEmrPsData() {
  1294. fitRecommendData(6);
  1295. }
  1296. /**
  1297. * 设置诊断推荐
  1298. */
  1299. function fitDiagnoseData() {
  1300. fitRecommendData(13);
  1301. }
  1302. /**
  1303. * 设置推荐通用方法
  1304. */
  1305. function fitRecommendData(paramsType) {
  1306. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  1307. if (!$("#" + popoverId).hasClass("in")) {
  1308. return;
  1309. }
  1310. var inputId = "symptom";
  1311. var text = "主诉";
  1312. if (paramsType == 5) {
  1313. inputId = "emrHpi";
  1314. text = "现病史";
  1315. } else if (paramsType == 6) {
  1316. inputId = "emrPs";
  1317. text = "既往史";
  1318. } else if (paramsType == 13) {
  1319. inputId = "diagnose";
  1320. text = "诊断";
  1321. }
  1322. //光标不在现病史上
  1323. if (document.activeElement.id != inputId) {
  1324. return;
  1325. }
  1326. $("#recommendType").html(text);
  1327. var emptyHtml = '<img src="/thmz/images/no-recommend.png" style="height: 120px;position: absolute;top: 50%;transform: translateY(-50%);margin-left: -30px;">';
  1328. $.ajax({
  1329. type: "GET",
  1330. url: '/thmz/getTCommonParamsByParamsType?paramsType=' + paramsType + '&commonParams=&pageSize=10',
  1331. contentType: "application/json;charset=UTF-8",
  1332. dataType: "json",
  1333. async: false,
  1334. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1335. success: function (res) {
  1336. if (res == '401' || res == 401) {
  1337. window.location.href = '/thmz/login/view'
  1338. return;
  1339. }
  1340. if (res.code == 0) {
  1341. var html = '';
  1342. var data = res.data;
  1343. if (data == null || data.length == 0) {
  1344. html += emptyHtml;
  1345. } else {
  1346. for (var i = 0; i < data.length; i++) {
  1347. var paramsContent = data[i].paramsContent;
  1348. html += ' <div class="item form-group thmz_alert" style="width: 100%;">';
  1349. html += ' <div style="margin-left: 10px;float: left;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 60px);" title="' + paramsContent + '">';
  1350. html += paramsContent;
  1351. html += ' </div>';
  1352. html += ' <div style="float: left;width: 36px;cursor: pointer;"';
  1353. html += ' onclick="fitAppeal(\'' + paramsContent + '\',' + paramsType + ',' + data[i].id + ')">';
  1354. html += ' <img';
  1355. html += ' src="/thmz/css/bootstrap/bootstrap-icons-1.5.0/cursor-fill.svg"';
  1356. html += ' style="margin-left: 10px!important;vertical-align: -.15em;margin-right: 10px!important;"/>';
  1357. html += ' </div>';
  1358. html += ' </div>';
  1359. }
  1360. }
  1361. $("#recommendForm").html(html);
  1362. } else {
  1363. errorMesage(res);
  1364. }
  1365. }
  1366. });
  1367. }
  1368. /**
  1369. * 设置医疗范文方法
  1370. */
  1371. function fitTemplateData() {
  1372. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  1373. if (!$("#" + popoverId).hasClass("in")) {
  1374. return;
  1375. }
  1376. 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;">';
  1377. $.ajax({
  1378. type: "GET",
  1379. url: '/thmz/getTemplate?templateKindType=' + $("#templateKindTypeForm").val() + '&templateType=' + $("#templateTypeForm").val(),
  1380. contentType: "application/json;charset=UTF-8",
  1381. dataType: "json",
  1382. async: false,
  1383. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1384. success: function (res) {
  1385. if (res == '401' || res == 401) {
  1386. window.location.href = '/thmz/login/view'
  1387. return;
  1388. }
  1389. if (res.code == 0) {
  1390. var html = '';
  1391. var data = res.data;
  1392. if (data == null || data.length == 0) {
  1393. html += emptyHtml;
  1394. } else {
  1395. for (var i = 0; i < data.length; i++) {
  1396. var template = data[i];
  1397. var icdText = (template.icdText == null || template.icdText == "") ? "无" : template.icdText;
  1398. html += ' <div class="item form-group thmz_alert" style="width: 100%;">';
  1399. html += ' <div title="' + template.name + '"';
  1400. html += ' style="margin-left: 10px!important;float: left;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: 100px;">';
  1401. html += template.name;
  1402. html += ' </div>';
  1403. html += ' <div style="float: left;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 160px);"';
  1404. html += ' title="' + template.icdText + '">诊断:<a';
  1405. html += ' style="cursor: pointer; color: #2e69eb;"';
  1406. html += ' onclick="medicalModelModal(' + template.id + ')">' + icdText + '</a>';
  1407. html += ' </div>';
  1408. html += ' <div style="float: left;width: 36px;cursor: pointer;" onclick="medicalModelModal(' + template.id + ')"><img';
  1409. html += ' src="/thmz/css/bootstrap/bootstrap-icons-1.5.0/cursor-fill.svg"';
  1410. html += ' style="margin-left: 10px!important;vertical-align: -.15em;margin-right: 10px!important;"/>';
  1411. html += ' </div>';
  1412. html += ' </div>';
  1413. }
  1414. }
  1415. $("#TemplateData").html(html);
  1416. } else {
  1417. errorMesage(res);
  1418. }
  1419. }
  1420. });
  1421. }
  1422. /**
  1423. * 清空快速接诊弹窗
  1424. */
  1425. function clearRapidAcceptsModal() {
  1426. $("#rapidAcceptsUserName").val(null);
  1427. $("#rapidAcceptsUserCode").val(null);
  1428. $("#patientIdDb").val(null);
  1429. $("#rapidAcceptsUserCardNo").val(null);
  1430. $("#rapidAcceptsUserGender").selectpicker('val', 0);
  1431. $("#rapidAcceptsUserGender").selectpicker('refresh');
  1432. $("#rapidAcceptsUserPhoneNum").val(null);
  1433. $('#rapidAcceptsUserCertificateType').selectpicker('val', '01');
  1434. $('#rapidAcceptsUserCertificateType').selectpicker('refresh');
  1435. $("#rapidAcceptsUserIdCard").val(null);
  1436. $("#rapidAcceptsUserIdCard").attr("title", null);
  1437. $("#rapidAcceptsUserPhoneNum").attr("title", null);
  1438. $('#rapidAcceptsProvinceCode').selectpicker('val', null);
  1439. $('#rapidAcceptsProvinceCode').selectpicker('refresh');
  1440. $('#rapidAcceptsCityCode').selectpicker('val', null);
  1441. $('#rapidAcceptsCityCode').selectpicker('refresh');
  1442. $('#rapidAcceptsDistrictCode').selectpicker('val', null);
  1443. $('#rapidAcceptsDistrictCode').selectpicker('refresh');
  1444. $("#rapidAcceptsDetail").val(null);
  1445. $("#rapidAcceptsDetail").attr("title", null);
  1446. $("#rapidAcceptsUserContact").val(null);
  1447. $("#rapidAcceptsUserContactPhone").val(null);
  1448. }
  1449. /**
  1450. * 清空接诊台用户信息
  1451. * @param flag 是否清空分诊流水哈 true 清空
  1452. */
  1453. function clearUser(flag) {
  1454. $("#patientName").html("");
  1455. $("#patientAge").html("");
  1456. $("#patientGender").html("");
  1457. $("#patientId").text(null);
  1458. $("#visitTimes").val(null);
  1459. $("#crbMainCard").css("display", "none");
  1460. $("#editUser").css("display", "none");
  1461. $("#clearUser").css("display", "none");
  1462. $("#discountLvCard").css("display", "none");
  1463. // $("#fetchSpcSlwinfo").css("display", "none");
  1464. $("#patientPhone").html("");
  1465. $("#patientPhoneLabel").hide();
  1466. $("#patientResponseType").html("");
  1467. $("#first").next().click();
  1468. $("#patientHisData").text("");
  1469. if (flag) {
  1470. $("#mzReqTypeName").text(null);
  1471. $("#mzReqType").val(null);
  1472. $('#mzOrderTypeSelect').val('1');
  1473. $('#mzOrderTypeSelect').selectpicker('refresh');
  1474. $("#transferTreatment").css("display", "none");
  1475. $("#consultation").css("display", "none");
  1476. $("#mzfzSerialNoInClick").val(null);
  1477. $("#mzfzReqTypeNoInClick").val(null);
  1478. $("#turnToConsultationIdInClick").val(null);
  1479. }
  1480. }
  1481. /**
  1482. * 卡号输入改变事件
  1483. */
  1484. function cardNoChange() {
  1485. if (window.ActiveXObject || "ActiveXObject" in window) {
  1486. $("#rapidAcceptsUserCardNo").on('input propertychange', function () {
  1487. queryUserInfoByCardNo();
  1488. });
  1489. } else {
  1490. $("#rapidAcceptsUserCardNo").on('input οninput', function () {
  1491. queryUserInfoByCardNo();
  1492. });
  1493. }
  1494. }
  1495. /**
  1496. * 刷新就诊列表
  1497. */
  1498. function refreshClinic() {
  1499. loadInClinicTableList();
  1500. loadClinicTableList();
  1501. fitPatientHisData();
  1502. }
  1503. /**
  1504. * 加载已接诊患者列表
  1505. */
  1506. function loadClinicTableList() {
  1507. //loadCommonClinicTableList("tb_table_clinic","/thmz/getClinicWithPage");
  1508. loadCommonClinicTableList("tb_table_clinic", queryParamsClinic);
  1509. }
  1510. /**
  1511. * 加载患者列表通用方法
  1512. * @param id
  1513. * @param queryParams
  1514. */
  1515. function loadCommonClinicTableList(id, queryParams) {
  1516. $('#' + id).bootstrapTable('refresh');
  1517. $('#' + id).bootstrapTable({
  1518. url: "/thmz/getClinicWithPage", //请求后台的URL(*)
  1519. method: 'post', //请求方式(*)
  1520. toolbar: '#toolbar', //工具按钮用哪个容器
  1521. striped: true, //是否显示行间隔色
  1522. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  1523. pagination: true, //是否显示分页(*)
  1524. sortable: true, //是否启用排序
  1525. sortOrder: "asc", //排序方式
  1526. queryParams: queryParams, //传递参数(*)
  1527. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  1528. pageNumber: 1, //初始化加载第一页,默认第一页
  1529. pageSize: 5, //每页的记录行数(*)
  1530. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  1531. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  1532. strictSearch: true,
  1533. showColumns: false, //是否显示所有的列
  1534. showRefresh: false, //是否显示刷新按钮
  1535. minimumCountColumns: 2, //最少允许的列数
  1536. clickToSelect: true, //是否启用点击选中行
  1537. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  1538. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  1539. cardView: false, //是否显示详细视图
  1540. detailView: false,
  1541. //rowStyle:rowStyle,//通过自定义函数设置行样式
  1542. ajaxOptions: {
  1543. headers: {
  1544. 'Accept': 'application/json',
  1545. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  1546. }
  1547. },
  1548. columns: [
  1549. {
  1550. field: 'patientName',
  1551. title: '姓名/性别/年龄',
  1552. align: "center",
  1553. valign: 'middle',
  1554. // sortable: true
  1555. formatter: function (value, row, index) {
  1556. var age = row.age;
  1557. if (age == null || age == "null") {
  1558. age = "";
  1559. }
  1560. return value + "/" + row.gender + "/" + age;
  1561. }
  1562. }, {
  1563. field: 'opDay',
  1564. title: '接诊时间',
  1565. align: "center",
  1566. valign: 'middle',
  1567. // sortable: true
  1568. formatter: function (value, row, index) {
  1569. return format(value, "MM/dd HH:mm");
  1570. }
  1571. }
  1572. , {
  1573. title: '操作',
  1574. align: "center",
  1575. valign: 'middle',
  1576. // sortable: true,
  1577. formatter: function (value, row, index) {
  1578. if (row.clinicStatus == 5) {
  1579. 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>';
  1580. // 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>';
  1581. } else if (row.clinicStatus == 6) {
  1582. 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>';
  1583. } else if (row.clinicStatus == 7) {
  1584. 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>';
  1585. }
  1586. }
  1587. }
  1588. ],
  1589. responseHandler: function (res) {
  1590. if (res == '401' || res == 401) {
  1591. window.location.href = '/thmz/login/view'
  1592. return;
  1593. }
  1594. var ress = eval(res);
  1595. if (ress.code == -1) {
  1596. new PNotify({
  1597. title: '错误提示',
  1598. text: ress.message,
  1599. type: 'error',
  1600. hide: false,
  1601. styling: 'bootstrap3'
  1602. });
  1603. return {
  1604. "total": 0,//总页数
  1605. "rows": {} //数据
  1606. };
  1607. }
  1608. return {
  1609. "total": ress.total,//总页数
  1610. "rows": ress.data //数据
  1611. };
  1612. },
  1613. onLoadSuccess: function (data) {
  1614. $(".pagination-detail").css("display", "none");
  1615. if (id == "tb_table_clinic") {
  1616. $("#ClinicNum").html(data.total);
  1617. } else {
  1618. $("#inClinicNum").html(data.total);
  1619. }
  1620. }
  1621. });
  1622. }
  1623. /**
  1624. * 得到查询的参数 接诊中
  1625. * @param params
  1626. * @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}}
  1627. */
  1628. function queryParamsInClinic(params) {
  1629. var temp = {
  1630. pageSize: params.limit,
  1631. pageIndex: params.offset / params.limit, //页码
  1632. statusFlagList: [8]
  1633. };
  1634. return temp;
  1635. };
  1636. /**
  1637. * 得到查询的参数
  1638. * @param params
  1639. * @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}}
  1640. */
  1641. function queryParamsClinic(params) {
  1642. var rePortRangeArr = getRePortRangeArr();
  1643. var commonParams = $("#userName").val();
  1644. var needDateParams = commonParams == null || commonParams == "null" || commonParams == "";
  1645. var temp = {
  1646. beginDate: needDateParams ? rePortRangeArr[0] : "2012-02-01 00:00:00" ,
  1647. endDate: needDateParams ? rePortRangeArr[1]: format(new Date(),"yyyy-MM-dd HH:mm:ss"),
  1648. commonParams: commonParams,
  1649. clinicStatuses: [5, 6, 7],
  1650. pageSize: params.limit,
  1651. offset: params.offset
  1652. };
  1653. return temp;
  1654. };
  1655. /**
  1656. * 加载待诊患者列表方法
  1657. */
  1658. function loadUnClinicTableList() {
  1659. loadCanClinicTableList("tb_table_un_clinic", queryParamsUnClinic);
  1660. }
  1661. /**
  1662. * 加载接诊中患者列表方法
  1663. */
  1664. function loadInClinicTableList() {
  1665. loadCanClinicTableList("tb_table_in_clinic", queryParamsInClinic);
  1666. }
  1667. /**
  1668. * 加载待诊和接诊中患者列表通用方法方法
  1669. */
  1670. function loadCanClinicTableList(id, queryParams) {
  1671. $('#' + id).bootstrapTable('refresh');
  1672. $('#' + id).bootstrapTable({
  1673. url: "/thmz/getUnClinicWithPage", //请求后台的URL(*)
  1674. method: 'post', //请求方式(*)
  1675. toolbar: '#toolbar', //工具按钮用哪个容器
  1676. striped: true, //是否显示行间隔色
  1677. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  1678. pagination: true, //是否显示分页(*)
  1679. sortable: true, //是否启用排序
  1680. sortOrder: "asc", //排序方式
  1681. queryParams: queryParams, //传递参数(*)
  1682. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  1683. pageNumber: 1, //初始化加载第一页,默认第一页
  1684. pageSize: 5, //每页的记录行数(*)
  1685. pageList: [2, 5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  1686. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  1687. strictSearch: true,
  1688. showColumns: false, //是否显示所有的列
  1689. showRefresh: false, //是否显示刷新按钮
  1690. minimumCountColumns: 2, //最少允许的列数
  1691. clickToSelect: true, //是否启用点击选中行
  1692. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  1693. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  1694. cardView: false, //是否显示详细视图
  1695. detailView: false,
  1696. //rowStyle:rowStyle,//通过自定义函数设置行样式
  1697. ajaxOptions: {
  1698. headers: {
  1699. 'Accept': 'application/json',
  1700. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  1701. }
  1702. },
  1703. columns: [
  1704. {
  1705. field: 'name',
  1706. title: '姓名/性别/年龄',
  1707. align: "center",
  1708. valign: 'middle',
  1709. // sortable: true
  1710. formatter: function (value, row, index) {
  1711. return value + "/" + row.gender + "/" + row.age;
  1712. }
  1713. }, {
  1714. field: 'visitDate',
  1715. title: '分诊时间',
  1716. align: "center",
  1717. valign: 'middle',
  1718. // sortable: true
  1719. formatter: function (value, row, index) {
  1720. return format(value, "MM/dd HH:mm");
  1721. }
  1722. }
  1723. , {
  1724. title: '操作',
  1725. align: "center",
  1726. valign: 'middle',
  1727. // sortable: true,
  1728. formatter: function (value, row, index) {
  1729. if (row.statusFlag == 0) {
  1730. return '<a title="接诊" onclick="clinicalReception(\'' + row.patientId + '\',\'' + row.serialNo + '\',' + row.reqType + ')" style="cursor: pointer">接诊</a>';
  1731. } else if (row.statusFlag == 8) {
  1732. //TODO 继续接诊需要新方法
  1733. 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>';
  1734. } else if (row.statusFlag == 1 || row.statusFlag == 2 || row.statusFlag == 3) {
  1735. var userIdCode = localStorage.getItem("userIdCode");
  1736. if (userIdCode === row.doctorCode) {
  1737. 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>';
  1738. }
  1739. return '<a title="接诊" onclick="clinicalReception(\'' + row.patientId + '\',\'' + row.serialNo + '\',' + row.reqType + ')" style="cursor: pointer">接诊</a>';
  1740. }
  1741. }
  1742. }
  1743. ],
  1744. responseHandler: function (res) {
  1745. if (res == '401' || res == 401) {
  1746. window.location.href = '/thmz/login/view'
  1747. return;
  1748. }
  1749. var ress = eval(res);
  1750. if (ress.code == -1) {
  1751. new PNotify({
  1752. title: '错误提示',
  1753. text: ress.message,
  1754. type: 'error',
  1755. hide: false,
  1756. styling: 'bootstrap3'
  1757. });
  1758. return {
  1759. "total": 0,//总页数
  1760. "rows": {} //数据
  1761. };
  1762. }
  1763. return {
  1764. "total": ress.total,//总页数
  1765. "rows": ress.data //数据
  1766. };
  1767. },
  1768. onLoadSuccess: function (data) {
  1769. $(".pagination-detail").css("display", "none");
  1770. $("#unClinicNum").html(data.total);
  1771. }
  1772. });
  1773. }
  1774. /**
  1775. * 得到查询的参数
  1776. * @param params
  1777. * @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}}
  1778. */
  1779. function queryParamsUnClinic(params) {
  1780. var temp = {
  1781. pageSize: params.limit,
  1782. pageIndex: params.offset / params.limit, //页码
  1783. statusFlagList: [0, 1, 2, 3]
  1784. };
  1785. return temp;
  1786. };
  1787. /**
  1788. * 通知叫号
  1789. * @param serialNo
  1790. */
  1791. function clinicCallNumber(serialNo) {
  1792. $.ajax({
  1793. type: "GET",
  1794. url: '/thmz/clinicCallNumber?serialNo=' + serialNo,
  1795. contentType: "application/json;charset=UTF-8",
  1796. dataType: "json",
  1797. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1798. success: function (res) {
  1799. if (res == '401' || res == 401) {
  1800. window.location.href = '/thmz/login/view'
  1801. return;
  1802. }
  1803. if (res.code == 0) {
  1804. successMesage(res);
  1805. } else {
  1806. errorMesage(res);
  1807. }
  1808. }
  1809. });
  1810. }
  1811. /**
  1812. * 接诊方法
  1813. * @param patientId 门诊id
  1814. * @param serialNo 分诊流水号
  1815. * @param reqType 号表类别
  1816. */
  1817. function clinicalReception(patientId, serialNo, reqType) {
  1818. var existPatientId = $("#patientId").text();
  1819. if (existPatientId != null && existPatientId != "" && existPatientId != patientId) {
  1820. $("#messageModal").modal();
  1821. $("#messageContent").html("当前有病人正在接诊,是否切换?");
  1822. $("#messageButton").off("click").on("click", function (t) {
  1823. $("#messageModal").modal("hide");
  1824. //当前有人在接诊,提示是否需要切换和保存
  1825. $("#messagePrescriptionModal").modal();
  1826. $("#confirmPrescriptionButton").off("click").on("click", function (t) {
  1827. $("#messagePrescriptionModal").modal("hide");
  1828. //先保存目前接诊信息,再切换就诊人
  1829. var jsonData = getParamsForpPrescription(1);
  1830. $.ajax({
  1831. type: "POST",
  1832. url: '/thmz/savePrescription',
  1833. contentType: "application/json;charset=UTF-8",
  1834. dataType: "json",
  1835. data: JSON.stringify(jsonData),
  1836. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1837. success: function (res) {
  1838. if (res == '401' || res == 401) {
  1839. window.location.href = '/thmz/login/view'
  1840. return;
  1841. }
  1842. if (res.code == 0) {
  1843. clearWorkSpace();
  1844. realClinicalReception(patientId, serialNo, reqType);
  1845. //加载已接诊患者列表
  1846. loadClinicTableList();
  1847. } else {
  1848. errorMesage(res);
  1849. }
  1850. }
  1851. });
  1852. });
  1853. $("#cancelPrescriptionButton").off("click").on("click", function (t) {
  1854. $("#messagePrescriptionModal").modal("hide");
  1855. clearWorkSpace();
  1856. realClinicalReception(patientId, serialNo, reqType);
  1857. });
  1858. });
  1859. $("#cancelButton").off("click");
  1860. } else {
  1861. realClinicalReception(patientId, serialNo, reqType);
  1862. }
  1863. }
  1864. /**
  1865. * 取消接诊
  1866. * @param patientId
  1867. */
  1868. function cancelClinic(patientId, times) {
  1869. $("#messageModal").modal();
  1870. $("#messageContent").html("确认取消当前病人的接诊记录吗?");
  1871. $("#messageButton").off("click").on("click", function (t) {
  1872. $("#messageModal").modal("hide");
  1873. $.ajax({
  1874. type: "GET",
  1875. url: '/thmz/cancelClinic?patientId=' + patientId + "&times=" + times,
  1876. contentType: "application/json;charset=UTF-8",
  1877. dataType: "json",
  1878. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1879. success: function (res) {
  1880. if (res == '401' || res == 401) {
  1881. window.location.href = '/thmz/login/view'
  1882. return;
  1883. }
  1884. if (res.code == 0) {
  1885. if (res.data == null || res.data.length == 0) {
  1886. return;
  1887. }
  1888. successMesage(res);
  1889. if (times > 0) {
  1890. loadUnClinicTableList();
  1891. loadInClinicTableList();
  1892. clearWorkSpace();
  1893. }
  1894. } else if (res.code == -1) {
  1895. errorMesage(res);
  1896. }
  1897. }
  1898. });
  1899. });
  1900. $("#cancelButton").off("click");
  1901. };
  1902. /**
  1903. * 设置当前接诊病人信息
  1904. * @param mzPatientMi
  1905. */
  1906. function setMzPatientInfo(mzPatientMi) {
  1907. $.ajax({
  1908. type: "GET",
  1909. url: '/thmz/getDeptNoByCurrentPatientId?patientId=' + mzPatientMi.patientId,
  1910. contentType: "application/json;charset=UTF-8",
  1911. dataType: "json",
  1912. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1913. success: function (res) {
  1914. if (res == '401' || res == 401) {
  1915. window.location.href = '/thmz/login/view'
  1916. return;
  1917. }
  1918. if (res.code == 0) {
  1919. //当前患者就诊科室编码
  1920. localStorage.setItem("currentDeptNo", res.data);
  1921. } else if (res.code == -1) {
  1922. errorMesage(res);
  1923. }
  1924. }
  1925. });
  1926. $("#patientName").html(mzPatientMi.name);
  1927. //var age = getAge(mzPatientMi);
  1928. $("#patientAge").html(mzPatientMi.ageString);
  1929. setVisitTypeName(mzPatientMi.patientId);
  1930. $("#visitTimes").val(mzPatientMi.times);
  1931. $("#patientGender").html(mzPatientMi.gender);
  1932. $("#patientId").text(mzPatientMi.patientId);
  1933. $("#crbMainCard").css("display", "inline-block");
  1934. $("#editUser").css("display", "inline-block");
  1935. $("#clearUser").css("display", "inline-block");
  1936. if (mzPatientMi.phoneNo != null && mzPatientMi.phoneNo != '') {
  1937. $("#patientPhone").html(mzPatientMi.phoneNo);
  1938. $("#patientPhoneLabel").show();
  1939. } else {
  1940. $("#patientPhoneLabel").hide();
  1941. }
  1942. $("#patientResponseType").html(mzPatientMi.responseTypeName);
  1943. if (mzPatientMi.times == 1) {
  1944. $("#first").next().click();
  1945. } else {
  1946. $("#not").next().click();
  1947. }
  1948. $("#patientHisData").text(mzPatientMi.name);
  1949. fitPatientHisData();
  1950. // setTmResponseType(mzPatientMi.patientId);
  1951. }
  1952. //设置病人身份
  1953. function setVisitTypeName(patientId) {
  1954. if(stringIsBlank(patientId)){
  1955. return
  1956. }
  1957. postAjaxJsonHttpRequst("/thmz/queryVisitTypeName",{patientId:patientId},true,function (res) {
  1958. if(res.code ==0){
  1959. $("#patientVisitType").text(res.data);
  1960. if(!stringIsBlank(res.data)){
  1961. $("#discountLvCard").css("display", "inline-block");
  1962. }
  1963. }
  1964. $("#crmType").text(res.crmTypeName);
  1965. })
  1966. }
  1967. /**
  1968. * 判断是否是特门病人
  1969. * @param patientId
  1970. */
  1971. function setTmResponseType(patientId) {
  1972. postAjaxJsonHttpRequst("/thmz/fetchSpcSlwinfo",{"patientId":patientId,"admdvs":"","readCardResult":""},true,function (res) {
  1973. if (res == '401' || res == 401) {
  1974. window.location.href = '/thmz/login/view'
  1975. return;
  1976. }
  1977. if (res.code == 0) {
  1978. if (res.data != null && res.data.length > 0) {
  1979. $("#patientResponseType").html("特殊门诊");
  1980. $("#fetchSpcSlwinfo").css("display", "inline-block");
  1981. }
  1982. }
  1983. })
  1984. }
  1985. //删除股东卡身份
  1986. // function deleteShareholderCard() {
  1987. // let patientId = $("#patientId").text();
  1988. // if(stringIsBlank(patientId)){
  1989. // errorMesageSimaple("请先选择就诊病人")
  1990. // return
  1991. // }
  1992. // postAjaxJsonHttpRequst("/thmz/deleteShareholderCard",{patientId:patientId},true,function (res) {
  1993. // if(res.code ==0){
  1994. // $("#patientVisitType").text("");
  1995. // successMesageSimaple(res.message)
  1996. // }else {
  1997. // errorMesage(res)
  1998. // }
  1999. // })
  2000. // }
  2001. //慢病建档
  2002. function cmrCreate() {
  2003. $.ajax({
  2004. type: "GET",
  2005. url: '/thmz/getMzjsdHost',
  2006. dataType: "json",
  2007. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2008. success: function (res) {
  2009. if (res == '401' || res == 401) {
  2010. window.location.href = '/thmz/login/view'
  2011. return;
  2012. }
  2013. if (res.code == 0) {
  2014. let patientId = $("#patientId").text();
  2015. if(stringIsBlank(patientId)){
  2016. return errorMesageSimaple('门诊号不能为空,请先接诊')
  2017. }
  2018. getAjaxRequst("/thmz/getByPatientId",{patientId:patientId},true,function (ress) {
  2019. if(ress.code ==0){
  2020. let cmrType ;
  2021. let userIdCode = localStorage.getItem("userIdCode");
  2022. if(stringIsBlank($("#crmType").text())){
  2023. cmrType = '2'
  2024. }else {
  2025. cmrType = '1'
  2026. }
  2027. window.open(`${res.data}/outpatient/chronicDisease/chronicDiseaseRegister?socialNo=${ress.data.socialNo}&type=${cmrType}&userCode=${userIdCode}`, '_blank');
  2028. }
  2029. })
  2030. }
  2031. }
  2032. });
  2033. }
  2034. var curOpspDiseCode =null;
  2035. var curOpspDiseName =null;
  2036. function openFetchSpcSlwinfoModal() {
  2037. $("#fetchSpcSlwinfoModal").modal();
  2038. $("#fetchSpcSlwinfoTable").html(null);
  2039. clearOpspDiseData();
  2040. }
  2041. /**
  2042. * 清除特门数据
  2043. */
  2044. function clearOpspDiseData() {
  2045. curOpspDiseCode =null;
  2046. curOpspDiseName =null;
  2047. visitMtCardResult = null;
  2048. }
  2049. /**
  2050. * 关闭门特窗口
  2051. */
  2052. function closeFetchSpcSlwinfoModal() {
  2053. $("#fetchSpcSlwinfoModal").modal("hide");
  2054. clearOpspDiseData();
  2055. }
  2056. /**
  2057. * 特门详情
  2058. * @param patientId
  2059. */
  2060. function fetchSpcSlwinfo() {
  2061. let patientId = $("#patientId").text();
  2062. let visitAdvmCity = $("#visitAdvmCity").val();
  2063. postAjaxJsonHttpRequst("/thmz/fetchSpcSlwinfo",{"patientId":patientId,"admdvs":visitAdvmCity,"readCardResult":visitMtCardResult},true,function (res) {
  2064. if (res == '401' || res == 401) {
  2065. window.location.href = '/thmz/login/view'
  2066. return;
  2067. }
  2068. if (res.code == 0) {
  2069. if (res.data == null || res.data.length == 0 ){
  2070. errorMesageSimaple("该患者没有特门信息");
  2071. }
  2072. if (res.data != null && res.data.length > 0) {
  2073. for (var i = 0; i < res.data.length; i++) {
  2074. var begndate = res.data[i].begndate;
  2075. if (begndate == null || begndate == "null") {
  2076. begndate = "";
  2077. }
  2078. var enddate = res.data[i].enddate;
  2079. if (enddate == null || enddate == "null") {
  2080. enddate = "";
  2081. }
  2082. var opspDiseName = res.data[i].opspDiseName;
  2083. if (opspDiseName == null || opspDiseName == "null") {
  2084. opspDiseName = "";
  2085. }
  2086. var opspDiseCode = res.data[i].opspDiseCode;
  2087. if (opspDiseCode == null || opspDiseCode == "null") {
  2088. opspDiseCode = "";
  2089. }
  2090. var ideFixmedinsName = res.data[i].ideFixmedinsName;
  2091. if (ideFixmedinsName == null || ideFixmedinsName == "null") {
  2092. ideFixmedinsName = "";
  2093. }
  2094. $("<tr data-target-opspDiseCode='" + opspDiseCode + "' data-target-opspDiseName='" + opspDiseName + "' data-target-ideFixmedinsName='" + ideFixmedinsName + "'><td>" + begndate + "</td><td>" + enddate + "</td><td>" + opspDiseCode + "</td><td>" + opspDiseName + "</td><td>" + ideFixmedinsName + "</td></tr>").appendTo("#fetchSpcSlwinfoTable").bind('click',function () {
  2095. $("#fetchSpcSlwinfoModal").modal("hide");
  2096. curOpspDiseCode = $(this).attr("data-target-opspDiseCode");
  2097. curOpspDiseName = $(this).attr("data-target-opspDiseName");
  2098. //设置特殊门诊值
  2099. $("#mzOrderTypeSelect").val('3')
  2100. $('#mzOrderTypeSelect').selectpicker('refresh');
  2101. });
  2102. }
  2103. } else {
  2104. errorMesage(res);
  2105. }
  2106. } else {
  2107. errorMesage(res);
  2108. }
  2109. })
  2110. }
  2111. function initAdvmPro(proId) {
  2112. getAjaxRequst("/thmz/queryProvinceCodes",{},true,function (res) {
  2113. if(res.code == 0 && res.data !=null && res.data.length > 0){
  2114. let selectHtml = '';
  2115. for (let i=0 ; i <res.data.length; i++ ){
  2116. selectHtml+= `<option value="${res.data[i].code}">${res.data[i].code} ${res.data[i].name}</option>`
  2117. }
  2118. $('#'+proId).html(selectHtml);
  2119. $('#'+proId).selectpicker('refresh');
  2120. $('#'+proId).val(430000);
  2121. $('#'+proId).selectpicker('refresh');
  2122. cityChange('visitAdvmPro','visitAdvmCity',430100)
  2123. }
  2124. })
  2125. }
  2126. function cityChange(proId,cityId,defalultVal) {
  2127. let code = $('#'+proId).val()
  2128. postAjaxJsonHttpRequst("/thmz/queryCityCodes",{code:code},true,function (res) {
  2129. if(res.code == 0 && res.data !=null && res.data.length > 0){
  2130. let selectHtml = '';
  2131. for (let i=0 ; i <res.data.length; i++ ){
  2132. selectHtml+= `<option value="${res.data[i].code}">${res.data[i].code} ${res.data[i].name}</option>`
  2133. }
  2134. $('#'+cityId).html(selectHtml);
  2135. $('#'+cityId).selectpicker('refresh');
  2136. if(!stringIsBlank(defalultVal)){
  2137. $('#'+cityId).val(defalultVal);
  2138. $('#'+cityId).selectpicker('refresh');
  2139. }
  2140. }
  2141. })
  2142. }
  2143. var visitMtCardResult = null;
  2144. function readVisitPatientCard() {
  2145. $.ajax({
  2146. type: "GET",
  2147. url: 'http://localhost:8321/readcard/entry?param=qrcode_01101',
  2148. contentType: "application/json;charset=UTF-8",
  2149. dataType: "json",
  2150. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2151. success: function (res) {
  2152. if (res == '401' || res == 401) {
  2153. window.location.href = '/thmz/login/view'
  2154. return;
  2155. }
  2156. if (res.code == 200) {
  2157. visitMtCardResult = res.data
  2158. fetchSpcSlwinfo()
  2159. } else {
  2160. errorMesage(res);
  2161. }
  2162. }
  2163. });
  2164. }
  2165. /**
  2166. * 初诊的时候设置患者生命体征
  2167. * @param res
  2168. */
  2169. function setMzSmtz(res) {
  2170. var mzYshTzxx = res.mzYshTzxx;
  2171. if (mzYshTzxx != null) {
  2172. if (mzYshTzxx.valueTz != null) {
  2173. $("#weight").val(mzYshTzxx.valueTz);
  2174. }
  2175. if (mzYshTzxx.valueTw != null) {
  2176. $("#temperature").val(mzYshTzxx.valueTw);
  2177. }
  2178. if (mzYshTzxx.valueMb != null) {
  2179. $("#sphygmus").val(mzYshTzxx.valueMb);
  2180. }
  2181. if (mzYshTzxx.valueHx != null) {
  2182. $("#breathe").val(mzYshTzxx.valueHx);
  2183. }
  2184. if (mzYshTzxx.valueSsy != null) {
  2185. $("#pressure_high").val(mzYshTzxx.valueSsy);
  2186. }
  2187. if (mzYshTzxx.valueSzy != null) {
  2188. $("#pressure_floor").val(mzYshTzxx.valueSzy);
  2189. }
  2190. }
  2191. }
  2192. /**
  2193. * 真实的接诊方法
  2194. * @param patientId
  2195. * @param serialNo 分诊流水号
  2196. * @param reqType 号表类别
  2197. */
  2198. function realClinicalReception(patientId, serialNo, reqType) {
  2199. var turnToConsultationIdInClick = $("#turnToConsultationIdInClick").val();
  2200. if (turnToConsultationIdInClick == null || turnToConsultationIdInClick == "null") {
  2201. turnToConsultationIdInClick = 0;
  2202. }
  2203. var userIdCode = localStorage.getItem("userIdCode");
  2204. var deptNo = localStorage.getItem(userIdCode);
  2205. if (deptNo == null) {
  2206. deptNo = "";
  2207. }
  2208. $.ajax({
  2209. type: "GET",
  2210. url: '/thmz/saveClinic?patientId=' + patientId + "&serialNo=" + serialNo + "&turnToConsultationId=" + turnToConsultationIdInClick + "&deptNo=" + deptNo,
  2211. contentType: "application/json;charset=UTF-8",
  2212. dataType: "json",
  2213. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2214. success: function (res) {
  2215. if (res == '401' || res == 401) {
  2216. window.location.href = '/thmz/login/view'
  2217. return;
  2218. }
  2219. if (res.code == 0) {
  2220. if (res.data != null) {
  2221. setMzReqType(null,null,reqType);
  2222. var mzPatientMi = res.data;
  2223. setMzPatientInfo(mzPatientMi);
  2224. setMzSmtz(res);
  2225. $("#mzfzSerialNoInClick").val(serialNo);
  2226. $("#mzfzReqTypeNoInClick").val(reqType);
  2227. //有分诊流水号 且 不是简易门诊 或 会诊目标科室接诊
  2228. if (serialNo != null && serialNo != "null") {
  2229. if (!(reqType == "16" || reqType == 16 || reqType == -200)) {
  2230. $("#transferTreatment").css("display", "inline-block");
  2231. }
  2232. $("#consultation").css("display", "inline-block");
  2233. }
  2234. //加载候诊患者列表
  2235. loadUnClinicTableList();
  2236. //加载接诊中患者列表
  2237. loadInClinicTableList();
  2238. //查询患者的门诊统筹信息
  2239. queryInsuinfo(patientId);
  2240. }
  2241. } else {
  2242. errorMesage(res);
  2243. }
  2244. }
  2245. });
  2246. }
  2247. /**
  2248. * 查询患者的门诊统筹信息
  2249. * @param patientId
  2250. */
  2251. function queryInsuinfo(patientId) {
  2252. getAjaxRequst("/thmz/queryInsuinfo",{patientId: patientId},true,function (insurRes) {
  2253. if(insurRes.code == 0){
  2254. var ybCode = localStorage.getItem("ybCode");
  2255. if(ybCode !=null && ybCode !="" && ybCode.length > 0){
  2256. $("#zgmztczf").selectpicker('val',1);
  2257. $("#zgmztczf").selectpicker('refresh');
  2258. if($("#mzOrderTypeSelect").val() !='4'){
  2259. $("#mzOrderTypeSelect").selectpicker('val','2');
  2260. $("#mzOrderTypeSelect").selectpicker('refresh');
  2261. }else {
  2262. $("#zgmztczf").selectpicker('val',0);
  2263. $("#zgmztczf").selectpicker('refresh');
  2264. }
  2265. postAjaxJsonHttpRequst("/thmz/queryVisitTypeName",{patientId:patientId},true,function (res) {
  2266. if(res.code ==0){
  2267. if(!stringIsBlank(res.data)){
  2268. warningMesageSimaple("该患者为股东卡用户,选择医保门诊统筹将不能享受股东卡优惠,请告知患者,请悉知!")
  2269. }
  2270. }
  2271. })
  2272. }else {
  2273. $("#zgmztczf").selectpicker('val',0);
  2274. $("#zgmztczf").selectpicker('refresh');
  2275. }
  2276. }else if(insurRes.code == -1){
  2277. errorMesageSimaple(insurRes.message);
  2278. }else if(insurRes.code == -2){
  2279. warningMesageSimaple(insurRes.message);
  2280. }
  2281. })
  2282. }
  2283. /**
  2284. * 读医保电子凭证
  2285. * @param asyncFlag true 异步 false 同步
  2286. * @param params
  2287. */
  2288. function mztczfSiReadCard(asyncFlag, params) {
  2289. mztczfSiReadCardStatus = true;
  2290. $.ajax({
  2291. type: "GET",
  2292. url: 'http://localhost:8321/readcard/entry?param=' + params,
  2293. contentType: "application/json;charset=UTF-8",
  2294. dataType: "json",
  2295. async: asyncFlag,
  2296. headers: {
  2297. 'Accept': 'application/json',
  2298. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  2299. },
  2300. success: function (res) {
  2301. mztczfSiReadCardStatus = false;
  2302. if (res == '401' || res == 401) {
  2303. window.location.href = '/thmz/login/view'
  2304. return;
  2305. }
  2306. //console.log(res);
  2307. if (res.code == 200) {
  2308. var data = JSON.parse(res.data);
  2309. $("#readCardResult").val(JSON.stringify(data.data));
  2310. $("#messageContent").html("读卡成功,是否保存处方?");
  2311. } else {
  2312. $("#messageContent").html("读卡失败,是否保存处方(不享受门诊统筹)?");
  2313. errorMesage(res);
  2314. }
  2315. },
  2316. error: function (XMLHttpRequest, textStatus, errorThrown) {
  2317. mztczfSiReadCardStatus = false;
  2318. $("#messageContent").html("读卡异常,是否保存处方(不享受门诊统筹)?");
  2319. }
  2320. });
  2321. }
  2322. /**
  2323. * 实际读医保电子凭证
  2324. * @param asyncFlag true 异步 false 同步
  2325. */
  2326. function realMztczfSiReadCard(asyncFlag) {
  2327. }
  2328. /**
  2329. * 清空工作台
  2330. */
  2331. function clearWorkSpace() {
  2332. clearUser(true);
  2333. clearWorkSpaceExcludeUser(1);
  2334. }
  2335. /**
  2336. * 清空工作台除了用户信息
  2337. * @param source 1 清空工作台 2 调用模板 3 调用历史处方
  2338. */
  2339. function clearWorkSpaceExcludeUser(source) {
  2340. var conciseRecordsFlag = false;
  2341. if (source == 2) {
  2342. conciseRecordsFlag = $("#conciseRecordsYlfw").prop("checked");
  2343. } else if (source == 3) {
  2344. conciseRecordsFlag = $("#conciseRecordsJzxq").prop("checked");
  2345. }
  2346. if (source == 1 || conciseRecordsFlag) {
  2347. $("#symptom").val(null);
  2348. $("#emrHpi").val(null);
  2349. $("#emrPs").val(null);
  2350. $("#personalHistory").val(null);
  2351. $("#familyHistory").val(null);
  2352. $("#fzZl").val(null);
  2353. $("#obstericalHistory").val(null);
  2354. $("#weight").val(null);
  2355. $("#temperature").val(null);
  2356. $("#sphygmus").val(null);
  2357. $("#breathe").val(null);
  2358. $("#pressure_high").val(null);
  2359. $("#pressure_floor").val(null);
  2360. $("#pressure_high_left").val(null);
  2361. $("#pressure_floor_left").val(null);
  2362. $("#tentativeDiagnosis").val(null);
  2363. $("#otherCheck").val(null);
  2364. $("#diagnoseValue").val(null);
  2365. $("#diagnoseTags").html(null);
  2366. $("#healthEducation").val(null);
  2367. $("#zdAllergen").selectpicker('val', null);
  2368. $("#zdAllergen").selectpicker('refresh');
  2369. $("#ypDitList").selectpicker('val', null);
  2370. $("#ypDitList").selectpicker('refresh');
  2371. }
  2372. //清空工作台的时候需要调用
  2373. if (source == 1) {
  2374. clearWesternMedicine(true);
  2375. clearChineseMedicine();
  2376. clearJyJcItem();
  2377. clearZlItem();
  2378. clearZyReq();
  2379. //initNavTabs(0);
  2380. clearNavTabs(0);
  2381. clearNavTabs(1);
  2382. clearNavTabs(2);
  2383. clearNavTabs(3);
  2384. clearNavTabs(4);
  2385. clearNavTabs(5);
  2386. clearApidAcceptsModal();
  2387. clearTurnToConsultationInput();
  2388. clearZgtczfInput();
  2389. clearOpspDiseData();
  2390. clearExpContentRequired();
  2391. gropuIdAndOrderNoMap = null;
  2392. //prevCategoriesFlag = null;
  2393. initGroupOrder();
  2394. localStorage.removeItem("currentDeptNo");
  2395. getResultUrl = null;
  2396. }
  2397. $("#totalAmount").text(0);
  2398. }
  2399. /**
  2400. * 构造西药处方详情和模板预览方法
  2401. * @param pyPrescription
  2402. * @param contentId 内容ID
  2403. * @param titleId 标题ID
  2404. * @param checkBox 是否需要增加ckeckBox
  2405. */
  2406. function fitxyContent(pyPrescription, contentId, titleId, checkBox) {
  2407. if (pyPrescription != null && pyPrescription.length > 0) {
  2408. var xypyHtml = "";
  2409. for (var i = 0; i < pyPrescription.length; i++) {
  2410. var py = pyPrescription[i];
  2411. if (py == null || py.length == 0) {
  2412. continue;
  2413. }
  2414. var detail = py.detail;
  2415. if (detail == null || detail.length == 0) {
  2416. continue;
  2417. }
  2418. for (var j = 0; j < detail.length; j++) {
  2419. var pyDetail = detail[j];
  2420. if (checkBox) {
  2421. xypyHtml += "<div style='cursor: pointer;' data-id='" + pyDetail.orderCode + "'>";
  2422. xypyHtml += "<input type='checkbox'/>";
  2423. xypyHtml += "<span onclick='rowDataClick(this)'>";
  2424. } else {
  2425. xypyHtml += "<div>";
  2426. }
  2427. xypyHtml += "<span style='color: red;'>" + pyDetail.groupOrder + "." + "</span>";
  2428. xypyHtml += pyDetail.name;
  2429. xypyHtml += " ";
  2430. xypyHtml += pyDetail.specification;
  2431. xypyHtml += " X ";
  2432. xypyHtml += pyDetail.quantity;
  2433. xypyHtml += pyDetail.packUnit;
  2434. xypyHtml += " 用法: ";
  2435. xypyHtml += pyDetail.supplyName;
  2436. xypyHtml += " ";
  2437. xypyHtml += pyDetail.drugQuan;
  2438. xypyHtml += pyDetail.unitDesc;
  2439. xypyHtml += " ";
  2440. xypyHtml += pyDetail.frequency;
  2441. xypyHtml += " ";
  2442. xypyHtml += pyDetail.orderDays;
  2443. xypyHtml += "天 ";
  2444. if (pyDetail.tryFlag != undefined && pyDetail.tryFlag != null && pyDetail.tryFlag != "null" && pyDetail.tryFlag != "") {
  2445. xypyHtml += pyDetail.tryFlag;
  2446. } else if (pyDetail.tryResult != undefined && pyDetail.tryResult != null && pyDetail.tryResult != "null" && pyDetail.tryResult != "") {
  2447. xypyHtml += pyDetail.tryResult;
  2448. }
  2449. if (checkBox) {
  2450. xypyHtml += "</span>";
  2451. }
  2452. xypyHtml += "</div>";
  2453. }
  2454. }
  2455. afterFitContent(contentId, xypyHtml, titleId);
  2456. } else {
  2457. $("#" + titleId).removeClass("in").addClass("hide");
  2458. $("#" + contentId).html("");
  2459. }
  2460. }
  2461. /**
  2462. * 构造中药处方详情和模板预览方法
  2463. * @param zyPrescription
  2464. * @param contentId 内容ID
  2465. * @param titleId 标题ID
  2466. * @param checkBox 是否需要增加ckeckBox
  2467. */
  2468. function fitzyContent(zyPrescription, contentId, titleId, checkBox) {
  2469. if (zyPrescription == null || zyPrescription.length == 0) {
  2470. $("#" + titleId).removeClass("in").addClass("hide");
  2471. $("#" + contentId).html("");
  2472. return;
  2473. }
  2474. var zyDetail = zyPrescription[0];
  2475. if (zyDetail == null || zyDetail.length == 0) {
  2476. $("#" + titleId).removeClass("in").addClass("hide");
  2477. $("#" + contentId).html("");
  2478. return;
  2479. }
  2480. var detail = zyDetail.detail;
  2481. if (detail == null || detail.length == 0) {
  2482. $("#" + titleId).removeClass("in").addClass("hide");
  2483. $("#" + contentId).html("");
  2484. return;
  2485. }
  2486. var zypyHtml = "";
  2487. for (var i = 0; i < detail.length; i++) {
  2488. //zypyHtml += '<div class="item form-group" style="margin-bottom: -5px;">';
  2489. var zy = detail[i];
  2490. if (zy == null || zy.length == 0) {
  2491. continue;
  2492. }
  2493. if (checkBox) {
  2494. zypyHtml += "<div class=\"col-md-3 col-sm-3 col-xs-12\" style='cursor: pointer;' data-id='" + zy.orderCode + "'>";
  2495. zypyHtml += "<input type='checkbox'/>";
  2496. zypyHtml += "<span onclick='rowDataClick(this)'>";
  2497. } else {
  2498. zypyHtml += "<div class=\"col-md-3 col-sm-3 col-xs-12\">";
  2499. }
  2500. zypyHtml += zy.name;
  2501. if(zy.spec){
  2502. zypyHtml += "("+zy.spec+")";
  2503. }
  2504. var instructionText = zy.instructionText;
  2505. if (instructionText != null && instructionText != "") {
  2506. zypyHtml += "[";
  2507. zypyHtml += instructionText;
  2508. zypyHtml += "]";
  2509. }
  2510. zypyHtml += zy.quantity;
  2511. if(zyDetail.groupNo =='83'){
  2512. zypyHtml += "袋";
  2513. }else {
  2514. zypyHtml += "g";
  2515. }
  2516. if (checkBox) {
  2517. zypyHtml += "</span>";
  2518. }
  2519. zypyHtml += "</div>";
  2520. // if (i % 4 == 0) {
  2521. // zypyHtml += '</div>';
  2522. // }
  2523. }
  2524. // if(detail.length%4!=0){
  2525. // for(var i=0;i<4-(detail.length%4);i++){
  2526. // zypyHtml += "<div class=\"col-md-3 col-sm-3 col-xs-12\"></div>";
  2527. // }
  2528. // }
  2529. var zyfs = zyDetail.zyfs;
  2530. if (zyfs != null && zyfs != "") {
  2531. zypyHtml += " <div class=\"col-md-12 col-sm-12 col-xs-12\">";
  2532. zypyHtml += ' <div style="text-indent: 2em;">';
  2533. zypyHtml += ' <div>';
  2534. zypyHtml += 'x<span>';
  2535. zypyHtml += zyfs;
  2536. zypyHtml += '</span> 付</div>';
  2537. }
  2538. afterFitContent(contentId, zypyHtml, titleId);
  2539. }
  2540. /**
  2541. * 构造辅助检查、检验处方详情和模板预览方法
  2542. * @param jcjyPrescription
  2543. * @param contentId 内容ID
  2544. * @param titleId 标题ID
  2545. * @param checkBox 是否需要增加ckeckBox
  2546. */
  2547. function fitJcjyContent(jcjyPrescription, contentId, titleId, checkBox) {
  2548. if (jcjyPrescription == null || jcjyPrescription.length == 0) {
  2549. $("#" + titleId).removeClass("in").addClass("hide");
  2550. $("#" + contentId).html("");
  2551. return;
  2552. }
  2553. var jcjyDetail = jcjyPrescription[0];
  2554. if (jcjyDetail == null || jcjyDetail.length == 0) {
  2555. $("#" + titleId).removeClass("in").addClass("hide");
  2556. $("#" + contentId).html("");
  2557. return;
  2558. }
  2559. var detail = jcjyDetail.detail;
  2560. if (detail == null || detail.length == 0) {
  2561. $("#" + titleId).removeClass("in").addClass("hide");
  2562. $("#" + contentId).html("");
  2563. return;
  2564. }
  2565. var jcjyHtml = "";
  2566. for (var i = 0; i < detail.length; i++) {
  2567. var jcjy = detail[i];
  2568. if (jcjy == null || jcjy.length == 0) {
  2569. continue;
  2570. }
  2571. if (checkBox) {
  2572. jcjyHtml += "<div style='cursor: pointer;' data-id='" + jcjy.orderCode + "'>";
  2573. jcjyHtml += "<input type='checkbox'/>";
  2574. jcjyHtml += "<span onclick='rowDataClick(this)'>";
  2575. } else {
  2576. jcjyHtml += "<div>";
  2577. }
  2578. jcjyHtml += jcjy.index + ".";
  2579. jcjyHtml += jcjy.name;
  2580. var drugUnit = jcjy.drugUnit;
  2581. if (drugUnit == undefined || drugUnit == null || drugUnit == "") {
  2582. drugUnit = "";
  2583. }
  2584. var drugQuan = jcjy.drugQuan;
  2585. if (drugQuan != undefined && drugQuan != null && drugQuan != "") {
  2586. jcjyHtml += " 单量:" + drugQuan + drugUnit;
  2587. }
  2588. var orderDays = jcjy.orderDays;
  2589. if (orderDays != undefined && orderDays != null && orderDays != "") {
  2590. jcjyHtml += " 天数:" + orderDays + "天";
  2591. }
  2592. var frequency = jcjy.frequency;
  2593. if (frequency != undefined && frequency != null && frequency != "") {
  2594. jcjyHtml += " 频次:" + frequency;
  2595. }
  2596. var quantity = jcjy.quantity;
  2597. if (quantity != undefined && quantity != null && quantity != "") {
  2598. jcjyHtml += " 总量:" + quantity + drugUnit;
  2599. }
  2600. if (checkBox) {
  2601. jcjyHtml += "</span>";
  2602. }
  2603. jcjyHtml += "</div>";
  2604. }
  2605. afterFitContent(contentId, jcjyHtml, titleId);
  2606. }
  2607. /**
  2608. * 构造入院处方详情和模板预览方法
  2609. * @param jcjyPrescription
  2610. * @param contentId 内容ID
  2611. * @param titleId 标题ID
  2612. * @param checkBox 是否需要增加ckeckBox
  2613. */
  2614. function fitZyReqContent(zyReqPrescription, contentId, titleId, checkBox) {
  2615. if (zyReqPrescription == null || zyReqPrescription.length == 0) {
  2616. $("#" + titleId).removeClass("in").addClass("hide");
  2617. $("#" + contentId).html("");
  2618. return;
  2619. }
  2620. var zyReqHtml = "";
  2621. if (checkBox) {
  2622. zyReqHtml += "<div style='cursor: pointer;'>";
  2623. zyReqHtml += "<input type='checkbox'/>";
  2624. zyReqHtml += "<span onclick='rowDataClick(this)'>";
  2625. } else {
  2626. zyReqHtml += "<div>";
  2627. }
  2628. zyReqHtml += "收住院 [";
  2629. zyReqHtml += zyReqPrescription.reqDept;
  2630. if (zyReqPrescription.smallDept != null && zyReqPrescription.smallDept != "") {
  2631. zyReqHtml += "(" + zyReqPrescription.smallDept + ")";
  2632. }
  2633. zyReqHtml += "]";
  2634. if (zyReqPrescription.admissStatus != null && zyReqPrescription.admissStatus != "") {
  2635. zyReqHtml += zyReqPrescription.admissStatus;
  2636. }
  2637. if (zyReqPrescription.conditionCode != null && zyReqPrescription.conditionCode != "") {
  2638. zyReqHtml += " " + zyReqPrescription.conditionCode;
  2639. }
  2640. if (zyReqPrescription.routeOfAdmission != null && zyReqPrescription.routeOfAdmission != "") {
  2641. zyReqHtml += " " + zyReqPrescription.routeOfAdmission;
  2642. }
  2643. zyReqHtml += " 侯床";
  2644. if (checkBox) {
  2645. zyReqHtml += "</span>";
  2646. }
  2647. zyReqHtml += "</div>";
  2648. afterFitContent(contentId, zyReqHtml, titleId);
  2649. }
  2650. /**
  2651. * 构造门诊手术处方详情和模板预览方法
  2652. * @param jcjyPrescription
  2653. * @param contentId 内容ID
  2654. * @param titleId 标题ID
  2655. * @param checkBox 是否需要增加ckeckBox
  2656. */
  2657. function fitOpRecordContent(opRecordPrescription, contentId, titleId, checkBox) {
  2658. if (opRecordPrescription == null || opRecordPrescription.length == 0) {
  2659. $("#" + titleId).removeClass("in").addClass("hide");
  2660. $("#" + contentId).html("");
  2661. return;
  2662. }
  2663. var opHtml = "";
  2664. for (var i = 0; i < opRecordPrescription.length; i++) {
  2665. var opRecord = opRecordPrescription[i];
  2666. if (opRecord == null || opRecord.length == 0) {
  2667. continue;
  2668. }
  2669. if (checkBox) {
  2670. opHtml += "<div style='cursor: pointer;' data-id='" + opRecord.opCode + "'>";
  2671. opHtml += "<input type='checkbox'/>";
  2672. opHtml += "<span onclick='rowDataClick(this)'>";
  2673. } else {
  2674. opHtml += "<div>";
  2675. }
  2676. opHtml += opRecord.opName;
  2677. var urgentClinicFlag = opRecord.urgentClinicFlag;
  2678. if (urgentClinicFlag != undefined && urgentClinicFlag != null && urgentClinicFlag != "") {
  2679. opHtml += " 急诊标志:" + urgentClinicFlag;
  2680. }
  2681. var ssbc = opRecord.ssbc;
  2682. if (ssbc != undefined && ssbc != null && ssbc != "") {
  2683. opHtml += " 班次:" + ssbc;
  2684. }
  2685. var partName = opRecord.partName;
  2686. if (partName != undefined && partName != null && partName != "") {
  2687. opHtml += " 手术部位:" + partName;
  2688. }
  2689. var opScale = opRecord.opScale;
  2690. if (opScale != undefined && opScale != null && opScale != "") {
  2691. opHtml += " 手术等级:" + opScale;
  2692. }
  2693. var hocusCode = opRecord.hocusCode;
  2694. if (hocusCode != undefined && hocusCode != null && hocusCode != "") {
  2695. opHtml += " 麻醉方式:" + hocusCode;
  2696. }
  2697. var doctorZd = opRecord.doctorZd;
  2698. if (doctorZd != undefined && doctorZd != null && doctorZd != "") {
  2699. opHtml += " 主刀医生:" + doctorZd;
  2700. }
  2701. if (checkBox) {
  2702. opHtml += "</span>";
  2703. }
  2704. opHtml += "</div>";
  2705. }
  2706. afterFitContent(contentId, opHtml, titleId);
  2707. }
  2708. /**
  2709. * 处方详情构造方法后续事件,如所有的复选框默认勾选
  2710. * @param contentId
  2711. * @param zyReqHtml
  2712. * @param titleId
  2713. */
  2714. function afterFitContent(contentId, zyReqHtml, titleId) {
  2715. $("#" + contentId).html(zyReqHtml);
  2716. $("#" + titleId).removeClass("hide").addClass("in");
  2717. //是否默认勾选处方回调
  2718. var checkboxFlag = localStorage.getItem("checkboxFlag");
  2719. if (checkboxFlag != null && (checkboxFlag == "0" || checkboxFlag == 0)) {
  2720. $("#" + titleId).find("input[type='checkbox']").prop("checked", true);
  2721. $("#" + contentId).find("input[type='checkbox']").each(function (index, obj) {
  2722. $(obj).prop("checked", true);
  2723. });
  2724. } else {
  2725. $("#" + titleId).find("input[type='checkbox']").prop("checked", false);
  2726. }
  2727. }
  2728. /**
  2729. * 模板、详情页行数据点击事件
  2730. * @param obj
  2731. */
  2732. function rowDataClick(obj) {
  2733. $(obj).prev().click();
  2734. }
  2735. /**
  2736. * 模板、详情页治疗分类标题点击事件
  2737. * @param obj
  2738. * @param source 0 是标题的行点击事件 1 标题的checkbox本身触发
  2739. */
  2740. function titleClick(obj, source) {
  2741. var contentObj = $(obj).parent().next();
  2742. var check = $(obj).prop("checked");
  2743. if (source == 0) {
  2744. var prev = $(obj).prev();
  2745. check = !$(prev).prop("checked");
  2746. $(prev).prop("checked", check)
  2747. }
  2748. if (contentObj != null) {
  2749. $(contentObj).children().each(function (index, object) {
  2750. //以下两个方法,单独调用一个可能不行
  2751. $(object).find("input[type='checkbox']").prop("checked", check) //如果鼠标点击选中了,执行后可以取消选中
  2752. });
  2753. }
  2754. }
  2755. /**
  2756. * 处方明细复选框点击事件
  2757. * @param obj
  2758. * @param source 0 是标题的行点击事件 1 标题的checkbox本身触发
  2759. */
  2760. function prescriptionCfmxChosice(obj, source) {
  2761. var check = $(obj).prop("checked");
  2762. if (source == 0) {
  2763. var prev = $(obj).prev();
  2764. check = !$(prev).prop("checked");
  2765. //以下两个方法,单独调用一个可能不行
  2766. $(prev).prop("checked", check) //如果鼠标点击选中了,执行后可以取消选中
  2767. }
  2768. var conents = $(obj).parent().parent().nextAll();
  2769. if (conents == null || conents.length == 0) {
  2770. return;
  2771. }
  2772. $(conents).each(function (index, object) {
  2773. //以下两个方法,单独调用一个可能不行
  2774. $(object).find("div:eq(0)").find("input[type='checkbox']").prop("checked", check) //如果鼠标点击选中了,执行后可以取消选中
  2775. var contentObj = $(object).find("div:eq(1)");
  2776. if (contentObj != null) {
  2777. $(contentObj).children().each(function (contentIndex, contentObject) {
  2778. $(contentObject).find("input[type='checkbox']").prop("checked", check) //如果鼠标点击选中了,执行后可以取消选中
  2779. });
  2780. }
  2781. });
  2782. }
  2783. /**
  2784. * 简明病历标题点击事件
  2785. * @param obj
  2786. */
  2787. function prescriptionJmblChosice(obj) {
  2788. var prev = $(obj).prev();
  2789. var check = !$(prev).prop("checked");
  2790. $(prev).prop("checked", check); //如果鼠标点击选中了,执行后可以取消选中
  2791. }
  2792. /**
  2793. * 医疗范文详情预览
  2794. * @param id
  2795. */
  2796. function medicalModelModal(id) {
  2797. closeObjectWebui(false);
  2798. //是否默认勾选处方回调
  2799. var checkboxFlag = localStorage.getItem("checkboxFlag");
  2800. if (checkboxFlag != null && (checkboxFlag == "0" || checkboxFlag == 0)) {
  2801. $("#conciseRecordsYlfw").prop("checked", true);
  2802. $("#prescriptionSubsidiaryYlfw").prop("checked", true);
  2803. } else {
  2804. $("#conciseRecordsYlfw").prop("checked", false);
  2805. $("#prescriptionSubsidiaryYlfw").prop("checked", false);
  2806. }
  2807. $.ajax({
  2808. type: "GET",
  2809. url: '/thmz/getTemplateById?id=' + id,
  2810. contentType: "application/json;charset=UTF-8",
  2811. dataType: "json",
  2812. async: false,
  2813. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2814. success: function (res) {
  2815. if (res == '401' || res == 401) {
  2816. window.location.href = '/thmz/login/view'
  2817. return;
  2818. }
  2819. if (res.code == 0) {
  2820. var jsonData = JSON.parse(res.data.templateData);
  2821. $("#vmedicalModelName").text(res.data.name);
  2822. $("#idTemplate").val(res.data.id);
  2823. $("#zsTemplate").html(jsonData.mzBlRecord.emrChiefComplaint);
  2824. $("#xbsTemplate").html(jsonData.mzBlRecord.emrHpi);
  2825. $("#tgjcTemplate").html(jsonData.mzBlRecord.emrPe);
  2826. $("#jkjyTemplate").html(jsonData.mzBlRecord.emrJkjy);
  2827. var icdText = res.data.icdText;
  2828. $("#zdTemplate").html("");
  2829. $("#xypyContent").html("");
  2830. $("#xymjContent").html("");
  2831. $("#xyjeContent").html("");
  2832. $("#yczlContent").html("");
  2833. $("#zyzlContent").html("");
  2834. $("#zlyjContent").html("");
  2835. if (icdText != null) {
  2836. var arr = icdText.split(",");
  2837. var html = "";
  2838. for (var i = 0; i < arr.length; i++) {
  2839. if (i == 0) {
  2840. html += ' <div class="tagZdy tagZdy-back">';
  2841. } else {
  2842. html += ' <div class="tagZdy tagZdy-back-green">';
  2843. }
  2844. html += arr[i];
  2845. html += '</div>';
  2846. }
  2847. $("#zdTemplate").html(html);
  2848. }
  2849. var prescriptionDetail = jsonData.mzBlRecord.prescriptionDetail;
  2850. if (prescriptionDetail != null && prescriptionDetail != "") {
  2851. prescriptionDetail = JSON.parse(prescriptionDetail);
  2852. var xyPrescription = prescriptionDetail.xyPrescription;
  2853. if (xyPrescription != null) {
  2854. fitxyContent(xyPrescription.pyPrescription, "xypyContent", "xypyTitle", true);
  2855. fitxyContent(xyPrescription.mjPrescription, "xymjContent", "xymjTitle", true);
  2856. fitxyContent(xyPrescription.jePrescription, "xyjeContent", "xyjeTitle", true);
  2857. fitxyContent(xyPrescription.ycPrescription, "yczlContent", "yczlTitle", true);
  2858. } else {
  2859. $("#xypyTitle").removeClass("in").addClass("hide");
  2860. $("#xypyContent").html("");
  2861. $("#xymjTitle").removeClass("in").addClass("hide");
  2862. $("#xymjContent").html("");
  2863. $("#xyjeTitle").removeClass("in").addClass("hide");
  2864. $("#xyjeContent").html("");
  2865. $("#yczlTitle").removeClass("in").addClass("hide");
  2866. $("#yczlContent").html("");
  2867. }
  2868. var zyPrescription = prescriptionDetail.zyPrescription;
  2869. if (zyPrescription != null) {
  2870. fitzyContent(zyPrescription, "zyzlContent", "zyzlTitle", true);
  2871. } else {
  2872. $("#zyzlTitle").removeClass("in").addClass("hide");
  2873. $("#zyzlContent").html("");
  2874. }
  2875. var jcjyPrescription = prescriptionDetail.jcjyPrescription;
  2876. if (jcjyPrescription != null) {
  2877. fitJcjyContent(jcjyPrescription, "jcjyContent", "jcjyTitle", true);
  2878. } else {
  2879. $("#jcjyTitle").removeClass("in").addClass("hide");
  2880. $("#jcjyContent").html("");
  2881. }
  2882. var zlPrescription = prescriptionDetail.zlPrescription;
  2883. if (zlPrescription != null) {
  2884. fitJcjyContent(zlPrescription, "zlContent", "zlTitle", true);
  2885. } else {
  2886. $("#zlTitle").removeClass("in").addClass("hide");
  2887. $("#zlContent").html("");
  2888. }
  2889. var zyReqPrescription = prescriptionDetail.zyReqPrescription;
  2890. if (zyReqPrescription != null) {
  2891. fitZyReqContent(zyReqPrescription, "zyReqContent", "zyReqTitle", true);
  2892. } else {
  2893. $("#zyReqTitle").removeClass("in").addClass("hide");
  2894. $("#zyReqContent").html("");
  2895. }
  2896. var opRecordPrescription = prescriptionDetail.opRecordPrescription;
  2897. if (opRecordPrescription != null) {
  2898. fitOpRecordContent(opRecordPrescription, "opRecordContent", "opRecordTitle", true);
  2899. } else {
  2900. $("#opRecordTitle").removeClass("in").addClass("hide");
  2901. $("#opRecordContent").html("");
  2902. }
  2903. } else {
  2904. $("#xypyTitle").removeClass("in").addClass("hide");
  2905. $("#xypyContent").html("");
  2906. $("#xymjTitle").removeClass("in").addClass("hide");
  2907. $("#xymjContent").html("");
  2908. $("#xyjeTitle").removeClass("in").addClass("hide");
  2909. $("#xyjeContent").html("");
  2910. $("#yczlTitle").removeClass("in").addClass("hide");
  2911. $("#yczlContent").html("");
  2912. $("#zyzlTitle").removeClass("in").addClass("hide");
  2913. $("#zyzlContent").html("");
  2914. $("#jcjyTitle").removeClass("in").addClass("hide");
  2915. $("#jcjyContent").html("");
  2916. $("#zlTitle").removeClass("in").addClass("hide");
  2917. $("#zlContent").html("");
  2918. $("#zyReqTitle").removeClass("in").addClass("hide");
  2919. $("#zyReqContent").html("");
  2920. }
  2921. } else {
  2922. errorMesage(res);
  2923. }
  2924. }
  2925. });
  2926. $("#medicalModelModal").modal();
  2927. }
  2928. /**
  2929. * 诊疗项目回写
  2930. * @param code
  2931. * @param mzChargeDetail
  2932. */
  2933. function callBackZlDetail(code, mzChargeDetail) {
  2934. //诊疗项目
  2935. $.ajax({
  2936. type: "GET",
  2937. url: '/thmz/getZdChargeItemByCode?code=' + code,
  2938. contentType: "application/json;charset=UTF-8",
  2939. dataType: "json",
  2940. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2941. async: false,
  2942. success: function (res) {
  2943. if (res == '401' || res == 401) {
  2944. window.location.href = '/thmz/login/view'
  2945. return;
  2946. }
  2947. if (res.code == 0) {
  2948. //如果
  2949. if ($("#zlTab").find("li") == null || $("#zlTab").find("li").length == 0) {
  2950. initNavTabs(3, null, null);
  2951. }
  2952. $("#zlItem").val(res.data.name);
  2953. $("#zlItem").blur();
  2954. $("#descriptions").val(res.data.descriptions);
  2955. $("#zlItemPrice").val(res.data.chargeAmount);
  2956. $("#chargeUnit").val(res.data.chargeUnit);
  2957. $("#zl_current_code").val(res.data.code);
  2958. $("#zlRemark").val(mzChargeDetail.instructionText);
  2959. $("#dayZlNum").selectpicker('val', mzChargeDetail.orderDays);
  2960. $('#dayZlNum').selectpicker('refresh');
  2961. if(!stringIsBlank(mzChargeDetail.hospApprFlag)){
  2962. $("#zlHospApprFlag").selectpicker('val', mzChargeDetail.hospApprFlag);
  2963. $('#zlHospApprFlag').selectpicker('refresh');
  2964. }
  2965. $("#orderFrequencyZl").selectpicker('val', mzChargeDetail.frequency);
  2966. $('#orderFrequencyZl').selectpicker('refresh');
  2967. if (mzChargeDetail.execDept != null && mzChargeDetail.execDept != "") {
  2968. $("#zlExecUnit").selectpicker('val', mzChargeDetail.execDept);
  2969. $('#zlExecUnit').selectpicker('refresh');
  2970. }
  2971. $("#itemQuantity").val(mzChargeDetail.drugQuan);
  2972. $("#totalNumZl").val(mzChargeDetail.quantity);
  2973. saveZlItem(false);
  2974. } else {
  2975. errorMesage(res);
  2976. }
  2977. }
  2978. });
  2979. }
  2980. /**
  2981. * 处方模板回调和历史处方调用自动重置组号
  2982. * @param type
  2983. */
  2984. function resetNewGroupId(type) {
  2985. if (type == 1 || type == 2) {
  2986. var xyTabContents = $("#xyTabContent").find("div.tab-pane");
  2987. //西药设置
  2988. if (xyTabContents != null && xyTabContents.length > 0) {
  2989. groupIdMap = new MyMap();
  2990. gropuIdAndOrderNoMap = new MyMap();
  2991. var newGroupId = 1;
  2992. gropuIdAndOrderNoMap.put(1, 0);
  2993. var prevGroupId = null;
  2994. for (var i = 0; i < xyTabContents.length; i++) {
  2995. var formGroups = $(xyTabContents[i]).find("div.form-group");
  2996. if (formGroups != null && formGroups.length > 0) {
  2997. for (var j = 0; j < formGroups.length; j++) {
  2998. var tempGroupId = $(formGroups[j]).find("input.temporary_items_groupId").val();
  2999. if (prevGroupId != null && tempGroupId != prevGroupId) {
  3000. newGroupId++;
  3001. gropuIdAndOrderNoMap.put(newGroupId, i);
  3002. }
  3003. $(formGroups[j]).find("span.groupId").text(newGroupId);
  3004. $(formGroups[j]).find("input.temporary_items_groupId").val(newGroupId);
  3005. var map = groupIdMap.get(newGroupId + '');
  3006. if (map == null) {
  3007. map = new MyMap();
  3008. map.put("supplyType", $(formGroups[j]).find("input.temporary_items_supplyType").val());
  3009. map.put("orderFrequency", $(formGroups[j]).find("input.temporary_items_orderFrequency").val());
  3010. map.put("dayNum", $(formGroups[j]).find("input.temporary_items_dayNum").val());
  3011. groupIdMap.put(newGroupId + '', map);
  3012. }
  3013. if (prevGroupId == null || tempGroupId != prevGroupId) {
  3014. prevGroupId = tempGroupId;
  3015. }
  3016. }
  3017. }
  3018. }
  3019. resetGroupIdSelect();
  3020. }
  3021. }
  3022. }
  3023. /**
  3024. * 处方回写
  3025. * @param jsonData 处方数据
  3026. * @param type 回写类型 0 全部回写 1 医疗范文 2 就诊详情
  3027. */
  3028. function editPrescription(jsonData, type) {
  3029. orderNoAndTableIdMap = new MyMap();
  3030. tableIdAndOrderNoMap = new MyMap();
  3031. var firstOrNot = jsonData.firstOrNot;
  3032. var conciseRecordsFlag = false;
  3033. if (type == 1) {
  3034. conciseRecordsFlag = $("#conciseRecordsYlfw").prop("checked");
  3035. } else if (type == 2) {
  3036. conciseRecordsFlag = $("#conciseRecordsJzxq").prop("checked");
  3037. }
  3038. if (firstOrNot == 0) {
  3039. $("#first").next().click();
  3040. } else if (firstOrNot == 1) {
  3041. $("#not").next().click();
  3042. }
  3043. if (type == 0 || conciseRecordsFlag) {
  3044. $("#symptom").val(jsonData.mzBlRecord.emrChiefComplaint);
  3045. $("#emrHpi").val(jsonData.mzBlRecord.emrHpi);
  3046. $("#emrPs").val(jsonData.mzBlRecord.emrPs);
  3047. $("#personalHistory").val(jsonData.mzBlRecord.personalHistory);
  3048. $("#familyHistory").val(jsonData.mzBlRecord.familyHistory);
  3049. $("#fzZl").val(jsonData.mzBlRecord.fzZl);
  3050. $("#obstericalHistory").val(jsonData.mzBlRecord.obstericalHistory);
  3051. if (jsonData.mzBlRecord.weight != null && jsonData.mzBlRecord.weight != 0) {
  3052. $("#weight").val(jsonData.mzBlRecord.weight);
  3053. } else {
  3054. $("#weight").val("");
  3055. }
  3056. if (jsonData.mzBlRecord.temperature != null && jsonData.mzBlRecord.temperature != 0) {
  3057. $("#temperature").val(jsonData.mzBlRecord.temperature);
  3058. } else {
  3059. $("#temperature").val("");
  3060. }
  3061. if (jsonData.mzBlRecord.sphygmus != null && jsonData.mzBlRecord.sphygmus != 0) {
  3062. $("#sphygmus").val(jsonData.mzBlRecord.sphygmus);
  3063. } else {
  3064. $("#sphygmus").val("");
  3065. }
  3066. if (jsonData.mzBlRecord.breathe != null && jsonData.mzBlRecord.breathe != 0) {
  3067. $("#breathe").val(jsonData.mzBlRecord.breathe);
  3068. } else {
  3069. $("#breathe").val("");
  3070. }
  3071. if (jsonData.mzBlRecord.pressureHigh != null && jsonData.mzBlRecord.pressureHigh != 0) {
  3072. $("#pressure_high").val(jsonData.mzBlRecord.pressureHigh);
  3073. } else {
  3074. $("#pressure_high").val("");
  3075. }
  3076. if (jsonData.mzBlRecord.pressureFloor != null && jsonData.mzBlRecord.pressureFloor != 0) {
  3077. $("#pressure_floor").val(jsonData.mzBlRecord.pressureFloor);
  3078. } else {
  3079. $("#pressure_floor").val("");
  3080. }
  3081. if (jsonData.mzBlRecord.pressureHighLeft != null && jsonData.mzBlRecord.pressureHighLeft != 0) {
  3082. $("#pressure_high_left").val(jsonData.mzBlRecord.pressureHighLeft);
  3083. } else {
  3084. $("#pressure_high_left").val("");
  3085. }
  3086. if (jsonData.mzBlRecord.pressureFloorLeft != null && jsonData.mzBlRecord.pressureFloorLeft != 0) {
  3087. $("#pressure_floor_left").val(jsonData.mzBlRecord.pressureFloorLeft);
  3088. } else {
  3089. $("#pressure_floor_left").val("");
  3090. }
  3091. $("#tentativeDiagnosis").val(jsonData.mzBlRecord.tentativeDiagnosis);
  3092. $("#otherCheck").val(jsonData.mzBlRecord.emrPe);
  3093. var icdCode = jsonData.icdCode;
  3094. if (icdCode != null && icdCode != "" && icdCode.length > 0) {
  3095. $.ajax({
  3096. type: "POST",
  3097. url: '/thmz/getZdIcdByCodes',
  3098. contentType: "application/json;charset=UTF-8",
  3099. dataType: "json",
  3100. async: false,
  3101. data: JSON.stringify({
  3102. "icdCode": icdCode
  3103. }),
  3104. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3105. success: function (res) {
  3106. if (res == '401' || res == 401) {
  3107. window.location.href = '/thmz/login/view'
  3108. return;
  3109. }
  3110. if (res.code == 0) {
  3111. if (res.data != null && res.data.length > 0) {
  3112. for (var i = 0; i < res.data.length; i++) {
  3113. fitDiagnoseValue(res.data[i].name, res.data[i].code);
  3114. }
  3115. }
  3116. } else {
  3117. errorMesage(res);
  3118. }
  3119. }
  3120. });
  3121. }
  3122. $("#healthEducation").val(jsonData.mzBlRecord.emrJkjy);
  3123. }
  3124. var patientAllergenInfoList = jsonData.patientAllergenInfoList;
  3125. if (patientAllergenInfoList != null && patientAllergenInfoList.length > 0) {
  3126. var zdAllergen = [];
  3127. var ypDitList = [];
  3128. var zdAllergenHtml = '';
  3129. var ypDitListHtml = '';
  3130. var zdAllergeCodes = null;
  3131. var zdAllergeTexts = null;
  3132. var ypDitListodes = null;
  3133. var ypDitListTexts = null;
  3134. for (var i = 0; i < patientAllergenInfoList.length; i++) {
  3135. var patientAllergenInfo = patientAllergenInfoList[i];
  3136. if (patientAllergenInfo.type == 0 || patientAllergenInfo.type == '0') {
  3137. zdAllergen[zdAllergen.length] = patientAllergenInfo.allergenCode;
  3138. zdAllergenHtml += '<option value="' + patientAllergenInfo.allergenCode + '">' + patientAllergenInfo.allergenName + '</option>';
  3139. if (zdAllergeCodes == null) {
  3140. zdAllergeCodes = patientAllergenInfo.allergenCode;
  3141. zdAllergeTexts = patientAllergenInfo.allergenName;
  3142. } else {
  3143. zdAllergeCodes += "," + patientAllergenInfo.allergenCode;
  3144. zdAllergeTexts += "," + patientAllergenInfo.allergenName;
  3145. }
  3146. } else if (patientAllergenInfo.type == 1 || patientAllergenInfo.type == '1') {
  3147. ypDitList[ypDitList.length] = patientAllergenInfo.allergenCode;
  3148. ypDitListHtml += '<option value="' + patientAllergenInfo.allergenCode + '">' + patientAllergenInfo.allergenName + '</option>';
  3149. if (zdAllergeCodes == null) {
  3150. ypDitListodes = patientAllergenInfo.allergenCode;
  3151. ypDitListTexts = patientAllergenInfo.allergenName;
  3152. } else {
  3153. ypDitListodes += "," + patientAllergenInfo.allergenCode;
  3154. ypDitListTexts += "," + patientAllergenInfo.allergenName;
  3155. }
  3156. }
  3157. }
  3158. $("#zdAllergen").empty();
  3159. $('#zdAllergen').append(zdAllergenHtml);
  3160. $('#zdAllergen').selectpicker('refresh');
  3161. $("#ypDitList").empty();
  3162. $('#ypDitList').append(ypDitListHtml);
  3163. $('#ypDitList').selectpicker('refresh');
  3164. $("#zdAllergen").selectpicker('val', zdAllergen);
  3165. $("#zdAllergen").selectpicker('refresh');
  3166. $("#ypDitList").selectpicker('val', ypDitList);
  3167. $("#ypDitList").selectpicker('refresh');
  3168. $("#zdAllergen").attr("selectedCodes", zdAllergeCodes);
  3169. $("#zdAllergen").attr("selectedTexts", zdAllergeTexts);
  3170. $("#ypDitList").attr("selectedCodes", ypDitListodes);
  3171. $("#ypDitList").attr("selectedTexts", ypDitListTexts);
  3172. }
  3173. //西药选中的数据组
  3174. var xyArrays = [];
  3175. //中药选中的数据组
  3176. var zyArrays = [];
  3177. //辅助检查、检验选中的数据组
  3178. var jcjyArrays = [];
  3179. //诊疗选中的数据组
  3180. var zlArrays = [];
  3181. //住院选中的数据组
  3182. var zyReqArrays = [];
  3183. //门诊手术选中的数据组
  3184. var opRecordArrays = [];
  3185. //组号与同组药数量的map
  3186. var groupOrderAndLengthMap = new MyMap();
  3187. //处方号与同处方号药数量的map
  3188. var orderNoAndLengthMap = new MyMap();
  3189. //住院回写
  3190. var zyReqCallBack = false;
  3191. if (type == 1) {
  3192. setCallBackArrays("xypyContent", xyArrays, groupOrderAndLengthMap, orderNoAndLengthMap);
  3193. setCallBackArrays("xymjContent", xyArrays, groupOrderAndLengthMap, orderNoAndLengthMap);
  3194. setCallBackArrays("xyjeContent", xyArrays, groupOrderAndLengthMap, orderNoAndLengthMap);
  3195. setCallBackArrays("yczlContent", xyArrays, groupOrderAndLengthMap, orderNoAndLengthMap);
  3196. setCallBackArrays("zyzlContent", zyArrays, null, null);
  3197. setCallBackArrays("jcjyContent", jcjyArrays, null, null);
  3198. setCallBackArrays("zlContent", zlArrays, null, null);
  3199. zyReqCallBack = $("#zyReqContent").find("input").prop("checked");
  3200. setCallBackArrays("opRecordContent", opRecordArrays, null, null);
  3201. } else if (type == 2) {
  3202. setCallBackArrays("prescriptionDetail_xypyContent", xyArrays, groupOrderAndLengthMap, orderNoAndLengthMap);
  3203. setCallBackArrays("prescriptionDetail_xymjContent", xyArrays, groupOrderAndLengthMap, orderNoAndLengthMap);
  3204. setCallBackArrays("prescriptionDetail_xyjeContent", xyArrays, groupOrderAndLengthMap, orderNoAndLengthMap);
  3205. setCallBackArrays("prescriptionDetail_yczlContent", xyArrays, groupOrderAndLengthMap, orderNoAndLengthMap);
  3206. setCallBackArrays("prescriptionDetail_zyzlContent", zyArrays, null, null);
  3207. setCallBackArrays("prescriptionDetail_jcjyContent", jcjyArrays, null, null);
  3208. setCallBackArrays("prescriptionDetail_zlContent", zlArrays, null, null);
  3209. zyReqCallBack = $("#prescriptionDetail_zyReqContent").find("input").prop("checked");
  3210. setCallBackArrays("prescriptionDetail_opRecordContent", opRecordArrays, null, null);
  3211. } else if (type == 0) {
  3212. zyReqCallBack = true;
  3213. }
  3214. var mzChargeDetailList = jsonData.mzChargeDetailList;
  3215. var mzZyReq = jsonData.mzZyReq;
  3216. //中药的公共参数是否已经设置了
  3217. var hadSetZyFullParams = false;
  3218. //西药,成药,医材,麻精,中药,诊疗
  3219. if (mzChargeDetailList != null && mzChargeDetailList.length > 0) {
  3220. //当前实际回写的组号
  3221. var currentOrderNo = null;
  3222. //处方号与药品类型关系
  3223. var orderAndGroupNoMap = new MyMap();
  3224. // mzChargeDetailList.sort(function (a, b) {
  3225. // return a.groupNo - b.groupNo
  3226. // });
  3227. for (var i = 0; i < mzChargeDetailList.length; i++) {
  3228. var mzChargeDetail = mzChargeDetailList[i];
  3229. var groupNo = mzChargeDetail.groupNo;
  3230. var code = mzChargeDetail.chargeItemCode;
  3231. var serial = mzChargeDetail.serial;
  3232. if (groupNo == "00") {
  3233. if (type != 0 && !isInArray(code, zlArrays)) {
  3234. continue;
  3235. }
  3236. callBackZlDetail(code, mzChargeDetail);
  3237. } else if (groupNo == "71" || groupNo == "91" || groupNo == "111" || groupNo == "131") {
  3238. // 71 西成药 91 医材 111 精一 131 精二
  3239. var groupOrder = mzChargeDetail.groupOrder;
  3240. if (groupOrder == null || groupOrder == 'null' || groupOrder == "") {
  3241. groupOrder = 1;
  3242. }
  3243. var orderNo = mzChargeDetail.orderNo;
  3244. orderAndGroupNoMap.put(orderNo, groupNo);
  3245. if (type != 0 && !isInArray(code + "_" + serial + "_" + groupOrder + "_" + orderNo, xyArrays)) {
  3246. continue;
  3247. }
  3248. var lastGroupOrder = parseInt($("#groupId > option:last").val());
  3249. while (lastGroupOrder < groupOrder) {
  3250. appendGroupOrder();
  3251. lastGroupOrder = parseInt($("#groupId > option:last").val());
  3252. }
  3253. //appendGroupOrder()
  3254. $("#groupId").selectpicker('val', groupOrder);
  3255. $('#groupId').selectpicker('refresh');
  3256. if (type == 1 || type == 2) {
  3257. //模板和历史轨迹回调的时候,如果前一个处方不满5个,就将后面的处方的药品添加到上一个处方中,但如果同一组药不能全部添加到上一个处方,就不会追加到该处方中
  3258. var orderNoLength = orderNoAndLengthMap.get(orderNo);
  3259. if (currentOrderNo == null) {
  3260. currentOrderNo = orderNo;
  3261. } else if (orderAndGroupNoMap.get(currentOrderNo) != orderAndGroupNoMap.get(orderNo)) {
  3262. var currentGroupNos = $("#xyTabContent").find("input.current_groupNo");
  3263. //查询还没有满5个的处方页
  3264. var tempOrderNo = null;
  3265. for (var k = 0; k < currentGroupNos.length; k++) {
  3266. if ($(currentGroupNos[k]).val() == groupNo) {
  3267. var next = $(currentGroupNos[k]).next();
  3268. if ($(next).children().length < 4) {
  3269. var parentId = $(currentGroupNos[k]).parent().attr("id");
  3270. tempOrderNo = tableIdAndOrderNoMap.get(parentId);
  3271. }
  3272. }
  3273. }
  3274. currentOrderNo = tempOrderNo;
  3275. } else if (currentOrderNo != orderNo && orderNoLength < 5) {
  3276. var currentOrderNoLength = orderNoAndLengthMap.get(currentOrderNo);
  3277. var groupOrderLength = groupOrderAndLengthMap.get(groupOrder);
  3278. if (groupOrderLength + currentOrderNoLength <= 5) {
  3279. currentOrderNoLength = currentOrderNoLength + 1;
  3280. orderNoLength = orderNoLength - 1;
  3281. groupOrderLength = groupOrderLength - 1;
  3282. orderNoAndLengthMap.put(currentOrderNo, currentOrderNoLength);
  3283. orderNoAndLengthMap.put(orderNo, orderNoLength);
  3284. groupOrderAndLengthMap.put(groupOrder, groupOrderLength);
  3285. orderNo = currentOrderNo;
  3286. if (currentOrderNoLength == 5) {
  3287. var currentGroupNos = $("#xyTabContent").find("input.current_groupNo");
  3288. //查询还没有满5个的处方页,
  3289. var tempOrderNo = null;
  3290. for (var k = 0; k < currentGroupNos.length; k++) {
  3291. if ($(currentGroupNos[k]).val() == groupNo) {
  3292. var next = $(currentGroupNos[k]).next();
  3293. //这里判断是4,是因为已经把组号设置了,所以要减去1
  3294. if ($(next).children().length < 4) {
  3295. var parentId = $(currentGroupNos[k]).parent().attr("id");
  3296. tempOrderNo = tableIdAndOrderNoMap.get(parentId);
  3297. }
  3298. }
  3299. }
  3300. currentOrderNo = tempOrderNo;
  3301. }
  3302. } else {
  3303. currentOrderNo = orderNo;
  3304. }
  3305. }
  3306. }
  3307. checkYpInfo(code, serial, groupNo, false, orderNo, type);
  3308. // 给药方式 同组药品给药方式相同
  3309. $("#supplyType").selectpicker('val', mzChargeDetail.supplyCode);
  3310. $('#supplyType').selectpicker('refresh');
  3311. $("#drugWin").val(mzChargeDetail.drugQuan);
  3312. $("#drugWinUnit").selectpicker('val', mzChargeDetail.drugUnit);
  3313. $('#drugWinUnit').selectpicker('refresh');
  3314. //天数 同组药品天数相同
  3315. $("#dayNum").selectpicker('val', mzChargeDetail.orderDays);
  3316. $('#dayNum').selectpicker('refresh');
  3317. //频次编码 同组药品频次编码相同
  3318. $("#orderFrequency").selectpicker('val', mzChargeDetail.frequency);
  3319. $('#orderFrequency').selectpicker('refresh');
  3320. if (mzChargeDetail.tryFlag == 1 || mzChargeDetail.tryFlag == "1") {
  3321. $("#tryResult").selectpicker('val', 100);
  3322. $('#tryResult').selectpicker('refresh');
  3323. } else if (mzChargeDetail.tryResult != null && mzChargeDetail.tryResult != "null" && mzChargeDetail.tryResult != "") {
  3324. $("#tryResult").selectpicker('val', mzChargeDetail.tryResult);
  3325. $('#tryResult').selectpicker('refresh');
  3326. }
  3327. $("#gross").val(mzChargeDetail.quantity);
  3328. $("#totalRetprice").val(Multiply(mzChargeDetail.quantity, $("#packRetprice").val()));
  3329. $("#medicalAdvice").selectpicker('val', mzChargeDetail.instructionCode);
  3330. $('#medicalAdvice').selectpicker('refresh');
  3331. if(!stringIsBlank(mzChargeDetail.hospApprFlag)){
  3332. $("#xyHospApprFlag").selectpicker('val', mzChargeDetail.hospApprFlag);
  3333. $('#xyHospApprFlag').selectpicker('refresh');
  3334. }
  3335. saveWesternMedicineWithCheck(false, orderNo);
  3336. $("#western_medicine_button").click();
  3337. $("#xyTab").find("li:eq(0) a").off("click").click();
  3338. } else {
  3339. if (type != 0 && !isInArray(code + "_" + serial, zyArrays)) {
  3340. continue;
  3341. }
  3342. //中药与颗粒剂
  3343. checkZyInfo(code, serial, groupNo, false);
  3344. //类型
  3345. $("#zyClassType").selectpicker('val', groupNo);
  3346. $('#zyClassType').selectpicker('refresh');
  3347. $("#zy_drugWin").val(mzChargeDetail.quantity);
  3348. $("#zyInstruction").selectpicker('val', mzChargeDetail.instructionCode);
  3349. $('#zyInstruction').selectpicker('refresh');
  3350. if(!stringIsBlank(mzChargeDetail.hospApprFlag)){
  3351. $("#zyHospApprFlag").selectpicker('val', mzChargeDetail.hospApprFlag);
  3352. $('#zyHospApprFlag').selectpicker('refresh');
  3353. }
  3354. saveChineseMedicine(false);
  3355. if (!hadSetZyFullParams) {
  3356. hadSetZyFullParams = true;
  3357. $("input.zyfs").val(mzChargeDetail.drugWin);
  3358. // $("#zy_orderFrequency_1").selectpicker('val', mzChargeDetail.frequency);
  3359. // $('#zy_orderFrequency_1').selectpicker('refresh');
  3360. $("#useType_1").selectpicker('val', mzChargeDetail.cyFysm);
  3361. $('#useType_1').selectpicker('refresh');
  3362. $("#cyJssm").selectpicker('val', mzChargeDetail.cyJssm);
  3363. $('#cyJssm').selectpicker('refresh');
  3364. $("#cyJsl").val(mzChargeDetail.cyJsl);
  3365. $("#cyZql").val(mzChargeDetail.cyZql);
  3366. $("#cyFj").val(mzChargeDetail.cyFj);
  3367. $("#cyFfcs").val(mzChargeDetail.cyFfcs);
  3368. $("#cyMtjs").val(mzChargeDetail.cyMtjs);
  3369. $("#zy_supplyType_1").selectpicker('val', mzChargeDetail.cyDj);
  3370. $('#zy_supplyType_1').selectpicker('refresh');
  3371. }
  3372. $("#chinese_medicine_button").click();
  3373. }
  3374. }
  3375. }
  3376. //检验与检查
  3377. var mzYjReqList = jsonData.mzYjReqList;
  3378. if (mzYjReqList != null && mzYjReqList.length > 0) {
  3379. for (var i = 0; i < mzYjReqList.length; i++) {
  3380. var mzYjReq = mzYjReqList[i];
  3381. var code = mzYjReq.orderCode;
  3382. if (type != 0 && !isInArray(code, jcjyArrays)) {
  3383. continue;
  3384. }
  3385. var jcJyZltype = null;
  3386. if (mzYjReq.reqType == 2) {
  3387. jcJyZltype = 1;
  3388. $("#jyZdSample").selectpicker('val', mzYjReq.inspectStuff);
  3389. $('#jyZdSample').selectpicker('refresh');
  3390. } else if (mzYjReq.reqType == 3) {
  3391. jcJyZltype = 2;
  3392. $("#yshPart").selectpicker('val', mzYjReq.inspectPart);
  3393. $('#yshPart').selectpicker('refresh');
  3394. }
  3395. $("#jcJyZltype").val(jcJyZltype);
  3396. checkJcJyItemInfo(code, null, jcJyZltype, false);
  3397. $("#remark").val(mzYjReq.jyRemark);
  3398. if (mzYjReq.execDept != null && mzYjReq.execDept != "") {
  3399. $("#execUnit").selectpicker('val', mzYjReq.execDept);
  3400. $('#execUnit').selectpicker('refresh');
  3401. }
  3402. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  3403. saveJyJcItem(false);
  3404. $("#jcJyItemChargeDetail").removeClass("in").addClass("hide");
  3405. }
  3406. $("#yj_req_button").click();
  3407. }
  3408. //入院证
  3409. if (zyReqCallBack && mzZyReq != null && mzZyReq.reqDept != null && mzZyReq.reqDept != "") {
  3410. $("#inpatientWardBeHospitalized").selectpicker('val', mzZyReq.reqDept);
  3411. $('#inpatientWardBeHospitalized').selectpicker('refresh');
  3412. initSmallDeptByDept();
  3413. $("#admissStatus").selectpicker('val', mzZyReq.admissStatus);
  3414. $('#admissStatus').selectpicker('refresh');
  3415. $("#conditionCode").selectpicker('val', mzZyReq.conditionCode);
  3416. $('#conditionCode').selectpicker('refresh');
  3417. $("#routeOfAdmission").selectpicker('val', mzZyReq.routeOfAdmission);
  3418. $('#routeOfAdmission').selectpicker('refresh');
  3419. setTimeout(function () {
  3420. $("#smallWardBeHospitalized").selectpicker('val', mzZyReq.smallDept);
  3421. $('#smallWardBeHospitalized').selectpicker('refresh');
  3422. saveZyReq(false);
  3423. }, 500);
  3424. $("#zy_req_button").click();
  3425. }
  3426. //门诊手术
  3427. var opRecordList = jsonData.opRecordList;
  3428. if (opRecordList != null && opRecordList.length > 0) {
  3429. for (var i = 0; i < opRecordList.length; i++) {
  3430. var opRecord = opRecordList[i];
  3431. var opCode = opRecord.opCode;
  3432. if (type != 0 && !isInArray(opCode, opRecordArrays)) {
  3433. continue;
  3434. }
  3435. var opNameHtml = '<option value="' + opRecord.opCode + '">' + opRecord.opName + '</option>';
  3436. $('#opName').html(opNameHtml);
  3437. $('#opName').selectpicker('refresh');
  3438. $('#opName').selectpicker('val', opRecord.opCode);
  3439. $('#opName').selectpicker('refresh');
  3440. $("#opTime").val(opRecord.opDatetimeStr);
  3441. $('#urgentClinicFlag').selectpicker('val', opRecord.urgentClinicFlag);
  3442. $('#urgentClinicFlag').selectpicker('refresh');
  3443. $('#ssbc').selectpicker('val', opRecord.ssbc);
  3444. $('#ssbc').selectpicker('refresh');
  3445. $('#partCode').selectpicker('val', opRecord.partCode);
  3446. $('#partCode').selectpicker('refresh');
  3447. $('#opScale').selectpicker('val', opRecord.opScale);
  3448. $('#opScale').selectpicker('refresh');
  3449. $('#hocusCode').selectpicker('val', opRecord.hocusCode);
  3450. $('#hocusCode').selectpicker('refresh');
  3451. $('#doctorZd').selectpicker('val', opRecord.doctorZd);
  3452. $('#doctorZd').selectpicker('refresh');
  3453. $("#opRecordRemark").val(opRecord.remark);
  3454. saveOpRecord(false);
  3455. }
  3456. $("#op_record_button").click();
  3457. }
  3458. setTimeout(function () {
  3459. //设置总金额 计算金额的时候,可能处方还没有回写完
  3460. calculateTotalAmount(false);
  3461. }, 1000);
  3462. //清空映射map
  3463. orderNoAndTableIdMap = null;
  3464. tableIdAndOrderNoMap = null;
  3465. resetNewGroupId(type);
  3466. }
  3467. /**
  3468. * 根据勾选内容设置选中集合
  3469. * @param id 区域id
  3470. * @param arrays 集合
  3471. * @param groupOrderAndLengthMap 组号与同组药数量的map
  3472. * @param orderNoAndLengthMap 处方号与同处方号药数量的map
  3473. */
  3474. function setCallBackArrays(id, arrays, groupOrderAndLengthMap, orderNoAndLengthMap) {
  3475. var contents = $("#" + id).children();
  3476. if (contents == null || contents.length == 0) {
  3477. return;
  3478. }
  3479. $(contents).each(function (index, obj) {
  3480. var checked = $(obj).find("input").prop("checked");
  3481. var data_id = $(obj).attr("data-id");
  3482. if (checked && data_id != undefined && data_id != null && data_id != "null" && data_id != "") {
  3483. arrays[arrays.length] = data_id;
  3484. var dataArr = null;
  3485. //设置组号与同组药品数量关系
  3486. if (groupOrderAndLengthMap != null) {
  3487. dataArr = data_id.split("_");
  3488. if (dataArr != null && dataArr.length >= 3) {
  3489. var groupOrder = Number(dataArr[2]);
  3490. var length = groupOrderAndLengthMap.get(groupOrder);
  3491. if (length == null || length == "") {
  3492. length = 0;
  3493. }
  3494. length++;
  3495. groupOrderAndLengthMap.put(groupOrder, length);
  3496. }
  3497. }
  3498. //设置处方号与同处方号药品数量关系
  3499. if (orderNoAndLengthMap != null) {
  3500. if (dataArr == null) {
  3501. dataArr = data_id.split("_");
  3502. }
  3503. if (dataArr != null && dataArr.length >= 4) {
  3504. var orderNo = Number(dataArr[3]);
  3505. var length = orderNoAndLengthMap.get(orderNo);
  3506. if (length == null || length == "") {
  3507. length = 0;
  3508. }
  3509. length++;
  3510. orderNoAndLengthMap.put(orderNo, length);
  3511. }
  3512. }
  3513. }
  3514. });
  3515. }
  3516. /**
  3517. * 调用医疗范文
  3518. */
  3519. function callTemplate() {
  3520. clearWorkSpaceExcludeUser(2);
  3521. $.ajax({
  3522. type: "GET",
  3523. url: '/thmz/increaseNumber?id=' + $("#idTemplate").val(),
  3524. contentType: "application/json;charset=UTF-8",
  3525. dataType: "json",
  3526. async: false,
  3527. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3528. success: function (res) {
  3529. if (res == '401' || res == 401) {
  3530. window.location.href = '/thmz/login/view'
  3531. return;
  3532. }
  3533. if (res.code == 0) {
  3534. var jsonData = JSON.parse(res.data.templateData);
  3535. editPrescription(jsonData, 1);
  3536. $("#templateId").val(res.data.id);
  3537. $("#templateName").val(res.data.name);
  3538. $("#templateKindType").selectpicker('val', res.data.templateKindType);
  3539. $("#templateKindType").selectpicker('refresh');
  3540. $("#templateType").selectpicker('val', res.data.templateType);
  3541. $("#templateType").selectpicker('refresh');
  3542. $('#operationType').selectpicker('val', 1);
  3543. $('#operationType').selectpicker('refresh');
  3544. $("#operationTypeDiv").removeClass("hide").addClass("in");
  3545. $("#medicalModelModal").modal("hide");
  3546. closePopover();
  3547. } else {
  3548. errorMesage(res);
  3549. }
  3550. }
  3551. });
  3552. }
  3553. /**
  3554. * 底层填充推荐方法
  3555. * @param paramsType
  3556. * @param appeal
  3557. * @param inputId
  3558. */
  3559. function extracted(paramsType, appeal, inputId) {
  3560. if (paramsType == 13) {
  3561. var contentArr = appeal.split(",");
  3562. if (contentArr != null && contentArr.length > 0) {
  3563. for (var i = 0; i < contentArr.length; i++) {
  3564. var content = contentArr[i].replace(")", "").replace("(", "-");
  3565. var diagnoseArr = content.split("-");
  3566. if (diagnoseArr == null || diagnoseArr.length == 0) {
  3567. continue;
  3568. }
  3569. fitDiagnoseValue(diagnoseArr[0], diagnoseArr[1]);
  3570. }
  3571. }
  3572. } else {
  3573. $("#" + inputId).val(appeal);
  3574. }
  3575. }
  3576. /**
  3577. * 填充推荐
  3578. * @param appeal
  3579. * @param paramsType
  3580. * @param id
  3581. */
  3582. function fitAppeal(appeal, paramsType, id) {
  3583. var inputId = "symptom";
  3584. var text = "主诉项已经录入,是否覆盖?";
  3585. if (paramsType == 5) {
  3586. inputId = "emrHpi";
  3587. text = "现病史项已经录入,是否覆盖?";
  3588. } else if (paramsType == 6) {
  3589. inputId = "emrPs";
  3590. text = "既往史项已经录入,是否覆盖?";
  3591. } else if (paramsType == 13) {
  3592. inputId = "diagnoseValue";
  3593. text = "诊断项已经录入,是否覆盖?";
  3594. }
  3595. var symptom = $("#" + inputId).val();
  3596. if (paramsType == 13 && (symptom == ",," || symptom == ",")) {
  3597. symptom = null;
  3598. }
  3599. if (symptom != null && symptom != "") {
  3600. $("#messageModal").modal();
  3601. $("#messageContent").html(text);
  3602. $("#messageButton").off("click").on("click", function (t) {
  3603. $("#messageModal").modal("hide");
  3604. if (paramsType == 13) {
  3605. $("#" + inputId).val(null);
  3606. $("#diagnoseTags").html(null);
  3607. }
  3608. extracted(paramsType, appeal, inputId);
  3609. });
  3610. $("#cancelButton").off("click");
  3611. } else {
  3612. extracted(paramsType, appeal, inputId);
  3613. }
  3614. $.ajax({
  3615. type: "GET",
  3616. url: '/thmz/increaseTcCommonParamsNumber?id=' + id,
  3617. contentType: "application/json;charset=UTF-8",
  3618. dataType: "json",
  3619. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3620. success: function (res) {
  3621. }
  3622. });
  3623. }
  3624. /**
  3625. * 初始嘱托下拉选
  3626. */
  3627. function initInstructionSelect() {
  3628. //西药医嘱
  3629. $.ajax({
  3630. type: "GET",
  3631. url: '/thmz/getMzZdInstructionByType?instructionType=0',
  3632. contentType: "application/json;charset=UTF-8",
  3633. dataType: "json",
  3634. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3635. success: function (res) {
  3636. if (res == '401' || res == 401) {
  3637. window.location.href = '/thmz/login/view'
  3638. return;
  3639. }
  3640. if (res.code == 0) {
  3641. res.data.forEach(function (item, index) {
  3642. var html = '<option value="' + item.code + '">' + item.instructionText + '</option>';
  3643. $('#medicalAdvice').append(html);
  3644. });
  3645. $('#medicalAdvice').selectpicker('refresh');
  3646. } else {
  3647. errorMesage(res);
  3648. }
  3649. }
  3650. });
  3651. //中药医嘱
  3652. $.ajax({
  3653. type: "GET",
  3654. url: '/thmz/getMzZdInstructionByType?instructionType=1',
  3655. contentType: "application/json;charset=UTF-8",
  3656. dataType: "json",
  3657. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3658. success: function (res) {
  3659. if (res == '401' || res == 401) {
  3660. window.location.href = '/thmz/login/view'
  3661. return;
  3662. }
  3663. if (res.code == 0) {
  3664. res.data.forEach(function (item, index) {
  3665. var html = '<option value="' + item.code + '">' + item.instructionText.trim() + '</option>';
  3666. $('#zyInstruction').append(html);
  3667. });
  3668. $('#zyInstruction').selectpicker('refresh');
  3669. } else {
  3670. errorMesage(res);
  3671. }
  3672. }
  3673. });
  3674. }
  3675. // /**
  3676. // * 设置下拉选的尺寸
  3677. // */
  3678. // function setSelectSize() {
  3679. // $(".selectpicker").selectpicker({
  3680. // dropuAuto: false,
  3681. // size: 10
  3682. // });
  3683. // }
  3684. /**
  3685. * 初始化下拉选
  3686. */
  3687. function initSelectWithParams() {
  3688. $(".selectpicker").selectpicker({
  3689. dropuAuto: false,
  3690. size: 10
  3691. });
  3692. //select 从后台加载数据,并保留之前选择的内容
  3693. dynamicSelectWithOri("editZd", '/thmz/getAllZdIcdCommonParams?commonParams=', false);
  3694. //手术名称下拉选实现
  3695. dynamicSelect("opName", '/thmz/getZdIcd9Cm3ListByCode?code=', false);
  3696. //手术部位
  3697. dynamicSelect("partCode", '/thmz/getAllOpZdPartNewByCode?code=', true);
  3698. //手术等级
  3699. dynamicSelect("opScale", '/thmz/getAllOpZdScaleByCode?code=', true);
  3700. //麻醉方式
  3701. dynamicSelect("hocusCode", '/thmz/getAllZdAnaesthesiaByCode?code=', true);
  3702. //主刀医生
  3703. dynamicSelect("doctorZd", '/thmz/getEmployeeByCommon?code=', true);
  3704. //过敏源
  3705. dynamicSelectWithOri("zdAllergen", '/thmz/getZdAllergenListByCode?code=', false);
  3706. //过敏源
  3707. dynamicSelectWithOri("editZdAllergen", '/thmz/getZdAllergenListByCode?code=', false);
  3708. //药品列表
  3709. dynamicSelectWithOri("ypDitList", '/thmz/getYpZdDictListByCode?code=', false);
  3710. //药品列表
  3711. dynamicSelectWithOri("editYpDitList", '/thmz/getYpZdDictListByCode?code=', false);
  3712. }
  3713. /**
  3714. * 初始化性别下拉选
  3715. */
  3716. function initGenderSelect() {
  3717. var gender = '<option value="1">男</option><option value="2">女</option><option value="0">未知</option>';
  3718. $('#rapidAcceptsUserGender').html(gender);
  3719. $('#rapidAcceptsUserGender').selectpicker('refresh');
  3720. $('#editUserGender').html(gender);
  3721. $('#editUserGender').selectpicker('refresh');
  3722. $('#crbMainCardGender').html(gender);
  3723. $('#crbMainCardGender').selectpicker('refresh');
  3724. //医疗范文状态
  3725. var templateStatus = '<option value="0">启用</option><option value="1">停用</option>';
  3726. $('#templateStatus').html(templateStatus);
  3727. $('#templateStatus').selectpicker('refresh');
  3728. //医疗范文操作类型
  3729. var operationType = '<option value="0">新增</option><option value="1">修改</option>';
  3730. $('#operationType').html(operationType);
  3731. $('#operationType').selectpicker('refresh');
  3732. //入院病情
  3733. var conditionCode = '<option value="1">有</option><option value="2">临床未确定</option><option value="3">情况不明</option><option value="4">无</option>';
  3734. $('#conditionCode').html(conditionCode);
  3735. $('#conditionCode').selectpicker('refresh');
  3736. //入院途径
  3737. initRouteOfAdmission()
  3738. //就诊人群类型
  3739. var mdtrtGrpType = '<option value="-1">无</option><option value="1">新冠肺炎确诊患者</option><option value="2">其他国家突发公共事件</option><option value="3">新冠肺炎疑似患者</option><option value="4">无症状感染者</option>';
  3740. $('#mdtrtGrpType').html(mdtrtGrpType);
  3741. $('#mdtrtGrpType').selectpicker('refresh');
  3742. //外伤标志
  3743. var trumFlag = '<option value="0">否</option><option value="1">是</option>';
  3744. $('#trumFlag').html(trumFlag);
  3745. $('#trumFlag').selectpicker('refresh');
  3746. //涉及第三方标志
  3747. var relTtpFlag = '<option value="0">否</option><option value="1">是</option>';
  3748. $('#relTtpFlag').html(relTtpFlag);
  3749. $('#relTtpFlag').selectpicker('refresh');
  3750. //门诊急诊转诊标志
  3751. var otpErReflFlag = '<option value="-1">无</option><option value="1">急诊</option><option value="2">转诊</option><option value="3">转诊合并急诊</option>';
  3752. $('#otpErReflFlag').html(otpErReflFlag);
  3753. $('#otpErReflFlag').selectpicker('refresh');
  3754. }
  3755. /**
  3756. * 初始化中药类型下拉选
  3757. */
  3758. function initZyClassTypeSelect() {
  3759. var gender = '<option value="81">普通</option><option value="83">颗粒剂</option>';
  3760. $('#zyClassType').html(gender);
  3761. $('#zyClassType').selectpicker('refresh');
  3762. //$('#zyClassType').selectpicker('val', "81");
  3763. // $('#zyClassType').selectpicker('refresh');
  3764. }
  3765. /**
  3766. * 初始化皮试结果下拉选
  3767. * @param categoriesFlag 0 口服 2 注射针剂
  3768. */
  3769. function initTryResultSelect(categoriesFlag) {
  3770. var tryResult = '';
  3771. if (categoriesFlag == 2 || categoriesFlag == "2") {
  3772. tryResult += '<option value="100">皮试</option>';
  3773. }
  3774. tryResult += '<option value="0">阴性</option><option value="3">免试</option>';
  3775. //var tryResult = '<option value="100">皮试</option><option value="0">阴性</option><option value="3">免试</option>';
  3776. $('#tryResult').html(tryResult);
  3777. $('#tryResult').selectpicker('refresh');
  3778. //口服药选择皮试结果
  3779. $("#tryResult").parent().parent().parent().removeClass("hide").addClass("in");
  3780. }
  3781. /**
  3782. * 初始化病人身份类别下拉选
  3783. */
  3784. function initResponceTypeSelect() {
  3785. $.ajax({
  3786. type: "GET",
  3787. url: '/thmz/getMzResponceType',
  3788. contentType: "application/json;charset=UTF-8",
  3789. dataType: "json",
  3790. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3791. success: function (res) {
  3792. if (res == '401' || res == 401) {
  3793. window.location.href = '/thmz/login/view'
  3794. return;
  3795. }
  3796. if (res.code == 0) {
  3797. res.data.forEach(function (item, index) {
  3798. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  3799. $('#patientsNature').append(html);
  3800. $('#editUserPatientsNature').append(html);
  3801. $('#crbMainCardPatientsNature').append(html);
  3802. // $('#responeTypeBeHospitalized').append(html);
  3803. });
  3804. $('#patientsNature').selectpicker('refresh');
  3805. $('#editUserPatientsNature').selectpicker('refresh');
  3806. $('#crbMainCardPatientsNature').selectpicker('refresh');
  3807. } else {
  3808. errorMesage(res);
  3809. }
  3810. }
  3811. });
  3812. }
  3813. /**
  3814. * 所有的入院状态
  3815. */
  3816. function iniAdmissStatus() {
  3817. $.ajax({
  3818. type: "GET",
  3819. url: '/thmz/getAdmissStatus',
  3820. dataType: "json",
  3821. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3822. success: function (res) {
  3823. if (res == '401' || res == 401) {
  3824. window.location.href = '/thmz/login/view'
  3825. return;
  3826. }
  3827. var html = '';
  3828. $.each(res.data, function (commentIndex, comment) {
  3829. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  3830. });
  3831. $('#admissStatus').empty();
  3832. $('#admissStatus').html(html);
  3833. $('#admissStatus').selectpicker('destroy').selectpicker('refresh');
  3834. }
  3835. });
  3836. }
  3837. /**
  3838. * 初始化入院途径
  3839. */
  3840. function initRouteOfAdmission() {
  3841. getAjaxRequst("/thmz/queryRouteOfAdmission",{},true,function (res) {
  3842. if (res == '401' || res == 401) {
  3843. window.location.href = '/thmz/login/view'
  3844. return;
  3845. }
  3846. var html = '';
  3847. $.each(res.data, function (commentIndex, comment) {
  3848. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  3849. });
  3850. $('#routeOfAdmission').empty();
  3851. $('#routeOfAdmission').html(html);
  3852. $('#routeOfAdmission').selectpicker('destroy').selectpicker('refresh');
  3853. })
  3854. }
  3855. /**
  3856. * 入院登记的病区列表
  3857. */
  3858. function initListDeptSelect() {
  3859. //科室列表
  3860. $.ajax({
  3861. type: "GET",
  3862. url: '/thmz/allInpatientWard',
  3863. dataType: "json",
  3864. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3865. success: function (data) {
  3866. if (data == '401' || data == 401) {
  3867. window.location.href = '/thmz/login/view'
  3868. return;
  3869. }
  3870. var html = '';
  3871. $.each(data.data, function (commentIndex, comment) {
  3872. if(comment.code !='8000020'){
  3873. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';
  3874. }
  3875. });
  3876. $('#inpatientWardBeHospitalized').empty();
  3877. $('#inpatientWardBeHospitalized').html(html);
  3878. $('#inpatientWardBeHospitalized').selectpicker('refresh');
  3879. initSmallDeptByDept();
  3880. }
  3881. });
  3882. }
  3883. /**
  3884. * 小科室列表
  3885. */
  3886. function initSmallDeptByDept() {
  3887. let code = escape($('#inpatientWardBeHospitalized').val()).replace(/\+/g, '%2B');
  3888. //小科室列表
  3889. $.ajax({
  3890. type: "GET",
  3891. url: '/thmz/getSmallDeptByDept?code=' + code,
  3892. dataType: "json",
  3893. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3894. success: function (res) {
  3895. if (res == '401' || res == 401) {
  3896. window.location.href = '/thmz/login/view'
  3897. return;
  3898. }
  3899. var html = '';
  3900. $.each(res.data, function (commentIndex, comment) {
  3901. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  3902. });
  3903. $('#smallWardBeHospitalized').empty();
  3904. $('#smallWardBeHospitalized').html(html);
  3905. $('#smallWardBeHospitalized').selectpicker('destroy').selectpicker('refresh');
  3906. }
  3907. });
  3908. //病床数
  3909. $.ajax({
  3910. type: "GET",
  3911. url: '/thmz/getBedStatusNumByDept?code=' + code,
  3912. dataType: "json",
  3913. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3914. success: function (res) {
  3915. if (res == '401' || res == 401) {
  3916. window.location.href = '/thmz/login/view'
  3917. return;
  3918. }
  3919. if (res.code == 0) {
  3920. var data = res.data;
  3921. if (data == null) {
  3922. $("#totalBedNum").val(0);
  3923. $("#freeBedNum").val(0);
  3924. $("#occupationBedNum").val(0);
  3925. } else {
  3926. $("#totalBedNum").val(data.total);
  3927. $("#freeBedNum").val(data.free);
  3928. $("#occupationBedNum").val(data.occupation);
  3929. }
  3930. } else {
  3931. errorMesage(res);
  3932. }
  3933. }
  3934. });
  3935. }
  3936. /**
  3937. * 初始化门诊统筹下拉选
  3938. */
  3939. function initMztcSelect() {
  3940. var selectHtml = '<option value="0">否</option><option value="1">是</option>';
  3941. $('#zgmztczf').html(selectHtml);
  3942. $('#zgmztczf').selectpicker('refresh');
  3943. var gzZfSelectHtml = '<option value="0">否</option><option value="1">使用个账</option><option value="2">使用共济账户</option>';
  3944. $('#grzhzf').html(gzZfSelectHtml);
  3945. $('#grzhzf').selectpicker('refresh');
  3946. }
  3947. /**
  3948. * 初始化手术下拉选
  3949. */
  3950. function initMzssSelect() {
  3951. var selectHtml = '<option value="0">否</option><option value="1">是</option>';
  3952. $('#urgentClinicFlag').html(selectHtml);
  3953. $('#urgentClinicFlag').selectpicker('refresh');
  3954. $('#urgentClinicFlag').selectpicker('val', "0");
  3955. $('#urgentClinicFlag').selectpicker('refresh');
  3956. var bcHtml = '<option value="1">正常</option><option value="2">加班</option>';
  3957. $('#ssbc').html(bcHtml);
  3958. $('#ssbc').selectpicker('refresh');
  3959. $('#ssbc').selectpicker('val', "1");
  3960. $('#ssbc').selectpicker('refresh');
  3961. }
  3962. /**
  3963. * 初始化医疗范文范围下拉选
  3964. * @param templateTypeId
  3965. */
  3966. function initTemplateTypeSelect(templateTypeId) {
  3967. $.ajax({
  3968. type: "GET",
  3969. url: '/thmz/getTemplateTypes',
  3970. contentType: "application/json;charset=UTF-8",
  3971. dataType: "json",
  3972. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3973. success: function (res) {
  3974. if (res == '401' || res == 401) {
  3975. window.location.href = '/thmz/login/view'
  3976. return;
  3977. }
  3978. if (res.code == 0) {
  3979. res.data.forEach(function (item) {
  3980. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  3981. $('#' + templateTypeId).append(html);
  3982. });
  3983. $('#' + templateTypeId).selectpicker('refresh');
  3984. if(templateTypeId =='templateTypeForm'){
  3985. $('#'+templateTypeId).selectpicker('val', "0");
  3986. $('#'+templateTypeId).selectpicker('refresh');
  3987. fitTemplateData()
  3988. }
  3989. } else {
  3990. errorMesage(res);
  3991. }
  3992. }
  3993. });
  3994. }
  3995. /**
  3996. * 初始化医疗范文类型下拉选
  3997. * @param templateKindTypeId
  3998. */
  3999. function initTemplateKindTypeSelect(templateKindTypeId) {
  4000. $.ajax({
  4001. type: "GET",
  4002. url: '/thmz/getTemplateKindTypes',
  4003. contentType: "application/json;charset=UTF-8",
  4004. dataType: "json",
  4005. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4006. success: function (res) {
  4007. if (res == '401' || res == 401) {
  4008. window.location.href = '/thmz/login/view'
  4009. return;
  4010. }
  4011. if (res.code == 0) {
  4012. res.data.forEach(function (item) {
  4013. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  4014. $('#' + templateKindTypeId).append(html);
  4015. });
  4016. $('#' + templateKindTypeId).selectpicker('refresh');
  4017. $('#' + templateKindTypeId).selectpicker({
  4018. dropuAuto: false,
  4019. size: 5
  4020. });
  4021. } else {
  4022. errorMesage(res);
  4023. }
  4024. }
  4025. });
  4026. }
  4027. /**
  4028. * 初始频次下拉选
  4029. * @param id
  4030. * @param async 是否是异步 true 异步 false 同步
  4031. */
  4032. function initOrderFrequencys(id, async) {
  4033. $.ajax({
  4034. type: "GET",
  4035. url: '/thmz/getXyOrderFrequencys',
  4036. dataType: "json",
  4037. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4038. async: async,
  4039. success: function (res) {
  4040. if (res == '401' || res == 401) {
  4041. window.location.href = '/thmz/login/view'
  4042. return;
  4043. }
  4044. var html = '';
  4045. $.each(res.data, function (commentIndex, comment) {
  4046. html += '<option value="' + comment.code + '" desc="' + comment.times + '">' + comment.name + '(' + comment.code + ')' + '</option>';
  4047. });
  4048. $('#' + id).empty();
  4049. $('#' + id).html(html);
  4050. $('#' + id).selectpicker('refresh');
  4051. }
  4052. });
  4053. }
  4054. /**
  4055. * 初始中药频次下拉选
  4056. * @param id
  4057. * @param async 是否是异步 true 异步 false 同步
  4058. */
  4059. function initZyOrderFrequencys(id, async) {
  4060. $.ajax({
  4061. type: "GET",
  4062. url: '/thmz/getZyOrderFrequencys',
  4063. dataType: "json",
  4064. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4065. async: async,
  4066. success: function (res) {
  4067. if (res == '401' || res == 401) {
  4068. window.location.href = '/thmz/login/view'
  4069. return;
  4070. }
  4071. var html = '';
  4072. $.each(res.data, function (commentIndex, comment) {
  4073. html += '<option value="' + comment.code + '" desc="' + comment.times + '">' + comment.name + '(' + comment.code + ')' + '</option>';
  4074. });
  4075. $('#' + id).empty();
  4076. $('#' + id).html(html);
  4077. $('#' + id).selectpicker('refresh');
  4078. }
  4079. });
  4080. }
  4081. /**
  4082. * 初始中药服用说明
  4083. */
  4084. function initAllMzYshZdFysm() {
  4085. $.ajax({
  4086. type: "GET",
  4087. url: '/thmz/getAllMzYshZdFysm',
  4088. dataType: "json",
  4089. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4090. async: false,
  4091. success: function (res) {
  4092. if (res == '401' || res == 401) {
  4093. window.location.href = '/thmz/login/view'
  4094. return;
  4095. }
  4096. var html = '';
  4097. $.each(res.data, function (commentIndex, comment) {
  4098. if (comment.name.indexOf(",") < 0) {
  4099. //过滤组合的用法
  4100. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  4101. }
  4102. });
  4103. $('.useType').empty();
  4104. $('.useType').html(html);
  4105. $('.useType').selectpicker('refresh');
  4106. $('.useType').selectpicker('val', "2");
  4107. $('.useType').selectpicker('refresh');
  4108. }
  4109. });
  4110. }
  4111. /**
  4112. * 初始用药方式下拉选
  4113. */
  4114. function initSupplyTypes() {
  4115. $.ajax({
  4116. type: "GET",
  4117. url: '/thmz/getSupplyTypes',
  4118. dataType: "json",
  4119. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4120. success: function (res) {
  4121. if (res == '401' || res == 401) {
  4122. window.location.href = '/thmz/login/view'
  4123. return;
  4124. }
  4125. var html = '';
  4126. $.each(res.data, function (commentIndex, comment) {
  4127. if (comment.supplyOcc === "71") {
  4128. html += '<option value="' + comment.supplyCode + '">' + comment.supplyName + '[' + comment.pyCode + ']' + '</option>';
  4129. }
  4130. });
  4131. $('#supplyType').empty();
  4132. $('#supplyType').html(html);
  4133. $('#supplyType').selectpicker('refresh');
  4134. }
  4135. });
  4136. }
  4137. /**
  4138. * 初始煎药方式下拉选
  4139. * @param async 是否是异步 true 异步 false 同步
  4140. */
  4141. function initZySupplyTypes(id, async) {
  4142. $.ajax({
  4143. type: "GET",
  4144. url: '/thmz/getSupplyTypes',
  4145. dataType: "json",
  4146. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4147. async: async,
  4148. success: function (res) {
  4149. if (res == '401' || res == 401) {
  4150. window.location.href = '/thmz/login/view'
  4151. return;
  4152. }
  4153. var html = '';
  4154. $.each(res.data, function (commentIndex, comment) {
  4155. if (comment.supplyOcc === "81") {
  4156. // html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  4157. html += '<option value="' + comment.supplyCode + '">' + comment.supplyName + '[' + comment.pyCode + ']' + '</option>';
  4158. }
  4159. });
  4160. $('#' + id).empty();
  4161. $('#' + id).html(html);
  4162. $('#' + id).selectpicker('refresh');
  4163. $('#' + id).selectpicker({
  4164. dropuAuto: false,
  4165. size: 10
  4166. });
  4167. }
  4168. });
  4169. }
  4170. /**
  4171. * 初始查检查部位
  4172. */
  4173. function initYshPart() {
  4174. $.ajax({
  4175. type: "GET",
  4176. url: '/thmz/getYshPart',
  4177. dataType: "json",
  4178. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4179. success: function (res) {
  4180. if (res == '401' || res == 401) {
  4181. window.location.href = '/thmz/login/view'
  4182. return;
  4183. }
  4184. var html = '';
  4185. $.each(res.data, function (commentIndex, comment) {
  4186. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')' + '</option>';
  4187. });
  4188. $('#yshPart').empty();
  4189. $('#yshPart').html(html);
  4190. $('#yshPart').selectpicker('refresh');
  4191. $('#yshPart').selectpicker({
  4192. dropuAuto: false,
  4193. size: 10
  4194. });
  4195. }
  4196. });
  4197. }
  4198. /**
  4199. * 初始化验物下拉选
  4200. */
  4201. function initJyZdSample() {
  4202. $.ajax({
  4203. type: "GET",
  4204. url: '/thmz/getJyZdSample',
  4205. dataType: "json",
  4206. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4207. success: function (res) {
  4208. if (res == '401' || res == 401) {
  4209. window.location.href = '/thmz/login/view'
  4210. return;
  4211. }
  4212. var html = '';
  4213. $.each(res.data, function (commentIndex, comment) {
  4214. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')' + '</option>';
  4215. });
  4216. $('#jyZdSample').empty();
  4217. $('#jyZdSample').html(html);
  4218. $('#jyZdSample').selectpicker('refresh');
  4219. $('#jyZdSample').selectpicker({
  4220. dropuAuto: false,
  4221. size: 10
  4222. });
  4223. }
  4224. });
  4225. }
  4226. /**
  4227. * 初始化当前医生说书科室
  4228. */
  4229. function initClinicDeptNo() {
  4230. $.ajax({
  4231. type: "GET",
  4232. url: '/thmz/getUnitCodeByCurrentUser',
  4233. dataType: "json",
  4234. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4235. success: function (res) {
  4236. if (res == '401' || res == 401) {
  4237. window.location.href = '/thmz/login/view'
  4238. return;
  4239. }
  4240. var html = '';
  4241. $.each(res.data, function (commentIndex, comment) {
  4242. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  4243. });
  4244. $('#clinicDeptNo').empty();
  4245. $('#clinicDeptNo').html(html);
  4246. $('#clinicDeptNo').selectpicker('refresh');
  4247. var userIdCode = localStorage.getItem("userIdCode");
  4248. var deptNo = localStorage.getItem(userIdCode);
  4249. if (deptNo != null && deptNo != "") {
  4250. $('#clinicDeptNo').selectpicker('val', deptNo);
  4251. $('#clinicDeptNo').selectpicker('refresh');
  4252. }
  4253. }
  4254. });
  4255. }
  4256. /**
  4257. * 保存当前药品到右边处方区域
  4258. * @param index 0 西药 1中药 2 诊疗和社备
  4259. */
  4260. function saveMedicine(index) {
  4261. if (index == 0) {
  4262. saveWesternMedicineWithCheck(true, null);
  4263. } else if (index == 1) {
  4264. saveChineseMedicine(true);
  4265. }
  4266. }
  4267. /**
  4268. * 保存当前药品到右边处方区域 西药
  4269. * calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  4270. * orderNoParmams
  4271. */
  4272. function saveWesternMedicineWithCheck(calculateTotalAmountFlag, orderNoParmams) {
  4273. //是新增药品还是编辑 true 修改 默认false
  4274. var updateFlag = $("#western_medicine_update_flag").val();
  4275. if (updateFlag == "true" || updateFlag == true) {
  4276. saveWesternMedicine(calculateTotalAmountFlag);
  4277. } else {
  4278. //当前药房编码
  4279. var currentGroupNo = $("#current_groupNo").val();
  4280. if (currentGroupNo == "") {
  4281. errorMesageSimaple("您未选择任何药品");
  4282. return;
  4283. }
  4284. if ($("#xyTab").find("li") == null || $("#xyTab").find("li").length == 0) {
  4285. initNavTabs(0, currentGroupNo, orderNoParmams);
  4286. }
  4287. var tableId = $("#xyTab li.active").find("a").attr("href");
  4288. var childrens = $(tableId).find("div:eq(0)").children().length;
  4289. var thisGroupNo = $(tableId).find("input.current_groupNo").val();
  4290. var flag = childrens === 5;
  4291. if (!calculateTotalAmountFlag) {
  4292. flag = childrens === 5 && $(tableId).is(':last-child');
  4293. }
  4294. if (thisGroupNo != null && thisGroupNo != '' && currentGroupNo != thisGroupNo) {
  4295. //当前编辑的处方与选中的品类非同一处方能保存的
  4296. var currentGroupNos = $("#xyTabContent").find("input.current_groupNo");
  4297. //是否需要新增处方页,以保存医材处方
  4298. var needAddTable = true;
  4299. for (var i = 0; i < currentGroupNos.length; i++) {
  4300. if ($(currentGroupNos[i]).val() == currentGroupNo) {
  4301. var next = $(currentGroupNos[i]).next();
  4302. if (needAddTable && $(next).children().length < 5) {
  4303. var parentId = $(currentGroupNos[i]).parent().attr("id");
  4304. //切换处方
  4305. $("#xyTab").find("a[href='#" + parentId + "']").off("click").tab('show');
  4306. //$("#xyTab").find("a[href='#" + tableId + "']").off("click").click();
  4307. //因为存在没有满5个的处方页,直接保存到该页
  4308. needAddTable = false;
  4309. }
  4310. }
  4311. }
  4312. if (needAddTable) {
  4313. //91 医材
  4314. var message = "医材需要单独处方,是否需要新增医材处方?";
  4315. if (currentGroupNo == '71') {
  4316. message = "普通西成药需要单独处方,是否需要新增处方?"
  4317. } else if (currentGroupNo == '111') {
  4318. message = "麻、精一药物需要单独处方,是否需要新增处方?"
  4319. } else if (currentGroupNo == '131') {
  4320. message = "精二药物需要单独处方,是否需要新增处方?"
  4321. }
  4322. if (calculateTotalAmountFlag) {
  4323. $("#messageModal").modal();
  4324. $("#messageContent").html(message);
  4325. $("#messageButton").off("click").on("click", function (t) {
  4326. $("#messageModal").modal("hide");
  4327. refreshNavTabs(0, currentGroupNo, orderNoParmams);
  4328. saveWesternMedicine(calculateTotalAmountFlag);
  4329. });
  4330. $("#cancelButton").off("click").on("click", function (t) {
  4331. return;
  4332. });
  4333. }
  4334. }
  4335. } else if (flag) {
  4336. if (calculateTotalAmountFlag) {
  4337. $("#messageModal").modal();
  4338. $("#messageContent").html("单张处方最多只能开具5个药品,是否需要新增处方?");
  4339. $("#messageButton").off("click").on("click", function (t) {
  4340. $("#messageModal").modal("hide");
  4341. refreshNavTabs(0, currentGroupNo, orderNoParmams);
  4342. saveWesternMedicine(calculateTotalAmountFlag);
  4343. });
  4344. $("#cancelButton").off("click").on("click", function (t) {
  4345. return;
  4346. });
  4347. }
  4348. } else {
  4349. saveWesternMedicine(calculateTotalAmountFlag);
  4350. }
  4351. }
  4352. }
  4353. /**
  4354. * 保存当前药品到右边处方区域 西药
  4355. * calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  4356. */
  4357. function saveWesternMedicine(calculateTotalAmountFlag) {
  4358. //当前药房编码
  4359. var currentGroupNo = $("#current_groupNo").val();
  4360. //药品名称
  4361. var westernMedicineNamme = $("#western_medicine_name").val();
  4362. var tableId = $("#xyTab li.active").find("a").attr("href");
  4363. if (tableId == undefined) {
  4364. refreshNavTabs(0, currentGroupNo, null);
  4365. tableId = $("#xyTab li.active").find("a").attr("href");
  4366. }
  4367. var thisGroupNo = $(tableId).find("input.current_groupNo").val();
  4368. if (currentGroupNo != thisGroupNo) {
  4369. //91 医材
  4370. var type = "医材";
  4371. if (currentGroupNo == '71') {
  4372. type = "普通西成药"
  4373. } else if (currentGroupNo == '111') {
  4374. type = "麻、精一药物"
  4375. } else if (currentGroupNo == '131') {
  4376. type = "精二药物"
  4377. }
  4378. errorMesageSimaple("【" + westernMedicineNamme + "】是" + type + ",无法保存到当前处方,请切换或者新增相应的处方进行保存。");
  4379. return;
  4380. }
  4381. //当前处方选项卡下标
  4382. var xyTabIndex = $("#xyTab li.active").index();
  4383. //组号
  4384. var groupId = $("#groupId").val();
  4385. if (groupId == null || groupId == '') {
  4386. errorMesageSimaple("组号为空,请选择组号!");
  4387. return;
  4388. }
  4389. groupId = parseInt(groupId);
  4390. if (groupId == null || isNaN(groupId)) {
  4391. errorMesageSimaple("组号为空,请选择组号!");
  4392. return;
  4393. }
  4394. if (gropuIdAndOrderNoMap == null) {
  4395. gropuIdAndOrderNoMap = new MyMap();
  4396. }
  4397. var exitIndex = gropuIdAndOrderNoMap.get(groupId);
  4398. if (exitIndex == null) {
  4399. exitIndex = xyTabIndex;
  4400. gropuIdAndOrderNoMap.put(groupId, xyTabIndex);
  4401. }
  4402. if (xyTabIndex != exitIndex) {
  4403. var westernMedicineUpdateFlag = $("#western_medicine_update_flag").val();
  4404. var westernMedicineOriGroupId = $("#western_medicine_ori_group_id").val();
  4405. //非修改组号的情况下就需要切换组号
  4406. if (!((westernMedicineUpdateFlag == true || westernMedicineUpdateFlag == "true") && westernMedicineOriGroupId != groupId)) {
  4407. groupId = parseInt($("#groupId > option:last").val());
  4408. $("#groupId").selectpicker('val', groupId);
  4409. $('#groupId').selectpicker('refresh');
  4410. gropuIdAndOrderNoMap.put(groupId, xyTabIndex);
  4411. appendGroupOrder();
  4412. }
  4413. warningMesageSimaple("同一组药必须出现在同一个处方中,当前组号已经被其他处方使用,系统已自动为您重新分配组号!");
  4414. //return;
  4415. }
  4416. //当前药品编码
  4417. var currentCode = $("#western_medicine_current_code").val();
  4418. //当前药品规格
  4419. var currentSerial = $("#western_medicine_current_serial").val();
  4420. //用法编码
  4421. var supplyType = $("#supplyType").val();
  4422. //用法描述
  4423. var supplyTypeText = $('#supplyType option:selected').text();
  4424. supplyTypeText = supplyTypeText.substring(0, supplyTypeText.indexOf("["));
  4425. //药品默认单次使用剂量
  4426. var drugWinDb = $("#drugWinDb").val();
  4427. //处方实际单次使用剂量
  4428. var drugWin = $("#drugWin").val();
  4429. //剂量单位
  4430. var drugWinUnit = $('#drugWinUnit option:selected').text();
  4431. //drugWinUnit = drugWinUnit.substring(0, drugWinUnit.indexOf("("));
  4432. //天数
  4433. var dayNum = $("#dayNum").val();
  4434. //频次编码
  4435. var orderFrequency = $("#orderFrequency").val();
  4436. //频次描述
  4437. var orderFrequencyText = $('#orderFrequency option:selected').text();
  4438. orderFrequencyText = orderFrequencyText.substring(0, orderFrequencyText.indexOf("("));
  4439. //总量
  4440. var gross = $("#gross").val();
  4441. //包装单位
  4442. var packUnit = $("#packUnit").val();
  4443. if (packUnit == null) {
  4444. packUnit = "";
  4445. }
  4446. //医嘱码
  4447. var medicalAdvice = $("#medicalAdvice").val();
  4448. //医嘱内容
  4449. var medicalAdviceText = $('#medicalAdvice option:selected').text();
  4450. medicalAdviceText = medicalAdviceText.substring(0, medicalAdviceText.indexOf("("));
  4451. //金额
  4452. var totalRetprice = parseFloat($("#totalRetprice").val());
  4453. //单价
  4454. var packRetprice = $("#packRetprice").val();
  4455. //皮试结果
  4456. var tryResult = $("#tryResult").val();
  4457. //药品大类标志
  4458. var categoriesFlag = $("#categoriesFlag").val();
  4459. //报销自费标识
  4460. var xyHospApprFlag = $("#xyHospApprFlag").val();
  4461. if (currentCode == null || currentCode == '') {
  4462. if (calculateTotalAmountFlag) {
  4463. errorMesageSimaple("未选择任何药品!");
  4464. }
  4465. return;
  4466. }
  4467. if (currentGroupNo != '91') {
  4468. if (supplyType == null || supplyType == "") {
  4469. errorMesageSimaple("用法为空!");
  4470. return;
  4471. }
  4472. if (drugWin == null || drugWin == "") {
  4473. errorMesageSimaple("剂量为空!");
  4474. return;
  4475. }
  4476. if (dayNum == null || dayNum == "") {
  4477. errorMesageSimaple("天数为空!");
  4478. return;
  4479. }
  4480. if (orderFrequency == null || orderFrequency == "") {
  4481. errorMesageSimaple("频次为空!");
  4482. return;
  4483. }
  4484. }
  4485. if (gross == null || gross == "") {
  4486. errorMesageSimaple("总量为空!");
  4487. return;
  4488. }
  4489. var manufactoryName = $("#manufactoryName").val();
  4490. var html = '<div class="form-group">';
  4491. html += '<span class="groupId">' + groupId + '</span>' + '.<span style="margin-left: 5px"></span>';
  4492. html += westernMedicineNamme;
  4493. if (manufactoryName != null && manufactoryName != 'null' && manufactoryName != "") {
  4494. html += "(" + manufactoryName + ")"
  4495. }
  4496. html += '&nbsp;&nbsp;&nbsp;&nbsp;';
  4497. html += $("#specification").val();
  4498. html += '&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;';
  4499. //html += drugWinDb + drugWinUnit + ' 共';
  4500. html += gross + packUnit + " " + '<br/><span style="margin-left: 15px"></span>';
  4501. html += '用法:' + supplyTypeText + ' ';
  4502. html += drugWin + drugWinUnit + ' ';
  4503. html += '频次:' + orderFrequencyText + ' ';
  4504. html += dayNum + '天 ';
  4505. if (tryResult != null && tryResult != 'null' && tryResult != "") {
  4506. if (tryResult == "100" || tryResult == 100) {
  4507. html += '皮试 ';
  4508. } else {
  4509. html += '皮试结果: ' + $('#tryResult option:selected').text();
  4510. }
  4511. }
  4512. if (medicalAdvice != null && medicalAdvice != '') {
  4513. html += '医嘱:' + medicalAdviceText;
  4514. }
  4515. 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>';
  4516. 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>';
  4517. 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>';
  4518. 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>';
  4519. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  4520. html += '<input type="hidden" class="temporary_items_serial" value="' + currentSerial + '"/>';
  4521. html += '<input type="hidden" class="temporary_items_amount" value="' + totalRetprice + '"/>';
  4522. html += '<input type="hidden" class="temporary_items_groupId" value="' + groupId + '"/>';
  4523. html += '<input type="hidden" class="temporary_items_westernMedicineNamme" value="' + westernMedicineNamme + '"/>';
  4524. html += '<input type="hidden" class="temporary_items_drugWinDb" value="' + drugWinDb + '"/>';
  4525. html += '<input type="hidden" class="temporary_items_drugWin" value="' + drugWin + '"/>';
  4526. html += '<input type="hidden" class="temporary_items_drugWinUnit" value="' + $("#drugWinUnit").val() + '"/>';
  4527. html += '<input type="hidden" class="temporary_items_gross" value="' + gross + '"/>';
  4528. html += '<input type="hidden" class="temporary_items_packUnit" value="' + packUnit + '"/>';
  4529. html += '<input type="hidden" class="temporary_items_supplyType" value="' + supplyType + '"/>';
  4530. html += '<input type="hidden" class="temporary_items_orderFrequency" value="' + orderFrequency + '"/>';
  4531. html += '<input type="hidden" class="temporary_items_dayNum" value="' + dayNum + '"/>';
  4532. html += '<input type="hidden" class="temporary_items_medicalAdvice" value="' + medicalAdvice + '"/>';
  4533. html += '<input type="hidden" class="temporary_items_medicalAdviceText" value="' + medicalAdviceText + '"/>';
  4534. html += '<input type="hidden" class="temporary_items_packRetprice" value="' + packRetprice + '"/>';
  4535. html += '<input type="hidden" class="temporary_items_tryResult" value="' + tryResult + '"/>';
  4536. html += '<input type="hidden" class="temporary_items_currentGroupNo" value="' + currentGroupNo + '"/>';
  4537. html += '<input type="hidden" class="temporary_items_categoriesFlag" value="' + categoriesFlag + '"/>';
  4538. html += '<input type="hidden" class="temporary_items_xyHospApprFlag" value="' + xyHospApprFlag + '"/>';
  4539. html += '</div>';
  4540. var tableId = $("#xyTab li.active").find("a").attr("href");
  4541. //是新增药品还是编辑 true 修改 默认false
  4542. var updateFlag = $("#western_medicine_update_flag").val();
  4543. if (updateFlag == undefined || updateFlag == null) {
  4544. updateFlag = false;
  4545. }
  4546. // //原药品金额 如果是修改则需要设置
  4547. // var temporaryItemsAmount = 0;
  4548. //当前需要被移除元素的下个兄弟节点
  4549. var nextObj = null;
  4550. //当前修改的药品是不是最后一个
  4551. var isLast = false;
  4552. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  4553. if (formGroups != null && formGroups.length > 0) {
  4554. //如果是修改,需要减去原来的费用
  4555. if (updateFlag == "true" || updateFlag == true) {
  4556. //药品有可能会修改,所以,判断的时候要用原药品编码
  4557. var updateOriCode = $("#update_ori_code").val();
  4558. //规格有可能会修改,所以,判断的时候要用原规格
  4559. var updateOriSerial = $("#update_ori_serial").val();
  4560. //组号有可能会修改,所以,判断的时候要用原组号
  4561. var westernMedicineOriGroupId = $("#western_medicine_ori_group_id").val();
  4562. for (var i = 0; i < formGroups.length; i++) {
  4563. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  4564. var temporaryItemsSerial = $(formGroups[i]).find("input.temporary_items_serial").val();
  4565. var temporaryItemsGroupId = $(formGroups[i]).find("input.temporary_items_groupId").val();
  4566. if (temporaryItemsCode === updateOriCode && temporaryItemsSerial === updateOriSerial && temporaryItemsGroupId == westernMedicineOriGroupId) {
  4567. //temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  4568. if (formGroups.length > 1) {
  4569. nextObj = $(formGroups[i]).next();
  4570. }
  4571. isLast = (i + 1) === formGroups.length;
  4572. $(formGroups[i]).remove();
  4573. break;
  4574. }
  4575. }
  4576. } else {
  4577. //因为药品可以换组号,要保证相同组号的在一起
  4578. for (var i = 0; i < formGroups.length; i++) {
  4579. var temporaryItemsGroupId = parseInt($(formGroups[i]).find("input.temporary_items_groupId").val());
  4580. //如果当前的组号小与遍历到的组号,说明是原组号的下一个兄弟节点,新的药品插入到兄弟节点前就可以了
  4581. if (temporaryItemsGroupId > groupId) {
  4582. nextObj = $(formGroups[i]);
  4583. break;
  4584. }
  4585. }
  4586. }
  4587. }
  4588. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  4589. if (nextObj == null || isLast) {
  4590. $(tableId).find("div:eq(0)").append(html);
  4591. } else {
  4592. $(nextObj).before(html);
  4593. }
  4594. //设置当前处方金额
  4595. //calculateCfAmount(tableId, totalRetprice, temporaryItemsAmount, 0, 0);
  4596. if (calculateTotalAmountFlag) {
  4597. //设置总金额
  4598. calculateTotalAmount(true);
  4599. resetGroupIdSelect();
  4600. }
  4601. //判断当前组号是不是最后一个,是最后一个组号,就需要新增组号
  4602. var groupIdLast = $("#groupId option:last-child").text();
  4603. if (groupId === groupIdLast) {
  4604. appendGroupOrder();
  4605. }
  4606. //设置药品的用法,频次,天数
  4607. var map = groupIdMap.get(groupId);
  4608. if (map == null) {
  4609. map = new MyMap();
  4610. map.put("supplyType", supplyType);
  4611. map.put("orderFrequency", orderFrequency);
  4612. map.put("dayNum", dayNum);
  4613. groupIdMap.put(groupId, map);
  4614. }
  4615. //设置当前药品的品类
  4616. $(tableId).find("input.current_groupNo").val($("#current_groupNo").val());
  4617. $("#supplyType").selectpicker('val', null);
  4618. $('#supplyType').selectpicker('refresh');
  4619. clearWesternMedicine(false);
  4620. resetGroupIdMap();
  4621. }
  4622. /**
  4623. * 上移
  4624. * @param obj
  4625. */
  4626. function arrowUp(obj) {
  4627. var parentObject = $(obj).parent();
  4628. if ($(parentObject).prev() == null) {
  4629. return;
  4630. }
  4631. //当前元素的序号
  4632. var thisJcjyItemGroupId = null;
  4633. //前一个兄弟节点的序号
  4634. var prevJcjyItemGroupId = null;
  4635. //当是项目时有序号,进行序号调整
  4636. if ($(parentObject).find("span.jcjyItemGroupId") != null) {
  4637. thisJcjyItemGroupId = $(parentObject).find("span.jcjyItemGroupId").html();
  4638. prevJcjyItemGroupId = $(parentObject).prev().find("span.jcjyItemGroupId").html();
  4639. $(parentObject).find("span.jcjyItemGroupId").html(prevJcjyItemGroupId);
  4640. $(parentObject).prev().find("span.jcjyItemGroupId").html(thisJcjyItemGroupId);
  4641. }
  4642. $(parentObject).prev().before($(parentObject));
  4643. }
  4644. /**
  4645. * 下移
  4646. * @param obj
  4647. */
  4648. function arrowDown(obj) {
  4649. var parentObject = $(obj).parent();
  4650. if ($(parentObject).next() == null) {
  4651. return;
  4652. }
  4653. //当前元素的序号
  4654. var thisJcjyItemGroupId = null;
  4655. //后一个兄弟节点的序号
  4656. var afterJcjyItemGroupId = null;
  4657. //当是项目时有序号,进行序号调整
  4658. if ($(parentObject).find("span.jcjyItemGroupId") != null) {
  4659. thisJcjyItemGroupId = $(parentObject).find("span.jcjyItemGroupId").html();
  4660. afterJcjyItemGroupId = $(parentObject).after().find("span.jcjyItemGroupId").html();
  4661. $(parentObject).find("span.jcjyItemGroupId").html(afterJcjyItemGroupId);
  4662. $(parentObject).after().find("span.jcjyItemGroupId").html(thisJcjyItemGroupId);
  4663. }
  4664. $(parentObject).next().after($(parentObject));
  4665. }
  4666. /**
  4667. * 修改西药
  4668. * @param obj
  4669. */
  4670. function editWesternMedicine(obj) {
  4671. clearWesternMedicine(true);
  4672. //是新增药品还是编辑 true 修改 默认false
  4673. $("#western_medicine_update_flag").val(true);
  4674. var parentObject = $(obj).parent();
  4675. //组号
  4676. $("#groupId").val($(parentObject).find("input.temporary_items_groupId").val());
  4677. //组号有可能会修改,所以,判断的时候要用原组号
  4678. $("#western_medicine_ori_group_id").val($(parentObject).find("input.temporary_items_groupId").val());
  4679. $('#groupId').selectpicker('refresh');
  4680. //药品名称
  4681. $("#western_medicine_name").val($(parentObject).find("input.temporary_items_westernMedicineNamme").val());
  4682. var code = $(parentObject).find("input.temporary_items_code").val();
  4683. var serial = $(parentObject).find("input.temporary_items_serial").val();
  4684. //当前药品编码
  4685. $("#western_medicine_current_code").val(code);
  4686. //当前药品规格
  4687. $("#western_medicine_current_serial").val(serial);
  4688. //当前修改药品原始编码
  4689. $("#update_ori_code").val(code);
  4690. //当前修改的药品原始规格
  4691. $("#update_ori_serial").val(serial);
  4692. //用法编码
  4693. $("#supplyType").val($(parentObject).find("input.temporary_items_supplyType").val());
  4694. $('#supplyType').selectpicker('refresh');
  4695. $("#xyHospApprFlag").val($(parentObject).find("input.temporary_items_xyHospApprFlag").val());
  4696. $('#xyHospApprFlag').selectpicker('refresh');
  4697. //药品默认单次使用剂量
  4698. $("#drugWinDb").val($(parentObject).find("input.temporary_items_drugWinDb").val());
  4699. //处方实际单次使用剂量
  4700. $("#drugWin").val($(parentObject).find("input.temporary_items_drugWin").val());
  4701. //天数
  4702. $("#dayNum").val($(parentObject).find("input.temporary_items_dayNum").val());
  4703. $('#dayNum').selectpicker('refresh');
  4704. //频次编码
  4705. $("#orderFrequency").val($(parentObject).find("input.temporary_items_orderFrequency").val());
  4706. $('#orderFrequency').selectpicker('refresh');
  4707. //总量
  4708. $("#gross").val($(parentObject).find("input.temporary_items_gross").val());
  4709. //医嘱
  4710. $("#medicalAdvice").val($(parentObject).find("input.temporary_items_medicalAdvice").val());
  4711. $('#medicalAdvice').selectpicker('refresh');
  4712. //金额
  4713. $("#totalRetprice").val($(parentObject).find("input.temporary_items_amount").val());
  4714. //单价
  4715. $("#packRetprice").val($(parentObject).find("input.temporary_items_packRetprice").val());
  4716. //皮试结果
  4717. var tryResult = $(parentObject).find("input.temporary_items_tryResult").val();
  4718. //设置当前药品类型
  4719. $("#current_groupNo").val($(parentObject).find("input.temporary_items_currentGroupNo").val());
  4720. //设置当前药品大类
  4721. $("#categoriesFlag").val($(parentObject).find("input.temporary_items_categoriesFlag").val());
  4722. $.ajax({
  4723. type: "GET",
  4724. url: '/thmz/getYpZdDictByCodeAndSerial?code=' + code + "&serial=" + serial + "&deptNo=" + localStorage.getItem("currentDeptNo") + "&groupNo=71",
  4725. contentType: "application/json;charset=UTF-8",
  4726. dataType: "json",
  4727. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4728. success: function (res) {
  4729. if (res == '401' || res == 401) {
  4730. window.location.href = '/thmz/login/view'
  4731. return;
  4732. }
  4733. if (res.code == 0) {
  4734. if (res.data != null) {
  4735. var drugWinHtml = '';
  4736. if (res.data.weight != null) {
  4737. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  4738. $("#drugWin").val(res.data.weight);
  4739. $("#drugWinDb").val(res.data.weight);
  4740. }
  4741. drugWinHtml = '<option value="' + res.data.weighUnit + '" desc="' + res.data.weight + '">' + res.data.weighUnitDesc + '</option>';
  4742. }
  4743. if (res.data.volum != null) {
  4744. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  4745. $("#drugWin").val(res.data.volum);
  4746. $("#drugWinDb").val(res.data.volum);
  4747. }
  4748. drugWinHtml += '<option value="' + res.data.volUnit + '" desc="' + res.data.volum + '">' + res.data.volUnitDesc + '</option>';
  4749. }
  4750. if (res.data.miniUnit != null && res.data.miniUnit != "") {
  4751. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  4752. $("#drugWin").val(1);
  4753. $("#drugWinDb").val(1);
  4754. }
  4755. drugWinHtml += '<option value="' + res.data.miniUnit + '" desc="1">' + res.data.miniUnitDesc + '</option>';
  4756. }
  4757. $('#drugWinUnit').html(drugWinHtml);
  4758. $('#drugWinUnit').selectpicker('refresh');
  4759. //剂量单位
  4760. $("#drugWinUnit").val($(parentObject).find("input.temporary_items_drugWinUnit").val());
  4761. $('#drugWinUnit').selectpicker('refresh');
  4762. if (res.data.packUnitDesc != null && res.data.packUnitDesc != "") {
  4763. var html = '<option value="' + res.data.packUnitDesc + '" >' + res.data.packUnitDesc + '</option>';
  4764. $('#packUnit').html(html);
  4765. $('#packUnit').selectpicker('refresh');
  4766. //包装单位
  4767. $("#packUnit").val($(parentObject).find("input.temporary_items_packUnit").val());
  4768. $('#packUnit').selectpicker('refresh');
  4769. }
  4770. if (res.data.psFlag != null && (res.data.psFlag == 1 || res.data.psFlag == "1")) {
  4771. if (res.data.categoriesFlag == 0 || res.data.categoriesFlag == "0" || res.data.categoriesFlag == 2 || res.data.categoriesFlag == "2") {
  4772. initTryResultSelect(res.data.categoriesFlag);
  4773. $("#tryResult").val(tryResult);
  4774. $('#tryResult').selectpicker('refresh');
  4775. }
  4776. }
  4777. $("#packSize").val(res.data.packSize);
  4778. //厂家名称
  4779. $("#manufactoryName").val(res.data.manufactoryName);
  4780. //规格
  4781. $("#specification").val(res.data.specification);
  4782. }
  4783. } else {
  4784. errorMesage(res);
  4785. }
  4786. }
  4787. });
  4788. }
  4789. /**
  4790. * 修改中药
  4791. * @param obj
  4792. */
  4793. function editChineseMedicine(obj) {
  4794. //是新增药品还是编辑 true 修改 默认false
  4795. $("#chinese_medicine_update_flag").val(true);
  4796. var parentObject = $(obj).parent();
  4797. //当前药品编码
  4798. $("#chinese_medicine_current_code").val($(parentObject).find("input.temporary_items_code").val());
  4799. //当前药品规格
  4800. $("#chinese_medicine_current_serial").val($(parentObject).find("input.temporary_items_serial").val());
  4801. //当前修改药品原始编码
  4802. $("#update_ori_code").val($(parentObject).find("input.temporary_items_code").val());
  4803. //当前修改的药品原始规格
  4804. $("#update_ori_serial").val($(parentObject).find("input.temporary_items_serial").val());
  4805. //中药类型
  4806. $("#zyClassType").val($(parentObject).find("input.temporary_items_zyClassType").val());
  4807. $('#zyClassType').selectpicker('refresh');
  4808. //药品名称
  4809. $("#chinese_medicine_name").val($(parentObject).find("input.temporary_items_chineseMedicineNamme").val());
  4810. //单价
  4811. $("#zy_packRetprice").val($(parentObject).find("input.temporary_items_zyPackRetprice").val());
  4812. //处方实际单次使用剂量
  4813. $("#zy_drugWin").val($(parentObject).find("input.temporary_items_drugWin").val());
  4814. //医嘱码
  4815. $("#zyInstruction").val($(parentObject).find("input.temporary_items_zyInstruction").val());
  4816. $('#zyInstruction').selectpicker('refresh');
  4817. $("#zyHospApprFlag").val($(parentObject).find("input.temporary_items_zyHospApprFlag").val());
  4818. $('#zyHospApprFlag').selectpicker('refresh');
  4819. }
  4820. /**
  4821. * 修改辅助检查、检验项目
  4822. * @param obj
  4823. */
  4824. function editJyJcItem(obj) {
  4825. //是新增药品还是编辑 true 修改 默认false
  4826. $("#jcjy_update_flag").val(true);
  4827. var parentObject = $(obj).parent();
  4828. //当前项目编码
  4829. $("#jcjy_current_code").val($(parentObject).find("input.temporary_items_code").val());
  4830. $("#update_ori_code").val($(parentObject).find("input.temporary_items_code").val());
  4831. //项目名称
  4832. $("#jcJyItem").val($(parentObject).find("input.temporary_items_jcJyItemName").val());
  4833. //单价
  4834. $("#jcjyItemPrice").val($(parentObject).find("input.temporary_items_amount").val());
  4835. //备注
  4836. $("#remark").val($(parentObject).find("input.temporary_items_remark").val());
  4837. var chargeUnit = $(parentObject).find("input.temporary_items_desc_value").val();
  4838. var jcJyZltype = $(parentObject).find("input.temporary_items_type").val();
  4839. //执行科室
  4840. var execUnit = $(parentObject).find("input.temporary_items_execUnit").val();
  4841. $("#execUnit").selectpicker('val', execUnit);
  4842. $('#execUnit').selectpicker('refresh');
  4843. if (jcJyZltype == 1 || jcJyZltype == "1") {
  4844. $("#jyZdSample").selectpicker('val', chargeUnit);
  4845. $('#jyZdSample').selectpicker('refresh');
  4846. $("#jyZdSampleDiv").removeClass("hide").addClass("in");
  4847. $("#jyQuantityDiv").removeClass("hide").addClass("in");
  4848. $("#yshPartDiv").removeClass("in").addClass("hide");
  4849. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  4850. //数量
  4851. var jyQuantity = $(parentObject).find("input.temporary_items_jyQuantity").val();
  4852. $("#jyQuantity").val(jyQuantity);
  4853. } else if (jcJyZltype == 2 || jcJyZltype == "2") {
  4854. $("#yshPart").selectpicker('val', chargeUnit);
  4855. $('#yshPart').selectpicker('refresh');
  4856. $("#yshPartDiv").removeClass("hide").addClass("in");
  4857. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  4858. $("#jyQuantityDiv").removeClass("in").addClass("hide");
  4859. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  4860. }
  4861. $("#jcJyZltype").val(jcJyZltype);
  4862. }
  4863. /**
  4864. * 修改诊疗项目
  4865. * @param obj
  4866. */
  4867. function editZlItem(obj) {
  4868. //是新增药品还是编辑 true 修改 默认false
  4869. $("#zl_update_flag").val(true);
  4870. var parentObject = $(obj).parent();
  4871. //当前项目编码
  4872. $("#zl_current_code").val($(parentObject).find("input.temporary_items_code").val());
  4873. $("#update_ori_code").val($(parentObject).find("input.temporary_items_code").val());
  4874. //项目名称
  4875. $("#zlItem").val($(parentObject).find("input.temporary_items_zlItemName").val());
  4876. //单价
  4877. $("#zlItemPrice").val($(parentObject).find("input.temporary_items_amount").val());
  4878. //备注
  4879. $("#zlRemark").val($(parentObject).find("input.temporary_items_remark").val());
  4880. var chargeUnit = $(parentObject).find("input.temporary_items_desc_value").val();
  4881. //数量
  4882. var itemQuantity = $(parentObject).find("input.temporary_items_itemQuantity").val();
  4883. //执行科室
  4884. var execUnit = $(parentObject).find("input.temporary_items_execUnit").val();
  4885. $("#zlHospApprFlag").val($(parentObject).find("input.temporary_items_zlHospApprFlag").val());
  4886. $('#zlHospApprFlag').selectpicker('refresh');
  4887. var descriptions = $(parentObject).find("input.temporary_items_code").val();
  4888. if (descriptions != null && descriptions != "" && descriptions != 'null') {
  4889. $("#descriptions").val(descriptions);
  4890. }
  4891. var dayZlNum = $(parentObject).find("input.temporary_items_dayZlNum").val();
  4892. if (dayZlNum != null && dayZlNum != "" && dayZlNum != 'null') {
  4893. $("#dayZlNum").selectpicker('val', dayZlNum);
  4894. $('#dayZlNum').selectpicker('refresh');
  4895. }
  4896. var orderFrequencyZl = $(parentObject).find("input.temporary_items_orderFrequencyZl").val();
  4897. if (orderFrequencyZl != null && orderFrequencyZl != "" && orderFrequencyZl != 'null') {
  4898. $("#orderFrequencyZl").selectpicker('val', orderFrequencyZl);
  4899. $('#orderFrequencyZl').selectpicker('refresh');
  4900. }
  4901. var totalNumZl = $(parentObject).find("input.temporary_items_totalNumZl").val();
  4902. if (totalNumZl != null && totalNumZl != "" && totalNumZl != 'null') {
  4903. $("#totalNumZl").val(totalNumZl);
  4904. }
  4905. $("#zlExecUnit").selectpicker('val', execUnit);
  4906. $('#zlExecUnit').selectpicker('refresh');
  4907. //描述
  4908. $("#chargeUnit").val(chargeUnit);
  4909. $("#itemQuantity").val(itemQuantity);
  4910. calculateZl(true);
  4911. }
  4912. /**
  4913. * 保存当前辅助检查、检验项目到右边处方区域 需要提示加价
  4914. * @param calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  4915. */
  4916. function saveJyJcItem(calculateTotalAmountFlag) {
  4917. //6岁内提示加价
  4918. var patientAge = $("#patientAge").text();
  4919. if (calculateTotalAmountFlag && patientAge != null && patientAge != "" && patientAge <= 6) {
  4920. $.ajax({
  4921. type: "GET",
  4922. url: '/thmz/checkAdditionally?code=' + $("#jcjy_current_code").val() + "&jcJyZltype=" + $("#jcJyZltype").val(),
  4923. contentType: "application/json;charset=UTF-8",
  4924. dataType: "json",
  4925. async: false,
  4926. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4927. success: function (res) {
  4928. if (res == '401' || res == 401) {
  4929. window.location.href = '/thmz/login/view'
  4930. return;
  4931. }
  4932. if (res.code == 0) {
  4933. if (res.data != undefined && res.data != null && res.data.co != null && res.data.co == 1 && res.data.xlCode != null && res.data.xlCode != "") {
  4934. var xlCode = res.data.xlCode;
  4935. xlCode = Multiply(100, xlCode);
  4936. $("#messageModal").modal();
  4937. $("#messageContent").html("根据【湘医保发〔2020〕51 号】价格通知,6岁以内的小朋友诊疗费上调" + xlCode + "%,是否需要继续添加该项目?");
  4938. $("#messageButton").off("click").on("click", function (t) {
  4939. $("#messageModal").modal("hide");
  4940. saveJyJcItemReal(calculateTotalAmountFlag);
  4941. });
  4942. $("#cancelButton").off("click");
  4943. } else {
  4944. //虽然是不满6岁,但是也没有需要加收的项目,直接保存
  4945. saveJyJcItemReal(calculateTotalAmountFlag);
  4946. }
  4947. } else {
  4948. errorMesage(res);
  4949. }
  4950. }
  4951. });
  4952. } else {
  4953. saveJyJcItemReal(calculateTotalAmountFlag);
  4954. }
  4955. }
  4956. /**
  4957. * 保存当前项目到右边处方区域
  4958. * @param calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  4959. */
  4960. function saveJyJcItemReal(calculateTotalAmountFlag) {
  4961. var tableId = $("#jcjyTab li.active").find("a").attr("href");
  4962. //组号
  4963. var groupId = $(tableId).find("div:eq(0)").children().length + 1;
  4964. //项目名称
  4965. var jcJyItem = $("#jcJyItem").val();
  4966. //当前项目编码
  4967. var currentCode = $("#jcjy_current_code").val();
  4968. //当前项目价格
  4969. var jcjyItemPrice = $("#jcjyItemPrice").val();
  4970. //执行科室
  4971. var execUnit = $("#execUnit").val();
  4972. //执行科室
  4973. var execUnitName = $('#execUnit option:selected').text();
  4974. execUnitName = execUnitName.substring(0, execUnitName.indexOf("("));
  4975. //描述编码
  4976. var chargeUnitCode = null;
  4977. var chargeUnitName = "";
  4978. //检验物或者检查部位
  4979. var chargeUnit = null;
  4980. //检验数量
  4981. var jyQuantity = null;
  4982. //备注
  4983. var remark = $("#remark").val();
  4984. //项目类型
  4985. var jcJyZltype = $("#jcJyZltype").val();
  4986. if (jcJyZltype == "1" || jcJyZltype == 1) {
  4987. //检验
  4988. chargeUnit = $('#jyZdSample option:selected').text();
  4989. chargeUnit = chargeUnit.substring(0, chargeUnit.indexOf("("));
  4990. chargeUnitCode = $('#jyZdSample').val();
  4991. chargeUnitName = " 检验物:";
  4992. jyQuantity = $('#jyQuantity').val();
  4993. if (calculateTotalAmountFlag == true) {
  4994. if (jyQuantity == null || jyQuantity == "") {
  4995. errorMesageSimaple("检验项目数量为空!");
  4996. return;
  4997. }
  4998. if (jyQuantity <= 0) {
  4999. errorMesageSimaple("检验项目数量不能小于1!");
  5000. return;
  5001. }
  5002. }
  5003. } else if (jcJyZltype == "2" || jcJyZltype == 2) {
  5004. //检查
  5005. chargeUnit = $('#yshPart option:selected').text();
  5006. chargeUnit = chargeUnit.substring(0, chargeUnit.indexOf("("));
  5007. chargeUnitCode = $('#yshPart').val();
  5008. chargeUnitName = " 检查部位:";
  5009. }
  5010. if (currentCode == null || currentCode == '') {
  5011. if (calculateTotalAmountFlag == true) {
  5012. errorMesageSimaple("未选择任何项目!");
  5013. }
  5014. return;
  5015. }
  5016. //判断是否有重复的项目 返回true 说明有重复的
  5017. //彩超加收一个部位的不限制多开
  5018. if ("003913" != currentCode && verifyRepeat(currentCode, null, chargeUnitCode, 2)) {
  5019. return;
  5020. }
  5021. //原药品金额 如果是修改则需要设置
  5022. var temporaryItemsAmount = 0;
  5023. //当前需要被移除元素的下个兄弟节点
  5024. var nextObj = null;
  5025. //当前修改的药品是不是最后一个
  5026. var isLast = false;
  5027. //是新增药品还是编辑 true 修改 默认false
  5028. var updateFlag = $("#jcjy_update_flag").val();
  5029. if (updateFlag == undefined || updateFlag == null) {
  5030. updateFlag = false;
  5031. }
  5032. //如果是修改,需要减去原来的费用
  5033. //原组号
  5034. var oriGroupId = null;
  5035. if (updateFlag == "true" || updateFlag == true) {
  5036. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  5037. if (formGroups != null && formGroups.length > 0) {
  5038. var updateOriCode = $("#update_ori_code").val();
  5039. for (var i = 0; i < formGroups.length; i++) {
  5040. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  5041. if (temporaryItemsCode === updateOriCode) {
  5042. temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  5043. if (formGroups.length > 1) {
  5044. nextObj = $(formGroups[i]).next();
  5045. }
  5046. isLast = (i + 1) === formGroups.length;
  5047. oriGroupId = $(formGroups[i]).find("span.jcjyItemGroupId").text();
  5048. $(formGroups[i]).remove();
  5049. break;
  5050. }
  5051. }
  5052. }
  5053. }
  5054. if (oriGroupId != null) {
  5055. groupId = oriGroupId;
  5056. }
  5057. var html = '<div class="form-group">';
  5058. html += '<span class="jcjyItemGroupId">' + groupId + '</span>.<span style="margin-left: 5px"></span>'
  5059. html += jcJyItem + ' ';
  5060. if (jcJyZltype == "3" || jcJyZltype == 3) {
  5061. html += " 数量:" + itemQuantity;
  5062. }
  5063. if (execUnit != null && execUnit != "") {
  5064. html += " 执行科室:" + execUnitName;
  5065. }
  5066. if (chargeUnit != null && chargeUnit != '') {
  5067. html += chargeUnitName + chargeUnit;
  5068. }
  5069. if (remark != null && remark != '') {
  5070. html += ' 备注:' + remark;
  5071. }
  5072. 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>';
  5073. 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>';
  5074. 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>';
  5075. 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>';
  5076. if ($("#jcJyItemChargeDetail").hasClass("in")) {
  5077. 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>';
  5078. }
  5079. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  5080. html += '<input type="hidden" class="temporary_items_jcJyItemName" value="' + jcJyItem + '"/>';
  5081. html += '<input type="hidden" class="temporary_items_amount" value="' + jcjyItemPrice + '"/>';
  5082. html += '<input type="hidden" class="temporary_items_remark" value="' + remark + '"/>';
  5083. html += '<input type="hidden" class="temporary_items_type" value="' + jcJyZltype + '"/>';
  5084. html += '<input type="hidden" class="temporary_items_desc_value" value="' + chargeUnitCode + '"/>';
  5085. html += '<input type="hidden" class="temporary_items_execUnit" value="' + execUnit + '"/>';
  5086. if (jyQuantity != null) {
  5087. html += '<input type="hidden" class="temporary_items_jyQuantity" value="' + jyQuantity + '"/>';
  5088. }
  5089. html += '</div>';
  5090. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  5091. if (nextObj == null || isLast) {
  5092. $(tableId).find("div:eq(0)").append(html);
  5093. } else {
  5094. $(nextObj).before(html);
  5095. }
  5096. //设置当前处方金额
  5097. //calculateCfAmount(tableId, jcjyItemPrice, temporaryItemsAmount, 2, 0);
  5098. if (calculateTotalAmountFlag) {
  5099. //设置总金额
  5100. calculateTotalAmount(true);
  5101. }
  5102. clearJyJcItem();
  5103. }
  5104. /**
  5105. * 保存当前诊疗项目到右边处方区域 需要提示加价
  5106. * @param calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  5107. */
  5108. function saveZlItem(calculateTotalAmountFlag) {
  5109. //6岁内提示加价
  5110. var patientAge = $("#patientAge").text();
  5111. if (calculateTotalAmountFlag && patientAge != null && patientAge != "" && patientAge <= 6) {
  5112. $.ajax({
  5113. type: "GET",
  5114. url: '/thmz/checkAdditionally?code=' + $("#zl_current_code").val() + "&jcJyZltype=3",
  5115. contentType: "application/json;charset=UTF-8",
  5116. dataType: "json",
  5117. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5118. async: false,
  5119. success: function (res) {
  5120. if (res == '401' || res == 401) {
  5121. window.location.href = '/thmz/login/view'
  5122. return;
  5123. }
  5124. if (res.code == 0) {
  5125. if (res.data != undefined && res.data != null && res.data.co != null && res.data.co == 1 && res.data.xlCode != null && res.data.xlCode != "") {
  5126. var xlCode = res.data.xlCode;
  5127. xlCode = Multiply(100, xlCode);
  5128. $("#messageModal").modal();
  5129. $("#messageContent").html("根据【湘医保发〔2020〕51 号】价格通知,6岁以内的小朋友诊疗费上调" + xlCode + "%,是否需要继续添加该项目?");
  5130. $("#messageButton").off("click").on("click", function (t) {
  5131. $("#messageModal").modal("hide");
  5132. saveZlItemReal(calculateTotalAmountFlag);
  5133. });
  5134. $("#cancelButton").off("click");
  5135. } else {
  5136. //虽然是不满6岁,但是也没有需要加收的项目,直接保存
  5137. saveZlItemReal(calculateTotalAmountFlag);
  5138. }
  5139. } else {
  5140. errorMesage(res);
  5141. }
  5142. }
  5143. });
  5144. } else {
  5145. saveZlItemReal(calculateTotalAmountFlag);
  5146. }
  5147. }
  5148. /**
  5149. * 保存当前项目到右边处方区域
  5150. * @param calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  5151. */
  5152. function saveZlItemReal(calculateTotalAmountFlag) {
  5153. var tableId = $("#zlTab li.active").find("a").attr("href");
  5154. //组号
  5155. var groupId = $(tableId).find("div:eq(0)").children().length + 1;
  5156. //项目名称
  5157. var zlItem = $("#zlItem").val();
  5158. //当前项目编码
  5159. var currentCode = $("#zl_current_code").val();
  5160. //当前项目价格
  5161. var zlItemPrice = $("#zlItemPrice").val();
  5162. //单位
  5163. var chargeUnit = $("#chargeUnit").val();
  5164. //执行科室
  5165. var zlExecUnit = $("#zlExecUnit").val();
  5166. //执行科室
  5167. var zlExecUnitName = $('#zlExecUnit option:selected').text();
  5168. zlExecUnitName = zlExecUnitName.substring(0, zlExecUnitName.indexOf("("));
  5169. //单量
  5170. var itemQuantity = $("#itemQuantity").val();
  5171. //规格
  5172. var descriptions = $("#descriptions").val();
  5173. //天数
  5174. var dayZlNum = $("#dayZlNum").val();
  5175. //频次
  5176. var orderFrequencyZl = $("#orderFrequencyZl").val();
  5177. //总量
  5178. var totalNumZl = $("#totalNumZl").val();
  5179. //描述编码
  5180. var chargeUnitCode = chargeUnit;
  5181. //备注
  5182. var remark = $("#zlRemark").val();
  5183. //报销自费标识
  5184. var zlHospApprFlag = $("#zlHospApprFlag").val();
  5185. if (calculateTotalAmountFlag == true) {
  5186. if (currentCode == null || currentCode == '') {
  5187. errorMesageSimaple("未选择任何项目!");
  5188. return;
  5189. }
  5190. if (totalNumZl == null || totalNumZl == "" || totalNumZl == "null") {
  5191. errorMesageSimaple("项目使用总量为空!");
  5192. return;
  5193. }
  5194. }
  5195. //判断是否有重复的项目 返回true 说明有重复的
  5196. if (verifyRepeat(currentCode, null, null, 3)) {
  5197. return;
  5198. }
  5199. //原药品金额 如果是修改则需要设置
  5200. var temporaryItemsAmount = 0;
  5201. //当前需要被移除元素的下个兄弟节点
  5202. var nextObj = null;
  5203. //当前修改的药品是不是最后一个
  5204. var isLast = false;
  5205. //是新增药品还是编辑 true 修改 默认false
  5206. var updateFlag = $("#zl_update_flag").val();
  5207. if (updateFlag == undefined || updateFlag == null) {
  5208. updateFlag = false;
  5209. }
  5210. //如果是修改,需要减去原来的费用
  5211. //原组号
  5212. var oriGroupId = null;
  5213. if (updateFlag == "true" || updateFlag == true) {
  5214. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  5215. if (formGroups != null && formGroups.length > 0) {
  5216. var updateOriCode = $("#update_ori_code").val();
  5217. for (var i = 0; i < formGroups.length; i++) {
  5218. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  5219. if (temporaryItemsCode === updateOriCode) {
  5220. temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  5221. if (formGroups.length > 1) {
  5222. nextObj = $(formGroups[i]).next();
  5223. }
  5224. isLast = (i + 1) === formGroups.length;
  5225. oriGroupId = $(formGroups[i]).find("span.zlItemGroupId").text();
  5226. $(formGroups[i]).remove();
  5227. break;
  5228. }
  5229. }
  5230. }
  5231. }
  5232. if (oriGroupId != null) {
  5233. groupId = oriGroupId;
  5234. }
  5235. var html = '<div class="form-group">';
  5236. html += '<span class="zlItemGroupId">' + groupId + '</span>.<span style="margin-left: 5px"></span>'
  5237. html += zlItem + ' ';
  5238. if (descriptions != null && descriptions != "") {
  5239. html += " 规格:" + descriptions;
  5240. }
  5241. html += " 单量:" + itemQuantity;
  5242. if (chargeUnit != null && chargeUnit != '') {
  5243. html += chargeUnit;
  5244. }
  5245. if (dayZlNum != null && dayZlNum != "") {
  5246. html += " 天数:" + dayZlNum + "天";
  5247. }
  5248. if (orderFrequencyZl != null && orderFrequencyZl != "") {
  5249. html += " 频次:" + orderFrequencyZl;
  5250. }
  5251. if (totalNumZl != null && totalNumZl != "") {
  5252. html += " 总量:" + totalNumZl;
  5253. if (chargeUnit != null && chargeUnit != '') {
  5254. html += chargeUnit;
  5255. }
  5256. }
  5257. if (zlExecUnit != null && zlExecUnit != "") {
  5258. html += " 执行科室:" + zlExecUnitName;
  5259. }
  5260. if (remark != null && remark != '') {
  5261. html += ' 备注:' + remark;
  5262. }
  5263. 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>';
  5264. 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>';
  5265. 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>';
  5266. 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>';
  5267. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  5268. html += '<input type="hidden" class="temporary_items_zlItemName" value="' + zlItem + '"/>';
  5269. html += '<input type="hidden" class="temporary_items_amount" value="' + zlItemPrice + '"/>';
  5270. html += '<input type="hidden" class="temporary_items_remark" value="' + remark + '"/>';
  5271. html += '<input type="hidden" class="temporary_items_desc_value" value="' + chargeUnitCode + '"/>';
  5272. html += '<input type="hidden" class="temporary_items_itemQuantity" value="' + itemQuantity + '"/>';
  5273. html += '<input type="hidden" class="temporary_items_execUnit" value="' + zlExecUnit + '"/>';
  5274. html += '<input type="hidden" class="temporary_items_descriptions" value="' + descriptions + '"/>';
  5275. html += '<input type="hidden" class="temporary_items_dayZlNum" value="' + dayZlNum + '"/>';
  5276. html += '<input type="hidden" class="temporary_items_orderFrequencyZl" value="' + orderFrequencyZl + '"/>';
  5277. html += '<input type="hidden" class="temporary_items_zlHospApprFlag" value="' + zlHospApprFlag + '"/>';
  5278. html += '<input type="hidden" class="temporary_items_totalNumZl" value="' + totalNumZl + '"/>';
  5279. html += '</div>';
  5280. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  5281. if (nextObj == null || isLast) {
  5282. $(tableId).find("div:eq(0)").append(html);
  5283. } else {
  5284. $(nextObj).before(html);
  5285. }
  5286. //设置当前处方金额
  5287. //calculateCfAmount(tableId, jcjyItemPrice, temporaryItemsAmount, 2, 0);
  5288. if (calculateTotalAmountFlag) {
  5289. //设置总金额
  5290. calculateTotalAmount(true);
  5291. }
  5292. clearZlItem();
  5293. }
  5294. /**
  5295. * 临时保存住院证
  5296. * @param messageFlag 是否需要提醒已经存在的入院申请 true 提示
  5297. */
  5298. function saveZyReq(messageFlag) {
  5299. //如果
  5300. if ($("#zyReqTab").find("li") == null || $("#zyReqTab").find("li").length == 0) {
  5301. initNavTabs(4, null, null);
  5302. }
  5303. var tableId = $("#zyReqTab li.active").find("a").attr("href");
  5304. //病区编码
  5305. var inpatientWardBeHospitalized = $("#inpatientWardBeHospitalized").val();
  5306. //小病室编码
  5307. var smallWardBeHospitalized = $("#smallWardBeHospitalized").val();
  5308. //入院状态编码
  5309. var admissStatus = $("#admissStatus").val();
  5310. //病区名称
  5311. var inpatientWardText = $('#inpatientWardBeHospitalized option:selected').text();
  5312. //小科室名称
  5313. var smallWardText = $('#smallWardBeHospitalized option:selected').text();
  5314. //入院状态名称
  5315. var admissStatusText = $('#admissStatus option:selected').text();
  5316. //入院病情代码
  5317. var conditionCode = $("#conditionCode").val();
  5318. //入院途径代码
  5319. var routeOfAdmission = $("#routeOfAdmission").val();
  5320. //入院病情代码
  5321. var conditionCodeText = $('#conditionCode option:selected').text();
  5322. //入院途径代码
  5323. var routeOfAdmissionText = $('#routeOfAdmission option:selected').text();
  5324. if (admissStatusText == null || admissStatusText == '') {
  5325. errorMesageSimaple("未选择入院状态!");
  5326. return;
  5327. }
  5328. if (conditionCode == null || conditionCode == '') {
  5329. errorMesageSimaple("未选择入院病情!");
  5330. return;
  5331. }
  5332. if (routeOfAdmission == null || routeOfAdmission == '') {
  5333. errorMesageSimaple("未选择入院途径!");
  5334. return;
  5335. }
  5336. if (inpatientWardBeHospitalized == null || inpatientWardBeHospitalized == '') {
  5337. errorMesageSimaple("未选择入院病区!");
  5338. return;
  5339. }
  5340. if (admissStatus == null || admissStatus == '') {
  5341. errorMesageSimaple("未选择入院状态!");
  5342. return;
  5343. }
  5344. if (messageFlag == "true" || messageFlag == true) {
  5345. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  5346. if (formGroups != null && formGroups.length > 0) {
  5347. $("#messageModal").modal();
  5348. $("#messageContent").html("当前病人已经有一个暂存的入院申请,是否需要替换该申请?");
  5349. $("#messageButton").off("click").on("click", function (t) {
  5350. $("#messageModal").modal("hide");
  5351. saveZyReq(false);
  5352. });
  5353. $("#cancelButton").off("click");
  5354. return;
  5355. }
  5356. }
  5357. var html = '<div class="form-group"> 收住院';
  5358. if (inpatientWardText != null) {
  5359. html += " [" + inpatientWardText;
  5360. }
  5361. if (smallWardText != null) {
  5362. html += " (" + smallWardText + ") ";
  5363. }
  5364. if (inpatientWardText != null) {
  5365. html += "]";
  5366. }
  5367. if (admissStatusText != null) {
  5368. html += " " + admissStatusText;
  5369. }
  5370. if (conditionCodeText != null) {
  5371. html += " " + conditionCodeText;
  5372. }
  5373. if (routeOfAdmissionText != null) {
  5374. html += " " + routeOfAdmissionText;
  5375. }
  5376. html += ' 侯床';
  5377. //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>';
  5378. 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>';
  5379. html += '<input type="hidden" class="temporary_inpatient_ward" value="' + inpatientWardBeHospitalized + '"/>';
  5380. html += '<input type="hidden" class="temporary_items_small_ward" value="' + smallWardBeHospitalized + '"/>';
  5381. html += '<input type="hidden" class="temporary_items_admiss_status" value="' + admissStatus + '"/>';
  5382. html += '<input type="hidden" class="temporary_items_condition_code" value="' + conditionCode + '"/>';
  5383. html += '<input type="hidden" class="temporary_items_route_of_admission" value="' + routeOfAdmission + '"/>';
  5384. html += '</div>';
  5385. $(tableId).find("div:eq(0)").html(html);
  5386. clearZyReq();
  5387. }
  5388. /**
  5389. * 临时保存门诊手术
  5390. * @param messageFlag 是否需要提醒已经存在的相同诊间手术申请 true 提示
  5391. */
  5392. function saveOpRecord(messageFlag) {
  5393. //如果
  5394. if ($("#opRecordTab").find("li") == null || $("#opRecordTab").find("li").length == 0) {
  5395. initNavTabs(5, null, null);
  5396. }
  5397. var tableId = $("#opRecordTab li.active").find("a").attr("href");
  5398. //手术名称编码
  5399. var opCode = $("#opName").val();
  5400. //手术名称
  5401. var opNameText = $('#opName option:selected').text();
  5402. //手术时间
  5403. var opTime = $("#opTime").val();
  5404. //急诊标志
  5405. var urgentClinicFlag = $("#urgentClinicFlag").val();
  5406. //急诊标志名称
  5407. var urgentClinicFlagText = $('#urgentClinicFlag option:selected').text();
  5408. //班次
  5409. var ssbc = $("#ssbc").val();
  5410. //班次名称
  5411. var ssbcText = $('#ssbc option:selected').text();
  5412. //手术部位
  5413. var partCode = $("#partCode").val();
  5414. //手术部位名称
  5415. var partCodeText = $('#partCode option:selected').text();
  5416. //手术等级
  5417. var opScale = $("#opScale").val();
  5418. //手术等级名称
  5419. var opScaleText = $('#opScale option:selected').text();
  5420. //麻醉方式
  5421. var hocusCode = $("#hocusCode").val();
  5422. //麻醉方式名称
  5423. var hocusCodeText = $('#hocusCode option:selected').text();
  5424. //主刀医生
  5425. var doctorZd = $("#doctorZd").val();
  5426. //主刀医生名称
  5427. var doctorZdText = $('#doctorZd option:selected').text();
  5428. var opRecordRemark = $("#opRecordRemark").val();
  5429. if (opCode == null || opCode == '') {
  5430. errorMesageSimaple("手术名称为空!");
  5431. return;
  5432. }
  5433. if (opTime == null || opTime == '') {
  5434. errorMesageSimaple("手术时间为空!");
  5435. return;
  5436. }
  5437. if (urgentClinicFlag == null || urgentClinicFlag == '') {
  5438. errorMesageSimaple("急诊标志为空!");
  5439. return;
  5440. }
  5441. if (ssbc == null || ssbc == '') {
  5442. errorMesageSimaple("班次为空!");
  5443. return;
  5444. }
  5445. if (partCode == null || partCode == '') {
  5446. errorMesageSimaple("手术部位为空!");
  5447. return;
  5448. }
  5449. if (opScale == null || opScale == '') {
  5450. errorMesageSimaple("手术等级为空!");
  5451. return;
  5452. }
  5453. if (hocusCode == null || hocusCode == '') {
  5454. errorMesageSimaple("麻醉方式为空!");
  5455. return;
  5456. }
  5457. if (doctorZd == null || doctorZd == '') {
  5458. errorMesageSimaple("主刀医生为空!");
  5459. return;
  5460. }
  5461. //判断是否有重复的项目 返回true 说明有重复的
  5462. if (verifyRepeat(opName, null, null, 5)) {
  5463. return;
  5464. }
  5465. //当前需要被移除元素的下个兄弟节点
  5466. var nextObj = null;
  5467. //当前修改的手术是不是最后一个
  5468. var isLast = false;
  5469. //是新增药品还是编辑 true 修改 默认false
  5470. var updateFlag = $("#op_record_update_flag").val();
  5471. if (updateFlag == undefined || updateFlag == null) {
  5472. updateFlag = false;
  5473. }
  5474. //如果是修改
  5475. if (updateFlag == "true" || updateFlag == true) {
  5476. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  5477. if (formGroups != null && formGroups.length > 0) {
  5478. var updateOriCode = $("#update_ori_code").val();
  5479. for (var i = 0; i < formGroups.length; i++) {
  5480. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  5481. if (temporaryItemsCode === updateOriCode) {
  5482. if (formGroups.length > 1) {
  5483. nextObj = $(formGroups[i]).next();
  5484. }
  5485. isLast = (i + 1) === formGroups.length;
  5486. $(formGroups[i]).remove();
  5487. break;
  5488. }
  5489. }
  5490. }
  5491. }
  5492. var html = '<div class="form-group"> 手术名称:' + opNameText + ' 时间:' + opTime + ' 急诊标志:' + urgentClinicFlagText + ' 班次:' + ssbcText + ' 手术部位:' + partCodeText + ' 手术等级:' + opScaleText + ' 麻醉方式:' + hocusCodeText + ' 主刀医生:' + doctorZdText + ' 附注说明:' + opRecordRemark;
  5493. 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>';
  5494. 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>';
  5495. html += ' <i class="fa fa-long-arrow-left" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;" onclick="editOpRecord(this)"></i>';
  5496. 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>';
  5497. html += '<input type="hidden" class="temporary_items_code" value="' + opCode + '"/>';
  5498. html += '<input type="hidden" class="temporary_items_op_name" value="' + opNameText + '"/>';
  5499. html += '<input type="hidden" class="temporary_items_op_time" value="' + opTime + '"/>';
  5500. html += '<input type="hidden" class="temporary_items_urgent_clinic_flag" value="' + urgentClinicFlag + '"/>';
  5501. html += '<input type="hidden" class="temporary_items_ssbc" value="' + ssbc + '"/>';
  5502. html += '<input type="hidden" class="temporary_items_part_code" value="' + partCode + '"/>';
  5503. html += '<input type="hidden" class="temporary_items_op_scale" value="' + opScale + '"/>';
  5504. html += '<input type="hidden" class="temporary_items_hocus_code" value="' + hocusCode + '"/>';
  5505. html += '<input type="hidden" class="temporary_items_doctor_zd" value="' + doctorZd + '"/>';
  5506. html += '<input type="hidden" class="temporary_items_op_record_remark" value="' + opRecordRemark + '"/>';
  5507. html += '</div>';
  5508. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  5509. if (nextObj == null || isLast) {
  5510. $(tableId).find("div:eq(0)").append(html);
  5511. } else {
  5512. $(nextObj).before(html);
  5513. }
  5514. clearOpRecord();
  5515. }
  5516. /**
  5517. * 修改门诊手术
  5518. * @param obj
  5519. */
  5520. function editOpRecord(obj) {
  5521. //是新增药品还是编辑 true 修改 默认false
  5522. $("#op_record_update_flag").val(true);
  5523. var parentObject = $(obj).parent();
  5524. //当前项目编码
  5525. $("#opName").selectpicker('val', $(parentObject).find("input.temporary_items_code").val());
  5526. $('#opName').selectpicker('refresh');
  5527. $("#update_ori_code").val($(parentObject).find("input.temporary_items_code").val());
  5528. //手术时间
  5529. $("#opTime").val($(parentObject).find("input.temporary_items_op_time").val());
  5530. //急诊标志
  5531. $("#urgentClinicFlag").selectpicker('val', $(parentObject).find("input.temporary_items_urgent_clinic_flag").val());
  5532. $('#urgentClinicFlag').selectpicker('refresh');
  5533. //班次
  5534. $("#ssbc").selectpicker('val', $(parentObject).find("input.temporary_items_ssbc").val());
  5535. $('#ssbc').selectpicker('refresh');
  5536. //部位
  5537. $("#partCode").selectpicker('val', $(parentObject).find("input.temporary_items_part_code").val());
  5538. $('#partCode').selectpicker('refresh');
  5539. //等级
  5540. $("#opScale").selectpicker('val', $(parentObject).find("input.temporary_items_op_scale").val());
  5541. $('#opScale').selectpicker('refresh');
  5542. //麻醉方式
  5543. $("#hocusCode").selectpicker('val', $(parentObject).find("input.temporary_items_hocus_code").val());
  5544. $('#hocusCode').selectpicker('refresh');
  5545. //麻醉方式
  5546. $("#doctorZd").selectpicker('val', $(parentObject).find("input.temporary_items_doctor_zd").val());
  5547. $('#doctorZd').selectpicker('refresh');
  5548. $("#opRecordRemark").val($(parentObject).find("input.temporary_items_op_record_remark").val());
  5549. }
  5550. /**
  5551. * 删除药品或者项目
  5552. * @param index 0 西药 1 中药 2 检查检验 3诊疗
  5553. * @param obj 当前点击的对象
  5554. */
  5555. function removeYpOrProject(index, obj) {
  5556. var tabId = null;
  5557. var className = null;
  5558. //西药
  5559. if (index == 0) {
  5560. tabId = "xyTab";
  5561. } else if (index == 1) {
  5562. //中成药
  5563. tabId = "zyTab";
  5564. } else if (index == 2) {
  5565. //辅助检查、检验
  5566. className = ".jcjyItemGroupId";
  5567. tabId = "jcjyTab";
  5568. } else if (index == 3) {
  5569. //诊疗
  5570. className = ".zlItemGroupId";
  5571. tabId = "zlTab";
  5572. } else if (index == 4) {
  5573. //入院
  5574. tabId = "zyReqTab";
  5575. }
  5576. var tableId = $("#" + tabId + " li.active").find("a").attr("href");
  5577. //var totalRetprice = $(obj).parent().find("input.temporary_items_amount").val();
  5578. //calculateCfAmount(tableId, totalRetprice, null, index, 1);
  5579. //医技和诊疗的序号调整一下
  5580. if (index == 2 || index == 3) {
  5581. var nextAll = $(obj).parent().nextAll();
  5582. if (nextAll != null && nextAll.length > 0) {
  5583. for (var i = 0; i < nextAll.length; i++) {
  5584. var index = $(nextAll[i]).find(className).text();
  5585. $(nextAll[i]).find(className).text(index - 1);
  5586. }
  5587. }
  5588. }
  5589. var temporaryItemsGroupId = $(obj).parent().find("input.temporary_items_groupId").val();
  5590. var temporaryItemsGroupIds = $(obj).parent().parent().find("input.temporary_items_groupId");
  5591. if (temporaryItemsGroupIds != null && temporaryItemsGroupIds.length > 0) {
  5592. var count = 0;
  5593. for (var i = 0; i < temporaryItemsGroupIds.length; i++) {
  5594. if (temporaryItemsGroupId == $(temporaryItemsGroupIds[i]).val()) {
  5595. count++;
  5596. }
  5597. }
  5598. //当前删除的药品组号是最后一个的时候,清空缓存
  5599. if (count == 1) {
  5600. groupIdMap.remove(temporaryItemsGroupId);
  5601. gropuIdAndOrderNoMap.remove(temporaryItemsGroupId);
  5602. }
  5603. }
  5604. $(obj).parent().remove();
  5605. if (index != 4) {
  5606. calculateTotalAmount(false);
  5607. }
  5608. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  5609. if (formGroups == null || formGroups.length == 0) {
  5610. if (index == 0) {
  5611. //西药被清空后,重置药房类型编码
  5612. $(tableId).find("input.current_groupNo").val(null);
  5613. //当本处方内容都被删除完后,也删除处方table
  5614. $("#" + tabId).find("a[href=\"" + tableId + "\"]").parent().remove();
  5615. $(tableId).remove();
  5616. //切换处方 最后一个被选中
  5617. $("#" + tabId).find("li:last > a").off("click").tab('show');
  5618. } else if (index == 1) {
  5619. //当中药处方被清空完后,重置当前中药类型为空
  5620. $("#current_zyClassType").val(null);
  5621. }
  5622. }
  5623. if (index == 0) {
  5624. resetGroupIdMap();
  5625. }
  5626. }
  5627. /**
  5628. * 重置组号与用法、频率天数缓存关系
  5629. */
  5630. function resetGroupIdMap() {
  5631. var temporaryItemsGroupIds = $("#xyTabContent").find("input.temporary_items_groupId");
  5632. if (temporaryItemsGroupIds != null && temporaryItemsGroupIds.length > 0) {
  5633. var list = [];
  5634. for (var i = 0; i < temporaryItemsGroupIds.length; i++) {
  5635. var groupId = $(temporaryItemsGroupIds[i]).val();
  5636. if (list.indexOf(groupId) < 0) {
  5637. list.push(groupId);
  5638. }
  5639. }
  5640. var keys = groupIdMap.keySet();
  5641. for (var i = 0; i < keys.length; i++) {
  5642. var key = keys[i];
  5643. if (list.indexOf(key) < 0) {
  5644. groupIdMap.remove(key);
  5645. }
  5646. }
  5647. }
  5648. }
  5649. /**
  5650. * 清空西药
  5651. * @param flag 是否全部清空 因为 西药有分组,同一组的药品用药方式和频率以及天数一样,不能改变。所以不换组是不能改变 并且设置成不可编辑
  5652. */
  5653. function clearWesternMedicine(flag) {
  5654. $("#addPDiv").css("margin-left", "125px");
  5655. $("#hlyyypsms").removeClass("in").addClass("hide");
  5656. $("#western_medicine_update_flag").val(false);
  5657. $("#western_medicine_ori_group_id").val(null);
  5658. $("#update_ori_code").val(null);
  5659. $("#update_ori_serial").val(null);
  5660. //药品名称
  5661. $("#western_medicine_name").val(null);
  5662. //当前药品编码
  5663. $("#western_medicine_current_code").val(null);
  5664. //当前药品规格
  5665. $("#western_medicine_current_serial").val(null);
  5666. //当前药房编码
  5667. $("#current_groupNo").val(null);
  5668. if (flag) {
  5669. //用法编码
  5670. $("#supplyType").selectpicker('val', null);
  5671. $('#supplyType').selectpicker('refresh');
  5672. //$("#supplyType").removeAttr("disabled");
  5673. //天数
  5674. $("#dayNum").selectpicker('val', null);
  5675. $('#dayNum').selectpicker('refresh');
  5676. // $("#dayNum").removeAttr("disabled");
  5677. //频次编码
  5678. $("#orderFrequency").selectpicker('val', null);
  5679. $('#orderFrequency').selectpicker('refresh');
  5680. // $("#orderFrequency").removeAttr("disabled");
  5681. }
  5682. //药品默认单次使用剂量
  5683. $("#drugWinDb").val(null);
  5684. //处方实际单次使用剂量
  5685. $("#drugWin").val(null);
  5686. //剂量单位
  5687. $("#drugWinUnit").selectpicker('val', null);
  5688. $('#drugWinUnit').selectpicker('refresh');
  5689. //总量
  5690. $("#gross").val(null);
  5691. //包装单位
  5692. $("#packUnit").selectpicker('val', null);
  5693. $('#packUnit').selectpicker('refresh');
  5694. //单价
  5695. $("#packRetprice").val(null);
  5696. //金额
  5697. $("#totalRetprice").val(null);
  5698. //医嘱
  5699. $("#medicalAdvice").selectpicker('val', null);
  5700. $('#medicalAdvice').selectpicker('refresh');
  5701. $("#xyHospApprFlag").selectpicker('val', '0');
  5702. $('#xyHospApprFlag').selectpicker('refresh');
  5703. $("#tryResult").parent().parent().parent().removeClass("in").addClass("hide");
  5704. //皮试结果
  5705. $("#tryResult").selectpicker('val', null);
  5706. $('#tryResult').selectpicker('refresh');
  5707. //$("#gross").attr("readonly", "readonly");
  5708. $("#manufactoryName").val(null);
  5709. $("#specification").val(null);
  5710. $("#categoriesFlag").val(null);
  5711. }
  5712. /**
  5713. * 保存当前药品到右边处方区域 中药
  5714. * calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  5715. */
  5716. function saveChineseMedicine(calculateTotalAmountFlag) {
  5717. //药品名称
  5718. var chineseMedicineNamme = $("#chinese_medicine_name").val();
  5719. //当前药品编码
  5720. var currentCode = $("#chinese_medicine_current_code").val();
  5721. //当前药品规格
  5722. var currentSerial = $("#chinese_medicine_current_serial").val();
  5723. //处方实际单次使用剂量
  5724. var drugWin = $("#zy_drugWin").val();
  5725. //医嘱码
  5726. var zyInstruction = $("#zyInstruction").val();
  5727. //医嘱
  5728. var zyInstructionText = $('#zyInstruction option:selected').text();
  5729. //单价
  5730. var zyPackRetprice = parseFloat($("#zy_packRetprice").val());
  5731. //当前中药的总价
  5732. var totalRetprice = Multiply(drugWin, zyPackRetprice);
  5733. //中药类型
  5734. var zyClassType = $("#zyClassType").val();
  5735. //
  5736. var zyHospApprFlag = $("#zyHospApprFlag").val();
  5737. //已经选中的药品类型, 中药不允许一个处方里有普通中药和颗粒剂
  5738. var currentYyClassType = $("#current_zyClassType").val();
  5739. if (currentYyClassType == null || currentYyClassType == "") {
  5740. //中药此时是第一次选择药品,不控制类型
  5741. $("#current_zyClassType").val(zyClassType);
  5742. } else if (currentYyClassType != zyClassType) {
  5743. errorMesageSimaple("同一个中药处方不允许同时出现普通中药和颗粒剂中药!");
  5744. return;
  5745. }
  5746. if (currentCode == null || currentCode == '') {
  5747. errorMesageSimaple("未选择任何药品!");
  5748. return;
  5749. }
  5750. //颗粒 剂量只能为整数
  5751. if(zyClassType == '83' && !(/(^[1-9]\d*$)/.test(drugWin))){
  5752. errorMesageSimaple("颗粒剂处方剂量只能为大于等于1的正整数!");
  5753. return;
  5754. }
  5755. var html = '<div class="form-group" style="float: left;">';
  5756. html += chineseMedicineNamme;
  5757. if (zyInstruction != null && zyInstruction != '') {
  5758. html += '[' + zyInstructionText + ']';
  5759. }
  5760. html += '<span style="margin-left: 5px"></span>';
  5761. html += drugWin + $("#zyUnit").text();
  5762. 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>';
  5763. 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>';
  5764. 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>';
  5765. 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>';
  5766. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  5767. html += '<input type="hidden" class="temporary_items_serial" value="' + currentSerial + '"/>';
  5768. html += '<input type="hidden" class="temporary_items_amount" value="' + totalRetprice + '"/>';
  5769. html += '<input type="hidden" class="temporary_items_zyClassType" value="' + zyClassType + '"/>';
  5770. html += '<input type="hidden" class="temporary_items_chineseMedicineNamme" value="' + chineseMedicineNamme + '"/>';
  5771. html += '<input type="hidden" class="temporary_items_zyPackRetprice" value="' + zyPackRetprice + '"/>';
  5772. html += '<input type="hidden" class="temporary_items_drugWin" value="' + drugWin + '"/>';
  5773. html += '<input type="hidden" class="temporary_items_drugUnit" value="' + $("#zyUnit").text() + '"/>';
  5774. html += '<input type="hidden" class="temporary_items_zyInstruction" value="' + zyInstruction + '"/>';
  5775. html += '<input type="hidden" class="temporary_items_zyInstructionText" value="' + zyInstructionText + '"/>';
  5776. html += '<input type="hidden" class="temporary_items_zyHospApprFlag" value="' + zyHospApprFlag + '"/>';
  5777. html += '</div>';
  5778. var tableId = $("#zyTab li.active").find("a").attr("href");
  5779. //原药品金额 如果是修改则需要设置
  5780. var temporaryItemsAmount = 0;
  5781. //当前需要被移除元素的下个兄弟节点
  5782. var nextObj = null;
  5783. //当前修改的药品是不是最后一个
  5784. var isLast = false;
  5785. //是新增药品还是编辑 true 修改 默认false
  5786. var updateFlag = $("#chinese_medicine_update_flag").val();
  5787. if (updateFlag == undefined || updateFlag == null) {
  5788. updateFlag = false;
  5789. }
  5790. //如果是修改,需要减去原来的费用
  5791. if (updateFlag == "true" || updateFlag == true) {
  5792. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  5793. if (formGroups != null && formGroups.length > 0) {
  5794. //药品有可能会修改,所以,判断的时候要用原药品编码
  5795. var updateOriCode = $("#update_ori_code").val();
  5796. //规格有可能会修改,所以,判断的时候要用原规格
  5797. var updateOriSerial = $("#update_ori_serial").val();
  5798. for (var i = 0; i < formGroups.length; i++) {
  5799. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  5800. var temporaryItemsSerial = $(formGroups[i]).find("input.temporary_items_serial").val();
  5801. if (temporaryItemsCode === updateOriCode && temporaryItemsSerial === updateOriSerial) {
  5802. temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  5803. if (formGroups.length > 1) {
  5804. nextObj = $(formGroups[i]).next();
  5805. }
  5806. isLast = (i + 1) === formGroups.length;
  5807. $(formGroups[i]).remove();
  5808. break;
  5809. }
  5810. }
  5811. }
  5812. }
  5813. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  5814. if (nextObj == null || isLast) {
  5815. $(tableId).find("div:eq(0)").append(html);
  5816. } else {
  5817. $(nextObj).before(html);
  5818. }
  5819. //设置当前处方金额
  5820. // calculateCfAmount(tableId, totalRetprice, temporaryItemsAmount, 1, 0);
  5821. if (calculateTotalAmountFlag) {
  5822. //设置总金额
  5823. calculateTotalAmount(true);
  5824. }
  5825. clearChineseMedicine();
  5826. }
  5827. /**
  5828. * 清空中药
  5829. */
  5830. function clearChineseMedicine() {
  5831. $("#chinese_medicine_update_flag").val(false);
  5832. $("#update_ori_code").val(null);
  5833. $("#update_ori_serial").val(null);
  5834. //药品名称
  5835. $("#chinese_medicine_name").val(null);
  5836. //当前药品编码
  5837. $("#chinese_medicine_current_code").val(null);
  5838. //当前药品规格
  5839. $("#chinese_medicine_current_serial").val(null);
  5840. //医嘱
  5841. $("#zyInstruction").selectpicker('val', null);
  5842. $('#zyInstruction').selectpicker('refresh');
  5843. $("#zyHospApprFlag").selectpicker('val', '0');
  5844. $('#zyHospApprFlag').selectpicker('refresh');
  5845. //剂量
  5846. $("#zy_drugWin").val(null);
  5847. //单价
  5848. $("#zy_packRetprice").val(null);
  5849. zyUnitChange()
  5850. }
  5851. //中药单位改变
  5852. function zyUnitChange() {
  5853. var zyClassTypeTemp = $("#zyClassType").val()
  5854. if(zyClassTypeTemp == '83'){
  5855. $("#zyUnit").text('袋')
  5856. //煮取 剪法 隐藏
  5857. $("#cyZqlDiv").removeClass("in").addClass("hide");
  5858. $("#ZySupplyTypeDiv").removeClass("in").addClass("hide");
  5859. if($("#cyFjDiv")){
  5860. $("#cyFjDiv").removeClass("in").addClass("hide");
  5861. }
  5862. }else {
  5863. $("#zyUnit").text('g')
  5864. $("#cyZqlDiv").removeClass("hide").addClass("in");
  5865. $("#ZySupplyTypeDiv").removeClass("hide").addClass("in");
  5866. if($("#cyFjDiv")){
  5867. $("#cyFjDiv").removeClass("hide").addClass("in");
  5868. }
  5869. }
  5870. }
  5871. /**
  5872. * 清空辅助检查、检验项目
  5873. */
  5874. function clearJyJcItem() {
  5875. $("#update_ori_code").val(null);
  5876. $("#jcjy_update_flag").val(false);
  5877. //项目名称
  5878. $("#jcJyItem").val(null);
  5879. //当前项目编码
  5880. $("#jcjy_current_code").val(null);
  5881. //单价
  5882. $("#jcjyItemPrice").val(null);
  5883. //备注
  5884. $("#remark").val(null);
  5885. $("#jcJyZltype").val(null);
  5886. $("#jyZdSample").selectpicker('val', null);
  5887. $('#jyZdSample').selectpicker('refresh');
  5888. $("#yshPart").selectpicker('val', null);
  5889. $('#yshPart').selectpicker('refresh');
  5890. $("#execUnit").selectpicker('val', null);
  5891. $('#execUnit').selectpicker('refresh');
  5892. $("#jcJyItemChargeDetail").removeClass("in").addClass("hide");
  5893. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  5894. $("#jyQuantityDiv").removeClass("in").addClass("hide");
  5895. $("#yshPartDiv").removeClass("in").addClass("hide");
  5896. $("#jyQuantity").val(null);
  5897. }
  5898. /**
  5899. * 清空诊疗项目
  5900. */
  5901. function clearZlItem() {
  5902. $("#update_ori_code").val(null);
  5903. $("#zl_update_flag").val(false);
  5904. //项目名称
  5905. $("#zlItem").val(null);
  5906. //当前项目编码
  5907. $("#zl_current_code").val(null);
  5908. //单价
  5909. $("#zlItemPrice").val(null);
  5910. //备注
  5911. $("#zlRemark").val(null);
  5912. //描述
  5913. $("#chargeUnit").val(null);
  5914. $("#itemQuantity").val(1);
  5915. $("#descriptions").val(null);
  5916. $("#dayZlNum").selectpicker('val', 1);
  5917. $('#dayZlNum').selectpicker('refresh');
  5918. $("#zlHospApprFlag").selectpicker('val', '0');
  5919. $('#zlHospApprFlag').selectpicker('refresh');
  5920. $("#orderFrequencyZl").selectpicker('val', 'ONCE');
  5921. $('#orderFrequencyZl').selectpicker('refresh');
  5922. $("#totalNumZl").val(null);
  5923. $("#totalAmountZl").val(null);
  5924. $("#zlExecUnit").selectpicker('val', null);
  5925. $('#zlExecUnit').selectpicker('refresh');
  5926. }
  5927. /**
  5928. * 清空入院证输入框
  5929. */
  5930. function clearZyReq() {
  5931. $("#inpatientWardBeHospitalized").selectpicker('val', null);
  5932. $('#inpatientWardBeHospitalized').selectpicker('refresh');
  5933. $("#smallWardBeHospitalized").selectpicker('val', null);
  5934. $('#smallWardBeHospitalized').selectpicker('refresh');
  5935. $("#admissStatus").selectpicker('val', null);
  5936. $('#admissStatus').selectpicker('refresh');
  5937. $("#conditionCode").selectpicker('val', null);
  5938. $('#conditionCode').selectpicker('refresh');
  5939. $("#routeOfAdmission").selectpicker('val', null);
  5940. $('#routeOfAdmission').selectpicker('refresh');
  5941. $("#totalBedNum").val(null);
  5942. $("#freeBedNum").val(null);
  5943. $("#occupationBedNum").val(null);
  5944. initSmallDeptByDept();
  5945. }
  5946. /**
  5947. * 清空门诊手术输入框
  5948. */
  5949. function clearOpRecord() {
  5950. $("#op_record_update_flag").val(false);
  5951. $("#opName").selectpicker('val', null);
  5952. $('#opName').selectpicker('refresh');
  5953. $("#urgentClinicFlag").selectpicker('val', null);
  5954. $('#urgentClinicFlag').selectpicker('refresh');
  5955. $("#ssbc").selectpicker('val', null);
  5956. $('#ssbc').selectpicker('refresh');
  5957. $("#partCode").selectpicker('val', null);
  5958. $('#partCode').selectpicker('refresh');
  5959. $("#opScale").selectpicker('val', null);
  5960. $('#opScale').selectpicker('refresh');
  5961. $("#opTime").val(null);
  5962. $("#hocusCode").selectpicker('val', null);
  5963. $('#hocusCode').selectpicker('refresh');
  5964. $("#doctorZd").selectpicker('val', null);
  5965. $('#doctorZd').selectpicker('refresh');
  5966. $("#opRecordRemark").val(null);
  5967. }
  5968. /**
  5969. * 计算总金额
  5970. * @param needRemoveLastObject 是否需要删除最后一次加进来的项目
  5971. */
  5972. function calculateTotalAmount(needRemoveLastObject) {
  5973. //调用后去除所有的验证提示
  5974. $("div.alert ").each(function (index, obj) {
  5975. $(obj).remove();
  5976. });
  5977. var jsonData = getParamsForpPrescription(3);
  5978. if(stringIsBlank(jsonData.visitDeptCode)){
  5979. jsonData.visitDeptCode = localStorage.getItem("currentDeptNo")
  5980. }
  5981. $.ajax({
  5982. type: "POST",
  5983. url: '/thmz/getAmountForTempPrescription',
  5984. contentType: "application/json;charset=UTF-8",
  5985. dataType: "json",
  5986. data: JSON.stringify(jsonData),
  5987. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5988. success: function (res) {
  5989. if (res == '401' || res == 401) {
  5990. window.location.href = '/thmz/login/view'
  5991. return;
  5992. }
  5993. if (res.code == 0) {
  5994. if(!stringIsBlank(res.discountWarningMessage)){
  5995. warningMesageSimaple(res.discountWarningMessage)
  5996. }
  5997. $("#totalAmount").html(res.data.amount.toFixed(2));
  5998. var arrs = $("span.cf_amount");
  5999. for (var i = 0; i < arrs.length; i++) {
  6000. if (res.data.amountList[i] != undefined && res.data.amountList[i] != null) {
  6001. $(arrs[i]).html(res.data.amountList[i].toFixed(2));
  6002. }
  6003. }
  6004. } else {
  6005. if (needRemoveLastObject) {
  6006. var index = getIndex("bill_item_group");
  6007. var tabId = null;
  6008. //西药
  6009. if (index == 0) {
  6010. tabId = "xyTab";
  6011. } else if (index == 1) {
  6012. //中成药
  6013. tabId = "zyTab";
  6014. } else if (index == 2) {
  6015. //辅助检查、检验
  6016. tabId = "jcjyTab";
  6017. } else if (index == 3) {
  6018. //诊疗
  6019. tabId = "zlTab";
  6020. } else if (index == 4) {
  6021. //入院
  6022. tabId = "zyReqTab";
  6023. } else if (index == 5) {
  6024. //手术
  6025. tabId = "opRecordTab";
  6026. }
  6027. var tableId = $("#" + tabId + " li.active").find("a").attr("href");
  6028. var last = $(tableId).find("div:eq(0)").find("div:last");
  6029. if (last != null) {
  6030. $(last).find("i:eq(2)").click();
  6031. $(last).find("i:eq(3)").click();
  6032. }
  6033. }
  6034. errorMesage(res);
  6035. }
  6036. }
  6037. });
  6038. }
  6039. // /**
  6040. // * 打开住院处理窗口
  6041. // * @param data
  6042. // */
  6043. // function beHospitalized() {
  6044. // $("#beHospitalizedModal").modal();
  6045. // //根据病人门诊id查询病人的入院申请
  6046. // $.ajax({
  6047. // type: "GET",
  6048. // url: '/thmz/getMzZyReqByPatientId?patientId=' + $("#patientId").text(),
  6049. // contentType: "application/json;charset=UTF-8",
  6050. // dataType: "json",
  6051. // headers: {
  6052. // 'Accept': 'application/json',
  6053. // 'Authorization': 'Bearer ' + localStorage.getItem("token")
  6054. // },
  6055. // success: function (resZyz) {
  6056. // if (resZyz == '401' || resZyz == 401) {
  6057. // window.location.href = '/thmz/login/view'
  6058. // return;
  6059. // }
  6060. // if (resZyz.code == 0) {
  6061. // $("#icdCodeInputBeHospitalized").val(resZyz.data.icdCode);
  6062. // $("#icdTextBeHospitalized").val(resZyz.data.icdText);
  6063. // $("#icdTextBeHospitalized").attr("title", resZyz.data.icdText);
  6064. // $("#inpatientWardBeHospitalized").selectpicker('val', resZyz.data.reqDept);
  6065. // $("#inpatientWardBeHospitalized").selectpicker('refresh');
  6066. // initSmallDeptByDept();
  6067. // $("#smallWardBeHospitalized").selectpicker('val', resZyz.data.smallDept);
  6068. // $("#smallWardBeHospitalized").selectpicker('refresh');
  6069. // $("#admissStatus").selectpicker('val', resZyz.data.admissStatus);
  6070. // $("#admissStatus").selectpicker('refresh');
  6071. // $("#zyReqVisitDate").val(format(resZyz.data.visitDate, "yyyy-MM-dd HH:mm:ss"));
  6072. // }
  6073. // }
  6074. // });
  6075. // }
  6076. /**
  6077. * 打开编辑用户信息窗口
  6078. * @param data
  6079. * @param type 1 患者详情处编辑 2 快速接诊处编辑 3 就诊详情预览
  6080. */
  6081. function editUserModal(patientId, type) {
  6082. if (type == 3) {
  6083. $("#editUserModalTitle").html("患者档案【预览】");
  6084. $("#saveEditUser").removeClass("in").addClass("hide");
  6085. } else {
  6086. $("#editUserModalTitle").html("患者档案【修改】");
  6087. $("#saveEditUser").removeClass("hide").addClass("in");
  6088. }
  6089. $("#openSource").val(type);
  6090. if (patientId == null) {
  6091. //医生工作台发起
  6092. patientId = $("#patientId").text();
  6093. }
  6094. // else {
  6095. // //快速接诊界面发起
  6096. // clearRapidAccepts();
  6097. // }
  6098. if (patientId == null || patientId == "null" || patientId == "") {
  6099. errorMesageSimaple("请输入需要编辑的患者信息");
  6100. return;
  6101. }
  6102. $("#rapidAcceptsModal").modal("hide");
  6103. $("#visitingDetailModal").modal("hide");
  6104. $("#editUserModal").modal();
  6105. $.ajax({
  6106. type: "GET",
  6107. url: '/thmz/getByPatientId?patientId=' + patientId,
  6108. contentType: "application/json;charset=UTF-8",
  6109. dataType: "json",
  6110. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6111. success: function (res) {
  6112. if (res == '401' || res == 401) {
  6113. window.location.href = '/thmz/login/view'
  6114. return;
  6115. }
  6116. if (res.code == 0) {
  6117. if (res.data != null) {
  6118. //延时调用,因为当前弹框还没有加载出来,校验规则无法获取光标与模拟光标丢失事件,延时可以等弹框加载出来后模拟事件
  6119. setTimeout(function () {
  6120. fillPlusPatinet(res.data);
  6121. }, 400);
  6122. }
  6123. } else {
  6124. errorMesage(res);
  6125. $("#editUserModal").modal("hide");
  6126. }
  6127. }
  6128. });
  6129. }
  6130. /**
  6131. * 处方类型按钮切换事件
  6132. * @param object
  6133. * @param objectIndex
  6134. */
  6135. function billItemButtonChange(object, objectIndex) {
  6136. $(".nav-tabs").removeClass("in").addClass("hide");
  6137. $(".tab-content").removeClass("in").addClass("hide");
  6138. $(".nav-tabs:eq(" + objectIndex + ")").removeClass("hide").addClass("in");
  6139. $(".tab-content:eq(" + objectIndex + ")").removeClass("hide").addClass("in");
  6140. $("#bill_item_group").find("button").each(function (index, element) {
  6141. if ($(element).hasClass("btn-primary")) {
  6142. $(element).removeClass("btn-primary").addClass("btn-default");
  6143. }
  6144. $("#rp_form" + index).removeClass("show").addClass("hide");
  6145. });
  6146. $("#rp_form" + objectIndex).removeClass("hide").addClass("show");
  6147. $(object).removeClass("btn-default").addClass("btn-primary");
  6148. $("#western_medicine_name").webuiPopover('hide');
  6149. $("#chinese_medicine_name").webuiPopover('hide');
  6150. $("#jcJyItem").webuiPopover('hide');
  6151. $("#zlItem").webuiPopover('hide');
  6152. if (objectIndex == 0) {
  6153. $("#western_medicine_name").focus();
  6154. //有时候调用药品多了以后,会导致一个药品处方名对应多个content显现
  6155. var paneId = $("#xyTab li.active").find("a").attr("href");
  6156. if (paneId != null) {
  6157. //去除第一个字符 #
  6158. paneId = paneId.slice(1);
  6159. xyTableOnClick(paneId)
  6160. }
  6161. } else if (objectIndex == 1) {
  6162. $("#chinese_medicine_name").focus();
  6163. } else if (objectIndex == 2) {
  6164. $("#jcJyItem").focus();
  6165. } else if (objectIndex == 3) {
  6166. $("#zlItem").focus();
  6167. } else if (objectIndex == 4) {
  6168. // $("#inpatientWardBeHospitalized").next().click();
  6169. prevEleId = "zy_req_button";
  6170. } else if (objectIndex == 5) {
  6171. prevEleId = "op_record_button";
  6172. }
  6173. }
  6174. /**
  6175. * 打开快速接诊窗口
  6176. * @param data
  6177. */
  6178. function rapidAcceptsModal() {
  6179. $("#rapidAcceptsModal").modal();
  6180. //延迟触发 默认光标在卡号输入框
  6181. setTimeout('$("#rapidAcceptsUserCardNo").focus();', 500);
  6182. }
  6183. /**
  6184. * checkBox样式
  6185. */
  6186. function formatCheck() {
  6187. if ($("input.flat")[0]) {
  6188. $(document).ready(function () {
  6189. $('input.flat').iCheck({
  6190. checkboxClass: 'icheckbox_flat-blue',
  6191. radioClass: 'iradio_flat-blue'
  6192. });
  6193. });
  6194. }
  6195. }
  6196. /**
  6197. * 卡号有变化后查询病人信息
  6198. */
  6199. function queryUserInfoByCardNo() {
  6200. //当反写的id不存在,说明不是查询后的改变事件,触发查询
  6201. var rapidAcceptsUserCardNo = $("#rapidAcceptsUserCardNo").val();
  6202. var index = rapidAcceptsUserCardNo.indexOf("-");
  6203. if (($("#patientIdDb").val() == null || $("#patientIdDb").val() == "") && ((index > 0 && index == rapidAcceptsUserCardNo.length - 2) || rapidAcceptsUserCardNo.length == 8)) {
  6204. $("#cardNo").attr("title", rapidAcceptsUserCardNo);
  6205. $.ajax({
  6206. type: "GET",
  6207. url: '/thmz/getByIcCardNo?icCardNo=' + rapidAcceptsUserCardNo,
  6208. contentType: "application/json;charset=UTF-8",
  6209. dataType: "json",
  6210. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6211. success: function (res) {
  6212. if (res == '401' || res == 401) {
  6213. window.location.href = '/thmz/login/view'
  6214. return;
  6215. }
  6216. if (res.code == 0) {
  6217. if (res.data != null) {
  6218. $("#rapidAcceptsUserName").val(res.data.name);
  6219. $("#rapidAcceptsUserCode").val(res.data.patientId);
  6220. $("#patientIdDb").val(res.data.patientId);
  6221. $("#rapidAcceptsUserCardNo").val(res.data.icCardNo);
  6222. $("#rapidAcceptsUserGender").selectpicker('val', res.data.sex);
  6223. $("#rapidAcceptsUserGender").selectpicker('refresh');
  6224. $("#rapidAcceptsUserPhoneNum").val(res.data.phoneNo);
  6225. $("#rapidAcceptsUserIdCard").val(res.data.socialNo);
  6226. $('#rapidAcceptsUserCertificateType').selectpicker('val', '01');
  6227. $('#rapidAcceptsUserCertificateType').selectpicker('refresh');
  6228. $("#rapidAcceptsUserIdCard").attr("title", res.data.socialNo);
  6229. $("#rapidAcceptsUserPhoneNum").attr("title", res.data.phoneNo);
  6230. $('#rapidAcceptsProvinceCode').selectpicker('val', res.data.provinceCode);
  6231. $('#rapidAcceptsProvinceCode').selectpicker('refresh');
  6232. initCity(3, res.data.cityCode);
  6233. initDistrict(3, res.data.cityCode, res.data.districtCode);
  6234. $("#rapidAcceptsDetail").val(res.data.detail);
  6235. $("#rapidAcceptsUserAddress").attr("title", res.data.address);
  6236. $("#rapidAcceptsUserAddress").val(res.data.address);
  6237. $("#rapidAcceptsUserContact").val(res.data.relName);
  6238. $("#rapidAcceptsUserContactPhone").val(res.data.contractName);
  6239. //查询分诊号
  6240. $.ajax({
  6241. type: "POST",
  6242. url: '/thmz/getUnClinicWithPage',
  6243. contentType: "application/json;charset=UTF-8",
  6244. dataType: "json",
  6245. data: JSON.stringify({"patientId": res.data.patientId}),
  6246. headers: {
  6247. 'Accept': 'application/json',
  6248. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  6249. },
  6250. success: function (resFz) {
  6251. if (resFz == '401' || resFz == 401) {
  6252. window.location.href = '/thmz/login/view'
  6253. return;
  6254. }
  6255. if (resFz.code == 0) {
  6256. if (resFz.data == null || resFz.data.length == 0) {
  6257. errorMesageSimaple("没有查询到符合条件的分诊记录!");
  6258. clearRapidAcceptsModal();
  6259. return;
  6260. }
  6261. $("#mzfzSerialNo").val(resFz.data[0].serialNo);
  6262. }
  6263. }
  6264. });
  6265. } else {
  6266. errorMesageSimaple("病人信息不存在!");
  6267. }
  6268. } else {
  6269. errorMesage(res);
  6270. }
  6271. }
  6272. });
  6273. }
  6274. }
  6275. /**
  6276. * 清空快速接诊查询框
  6277. */
  6278. function clearRapidAccepts() {
  6279. $("#rapidAcceptsUserName").val(null);
  6280. $("#rapidAcceptsUserCode").val(null);
  6281. $("#patientIdDb").val(null);
  6282. $("#rapidAcceptsUserCardNo").val(null);
  6283. $("#rapidAcceptsUserGender").selectpicker('val', 0);
  6284. $("#rapidAcceptsUserGender").selectpicker('refresh');
  6285. $("#rapidAcceptsUserPhoneNum").val(null);
  6286. $("#rapidAcceptsUserIdCard").val(null);
  6287. $("#rapidAcceptsUserIdCard").attr("title", null);
  6288. $("#rapidAcceptsUserPhoneNum").attr("title", null);
  6289. $("#rapidAcceptsUserAddress").attr("title", null);
  6290. $("#mzfzSerialNo").val(null);
  6291. $("#rapidAcceptsUserCardNo").focus();
  6292. $("#rapidAcceptsUserAddress").val(null);
  6293. $("#rapidAcceptsUserContact").val(null);
  6294. $("#rapidAcceptsUserContactPhone").val(null);
  6295. }
  6296. /**
  6297. * 根据病人姓名输入框内容动态加载病人列表
  6298. */
  6299. function initUserList() {
  6300. //var width=$("#userName").css("width");
  6301. var settings = {
  6302. trigger: 'click',
  6303. content: '',
  6304. width: 170,
  6305. multi: true,
  6306. closeable: false,
  6307. style: '',
  6308. delay: 300,
  6309. padding: true,
  6310. height: 300,
  6311. };
  6312. var webuiPopover = $('#rapidAcceptsUserName').webuiPopover('destroy').webuiPopover(settings);
  6313. //用户姓名选中事件
  6314. $("#rapidAcceptsUserName").on("click", function (t) {
  6315. if ($(webuiPopover).css("display") == "block") {
  6316. refeshPatinetList(true);
  6317. }
  6318. });
  6319. }
  6320. /**
  6321. * 刷新候诊病人列表
  6322. */
  6323. function refeshPatinetList(flag) {
  6324. //如果是重新加载病人列表,需要重置下标
  6325. if (flag) {
  6326. //重置下标
  6327. pageIndex = 0;
  6328. msg_list_loading = true;
  6329. }
  6330. var userName = $('#rapidAcceptsUserName').val();
  6331. if (!(userName == null || userName == "" || isChinese(userName))) {
  6332. return;
  6333. }
  6334. $.ajax({
  6335. type: "POST",
  6336. url: '/thmz/getUnClinicWithPage',
  6337. contentType: "application/json;charset=UTF-8",
  6338. dataType: "json",
  6339. data: JSON.stringify({"name": userName, "pageIndex": pageIndex}),
  6340. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6341. success: function (res) {
  6342. if (res == '401' || res == 401) {
  6343. window.location.href = '/thmz/login/view'
  6344. return;
  6345. }
  6346. if (res.code == 0) {
  6347. if (res.data != null && res.data.length > 0) {
  6348. $("#webuiPopover0").css("display", "block");
  6349. $("#webuiPopover0 .webui-popover-content").css("max-height", "300px").css("height", "auto");
  6350. var html = '<div class="list-group">';
  6351. for (var i = 0; i < res.data.length; i++) {
  6352. var mzPatientMi = res.data[i];
  6353. html += '<a href="#" class="list-group-item list-group-item-action" onclick="fillUnClinicPatinet(\'' + mzPatientMi.patientId + '\')">';
  6354. if (mzPatientMi.gender == "男") {
  6355. html += '<img src="/thmz/images/boy.png"/>'
  6356. } else if (mzPatientMi.gender == "女") {
  6357. html += '<img src="/thmz/images/girl.png"/>'
  6358. } else if (mzPatientMi.gender == "未知" || mzPatientMi.gender == null) {
  6359. html += '<img src="/thmz/images/girl_or_boy.png"/>'
  6360. }
  6361. html += '<div>' + mzPatientMi.name + '&nbsp;' + mzPatientMi.gender + '&nbsp;';
  6362. html += mzPatientMi.ageString;
  6363. if (mzPatientMi.phoneNo != null && mzPatientMi.phoneNo != "") {
  6364. html += '<span>' + mzPatientMi.phoneNo + '</span>';
  6365. }
  6366. html += '</div></a>';
  6367. }
  6368. html += '</div>';
  6369. if (flag) {
  6370. $("#webuiPopover0 div.webui-popover-content").html("");
  6371. }
  6372. $("#webuiPopover0 div.webui-popover-content").append(html);
  6373. $("#webuiPopover0 div.arrow").css("left", "23px");
  6374. refeshPatinetListScrollEvent();
  6375. } else {
  6376. $("#webuiPopover0").css("display", "none");
  6377. }
  6378. }
  6379. //查询完成,设置加载完成
  6380. msg_list_loading = false;
  6381. }
  6382. });
  6383. }
  6384. /**
  6385. * 病人下拉列表滚动条滚动到底部时继续加载新纪录
  6386. */
  6387. function refeshPatinetListScrollEvent() {
  6388. $('.webui-popover-content').scroll(function (event) {
  6389. var top = $(this).scrollTop();
  6390. var height = $(this).height();
  6391. var scrollHeight = $(this).get(0).scrollHeight;
  6392. if (scrollHeight <= top + height) {
  6393. if (!msg_list_loading) {
  6394. msg_list_loading = true;
  6395. pageIndex = pageIndex + 1;
  6396. refeshPatinetList(false);
  6397. }
  6398. }
  6399. });
  6400. }
  6401. /**
  6402. * 按照病人id查询病人信息
  6403. * @param patientId
  6404. */
  6405. function fillUnClinicPatinet(patientId) {
  6406. $("#rapidAcceptsUserCardNo").val(patientId);
  6407. $("#webuiPopover0").css("display", "none");
  6408. queryUserInfoByCardNo();
  6409. }
  6410. /**
  6411. * 加载主诉,体格检查,诊断窗口
  6412. */
  6413. function initRecommendList() {
  6414. var width = $("#symptom").parent().css("width");
  6415. var settings = {
  6416. placement: 'bottom-right',//值: auto,top,right,bottom,left,top-right,top-left,bottom-right,bottom-left 要显示的位置
  6417. trigger: 'click', //值:click,hover 触发方式 manual 手动
  6418. content: '',//内容,内容可以是函数
  6419. width: width,
  6420. //arrow:false,//是否显示箭头
  6421. multi: true,//在页面允许其他弹出层
  6422. closeable: true,//显示关闭按钮
  6423. style: '', //值:'',inverse
  6424. delay: 300,//延迟时间, 悬浮属性才执行
  6425. padding: true,//内容填充
  6426. height: 320,
  6427. //offsetTop:10,
  6428. cache: true,//如果缓存设置为false,则popover将销毁并重新创建
  6429. };
  6430. //主诉弹窗
  6431. var symptomWebuiPopover = $('#symptom').webuiPopover('destroy').webuiPopover(settings);
  6432. //体格检查弹窗
  6433. settings.height = 260;
  6434. $('#weight').webuiPopover('destroy').webuiPopover(settings);
  6435. //诊断弹窗
  6436. settings.height = 320;
  6437. var diagnoseWebuiPopover = $('#diagnose').webuiPopover('destroy').webuiPopover(settings);
  6438. //西药弹窗
  6439. settings.width = 680;
  6440. settings.closeable = false;
  6441. settings.arrow = false;//显示箭头或不显示箭头
  6442. settings.content = '<div id="westernMedicinePopoverContent"><table id="tb_table_western_medicine"></table></div>';
  6443. //手动触发
  6444. settings.trigger = 'manual';
  6445. var westernMedicineWebuiPopover = $('#western_medicine_name').webuiPopover('destroy').webuiPopover(settings);
  6446. //中药弹窗
  6447. settings.trigger = 'click';
  6448. settings.content = '<div id="chineseMedicinePopoverContent"><table id="tb_table_chinese_medicine"></table></div>';
  6449. //手动触发
  6450. settings.trigger = 'manual';
  6451. var chineseMedicineWebuiPopover = $('#chinese_medicine_name').webuiPopover('destroy').webuiPopover(settings);
  6452. //辅助检查、检验弹窗
  6453. settings.trigger = 'manual';
  6454. settings.content = '<div id="jcJyItemPopoverContent"><table id="tb_table_jc_jy_item"></table></div>';
  6455. var jcJyItemWebuiPopover = $('#jcJyItem').webuiPopover('destroy').webuiPopover(settings);
  6456. //诊疗弹窗
  6457. settings.trigger = 'manual';
  6458. settings.content = '<div id="zlItemPopoverContent"><table id="tb_table_zl_item"></table></div>';
  6459. var zlItemWebuiPopover = $('#zlItem').webuiPopover('destroy').webuiPopover(settings);
  6460. //主诉选中事件
  6461. $("#symptom").on("click", function (t) {
  6462. if ($(symptomWebuiPopover).css("display") == "block") {
  6463. $("#webuiPopover1 div.arrow").css("left", "23px");
  6464. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">主诉</span>';
  6465. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='contentHtml'>";
  6466. html += "</div>";
  6467. html += '<div style="height: 60px; line-height: 60px; font-size: 14px;">' +
  6468. '<div style="float: left">' +
  6469. '<span style="margin-left: 20px;">内容:</span> ' +
  6470. '</div>' +
  6471. '<div style="float: left;">' +
  6472. '<select class="form-control selectpicker show-tick" id="paramsType" dropupAuto="true">' +
  6473. '<option label="常用症状" value="0">常用症状</option>' +
  6474. '<option label="常用时间" value="1">常用时间</option>' +
  6475. '<option label="常用标点" value="2">常用标点</option>' +
  6476. '<option label="常用词" value="3">常用词</option>' +
  6477. '</select> ' +
  6478. '</div>' +
  6479. '<div style="width: 200px;float: left;margin-left: 10px;">' +
  6480. '<input id="paramsNameInput" class="form-control" type="text" style="position: relative;top: 13px;height: 34px;">' +
  6481. '</div>' +
  6482. '<div style="float: left;margin-left: 10px;">' +
  6483. ' <button type="button" class="btn" onclick="saveParams();"' +
  6484. ' style="height: 30px;line-height: 15px;border-color: #2e69eb!important;color: #2e69eb;background-color: white;">' +
  6485. ' <svg class="bi" width="1em" height="1em" fill="currentColor" style="vertical-align: -.15em;margin-right: 10px!important;color: #2e69eb;">' +
  6486. ' <use xlink:href="/thmz/css/bootstrap/bootstrap-icons-1.5.0/bootstrap-icons.svg#plus-circle"></use>' +
  6487. ' </svg>' +
  6488. '新增' +
  6489. ' </button>' +
  6490. ' </div>' +
  6491. '</div>';
  6492. $("#webuiPopover1 div.webui-popover-content").html(html);
  6493. $('#paramsType').selectpicker('refresh');
  6494. $("#paramsType").parent().css("width", "140px").css("height", "34px");
  6495. $("#webuiPopover1").css("z-index", "10");
  6496. if ($("#webuiPopover1").hasClass("in")) {
  6497. loadSymptom();
  6498. }
  6499. }
  6500. //加载智能接诊模块的主诉推荐
  6501. fitSymptomData();
  6502. });
  6503. //体格检查各输入框选中事件
  6504. $("#weight,#temperature,#sphygmus,#breathe,#pressure_high,#pressure_floor,#pressure_high_left,#pressure_floor_left").on("click", function (t) {
  6505. if ($("#webuiPopover2").css("display") == "block") {
  6506. $("#webuiPopover2").css("left", $("#webuiPopover1").css("left"));
  6507. if ($("#healthCheckupContentHtml").html() == null || $("#healthCheckupContentHtml").html() == "") {
  6508. $("#webuiPopover2 div.arrow").css("left", "23px");
  6509. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">体格检查</span>';
  6510. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='healthCheckupContentHtml'>";
  6511. html += "</div>";
  6512. $("#webuiPopover2 div.webui-popover-content").html(html);
  6513. $("#webuiPopover2").css("z-index", "10");
  6514. if ($("#webuiPopover2").hasClass("in")) {
  6515. loadHealthCheckup();
  6516. }
  6517. }
  6518. //loadSymptom();
  6519. } else {
  6520. $('#weight').webuiPopover('show');
  6521. $("#webuiPopover2").css("left", $("#webuiPopover1").css("left"));
  6522. if ($("#healthCheckupContentHtml").html() == null || $("#healthCheckupContentHtml").html() != "") {
  6523. $("#webuiPopover2 div.arrow").css("left", "23px");
  6524. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">体格检查</span>';
  6525. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='healthCheckupContentHtml'>";
  6526. html += "</div>";
  6527. $("#webuiPopover2 div.webui-popover-content").html(html);
  6528. $("#webuiPopover2").css("z-index", "10");
  6529. if ($("#webuiPopover2").hasClass("in")) {
  6530. loadHealthCheckup();
  6531. }
  6532. }
  6533. }
  6534. return false;
  6535. });
  6536. //诊断选中事件
  6537. $("#diagnose").on("click", function (t) {
  6538. $("#western_medicine_name").webuiPopover('hide');
  6539. $("#chinese_medicine_name").webuiPopover('hide');
  6540. $("#jcJyItem").webuiPopover('hide');
  6541. $("#zlItem").webuiPopover('hide');
  6542. if ($(diagnoseWebuiPopover).css("display") == "block") {
  6543. $("#webuiPopover3 div.arrow").css("left", "23px");
  6544. $("#webuiPopover3 a.close").css("margin-top", "15px");
  6545. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">诊断</span>';
  6546. html += '<div class="form-group has-feedback" style="float: right;width: 300px;margin-right: 20px;margin-top: 10px;">' +
  6547. ' <input type="text" class="form-control has-feedback-left" ' +
  6548. ' placeholder="搜索" style="padding-left: 10px;" onkeyup="debounce(loadDiagnose(this.value),100,true)" id="paramsDiagnose">' +
  6549. ' <span class="fa fa-search form-control-feedback right" aria-hidden="true" style="right: 0px;"></span>' +
  6550. ' </div>';
  6551. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='diagnoseContentHtml'>";
  6552. html += "</div>";
  6553. $("#webuiPopover3 div.webui-popover-content").html(html);
  6554. $("#webuiPopover3").css("z-index", "10");
  6555. //$("#paramsDiagnose").on('input propertychange', loadDiagnose($("#paramsDiagnose").val()));
  6556. //中文会导致查询混乱
  6557. $("#paramsDiagnose").on('compositionstart', function () {
  6558. $("#paramsDiagnose").attr("isNeedPrevent", true);
  6559. });
  6560. $("#paramsDiagnose").on('compositionend', function () {
  6561. $("#paramsDiagnose").attr("isNeedPrevent", false);
  6562. });
  6563. loadDiagnose("");
  6564. }
  6565. //加载智能接诊模块的诊断推荐推荐
  6566. fitDiagnoseData();
  6567. });
  6568. //现病史选中事件
  6569. $("#emrHpi").on("click", function (t) {
  6570. //加载智能接诊模块的现病史推荐推荐
  6571. fitEmrHpiData();
  6572. });
  6573. //既往史选中事件
  6574. $("#emrPs").on("click", function (t) {
  6575. //加载智能接诊模块的既往史推荐推荐
  6576. fitEmrPsData();
  6577. });
  6578. // //西药选中事件
  6579. // $("#western_medicine_name").on("click", function (t) {
  6580. // if ($(westernMedicineWebuiPopover).css("display") == "block") {
  6581. // $("#westernMedicinePopoverContent").parent().parent().prev().css("left", "23px");
  6582. // loadYpList(0);
  6583. // }
  6584. // });
  6585. // //中药选中事件
  6586. // $("#chinese_medicine_name").on("click", function (t) {
  6587. // if ($(chineseMedicineWebuiPopover).css("display") == "block") {
  6588. // $("#chineseMedicinePopoverContent").parent().parent().prev().css("left", "23px");
  6589. // loadYpList(1);
  6590. // }
  6591. // });
  6592. // //诊疗与医技弹窗选中事件
  6593. // $("#jcJyItem").on("click", function (t) {
  6594. // if ($(jcJyItemWebuiPopover).css("display") == "block") {
  6595. // $("#jcJyItemPopoverContent").parent().parent().prev().css("left", "23px");
  6596. // loadjcJyItemList();
  6597. // }
  6598. // });
  6599. //帮助字典弹窗
  6600. settings.width = 450;
  6601. settings.height = 500;
  6602. settings.placement = 'right';//值: auto,top,right,bottom,left,top-right,top-left,bottom-right,bottom-left 要显示的位置
  6603. settings.content = '<div id="treePopoverContent"><div><ul id="treeDemo" class="ztree"></ul></div></div>';
  6604. settings.trigger = 'click';
  6605. var treeWebuiPopover = $('#treeButton').webuiPopover('destroy').webuiPopover(settings);
  6606. $("#treeButton").on("click", function (t) {
  6607. // $("#treePopoverContent").parent().parent().prev().css("left", "23px");
  6608. //初始化药品,检查检验菜单树
  6609. initzTree();
  6610. });
  6611. }
  6612. /**
  6613. * 新增通用参数
  6614. */
  6615. function saveParams() {
  6616. $.ajax({
  6617. type: "POST",
  6618. url: '/thmz/saveTCommonParams',
  6619. contentType: "application/json;charset=UTF-8",
  6620. dataType: "json",
  6621. data: JSON.stringify({
  6622. "paramsType": $("#paramsType").val(),
  6623. "paramsName": $("#paramsNameInput").val()
  6624. }),
  6625. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6626. success: function (res) {
  6627. if (res == '401' || res == 401) {
  6628. window.location.href = '/thmz/login/view'
  6629. return;
  6630. }
  6631. if (res.code == 0) {
  6632. successMesage(res);
  6633. loadSymptom();
  6634. $("#paramsNameInput").val(null);
  6635. // $("#paramsType").selectpicker('val', 0);
  6636. // $("#paramsType").selectpicker('refresh');
  6637. } else {
  6638. errorMesage(res);
  6639. }
  6640. }
  6641. });
  6642. }
  6643. /**
  6644. * 加载主诉参数列表
  6645. */
  6646. function loadSymptom() {
  6647. $.ajax({
  6648. type: "GET",
  6649. url: '/thmz/loadSymptom',
  6650. contentType: "application/json;charset=UTF-8",
  6651. dataType: "json",
  6652. async: false,
  6653. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6654. success: function (res) {
  6655. if (res == '401' || res == 401) {
  6656. window.location.href = '/thmz/login/view'
  6657. return;
  6658. }
  6659. var html = '';
  6660. if (res.code == 0) {
  6661. if (res.featureList != null && res.featureList.length > 0) {
  6662. html += '<div id="feature">';
  6663. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用症状:</div>';
  6664. html += '<div style="width: calc(100% - 80px); float: left;">';
  6665. for (var i = 0; i < res.featureList.length; i++) {
  6666. 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;">';
  6667. html += res.featureList[i].paramsName;
  6668. html += '</span></button>';
  6669. }
  6670. html += '</div><div style="clear:both"></div></div>';
  6671. }
  6672. if (res.timeList != null && res.timeList.length > 0) {
  6673. html += '<div id="time">';
  6674. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用时间:</div>';
  6675. html += '<div style="width: calc(100% - 80px); float: left;">';
  6676. for (var i = 0; i < res.timeList.length; i++) {
  6677. 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;">';
  6678. html += res.timeList[i].paramsName;
  6679. html += '</span></button>';
  6680. }
  6681. html += '</div><div style="clear:both"></div></div>';
  6682. }
  6683. if (res.characterList != null && res.characterList.length > 0) {
  6684. html += '<div id="character">';
  6685. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用标点:</div>';
  6686. html += '<div style="width: calc(100% - 80px); float: left;">';
  6687. for (var i = 0; i < res.characterList.length; i++) {
  6688. 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;">';
  6689. html += res.characterList[i].paramsName;
  6690. html += '</span></button>';
  6691. }
  6692. html += '</div><div style="clear:both"></div></div>';
  6693. }
  6694. if (res.wordsList != null && res.wordsList.length > 0) {
  6695. html += '<div id="words">';
  6696. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用词:</div>';
  6697. html += '<div style="width: calc(100% - 80px); float: left;">';
  6698. for (var i = 0; i < res.wordsList.length; i++) {
  6699. 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;">';
  6700. html += res.wordsList[i].paramsName;
  6701. html += '</span></button>';
  6702. }
  6703. html += '</div><div style="clear:both"></div></div>';
  6704. }
  6705. } else {
  6706. errorMesage(res);
  6707. }
  6708. $("#contentHtml").html(html);
  6709. }
  6710. });
  6711. }
  6712. /**
  6713. * 加载体格检查参数列表
  6714. */
  6715. function loadHealthCheckup() {
  6716. $.ajax({
  6717. type: "GET",
  6718. url: '/thmz/loadHealthCheckup',
  6719. contentType: "application/json;charset=UTF-8",
  6720. dataType: "json",
  6721. async: false,
  6722. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6723. success: function (res) {
  6724. if (res == '401' || res == 401) {
  6725. window.location.href = '/thmz/login/view'
  6726. return;
  6727. }
  6728. var html = '';
  6729. if (res.code == 0) {
  6730. if (res.weightList != null && res.weightList.length > 0) {
  6731. html += '<div id="weightDiv">';
  6732. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">体重:</div>';
  6733. html += '<div style="width: calc(100% - 80px); float: left;">';
  6734. for (var i = 0; i < res.weightList.length; i++) {
  6735. 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;">';
  6736. html += res.weightList[i].paramsName;
  6737. html += '</span></button>';
  6738. }
  6739. html += '</div><div style="clear:both"></div></div>';
  6740. }
  6741. if (res.temperatureList != null && res.temperatureList.length > 0) {
  6742. html += '<div id="temperatureDiv">';
  6743. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">体温:</div>';
  6744. html += '<div style="width: calc(100% - 80px); float: left;">';
  6745. for (var i = 0; i < res.temperatureList.length; i++) {
  6746. 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;">';
  6747. html += res.temperatureList[i].paramsName;
  6748. html += '</span></button>';
  6749. }
  6750. html += '</div><div style="clear:both"></div></div>';
  6751. }
  6752. if (res.sphygmusList != null && res.sphygmusList.length > 0) {
  6753. html += '<div id="sphygmusDiv">';
  6754. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">脉搏:</div>';
  6755. html += '<div style="width: calc(100% - 80px); float: left;">';
  6756. for (var i = 0; i < res.sphygmusList.length; i++) {
  6757. 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;">';
  6758. html += res.sphygmusList[i].paramsName;
  6759. html += '</span></button>';
  6760. }
  6761. html += '</div><div style="clear:both"></div></div>';
  6762. }
  6763. if (res.breatheList != null && res.breatheList.length > 0) {
  6764. html += '<div id="breatheDiv">';
  6765. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">呼吸:</div>';
  6766. html += '<div style="width: calc(100% - 80px); float: left;">';
  6767. for (var i = 0; i < res.breatheList.length; i++) {
  6768. 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;">';
  6769. html += res.breatheList[i].paramsName;
  6770. html += '</span></button>';
  6771. }
  6772. html += '</div><div style="clear:both"></div></div>';
  6773. }
  6774. if (res.pressureList != null && res.pressureList.length > 0) {
  6775. html += '<div id="pressureDiv">';
  6776. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">血压:</div>';
  6777. html += '<div style="width: calc(100% - 80px); float: left;">';
  6778. for (var i = 0; i < res.pressureList.length; i++) {
  6779. 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;">';
  6780. html += res.pressureList[i].paramsName;
  6781. html += '</span></button>';
  6782. }
  6783. html += '</div><div style="clear:both"></div></div>';
  6784. }
  6785. } else {
  6786. errorMesage(res);
  6787. }
  6788. $("#healthCheckupContentHtml").html(html);
  6789. }
  6790. });
  6791. }
  6792. /**
  6793. * 加载诊断参数列表
  6794. * @param value
  6795. */
  6796. function loadDiagnose(value) {
  6797. if (!$("#webuiPopover3").hasClass("in")) {
  6798. return;
  6799. }
  6800. var isNeedPrevent = $("#paramsDiagnose").attr("isNeedPrevent");
  6801. if (isNeedPrevent == "true") {
  6802. return;
  6803. }
  6804. $.ajax({
  6805. type: "GET",
  6806. url: '/thmz/getIcdCodeByParams?commonParams=' + value,
  6807. contentType: "application/json;charset=UTF-8",
  6808. dataType: "json",
  6809. async: false,
  6810. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6811. success: function (res) {
  6812. if (res == '401' || res == 401) {
  6813. window.location.href = '/thmz/login/view'
  6814. return;
  6815. }
  6816. var html = '';
  6817. if (res.code == 0) {
  6818. let crbFlag = '1'
  6819. if (res.data != null && res.data.length > 0) {
  6820. html += '<div>';
  6821. for (var i = 0; i < res.data.length; i++) {
  6822. 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 + '\',\'' + crbFlag + '\',\'' + res.data[i].infectiousdiseasesFlag + '\')"><span style="padding: 0px 5px;font-size: 20px;">';
  6823. html += res.data[i].name;
  6824. html += '<small>&nbsp;&nbsp;(' + res.data[i].code + ')</small>';
  6825. html += '</span></button>';
  6826. }
  6827. html += '</div>';
  6828. }
  6829. } else {
  6830. errorMesage(res);
  6831. }
  6832. $("#diagnoseContentHtml").html(html);
  6833. }
  6834. });
  6835. }
  6836. /**
  6837. * 填充诊断
  6838. * @param value
  6839. * @param code
  6840. */
  6841. function fitDiagnoseValue(value, code,crbFlag,infectiousdiseasesFlag) {
  6842. if (code === null || code === "") {
  6843. return;
  6844. }
  6845. var html = '';
  6846. var childrenNum = $("#diagnoseTags").children().length;
  6847. if (childrenNum == 6) {
  6848. errorMesageSimaple("最多填写六个诊断!");
  6849. return;
  6850. }
  6851. var diagnoseValue = $("#diagnoseValue").val();
  6852. if (diagnoseValue == null || diagnoseValue == "") {
  6853. diagnoseValue = code;
  6854. } else {
  6855. if (diagnoseValue.indexOf(code) != -1) {
  6856. errorMesageSimaple("诊断已存在,请勿重复添加!");
  6857. return;
  6858. }
  6859. diagnoseValue += "," + code;
  6860. }
  6861. $("#diagnoseValue").val(diagnoseValue);
  6862. if (childrenNum == 0) {
  6863. html += '<span class="el-tag--mainDiagnosis" ';
  6864. } else {
  6865. html += '<span class="el-tag--secondaryDiagnosis" ';
  6866. }
  6867. 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>';
  6868. $("#diagnoseTags").append(html);
  6869. $("#diagnoseTags").parent().parent().css("height", $("#diagnoseTags").height());
  6870. if(stringNotBlank($("#patientId").text()) && crbFlag =='1' && infectiousdiseasesFlag == 1){
  6871. crbMainCard()
  6872. }
  6873. }
  6874. /**
  6875. * 移除诊断
  6876. * @param code
  6877. */
  6878. function removeDiagnoseValue(code) {
  6879. var childrenIndex = 0;
  6880. var children = $("#diagnoseTags").children();
  6881. for (var i = 0; i < children.length; i++) {
  6882. if ($(children[i]).attr("id") == code) {
  6883. childrenIndex = i;
  6884. break;
  6885. }
  6886. }
  6887. $($("#diagnoseTags").children("span")[childrenIndex]).remove();
  6888. if (childrenIndex == 0) {
  6889. $($("#diagnoseTags").children("span")[childrenIndex]).removeClass("el-tag--secondaryDiagnosis").addClass("el-tag--mainDiagnosis");
  6890. }
  6891. var diagnoseValue = $("#diagnoseValue").val();
  6892. $("#diagnoseValue").val(diagnoseValue.replace(code, ""));
  6893. $("#diagnoseTags").parent().parent().css("height", $("#diagnoseTags").height());
  6894. }
  6895. /**
  6896. * 点击通用参数属性值时设置值到对应的区域
  6897. * @param value
  6898. * @param id
  6899. */
  6900. function fitValue(value, id) {
  6901. //当选择的是血压时
  6902. if (id == "pressure_") {
  6903. var arr = value.split("/");
  6904. $("#pressure_high").val(arr[0]);
  6905. $("#pressure_floor").val(arr[1]);
  6906. if ($("#pressureLeftFlag").hasClass("in")) {
  6907. $("#pressure_high_left").val(arr[0]);
  6908. $("#pressure_floor_left").val(arr[1]);
  6909. }
  6910. //当选的是体重,体温,脉搏和呼吸时
  6911. } else if (id == "weight" || id == "temperature" || id == "sphygmus" || id == "breathe") {
  6912. $("#" + id).val(value);
  6913. } else {
  6914. //主诉拼写时
  6915. var valueExist = $("#" + id).val();
  6916. if (valueExist != null && valueExist != "") {
  6917. value = valueExist + value;
  6918. }
  6919. $("#" + id).val(value);
  6920. }
  6921. }
  6922. /**
  6923. * 加载药品列表数列表
  6924. * @param index
  6925. */
  6926. function loadYpList(index, event) {
  6927. if (event != null) {
  6928. if (event.keyCode == 38 || event.keyCode == 40 || event.keyCode == 13) {
  6929. //上下键不刷新表格
  6930. return;
  6931. }
  6932. }
  6933. var medicinePopoverContent = null;
  6934. var tableMedicine = null;
  6935. var MedicineName = null;
  6936. //var groupNo=null;
  6937. if (index == 0) {
  6938. medicinePopoverContent = "westernMedicinePopoverContent";
  6939. tableMedicine = "tb_table_western_medicine";
  6940. MedicineName = "western_medicine_name";
  6941. // groupNo=71;
  6942. }
  6943. if (index == 1) {
  6944. medicinePopoverContent = "chineseMedicinePopoverContent";
  6945. tableMedicine = "tb_table_chinese_medicine";
  6946. MedicineName = "chinese_medicine_name";
  6947. // groupNo=$("#zyClassType").val();
  6948. }
  6949. // if (!$("#" + medicinePopoverContent).parent().parent().parent().hasClass("in")) {
  6950. // return;
  6951. // }
  6952. $('#' + MedicineName).webuiPopover('show');
  6953. $('#' + tableMedicine).bootstrapTable('refresh');
  6954. $('#' + tableMedicine).bootstrapTable({
  6955. url: '/thmz/getYpListByCommonParams', //请求后台的URL(*)
  6956. method: 'GET', //请求方式(*)
  6957. toolbar: '#toolbar', //工具按钮用哪个容器
  6958. striped: true, //是否显示行间隔色
  6959. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  6960. pagination: false, //是否显示分页(*)
  6961. sortable: true, //是否启用排序
  6962. sortOrder: "asc", //排序方式
  6963. queryParams: function (params) {
  6964. var groupNo = null;
  6965. if (index == 0) {
  6966. groupNo = 71;
  6967. }
  6968. if (index == 1) {
  6969. groupNo = $("#zyClassType").val();
  6970. }
  6971. var temp = {
  6972. groupNo: groupNo,
  6973. commonParams: $("#" + MedicineName).val()
  6974. };
  6975. return temp;
  6976. }, //传递参数(*)
  6977. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  6978. pageNumber: 1, //初始化加载第一页,默认第一页
  6979. pageSize: 5, //每页的记录行数(*)
  6980. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  6981. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  6982. strictSearch: true,
  6983. showColumns: false, //是否显示所有的列
  6984. showRefresh: false, //是否显示刷新按钮
  6985. minimumCountColumns: 2, //最少允许的列数
  6986. clickToSelect: true, //是否启用点击选中行
  6987. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  6988. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  6989. cardView: false, //是否显示详细视图
  6990. detailView: false,
  6991. //rowStyle:rowStyle,//通过自定义函数设置行样式
  6992. ajaxOptions: {
  6993. headers: {
  6994. 'Accept': 'application/json',
  6995. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  6996. }
  6997. },
  6998. columns: [
  6999. // {
  7000. // title: '药品说明书',
  7001. // field: 'op',
  7002. // align: "center",
  7003. // valign: 'middle',
  7004. // formatter: function (value, row, index) {
  7005. // var str = '<button type="button" class="btn btn-primary btn-sm" onclick="hlyyypsms(\'' + row.code + '\',\'' + row.serial + '\')">说明书</button>';
  7006. // return [str].join('');
  7007. // }
  7008. // },
  7009. {
  7010. field: 'code',
  7011. title: '编码',
  7012. align: "center",
  7013. valign: 'middle',
  7014. // sortable: true
  7015. }, {
  7016. field: 'name',
  7017. title: '药品名称',
  7018. align: "center",
  7019. valign: 'middle',
  7020. // sortable: true
  7021. }
  7022. , {
  7023. field: 'specification',
  7024. title: '规格',
  7025. align: "center",
  7026. valign: 'middle',
  7027. // sortable: true
  7028. }, {
  7029. field: 'manufactory',
  7030. title: '生产厂家',
  7031. align: "center",
  7032. valign: 'middle',
  7033. // sortable: true
  7034. }, {
  7035. field: 'miniUnitName',
  7036. title: '单位',
  7037. align: "center",
  7038. valign: 'middle',
  7039. // sortable: true
  7040. }, {
  7041. field: 'chargeAmount',
  7042. title: '零售价',
  7043. align: "center",
  7044. valign: 'middle',
  7045. // sortable: true
  7046. formatter: function (value, row, index) {
  7047. if (value == null) {
  7048. return '0.0元';
  7049. }
  7050. return value.toFixed(2) + "元";
  7051. }
  7052. }, {
  7053. field: 'drugWinDesc',
  7054. title: '剂量',
  7055. align: "center",
  7056. valign: 'middle',
  7057. // sortable: true
  7058. }, {
  7059. field: 'stockAmountVirtual',
  7060. title: '库存数量',
  7061. align: "center",
  7062. valign: 'middle',
  7063. // sortable: true
  7064. }, {
  7065. field: 'ybBlNew',
  7066. title: '医保报销比例',
  7067. align: "center",
  7068. valign: 'middle',
  7069. // sortable: true
  7070. // formatter: function (value, row, index) {
  7071. // if (value != null) {
  7072. // return value + '%';
  7073. // }
  7074. // }
  7075. }, {
  7076. field: 'ybComment',
  7077. title: '医保说明',
  7078. align: "center",
  7079. valign: 'middle',
  7080. // sortable: true
  7081. }, {
  7082. field: 'nationalCode',
  7083. title: '医保编码',
  7084. align: "left",
  7085. valign: 'middle',
  7086. // sortable: true
  7087. }
  7088. ],
  7089. responseHandler: function (res) {
  7090. if (res == '401' || res == 401) {
  7091. window.location.href = '/thmz/login/view'
  7092. return;
  7093. }
  7094. var ress = eval(res);
  7095. if (ress.code == -1) {
  7096. errorMesage(res);
  7097. return {
  7098. "total": 0,//总页数
  7099. "rows": {} //数据
  7100. };
  7101. }
  7102. $("#" + medicinePopoverContent).parent().css("background", "#EBEBE4");
  7103. return {
  7104. "total": ress.data.length,//总页数
  7105. "rows": ress.data //数据
  7106. };
  7107. },
  7108. onClickRow: function (row, $element) {
  7109. postAjaxJsonHttpRequst("/thmz/checkKssByUserCode",{code:row.code,ypName:row.name,serial:row.serial,patientId:$("#patientId").text(),ypType:row.ypType},true,function (cres) {
  7110. if(cres.code == 0){
  7111. $('#' + MedicineName).webuiPopover('hide');
  7112. if (index == 0) {
  7113. clearWesternMedicine(false);
  7114. checkYpInfo(row.code, row.serial, row.ypType, true, null, 3);
  7115. }
  7116. if (index == 1) {
  7117. checkZyInfo(row.code, row.serial, $("#zyClassType").val(), true);
  7118. }
  7119. }else if(cres.code == -2) {
  7120. errorMesageSimaple(`没有${row.code}/${row.name}的抗生素使用级别权限,不能开具此药品`)
  7121. }else if(cres.code == -3) {
  7122. errorMesageSimaple(cres.message)
  7123. } else {
  7124. errorMesage(cres)
  7125. }
  7126. })
  7127. }
  7128. });
  7129. }
  7130. /**
  7131. * 按照药品的编码 和药品拆零规格查询药品信息 西药
  7132. * @param code
  7133. * @param serial
  7134. * @param groupNo
  7135. * @param needNotice 是否需要提示 当用户操作的时候 true 需要提示, 范文和处方回写的时候false不需要提示
  7136. * @param orderNo 处方号,回写的时候需要用,因为有的处方没有满5个
  7137. * @param type 操作类型 0 修改 1 医疗范文 2 就诊详情 3 处方开立
  7138. */
  7139. function checkYpInfo(code, serial, groupNo, needNotice, orderNo, type) {
  7140. //判断是否有重复的项目 返回true 说明有重复的
  7141. if (verifyRepeat(code, serial, null, 0)) {
  7142. return;
  7143. }
  7144. $("#current_groupNo").val(groupNo);
  7145. //不需要每次都关闭这个帮助字典
  7146. //$("#treeButton").webuiPopover('hide');
  7147. $.ajax({
  7148. type: "GET",
  7149. url: '/thmz/getYpZdDictByCodeAndSerial?code=' + code + "&serial=" + serial + "&deptNo=" + localStorage.getItem("currentDeptNo") + "&groupNo=71",
  7150. contentType: "application/json;charset=UTF-8",
  7151. dataType: "json",
  7152. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7153. async: needNotice,//当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  7154. success: function (res) {
  7155. if (res == '401' || res == 401) {
  7156. window.location.href = '/thmz/login/view'
  7157. return;
  7158. }
  7159. if (res.code == 0) {
  7160. if (res.data != null) {
  7161. //如果
  7162. if ($("#xyTab").find("li") == null || $("#xyTab").find("li").length == 0) {
  7163. initNavTabs(0, groupNo, orderNo);
  7164. }
  7165. var cfdesc = '普药';
  7166. if (groupNo == '91') {
  7167. cfdesc = '医材';
  7168. } else if (groupNo == '111') {
  7169. cfdesc = '麻、精一';
  7170. } else if (groupNo == '131') {
  7171. cfdesc = '精二';
  7172. }
  7173. // else if(groupNo=='151'){
  7174. // cfdesc='诊疗';
  7175. // }
  7176. //每个处方不能超过5个药品
  7177. var tableId = $("#xyTab li.active").find("a").attr("href");
  7178. var childrens = $(tableId).find("div:eq(0)").children().length;
  7179. var currentGroupNo = $(tableId).find("input.current_groupNo").val();
  7180. var flag = childrens === 5;
  7181. if (!needNotice) {
  7182. flag = childrens === 5 && $(tableId).is(':last-child');
  7183. }
  7184. if (currentGroupNo != null && currentGroupNo != '' && groupNo != currentGroupNo) {
  7185. //当前编辑的处方与选中的品类非同一处方能保存的
  7186. var currentGroupNos = $("#xyTabContent").find("input.current_groupNo");
  7187. //是否需要新增处方页,以保存医材处方
  7188. var needAddTable = true;
  7189. for (var i = 0; i < currentGroupNos.length; i++) {
  7190. if ($(currentGroupNos[i]).val() == groupNo) {
  7191. var next = $(currentGroupNos[i]).next();
  7192. if (needAddTable && $(next).children().length < 5) {
  7193. var parentId = $(currentGroupNos[i]).parent().attr("id");
  7194. //切换处方
  7195. $("#xyTab").find("a[href='#" + parentId + "']").off("click").tab('show');
  7196. //$("#xyTab").find("a[href='#" + tableId + "']").off("click").click();
  7197. //因为存在没有满5个的处方页,直接保存到该页
  7198. needAddTable = false;
  7199. fitWesternMedicine(res, groupNo, type);
  7200. }
  7201. }
  7202. }
  7203. if (needAddTable) {
  7204. //91 医材
  7205. var message = "医材需要单独处方,是否需要新增医材处方?";
  7206. if (groupNo == '71') {
  7207. message = "普通西成药需要单独处方,是否需要新增处方?"
  7208. } else if (groupNo == '111') {
  7209. message = "麻、精一药物需要单独处方,是否需要新增处方?"
  7210. } else if (groupNo == '131') {
  7211. message = "精二药物需要单独处方,是否需要新增处方?"
  7212. }
  7213. if (needNotice) {
  7214. $("#messageModal").modal();
  7215. $("#messageContent").html(message);
  7216. $("#messageButton").off("click").on("click", function (t) {
  7217. $("#messageModal").modal("hide");
  7218. refreshNavTabs(0, groupNo, orderNo);
  7219. fitWesternMedicine(res, groupNo, type);
  7220. // //选中药品后,光标默认到用法
  7221. // $("#supplyType").next().click();
  7222. });
  7223. $("#cancelButton").off("click");
  7224. } else {
  7225. refreshNavTabs(0, groupNo, orderNo);
  7226. fitWesternMedicine(res, groupNo, type);
  7227. }
  7228. }
  7229. //当前编辑的处方非普通西药处方
  7230. } else if (flag) {
  7231. if (needNotice) {
  7232. $("#messageModal").modal();
  7233. $("#messageContent").html("单张处方最多只能开具5个药品,是否需要新增处方?");
  7234. $("#messageButton").off("click").on("click", function (t) {
  7235. $("#messageModal").modal("hide");
  7236. refreshNavTabs(0, groupNo, orderNo);
  7237. fitWesternMedicine(res, groupNo, type);
  7238. });
  7239. $("#cancelButton").off("click");
  7240. } else {
  7241. refreshNavTabs(0, groupNo, orderNo);
  7242. fitWesternMedicine(res, groupNo, type);
  7243. }
  7244. } else {
  7245. //修改药品
  7246. if (orderNo != null) {
  7247. //西药处方数量
  7248. // var xyTabLiLength = $("#xyTab li").length;
  7249. // if (xyTabLiLength < orderNo) {
  7250. //
  7251. // } else {
  7252. // $("#xyTab li.active").find("a").find("small.cfdesc").text("(" + cfdesc + ")");
  7253. // }
  7254. var tableId = orderNoAndTableIdMap.get(orderNo);
  7255. if (tableId != null && tableId != "") {
  7256. //切换处方
  7257. $("#xyTab").find("a[href='#" + tableId + "']").off("click").tab('show');
  7258. //$("#xyTab").find("a[href='#" + tableId + "']").off("click").click();
  7259. $("#xyTab li.active").find("a").find("small.cfdesc").text("(" + cfdesc + ")");
  7260. } else {
  7261. refreshNavTabs(0, groupNo, orderNo);
  7262. }
  7263. fitWesternMedicine(res, groupNo, type);
  7264. } else {
  7265. $("#xyTab li.active").find("a").find("small.cfdesc").text("(" + cfdesc + ")");
  7266. fitWesternMedicine(res, groupNo, type);
  7267. }
  7268. }
  7269. }
  7270. } else {
  7271. errorMesage(res);
  7272. }
  7273. }
  7274. });
  7275. }
  7276. /**
  7277. * 药品与项目自费信息提示
  7278. * @param res
  7279. * @param projectDesc
  7280. */
  7281. function hintProjectSelfPayInfo(selfpayProp, projectDesc) {
  7282. var zgmztczf = $("#zgmztczf").val();
  7283. if ((zgmztczf == 1 || zgmztczf == "1") && selfpayProp != null) {
  7284. selfpayProp = Number(selfpayProp);
  7285. if (selfpayProp > 0) {
  7286. var titile = "当前项目含自费" + projectDesc + ",请与患者提前确认是否继续使用,并签署自费承诺书!";
  7287. if (selfpayProp < 1) {
  7288. titile = "当前项目含部分自费" + projectDesc + ",请与患者提前确认是否继续使用,并签署自费承诺书!";
  7289. }
  7290. warningMesageSimaple(titile);
  7291. }
  7292. }
  7293. }
  7294. /**
  7295. * 按照药品的编码 和药品拆零规格查询药品信息 中药
  7296. * @param code
  7297. * @param serial
  7298. * @param groupNo 药房信息
  7299. * @param async 当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  7300. */
  7301. function checkZyInfo(code, serial, groupNo, async) {
  7302. //判断是否有重复的项目 返回true 说明有重复的
  7303. if (verifyRepeat(code, serial, null, 1)) {
  7304. return;
  7305. }
  7306. $.ajax({
  7307. type: "GET",
  7308. url: '/thmz/getYpZdDictByCodeAndSerial?code=' + code + "&serial=" + serial + "&deptNo=" + localStorage.getItem("currentDeptNo") + "&groupNo=" + groupNo,
  7309. contentType: "application/json;charset=UTF-8",
  7310. dataType: "json",
  7311. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7312. async: async,//当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  7313. success: function (res) {
  7314. if (res == '401' || res == 401) {
  7315. window.location.href = '/thmz/login/view'
  7316. return;
  7317. }
  7318. if (res.code == 0) {
  7319. if (res.data != null) {
  7320. hintProjectSelfPayInfo(res.data.selfpayProp, "药品");
  7321. //如果
  7322. if ($("#zyTab").find("li") == null || $("#zyTab").find("li").length == 0) {
  7323. initNavTabs(1, null, null);
  7324. //$("input.zyfs").val(1);
  7325. }
  7326. $("#chinese_medicine_name").val(res.data.name);
  7327. $("#chinese_medicine_name").blur();
  7328. //$("#zy_drugWin").val(res.data.weight);
  7329. $("#zy_packRetprice").val(res.data.packRetprice);
  7330. $("#chinese_medicine_current_code").val(res.data.code);
  7331. $("#chinese_medicine_current_serial").val(res.data.serial);
  7332. if (async) {
  7333. //选中药品后,光标默认到数量输入框
  7334. $("#zy_drugWin").focus();
  7335. // prevEleId = 'zy_drugWin';
  7336. }
  7337. }
  7338. } else {
  7339. errorMesage(res);
  7340. }
  7341. }
  7342. });
  7343. }
  7344. /**
  7345. * 加载辅助检查、检验列表
  7346. * @param index
  7347. */
  7348. function loadjcJyItemList(event) {
  7349. if (event != null) {
  7350. if (event.keyCode == 38 || event.keyCode == 40 || event.keyCode == 13) {
  7351. //上下键不刷新表格
  7352. return;
  7353. }
  7354. }
  7355. // if (!$("#jcJyItemPopoverContent").parent().parent().parent().hasClass("in")) {
  7356. // return;
  7357. // }
  7358. $('#jcJyItem').webuiPopover('show');
  7359. $('#tb_table_jc_jy_item').bootstrapTable('refresh');
  7360. $('#tb_table_jc_jy_item').bootstrapTable({
  7361. url: '/thmz/getJcJyItemByCommonParams', //请求后台的URL(*)
  7362. method: 'GET', //请求方式(*)
  7363. toolbar: '#toolbar', //工具按钮用哪个容器
  7364. striped: true, //是否显示行间隔色
  7365. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  7366. pagination: false, //是否显示分页(*)
  7367. sortable: true, //是否启用排序
  7368. sortOrder: "asc", //排序方式
  7369. queryParams: function (params) {
  7370. var temp = {
  7371. commonParams: $("#jcJyItem").val()
  7372. };
  7373. return temp;
  7374. }, //传递参数(*)
  7375. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  7376. pageNumber: 1, //初始化加载第一页,默认第一页
  7377. pageSize: 5, //每页的记录行数(*)
  7378. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  7379. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  7380. strictSearch: true,
  7381. showColumns: false, //是否显示所有的列
  7382. showRefresh: false, //是否显示刷新按钮
  7383. minimumCountColumns: 2, //最少允许的列数
  7384. clickToSelect: true, //是否启用点击选中行
  7385. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  7386. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  7387. cardView: false, //是否显示详细视图
  7388. detailView: false,
  7389. //rowStyle:rowStyle,//通过自定义函数设置行样式
  7390. ajaxOptions: {
  7391. headers: {
  7392. 'Accept': 'application/json',
  7393. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  7394. }
  7395. },
  7396. columns: [
  7397. {
  7398. field: 'code',
  7399. title: '编码',
  7400. align: "center",
  7401. valign: 'middle',
  7402. // sortable: true
  7403. }, {
  7404. field: 'name',
  7405. title: '名称',
  7406. align: "center",
  7407. valign: 'middle',
  7408. // sortable: true
  7409. }
  7410. , {
  7411. field: 'execUnitName',
  7412. title: '执行科室',
  7413. align: "center",
  7414. valign: 'middle',
  7415. // sortable: true
  7416. }, {
  7417. field: 'type',
  7418. title: '项目类型',
  7419. align: "center",
  7420. valign: 'middle',
  7421. // sortable: true
  7422. formatter: function (value, row, index) {
  7423. if (value == 1 || value == "1") {
  7424. return "检验";
  7425. }
  7426. if (value == 2 || value == "2") {
  7427. return "辅助检查";
  7428. }
  7429. if (value == 3 || value == "3") {
  7430. return "诊疗";
  7431. }
  7432. return "";
  7433. }
  7434. },
  7435. ],
  7436. responseHandler: function (res) {
  7437. if (res == '401' || res == 401) {
  7438. window.location.href = '/thmz/login/view'
  7439. return;
  7440. }
  7441. var ress = eval(res);
  7442. if (ress.code == -1) {
  7443. errorMesage(res);
  7444. return {
  7445. "total": 0,//总页数
  7446. "rows": {} //数据
  7447. };
  7448. }
  7449. $("#jcJyItemPopoverContent").parent().css("background", "#EBEBE4");
  7450. return {
  7451. "total": ress.data.length,//总页数
  7452. "rows": ress.data //数据
  7453. };
  7454. },
  7455. onClickRow: function (row, $element) {
  7456. postAjaxJsonHttpRequst("/thmz/checkJyJcGenderAndAge",{
  7457. patientId: $("#patientId").text(),
  7458. type:row.type,
  7459. code:row.code
  7460. },true,function (resJyJc) {
  7461. if(resJyJc.code == 0){
  7462. $('#jcJyItem').webuiPopover('hide');
  7463. $("#jcJyZltype").val(row.type);
  7464. $("#execUnit").selectpicker('val', row.execUnit);//默认不选中
  7465. $("#execUnit").selectpicker('refresh');
  7466. if (row.type == 1) {
  7467. //检验
  7468. $("#jyZdSampleDiv").removeClass("hide").addClass("in");
  7469. $("#jyQuantityDiv").removeClass("hide").addClass("in");
  7470. $("#yshPartDiv").removeClass("in").addClass("hide");
  7471. if (row.sampleCode != null && row.sampleCode != "") {
  7472. $("#jyZdSample").selectpicker('val', row.sampleCode);
  7473. $('#jyZdSample').selectpicker('refresh');
  7474. }
  7475. } else if (row.type == 2) {
  7476. //检查
  7477. $("#yshPartDiv").removeClass("hide").addClass("in");
  7478. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  7479. $("#jyQuantityDiv").removeClass("in").addClass("hide");
  7480. if (row.bwCode != null && row.bwCode != "") {
  7481. $("#yshPart").selectpicker('val', row.bwCode);
  7482. $('#yshPart').selectpicker('refresh');
  7483. }
  7484. }
  7485. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  7486. checkJcJyItemInfo(row.code, row.name, row.type, true);
  7487. }else {
  7488. errorMesage(resJyJc)
  7489. }
  7490. })
  7491. }
  7492. });
  7493. }
  7494. /**
  7495. * 加载诊疗列表
  7496. * @param index
  7497. */
  7498. function loadZlItemList(event) {
  7499. if (event != null) {
  7500. if (event.keyCode == 38 || event.keyCode == 40 || event.keyCode == 13) {
  7501. //上下键不刷新表格
  7502. return;
  7503. }
  7504. }
  7505. $('#zlItem').webuiPopover('show');
  7506. $('#tb_table_zl_item').bootstrapTable('refresh');
  7507. $('#tb_table_zl_item').bootstrapTable({
  7508. url: '/thmz/getZlItemByCommonParams', //请求后台的URL(*)
  7509. method: 'GET', //请求方式(*)
  7510. toolbar: '#toolbar', //工具按钮用哪个容器
  7511. striped: true, //是否显示行间隔色
  7512. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  7513. pagination: false, //是否显示分页(*)
  7514. sortable: true, //是否启用排序
  7515. sortOrder: "asc", //排序方式
  7516. queryParams: function (params) {
  7517. var temp = {
  7518. commonParams: $("#zlItem").val()
  7519. };
  7520. return temp;
  7521. }, //传递参数(*)
  7522. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  7523. pageNumber: 1, //初始化加载第一页,默认第一页
  7524. pageSize: 5, //每页的记录行数(*)
  7525. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  7526. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  7527. strictSearch: true,
  7528. showColumns: false, //是否显示所有的列
  7529. showRefresh: false, //是否显示刷新按钮
  7530. minimumCountColumns: 2, //最少允许的列数
  7531. clickToSelect: true, //是否启用点击选中行
  7532. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  7533. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  7534. cardView: false, //是否显示详细视图
  7535. detailView: false,
  7536. //rowStyle:rowStyle,//通过自定义函数设置行样式
  7537. ajaxOptions: {
  7538. headers: {
  7539. 'Accept': 'application/json',
  7540. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  7541. }
  7542. },
  7543. columns: [
  7544. {
  7545. field: 'code',
  7546. title: '编码',
  7547. align: "center",
  7548. valign: 'middle',
  7549. // sortable: true
  7550. }, {
  7551. field: 'name',
  7552. title: '名称',
  7553. align: "center",
  7554. valign: 'middle',
  7555. // sortable: true
  7556. }
  7557. , {
  7558. field: 'execUnitName',
  7559. title: '执行科室',
  7560. align: "center",
  7561. valign: 'middle',
  7562. // sortable: true
  7563. }
  7564. , {
  7565. field: 'chargeAmount',
  7566. title: '价格',
  7567. align: "center",
  7568. valign: 'middle',
  7569. // sortable: true
  7570. formatter: function (value, row, index) {
  7571. if (value == null) {
  7572. return "0.00元";
  7573. }
  7574. return value.toFixed(2) + "元";
  7575. }
  7576. }, {
  7577. field: 'descriptions',
  7578. title: '规格',
  7579. align: "center",
  7580. valign: 'middle',
  7581. // sortable: true
  7582. }, {
  7583. field: 'selfpayProp',
  7584. title: '自付比例',
  7585. align: "center",
  7586. valign: 'middle',
  7587. // sortable: true
  7588. formatter: function (value, row, index) {
  7589. if (value != null) {
  7590. return value + '%';
  7591. }
  7592. }
  7593. }, {
  7594. field: 'connotation',
  7595. title: '医保说明',
  7596. align: "center",
  7597. valign: 'middle',
  7598. // sortable: true
  7599. }, {
  7600. field: 'nationalCode',
  7601. title: '医保编码',
  7602. align: "left",
  7603. valign: 'middle',
  7604. // sortable: true
  7605. }
  7606. ],
  7607. responseHandler: function (res) {
  7608. if (res == '401' || res == 401) {
  7609. window.location.href = '/thmz/login/view'
  7610. return;
  7611. }
  7612. var ress = eval(res);
  7613. if (ress.code == -1) {
  7614. errorMesage(res);
  7615. return {
  7616. "total": 0,//总页数
  7617. "rows": {} //数据
  7618. };
  7619. }
  7620. $("#zlItemPopoverContent").parent().css("background", "#EBEBE4");
  7621. return {
  7622. "total": ress.data.length,//总页数
  7623. "rows": ress.data //数据
  7624. };
  7625. },
  7626. onClickRow: function (row, $element) {
  7627. hintProjectSelfPayInfo(row.selfpayProp, "诊疗");
  7628. $('#zlItem').webuiPopover('hide');
  7629. $("#zlExecUnit").selectpicker('val', row.execUnit);//默认不选中
  7630. $("#zlExecUnit").selectpicker('refresh');
  7631. //诊疗
  7632. if ($("#zlTab").find("li") == null || $("#zlTab").find("li").length == 0) {
  7633. initNavTabs(3, null, null);
  7634. }
  7635. $("#zlItem").val(row.name);
  7636. $("#zlItem").blur();
  7637. $("#zlItemPrice").val(row.chargeAmount);
  7638. zlItemPriceIsReadonly(row.chargeAmount);
  7639. $("#chargeUnit").val(row.specification);
  7640. $("#zl_current_code").val(row.code);
  7641. $("#itemQuantity").val(1);
  7642. $("#descriptions").val(row.descriptions);
  7643. $("#descriptions").attr('title', row.descriptions);
  7644. $("#dayZlNum").selectpicker('val', 1);//默认不选中
  7645. $("#dayZlNum").selectpicker('refresh');
  7646. $("#orderFrequencyZl").selectpicker('val', 'ONCE');//默认不选中
  7647. $("#orderFrequencyZl").selectpicker('refresh');
  7648. calculateZl(false);
  7649. $("#chargeUnit").focus();
  7650. return;
  7651. }
  7652. });
  7653. }
  7654. /**
  7655. * 诊疗单价输入框是否只读
  7656. */
  7657. function zlItemPriceIsReadonly(val) {
  7658. if(val !=null && Number(val) > 0 ){
  7659. $("#zlItemPrice").attr("readonly","readonly")
  7660. }else {
  7661. $("#zlItemPrice").removeAttr("readonly")
  7662. }
  7663. }
  7664. /**
  7665. * 诊疗与医技选中
  7666. * @param code
  7667. * @param name 回写的时候可以设置null
  7668. * @param type 1 检验 2 检查
  7669. * @param async 当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  7670. */
  7671. //function checkJcJyItemInfo(code, name, type) {
  7672. function checkJcJyItemInfo(code, name, type, async) {
  7673. // //判断是否有重复的项目 返回true 说明有重复的
  7674. // if (verifyRepeat(code, null, 2)) {
  7675. // return;
  7676. // }
  7677. //不需要每次都关闭帮助树
  7678. //$("#treeButton").webuiPopover('hide');
  7679. $.ajax({
  7680. type: "GET",
  7681. url: '/thmz/getJcJyItemChargeByCode?code=' + code + '&jcJyZltype=' + type,
  7682. contentType: "application/json;charset=UTF-8",
  7683. dataType: "json",
  7684. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7685. async: async,//当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  7686. success: function (res) {
  7687. if (res == '401' || res == 401) {
  7688. window.location.href = '/thmz/login/view'
  7689. return;
  7690. }
  7691. if (res.code == 0) {
  7692. if (res.data != null) {
  7693. hintProjectSelfPayInfo(res.selfpayProp, type == 1 ? "检验" : "辅助检查");
  7694. //如果
  7695. if ($("#jcjyTab").find("li") == null || $("#jcjyTab").find("li").length == 0) {
  7696. initNavTabs(2, null, null);
  7697. }
  7698. if (name == null) {
  7699. name = res.name;
  7700. }
  7701. $("#jcJyItem").val(name);
  7702. $("#jcJyItem").blur();
  7703. $("#jcjyItemPrice").val(res.totalAmount);
  7704. $("#jcjy_current_code").val(code);
  7705. $("#jyQuantity").val(1);
  7706. $("#execUnit").selectpicker('val', res.execUnit);//默认不选中
  7707. $("#execUnit").selectpicker('refresh');
  7708. // if (async) {
  7709. // if (type == 1) {
  7710. // //选中项目后,光标默认到数量输入框
  7711. // $("#jyZdSample").next().click();
  7712. // // prevEleId = 'jyZdSample';
  7713. // } else if (type == 2) {
  7714. // $("#yshPart").next().click();
  7715. // // prevEleId = 'yshPart';
  7716. // }
  7717. // }
  7718. }
  7719. $("#jyjcNote").val(res.note)
  7720. } else {
  7721. errorMesage(res);
  7722. }
  7723. }
  7724. });
  7725. }
  7726. /**
  7727. * 查询辅助检查、检验项目明细
  7728. * @param code 编码
  7729. * @param jcJyZltype 1 检验 2 检查
  7730. */
  7731. function getJcJyItemChargeByCode(code, jcJyZltype) {
  7732. if (code != null) {
  7733. $("#itemCodeSearch").val(code);
  7734. $("#jcJyZltypeSearch").val(jcJyZltype);
  7735. } else if ($("#jcjy_current_code").val() == null || $("#jcjy_current_code").val() == '') {
  7736. errorMesageSimaple("未选中任何项目!");
  7737. return;
  7738. }
  7739. $("#jcJyItemModal").modal("show");
  7740. $('#jcJyItemTable').bootstrapTable('refresh');
  7741. $('#jcJyItemTable').bootstrapTable({
  7742. url: '/thmz/getJcJyItemChargeByCode', //请求后台的URL(*)
  7743. method: 'GET', //请求方式(*)
  7744. toolbar: '#toolbar', //工具按钮用哪个容器
  7745. striped: true, //是否显示行间隔色
  7746. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  7747. pagination: false, //是否显示分页(*)
  7748. sortable: true, //是否启用排序
  7749. sortOrder: "asc", //排序方式
  7750. queryParams: function (params) {
  7751. var itemCodeSearch = $("#itemCodeSearch").val();
  7752. var jcJyZltypeSearch = $("#jcJyZltypeSearch").val();
  7753. if (itemCodeSearch == null || itemCodeSearch == "") {
  7754. itemCodeSearch = $("#jcjy_current_code").val();
  7755. jcJyZltypeSearch = $("#jcJyZltype").val();
  7756. }
  7757. var temp = {
  7758. code: itemCodeSearch,
  7759. jcJyZltype: jcJyZltypeSearch
  7760. };
  7761. return temp;
  7762. }, //传递参数(*)
  7763. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  7764. pageNumber: 1, //初始化加载第一页,默认第一页
  7765. pageSize: 5, //每页的记录行数(*)
  7766. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  7767. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  7768. strictSearch: true,
  7769. showColumns: false, //是否显示所有的列
  7770. showRefresh: false, //是否显示刷新按钮
  7771. minimumCountColumns: 2, //最少允许的列数
  7772. clickToSelect: true, //是否启用点击选中行
  7773. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  7774. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  7775. cardView: false, //是否显示详细视图
  7776. detailView: false,
  7777. //rowStyle:rowStyle,//通过自定义函数设置行样式
  7778. ajaxOptions: {
  7779. headers: {
  7780. 'Accept': 'application/json',
  7781. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  7782. }
  7783. },
  7784. columns: [
  7785. {
  7786. field: 'tcCode',
  7787. title: '项目编码',
  7788. align: "center",
  7789. valign: 'middle',
  7790. // sortable: true
  7791. }, {
  7792. field: 'code',
  7793. title: '收费编码',
  7794. align: "center",
  7795. valign: 'middle',
  7796. // sortable: true
  7797. }
  7798. , {
  7799. field: 'name',
  7800. title: '收费名称',
  7801. align: "center",
  7802. valign: 'middle',
  7803. // sortable: true
  7804. }, {
  7805. field: 'num',
  7806. title: '数量',
  7807. align: "center",
  7808. valign: 'middle',
  7809. // sortable: true
  7810. }, {
  7811. field: 'chargeAmount',
  7812. title: '单价',
  7813. align: "center",
  7814. valign: 'middle',
  7815. // sortable: true
  7816. formatter: function (value, row, index) {
  7817. if (value == null || value == "") {
  7818. return 0;
  7819. }
  7820. return value.toFixed(2);
  7821. }
  7822. }, {
  7823. field: 'totalAmount',
  7824. title: '总金额',
  7825. align: "center",
  7826. valign: 'middle',
  7827. // sortable: true
  7828. formatter: function (value, row, index) {
  7829. if (value == null || value == "") {
  7830. return 0;
  7831. }
  7832. return value.toFixed(2);
  7833. }
  7834. }, {
  7835. field: 'selfpayProp',
  7836. title: '自付比例',
  7837. align: "center",
  7838. valign: 'middle',
  7839. // sortable: true
  7840. formatter: function (value, row, index) {
  7841. if (value != null) {
  7842. return value + '%';
  7843. }
  7844. }
  7845. }, {
  7846. field: 'connotation',
  7847. title: '医保说明',
  7848. align: "center",
  7849. valign: 'middle',
  7850. // sortable: true
  7851. }
  7852. ],
  7853. responseHandler: function (res) {
  7854. if (res == '401' || res == 401) {
  7855. window.location.href = '/thmz/login/view'
  7856. return;
  7857. }
  7858. $("#itemCodeSearch").val(null);
  7859. $("#jyjcNote").val(res.note)
  7860. var ress = eval(res);
  7861. if (ress.code == -1) {
  7862. errorMesage(res);
  7863. return {
  7864. "total": 0,//总页数
  7865. "rows": {} //数据
  7866. };
  7867. }
  7868. return {
  7869. "total": ress.data.length,//总页数
  7870. "rows": ress.data //数据
  7871. };
  7872. }
  7873. });
  7874. }
  7875. function getJyJcCodeParam() {
  7876. var itemCodeSearch = $("#itemCodeSearch").val();
  7877. var jcJyZltypeSearch = $("#jcJyZltypeSearch").val();
  7878. if (itemCodeSearch == null || itemCodeSearch == "") {
  7879. itemCodeSearch = $("#jcjy_current_code").val();
  7880. jcJyZltypeSearch = $("#jcJyZltype").val();
  7881. }
  7882. var temp = {
  7883. code: itemCodeSearch,
  7884. jcJyZltype: jcJyZltypeSearch
  7885. };
  7886. return temp;
  7887. }
  7888. /**
  7889. * 判断是否有重复的项目 返回true 说明有重复的
  7890. * @param code 编码
  7891. * @param serial 药品规格 null 时是非药品
  7892. * @param chargeUnitCode 检查部位或者检验物 null 时是 诊疗
  7893. * @param index
  7894. */
  7895. function verifyRepeat(code, serial, chargeUnitCode, index) {
  7896. //是新增药品还是编辑 true 修改 默认false
  7897. var updateFlag = null;
  7898. if (index == 0) {
  7899. updateFlag = $("#western_medicine_update_flag").val();
  7900. } else if (index == 1) {
  7901. updateFlag = $("#chinese_medicine_update_flag").val();
  7902. } else if (index == 2) {
  7903. updateFlag = $("#jcjy_update_flag").val();
  7904. } else if (index == 3) {
  7905. updateFlag = $("#zl_update_flag").val();
  7906. } else if (index == 5) {
  7907. updateFlag = $("#op_record_update_flag").val();
  7908. }
  7909. if (updateFlag == undefined || updateFlag == null) {
  7910. updateFlag = false;
  7911. }
  7912. if (updateFlag == "true" || updateFlag == true) {
  7913. return false;
  7914. }
  7915. var tabId = null;
  7916. //西药
  7917. if (index == 0) {
  7918. tabId = "xyTab";
  7919. } else if (index == 1) {
  7920. //中成药
  7921. tabId = "zyTab";
  7922. } else if (index == 2) {
  7923. //辅助检查、检验
  7924. tabId = "jcjyTab";
  7925. } else if (index == 3) {
  7926. //诊疗
  7927. tabId = "zlTab";
  7928. } else if (index == 4) {
  7929. //入院
  7930. tabId = "zyReqTab";
  7931. } else if (index == 5) {
  7932. //手术
  7933. tabId = "opRecordTab";
  7934. }
  7935. var tableId = $("#" + tabId + " li.active").find("a").attr("href");
  7936. var items = $(tableId).find("div:eq(0)").find("div.form-group");
  7937. var groupId = null;
  7938. if (index == 0) {
  7939. groupId = $("#groupId").val();
  7940. }
  7941. if (items != null && items.length > 0) {
  7942. for (var i = 0; i < items.length; i++) {
  7943. if (serial == null) {
  7944. var temporary_items_code = $(items[i]).find("input.temporary_items_code").val();
  7945. var temporary_items_desc_value = $(items[i]).find("input.temporary_items_desc_value").val();
  7946. if (chargeUnitCode == null && code === temporary_items_code) {
  7947. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  7948. return true;
  7949. }
  7950. if (code === temporary_items_code && chargeUnitCode === temporary_items_desc_value) {
  7951. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  7952. return true;
  7953. }
  7954. } else {
  7955. if (index == 0) {
  7956. //西药需要判断组号,因为可能会有不同组的皮试用药,需要相同的药品
  7957. var temporary_items_groupId = $(items[i]).find("input.temporary_items_groupId").val();
  7958. var temporary_items_code = $(items[i]).find("input.temporary_items_code").val();
  7959. var temporary_items_serial = $(items[i]).find("input.temporary_items_serial").val();
  7960. if (code === temporary_items_code && serial === temporary_items_serial && groupId === temporary_items_groupId) {
  7961. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  7962. return true;
  7963. }
  7964. } else {
  7965. var temporary_items_code = $(items[i]).find("input.temporary_items_code").val();
  7966. var temporary_items_serial = $(items[i]).find("input.temporary_items_serial").val();
  7967. if (code === temporary_items_code && serial === temporary_items_serial) {
  7968. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  7969. return true;
  7970. }
  7971. }
  7972. }
  7973. }
  7974. }
  7975. return false;
  7976. }
  7977. /**
  7978. * 初始化处方分页
  7979. * @param index 0 西药 1 中药 2 诊疗 3 入院
  7980. * @param groupNo 初始化时候的药房分类
  7981. * @param orderNo 初始化时候的处方组号
  7982. */
  7983. function initNavTabs(index, groupNo, orderNo) {
  7984. var tabId = null;
  7985. var tabContentId = null;
  7986. var paneId = null;
  7987. var cfdesc = '普药';
  7988. //西药
  7989. if (index == 0) {
  7990. tabId = "xyTab";
  7991. tabContentId = "xyTabContent";
  7992. paneId = "xycf_" + getUID();
  7993. } else if (index == 1) {
  7994. //中草药
  7995. tabId = "zyTab";
  7996. tabContentId = "zyTabContent";
  7997. paneId = "zycf_" + getUID();
  7998. cfdesc = '中草药';
  7999. } else if (index == 2) {
  8000. //医技
  8001. tabId = "jcjyTab";
  8002. tabContentId = "jcjyTabContent";
  8003. paneId = "jcjycf_" + getUID();
  8004. cfdesc = '辅助检查、检验';
  8005. } else if (index == 3) {
  8006. //诊疗
  8007. tabId = "zlTab";
  8008. tabContentId = "zlTabContent";
  8009. paneId = "zlcf_" + getUID();
  8010. cfdesc = '诊疗';
  8011. } else if (index == 4) {
  8012. //住院
  8013. tabId = "zyReqTab";
  8014. tabContentId = "zyReqTabContent";
  8015. paneId = "zyReqcf_" + getUID();
  8016. cfdesc = '入院';
  8017. } else if (index == 5) {
  8018. //手术
  8019. tabId = "opRecordTab";
  8020. tabContentId = "opRecordTabContent";
  8021. paneId = "opRecordcf_" + getUID();
  8022. cfdesc = '手术';
  8023. }
  8024. var tabHtml = '<li class="active"><a href="#' + paneId + '" role="tab" data-toggle="tab" ';
  8025. if (index == 0) {
  8026. tabHtml += ' onclick=xyTableOnClick("' + paneId + '")';
  8027. }
  8028. tabHtml += '>处方 <small class="cfdesc">(' + cfdesc + ')</small></a></li>';
  8029. $("#" + tabId).html(tabHtml);
  8030. var html = '<div class="tab-pane fade in active" id="' + paneId + '" style="height: 100%;min-height: 285px;position: relative;">';
  8031. html += '<img src="/thmz/images/prescription.png" style="margin-top: 5px;"/>';
  8032. html += '<input class="current_groupNo" type="hidden"/>';
  8033. html += ' <div class="cf_content rb_item" style="height: 230px;padding-top: 5px;overflow-y: auto;"></div>' +
  8034. ' <div style="height: 30px;border-top: 1px solid #ddd;width: 100%;position: absolute;bottom:0;padding-top: 10px;">';
  8035. html += '<div style="width: 460px;">'
  8036. if (index == 1) {
  8037. html += '<div id="cyFjDiv" style="width: 130px;float: left;line-height: 34px;">' +
  8038. ' <label class="my_label_2">复煎:</label>' +
  8039. ' <div style="width: 69px;float: left;">' +
  8040. ' <input type="number" class="form-control " id="cyFj" placeholder="请输入" value="1"/>' +
  8041. ' </div>次' +
  8042. ' </div>';
  8043. html += '<div style="width: 130px;float: left;line-height: 34px;">' +
  8044. ' <label class="my_label_2">分服:</label>' +
  8045. ' <div style="width: 69px;float: left;">' +
  8046. ' <input type="number" class="form-control " id="cyFfcs" placeholder="请输入" value="2"/>' +
  8047. ' </div>次' +
  8048. ' </div>';
  8049. html += '<div style="width: 180px;float: left;">' +
  8050. ' <label class="my_label_2">用法:</label>' +
  8051. ' <div style="width: 135px;float: left;">' +
  8052. ' <select class="form-control selectpicker show-tick useType"' +
  8053. ' title="请选择" id="useType_1">' +
  8054. ' </select>' +
  8055. ' </div>' +
  8056. ' </div>';
  8057. html += '</div><div style="width: 460px;">'
  8058. html += '<input id="singleAmount" type="hidden"/>';
  8059. }
  8060. html += '<div style="width: 130px;float: left;padding-left: 7px;padding-top: 8px;">金额:<span class="cf_amount">0.0</span><span>元</span></div>';
  8061. if (index == 0) {
  8062. html += '<div style="width: 310px;float: left;color: red;padding-top: 8px;">说明:此费用包含药品给药方式所产生的费用!</div>';
  8063. }
  8064. // else if (index == 1) {
  8065. // html += '<div style="width: 310px;float: left;color: red;padding-top: 8px;">说明:此费用包含药品代煎所产生的费用!</div>';
  8066. // }
  8067. html += '</div></div></div>';
  8068. $("#" + tabContentId).html(html);
  8069. if (index == 1) {
  8070. var water = '<option value="加凉水">加凉水</option><option value="加温水">加温水</option><option value="加开水">加开水</option><option value="加冰水">加冰水</option><option value="加糖水">加糖水</option>';
  8071. $('#cyJssm').html(water);
  8072. $('#cyJssm').selectpicker('refresh');
  8073. $("#cyJssm").selectpicker('val', "加凉水");
  8074. $('#cyJssm').selectpicker('refresh');
  8075. if($("#zyClassType").val() =='83'){
  8076. $("#cyFjDiv").removeClass("in").addClass("hide");
  8077. }else {
  8078. $("#cyFjDiv").removeClass("hide").addClass("in");
  8079. }
  8080. initAllMzYshZdFysm();
  8081. //initZyOrderFrequencys("zy_orderFrequency_1", false);
  8082. initZySupplyTypes("zy_supplyType_1", false);
  8083. }
  8084. if (groupNo != null && groupNo != "") {
  8085. //设置当前药品的品类
  8086. $("#" + paneId).find("input.current_groupNo").val(groupNo);
  8087. }
  8088. if (orderNo != null && orderNo != "" && orderNoAndTableIdMap != null) {
  8089. orderNoAndTableIdMap.put(orderNo, paneId);
  8090. tableIdAndOrderNoMap.put(paneId, orderNo);
  8091. }
  8092. }
  8093. /**
  8094. * 清空处方分页
  8095. * @param index 0 西药 1 中药 2 诊疗 3 入院 5 手术
  8096. */
  8097. function clearNavTabs(index) {
  8098. var tabId = null;
  8099. var tabContentId = null;
  8100. //西药
  8101. if (index == 0) {
  8102. tabId = "xyTab";
  8103. tabContentId = "xyTabContent";
  8104. } else if (index == 1) {
  8105. //中草药
  8106. tabId = "zyTab";
  8107. tabContentId = "zyTabContent";
  8108. $("#cyJsl").val(400);
  8109. $("#cyZql").val(200);
  8110. $("#cyFj").val(1);
  8111. $("#cyFfcs").val(2);
  8112. $("#cyMtjs").val(1);
  8113. $("#zyfs").val(null);
  8114. $("#cyJssm").selectpicker('val', "加凉水");
  8115. $('#cyJssm').selectpicker('refresh');
  8116. $("#zy_supplyType_1").selectpicker('val', null);
  8117. $('#zy_supplyType_1').selectpicker('refresh');
  8118. } else if (index == 2) {
  8119. //辅助检查、检验
  8120. tabId = "jcjyTab";
  8121. tabContentId = "jcjyTabContent";
  8122. } else if (index == 3) {
  8123. //医技
  8124. tabId = "zlTab";
  8125. tabContentId = "zlTabContent";
  8126. } else if (index == 4) {
  8127. //住院
  8128. tabId = "zyReqTab";
  8129. tabContentId = "zyReqTabContent";
  8130. } else if (index == 5) {
  8131. //手术
  8132. tabId = "opRecordTab";
  8133. tabContentId = "opRecordTabContent";
  8134. }
  8135. $("#" + tabId).html(null);
  8136. $("#" + tabContentId).html(null);
  8137. }
  8138. /**
  8139. * 添加处方分页
  8140. * @param index 0 西药 1 中药 2 诊疗 3 入院
  8141. * @param groupNo 71 普通西药 91 医材 111 麻、精一 131 精二 151 诊疗
  8142. * @param orderNo 处方号
  8143. */
  8144. function refreshNavTabs(index, groupNo, orderNo) {
  8145. var tabId = null;
  8146. var tabContentId = null;
  8147. var paneIdPrfix = null;
  8148. var cfdesc = '普药';
  8149. //西药
  8150. if (index == 0) {
  8151. tabId = "xyTab";
  8152. tabContentId = "xyTabContent";
  8153. paneIdPrfix = "xycf_";
  8154. if (groupNo == '91') {
  8155. cfdesc = '医材';
  8156. } else if (groupNo == '111') {
  8157. cfdesc = '麻、精一';
  8158. } else if (groupNo == '131') {
  8159. cfdesc = '精二';
  8160. }
  8161. // else if(groupNo=='151'){
  8162. // cfdesc='诊疗';
  8163. // }
  8164. } else if (index == 1) {
  8165. //中草药
  8166. tabId = "zyTab";
  8167. tabContentId = "zyTabContent";
  8168. paneIdPrfix = "zycf_";
  8169. cfdesc = '中草药';
  8170. } else if (index == 2) {
  8171. //辅助检查、检验
  8172. tabId = "jcjyTab";
  8173. tabContentId = "jcjyTabContent";
  8174. paneIdPrfix = "jcjycf_";
  8175. cfdesc = '辅助检查、检验';
  8176. } else if (index == 3) {
  8177. //诊疗
  8178. tabId = "zlTab";
  8179. tabContentId = "zlTabContent";
  8180. paneIdPrfix = "zlcf_";
  8181. cfdesc = '诊疗';
  8182. } else if (index == 4) {
  8183. //入院
  8184. tabId = "zyReqTab";
  8185. tabContentId = "zyReqTabContent";
  8186. paneIdPrfix = "zyReqcf_";
  8187. cfdesc = '入院';
  8188. } else if (index == 5) {
  8189. //手术
  8190. tabId = "opRecordTab";
  8191. tabContentId = "opRecordTabContent";
  8192. paneIdPrfix = "opRecordcf_";
  8193. cfdesc = '手术';
  8194. }
  8195. // var tableId = $("#"+tabId+" li.active").find("a").attr("href");
  8196. // var length = $(tableId).find("div:eq(0)").children().length;
  8197. // if(length==0){
  8198. // //当前处方是空白的,不需要新增处方
  8199. // return;
  8200. // }
  8201. var cfTitle = "处方" + " <small class=\"cfdesc\">(" + cfdesc + ")</small>";
  8202. var paneId = paneIdPrfix + getUID();
  8203. //清除选中的样式
  8204. $("#" + tabId).find("li.active").removeClass("active");
  8205. var tabHtml = '<li><a href="#' + paneId + '" role="tab" data-toggle="tab"';
  8206. if (index == 0) {
  8207. tabHtml += ' onclick=xyTableOnClick("' + paneId + '")';
  8208. }
  8209. tabHtml += '>' + cfTitle + '</a';
  8210. tabHtml += '</li>';
  8211. $("#" + tabId).append(tabHtml);
  8212. var html = '<div class="tab-pane fade in active" id="' + paneId + '" style="height: 100%;min-height: 285px;position: relative;">' +
  8213. '<img src="/thmz/images/prescription.png" style="margin-top: 5px;"/>' +
  8214. '<input class="current_groupNo" type="hidden"/>' +
  8215. ' <div class="cf_content rb_item" style="height: 230px;padding-top: 5px;overflow-y: auto;"></div>' +
  8216. ' <div style="height: 30px;border-top: 1px solid #ddd;width: 100%;position: absolute;bottom:0;">' +
  8217. '<div style="width: 460px;">' +
  8218. '<div style="width: 130px;float: left;padding-left: 7px;padding-top: 8px;">金额:<span class="cf_amount">0.0</span><span>元</span></div>';
  8219. if (index == 0) {
  8220. html += '<div style="width: 310px;float: left;color: red;padding-top: 8px;">说明:此费用包含药品给药方式所产生的费用!</div>';
  8221. }
  8222. html += '</div></div>';
  8223. $("#" + tabContentId).append(html);
  8224. //切换处方
  8225. $("#" + tabId).find("a[href='#" + paneId + "']").off("click").tab('show');
  8226. if (groupNo != null && groupNo != "") {
  8227. //设置当前药品的品类
  8228. $("#" + paneId).find("input.current_groupNo").val(groupNo);
  8229. }
  8230. if (orderNo != null && orderNo != "" && orderNoAndTableIdMap != null) {
  8231. orderNoAndTableIdMap.put(orderNo, paneId);
  8232. tableIdAndOrderNoMap.put(paneId, orderNo);
  8233. }
  8234. }
  8235. /**
  8236. * 判断是否需要自动增加组号
  8237. * @param res
  8238. */
  8239. function autoAddGroupId(res) {
  8240. var tableId = $("#xyTab li.active").find("a").attr("href");
  8241. var childrens = $(tableId).find("div:eq(0)").children();
  8242. var prevCategoriesFlag = null;
  8243. if (childrens != null && childrens.length > 0) {
  8244. prevCategoriesFlag = $(childrens[childrens.length - 1]).find("input.temporary_items_categoriesFlag").val();
  8245. if (prevCategoriesFlag == "" || prevCategoriesFlag == undefined) {
  8246. prevCategoriesFlag = null;
  8247. }
  8248. }
  8249. if (!(res.data.categoriesFlag == 2 || res.data.categoriesFlag == "2" || res.data.categoriesFlag == 1 || res.data.categoriesFlag == "1") ||
  8250. ((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)) {
  8251. //非针剂默认要切换组号 或者 是针剂,但是上一个药品不是针剂,这时候也要新换一个组号
  8252. var last = parseInt($("#groupId > option:last").val());
  8253. $("#groupId").selectpicker('val', last);
  8254. $('#groupId').selectpicker('refresh');
  8255. }
  8256. }
  8257. /**
  8258. * 填充西药选中的内容
  8259. * @param res
  8260. * @param groupNo
  8261. * @param type 操作类型 0 修改 1 医疗范文 2 就诊详情 3 处方开立
  8262. */
  8263. function fitWesternMedicine(res, groupNo, type) {
  8264. hintProjectSelfPayInfo(res.data.selfpayProp, "药品");
  8265. if (type != 0) {
  8266. //处方修改的时候不改变组号
  8267. autoAddGroupId(res);
  8268. }
  8269. $("#categoriesFlag").val(res.data.categoriesFlag);
  8270. //prevCategoriesFlag = res.data.categoriesFlag;
  8271. $("#western_medicine_name").val(res.data.name);
  8272. $("#western_medicine_name").blur();
  8273. var drugWinHtml = '';
  8274. var index = null;
  8275. if (res.data.weight != null) {
  8276. $("#drugWin").val(res.data.weight);
  8277. $("#drugWinDb").val(res.data.weight);
  8278. drugWinHtml = '<option value="' + res.data.weighUnit + '" desc="' + res.data.weight + '">' + res.data.weighUnitDesc + '</option>';
  8279. index = res.data.weighUnit;
  8280. }
  8281. if (res.data.volum != null) {
  8282. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  8283. $("#drugWin").val(res.data.volum);
  8284. $("#drugWinDb").val(res.data.volum);
  8285. }
  8286. drugWinHtml += '<option value="' + res.data.volUnit + '" desc="' + res.data.volum + '">' + res.data.volUnitDesc + '</option>';
  8287. if (index == null) {
  8288. index = res.data.volUnit;
  8289. }
  8290. }
  8291. if (res.data.miniUnit != null && res.data.miniUnit != "") {
  8292. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  8293. $("#drugWin").val(1);
  8294. $("#drugWinDb").val(1);
  8295. }
  8296. drugWinHtml += '<option value="' + res.data.miniUnit + '" desc="1">' + res.data.miniUnitDesc + '</option>';
  8297. if (index == null) {
  8298. index = res.data.miniUnit;
  8299. }
  8300. }
  8301. $('#drugWinUnit').html(drugWinHtml);
  8302. $('#drugWinUnit').selectpicker('refresh');
  8303. $("#drugWinUnit").selectpicker('val', index);
  8304. $('#drugWinUnit').selectpicker('refresh');
  8305. if (res.data.packUnitDesc != null && res.data.packUnitDesc != "") {
  8306. var html = '<option value="' + res.data.packUnitDesc + '" >' + res.data.packUnitDesc + '</option>';
  8307. $('#packUnit').html(html);
  8308. $('#packUnit').selectpicker('refresh');
  8309. $("#packUnit").selectpicker('val', res.data.packUnitDesc);
  8310. $('#packUnit').selectpicker('refresh');
  8311. }
  8312. $("#packRetprice").val(res.data.packRetprice);
  8313. $("#packSize").val(res.data.packSize);
  8314. $("#western_medicine_current_code").val(res.data.code);
  8315. $("#western_medicine_current_serial").val(res.data.serial);
  8316. if ($("#dayNum").val() == null) {
  8317. //天数 同组药品天数相同
  8318. $("#dayNum").selectpicker('val', 1);
  8319. $('#dayNum').selectpicker('refresh');
  8320. }
  8321. if (($("#supplyType").val() == null || $("#supplyType").val() == "") && res.data.supplyType != null) {
  8322. // 给药方式 同组药品给药方式相同
  8323. $("#supplyType").selectpicker('val', res.data.supplyType);
  8324. $('#supplyType').selectpicker('refresh');
  8325. }
  8326. if (($("#orderFrequency").val() == null || $("#orderFrequency").val() == "") && res.data.frequency != null) {
  8327. //频次编码 同组药品频次编码相同
  8328. $("#orderFrequency").selectpicker('val', res.data.frequency);
  8329. $('#orderFrequency').selectpicker('refresh');
  8330. }
  8331. if ($("#orderFrequency").val() == null || $("#orderFrequency").val() == "") {
  8332. //频次编码 防止频次为空
  8333. $("#orderFrequency").selectpicker('val', "ONCE");
  8334. $('#orderFrequency').selectpicker('refresh');
  8335. }
  8336. $("#tryResult").parent().parent().parent().removeClass("in").addClass("hide");
  8337. if (res.data.psFlag != null && (res.data.psFlag == 1 || res.data.psFlag == "1")) {
  8338. if (res.data.categoriesFlag == 0 || res.data.categoriesFlag == "0" || res.data.categoriesFlag == 2 || res.data.categoriesFlag == "2") {
  8339. initTryResultSelect(res.data.categoriesFlag);
  8340. }
  8341. }
  8342. $("#manufactoryName").val(res.data.manufactoryName);
  8343. $("#specification").val(res.data.specification);
  8344. calculate();
  8345. $("#addPDiv").css("margin-left", "50px");
  8346. $("#hlyyypsms").removeClass("hide").addClass("in");
  8347. $("#western_medicine_name").focus();
  8348. }
  8349. /**
  8350. * 剂量单位改变事件
  8351. */
  8352. function drugWinUnitChange() {
  8353. var desc = $('#drugWinUnit').find("option:selected").attr('desc');
  8354. $("#drugWin").val(desc);
  8355. $("#drugWinDb").val(desc);
  8356. calculate();
  8357. }
  8358. /**
  8359. * 根据选择的内容计算总的用药量
  8360. */
  8361. function calculate() {
  8362. //最小规格剂量
  8363. var drugWinDb = $("#drugWinDb").val();
  8364. //天数
  8365. var dayNum = $("#dayNum").val();
  8366. //当前使用的最小剂量
  8367. var drugWin = $("#drugWin").val();
  8368. //频率
  8369. var times = $('#orderFrequency').find("option:selected").attr('desc');
  8370. //包装规格数量
  8371. var packSize = $("#packSize").val();
  8372. //单价
  8373. var packRetprice = $("#packRetprice").val();
  8374. //当前药房编码
  8375. var currentGroupNo = $("#current_groupNo").val();
  8376. if (drugWinDb == null || drugWinDb === "") {
  8377. if (currentGroupNo == '71') {
  8378. return;
  8379. }
  8380. drugWinDb = 1;
  8381. }
  8382. if (dayNum == null || dayNum === "") {
  8383. if (currentGroupNo == '71') {
  8384. return;
  8385. }
  8386. dayNum = 1;
  8387. }
  8388. if (drugWin == null || drugWin === "") {
  8389. if (currentGroupNo == '71') {
  8390. return;
  8391. }
  8392. drugWin = 1;
  8393. }
  8394. if (times == null || times === "") {
  8395. if (currentGroupNo == '71') {
  8396. return;
  8397. }
  8398. times = 1;
  8399. }
  8400. if (packSize == null || packSize === "") {
  8401. return;
  8402. }
  8403. //拆零总量
  8404. var scatteredTotalNum = Multiply(Multiply(dayNum, drugWin), times);
  8405. //整包装的数量
  8406. var totalNum = Math.ceil(Division(scatteredTotalNum, Multiply(packSize, drugWinDb)));
  8407. $("#gross").val(totalNum);
  8408. $("#totalRetprice").val(Multiply(totalNum, packRetprice));
  8409. }
  8410. /**
  8411. * 根据选择的总量计算金额 只有医材的时候需要计算
  8412. */
  8413. function calculateSimple() {
  8414. //总量
  8415. var gross = $("#gross").val();
  8416. //单价
  8417. var packRetprice = $("#packRetprice").val();
  8418. $("#totalRetprice").val(Multiply(gross, packRetprice));
  8419. //当前药房编码
  8420. var currentGroupNo = $("#current_groupNo").val();
  8421. if (currentGroupNo == '91') {
  8422. var dayNum = $("#dayNum").val();
  8423. if (dayNum == null || dayNum == "") {
  8424. //医材默认天数为1
  8425. $("#dayNum").selectpicker('val', 1);
  8426. $('#dayNum').selectpicker('refresh');
  8427. }
  8428. var orderFrequency = $("#orderFrequency").val();
  8429. if (orderFrequency == null || orderFrequency == "") {
  8430. $("#orderFrequency").selectpicker('val', "ONCE");
  8431. $('#orderFrequency').selectpicker('refresh');
  8432. }
  8433. }
  8434. }
  8435. /**
  8436. * 根据中药付数计算金额
  8437. */
  8438. function calculateZyAmount() {
  8439. var singleAmount = $("#singleAmount").val();
  8440. var tableId = $("#zyTab li.active").find("a").attr("href");
  8441. //获取中药付数
  8442. //var zyfs = $(tableId).find("input.zyfs").val();
  8443. var zyfs = $("#zyfs").val();
  8444. var cfAmount = Multiply(zyfs, singleAmount);
  8445. $(tableId).find("span.cf_amount").html(cfAmount);
  8446. calculateTotalAmount(false);
  8447. }
  8448. /**
  8449. * 将病人信息填入患者信息修改form
  8450. * @param patinet
  8451. */
  8452. function fillPlusPatinet(patinet) {
  8453. if (patinet != null) {
  8454. $("#editUserCode").val(patinet.patientId);
  8455. $("#editUserName").val(patinet.name);
  8456. $("#editUserName").blur();
  8457. $("#editUserAge").val(patinet.age);
  8458. $("#editUserAge").blur();
  8459. $("#editUserGender").selectpicker('val', patinet.sex);
  8460. $("#editUserGender").selectpicker('refresh');
  8461. $("#editUserGender").blur();
  8462. $("#editUserBirthDay").val(patinet.birthDayStr);
  8463. $("#editUserBirthDay").blur();
  8464. $('#editUserCertificateType').selectpicker('val', patinet.certificateType);
  8465. $('#editUserCertificateType').selectpicker('refresh');
  8466. $("#editUserCardNo").val(patinet.icCardNo);
  8467. $("#editUserCardNo").attr("title", patinet.icCardNo);
  8468. $("#editUserCardNo").blur();
  8469. $("#editUserPhoneNum").val(patinet.phoneNo);
  8470. $("#editUserPhoneNum").attr("title", patinet.phoneNo);
  8471. $("#editUserPhoneNum").blur();
  8472. $("#editUserPatientsNature").selectpicker('val', patinet.responseType);//默认选中
  8473. $('#editUserPatientsNature').selectpicker('refresh');
  8474. $("#editUserPatientsNature").blur();
  8475. $("#editUserIdCard").val(patinet.socialNo);
  8476. $("#editUserIdCard").attr("title", patinet.socialNo);
  8477. $("#editUserIdCard").blur();
  8478. $('#editUserProvinceCode').selectpicker('val', patinet.provinceCode);
  8479. $('#editUserProvinceCode').selectpicker('refresh');
  8480. initCity(2, patinet.cityCode);
  8481. initDistrict(2, patinet.cityCode, patinet.districtCode);
  8482. $("#editUserDetail").val(patinet.detail);
  8483. $("#editUserDetail").blur();
  8484. $("#editUserContact").val(patinet.relName);
  8485. $("#editUserContactPhone").val(patinet.contractName);
  8486. }
  8487. }
  8488. /**
  8489. * 修改病人信息
  8490. */
  8491. function modifyPatient() {
  8492. $.ajax({
  8493. type: "POST",
  8494. url: '/thmz/modifyPatient',
  8495. contentType: "application/json;charset=UTF-8",
  8496. dataType: "json",
  8497. data: JSON.stringify({
  8498. "name": $("#editUserName").val(),
  8499. "age": $("#editUserAge").val(),
  8500. "sex": $("#editUserGender").val(),
  8501. "birthDay": $("#editUserBirthDay").val(),
  8502. "certificateType": $("#editUserCertificateType").val(),
  8503. "icCardNo": $("#editUserCardNo").val(),
  8504. "phoneNo": $("#editUserPhoneNum").val(),
  8505. "responseType": $("#editUserPatientsNature").val(),
  8506. "socialNo": $("#editUserIdCard").val(),
  8507. "provinceCode": $("#editUserProvinceCode").val(),
  8508. "cityCode": $("#editCityCode").val(),
  8509. "districtCode": $("#editUserDistrictCode").val(),
  8510. "detail": $("#editUserDetail").val(),
  8511. "patientId": $("#editUserCode").val(),
  8512. "relName": $("#editUserContact").val(),
  8513. "contractName": $("#editUserContactPhone").val()
  8514. }),
  8515. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8516. success: function (res) {
  8517. if (res == '401' || res == 401) {
  8518. window.location.href = '/thmz/login/view'
  8519. return;
  8520. }
  8521. if (res.code == 0) {
  8522. $('#editUserModal').modal('hide');
  8523. var patientId = $("#patientId").text();
  8524. let tempMzfzSerialNo = $("#mzfzSerialNoInClick").val();
  8525. if (patientId != null && patientId != 'null' && patientId != "" && tempMzfzSerialNo.indexOf("clnicId_") < 0 ) {
  8526. realClinicalReception(patientId, $("#mzfzSerialNoInClick").val(), $("#mzfzReqTypeNoInClick").val());
  8527. } else {
  8528. if(ksjzType == 2){
  8529. let tempPatientId = $("#editUserCode").val();
  8530. clearRapidAccepts();
  8531. $("#rapidAcceptsUserCardNo").val(tempPatientId);
  8532. queryUserInfoByCardNo();
  8533. ksjzType = null;
  8534. }
  8535. }
  8536. clearPlusPatinet();
  8537. } else {
  8538. errorMesage(res);
  8539. }
  8540. }
  8541. });
  8542. }
  8543. /**
  8544. * 将病人信息修改域置空
  8545. * @param patinet
  8546. */
  8547. function clearPlusPatinet() {
  8548. ksjzType = null;
  8549. $("#editUserCode").val(null);
  8550. $("#editUserName").val(null);
  8551. $("#editUserAge").val(null);
  8552. $("#editUserGender").selectpicker('val', '1');
  8553. $("#editUserGender").selectpicker('refresh');
  8554. $("#editUserBirthDay").val(null);
  8555. $('#editUserCertificateType').selectpicker('val', '01');
  8556. $('#editUserCertificateType').selectpicker('refresh');
  8557. $("#editUserCardNo").val(null);
  8558. $("#editUserCardNo").attr("title", null);
  8559. $("#editUserPhoneNum").val(null);
  8560. $("#editUserPhoneNum").attr("title", null);
  8561. $("#editUserPatientsNature").selectpicker('val', '01');//默认选中
  8562. $('#editUserPatientsNature').selectpicker('refresh');
  8563. $("#editUserIdCard").val(null);
  8564. $("#editUserIdCard").attr("title", null);
  8565. $('#editUserProvinceCode').selectpicker('val', null);
  8566. $('#editUserProvinceCode').selectpicker('refresh');
  8567. $('#editCityCode').selectpicker('val', null);
  8568. $('#editCityCode').selectpicker('refresh');
  8569. $('#editUserDistrictCode').selectpicker('val', null);
  8570. $('#editUserDistrictCode').selectpicker('refresh');
  8571. $("#editUserDetail").val(null);
  8572. $("#editUserContact").val(null);
  8573. $("#editUserContactPhone").val(null);
  8574. var openSource = $("#openSource").val();
  8575. if (openSource == 2 || openSource == '2') {
  8576. $("#rapidAcceptsModal").modal();
  8577. } else if (openSource == 3 || openSource == '3') {
  8578. $("#visitingDetailModal").modal();
  8579. }
  8580. $("#openSource").val(null);
  8581. }
  8582. // /**
  8583. // * 保存入院证
  8584. // */
  8585. // function saveBeHospitalized() {
  8586. // $.ajax({
  8587. // type: "POST",
  8588. // url: '/thmz/saveMzZyReq',
  8589. // contentType: "application/json;charset=UTF-8",
  8590. // dataType: "json",
  8591. // data: JSON.stringify({
  8592. // "patientId": $("#patientId").text(),
  8593. // "icdCode": $("#icdCodeBeHospitalized").val(),
  8594. // "icdText": $("#icdTextBeHospitalized").val(),
  8595. // "reqDept": $("#inpatientWardBeHospitalized").val(),
  8596. // "smallDept": $("#smallWardBeHospitalized").val(),
  8597. // "admissStatus": $("#admissStatus").val()
  8598. // }),
  8599. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8600. // success: function (res) {
  8601. // if (res == '401' || res == 401) {
  8602. // window.location.href = '/thmz/login/view'
  8603. // return;
  8604. // }
  8605. // if (res.code == 0) {
  8606. // successMesage(res);
  8607. // $('#beHospitalizedModal').modal('hide');
  8608. // loadInClinicTableList();
  8609. // loadClinicTableList();
  8610. // clearWorkSpace();
  8611. // } else {
  8612. // errorMesage(res);
  8613. // }
  8614. // }
  8615. // });
  8616. // }
  8617. /**
  8618. * 获取按钮组选择的下标
  8619. * @param id
  8620. * @returns {number}
  8621. */
  8622. function getIndex(id) {
  8623. var index = 0;
  8624. var item = $("#" + id).find("button");
  8625. for (var i = 0; i <= item.length; i++) {
  8626. if ($(item[i]).hasClass("btn-primary")) {
  8627. index = i;
  8628. break;
  8629. }
  8630. }
  8631. return index;
  8632. }
  8633. /**
  8634. * 获取时间选择器的时间数组
  8635. * @returns {string[]}
  8636. */
  8637. function getRePortRangeArr() {
  8638. var rePortRange = $('#reportrange span').html();
  8639. var rePortRangeArr = rePortRange.split(" - ");
  8640. rePortRangeArr[0] = rePortRangeArr[0] + " 00:00:00"
  8641. rePortRangeArr[1] = rePortRangeArr[1] + " 23:59:59"
  8642. return rePortRangeArr;
  8643. }
  8644. /**
  8645. * 初始医生工作太配置
  8646. */
  8647. function initWorkspaceConfigForCurrent() {
  8648. $.ajax({
  8649. type: "GET",
  8650. url: '/thmz/getWorkspaceConfigForCurrent',
  8651. dataType: "json",
  8652. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8653. success: function (res) {
  8654. if (res == '401' || res == 401) {
  8655. window.location.href = '/thmz/login/view'
  8656. return;
  8657. }
  8658. if (res.code == 0) {
  8659. if (res.data.symptomFlag == 1) {
  8660. $("#symptomFlag").removeClass("in").addClass("hide");
  8661. if ($("#symptomFlagCheck").parent().hasClass("checked")) {
  8662. $("#symptomFlagCheck").parent().parent().click();//当前选中改为不选中
  8663. }
  8664. } else if (res.data.symptomFlag == 0) {
  8665. $("#symptomFlag").removeClass("hide").addClass("in");
  8666. if (!$("#symptomFlagCheck").parent().hasClass("checked")) {
  8667. $("#symptomFlagCheck").parent().parent().click();//当前不选中改为选中
  8668. }
  8669. }
  8670. if (res.data.emrHpiFlag == 1) {
  8671. $("#emrHpiFlag").removeClass("in").addClass("hide");
  8672. if ($("#emrHpiFlagCheck").parent().hasClass("checked")) {
  8673. $("#emrHpiFlagCheck").parent().parent().click();//当前选中改为不选中
  8674. }
  8675. } else if (res.data.emrHpiFlag == 0) {
  8676. $("#emrHpiFlag").removeClass("hide").addClass("in");
  8677. if (!$("#emrHpiFlagCheck").parent().hasClass("checked")) {
  8678. $("#emrHpiFlagCheck").parent().parent().click();//当前不选中改为选中
  8679. }
  8680. }
  8681. if (res.data.emrPsFlag == 1) {
  8682. $("#emrPsFlag").removeClass("in").addClass("hide");
  8683. if ($("#emrPsFlagCheck").parent().hasClass("checked")) {
  8684. $("#emrPsFlagCheck").parent().parent().click();//当前选中改为不选中
  8685. }
  8686. } else if (res.data.emrPsFlag == 0) {
  8687. $("#emrPsFlag").removeClass("hide").addClass("in");
  8688. if (!$("#emrPsFlagCheck").parent().hasClass("checked")) {
  8689. $("#emrPsFlagCheck").parent().parent().click();//当前不选中改为选中
  8690. }
  8691. }
  8692. if (res.data.personalHistoryFlag == 1) {
  8693. $("#personalHistoryFlag").removeClass("in").addClass("hide");
  8694. if ($("#personalHistoryFlagCheck").parent().hasClass("checked")) {
  8695. $("#personalHistoryFlagCheck").parent().parent().click();//当前选中改为不选中
  8696. }
  8697. } else if (res.data.personalHistoryFlag == 0) {
  8698. $("#personalHistoryFlag").removeClass("hide").addClass("in");
  8699. if (!$("#personalHistoryFlagCheck").parent().hasClass("checked")) {
  8700. $("#personalHistoryFlagCheck").parent().parent().click();//当前不选中改为选中
  8701. }
  8702. }
  8703. if (res.data.fzZlFlag == 1) {
  8704. $("#fzZlFlag").removeClass("in").addClass("hide");
  8705. if ($("#fzZlFlagCheck").parent().hasClass("checked")) {
  8706. $("#fzZlFlagCheck").parent().parent().click();//当前选中改为不选中
  8707. }
  8708. } else if (res.data.fzZlFlag == 0) {
  8709. $("#fzZlFlag").removeClass("hide").addClass("in");
  8710. if (!$("#fzZlFlagCheck").parent().hasClass("checked")) {
  8711. $("#fzZlFlagCheck").parent().parent().click();//当前不选中改为选中
  8712. }
  8713. }
  8714. if (res.data.familyHistoryFlag == 1) {
  8715. $("#familyHistoryFlag").removeClass("in").addClass("hide");
  8716. if ($("#familyHistoryFlagCheck").parent().hasClass("checked")) {
  8717. $("#familyHistoryFlagCheck").parent().parent().click();//当前选中改为不选中
  8718. }
  8719. } else if (res.data.familyHistoryFlag == 0) {
  8720. $("#familyHistoryFlag").removeClass("hide").addClass("in");
  8721. if (!$("#familyHistoryFlagCheck").parent().hasClass("checked")) {
  8722. $("#familyHistoryFlagCheck").parent().parent().click();//当前不选中改为选中
  8723. }
  8724. }
  8725. if (res.data.obstericalHistoryFlag == 1) {
  8726. $("#obstericalHistoryFlag").removeClass("in").addClass("hide");
  8727. if ($("#obstericalHistoryFlagCheck").parent().hasClass("checked")) {
  8728. $("#obstericalHistoryFlagCheck").parent().parent().click();//当前选中改为不选中
  8729. }
  8730. } else if (res.data.obstericalHistoryFlag == 0) {
  8731. $("#obstericalHistoryFlag").removeClass("hide").addClass("in");
  8732. if (!$("#obstericalHistoryFlagCheck").parent().hasClass("checked")) {
  8733. $("#obstericalHistoryFlagCheck").parent().parent().click();//当前不选中改为选中
  8734. }
  8735. }
  8736. if (res.data.pressureLeftFlag == 1) {
  8737. $("#pressureLeftFlag").removeClass("in").addClass("hide");
  8738. if ($("#pressureLeftFlagCheck").parent().hasClass("checked")) {
  8739. $("#pressureLeftFlagCheck").parent().parent().click();//当前选中改为不选中
  8740. }
  8741. } else if (res.data.pressureLeftFlag == 0) {
  8742. $("#pressureLeftFlag").removeClass("hide").addClass("in");
  8743. if (!$("#pressureLeftFlagCheck").parent().hasClass("checked")) {
  8744. $("#pressureLeftFlagCheck").parent().parent().click();//当前不选中改为选中
  8745. }
  8746. }
  8747. if (res.data.tentativeDiagnosisFlag == 1) {
  8748. $("#tentativeDiagnosisFlag").removeClass("in").addClass("hide");
  8749. if ($("#tentativeDiagnosisFlagCheck").parent().hasClass("checked")) {
  8750. $("#tentativeDiagnosisFlagCheck").parent().parent().click();//当前选中改为不选中
  8751. }
  8752. } else if (res.data.tentativeDiagnosisFlag == 0) {
  8753. $("#tentativeDiagnosisFlag").removeClass("hide").addClass("in");
  8754. if (!$("#tentativeDiagnosisFlagCheck").parent().hasClass("checked")) {
  8755. $("#tentativeDiagnosisFlagCheck").parent().parent().click();//当前不选中改为选中
  8756. }
  8757. }
  8758. if (res.data.checkboxFlag == 1) {
  8759. if ($("#checkboxFlagCheck").parent().hasClass("checked")) {
  8760. $("#checkboxFlagCheck").parent().parent().click();//当前选中改为不选中
  8761. }
  8762. } else if (res.data.checkboxFlag == 0) {
  8763. if (!$("#checkboxFlagCheck").parent().hasClass("checked")) {
  8764. $("#checkboxFlagCheck").parent().parent().click();//当前不选中改为选中
  8765. }
  8766. }
  8767. if (res.data.zlPrintFlag == 1) {
  8768. if ($("#zlPrintFlagCheck").parent().hasClass("checked")) {
  8769. $("#zlPrintFlagCheck").parent().parent().click();//当前选中改为不选中
  8770. }
  8771. } else if (res.data.zlPrintFlag == 0) {
  8772. if (!$("#zlPrintFlagCheck").parent().hasClass("checked")) {
  8773. $("#zlPrintFlagCheck").parent().parent().click();//当前不选中改为选中
  8774. }
  8775. }
  8776. //设置是否默认勾选处方回调
  8777. localStorage.setItem("checkboxFlag", res.data.checkboxFlag);
  8778. } else {
  8779. errorMesage(res);
  8780. }
  8781. }
  8782. });
  8783. }
  8784. /**
  8785. * 保存医生工作台配置
  8786. */
  8787. function saveWorkspaceConfig() {
  8788. var symptomFlag = $("#symptomFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  8789. var emrHpiFlag = $("#emrHpiFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  8790. var emrPsFlag = $("#emrPsFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  8791. var personalHistoryFlag = $("#personalHistoryFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  8792. var familyHistoryFlag = $("#familyHistoryFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  8793. var fzZlFlag = $("#fzZlFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  8794. var obstericalHistoryFlag = $("#obstericalHistoryFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  8795. var pressureLeftFlag = $("#pressureLeftFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  8796. var tentativeDiagnosisFlag = $("#tentativeDiagnosisFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  8797. var checkboxFlag = $("#checkboxFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  8798. var zlPrintFlag = $("#zlPrintFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  8799. $.ajax({
  8800. type: "POST",
  8801. url: '/thmz/saveWorkspaceConfig',
  8802. contentType: "application/json;charset=UTF-8",
  8803. dataType: "json",
  8804. data: JSON.stringify({
  8805. "symptomFlag": symptomFlag,
  8806. "emrHpiFlag": emrHpiFlag,
  8807. "emrPsFlag": emrPsFlag,
  8808. "personalHistoryFlag": personalHistoryFlag,
  8809. "familyHistoryFlag": familyHistoryFlag,
  8810. "fzZlFlag": fzZlFlag,
  8811. "obstericalHistoryFlag": obstericalHistoryFlag,
  8812. "pressureLeftFlag": pressureLeftFlag,
  8813. "tentativeDiagnosisFlag": tentativeDiagnosisFlag,
  8814. "checkboxFlag": checkboxFlag,
  8815. "zlPrintFlag": zlPrintFlag
  8816. }),
  8817. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8818. success: function (res) {
  8819. if (res == '401' || res == 401) {
  8820. window.location.href = '/thmz/login/view'
  8821. return;
  8822. }
  8823. if (res.code == 0) {
  8824. successMesage(res);
  8825. initWorkspaceConfigForCurrent();
  8826. $("#configWorkspaceModal").modal("hide");
  8827. } else {
  8828. errorMesage(res);
  8829. }
  8830. }
  8831. });
  8832. }
  8833. /**
  8834. * 初始化药品,检查检验菜单树
  8835. */
  8836. function initzTree() {
  8837. var index = getIndex("bill_item_group");
  8838. if (index == 0) {
  8839. $("#western_medicine_name").webuiPopover('hide');
  8840. $.ajax({
  8841. type: "GET",
  8842. url: '/thmz/getYpZdClasses',
  8843. contentType: "application/json;charset=UTF-8",
  8844. dataType: "json",
  8845. async: false,
  8846. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8847. success: function (res) {
  8848. if (res == '401' || res == 401) {
  8849. window.location.href = '/thmz/login/view'
  8850. return;
  8851. }
  8852. if (res.code == 0) {
  8853. // zTree 的参数配置,深入使用请参考 API 文档(setting 配置详解)
  8854. var setting = {
  8855. callback: {
  8856. onClick: zTreeOnClick
  8857. }
  8858. };
  8859. $.fn.zTree.init($("#treeDemo"), setting, res.data);
  8860. var webuiId = $("#treeButton").attr("data-target");
  8861. var top = $("#" + webuiId).css("top");
  8862. if (top.indexOf("-") == 0) {
  8863. $("#" + webuiId).css("top", '0px');
  8864. }
  8865. } else {
  8866. errorMesage(res);
  8867. }
  8868. }
  8869. });
  8870. } else if (index == 2) {
  8871. $("#jcJyItem").webuiPopover('hide');
  8872. $.ajax({
  8873. type: "GET",
  8874. url: '/thmz/getJyJcZdClasses',
  8875. contentType: "application/json;charset=UTF-8",
  8876. dataType: "json",
  8877. async: false,
  8878. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8879. success: function (res) {
  8880. if (res == '401' || res == 401) {
  8881. window.location.href = '/thmz/login/view'
  8882. return;
  8883. }
  8884. if (res.code == 0) {
  8885. // zTree 的参数配置,深入使用请参考 API 文档(setting 配置详解)
  8886. var setting = {
  8887. callback: {
  8888. onClick: zTreeOnClick
  8889. }
  8890. };
  8891. $.fn.zTree.init($("#treeDemo"), setting, res.data);
  8892. var webuiId = $("#treeButton").attr("data-target");
  8893. var top = $("#" + webuiId).css("top");
  8894. if (top.indexOf("-") == 0) {
  8895. $("#" + webuiId).css("top", '0px');
  8896. }
  8897. } else {
  8898. errorMesage(res);
  8899. }
  8900. }
  8901. });
  8902. } else if (index == 1) {
  8903. $("#treeButton").webuiPopover('hide');
  8904. warningMesageSimaple("中药暂无帮助字典");
  8905. } else if (index == 3) {
  8906. $("#treeButton").webuiPopover('hide');
  8907. warningMesageSimaple("诊疗暂无帮助字典");
  8908. } else {
  8909. $("#treeButton").webuiPopover('hide');
  8910. warningMesageSimaple("入院暂无帮助字典");
  8911. }
  8912. }
  8913. /**
  8914. * 节点点击事件
  8915. * @param event
  8916. * @param treeId
  8917. * @param treeNode
  8918. */
  8919. function zTreeOnClick(event, treeId, treeNode) {
  8920. var index = getIndex("bill_item_group");
  8921. if (index == 0) {
  8922. $("#western_medicine_name").val(treeNode.id);
  8923. $('#western_medicine_name').webuiPopover('show');
  8924. loadYpList(0, null);
  8925. } else if (index == 2) {
  8926. $("#jcJyItem").val(treeNode.id);
  8927. $('#jcJyItem').webuiPopover('show');
  8928. loadjcJyItemList(null);
  8929. }
  8930. }
  8931. /**
  8932. * 构建处方参数
  8933. * @param type 1 保存处方 2 保存模板 3 计算金额
  8934. * @returns {any}
  8935. */
  8936. function getParamsForpPrescription(type) {
  8937. var codes = $("#diagnoseValue").val();
  8938. var icdCode = null;
  8939. if (codes != null && codes.length > 0) {
  8940. var arr = codes.split(",");
  8941. if (arr != null) {
  8942. for (i = 0; i < arr.length; i++) {
  8943. if (arr[i] != "") {
  8944. if (icdCode == null) {
  8945. icdCode = arr[i];
  8946. } else {
  8947. icdCode += "," + arr[i];
  8948. }
  8949. }
  8950. }
  8951. }
  8952. }
  8953. var jsonData = JSON.parse('' +
  8954. '{"patientId": "",' +
  8955. '"visitDeptCode":"",' +
  8956. '"firstOrNot":"",' +
  8957. '"icdCode": "",' +
  8958. '"icdText": null,' +
  8959. '"jzFlag": "0",' +
  8960. '"serialNo":"",' +
  8961. '"mzBlRecord": ' +
  8962. '{"firstOrNot": "",' +
  8963. '"emrChiefComplaint": "",' +
  8964. '"emrHpi": "",' +
  8965. '"emrPs": "",' +
  8966. '"emrPe": "",' +
  8967. '"emrFzjc": null,' +
  8968. '"emrProcess": null,' +
  8969. '"emrXyy": "无",' +
  8970. '"emrYypg": "无",' +
  8971. '"emrGnpg": "无",' +
  8972. '"emrJkjy": "",' +
  8973. '"personalHistory": "",' +
  8974. '"familyHistory": "",' +
  8975. '"fzZl": "",' +
  8976. '"obstericalHistory": "",' +
  8977. '"weight": "",' +
  8978. '"temperature": "",' +
  8979. '"sphygmus": "",' +
  8980. '"breathe": "",' +
  8981. '"pressureHigh": "",' +
  8982. '"pressureFloor": "",' +
  8983. '"pressureHighLeft": "",' +
  8984. '"pressureFloorLeft": "",' +
  8985. '"tentativeDiagnosis":"",' +
  8986. '"prescriptionDetail":""},' +
  8987. '"mzChargeDetailList": [],' +
  8988. '"mzYjReqList": [],' +
  8989. '"mzZyReq": {"reqDept": "","smallDept": "","admissStatus": "","conditionCode": "","routeOfAdmission": ""},' +
  8990. '"opRecordList": [],' +
  8991. '"patientAllergenInfoList": [],' +
  8992. '"zgmztczf":"",' +
  8993. '"opspDisecode":"",' +
  8994. '"opspDiseName":"",' +
  8995. '"reqType":"",' +
  8996. '"orderType":"",' +
  8997. '"grzhzf":"",' +
  8998. '"readCardResult":"",' +
  8999. '"readCardType":"01"}');
  9000. jsonData.patientId = $("#patientId").text();
  9001. var userIdCode = localStorage.getItem("userIdCode");
  9002. var visitDeptCode = localStorage.getItem(userIdCode);
  9003. if (visitDeptCode == null) {
  9004. visitDeptCode = "";
  9005. }
  9006. jsonData.visitDeptCode = visitDeptCode;
  9007. jsonData.firstOrNot = $("input[name='firstOrNot']:checked").val();
  9008. jsonData.icdCode = icdCode;
  9009. jsonData.serialNo = $("#mzfzSerialNoInClick").val();
  9010. if (type == 1) {
  9011. jsonData.turnToConsultationId = $("#turnToConsultationIdInClick").val();
  9012. var mdtrtGrpType = $("#mdtrtGrpType").val();
  9013. var trumFlag = $("#trumFlag").val();
  9014. var relTtpFlag = $("#relTtpFlag").val();
  9015. if (trumFlag == "1" && relTtpFlag == "") {
  9016. errorMesageSimaple("请注意【外伤标志】为【是】,【涉及第三方标志】不能为空!");
  9017. $("#messageButton").attr("disabled", false);
  9018. $("#messageModal").modal("hide");
  9019. throw new Error("请注意【外伤标志】为【是】,【涉及第三方标志】不能为空!");
  9020. }
  9021. var otpErReflFlag = $("#otpErReflFlag").val();
  9022. var expContent = JSON.parse("{}");
  9023. if (mdtrtGrpType != "" && mdtrtGrpType != "-1") {
  9024. expContent.MDTRT_GRP_TYPE = mdtrtGrpType;
  9025. }
  9026. if (trumFlag != "") {
  9027. expContent.TRUM_FLAG = trumFlag;
  9028. }
  9029. if (relTtpFlag != "") {
  9030. expContent.REL_TTP_FLAG = relTtpFlag;
  9031. }
  9032. if (otpErReflFlag != "" && otpErReflFlag != "-1") {
  9033. expContent.OTP_ER_REFL_FLAG = otpErReflFlag;
  9034. }
  9035. jsonData.expContent = JSON.stringify(expContent);
  9036. }
  9037. jsonData.mzBlRecord.firstOrNot = jsonData.firstOrNot;
  9038. jsonData.mzBlRecord.emrChiefComplaint = $("#symptom").val();
  9039. jsonData.mzBlRecord.emrHpi = $("#emrHpi").val();
  9040. jsonData.mzBlRecord.emrPs = $("#emrPs").val();
  9041. jsonData.mzBlRecord.emrPe = $("#otherCheck").val();
  9042. jsonData.mzBlRecord.emrJkjy = $("#healthEducation").val();
  9043. jsonData.mzBlRecord.personalHistory = $("#personalHistory").val();
  9044. jsonData.mzBlRecord.familyHistory = $("#familyHistory").val();
  9045. jsonData.mzBlRecord.fzZl = $("#fzZl").val();
  9046. jsonData.mzBlRecord.obstericalHistory = $("#obstericalHistory").val();
  9047. jsonData.mzBlRecord.weight = $("#weight").val();
  9048. jsonData.mzBlRecord.temperature = $("#temperature").val();
  9049. jsonData.mzBlRecord.sphygmus = $("#sphygmus").val();
  9050. jsonData.mzBlRecord.breathe = $("#breathe").val();
  9051. jsonData.mzBlRecord.pressureHigh = $("#pressure_high").val();
  9052. jsonData.mzBlRecord.pressureFloor = $("#pressure_floor").val();
  9053. jsonData.mzBlRecord.pressureHighLeft = $("#pressure_high_left").val();
  9054. jsonData.mzBlRecord.pressureFloorLeft = $("#pressure_floor_left").val();
  9055. jsonData.mzBlRecord.tentativeDiagnosis = $("#tentativeDiagnosis").val();
  9056. //职工统筹部分参数
  9057. jsonData.zgmztczf = $("#zgmztczf").val();
  9058. jsonData.grzhzf = $("#grzhzf").val();
  9059. jsonData.readCardResult = $("#readCardResult").val();
  9060. jsonData.reqType = $("#mzReqType").val();
  9061. jsonData.orderType = $("#mzOrderTypeSelect").val();
  9062. jsonData.opspDisecode = curOpspDiseCode;
  9063. jsonData.opspDiseName = curOpspDiseName;
  9064. //设置过敏源
  9065. var zdAllergen = $("#zdAllergen").val();
  9066. var ypDitList = $("#ypDitList").val();
  9067. if (zdAllergen != null && zdAllergen.length > 0) {
  9068. for (var i = 0; i < zdAllergen.length; i++) {
  9069. var tempJson = JSON.parse('{}');
  9070. tempJson.allergenCode = zdAllergen[i];
  9071. tempJson.type = 0;
  9072. jsonData.patientAllergenInfoList[jsonData.patientAllergenInfoList.length] = tempJson;
  9073. }
  9074. }
  9075. if (ypDitList != null && ypDitList.length > 0) {
  9076. for (var i = 0; i < ypDitList.length; i++) {
  9077. var tempJson = JSON.parse('{}');
  9078. tempJson.allergenCode = ypDitList[i];
  9079. tempJson.type = 1;
  9080. jsonData.patientAllergenInfoList[jsonData.patientAllergenInfoList.length] = tempJson;
  9081. }
  9082. }
  9083. //设置处方详情
  9084. var emrFzjc = null;
  9085. var xyTabContents = $("#xyTabContent").find("div.tab-pane");
  9086. //处方号
  9087. var orderNo = 0;
  9088. var arrs = $("span.cf_amount");
  9089. //西药设置
  9090. if (xyTabContents != null && xyTabContents.length > 0) {
  9091. for (var i = 0; i < xyTabContents.length; i++) {
  9092. //当前药品类型
  9093. var currentGroupNo = $(xyTabContents[i]).find("input.current_groupNo").val();
  9094. var formGroups = $(xyTabContents[i]).find("div.form-group");
  9095. if (formGroups != null && formGroups.length > 0) {
  9096. for (var j = 0; j < formGroups.length; j++) {
  9097. var tempJson = JSON.parse('{"chargeItemCode": "","serial": "","quantity": "","drugQuan": "","drugUnit": "","frequency": "","orderDays": "","paySelf": "0","drugWin": "1","instructionCode":"",' +
  9098. '"instructionText":"","orderNo":"","groupOrder":"","supplyCode":"","tryFlag":"","tryResult":"","groupNo":"","cyJssm":"","cyDj":"","cyFysm":"","cyJsl":"","cyZql":"","cyFj":"","cyFfcs":"","cyMtjs":""}');
  9099. tempJson.chargeItemCode = $(formGroups[j]).find("input.temporary_items_code").val();
  9100. tempJson.serial = $(formGroups[j]).find("input.temporary_items_serial").val();
  9101. tempJson.quantity = $(formGroups[j]).find("input.temporary_items_gross").val();
  9102. tempJson.drugQuan = $(formGroups[j]).find("input.temporary_items_drugWin").val();
  9103. tempJson.drugUnit = $(formGroups[j]).find("input.temporary_items_drugWinUnit").val();
  9104. tempJson.frequency = $(formGroups[j]).find("input.temporary_items_orderFrequency").val();
  9105. tempJson.orderDays = $(formGroups[j]).find("input.temporary_items_dayNum").val();
  9106. tempJson.instructionCode = $(formGroups[j]).find("input.temporary_items_medicalAdvice").val();
  9107. tempJson.instructionText = $(formGroups[j]).find("input.temporary_items_medicalAdviceText").val();
  9108. tempJson.supplyCode = $(formGroups[j]).find("input.temporary_items_supplyType").val();
  9109. tempJson.hospApprFlag = $(formGroups[j]).find("input.temporary_items_xyHospApprFlag").val();
  9110. orderNo = i + 1;
  9111. tempJson.orderNo = orderNo;
  9112. tempJson.groupOrder = $(formGroups[j]).find("input.temporary_items_groupId").val();
  9113. tempJson.groupNo = currentGroupNo;
  9114. var tryResult = $(formGroups[j]).find("input.temporary_items_tryResult").val();
  9115. if (tryResult != undefined || tryResult != null || tryResult != "") {
  9116. if (tryResult == 100 || tryResult == "100") {
  9117. tempJson.tryFlag = 1;
  9118. } else {
  9119. tempJson.tryResult = tryResult;
  9120. }
  9121. }
  9122. jsonData.mzChargeDetailList[jsonData.mzChargeDetailList.length] = tempJson;
  9123. }
  9124. }
  9125. }
  9126. }
  9127. //中草药
  9128. var zyTabContents = $("#zyTabContent").find("div.form-group");
  9129. if (zyTabContents != null && zyTabContents.length > 0) {
  9130. orderNo++;
  9131. var zyfs = $("#zyfs").val();
  9132. if (zyfs == null || zyfs == "") {
  9133. if (type == 3) {
  9134. zyfs = 1;
  9135. } else {
  9136. errorMesageSimaple("中药付数为空,请设置!");
  9137. $("#messageButton").attr("disabled", false);
  9138. throw new Error('中药付数为空,请设置!');
  9139. }
  9140. }
  9141. //中药的类型
  9142. var currentZyClassType = $("#current_zyClassType").val();
  9143. for (var i = 0; i < zyTabContents.length; i++) {
  9144. var tempJson = JSON.parse('{"chargeItemCode": "","serial": "","quantity": "","drugQuan": "","drugUnit": "g","frequency": "","orderDays": "1","paySelf": "0","drugWin": "","instructionCode":"",' +
  9145. '"instructionText":"","orderNo":"1","groupOrder":"1","supplyCode":"","tryFlag":"0","tryResult":"0","groupNo":"","cyJssm":"","cyDj":"","cyFysm":"","cyJsl":"","cyZql":"","cyFj":"","cyFfcs":"","cyMtjs":""}');
  9146. tempJson.chargeItemCode = $(zyTabContents[i]).find("input.temporary_items_code").val();
  9147. tempJson.serial = $(zyTabContents[i]).find("input.temporary_items_serial").val();
  9148. tempJson.quantity = $(zyTabContents[i]).find("input.temporary_items_drugWin").val();
  9149. tempJson.drugQuan = $(zyTabContents[i]).find("input.temporary_items_drugWin").val();
  9150. tempJson.drugWin = zyfs;
  9151. tempJson.drugUnit=$(zyTabContents[i]).find("input.temporary_items_drugUnit").val();
  9152. //tempJson.frequency = $("#zy_orderFrequency_1").val();
  9153. tempJson.instructionCode = $(zyTabContents[i]).find("input.temporary_items_zyInstruction").val();
  9154. tempJson.instructionText = $(zyTabContents[i]).find("input.temporary_items_zyInstructionText").val();
  9155. tempJson.hospApprFlag = $(zyTabContents[i]).find("input.temporary_items_zyHospApprFlag").val();
  9156. tempJson.cyFysm = $("#useType_1").val();
  9157. tempJson.cyJssm = $("#cyJssm").val();
  9158. tempJson.cyJsl = $("#cyJsl").val();
  9159. if(currentZyClassType !='83'){
  9160. tempJson.cyZql = $("#cyZql").val();
  9161. tempJson.cyFj = $("#cyFj").val();
  9162. tempJson.cyDj = $("#zy_supplyType_1").val();
  9163. }
  9164. tempJson.cyFfcs = $("#cyFfcs").val();
  9165. tempJson.cyMtjs = $("#cyMtjs").val();
  9166. tempJson.orderNo = orderNo;
  9167. tempJson.groupNo = currentZyClassType;
  9168. jsonData.mzChargeDetailList[jsonData.mzChargeDetailList.length] = tempJson;
  9169. }
  9170. }
  9171. //辅助检查、检验
  9172. var jcjyTabContents = $("#jcjyTabContent").find("div.form-group");
  9173. if (jcjyTabContents != null && jcjyTabContents.length > 0) {
  9174. orderNo++;
  9175. for (var i = 0; i < jcjyTabContents.length; i++) {
  9176. if (emrFzjc == null) {
  9177. emrFzjc = $(jcjyTabContents[i]).text();
  9178. } else {
  9179. emrFzjc += "," + $(jcjyTabContents[i]).text();
  9180. }
  9181. var tempJson = null;
  9182. //项目类型
  9183. var itemsType = $(jcjyTabContents[i]).find("input.temporary_items_type").val();
  9184. //执行科室
  9185. var execUnit = $(jcjyTabContents[i]).find("input.temporary_items_execUnit").val();
  9186. tempJson = JSON.parse('{"orderCode":"","inspectPart":"","inspectStuff":"","jyRemark":"","orderNo":"1","execDept":"","quantity":""}');
  9187. tempJson.orderCode = $(jcjyTabContents[i]).find("input.temporary_items_code").val();
  9188. if (itemsType == "1" || itemsType == 1) {
  9189. //检验
  9190. tempJson.inspectStuff = $(jcjyTabContents[i]).find("input.temporary_items_desc_value").val();
  9191. tempJson.quantity = $(jcjyTabContents[i]).find("input.temporary_items_jyQuantity").val();
  9192. } else if (itemsType == "2" || itemsType == 2) {
  9193. //检查
  9194. tempJson.inspectPart = $(jcjyTabContents[i]).find("input.temporary_items_desc_value").val();
  9195. }
  9196. tempJson.jyRemark = $(jcjyTabContents[i]).find("input.temporary_items_remark").val();
  9197. tempJson.orderNo = orderNo;
  9198. tempJson.execDept = execUnit;
  9199. jsonData.mzYjReqList[jsonData.mzYjReqList.length] = tempJson;
  9200. }
  9201. }
  9202. //诊疗
  9203. var zlTabContents = $("#zlTabContent").find("div.form-group");
  9204. if (zlTabContents != null && zlTabContents.length > 0) {
  9205. orderNo++;
  9206. for (var i = 0; i < zlTabContents.length; i++) {
  9207. var tempJson = null;
  9208. //执行科室
  9209. var execUnit = $(zlTabContents[i]).find("input.temporary_items_execUnit").val();
  9210. //诊疗,放入药品类型中入库,因为诊疗是与药品一样直接入明细库,但是是与医技在同一处方开立页面开立
  9211. tempJson = JSON.parse('{"unitPrice": "0","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":""}');
  9212. tempJson.chargeItemCode = $(zlTabContents[i]).find("input.temporary_items_code").val();
  9213. tempJson.instructionText = $(zlTabContents[i]).find("input.temporary_items_remark").val();
  9214. tempJson.quantity = $(zlTabContents[i]).find("input.temporary_items_totalNumZl").val();
  9215. tempJson.drugQuan = $(zlTabContents[i]).find("input.temporary_items_itemQuantity").val();
  9216. tempJson.zlUnitPrice = $(zlTabContents[i]).find("input.temporary_items_amount").val();
  9217. //因为收费表里的单位长度限制,无法存入库
  9218. //tempJson.drugUnit = $(zlTabContents[i]).find("input.temporary_items_desc_value").val();
  9219. tempJson.frequency = $(zlTabContents[i]).find("input.temporary_items_orderFrequencyZl").val();
  9220. tempJson.hospApprFlag = $(zlTabContents[i]).find("input.temporary_items_zlHospApprFlag").val();
  9221. tempJson.orderDays = $(zlTabContents[i]).find("input.temporary_items_dayZlNum").val();
  9222. tempJson.orderNo = orderNo;
  9223. tempJson.execDept = execUnit;
  9224. jsonData.mzChargeDetailList[jsonData.mzChargeDetailList.length] = tempJson;
  9225. }
  9226. }
  9227. //入院
  9228. var zyReqTabContents = $("#zyReqTabContent").find("div.form-group");
  9229. if (zyReqTabContents != null && zyReqTabContents.length > 0) {
  9230. jsonData.mzZyReq.reqDept = $(zyReqTabContents[0]).find("input.temporary_inpatient_ward").val();
  9231. jsonData.mzZyReq.smallDept = $(zyReqTabContents[0]).find("input.temporary_items_small_ward").val();
  9232. jsonData.mzZyReq.admissStatus = $(zyReqTabContents[0]).find("input.temporary_items_admiss_status").val();
  9233. jsonData.mzZyReq.conditionCode = $(zyReqTabContents[0]).find("input.temporary_items_condition_code").val();
  9234. jsonData.mzZyReq.routeOfAdmission = $(zyReqTabContents[0]).find("input.temporary_items_route_of_admission").val();
  9235. }
  9236. //门诊手术
  9237. var opRecordTabContents = $("#opRecordTabContent").find("div.form-group");
  9238. if (opRecordTabContents != null && opRecordTabContents.length > 0) {
  9239. for (var i = 0; i < opRecordTabContents.length; i++) {
  9240. var tempJson = null;
  9241. var execUnit = $(opRecordTabContents[i]).find("input.temporary_items_execUnit").val();
  9242. tempJson = JSON.parse('{"opCode": "","opName": "","opDatetimeStr": "","urgentClinicFlag": "","ssbc": "","partCode": "","opScale": "","hocusCode": "","doctorZd": "","remark":""}');
  9243. tempJson.opCode = $(opRecordTabContents[i]).find("input.temporary_items_code").val();
  9244. tempJson.opName = $(opRecordTabContents[i]).find("input.temporary_items_op_name").val();
  9245. tempJson.opDatetimeStr = $(opRecordTabContents[i]).find("input.temporary_items_op_time").val();
  9246. tempJson.urgentClinicFlag = $(opRecordTabContents[i]).find("input.temporary_items_urgent_clinic_flag").val();
  9247. tempJson.ssbc = $(opRecordTabContents[i]).find("input.temporary_items_ssbc").val();
  9248. tempJson.partCode = $(opRecordTabContents[i]).find("input.temporary_items_part_code").val();
  9249. tempJson.opScale = $(opRecordTabContents[i]).find("input.temporary_items_op_scale").val();
  9250. tempJson.hocusCode = $(opRecordTabContents[i]).find("input.temporary_items_hocus_code").val();
  9251. tempJson.doctorZd = $(opRecordTabContents[i]).find("input.temporary_items_doctor_zd").val();
  9252. tempJson.remark = $(opRecordTabContents[i]).find("input.temporary_items_op_record_remark").val();
  9253. jsonData.opRecordList[jsonData.opRecordList.length] = tempJson;
  9254. }
  9255. }
  9256. //设置诊断名称
  9257. var icdText = null;
  9258. var tagsTexts = $("span.el-select__tags-text");
  9259. if (tagsTexts != null && tagsTexts.length > 0) {
  9260. for (var i = 0; i < tagsTexts.length; i++) {
  9261. if (icdText == null) {
  9262. icdText = $(tagsTexts[i]).text();
  9263. } else {
  9264. icdText += "," + $(tagsTexts[i]).text();
  9265. }
  9266. }
  9267. }
  9268. jsonData.icdText = icdText;
  9269. jsonData.mzBlRecord.emrFzjc = emrFzjc;
  9270. return jsonData;
  9271. }
  9272. /**
  9273. * 保存处方
  9274. */
  9275. function savePrescription() {
  9276. var jsonData = getParamsForpPrescription(1);
  9277. $.ajax({
  9278. type: "POST",
  9279. url: '/thmz/rationalUseOfMedicine',
  9280. contentType: "application/json;charset=UTF-8",
  9281. dataType: "json",
  9282. data: JSON.stringify(jsonData),
  9283. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9284. success: function (res) {
  9285. if (res == '401' || res == 401) {
  9286. window.location.href = '/thmz/login/view'
  9287. return;
  9288. }
  9289. $("#messageButton").attr("disabled", false);
  9290. if (res.code == 0) {
  9291. var rationalUseMap = res.data;
  9292. var result_lv = rationalUseMap.result_lv;
  9293. if (result_lv == 0 || result_lv == "0") {
  9294. savePrescriptionForReadCard();
  9295. } else {
  9296. var showUrl = rationalUseMap.ShowUrl;
  9297. getResultUrl = rationalUseMap.getResultUrl;
  9298. showHlyyModel('hlyyDiv', 'loading', 'hlyyModal', showUrl);
  9299. }
  9300. } else {
  9301. savePrescriptionForReadCard();
  9302. }
  9303. }
  9304. });
  9305. }
  9306. /**
  9307. * 合理用药结果查询
  9308. */
  9309. function getResult() {
  9310. $.ajax({
  9311. type: "POST",
  9312. url: '/thmz/auditingInterface',
  9313. contentType: "application/json;charset=UTF-8",
  9314. dataType: "json",
  9315. data: JSON.stringify({"getResultUrl": getResultUrl}),
  9316. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9317. success: function (res) {
  9318. if (res == '401' || res == 401) {
  9319. window.location.href = '/thmz/login/view'
  9320. return;
  9321. }
  9322. $("#messageButton").attr("disabled", false);
  9323. $("#hlyyModal").modal("hide");
  9324. if (res.code == 0) {
  9325. var rationalUseMap = res.data;
  9326. if (rationalUseMap.length == 0) {
  9327. savePrescriptionForReadCard();
  9328. } else {
  9329. var resultcode = rationalUseMap.resultcode;
  9330. var success = rationalUseMap.success;
  9331. var sh_msg = rationalUseMap.sh_msg;
  9332. if (resultcode == -1) {
  9333. //为处方不存在分析结果 直接忽略
  9334. savePrescriptionForReadCard();
  9335. } else if (resultcode == 0) {
  9336. //2.success:药师审核完成标志,false未审核,true已审核/无需审核
  9337. if (success == true || success == "true") {
  9338. savePrescriptionForReadCard();
  9339. } else {
  9340. //提示消息
  9341. $("#messageModal").modal();
  9342. $("#messageContent").html("药师未审核,请点击右上方【继续保存】提交审核!");
  9343. $("#messageButton").off("click").bind("click", function (t) {
  9344. $("#messageModal").modal("hide");
  9345. $("#hlyyModal").modal();
  9346. });
  9347. $("#cancelButton").off("click").bind("click", function (t) {
  9348. $("#hlyyModal").modal();
  9349. });
  9350. ;
  9351. }
  9352. } else if (resultcode == 1) {
  9353. //提示消息
  9354. $("#messageModal").modal();
  9355. $("#messageContent").html(sh_msg);
  9356. $("#messageButton").off("click").bind("click", function (t) {
  9357. $("#messageModal").modal("hide");
  9358. });
  9359. $("#cancelButton").off("click");
  9360. }
  9361. }
  9362. } else {
  9363. savePrescriptionForReadCard();
  9364. }
  9365. }
  9366. });
  9367. }
  9368. /**
  9369. * 合理用药结果弹窗
  9370. * @param hlyyDiv
  9371. * @param loading
  9372. * @param hlyyModal
  9373. * @param showUrl
  9374. */
  9375. function showHlyyModel(hlyyDiv, loading, hlyyModal, showUrl) {
  9376. const iframeEle = document.getElementById(hlyyDiv);
  9377. const loadingEle = document.getElementById(loading);
  9378. //设置ififrame透明
  9379. iframeEle.style.opacity = 0;
  9380. loadingEle.style.display = 'block';
  9381. $("#" + hlyyDiv).attr("src", showUrl);
  9382. iframeEle.addEventListener('load', function () {
  9383. // Hide the loading indicator
  9384. loadingEle.style.display = 'none';
  9385. // Bring the iframe back
  9386. iframeEle.style.opacity = 1;
  9387. });
  9388. setTimeout(function () {
  9389. // iframe 重复加载不会触发上述事件
  9390. loadingEle.style.display = 'none';
  9391. iframeEle.style.opacity = 1;
  9392. }, 1000);
  9393. $("#" + hlyyModal).modal();
  9394. }
  9395. /**
  9396. * 点击保存处方时提示是否读卡
  9397. */
  9398. function savePrescriptionForReadCard() {
  9399. if (!verifyInsuranceInfo()) {
  9400. return;
  9401. }
  9402. //关闭帮助框
  9403. $("#treeButton").webuiPopover('hide');
  9404. $("#western_medicine_name").webuiPopover('hide');
  9405. $("#chinese_medicine_name").webuiPopover('hide');
  9406. $("#jcJyItem").webuiPopover('hide');
  9407. $("#zlItem").webuiPopover('hide');
  9408. realSavePrescription();
  9409. }
  9410. /**
  9411. * 最终保存处方方法
  9412. */
  9413. function realSavePrescription() {
  9414. $("#messageModalYb").modal('hide');
  9415. $("#messageModal").modal();
  9416. $("#messageContent").html("确认保存处方吗?");
  9417. $("#messageButton").off("click").bind("click", function (t) {
  9418. $("#messageButton").attr("disabled", true);
  9419. var jsonData = getParamsForpPrescription(1);
  9420. $.ajax({
  9421. type: "POST",
  9422. url: '/thmz/savePrescription',
  9423. contentType: "application/json;charset=UTF-8",
  9424. dataType: "json",
  9425. data: JSON.stringify(jsonData),
  9426. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9427. success: function (res) {
  9428. if (res == '401' || res == 401) {
  9429. window.location.href = '/thmz/login/view'
  9430. return;
  9431. }
  9432. $("#messageButton").attr("disabled", false);
  9433. if (res.code == 0) {
  9434. successMesage(res);
  9435. clearWorkSpace();
  9436. loadInClinicTableList();
  9437. loadClinicTableList();
  9438. //$("#messageModal").modal();
  9439. $("#messageContent").html("门诊处方保存成功,是否打印处方和门诊指引单?");
  9440. $("#messageButton").off("click").on("click", function (t) {
  9441. $("#messageModal").modal("hide");
  9442. printPrescription(res.data.patientId, res.data.times, res.data.id, 5, 1);
  9443. });
  9444. $("#cancelButton").off("click");
  9445. } else {
  9446. $("#messageModal").modal("hide");
  9447. errorMesage(res);
  9448. }
  9449. }
  9450. });
  9451. });
  9452. $("#cancelButton").off("click");
  9453. }
  9454. /**
  9455. * 保存医疗范文
  9456. */
  9457. function saveapidAccepts() {
  9458. var templateName = $("#templateName").val();
  9459. if (templateName == null || templateName == "") {
  9460. errorMesageSimaple("范文名称不能为空!");
  9461. return;
  9462. }
  9463. var templateKindType = $("#templateKindType").val();
  9464. if (templateKindType == null || templateKindType == "") {
  9465. errorMesageSimaple("范文类型不能为空!");
  9466. return;
  9467. }
  9468. var templateType = $("#templateType").val();
  9469. if (templateType == null || templateType == "") {
  9470. errorMesageSimaple("范文范围不能为空!");
  9471. return;
  9472. }
  9473. var templateStatus = $("#templateStatus").val();
  9474. if (templateStatus == null || templateStatus == "") {
  9475. errorMesageSimaple("范文状态不能为空!");
  9476. return;
  9477. }
  9478. $("#saveapidAcceptsModal").modal("hide");
  9479. $("#messageModal").modal();
  9480. $("#messageContent").html("确认保存医疗范文吗?");
  9481. $("#messageButton").off("click").on("click", function (t) {
  9482. $("#messageModal").modal("hide");
  9483. var jsonData = getParamsForpPrescription(2);
  9484. var operationType = $("#operationType").val();
  9485. var templateId = $("#templateId").val();
  9486. if (operationType == 0 || operationType == '0') {
  9487. templateId = null;
  9488. }
  9489. $.ajax({
  9490. type: "POST",
  9491. url: '/thmz/saveTemplate',
  9492. contentType: "application/json;charset=UTF-8",
  9493. dataType: "json",
  9494. data: JSON.stringify({
  9495. "id": templateId,
  9496. "name": templateName,
  9497. "icdText": jsonData.icdText != null ? jsonData.icdText : jsonData.mzBlRecord.tentativeDiagnosis,
  9498. "templateKindType": templateKindType,
  9499. "templateType": templateType,
  9500. "templateStatus": templateStatus,
  9501. "templateData": JSON.stringify(jsonData),
  9502. "emrChiefComplaint": $("#symptom").val(),
  9503. "emrHpi": $("#emrHpi").val(),
  9504. "emrPs": $("#emrPs").val(),
  9505. "icdCode": $("#diagnoseValue").val()
  9506. }),
  9507. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9508. success: function (res) {
  9509. if (res == '401' || res == 401) {
  9510. window.location.href = '/thmz/login/view'
  9511. return;
  9512. }
  9513. if (res.code == 0) {
  9514. successMesage(res);
  9515. //范本保存完不清空
  9516. //clearWorkSpace();
  9517. } else {
  9518. $("#saveapidAcceptsModal").modal();
  9519. errorMesage(res);
  9520. }
  9521. }
  9522. });
  9523. });
  9524. $("#cancelButton").off("click");
  9525. }
  9526. /**
  9527. * 停用医疗范文
  9528. */
  9529. function removeTemplate() {
  9530. $("#messageModal").modal();
  9531. $("#messageContent").html("确认停用医疗范文吗?");
  9532. $("#messageButton").off("click").on("click", function (t) {
  9533. $("#messageModal").modal("hide");
  9534. $.ajax({
  9535. type: "POST",
  9536. url: '/thmz/removeTemplate',
  9537. contentType: "application/json;charset=UTF-8",
  9538. dataType: "json",
  9539. data: JSON.stringify({
  9540. "id": $("#idTemplate").val()
  9541. }),
  9542. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9543. success: function (res) {
  9544. if (res == '401' || res == 401) {
  9545. window.location.href = '/thmz/login/view'
  9546. return;
  9547. }
  9548. if (res.code == 0) {
  9549. successMesage(res);
  9550. $("#medicalModelModal").modal("hide");
  9551. fitTemplateData();
  9552. } else {
  9553. errorMesage(res);
  9554. }
  9555. }
  9556. });
  9557. });
  9558. $("#cancelButton").off("click");
  9559. }
  9560. /**
  9561. * 清空医疗范文模块内容
  9562. */
  9563. function clearApidAcceptsModal() {
  9564. $("#templateId").val(null);
  9565. $("#templateName").val(null);
  9566. $("#templateKindType").selectpicker('val', 0);
  9567. $("#templateKindType").selectpicker('refresh');
  9568. $("#templateType").selectpicker('val', 0);
  9569. $("#templateType").selectpicker('refresh');
  9570. $("#templateStatus").selectpicker('val', 0);
  9571. $("#templateStatus").selectpicker('refresh');
  9572. $('#operationType').selectpicker('val', 0);
  9573. $('#operationType').selectpicker('refresh');
  9574. $("#operationTypeDiv").removeClass("in").addClass("hide");
  9575. }
  9576. /**
  9577. * 查询病人未缴费处方信息 加载到处方修改
  9578. * @param patientId
  9579. * @param times
  9580. * @param clnicId 就诊记录id
  9581. */
  9582. function getMzPrescriptionVoUnPaid(patientId, times, clnicId) {
  9583. if (!confirm("请确认要修改处方吗?如只修改病历,请取消,点击【详情】再【修改病历】")) {
  9584. return;
  9585. }
  9586. var currentPatientId = $("#patientId").text();
  9587. //当前接诊的用户和操作接诊的是同一个人,不做任何操作
  9588. if (currentPatientId == patientId) {
  9589. warningMesageSimaple("当前病人正在接诊中,请勿重复操作!");
  9590. return;
  9591. }
  9592. //效验是否有修改处方权限
  9593. postAjaxJsonHttpRequst("/thmz/queryPrescriptionModifyPermission",{"patientId":patientId,"times":times},false,function (re) {
  9594. if (re == '401' || re == 401) {
  9595. window.location.href = '/thmz/login/view'
  9596. return;
  9597. }
  9598. if(re.code != 0){
  9599. errorMesageSimaple(re.message);
  9600. return;
  9601. }
  9602. if (currentPatientId == null || currentPatientId == "") {
  9603. //当前没有人接诊,直接接诊
  9604. getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId);
  9605. } else {
  9606. //当前有人在接诊,提示是否需要切换和保存
  9607. $("#messagePrescriptionModal").modal();
  9608. $("#confirmPrescriptionButton").off("click").on("click", function (t) {
  9609. $("#messagePrescriptionModal").modal("hide");
  9610. //先保存目前接诊信息,再切换就诊人
  9611. var jsonData = getParamsForpPrescription(1);
  9612. $.ajax({
  9613. type: "POST",
  9614. url: '/thmz/savePrescription',
  9615. contentType: "application/json;charset=UTF-8",
  9616. dataType: "json",
  9617. data: JSON.stringify(jsonData),
  9618. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9619. success: function (res) {
  9620. if (res == '401' || res == 401) {
  9621. window.location.href = '/thmz/login/view'
  9622. return;
  9623. }
  9624. if (res.code == 0) {
  9625. loadInClinicTableList();
  9626. loadClinicTableList();
  9627. getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId);
  9628. } else {
  9629. errorMesage(res);
  9630. }
  9631. }
  9632. });
  9633. });
  9634. $("#cancelPrescriptionButton").off("click").on("click", function (t) {
  9635. $("#messagePrescriptionModal").modal("hide");
  9636. getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId);
  9637. });
  9638. }
  9639. })
  9640. }
  9641. /**
  9642. * 查询病人未缴费处方信息 加载到处方修改 通用方法
  9643. * @param patientId
  9644. * @param times
  9645. * @param clnicId 就诊记录id
  9646. */
  9647. function getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId) {
  9648. $.ajax({
  9649. type: "GET",
  9650. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + "&times=" + times + "&MzBlRecordFlag=false&payMark=5&clnicId=null",
  9651. contentType: "application/json;charset=UTF-8",
  9652. dataType: "json",
  9653. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9654. success: function (res) {
  9655. if (res == '401' || res == 401) {
  9656. window.location.href = '/thmz/login/view'
  9657. return;
  9658. }
  9659. if (res.code == 0) {
  9660. clearWorkSpace();
  9661. setMzReqType(patientId,times,null)
  9662. setMzPatientInfo(res.mzPatientMi);
  9663. editPrescription(res.data, 0)
  9664. //修改患者的时候,将原纪录的就诊记录id带上,并借用分诊流水号字段传参
  9665. $("#mzfzSerialNoInClick").val("clnicId_" + clnicId);
  9666. //查询患者的门诊统筹信息
  9667. queryInsuinfo(patientId);
  9668. } else {
  9669. errorMesage(res);
  9670. }
  9671. }
  9672. });
  9673. }
  9674. /**
  9675. * 查询病人已缴费处方信息 调用处方
  9676. * @param patientId
  9677. * @param times
  9678. * @param clnicId 就诊记录id
  9679. */
  9680. function getMzPrescriptionVoPaid(patientId, times, clnicId) {
  9681. $("#visitingDetailModal").modal("hide");
  9682. $("#messageModal").modal();
  9683. $("#messageContent").html("确认调用选中处方吗?将会覆盖当前处方。");
  9684. $("#messageButton").off("click").on("click", function (t) {
  9685. $("#messageModal").modal("hide");
  9686. $.ajax({
  9687. type: "GET",
  9688. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + "&times=" + times + "&MzBlRecordFlag=false&payMark=0&clnicId=null",
  9689. contentType: "application/json;charset=UTF-8",
  9690. dataType: "json",
  9691. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9692. success: function (res) {
  9693. if (res == '401' || res == 401) {
  9694. window.location.href = '/thmz/login/view'
  9695. return;
  9696. }
  9697. if (res.code == 0) {
  9698. var mzfzSerialNoInClick = $("#mzfzSerialNoInClick").val();
  9699. var mzfzReqTypeNoInClick = $("#mzfzReqTypeNoInClick").val();
  9700. clearUser(false);
  9701. clearWorkSpaceExcludeUser(3);
  9702. setMzPatientInfo(res.mzPatientMi);
  9703. editPrescription(res.data, 2)
  9704. $("#mzfzSerialNoInClick").val(mzfzSerialNoInClick);
  9705. $("#mzfzReqTypeNoInClick").val(mzfzReqTypeNoInClick);
  9706. } else {
  9707. errorMesage(res);
  9708. }
  9709. }
  9710. });
  9711. });
  9712. $("#cancelButton").off("click");
  9713. }
  9714. /**
  9715. * 重复接诊
  9716. * @param patientId
  9717. * @param times
  9718. * @param clnicId
  9719. * @param deptCode 就诊科室编码
  9720. */
  9721. function repeatAccepts(patientId, times, clnicId, deptCode) {
  9722. $.ajax({
  9723. type: "GET",
  9724. url: '/thmz/validMzyReqrec?patientId=' + patientId + "&deptCode=" + deptCode,
  9725. contentType: "application/json;charset=UTF-8",
  9726. dataType: "json",
  9727. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9728. success: function (res) {
  9729. if (res == '401' || res == 401) {
  9730. window.location.href = '/thmz/login/view'
  9731. return;
  9732. }
  9733. if (res.code == 0) {
  9734. if (res.data == 0) {
  9735. // $("#messageModal").modal();
  9736. // $("#messageContent").html("挂号失效,确定继续就诊?");
  9737. // $("#messageButton").off("click").on("click", function (t) {
  9738. // $("#messageModal").modal("hide");
  9739. // repeatAcceptsConfirm(patientId, times, clnicId);
  9740. // });
  9741. // $("#cancelButton").off("click");
  9742. warningMesageSimaple(res.message);
  9743. return;
  9744. }
  9745. repeatAcceptsConfirm(patientId, times, clnicId);
  9746. } else {
  9747. errorMesage(res);
  9748. }
  9749. }
  9750. });
  9751. }
  9752. /**
  9753. * 重复接诊提示方法
  9754. * @param patientId
  9755. * @param times
  9756. * @param clnicId
  9757. */
  9758. function repeatAcceptsConfirm(patientId, times, clnicId) {
  9759. var currentPatientId = $("#patientId").text();
  9760. //当前接诊的用户和操作接诊的是同一个人,不做任何操作
  9761. if (currentPatientId == patientId) {
  9762. return;
  9763. }
  9764. if (currentPatientId == null || currentPatientId == "") {
  9765. //当前没有人接诊,直接接诊
  9766. repeatAcceptsCommon(patientId, times, clnicId);
  9767. } else {
  9768. //当前有人在接诊,提示是否需要切换和保存
  9769. $("#messagePrescriptionModal").modal();
  9770. $("#confirmPrescriptionButton").off("click").on("click", function (t) {
  9771. $("#messagePrescriptionModal").modal("hide");
  9772. //先保存目前接诊信息,再切换就诊人
  9773. var jsonData = getParamsForpPrescription(1);
  9774. $.ajax({
  9775. type: "POST",
  9776. url: '/thmz/savePrescription',
  9777. contentType: "application/json;charset=UTF-8",
  9778. dataType: "json",
  9779. data: JSON.stringify(jsonData),
  9780. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9781. success: function (res) {
  9782. if (res == '401' || res == 401) {
  9783. window.location.href = '/thmz/login/view'
  9784. return;
  9785. }
  9786. if (res.code == 0) {
  9787. repeatAcceptsCommon(patientId, times, clnicId);
  9788. //加载已接诊患者列表
  9789. loadClinicTableList();
  9790. } else {
  9791. errorMesage(res);
  9792. }
  9793. }
  9794. });
  9795. });
  9796. $("#cancelPrescriptionButton").off("click").on("click", function (t) {
  9797. $("#messagePrescriptionModal").modal("hide");
  9798. repeatAcceptsCommon(patientId, times, clnicId);
  9799. });
  9800. }
  9801. }
  9802. /**
  9803. * 重复接诊通用方法
  9804. * @param patientId
  9805. * @param times
  9806. * @param clnicId
  9807. */
  9808. function repeatAcceptsCommon(patientId, times, clnicId) {
  9809. $.ajax({
  9810. type: "GET",
  9811. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + "&times=" + times + "&MzBlRecordFlag=true&payMark=null&clnicId=null",
  9812. contentType: "application/json;charset=UTF-8",
  9813. dataType: "json",
  9814. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9815. success: function (res) {
  9816. if (res == '401' || res == 401) {
  9817. window.location.href = '/thmz/login/view'
  9818. return;
  9819. }
  9820. if (res.code == 0) {
  9821. clearWorkSpace();
  9822. setMzReqType(patientId,times,null);
  9823. setMzPatientInfo(res.mzPatientMi);
  9824. editPrescription(res.data, 0)
  9825. //修改患者的时候,将原纪录的就诊记录id带上,并借用分诊流水号字段传参
  9826. $("#mzfzSerialNoInClick").val("clnicId_" + clnicId);
  9827. //查询患者的门诊统筹信息
  9828. queryInsuinfo(patientId);
  9829. } else {
  9830. errorMesage(res);
  9831. }
  9832. }
  9833. });
  9834. }
  9835. /**
  9836. * 就诊详情 已诊患者列表发起
  9837. * @param patientId
  9838. * @param times
  9839. * @param clnicId
  9840. * @param payMark
  9841. */
  9842. function prescriptionDetail(patientId, times, clnicId, payMark) {
  9843. prescriptionDetailCommon(patientId, times, clnicId, payMark, 0);
  9844. }
  9845. /**
  9846. * 就诊详情 历史轨迹发起
  9847. * @param patientId
  9848. * @param times
  9849. * @param clnicId
  9850. * @param clinicStatus
  9851. */
  9852. function visitingDetailModal(patientId, times, clnicId, clinicStatus) {
  9853. closeObjectWebui(false);
  9854. var payMark = null;
  9855. if (clinicStatus == 5) {
  9856. payMark = 5;
  9857. } else {
  9858. payMark = 0;
  9859. }
  9860. prescriptionDetailCommon(patientId, times, clnicId, payMark, 1);
  9861. }
  9862. function setmzPrescriptionPrintFlag(patientId, times) {
  9863. postAjaxJsonHttpRequst("/thmz/mzPrescriptionPrint/getPrintFlag",{patientId:patientId,times:times},true,function (res) {
  9864. if(res.data !=null){
  9865. if(res.data == '1'){
  9866. $("#printImage").attr("src", "/thmz/images/yiprint.png");
  9867. }else {
  9868. $("#printImage").attr("src", "/thmz/images/no_print.png");
  9869. }
  9870. }else {
  9871. $("#printImage").attr("src", "/thmz/images/yiprint.png");
  9872. }
  9873. })
  9874. }
  9875. /**
  9876. * 就诊详情通用方法
  9877. * @param patientId
  9878. * @param times
  9879. * @param clnicId
  9880. * @param payMark
  9881. * @param type 0 已诊患者列表发起 1 历史轨迹发起
  9882. */
  9883. function prescriptionDetailCommon(patientId, times, clnicId, payMark, type) {
  9884. $('#baseMzBlTimes').val(null);
  9885. var oriPayMark = payMark;
  9886. if (payMark == 1) {
  9887. //退费时,查看的明细还是处方开立的情况
  9888. payMark = 0;
  9889. }
  9890. //是否默认勾选处方回调
  9891. var checkboxFlag = localStorage.getItem("checkboxFlag");
  9892. if (checkboxFlag != null && (checkboxFlag == "0" || checkboxFlag == 0)) {
  9893. $("#conciseRecordsJzxq").prop("checked", true);
  9894. $("#prescriptionSubsidiaryJzxq").prop("checked", true);
  9895. } else {
  9896. $("#conciseRecordsJzxq").prop("checked", false);
  9897. $("#prescriptionSubsidiaryJzxq").prop("checked", false);
  9898. }
  9899. $.ajax({
  9900. type: "GET",
  9901. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + '&times=' + times + '&MzBlRecordFlag=false&payMark=' + payMark + '&clnicId=' + clnicId,
  9902. contentType: "application/json;charset=UTF-8",
  9903. dataType: "json",
  9904. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9905. success: function (res) {
  9906. if (res == '401' || res == 401) {
  9907. window.location.href = '/thmz/login/view'
  9908. return;
  9909. }
  9910. if (res.code == 0) {
  9911. $("#visitingDetailModal").modal();
  9912. var jsonData = res.data;
  9913. var mzPatientMi = res.mzPatientMi;
  9914. $("#visitingDetailPatientName").html('<a onclick="editUserModal(\'' + mzPatientMi.patientId + '\',3)" style=\'cursor: pointer;\'>' + mzPatientMi.name + '</a>');
  9915. $("#visitingDetailPatientAge").text(mzPatientMi.ageString);
  9916. $("#visitingDetailPatientGender").val(mzPatientMi.gender);
  9917. $("#prescriptionDetail_zd").html("");
  9918. $("#prescriptionDetail_xyzlContent").html("");
  9919. $("#prescriptionDetail_zyzlContent").html("");
  9920. $("#prescriptionDetail_zlyjContent").html("");
  9921. if (res.opDate != null) {
  9922. $("#visitingDetailDate").text(res.opDate);
  9923. }
  9924. if (res.deptName != null) {
  9925. $("#visitingDetailDept").text(res.deptName);
  9926. }
  9927. if (res.doctorName != null) {
  9928. $("#visitingDetailDoctor").text(res.doctorName);
  9929. }
  9930. var firstOrNot = jsonData.mzBlRecord.firstOrNot;
  9931. if (firstOrNot == 0) {
  9932. $("#visitFlag").html("初诊");
  9933. $("#first").next().click();
  9934. } else if (firstOrNot == 1) {
  9935. $("#visitFlag").html("复诊");
  9936. $("#not").next().click();
  9937. }
  9938. if (oriPayMark == 0) {
  9939. $("#chargeImage").attr("src", "/thmz/images/charge.png");
  9940. } else if (oriPayMark == 1) {
  9941. $("#chargeImage").attr("src", "/thmz/images/refund.png");
  9942. } else if (oriPayMark == 5) {
  9943. $("#chargeImage").attr("src", "/thmz/images/nocharge.png");
  9944. }
  9945. setmzPrescriptionPrintFlag(patientId, times);
  9946. $("#prescriptionDetail_zs").html(jsonData.mzBlRecord.emrChiefComplaint);
  9947. $("#prescriptionDetail_xbs").html(jsonData.mzBlRecord.emrHpi);
  9948. $("#prescriptionDetail_tgjc").html(jsonData.mzBlRecord.emrPe);
  9949. $("#prescriptionDetail_jkjy").html(jsonData.mzBlRecord.emrJkjy);
  9950. var icdText = jsonData.icdText;
  9951. if (icdText != null) {
  9952. var arr = icdText.split(",");
  9953. var html = "";
  9954. for (var i = 0; i < arr.length; i++) {
  9955. if (i == 0) {
  9956. html += ' <div class="tagZdy tagZdy-back">';
  9957. } else {
  9958. html += ' <div class="tagZdy tagZdy-back-green">';
  9959. }
  9960. html += arr[i];
  9961. html += '</div>';
  9962. }
  9963. $("#prescriptionDetail_zd").html(html);
  9964. } else {
  9965. $("#prescriptionDetail_zd").html(jsonData.mzBlRecord.tentativeDiagnosis);
  9966. }
  9967. var prescriptionDetail = jsonData.mzBlRecord.prescriptionDetail;
  9968. if (prescriptionDetail != null) {
  9969. var checkBox = type == 1;
  9970. prescriptionDetail = JSON.parse(prescriptionDetail);
  9971. var xyPrescription = prescriptionDetail.xyPrescription;
  9972. if (xyPrescription != null) {
  9973. fitxyContent(xyPrescription.pyPrescription, "prescriptionDetail_xypyContent", "prescriptionDetail_xypyTitle", checkBox);
  9974. fitxyContent(xyPrescription.mjPrescription, "prescriptionDetail_xymjContent", "prescriptionDetail_xymjTitle", checkBox);
  9975. fitxyContent(xyPrescription.jePrescription, "prescriptionDetail_xyjeContent", "prescriptionDetail_xyjeTitle", checkBox);
  9976. fitxyContent(xyPrescription.ycPrescription, "prescriptionDetail_yczlContent", "prescriptionDetail_yczlTitle", checkBox);
  9977. } else {
  9978. $("#prescriptionDetail_xypyTitle").removeClass("in").addClass("hide");
  9979. $("#prescriptionDetail_xypyContent").html("");
  9980. $("#prescriptionDetail_xymjTitle").removeClass("in").addClass("hide");
  9981. $("#prescriptionDetail_xymjContent").html("");
  9982. $("#prescriptionDetail_xyjeTitle").removeClass("in").addClass("hide");
  9983. $("#prescriptionDetail_xyjeContent").html("");
  9984. $("#prescriptionDetail_yczlTitle").removeClass("in").addClass("hide");
  9985. $("#prescriptionDetail_yczlContent").html("");
  9986. }
  9987. var zyPrescription = prescriptionDetail.zyPrescription;
  9988. if (zyPrescription != null) {
  9989. fitzyContent(zyPrescription, "prescriptionDetail_zyzlContent", "prescriptionDetail_zyzlTitle", checkBox);
  9990. } else {
  9991. $("#prescriptionDetail_zyzlTitle").removeClass("in").addClass("hide");
  9992. $("#prescriptionDetail_zyzlContent").html("");
  9993. }
  9994. var jcjyPrescription = prescriptionDetail.jcjyPrescription;
  9995. if (jcjyPrescription != null) {
  9996. fitJcjyContent(jcjyPrescription, "prescriptionDetail_jcjyContent", "prescriptionDetail_jcjyTitle", checkBox);
  9997. } else {
  9998. ("#prescriptionDetail_jcjyTitle").removeClass("in").addClass("hide");
  9999. $("#prescriptionDetail_jcjyContent").html("");
  10000. }
  10001. var zlPrescription = prescriptionDetail.zlPrescription;
  10002. if (zlPrescription != null) {
  10003. fitJcjyContent(zlPrescription, "prescriptionDetail_zlContent", "prescriptionDetail_zlTitle", checkBox);
  10004. } else {
  10005. $("#prescriptionDetail_zlTitle").removeClass("in").addClass("hide");
  10006. $("#prescriptionDetail_zlContent").html("");
  10007. }
  10008. var zyReqPrescription = prescriptionDetail.zyReqPrescription;
  10009. if (zyReqPrescription != null) {
  10010. fitZyReqContent(zyReqPrescription, "prescriptionDetail_zyReqContent", "prescriptionDetail_zyReqTitle", true);
  10011. } else {
  10012. $("#prescriptionDetail_zyReqTitle").removeClass("in").addClass("hide");
  10013. $("#prescriptionDetail_zyReqContent").html("");
  10014. }
  10015. var opRecordPrescription = prescriptionDetail.opRecordPrescription;
  10016. if (opRecordPrescription != null) {
  10017. fitOpRecordContent(opRecordPrescription, "prescriptionDetail_opRecordContent", "prescriptionDetail_opRecordTitle", true);
  10018. } else {
  10019. $("#prescriptionDetail_opRecordTitle").removeClass("in").addClass("hide");
  10020. $("#prescriptionDetail_opRecordContent").html("");
  10021. }
  10022. } else {
  10023. $("#prescriptionDetail_xypyTitle").removeClass("in").addClass("hide");
  10024. $("#prescriptionDetail_xypyContent").html("");
  10025. $("#prescriptionDetail_xymjTitle").removeClass("in").addClass("hide");
  10026. $("#prescriptionDetail_xymjContent").html("");
  10027. $("#prescriptionDetail_xyjeTitle").removeClass("in").addClass("hide");
  10028. $("#prescriptionDetail_xyjeContent").html("");
  10029. $("#prescriptionDetail_yczlTitle").removeClass("in").addClass("hide");
  10030. $("#prescriptionDetail_yczlContent").html("");
  10031. $("#prescriptionDetail_zyzlTitle").removeClass("in").addClass("hide");
  10032. $("#prescriptionDetail_zyzlContent").html("");
  10033. $("#prescriptionDetail_jcjyTitle").removeClass("in").addClass("hide");
  10034. $("#prescriptionDetail_jcjyContent").html("");
  10035. $("#prescriptionDetail_zlTitle").removeClass("in").addClass("hide");
  10036. $("#prescriptionDetail_zlContent").html("");
  10037. $("#prescriptionDetail_zyReqTitle").removeClass("in").addClass("hide");
  10038. $("#prescriptionDetail_zyReqContent").html("");
  10039. }
  10040. $("#printJcReq").removeClass("in").addClass("hide");
  10041. $("#printJcReq").off("click");
  10042. $("#printJyReq").removeClass("in").addClass("hide");
  10043. $("#printJyReq").off("click");
  10044. $("#printJcReqSetup").removeClass("in").addClass("hide");
  10045. $("#printJcReqSetup").off("click");
  10046. $("#printJyReqSetup").removeClass("in").addClass("hide");
  10047. $("#printJyReqSetup").off("click");
  10048. $("#previewYjReq").removeClass("in").addClass("hide");
  10049. $("#previewYjReq").off("click");
  10050. $("#previewYjReqAll").removeClass("in").addClass("hide");
  10051. $("#previewYjReqAll").off("click");
  10052. $("#deletePrescription").removeClass("in").addClass("hide");
  10053. $("#deletePrescription").off("click");
  10054. $("#consultationCliniced").removeClass("in").addClass("hide");
  10055. $("#consultationCliniced").off("click");
  10056. if (jsonData.mzYjReqList != null && jsonData.mzYjReqList.length > 0) {
  10057. $("#previewYjReq").removeClass("hide").addClass("in");
  10058. $("#previewYjReq").off("click").on("click", function (t) {
  10059. previewYjReq(patientId, times);
  10060. });
  10061. }
  10062. if (res.yjReqCount != null && res.yjReqCount > 0) {
  10063. $("#previewYjReqAll").removeClass("hide").addClass("in");
  10064. $("#previewYjReqAll").off("click").on("click", function (t) {
  10065. previewYjReqAll(patientId);
  10066. });
  10067. }
  10068. if (type == 0) {
  10069. $("#callPrescription").removeClass("in").addClass("hide");
  10070. if ((jsonData.mzChargeDetailList == null || jsonData.mzChargeDetailList.length == 0) && (jsonData.mzYjReqList == null || jsonData.mzYjReqList.length == 0)) {
  10071. $("#printPrescription").removeClass("in").addClass("hide");
  10072. $("#printPrescriptionSetup").removeClass("in").addClass("hide");
  10073. } else {
  10074. $("#printPrescription").removeClass("hide").addClass("in");
  10075. $("#printPrescription").off("click").on("click", function (t) {
  10076. printPrescription(patientId, times, clnicId, payMark, 1);
  10077. });
  10078. $("#printPrescriptionSetup").removeClass("hide").addClass("in");
  10079. $("#printPrescriptionSetup").off("click").on("click", function (t) {
  10080. printPrescription(patientId, times, clnicId, payMark, 2);
  10081. });
  10082. }
  10083. if (jsonData.mzYjReqList != null && jsonData.mzYjReqList.length > 0) {
  10084. var hadJc = false;
  10085. var hadJy = false;
  10086. for (var i = 0; i < jsonData.mzYjReqList.length; i++) {
  10087. var mzYjReq = jsonData.mzYjReqList[i];
  10088. if (mzYjReq.reqType == 2) {
  10089. hadJy = true;
  10090. } else if (mzYjReq.reqType == 3) {
  10091. hadJc = true;
  10092. }
  10093. }
  10094. if (hadJc) {
  10095. $("#printJcReq").removeClass("hide").addClass("in");
  10096. $("#printJcReq").off("click").on("click", function (t) {
  10097. printYjReq(patientId, times, 3, 1);
  10098. });
  10099. $("#printJcReqSetup").removeClass("hide").addClass("in");
  10100. $("#printJcReqSetup").off("click").on("click", function (t) {
  10101. printYjReq(patientId, times, 3, 2);
  10102. });
  10103. }
  10104. if (hadJy) {
  10105. $("#printJyReq").removeClass("hide").addClass("in");
  10106. $("#printJyReq").off("click").on("click", function (t) {
  10107. printYjReq(patientId, times, 2, 1);
  10108. });
  10109. $("#printJyReqSetup").removeClass("hide").addClass("in");
  10110. $("#printJyReqSetup").off("click").on("click", function (t) {
  10111. printYjReq(patientId, times, 2, 2);
  10112. });
  10113. }
  10114. }
  10115. if (jsonData.mzZyReq == null || jsonData.mzZyReq.reqDept == null || jsonData.mzZyReq.reqDept == "") {
  10116. $("#printZyReq").removeClass("in").addClass("hide");
  10117. $("#printZyReq").off("click");
  10118. $("#printZyReqSetup").removeClass("in").addClass("hide");
  10119. $("#printZyReqSetup").off("click");
  10120. } else {
  10121. $("#printZyReq").removeClass("hide").addClass("in");
  10122. $("#printZyReq").off("click").on("click", function (t) {
  10123. printZyReq(patientId, 1);
  10124. });
  10125. $("#printZyReqSetup").removeClass("hide").addClass("in");
  10126. $("#printZyReqSetup").off("click").on("click", function (t) {
  10127. printZyReq(patientId, 2);
  10128. });
  10129. }
  10130. //门诊手术
  10131. if (jsonData.opRecordList != null && jsonData.opRecordList.length > 0) {
  10132. $("#printOpRecord").removeClass("hide").addClass("in");
  10133. $("#printOpRecord").off("click").on("click", function (t) {
  10134. printOpRecord(patientId, times, 1);
  10135. });
  10136. $("#printOpRecordSetup").removeClass("hide").addClass("in");
  10137. $("#printOpRecordSetup").off("click").on("click", function (t) {
  10138. printOpRecord(patientId, times, 2);
  10139. });
  10140. } else {
  10141. $("#printOpRecord").removeClass("in").addClass("hide");
  10142. $("#printOpRecord").off("click");
  10143. $("#printOpRecordSetup").removeClass("in").addClass("hide");
  10144. $("#printOpRecordSetup").off("click");
  10145. }
  10146. //未缴费状态的时候可以删除处方
  10147. if (oriPayMark == 5 || oriPayMark == "5") {
  10148. $("#deletePrescription").removeClass("hide").addClass("in");
  10149. $("#deletePrescription").off("click").on("click", function (t) {
  10150. deletePrescription(clnicId);
  10151. });
  10152. }
  10153. //已诊列表发起会诊
  10154. $("#consultationCliniced").removeClass("hide").addClass("in");
  10155. $("#consultationCliniced").off("click").on("click", function (t) {
  10156. consultationCliniced(patientId);
  10157. });
  10158. //已诊列表发起预约挂号
  10159. $("#registration").off("click").on("click", function (t) {
  10160. registration(patientId);
  10161. });
  10162. } else {
  10163. $("#printPrescription").removeClass("in").addClass("hide");
  10164. $("#printZyReq").removeClass("in").addClass("hide");
  10165. $("#printBlRecord").removeClass("in").addClass("hide");
  10166. $("#printJcReq").removeClass("in").addClass("hide");
  10167. $("#printJyReq").removeClass("in").addClass("hide");
  10168. $("#registration").removeClass("in").addClass("hide");
  10169. $("#callPrescription").removeClass("hide").addClass("in");
  10170. $("#callPrescription").off("click").on("click", function (t) {
  10171. getMzPrescriptionVoPaid(patientId, times, clnicId);
  10172. });
  10173. }
  10174. if (oriPayMark == 1) {
  10175. $("#printPrescription").removeClass("in").addClass("hide");
  10176. $("#printPrescriptionSetup").removeClass("in").addClass("hide");
  10177. } else {
  10178. if ((jsonData.mzChargeDetailList == null || jsonData.mzChargeDetailList.length == 0) && (jsonData.mzYjReqList == null || jsonData.mzYjReqList.length == 0)) {
  10179. $("#printPrescription").removeClass("in").addClass("hide");
  10180. $("#printPrescriptionSetup").removeClass("in").addClass("hide");
  10181. } else {
  10182. $("#printPrescription").removeClass("hide").addClass("in");
  10183. $("#printPrescription").off("click").on("click", function (t) {
  10184. printPrescription(patientId, times, clnicId, payMark, 1);
  10185. });
  10186. $("#printPrescriptionSetup").removeClass("hide").addClass("in");
  10187. $("#printPrescriptionSetup").off("click").on("click", function (t) {
  10188. printPrescription(patientId, times, clnicId, payMark, 2);
  10189. });
  10190. }
  10191. }
  10192. $("#previewBlbg").off("click").on("click", function (t) {
  10193. window.open("http://172.16.32.192:801/PIMSWebView.asp?mid=" + patientId);
  10194. });
  10195. $("#printBlRecord").removeClass("hide").addClass("in");
  10196. $("#printBlRecord").off("click").on("click", function (t) {
  10197. printBlRecord(patientId, times, 1);
  10198. });
  10199. $("#printBlRecordSetup").removeClass("hide").addClass("in");
  10200. $("#printBlRecordSetup").off("click").on("click", function (t) {
  10201. printBlRecord(patientId, times, 2);
  10202. });
  10203. $("#showMzBlRecordModal").removeClass("hide").addClass("in");
  10204. $("#showMzBlRecordModal").off("click").on("click", function (t) {
  10205. showMzBlRecordModal(patientId, times, 1);
  10206. });
  10207. if ($("#setupId").hasClass("fa-chevron-up")) {
  10208. //默认不展开打印设置
  10209. $("#setupId").parent().click();
  10210. }
  10211. // setTimeout(function () {
  10212. // if ($("#setupId").hasClass("fa-chevron-up")) {
  10213. // //默认不展开打印设置
  10214. // $("#setupId").parent().click();
  10215. // }
  10216. // }, 400);
  10217. //就诊详情的时候,隐藏复选框
  10218. if (type == 0) {
  10219. $("#visitingDetailModal").find("input[type=checkbox]").each(function (index, obj) {
  10220. $(obj).css("display", "none");
  10221. });
  10222. } else {
  10223. //历史处方显示复选框
  10224. $("#visitingDetailModal").find("input[type=checkbox]").each(function (index, obj) {
  10225. $(obj).css("display", "inline-block");
  10226. });
  10227. }
  10228. } else {
  10229. errorMesage(res);
  10230. }
  10231. }
  10232. });
  10233. $("#selfAmountView").html(0.00);
  10234. $("#fundPayView").html(0.00);
  10235. $("#acctPayView").html(0.00);
  10236. $("#totalAmountView").html(0.00);
  10237. $.ajax({
  10238. type: "GET",
  10239. url: '/thmz/getChargeDetailFee?patientId=&times=&receiptNo=&clnicId=' + clnicId,
  10240. contentType: "application/json;charset=UTF-8",
  10241. dataType: "json",
  10242. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10243. async: false,
  10244. success: function (res) {
  10245. if (res == '401' || res == 401) {
  10246. window.location.href = '/thmz/login/view'
  10247. return;
  10248. }
  10249. if (res.code == 0) {
  10250. if (res.fundPay != undefined && res.fundPay != null) {
  10251. $("#fundPayView").text("¥" + res.fundPay);
  10252. }
  10253. if (res.acctPay != undefined && res.acctPay != null) {
  10254. $("#acctPayView").text("¥" + res.acctPay);
  10255. }
  10256. $("#selfAmountView").text("¥" + res.selfAmount);
  10257. $("#totalAmountView").text("¥" + res.totalAmount);
  10258. } else {
  10259. printIndex = -1;
  10260. }
  10261. }
  10262. });
  10263. }
  10264. /**
  10265. * 查询默认打印机
  10266. */
  10267. function setPrint() {
  10268. if (printIndex >= 0) {
  10269. return;
  10270. }
  10271. $.ajax({
  10272. type: "GET",
  10273. url: '/thmz/getLastWindowsByCurrentUser',
  10274. contentType: "application/json;charset=UTF-8",
  10275. dataType: "json",
  10276. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10277. async: false,
  10278. success: function (res) {
  10279. if (res == '401' || res == 401) {
  10280. window.location.href = '/thmz/login/view'
  10281. return;
  10282. }
  10283. if (res.code == 0) {
  10284. printIndex = res.data.cgPrintIndex;
  10285. } else {
  10286. printIndex = -1;
  10287. }
  10288. }
  10289. });
  10290. }
  10291. //获取处方编码
  10292. function getOrderNum(patientId,times,prescriptionDetail) {
  10293. let num = '1'
  10294. if(prescriptionDetail.length > 0){
  10295. if(!stringIsBlank(prescriptionDetail[0].orderCode)){
  10296. num = prescriptionDetail[0].orderCode.split("_")[3]
  10297. }
  10298. }
  10299. return patientId + times + num;
  10300. }
  10301. function setTableHtml(prescriptionDetail) {
  10302. //设置成组处方符号
  10303. if (prescriptionDetail.length > 1) {
  10304. var map = new MyMap();
  10305. var groupOrderlist = [];
  10306. for (var j = 0; j < prescriptionDetail.length; j++) {
  10307. var detail = prescriptionDetail[j];
  10308. var list = map.get(detail.groupOrder);
  10309. if (list == null) {
  10310. list = [];
  10311. map.put(detail.groupOrder, list);
  10312. groupOrderlist[groupOrderlist.length] = detail.groupOrder;
  10313. }
  10314. list[list.length] = detail;
  10315. }
  10316. for (var j = 0; j < groupOrderlist.length; j++) {
  10317. var list = map.get(groupOrderlist[j]);
  10318. if (list.length == 1) {
  10319. continue;
  10320. }
  10321. list[0].groupFlag = "┒";
  10322. list[list.length - 1].groupFlag = "┛";
  10323. if (list.length > 2) {
  10324. for (var t = 1; t < list.length - 1; t++) {
  10325. list[t].groupFlag = "┃";
  10326. }
  10327. }
  10328. }
  10329. }
  10330. var html = "";
  10331. for (var j = 0; j < prescriptionDetail.length; j++) {
  10332. var detail = prescriptionDetail[j];
  10333. html += "<tr><td>" + (j+1) + "</td>";
  10334. html += "<td colspan='2'>";
  10335. html += detail.name + "(" + detail.specification + ")";
  10336. html += "</td>";
  10337. html += "<td colspan='2'></td>";
  10338. html += "<td>X</td>";
  10339. html += "<td rowspan='2' style='height: 100%;line-height: 100%;font-size: 40px;'>";
  10340. if (detail.groupFlag != undefined && detail.groupFlag != null) {
  10341. html += detail.groupFlag;
  10342. }
  10343. html += "</td><td>" + detail.quantity + detail.packUnit + "</td>";
  10344. html += "</tr>";
  10345. html += "<tr><td></td>";
  10346. if (detail.tryResult != undefined && detail.tryResult != null && detail.tryResult != "null" && detail.tryResult != "") {
  10347. html += "<td>" + detail.tryResult + "</td>";
  10348. } else if (detail.tryFlag != undefined && detail.tryFlag != null && detail.tryFlag != "null" && detail.tryFlag != "") {
  10349. html += "<td>" + detail.tryFlag + "</td>";
  10350. } else {
  10351. html += "<td></td>";
  10352. }
  10353. html += "<td style='font-weight: bold;text-align: right;'>用法:</td>";
  10354. html += "<td>" + detail.drugQuan + detail.unitDesc + "/次</td>";
  10355. html += "<td>" + detail.frequency + "</td>";
  10356. html += "<td>" + detail.orderDays + "天</td>";
  10357. html += "<td>" + detail.supplyName + "</td>";
  10358. html += "</tr>";
  10359. }
  10360. html += "<tr><td colspan='7'>&nbsp;&nbsp;&nbsp;&nbsp;------(以下空白)------</td></tr>";
  10361. return {html: html, j: j};
  10362. }
  10363. // /**
  10364. // * 打印门诊指引单
  10365. // * @param patientId
  10366. // * @param times
  10367. // */
  10368. // function printGuideCard(patientId, times) {
  10369. //
  10370. // }
  10371. /**
  10372. * 保存门诊处方打印记录
  10373. * @param patientId
  10374. * @param times
  10375. */
  10376. function saveMzPrescriptionPrint(patientId, times) {
  10377. postAjaxJsonHttpRequst("/thmz/mzPrescriptionPrint/saveData",{patientId:patientId,times:times},true,function (res) {
  10378. })
  10379. }
  10380. /**
  10381. * 打印门诊处方
  10382. * @param patientId
  10383. * @param times
  10384. * @param clnicId
  10385. * @param payMark
  10386. * @param printType 打印模式 1 预览打印 2 打印设置
  10387. */
  10388. function printPrescription(patientId, times, clnicId, payMark, printType) {
  10389. if(printType == 1){
  10390. saveMzPrescriptionPrint(patientId,times)
  10391. }
  10392. $.ajax({
  10393. type: "GET",
  10394. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + '&times=' + times + '&MzBlRecordFlag=false&payMark=' + payMark + '&clnicId=' + clnicId,
  10395. contentType: "application/json;charset=UTF-8",
  10396. dataType: "json",
  10397. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10398. success: function (res) {
  10399. if (res == '401' || res == 401) {
  10400. window.location.href = '/thmz/login/view'
  10401. return;
  10402. }
  10403. if (res.code == 0) {
  10404. var prescriptionDetail = res.data.mzBlRecord.prescriptionDetail;
  10405. if (prescriptionDetail != null && prescriptionDetail != "") {
  10406. var prescriptionDetailJson = JSON.parse(prescriptionDetail);
  10407. //当前处方只开了住院证则只打印住院证
  10408. 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) {
  10409. printZyReq(patientId, 1);
  10410. return;
  10411. }
  10412. var index = 0;
  10413. setPrint();
  10414. LODOP = getLodop();
  10415. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院处方笺");
  10416. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  10417. //设置默认打印机
  10418. LODOP.SET_PRINTER_INDEX(printIndex);
  10419. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  10420. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  10421. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  10422. //LODOP.SET_SHOW_MODE("SETUP_ENABLESS",getCheckSS());
  10423. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊处方笺");//对新建的纸张重命名
  10424. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  10425. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  10426. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  10427. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  10428. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  10429. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  10430. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  10431. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  10432. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  10433. var mzPatientMi = res.mzPatientMi;
  10434. var deptName = res.deptName;
  10435. $("#patientNamePrescription").text(mzPatientMi.name);
  10436. $("#patientGenderPrescription").text(mzPatientMi.gender);
  10437. $("#patientAgePrescription").text(mzPatientMi.ageString);
  10438. $("#patientIdPrescription").text(mzPatientMi.patientId);
  10439. $("#deptPrescription").text(deptName);
  10440. // $("#doctorPrescription").text(res.doctorName);
  10441. getAjaxRequst("/thmz/getDoctorSignatureImage",{doctorCode:res.doctorCode},false,function (postRes) {
  10442. if(postRes.code ==0){
  10443. $("#doctorPrescription").html("<img src='" + postRes.data + "' style='width:100px;height:23px;'/>")
  10444. }else {
  10445. $("#doctorPrescription").text(res.doctorName);
  10446. }
  10447. })
  10448. $("#cfTime").text(res.opDate);
  10449. $("#socialNo").text(mzPatientMi.socialNo);
  10450. $("#sfTypeId").text(mzPatientMi.responseTypeName);
  10451. $("#zdPrescription").text(res.data.icdText);
  10452. $("#patientIdGuideCard").text(mzPatientMi.patientId);
  10453. $("#patientNameGuideCard").text(mzPatientMi.name);
  10454. $("#patientDateGuideCard").text(format(new Date(), "yyyy-MM-dd"));
  10455. JsBarcode("#cfBarcode", patientId, {
  10456. lineColor: '#333', //线条颜色
  10457. width: 1, //线宽
  10458. height: 26, //条码高度
  10459. displayValue: false, //是否显示文字信息
  10460. });
  10461. //普药处方
  10462. var pyPrescription = prescriptionDetailJson.xyPrescription.pyPrescription;
  10463. if (pyPrescription != null && pyPrescription.length > 0) {
  10464. for (var i = 0; i < pyPrescription.length; i++) {
  10465. if (index > 0) {
  10466. LODOP.NewPageA();
  10467. }
  10468. var prescriptionDetail = pyPrescription[i].detail;
  10469. var __ret = setTableHtml(prescriptionDetail);
  10470. var html = __ret.html;
  10471. var j = __ret.j;
  10472. if (res.deptName != undefined && res.deptName != null) {
  10473. if (res.deptName.indexOf("儿") > 0) {
  10474. $("#typePrescription").text("儿科");
  10475. $("#cfTitle").text("儿科");
  10476. } else if (res.deptName.indexOf("急诊科") > 0) {
  10477. $("#typePrescription").text("急诊");
  10478. $("#cfTitle").text("急诊");
  10479. } else {
  10480. $("#typePrescription").text("普通处方");
  10481. $("#cfTitle").text("普通");
  10482. }
  10483. }
  10484. $("#prescriptionDetail").html(html);
  10485. $("#cfAmountPrint").text(pyPrescription[i].amount + "元 (不含注射费)");
  10486. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  10487. index++;
  10488. }
  10489. }
  10490. //医材处方
  10491. var ycPrescription = prescriptionDetailJson.xyPrescription.ycPrescription;
  10492. if (ycPrescription != null && ycPrescription.length > 0) {
  10493. for (var i = 0; i < ycPrescription.length; i++) {
  10494. if (index > 0) {
  10495. LODOP.NewPageA();
  10496. }
  10497. var prescriptionDetail = ycPrescription[i].detail;
  10498. var __ret = setTableHtml(prescriptionDetail);
  10499. var html = __ret.html;
  10500. var j = __ret.j;
  10501. if (res.deptName != undefined && res.deptName != null) {
  10502. if (res.deptName.indexOf("儿") > 0) {
  10503. $("#typePrescription").text("儿科");
  10504. $("#cfTitle").text("儿科");
  10505. } else if (res.deptName.indexOf("急诊科") > 0) {
  10506. $("#typePrescription").text("急诊");
  10507. $("#cfTitle").text("急诊");
  10508. } else {
  10509. $("#typePrescription").text("医材处方");
  10510. $("#cfTitle").text("普通");
  10511. }
  10512. }
  10513. $("#prescriptionDetail").html(html);
  10514. $("#cfAmountPrint").text(ycPrescription[i].amount + "元 ");
  10515. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  10516. index++;
  10517. }
  10518. }
  10519. //麻精处方
  10520. var mjPrescription = prescriptionDetailJson.xyPrescription.mjPrescription;
  10521. if (mjPrescription != null && mjPrescription.length > 0) {
  10522. for (var i = 0; i < mjPrescription.length; i++) {
  10523. if (index > 0) {
  10524. LODOP.NewPageA();
  10525. }
  10526. var prescriptionDetail = mjPrescription[i].detail;
  10527. var __ret = setTableHtml(prescriptionDetail);
  10528. var html = __ret.html;
  10529. var j = __ret.j;
  10530. $("#typePrescription").text("麻、精一处方");
  10531. $("#cfTitle").text("麻、精一");
  10532. $("#cfOrderNumTitle").text(getOrderNum(patientId,times,prescriptionDetail));
  10533. $("#prescriptionDetail").html(html);
  10534. $("#cfAmountPrint").text(mjPrescription[i].amount + "元 (不含注射费)");
  10535. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  10536. index++;
  10537. }
  10538. }
  10539. //精二处方
  10540. var jePrescription = prescriptionDetailJson.xyPrescription.jePrescription;
  10541. if (jePrescription != null && jePrescription.length > 0) {
  10542. for (var i = 0; i < jePrescription.length; i++) {
  10543. if (index > 0) {
  10544. LODOP.NewPageA();
  10545. }
  10546. var prescriptionDetail = jePrescription[i].detail;
  10547. var __ret = setTableHtml(prescriptionDetail);
  10548. var html = __ret.html;
  10549. var j = __ret.j;
  10550. $("#typePrescription").text("精二处方");
  10551. $("#cfTitle").text("精二");
  10552. $("#cfOrderNumTitle").text(getOrderNum(patientId,times,prescriptionDetail));
  10553. $("#prescriptionDetail").html(html);
  10554. $("#cfAmountPrint").text(jePrescription[i].amount + "元 (不含注射费)");
  10555. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  10556. index++;
  10557. }
  10558. }
  10559. $("#cfOrderNumTitle").text(null)
  10560. //中药处方
  10561. if (prescriptionDetailJson.zyPrescription != null && prescriptionDetailJson.zyPrescription.length > 0) {
  10562. var zyPrescription = prescriptionDetailJson.zyPrescription[0].detail;zyPrescription
  10563. var zyGroupNo = prescriptionDetailJson.zyPrescription[0].groupNo;
  10564. if (zyPrescription != null && zyPrescription.length > 0) {
  10565. var html = "";
  10566. for (var i = 0; i < zyPrescription.length; i++) {
  10567. if (i % 2 == 0) {
  10568. html += "<tr><td></td><td></td></tr><tr>";
  10569. }
  10570. html += "<td>";
  10571. html += zyPrescription[i].name;
  10572. if(zyPrescription[i].spec){
  10573. html += "("+zyPrescription[i].spec+")";
  10574. }
  10575. if(zyGroupNo=='83'){
  10576. html += zyPrescription[i].quantity + "袋";
  10577. }else {
  10578. html += zyPrescription[i].quantity + "g";
  10579. }
  10580. if (zyPrescription[i].instructionText != null) {
  10581. html += "[" + zyPrescription[i].instructionText + "]";
  10582. }
  10583. if (i % 2 == 1) {
  10584. html += "</td></tr>";
  10585. } else {
  10586. html += "</td>";
  10587. }
  10588. }
  10589. if (zyPrescription.length % 2 != 0) {
  10590. html += "</tr>";
  10591. }
  10592. html += "<tr><td></td><td>X " + prescriptionDetailJson.zyPrescription[0].zyfs + "付</td></tr>";
  10593. var cyMtjs = prescriptionDetailJson.zyPrescription[0].cyMtjs;
  10594. if (cyMtjs == null || cyMtjs == "null") {
  10595. cyMtjs = "";
  10596. }
  10597. var cyJssm = prescriptionDetailJson.zyPrescription[0].cyJssm;
  10598. if (cyJssm == null || cyJssm == "null") {
  10599. cyJssm = "";
  10600. }
  10601. var cyJsl = prescriptionDetailJson.zyPrescription[0].cyJsl;
  10602. if (cyJsl == null || cyJsl == "null") {
  10603. cyJsl = "";
  10604. }
  10605. var cyZql = prescriptionDetailJson.zyPrescription[0].cyZql;
  10606. if (cyZql == null || cyZql == "null") {
  10607. cyZql = "";
  10608. }
  10609. var cyFj = prescriptionDetailJson.zyPrescription[0].cyFj;
  10610. if (cyFj == null || cyFj == "null") {
  10611. cyFj = "";
  10612. }
  10613. var cyFfcs = prescriptionDetailJson.zyPrescription[0].cyFfcs;
  10614. if (cyFfcs == null || cyFfcs == "null") {
  10615. cyFfcs = "";
  10616. }
  10617. var cyFysm = prescriptionDetailJson.zyPrescription[0].cyFysm;
  10618. if (cyFysm == null || cyFysm == "null") {
  10619. cyFysm = "";
  10620. }
  10621. var cyDj = prescriptionDetailJson.zyPrescription[0].cyDj;
  10622. if (cyDj == null || cyDj == "null") {
  10623. cyDj = "";
  10624. } else {
  10625. cyDj = "(" + cyDj + ")";
  10626. }
  10627. if(zyGroupNo =='83'){
  10628. html += "<tr><td colspan='2'>每天" + cyMtjs + "剂," + cyJssm + cyJsl + "ml。分" + cyFfcs + "次" + cyFysm + "。</td></tr>";
  10629. }else {
  10630. html += "<tr><td colspan='2'>每天" + cyMtjs + "剂," + cyJssm + cyJsl + "ml,煮取量" + cyZql + "ml,复煎" + cyFj + "次。分" + cyFfcs + "次" + cyFysm + " " + cyDj + "。</td></tr>";
  10631. }
  10632. html += "<tr><td colspan='2'>&nbsp;&nbsp;&nbsp;&nbsp;------(以下空白)------</td></tr>";
  10633. if (index > 0) {
  10634. LODOP.NewPageA();
  10635. }
  10636. if (res.deptName != undefined && res.deptName != null) {
  10637. if (res.deptName.indexOf("儿") > 0) {
  10638. $("#typePrescription").text("儿科");
  10639. $("#cfTitle").text("儿科");
  10640. } else if (res.deptName.indexOf("急诊科") > 0) {
  10641. $("#typePrescription").text("急诊");
  10642. $("#cfTitle").text("急诊");
  10643. } else {
  10644. $("#typePrescription").text("中药处方");
  10645. $("#cfTitle").text("普通");
  10646. }
  10647. }
  10648. $("#prescriptionDetail").html(html);
  10649. $("#cfAmountPrint").text(prescriptionDetailJson.zyPrescription[0].amount + "元 (不含代煎费)");
  10650. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  10651. index++;
  10652. }
  10653. }
  10654. var printZlPrescription = $("#zlPrintFlagCheck").parent().hasClass("checked") == true ? true : false;
  10655. if (printZlPrescription) {
  10656. if (prescriptionDetailJson.zlPrescription != null && prescriptionDetailJson.zlPrescription.length > 0) {
  10657. //诊疗处方
  10658. var zlPrescription = prescriptionDetailJson.zlPrescription[0].detail;
  10659. if (zlPrescription != null && zlPrescription.length > 0) {
  10660. var html = "";
  10661. for (var i = 0; i < zlPrescription.length; i++) {
  10662. var zlPrescriptionTemp = zlPrescription[i];
  10663. html += "<tr>";
  10664. html += "<td colspan='2'>" + zlPrescriptionTemp.index + "." + zlPrescriptionTemp.name + "</td>";
  10665. html += "<td style='text-align: right;padding-right: 15px;'>X</td>";
  10666. html += "<td>总量:" + zlPrescriptionTemp.quantity + "</td>";
  10667. html += "</tr>";
  10668. html += "<tr>";
  10669. html += "<td width='40%'></td>";
  10670. html += "<td width='20%'>单量:" + zlPrescriptionTemp.drugQuan + "</td>";
  10671. html += "<td width='20%'>频率:" + zlPrescriptionTemp.frequency + "</td>";
  10672. html += "<td width='20%'>天数:" + zlPrescriptionTemp.orderDays + "天</td>";
  10673. html += "</tr>";
  10674. }
  10675. if (index > 0) {
  10676. LODOP.NewPageA();
  10677. }
  10678. if (res.deptName != undefined && res.deptName != null) {
  10679. if (res.deptName.indexOf("儿") > 0) {
  10680. $("#typePrescription").text("儿科");
  10681. $("#cfTitle").text("儿科");
  10682. } else if (res.deptName.indexOf("急诊科") > 0) {
  10683. $("#typePrescription").text("急诊");
  10684. $("#cfTitle").text("急诊");
  10685. } else {
  10686. $("#typePrescription").text("诊疗处方");
  10687. $("#cfTitle").text("普通");
  10688. }
  10689. }
  10690. $("#prescriptionDetail").html(html);
  10691. $("#cfAmountPrint").text(prescriptionDetailJson.zlPrescription[0].amount + "元 ");
  10692. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  10693. index++;
  10694. }
  10695. }
  10696. }
  10697. //检查申请单打印
  10698. var mzYjReqList = res.data.mzYjReqList;
  10699. if (mzYjReqList != null && mzYjReqList.length > 0) {
  10700. $("#patientIdJcReq").text(mzPatientMi.patientId);
  10701. $("#patientNameJcReq").text(mzPatientMi.name);
  10702. $("#patientGenderJcReq").text(mzPatientMi.gender);
  10703. $("#patientAgeJcReq").text(mzPatientMi.ageString);
  10704. $("#responseTypeJcReq").text(mzPatientMi.responseTypeName);
  10705. $("#patientCardNoJcReq").text(mzPatientMi.icCardNo);
  10706. $("#icdTextJcReq").text(res.data.icdText);
  10707. var mzBlRecord = res.data.mzBlRecord;
  10708. $("#jcReqEmrChiefComplaint").text(mzBlRecord.emrChiefComplaint);
  10709. $("#jcReqHis").text(mzBlRecord.emrHpi);
  10710. var tz = getTz(mzBlRecord);
  10711. $("#jcReqTz").text(tz);
  10712. $("#jcReqReqDept").text(res.deptName);
  10713. $("#jcReqReqDoctor").text(res.doctorName);
  10714. // $("#patientIdJyReq").text(mzPatientMi.patientId);
  10715. // $("#patientNameJyReq").text(mzPatientMi.name);
  10716. // $("#patientGenderJyReq").text(mzPatientMi.gender);
  10717. // $("#patientAgeJyReq").text(mzPatientMi.ageString);
  10718. // $("#patientCardNoJyReq").text(mzPatientMi.icCardNo);
  10719. // $("#responseTypeJyReq").text(mzPatientMi.responseTypeName);
  10720. // $("#icdTextJyReq").text(res.data.icdText);
  10721. // $("#jyReqEmrChiefComplaint").text(mzBlRecord.emrChiefComplaint);
  10722. // $("#jyReqHis").text(mzBlRecord.emrHpi);
  10723. // $("#jyReqTz").text(tz);
  10724. // $("#jyReqReqDept").text(res.deptName);
  10725. // $("#jyReqReqDoctor").text(res.doctorName);
  10726. for (var i = 0; i < mzYjReqList.length; i++) {
  10727. var mzYjReq = mzYjReqList[i];
  10728. if (mzYjReq == null) {
  10729. continue;
  10730. }
  10731. if (i == 0) {
  10732. var dateStr = format(mzYjReq.reqDate, "yyyy-MM-dd");
  10733. $("#jcReqReqDate").text(dateStr);
  10734. // $("#jyReqReqDoctor").text(dateStr);
  10735. }
  10736. if (mzYjReq.reqType == 2) {
  10737. continue;
  10738. }
  10739. if ((i == 0 && index > 0) || i > 0) {
  10740. LODOP.NewPageA();
  10741. }
  10742. JsBarcode("#JcBarcode", mzYjReq.reqNo, {
  10743. lineColor: '#333', //线条颜色
  10744. width: 1, //线宽
  10745. height: 26, //条码高度
  10746. displayValue: false, //是否显示文字信息
  10747. });
  10748. $("#reqNoJcReq").text(mzYjReq.reqNo);
  10749. $("#jcReqItem").text(mzYjReq.groupName);
  10750. $("#jcReqRemark").text(mzYjReq.jyRemark);
  10751. $("#jcComment8").text(mzYjReq.comment8);
  10752. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("jc_card_table").innerHTML);
  10753. index++;
  10754. }
  10755. }
  10756. //住院证打印
  10757. var mzZyReq = res.data.mzZyReq;
  10758. if (mzZyReq != null) {
  10759. $("#patientIdZyReq").text(mzPatientMi.patientId);
  10760. $("#patientNameZyReq").text(mzPatientMi.name);
  10761. $("#patientGenderZyReq").text(mzPatientMi.gender);
  10762. $("#patientAgeZyReq").text(mzPatientMi.ageString);
  10763. $("#sfzZyReq").text(mzPatientMi.socialNo);
  10764. $("#birthDateZyReq").text(format(mzPatientMi.birthDay, "yyyy-MM-dd"));
  10765. $("#phoneZyReq").text(mzPatientMi.phoneNo);
  10766. $("#responseTypeZyReq").text(mzPatientMi.responseTypeName);
  10767. $("#addressZyReq").text(mzPatientMi.address);
  10768. if (mzZyReq.icdCode == null || mzZyReq.icdCode == "" || mzZyReq.icdCode.length == 0) {
  10769. $("#icsCodeZyReq").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
  10770. $("#icsTextZyReq").text(mzZyReq.icdText);
  10771. } else {
  10772. $("#icsCodeZyReq").text(mzZyReq.icdCode);
  10773. $("#icsTextZyReq").text(mzZyReq.icdText);
  10774. }
  10775. $("#reqDeptZyReq").text(mzZyReq.reqWardName);
  10776. $("#smallDeptZyReq").text(mzZyReq.smallDeptName);
  10777. $("#routeOfAdmissionName").text(mzZyReq.routeOfAdmissionName);
  10778. //$("#admissStatusZyReq").text(mzZyReq.admissStatus);
  10779. // $("input:checkbox[value='" + mzZyReq.admissStatus + "']").attr('checked', 'true');
  10780. $("input:checkbox[name='admissStatusZyReq']").each(function (i, e) {
  10781. $(this).removeAttr("checked");
  10782. if ($(this).val() == Number(mzZyReq.admissStatus) || $(this).val() == mzZyReq.admissStatus) {
  10783. $(this).attr("checked", true)
  10784. }
  10785. });
  10786. $("#visitDateZyReq").text(format(mzZyReq.visitDate, "yyyy-MM-dd HH:mm:ss"));
  10787. $("#deptCodeZyReq").text(mzZyReq.deptName);
  10788. getAjaxRequst("/thmz/getDoctorSignatureImage",{doctorCode:mzZyReq.doctorCode},false,function (signRes) {
  10789. if(signRes.code == 0){
  10790. $("#doctorCodeZyReq").html("<img src='" + signRes.data + "' style='width:100px;height:23px;'/>")
  10791. }else {
  10792. $("#doctorCodeZyReq").text(mzZyReq.doctorName);
  10793. }
  10794. })
  10795. if (index > 0) {
  10796. LODOP.NewPageA();
  10797. }
  10798. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("mz_zy_req_table").innerHTML);
  10799. index++;
  10800. }
  10801. //手术申请单打印
  10802. var opRecordList = res.data.opRecordList;
  10803. if (opRecordList != null && opRecordList.length > 0) {
  10804. $("#patientIdOpRecord").text(mzPatientMi.patientId);
  10805. $("#patientNameOpRecord").text(mzPatientMi.name);
  10806. $("#patientGenderOpRecord").text(mzPatientMi.gender);
  10807. $("#patientAgeOpRecord").text(mzPatientMi.ageString);
  10808. $("#responseTypeOpRecord").text(mzPatientMi.responseTypeName);
  10809. $("#patientCardNoOpRecord").text(mzPatientMi.icCardNo);
  10810. for (var i = 0; i < opRecordList.length; i++) {
  10811. var obj = opRecordList[i];
  10812. //$("#reqNoOpRecord").text(obj.recordId);
  10813. $("#icdTextOpRecord").text(obj.diagBeforeOp);
  10814. $("#opNameOpRecord").text(obj.opName);
  10815. $("#hocusCodeOpRecord").text(obj.hocusCodeName);
  10816. $("#opScaleOpRecord").text(obj.opScaleName);
  10817. var dateStr = format(obj.applyDate, "yyyy-MM-dd HH:mm:ss");
  10818. $("#applyDateOpRecord").text(dateStr);
  10819. $("#opDatetimeOpRecord").text(obj.opDatetimeStr);
  10820. $("#doctorZdOpRecord").text(obj.doctorZdName);
  10821. $("#remarkOpRecord").text(obj.remark);
  10822. if (index > 0) {
  10823. LODOP.NewPageA();
  10824. }
  10825. JsBarcode("#JcBarcode", obj.recordId, {
  10826. lineColor: '#333', //线条颜色
  10827. width: 1, //线宽
  10828. height: 26, //条码高度
  10829. displayValue: false, //是否显示文字信息
  10830. });
  10831. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("op_record_card_table").innerHTML);
  10832. index++;
  10833. }
  10834. }
  10835. // $("#selfAmountGuideCard").html(0.00);
  10836. // $("#fundPayGuideCard").html(0.00);
  10837. // $("#acctPayGuideCard").html(0.00);
  10838. $("#payQrcodeGuideCard").empty();
  10839. $("#selfPayDetail").empty();
  10840. $.ajax({
  10841. type: "GET",
  10842. url: '/thmz/getChargeDetailForGuideCard?patientId=' + patientId + '&times=' + times,
  10843. contentType: "application/json;charset=UTF-8",
  10844. dataType: "json",
  10845. headers: {
  10846. 'Accept': 'application/json',
  10847. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  10848. },
  10849. success: function (res) {
  10850. if (res == '401' || res == 401) {
  10851. window.location.href = '/thmz/login/view'
  10852. return;
  10853. }
  10854. if (res.code == 0) {
  10855. var selfPayList = res.selfPayList;
  10856. $("#zfcns_time").text("时间:" + res.zfcns_time);
  10857. if (selfPayList != null && selfPayList.length > 0) {
  10858. $("#patientNameSelfPay").text(mzPatientMi.name);
  10859. $("#patientGenderSelfPay").text(mzPatientMi.gender);
  10860. $("#patientAgeSelfPay").text(mzPatientMi.ageString);
  10861. $("#patientIdSelfPay").text(mzPatientMi.patientId);
  10862. $("#deptSelfPay").text(deptName);
  10863. $("#zdSelfPay").text(res.icdText);
  10864. var selfPayListHtml = "";
  10865. for (var i = 1; i <= selfPayList.length; i++) {
  10866. selfPayListHtml += "<tr><td>";
  10867. selfPayListHtml += i + "." + selfPayList[i - 1];
  10868. selfPayListHtml += "</td></tr>";
  10869. }
  10870. $("#selfPayDetail").html(selfPayListHtml);
  10871. if (index > 0) {
  10872. LODOP.NewPageA();
  10873. }
  10874. //view-source:http://www.c-lodop.com/demolist/PrintSample43.html 分页看这里
  10875. LODOP.ADD_PRINT_TABLE(158, "5%", "90%", 400, strStyle + document.getElementById("self_pay_table_body").innerHTML);
  10876. LODOP.SET_PRINT_STYLEA(0, "Vorient", 3);
  10877. LODOP.ADD_PRINT_HTM(26, "5%", "90%", 119, document.getElementById("self_pay_table_header").innerHTML);
  10878. LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
  10879. LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1);
  10880. LODOP.ADD_PRINT_HTM(560, "5%", "90%", 200, document.getElementById("self_pay_table_foot").innerHTML);
  10881. LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
  10882. LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1);
  10883. // LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("self_pay_table").innerHTML);
  10884. index++;
  10885. }
  10886. if (res.data != null && res.data.length > 0) {
  10887. var html = "";
  10888. for (var i = 0; i < res.data.length; i++) {
  10889. html += "<tr><td>" + res.data[i].itemType + "</td><td>" + Division(res.data[i].itemTotalFee, 1) + "</td><td>" + res.data[i].execDeptName + "</td><td>" + res.data[i].execDeptAddress + "</td></tr>"
  10890. }
  10891. $("#guideCardDetail").html(html);
  10892. }
  10893. if (res.payQrcode != null && res.payQrcode != "") {
  10894. new QRCode(document.getElementById("payQrcodeGuideCard"), res.payQrcode); // 设置要生成二维码的链接
  10895. $("canvas").attr("id", "erw");
  10896. var canvas = document.getElementById('erw');
  10897. var src = canvas.toDataURL("image/png");
  10898. //var strDataURI =canvas.toDataURL("image/png");
  10899. $("#payQrcodeGuideCard").html("<img src='" + src + "' style='width:100px;height:100px;'/><div style='width: 300px;margin-top: 10px;text-align: center;'>微信支付(全自费请扫此码)</div>");
  10900. }
  10901. if(!stringIsBlank(res.healthEducationUrl)){
  10902. new QRCode(document.getElementById("healthEducationCard"), res.healthEducationUrl); // 设置要生成二维码的链接
  10903. $("canvas").attr("id", "erw");
  10904. let canvas = document.getElementById('erw');
  10905. let src = canvas.toDataURL("image/png");
  10906. $("#healthEducationCard").html("<img src='" + src + "' style='width:100px;height:100px;'/><div style='width: 100px;margin-top: 10px;text-align: center;'>健康宣教</div>");
  10907. }
  10908. if(!stringIsBlank(res.wxPayQrUrl)){
  10909. new QRCode(document.getElementById("wxPayQrCard"), res.wxPayQrUrl); // 设置要生成二维码的链接
  10910. $("canvas").attr("id", "erw");
  10911. let canvas = document.getElementById('erw');
  10912. let src = canvas.toDataURL("image/png");
  10913. $("#wxPayQrCard").html("<img src='" + src + "' style='width:100px;height:100px;'/><div style='width: 500px;margin-top: 5px'>微信支付(含医保统筹请扫此码)</div>");
  10914. }
  10915. // if (res.fundPay != undefined && res.fundPay != null) {
  10916. // $("#fundPayGuideCard").text("¥" + res.fundPay);
  10917. // }
  10918. // if (res.acctPay != undefined && res.acctPay != null) {
  10919. // $("#acctPayGuideCard").text("¥" + res.acctPay);
  10920. // }
  10921. // $("#selfAmountGuideCard").text("¥" + res.selfAmount);
  10922. $("#totalAmountGuideCard").text("¥" + res.totalAmount);
  10923. // $("#imgcode").JsBarcode(patientId);
  10924. console.log(patientId);
  10925. JsBarcode('#imgcode', patientId, {
  10926. lineColor: '#333', //线条颜色
  10927. width: 2, //线宽
  10928. height: 60, //条码高度
  10929. displayValue: false, //是否显示文字信息
  10930. });
  10931. if (index > 0) {
  10932. LODOP.NewPageA();
  10933. }
  10934. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("guide_card_table").innerHTML);
  10935. //LODOP.PRINT();
  10936. if (printType == 1) {
  10937. LODOP.PREVIEW();
  10938. } else if (printType == 2) {
  10939. LODOP.PRINT_SETUP();
  10940. }
  10941. } else if (res.code == -2) {
  10942. if (printType == 1) {
  10943. LODOP.PREVIEW();
  10944. } else if (printType == 2) {
  10945. LODOP.PRINT_SETUP();
  10946. }
  10947. } else {
  10948. errorMesage(res);
  10949. }
  10950. }
  10951. });
  10952. // printGuideCard(patientId, times);
  10953. }
  10954. } else {
  10955. errorMesage(res);
  10956. }
  10957. }
  10958. });
  10959. }
  10960. /**
  10961. * 构建体征描述
  10962. * @param mzBlRecord
  10963. * @returns {*}
  10964. */
  10965. function getTz(mzBlRecord) {
  10966. var tz = null;
  10967. if (mzBlRecord.weight != null && mzBlRecord.weight != 0) {
  10968. var temp = "体重:" + mzBlRecord.weight + "kg ";
  10969. if (tz == null) {
  10970. tz = temp;
  10971. } else {
  10972. tz += " " + temp;
  10973. }
  10974. }
  10975. if (mzBlRecord.temperature != null && mzBlRecord.temperature != 0) {
  10976. var temp = "体温:" + mzBlRecord.temperature + "℃ ";
  10977. if (tz == null) {
  10978. tz = temp;
  10979. } else {
  10980. tz += " " + temp;
  10981. }
  10982. }
  10983. if (mzBlRecord.sphygmus != null && mzBlRecord.sphygmus != 0) {
  10984. var temp = "脉搏:" + mzBlRecord.sphygmus + "次/分 ";
  10985. if (tz == null) {
  10986. tz = temp;
  10987. } else {
  10988. tz += " " + temp;
  10989. }
  10990. }
  10991. if (mzBlRecord.breathe != null && mzBlRecord.breathe != 0) {
  10992. var temp = "呼吸:" + mzBlRecord.breathe + "次/分 ";
  10993. if (tz == null) {
  10994. tz = temp;
  10995. } else {
  10996. tz += " " + temp;
  10997. }
  10998. }
  10999. if (mzBlRecord.pressureHigh != null && mzBlRecord.pressureFloor != null && mzBlRecord.pressureHigh != 0 && mzBlRecord.pressureFloor != 0) {
  11000. var temp = "血压:" + mzBlRecord.pressureHigh + "/" + mzBlRecord.pressureFloor + " mmhg";
  11001. if (tz == null) {
  11002. tz = temp;
  11003. } else {
  11004. tz += " " + temp;
  11005. }
  11006. }
  11007. if (mzBlRecord.pressureHighLeft != null && mzBlRecord.pressureFloorLeft != null && mzBlRecord.pressureHighLeft != 0 && mzBlRecord.pressureFloorLeft != 0) {
  11008. var temp = "左血压:" + mzBlRecord.pressureHighLeft + "/" + mzBlRecord.pressureFloorLeft;
  11009. if (tz == null) {
  11010. tz = temp;
  11011. } else {
  11012. tz += " " + temp;
  11013. }
  11014. }
  11015. if (mzBlRecord.emrPe != null && mzBlRecord.emrPe != "") {
  11016. if (tz == null) {
  11017. tz = mzBlRecord.emrPe;
  11018. } else {
  11019. tz += "," + mzBlRecord.emrPe;
  11020. }
  11021. }
  11022. return tz;
  11023. }
  11024. /**
  11025. * 打印医技申请单
  11026. * @param patientId
  11027. * @param times
  11028. * @param type 申请单类型:2:检验;3:检查
  11029. * @param printType 打印模式 1 预览打印 2 打印设置
  11030. */
  11031. function printYjReq(patientId, times, type, printType) {
  11032. $.ajax({
  11033. type: "GET",
  11034. url: '/thmz/printYjReq?patientId=' + patientId + '&times=' + times + "&reqType=" + type,
  11035. contentType: "application/json;charset=UTF-8",
  11036. dataType: "json",
  11037. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11038. success: function (res) {
  11039. if (res == '401' || res == 401) {
  11040. window.location.href = '/thmz/login/view'
  11041. return;
  11042. }
  11043. if (res.code == 0) {
  11044. if (res.data == null || res.data.mzYjReqList == null || res.data.mzYjReqList.length == 0) {
  11045. errorMesageSimaple("没有医技申请单可以打印");
  11046. return;
  11047. }
  11048. setPrint();
  11049. LODOP = getLodop();
  11050. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院检查申请单");
  11051. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  11052. //设置默认打印机
  11053. LODOP.SET_PRINTER_INDEX(printIndex);
  11054. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  11055. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  11056. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  11057. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "检查申请单");//对新建的纸张重命名
  11058. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  11059. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  11060. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  11061. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  11062. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  11063. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  11064. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  11065. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  11066. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  11067. var mzPatientMi = res.data.mzPatientMi;
  11068. $("#patientIdJcReq").text(mzPatientMi.patientId);
  11069. $("#patientNameJcReq").text(mzPatientMi.name);
  11070. $("#patientGenderJcReq").text(mzPatientMi.gender);
  11071. $("#patientAgeJcReq").text(mzPatientMi.ageString);
  11072. $("#responseTypeJcReq").text(mzPatientMi.responseTypeName);
  11073. $("#patientCardNoJcReq").text(mzPatientMi.icCardNo);
  11074. $("#icdTextJcReq").text(res.data.icdText);
  11075. $("#patientIdJyReq").text(mzPatientMi.patientId);
  11076. $("#patientNameJyReq").text(mzPatientMi.name);
  11077. $("#patientGenderJyReq").text(mzPatientMi.gender);
  11078. $("#patientAgeJyReq").text(mzPatientMi.ageString);
  11079. $("#responseTypeJyReq").text(mzPatientMi.responseTypeName);
  11080. $("#patientCardNoJyReq").text(mzPatientMi.icCardNo);
  11081. $("#icdTextJyReq").text(res.data.icdText);
  11082. var mzBlRecord = res.data.mzBlRecord;
  11083. $("#jcReqEmrChiefComplaint").text(mzBlRecord.emrChiefComplaint);
  11084. $("#jcReqHis").text(mzBlRecord.emrHpi);
  11085. $("#jyReqEmrChiefComplaint").text(mzBlRecord.emrChiefComplaint);
  11086. $("#jyReqHis").text(mzBlRecord.emrHpi);
  11087. var tz = getTz(mzBlRecord);
  11088. $("#jcReqTz").text(tz);
  11089. $("#jcReqReqDept").text(res.data.deptName);
  11090. $("#jcReqReqDoctor").text(res.data.doctorName);
  11091. $("#jyReqTz").text(tz);
  11092. $("#jyReqReqDept").text(res.data.deptName);
  11093. $("#jyReqReqDoctor").text(res.data.doctorName);
  11094. //检验报告列表名
  11095. 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><th style="min-height: 30px;border-bottom: 1px solid black;">单号</th></tr>';
  11096. var jyContent = "";
  11097. var needNewPageA = false;
  11098. for (var i = 0; i < res.data.mzYjReqList.length; i++) {
  11099. var obj = res.data.mzYjReqList[i];
  11100. if (i == 0) {
  11101. var dateStr = format(obj.reqDate, "yyyy-MM-dd");
  11102. $("#jcReqReqDate").text(dateStr);
  11103. $("#jyReqReqDate").text(dateStr);
  11104. }
  11105. if (obj.reqType == "3") {
  11106. if (i > 0) {
  11107. LODOP.NewPageA();
  11108. }
  11109. JsBarcode("#JcBarcode", obj.reqNo, {
  11110. lineColor: '#333', //线条颜色
  11111. width: 1, //线宽
  11112. height: 26, //条码高度
  11113. displayValue: false, //是否显示文字信息
  11114. });
  11115. $("#reqNoJcReq").text(obj.reqNo);
  11116. $("#jcReqItem").text(obj.groupName);
  11117. $("#jcReqRemark").text(obj.jyRemark);
  11118. $("#jcComment8").text(obj.comment8);
  11119. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("jc_card_table").innerHTML);
  11120. needNewPageA = true;
  11121. } else if (obj.reqType == "2") {
  11122. let inspectName = (obj.inspectName == null || obj.inspectName == "null") ? "" : obj.inspectName;
  11123. jyContent += '<tr><td>' + obj.execName + '</td><td style="min-height: 30px;">' + obj.groupName + '</td><td>' + inspectName + '</td><td>' + obj.reqNo + '</td></tr>';
  11124. JsBarcode("#JyBarcode", obj.reqNo, {
  11125. lineColor: '#333', //线条颜色
  11126. width: 1, //线宽
  11127. height: 26, //条码高度
  11128. displayValue: false, //是否显示文字信息
  11129. });
  11130. }
  11131. }
  11132. if (jyContent != null && jyContent != "" && jyContent.length > 0) {
  11133. if (needNewPageA) {
  11134. LODOP.NewPageA();
  11135. }
  11136. jyContent = jyTitle + jyContent;
  11137. $("#jyContent").html(jyContent);
  11138. //检验
  11139. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("jy_card_table").innerHTML);
  11140. }
  11141. if (printType == 1) {
  11142. LODOP.PREVIEW();
  11143. } else if (printType == 2) {
  11144. LODOP.PRINT_SETUP();
  11145. }
  11146. } else {
  11147. errorMesage(res);
  11148. }
  11149. }
  11150. });
  11151. }
  11152. /**
  11153. * 打印门诊病历
  11154. * @param patientId
  11155. * @param times
  11156. * @param clnicId
  11157. * @param payMark
  11158. * @param printType 打印模式 1 预览打印 2 打印设置
  11159. */
  11160. function printBlRecord(patientId, times, printType) {
  11161. if(printType == 1){
  11162. saveMzPrescriptionPrint(patientId,times)
  11163. }
  11164. $.ajax({
  11165. type: "GET",
  11166. url: '/thmz/getMzBlrecord?patientId=' + patientId + '&times=' + times,
  11167. contentType: "application/json;charset=UTF-8",
  11168. dataType: "json",
  11169. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11170. success: function (res) {
  11171. if (res == '401' || res == 401) {
  11172. window.location.href = '/thmz/login/view'
  11173. return;
  11174. }
  11175. if (res.code == 0) {
  11176. setPrint();
  11177. LODOP = getLodop();
  11178. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院门诊病历");
  11179. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  11180. //设置默认打印机
  11181. LODOP.SET_PRINTER_INDEX(printIndex);
  11182. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  11183. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  11184. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  11185. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊病历");//对新建的纸张重命名
  11186. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  11187. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  11188. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  11189. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  11190. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  11191. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  11192. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  11193. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  11194. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  11195. var mzPatientMi = res.mzPatientMi;
  11196. $("#patientIdBlrecord").text(mzPatientMi.patientId);
  11197. $("#patientNameBlrecord").text(mzPatientMi.name);
  11198. $("#patientGenderBlrecord").text(mzPatientMi.gender);
  11199. $("#patientAgeBlrecord").text(mzPatientMi.ageString);
  11200. var mzBlRecord = res.mzBlRecord;
  11201. if (mzBlRecord.firstOrNot == "1") {
  11202. $("#firstOrNotTitle").text("复诊");
  11203. } else {
  11204. $("#firstOrNotTitle").text("初诊");
  11205. }
  11206. if (mzBlRecord.emrChiefComplaint != null && mzBlRecord.emrChiefComplaint != "") {
  11207. $("#emrChiefComplaintBlrecord").text(mzBlRecord.emrChiefComplaint);
  11208. $("#emrChiefComplaintBlrecord").parent().css("display", "block");
  11209. } else {
  11210. $("#emrChiefComplaintBlrecord").parent().css("display", "none");
  11211. }
  11212. if (mzBlRecord.emrHpi != null && mzBlRecord.emrHpi != "") {
  11213. $("#emrHpiBlrecord").text(mzBlRecord.emrHpi);
  11214. $("#emrHpiBlrecord").parent().css("display", "block");
  11215. } else {
  11216. $("#emrHpiBlrecord").parent().css("display", "none");
  11217. }
  11218. if (mzBlRecord.emrPs != null && mzBlRecord.emrPs != "") {
  11219. $("#emrPsBlrecord").text(mzBlRecord.emrPs);
  11220. $("#emrPsBlrecord").parent().css("display", "block");
  11221. } else {
  11222. $("#emrPsBlrecord").parent().css("display", "none");
  11223. }
  11224. if (mzBlRecord.personalHistory != null && mzBlRecord.personalHistory != "") {
  11225. $("#personalHistoryBlrecord").text(mzBlRecord.personalHistory);
  11226. $("#personalHistoryBlrecord").parent().css("display", "block");
  11227. } else {
  11228. $("#personalHistoryBlrecord").parent().css("display", "none");
  11229. }
  11230. if (mzBlRecord.familyHistory != null && mzBlRecord.familyHistory != "") {
  11231. $("#familyHistoryBlrecord").text(mzBlRecord.familyHistory);
  11232. $("#familyHistoryBlrecord").parent().css("display", "block");
  11233. } else {
  11234. $("#familyHistoryBlrecord").parent().css("display", "none");
  11235. }
  11236. if (mzBlRecord.fzZl != null && mzBlRecord.fzZl != "") {
  11237. $("#fzZlBlrecord").text(mzBlRecord.fzZl);
  11238. $("#fzZlBlrecord").parent().css("display", "block");
  11239. } else {
  11240. $("#fzZlBlrecord").parent().css("display", "none");
  11241. }
  11242. if (mzBlRecord.obstericalHistory != null && mzBlRecord.obstericalHistory != "") {
  11243. $("#obstericalHistoryBlrecord").text(mzBlRecord.obstericalHistory);
  11244. $("#obstericalHistoryBlrecord").parent().css("display", "block");
  11245. } else {
  11246. $("#obstericalHistoryBlrecord").parent().css("display", "none");
  11247. }
  11248. var patientAllergenInfoList = res.patientAllergenInfoList;
  11249. if (patientAllergenInfoList != null && patientAllergenInfoList.length > 0) {
  11250. var zdAllergen = null;
  11251. for (var i = 0; i < patientAllergenInfoList.length; i++) {
  11252. var patientAllergenInfo = patientAllergenInfoList[i];
  11253. if (zdAllergen == null) {
  11254. zdAllergen = patientAllergenInfo.allergenName;
  11255. } else {
  11256. zdAllergen += "," + patientAllergenInfo.allergenName;
  11257. }
  11258. }
  11259. $("#zdAllergenBlrecord").text(zdAllergen);
  11260. $("#zdAllergenBlrecord").parent().css("display", "block");
  11261. } else {
  11262. $("#zdAllergenBlrecord").parent().css("display", "none");
  11263. }
  11264. var tz = getTz(mzBlRecord);
  11265. if (tz != null && tz != "") {
  11266. $("#emrPeBlrecord").text(tz);
  11267. $("#emrPeBlrecord").parent().css("display", "block");
  11268. } else {
  11269. $("#emrPeBlrecord").parent().css("display", "none");
  11270. }
  11271. // if (mzBlRecord.emrPe != null && mzBlRecord.emrPe != "") {
  11272. // $("#emrPeBlrecord").text(mzBlRecord.emrPe);
  11273. // $("#emrPeBlrecord").parent().css("display", "block");
  11274. // } else {
  11275. // $("#emrPeBlrecord").parent().css("display", "none");
  11276. // }
  11277. if (res.icdText != null && res.icdText != "") {
  11278. $("#icdTextBlrecord").text(res.icdText);
  11279. $("#icdTextBlrecord").parent().css("display", "block");
  11280. } else {
  11281. $("#icdTextBlrecord").parent().css("display", "none");
  11282. }
  11283. if (mzBlRecord.emrProcess != null && mzBlRecord.emrProcess != "") {
  11284. $("#emrProcessBlrecord").html(mzBlRecord.emrProcess);
  11285. $("#emrProcessBlrecord").parent().css("display", "block");
  11286. } else {
  11287. $("#emrProcessBlrecord").parent().css("display", "none");
  11288. }
  11289. if (mzBlRecord.emrJkjy != null && mzBlRecord.emrJkjy != "") {
  11290. $("#emrJkjyBlrecord").text(mzBlRecord.emrJkjy);
  11291. $("#emrJkjyBlrecord").parent().css("display", "block");
  11292. } else {
  11293. $("#emrJkjyBlrecord").parent().css("display", "none");
  11294. }
  11295. $("#visitDeptBlrecord").text(res.deptName);
  11296. $("#visitDateBlrecord").text(res.visitDate);
  11297. getAjaxRequst("/thmz/getDoctorSignatureImage",{doctorCode:mzBlRecord.doctorCode},false,function (hostRes) {
  11298. if(hostRes.code ==0){
  11299. $("#doctorSignBlrecord").html("<img src='" + hostRes.data + "' style='width:150px;height:25px;'/>")
  11300. }
  11301. })
  11302. //LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("mz_blrecord_card_table").innerHTML);
  11303. //上边距 左边距 宽 高
  11304. LODOP.ADD_PRINT_HTM("20mm", "5mm", "130mm", "168mm", strStyle + document.getElementById("mz_bl_content").innerHTML);
  11305. LODOP.SET_PRINT_STYLEA(0, "Vorient", 3);
  11306. LODOP.ADD_PRINT_HTM("0mm", "5mm", "130mm", "20mm", strStyle + document.getElementById("mz_bl_title").innerHTML);
  11307. LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
  11308. LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
  11309. LODOP.ADD_PRINT_HTM("190mm", "5mm", "130mm", "20mm", strStyle + document.getElementById("mz_bl_foot").innerHTML);
  11310. LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
  11311. LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
  11312. if (printType == 1) {
  11313. LODOP.PREVIEW();
  11314. } else if (printType == 2) {
  11315. LODOP.PRINT_SETUP();
  11316. }
  11317. } else {
  11318. errorMesage(res);
  11319. }
  11320. }
  11321. });
  11322. }
  11323. /**
  11324. * 打印入院通知单
  11325. * @param patientId
  11326. * @param times
  11327. * @param clnicId
  11328. * @param payMark
  11329. * @param printType 打印模式 1 预览打印 2 打印设置
  11330. */
  11331. function printZyReq(patientId, printType) {
  11332. $.ajax({
  11333. type: "GET",
  11334. url: '/thmz/printZyReq?patientId=' + patientId,
  11335. contentType: "application/json;charset=UTF-8",
  11336. dataType: "json",
  11337. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11338. success: function (res) {
  11339. if (res == '401' || res == 401) {
  11340. window.location.href = '/thmz/login/view'
  11341. return;
  11342. }
  11343. if (res.code == 0) {
  11344. setPrint();
  11345. LODOP = getLodop();
  11346. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院入院通知单");
  11347. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  11348. //设置默认打印机
  11349. LODOP.SET_PRINTER_INDEX(printIndex);
  11350. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  11351. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  11352. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  11353. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "入院通知单");//对新建的纸张重命名
  11354. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  11355. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  11356. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  11357. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  11358. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  11359. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  11360. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  11361. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  11362. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  11363. var mzPatientMi = res.mzPatientMi;
  11364. var mzZyReq = res.mzZyReq;
  11365. $("#patientIdZyReq").text(mzPatientMi.patientId);
  11366. $("#patientNameZyReq").text(mzPatientMi.name);
  11367. $("#patientGenderZyReq").text(mzPatientMi.gender);
  11368. $("#patientAgeZyReq").text(mzPatientMi.ageString);
  11369. $("#sfzZyReq").text(mzPatientMi.socialNo);
  11370. $("#birthDateZyReq").text(format(mzPatientMi.birthDay, "yyyy-MM-dd"));
  11371. $("#phoneZyReq").text(mzPatientMi.phoneNo);
  11372. $("#responseTypeZyReq").text(mzPatientMi.responseTypeName);
  11373. $("#addressZyReq").text(mzPatientMi.address);
  11374. if (mzZyReq.icdCode == null || mzZyReq.icdCode == "" || mzZyReq.icdCode.length == 0) {
  11375. $("#icsCodeZyReq").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
  11376. $("#icsTextZyReq").text(mzZyReq.icdText);
  11377. } else {
  11378. $("#icsCodeZyReq").text(mzZyReq.icdCode);
  11379. $("#icsTextZyReq").text(mzZyReq.icdText);
  11380. }
  11381. $("#reqDeptZyReq").text(mzZyReq.reqWardName);
  11382. $("#smallDeptZyReq").text(mzZyReq.smallDeptName);
  11383. $("#routeOfAdmissionName").text(mzZyReq.routeOfAdmissionName);
  11384. //$("#admissStatusZyReq").text(mzZyReq.admissStatus);
  11385. // $("input:checkbox[value='" + mzZyReq.admissStatus + "']").attr('checked', 'true');
  11386. $("input:checkbox[name='admissStatusZyReq']").each(function (i, e) {
  11387. $(this).removeAttr("checked");
  11388. if ($(this).val() == Number(mzZyReq.admissStatus) || $(this).val() == mzZyReq.admissStatus) {
  11389. $(this).attr("checked", true)
  11390. }
  11391. });
  11392. $("#visitDateZyReq").text(format(mzZyReq.visitDate, "yyyy-MM-dd HH:mm:ss"));
  11393. $("#deptCodeZyReq").text(mzZyReq.deptName);
  11394. getAjaxRequst("/thmz/getDoctorSignatureImage",{doctorCode:mzZyReq.doctorCode},false,function (signRes) {
  11395. if(signRes.code == 0){
  11396. $("#doctorCodeZyReq").html("<img src='" + signRes.data + "' style='width:100px;height:23px;'/>")
  11397. }else {
  11398. $("#doctorCodeZyReq").text(mzZyReq.doctorName);
  11399. }
  11400. })
  11401. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("mz_zy_req_table").innerHTML);
  11402. if (printType == 1) {
  11403. LODOP.PREVIEW();
  11404. } else if (printType == 2) {
  11405. LODOP.PRINT_SETUP();
  11406. }
  11407. } else {
  11408. errorMesage(res);
  11409. }
  11410. }
  11411. });
  11412. }
  11413. /**
  11414. * 打印门诊手术请单
  11415. * @param patientId
  11416. * @param times
  11417. * @param printType 打印模式 1 预览打印 2 打印设置
  11418. */
  11419. function printOpRecord(patientId, times, printType) {
  11420. $.ajax({
  11421. type: "GET",
  11422. url: '/thmz/printOpRecord?patientId=' + patientId + '&times=' + times,
  11423. contentType: "application/json;charset=UTF-8",
  11424. dataType: "json",
  11425. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11426. success: function (res) {
  11427. if (res == '401' || res == 401) {
  11428. window.location.href = '/thmz/login/view'
  11429. return;
  11430. }
  11431. if (res.code == 0) {
  11432. if (res.data == null || res.data.length == 0) {
  11433. errorMesageSimaple("没有手术申请单可以打印");
  11434. return;
  11435. }
  11436. setPrint();
  11437. LODOP = getLodop();
  11438. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院门诊手术申请单");
  11439. LODOP.SET_PRINT_STYLE("FontSize", 13); //字体大小
  11440. //设置默认打印机
  11441. LODOP.SET_PRINTER_INDEX(printIndex);
  11442. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  11443. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  11444. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  11445. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊手术申请单");//对新建的纸张重命名
  11446. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  11447. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  11448. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  11449. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  11450. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  11451. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  11452. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  11453. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  11454. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  11455. var mzPatientMi = res.mzPatientMi;
  11456. $("#patientIdOpRecord").text(mzPatientMi.patientId);
  11457. $("#patientNameOpRecord").text(mzPatientMi.name);
  11458. $("#patientGenderOpRecord").text(mzPatientMi.gender);
  11459. $("#patientAgeOpRecord").text(mzPatientMi.ageString);
  11460. $("#responseTypeOpRecord").text(mzPatientMi.responseTypeName);
  11461. $("#patientCardNoOpRecord").text(mzPatientMi.icCardNo);
  11462. var needNewPageA = false;
  11463. for (var i = 0; i < res.data.length; i++) {
  11464. var obj = res.data[i];
  11465. //$("#reqNoOpRecord").text(obj.recordId);
  11466. $("#icdTextOpRecord").text(obj.diagBeforeOp);
  11467. $("#opNameOpRecord").text(obj.opName);
  11468. $("#hocusCodeOpRecord").text(obj.hocusCodeName);
  11469. $("#opScaleOpRecord").text(obj.opScaleName);
  11470. var dateStr = format(obj.applyDate, "yyyy-MM-dd HH:mm:ss");
  11471. $("#applyDateOpRecord").text(dateStr);
  11472. $("#opDatetimeOpRecord").text(obj.opDatetimeStr);
  11473. $("#doctorZdOpRecord").text(obj.doctorZdName);
  11474. $("#remarkOpRecord").text(obj.remark);
  11475. if (i > 0) {
  11476. LODOP.NewPageA();
  11477. }
  11478. JsBarcode("#JcBarcode", obj.recordId, {
  11479. lineColor: '#333', //线条颜色
  11480. width: 1, //线宽
  11481. height: 26, //条码高度
  11482. displayValue: false, //是否显示文字信息
  11483. });
  11484. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("op_record_card_table").innerHTML);
  11485. needNewPageA = true;
  11486. }
  11487. if (printType == 1) {
  11488. LODOP.PREVIEW();
  11489. } else if (printType == 2) {
  11490. LODOP.PRINT_SETUP();
  11491. }
  11492. } else {
  11493. errorMesage(res);
  11494. }
  11495. }
  11496. });
  11497. }
  11498. /**
  11499. * 打开查看检查检验报告窗口(含往期)
  11500. * @param patientId
  11501. */
  11502. function previewYjReqAll(patientId) {
  11503. $("#visitingDetailModal").modal("hide");
  11504. $("#previewYjReqModal").modal();
  11505. $("#previewYjReqModalPatientId").val(patientId);
  11506. $("#previewYjReqModalTimes").val(null);
  11507. //重置参数
  11508. retryCount = 0;
  11509. initJcJyTable();
  11510. }
  11511. /**
  11512. * 打开查看检查检验报告窗口
  11513. * @param patientId 门诊病人ID
  11514. * @param times 就诊次数
  11515. */
  11516. function previewYjReq(patientId, times) {
  11517. $("#visitingDetailModal").modal("hide");
  11518. $("#previewYjReqModal").modal();
  11519. $("#previewYjReqModalPatientId").val(patientId);
  11520. $("#previewYjReqModalTimes").val(times);
  11521. //重置参数
  11522. retryCount = 0;
  11523. initJcJyTable();
  11524. }
  11525. /**
  11526. * 删除本次处方
  11527. * @param clnicId 就诊记录id
  11528. */
  11529. function deletePrescription(clnicId) {
  11530. $("#visitingDetailModal").modal("hide");
  11531. $("#messageModal").modal();
  11532. $("#messageContent").html("确认要删除本次处方信息吗?");
  11533. $("#messageButton").off("click").on("click", function (t) {
  11534. $("#messageModal").modal("hide");
  11535. $.ajax({
  11536. type: "GET",
  11537. url: '/thmz/deletePrescription?clnicId=' + clnicId,
  11538. contentType: "application/json;charset=UTF-8",
  11539. dataType: "json",
  11540. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11541. success: function (res) {
  11542. if (res == '401' || res == 401) {
  11543. window.location.href = '/thmz/login/view'
  11544. return;
  11545. }
  11546. if (res.code == 0) {
  11547. successMesage(res);
  11548. $("#tb_table_clinic").bootstrapTable('refresh');
  11549. } else {
  11550. errorMesage(res);
  11551. }
  11552. }
  11553. });
  11554. });
  11555. $("#cancelButton").off("click").on("click", function (t) {
  11556. $("#visitingDetailModal").modal();
  11557. });
  11558. ;
  11559. }
  11560. /**
  11561. * 检查检验列表类型按钮切换事件
  11562. * @param object
  11563. */
  11564. function jcjyButtonChange(object) {
  11565. $("#jcjy_group").find("button").each(function (index, element) {
  11566. if ($(element).hasClass("btn-primary")) {
  11567. $(element).removeClass("btn-primary").addClass("btn-default");
  11568. }
  11569. });
  11570. $(object).removeClass("btn-default").addClass("btn-primary");
  11571. initJcJyTable();
  11572. }
  11573. /**
  11574. * 初始化检查检验报告列表
  11575. */
  11576. function initJcJyTable() {
  11577. clearInspectionDetail();
  11578. clearJcDetail();
  11579. var typeIndex = getIndex("jcjy_group");
  11580. if (typeIndex == 0) {
  11581. //检查
  11582. $('#tb_jy_pName_table_list').bootstrapTable("destroy");
  11583. $('#tb_jy_table_list').bootstrapTable("destroy");
  11584. initJcListTable();
  11585. $("#jy_detail").removeClass("in").addClass("hide");
  11586. $("#jc_detail").removeClass("hide").addClass("in");
  11587. } else {
  11588. $('#tb_table_list').bootstrapTable("destroy");
  11589. initJyListTable();
  11590. $("#jc_detail").removeClass("in").addClass("hide");
  11591. $("#jy_detail").removeClass("hide").addClass("in");
  11592. }
  11593. }
  11594. /**
  11595. * 初始化检查报告列表
  11596. */
  11597. function initJcListTable() {
  11598. $('#tb_table_list').bootstrapTable("destroy");
  11599. $('#tb_table_list').bootstrapTable({
  11600. url: '/thmz/getJcJyList', //请求后台的URL(*)
  11601. method: 'post', //请求方式(*)
  11602. toolbar: '#toolbar', //工具按钮用哪个容器
  11603. striped: true, //是否显示行间隔色
  11604. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  11605. pagination: true, //是否显示分页(*)
  11606. sortable: true, //是否启用排序
  11607. sortOrder: "asc", //排序方式
  11608. queryParams: queryParams, //传递参数(*)
  11609. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  11610. pageNumber: 1, //初始化加载第一页,默认第一页
  11611. pageSize: 5, //每页的记录行数(*)
  11612. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  11613. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  11614. strictSearch: true,
  11615. showColumns: false, //是否显示所有的列
  11616. showRefresh: false, //是否显示刷新按钮
  11617. minimumCountColumns: 2, //最少允许的列数
  11618. clickToSelect: true, //是否启用点击选中行
  11619. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  11620. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  11621. cardView: false, //是否显示详细视图
  11622. detailView: false,
  11623. //rowStyle:rowStyle,//通过自定义函数设置行样式
  11624. ajaxOptions: {
  11625. headers: {
  11626. 'Accept': 'application/json',
  11627. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  11628. }
  11629. },
  11630. columns: [
  11631. {
  11632. field: 'groupName',
  11633. title: '项目名称',
  11634. align: "center",
  11635. valign: 'middle',
  11636. }, {
  11637. field: 'reqDate',
  11638. title: '申请时间',
  11639. align: "center",
  11640. valign: 'middle',
  11641. formatter: function (value, row, index) {
  11642. if (value == null || value == "") {
  11643. return "";
  11644. }
  11645. return format(value, "yyyy-MM-dd HH:mm:ss");
  11646. }
  11647. }
  11648. ],
  11649. onClickRow: function (row) {
  11650. clearJcDetail();
  11651. $("#patientId_t").text(row.patientId);
  11652. $("#name_t").text(row.patientName);
  11653. $("#date_t").text(format(row.reqDate, "yyyy-MM-dd HH:mm:ss"));
  11654. fitJcDetail(row.reqNo, row.patientId);
  11655. },
  11656. responseHandler: function (res) {
  11657. if (res == '401' || res == 401) {
  11658. window.location.href = '/thmz/login/view'
  11659. return;
  11660. }
  11661. var ress = eval(res);
  11662. if (ress.code == -1) {
  11663. if (ress.message != null && ress.message != '') {
  11664. errorMesage(ress);
  11665. }
  11666. if (retryCount == 0) {
  11667. retryCount++;
  11668. $("#jyButton").click();
  11669. return;
  11670. }
  11671. return {
  11672. "total": 0,//总页数
  11673. "rows": {} //数据
  11674. };
  11675. }
  11676. if (ress.count <= 0 && retryCount == 0) {
  11677. retryCount++;
  11678. $("#jyButton").click();
  11679. return;
  11680. }
  11681. //有数据的时候,计数也需要加1,防止这时医生自己候点击检验没数据又跳回检查
  11682. retryCount++;
  11683. return {
  11684. "total": ress.count,//总页数
  11685. "rows": ress.data //数据
  11686. };
  11687. },
  11688. onLoadSuccess: function (data) {
  11689. $(".pagination-detail").css("display", "none");
  11690. }
  11691. });
  11692. }
  11693. /**
  11694. * 构建列表查询参数
  11695. * @param params
  11696. * @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}}
  11697. */
  11698. function queryParams(params) {
  11699. var patientId = $("#previewYjReqModalPatientId").val();
  11700. var times = $("#previewYjReqModalTimes").val();
  11701. return {
  11702. reqType: "3",
  11703. patientId: patientId,
  11704. times: times,
  11705. pageSize: params.limit, //页面大小
  11706. pageIndex: params.offset / params.limit //页码
  11707. };
  11708. };
  11709. /**
  11710. * 加载检查明细
  11711. * @param reqNo
  11712. */
  11713. function fitJcDetail(reqNo, patientId) {
  11714. $.ajax({
  11715. type: "GET",
  11716. url: '/thmz/getYjJcRecordReport?hisReqNo=' + reqNo + "&patientId=" + patientId,
  11717. contentType: "application/json;charset=UTF-8",
  11718. dataType: "json",
  11719. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11720. success: function (res) {
  11721. if (res == '401' || res == 401) {
  11722. window.location.href = '/thmz/login/view'
  11723. return;
  11724. }
  11725. if (res.code == 0) {
  11726. canBePrintJc = true;
  11727. $("#jy_detail").removeClass("in").addClass("hide");
  11728. $("#jc_detail").removeClass("hide").addClass("in");
  11729. var mzPatientMi = res.data.mzPatientMi;
  11730. $("#gender_jc").text(mzPatientMi.gender);
  11731. $("#age_jc").text(mzPatientMi.ageString);
  11732. var yjJcRecordReport = res.data.yjJcRecordReport;
  11733. $("#groupName").text(res.data.groupName);
  11734. $("#textJc").text(yjJcRecordReport.textJc);
  11735. $("#textZd").text(yjJcRecordReport.textZd);
  11736. var jcRecord = res.data.jcRecord;
  11737. $("#report_no").text(jcRecord.reportNo);
  11738. $("#reportId").text(jcRecord.reportId);
  11739. if (jcRecord.reportDate == null || jcRecord.reportDate == "") {
  11740. $("#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;");
  11741. } else {
  11742. $("#reportDate").text(format(jcRecord.reportDate, "yyyy-MM-dd HH:mm:ss"));
  11743. }
  11744. $("#confirmId").text(jcRecord.confirmId);
  11745. if (jcRecord.confirmDate == null || jcRecord.confirmDate == "") {
  11746. $("#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;");
  11747. } else {
  11748. $("#confirmDate").text(format(jcRecord.confirmDate, "yyyy-MM-dd HH:mm:ss"));
  11749. }
  11750. } else {
  11751. errorMesage(res);
  11752. }
  11753. }
  11754. });
  11755. }
  11756. /**
  11757. * 清空检查明细
  11758. * @param reqNo
  11759. */
  11760. function clearJcDetail() {
  11761. canBePrintJc = false;
  11762. $("#patientId_t").text("");
  11763. $("#name_t").text("");
  11764. $("#date_t").text("");
  11765. $("#gender_jc").text("");
  11766. $("#age_jc").text("");
  11767. $("#groupName").text("");
  11768. $("#textJc").text("");
  11769. $("#textZd").text("");
  11770. $("#report_no").text("");
  11771. $("#reportId").text("");
  11772. $("#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;");
  11773. $("#confirmId").text("");
  11774. $("#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;");
  11775. }
  11776. /**
  11777. * 初始化检验报告列表
  11778. */
  11779. function initJyListTable() {
  11780. var patientId = $("#previewYjReqModalPatientId").val();
  11781. var times = $("#previewYjReqModalTimes").val();
  11782. $('#tb_table_list').bootstrapTable("destroy");
  11783. $('#tb_table_list').bootstrapTable({
  11784. url: '/thmz/getJyListByPatientIdAndTimes?patientId=' + patientId + "&times=" + times, //请求后台的URL(*)
  11785. method: 'get', //请求方式(*)
  11786. toolbar: '#toolbar', //工具按钮用哪个容器
  11787. striped: true, //是否显示行间隔色
  11788. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  11789. pagination: true, //是否显示分页(*)
  11790. sortable: true, //是否启用排序
  11791. sortOrder: "asc", //排序方式
  11792. //queryParams: queryJyPNameParams, //传递参数(*)
  11793. sidePagination: "client", //分页方式:client客户端分页,server服务端分页(*)
  11794. pageNumber: 1, //初始化加载第一页,默认第一页
  11795. pageSize: 5, //每页的记录行数(*)
  11796. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  11797. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  11798. strictSearch: true,
  11799. showColumns: false, //是否显示所有的列
  11800. showRefresh: false, //是否显示刷新按钮
  11801. minimumCountColumns: 2, //最少允许的列数
  11802. clickToSelect: true, //是否启用点击选中行
  11803. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  11804. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  11805. cardView: false, //是否显示详细视图
  11806. detailView: false,
  11807. //rowStyle:rowStyle,//通过自定义函数设置行样式
  11808. ajaxOptions: {
  11809. headers: {
  11810. 'Accept': 'application/json',
  11811. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  11812. }
  11813. },
  11814. columns: [
  11815. {
  11816. field: 'aply_CTNT',
  11817. title: '检验名称',
  11818. align: "center",
  11819. valign: 'middle',
  11820. }, {
  11821. field: 'ordr_CREATE_DATE',
  11822. title: '检验时间',
  11823. align: "center",
  11824. valign: 'middle',
  11825. formatter: function (value, row, index) {
  11826. if (value == null || value == "") {
  11827. return "";
  11828. }
  11829. return format(value, "yyyy-MM-dd HH:mm:ss");
  11830. }
  11831. }
  11832. ],
  11833. onClickRow: function (row) {
  11834. queryInspectionDetail(row.ordr_ID);
  11835. },
  11836. responseHandler: function (res) {
  11837. if (res == '401' || res == 401) {
  11838. window.location.href = '/thmz/login/view'
  11839. return;
  11840. }
  11841. var ress = eval(res);
  11842. if (ress.code == -1) {
  11843. if (retryCount == 0) {
  11844. retryCount++;
  11845. $("#jcButton").click();
  11846. return;
  11847. }
  11848. if (ress.message != null && ress.message != '') {
  11849. errorMesage(ress);
  11850. }
  11851. return {
  11852. "total": ress.data.length,//总页数
  11853. "rows": ress.data //数据
  11854. };
  11855. }
  11856. if (ress.data.length <= 0 && retryCount == 0) {
  11857. retryCount++;
  11858. $("#jcButton").click();
  11859. return;
  11860. }
  11861. //有数据的时候,计数也需要加1,防止这时医生自己候点击检查没数据又跳回检验
  11862. retryCount++;
  11863. return {
  11864. "total": ress.data.length,//总页数
  11865. "rows": ress.data //数据
  11866. };
  11867. },
  11868. onLoadSuccess: function (data) {
  11869. $("#jy_table_table_div").find(".pagination-detail").css("display", "none");
  11870. }
  11871. });
  11872. }
  11873. /**
  11874. * 清空检验明细
  11875. * @param orderId
  11876. */
  11877. function clearInspectionDetail() {
  11878. canBePrintJy = false;
  11879. $("#patientId_t_jy").text("");
  11880. $("#name_t_jy").text("");
  11881. $("#gender_jy").text("");
  11882. $("#age_jy").text("");
  11883. $("#reqDept_t_jy").text("");
  11884. $("#bed_no_jy").text("");
  11885. $("#smpl_jy").text("");
  11886. $("#item_jy").text("");
  11887. $("#applyDate").text("");
  11888. $("#orderCreateDate").text("");
  11889. $("#auditTime").text("");
  11890. $("#orderUsrName").text("");
  11891. $("#testUsrName").text("");
  11892. $("#auditUsrName").text("");
  11893. $("#jyBody").html("");
  11894. }
  11895. /**
  11896. * 加载检验明细
  11897. * @param orderId
  11898. */
  11899. function queryInspectionDetail(orderId) {
  11900. clearInspectionDetail();
  11901. $.ajax({
  11902. type: "GET",
  11903. url: '/thmz/getInspectionDetail?orderId=' + orderId,
  11904. contentType: "application/json;charset=UTF-8",
  11905. dataType: "json",
  11906. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11907. success: function (res) {
  11908. if (res == '401' || res == 401) {
  11909. window.location.href = '/thmz/login/view'
  11910. return;
  11911. }
  11912. if (res.code == 0) {
  11913. canBePrintJy = true;
  11914. $("#jc_detail").removeClass("in").addClass("hide");
  11915. $("#jy_detail").removeClass("hide").addClass("in");
  11916. var mzPatientMi = res.mzPatientMi;
  11917. $("#patientId_t_jy").text(mzPatientMi.patientId);
  11918. $("#name_t_jy").text(mzPatientMi.name);
  11919. $("#gender_jy").text(mzPatientMi.gender);
  11920. $("#age_jy").text(mzPatientMi.ageString);
  11921. var html = "";
  11922. if (res.data != null) {
  11923. var inspectionHeader = res.data.inspectionHeader;
  11924. $("#reqDept_t_jy").text(inspectionHeader.dept_NAME);
  11925. $("#bed_no_jy").text(inspectionHeader.ptnt_BED_NO);
  11926. $("#smpl_jy").text(inspectionHeader.smpl_NAME);
  11927. $("#item_jy").text(inspectionHeader.aply_CNTN);
  11928. $("#applyDate").text(format(inspectionHeader.aply_DATE, "yyyy-MM-dd HH:mm:ss"));
  11929. $("#orderCreateDate").text(format(inspectionHeader.ordr_CREATE_DATE, "yyyy-MM-dd HH:mm:ss"));
  11930. $("#auditTime").text(format(inspectionHeader.audt_TIME, "yyyy-MM-dd HH:mm:ss"));
  11931. $("#orderUsrName").text(inspectionHeader.doc_NAME);
  11932. $("#testUsrName").text(inspectionHeader.test_USR_NAME);
  11933. $("#auditUsrName").text(inspectionHeader.audt_USR_NAME);
  11934. var inspectionItems = res.data.inspectionItems;
  11935. if (inspectionItems != null && inspectionItems.length > 0) {
  11936. for (var i = 0; i < inspectionItems.length; i++) {
  11937. html += "<tr>";
  11938. var obj = inspectionItems[i];
  11939. var itm_VALUE = obj.itm_VALUE;
  11940. if (itm_VALUE == null || itm_VALUE == "null") {
  11941. itm_VALUE = "";
  11942. }
  11943. itm_VALUE += (obj.itm_STR_VALUE == null || obj.itm_STR_VALUE == "null") ? "" : obj.itm_STR_VALUE;
  11944. var range = obj.range;
  11945. if (range == null || range == "null") {
  11946. range = "";
  11947. }
  11948. range += (obj.range_STR == null || obj.range_STR == "null") ? "" : obj.range_STR;
  11949. html += "<td width='25%'>" + obj.itm_NAME + "</td>";
  11950. html += "<td width='16.66%'>" + itm_VALUE + "</td>";
  11951. html += "<td width='16.66%'>" + obj.itm_UNIT + "</td>";
  11952. if (obj.itm_ALERT == null || obj.itm_ALERT == "") {
  11953. html += "<td width='16.66%'><span style=\"color:#67C23A;font-weight:bold\"></span></td>";
  11954. } else if (obj.itm_ALERT == "H") {
  11955. html += "<td width='16.66%'><span style=\"color:#F56C6C;font-weight:bold\">↑</span></td>";
  11956. } else if (obj.itm_ALERT == "L") {
  11957. html += "<td width='16.66%'><span style=\"color:#F56C6C;font-weight:bold\">↓</span></td>";
  11958. }
  11959. html += "<td width='25%'>" + range + "</td>";
  11960. html += "</tr>";
  11961. var bacteriaResults = obj.bacteriaResults;
  11962. if (bacteriaResults == null || bacteriaResults.length == 0) {
  11963. continue;
  11964. }
  11965. var bacteriaResult = bacteriaResults[0];
  11966. if (bacteriaResult == null || bacteriaResult.length == 0) {
  11967. continue;
  11968. }
  11969. var antibioticResults = bacteriaResult.antibioticResults;
  11970. if (antibioticResults == null || antibioticResults.length == 0) {
  11971. continue;
  11972. }
  11973. 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>';
  11974. for (var j = 0; j < antibioticResults.length; j++) {
  11975. var antibioticResultsObj = antibioticResults[j];
  11976. html += "<tr>";
  11977. html += "<td width='35%' style='padding-left: 2%;";
  11978. if (j == 0) {
  11979. html += "border-top: 1px solid black;";
  11980. }
  11981. html += "'>" + antibioticResultsObj.anti_NAME_CN + "</td>";
  11982. html += "<td width='20%' ";
  11983. if (j == 0) {
  11984. html += "style='border-top: 1px solid black;'";
  11985. }
  11986. html += ">" + antibioticResultsObj.anti_ABB + "</td>";
  11987. html += "<td width='25%' ";
  11988. if (j == 0) {
  11989. html += "style='border-top: 1px solid black;'";
  11990. }
  11991. html += ">" + antibioticResultsObj.anti_MIC + "</td>";
  11992. html += "<td width='20%' style='padding-right: 2%;";
  11993. if (j == 0) {
  11994. html += "border-top: 1px solid black;";
  11995. }
  11996. html += "'>" + antibioticResultsObj.anti_VALUE + "</td>";
  11997. html += "</tr>";
  11998. }
  11999. }
  12000. }
  12001. }
  12002. $("#jyBody").html(html);
  12003. } else {
  12004. errorMesage(res);
  12005. }
  12006. }
  12007. });
  12008. }
  12009. /**
  12010. * 打印检查检验报告单
  12011. * @param printType 打印模式 1 预览打印 2 打印设置
  12012. */
  12013. function printJyJcReport(printType) {
  12014. var typeIndex = getIndex("jcjy_group");
  12015. var title = "检查报告单";
  12016. if (typeIndex == 1) {
  12017. title = "检验报告单"
  12018. if (!canBePrintJy) {
  12019. warningMesageSimaple("没有任何【" + title + "】可供打印!");
  12020. return;
  12021. }
  12022. } else {
  12023. if (!canBePrintJc) {
  12024. warningMesageSimaple("没有任何【" + title + "】可供打印!");
  12025. return;
  12026. }
  12027. }
  12028. setPrint();
  12029. LODOP = getLodop();
  12030. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院" + title);
  12031. LODOP.SET_PRINT_STYLE("FontSize", 7); //字体大小
  12032. //设置默认打印机
  12033. LODOP.SET_PRINTER_INDEX(printIndex);
  12034. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  12035. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  12036. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  12037. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", title);//对新建的纸张重命名
  12038. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  12039. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  12040. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  12041. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  12042. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  12043. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  12044. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  12045. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  12046. var strStyle = "<style>table{width: 96%;} #jy_detail_content thead {border-bottom: 1px solid black;border-collapse: collapse;}</style>";
  12047. if (typeIndex == 0) {
  12048. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("jc_detail").innerHTML);
  12049. }
  12050. if (typeIndex == 1) {
  12051. LODOP.ADD_PRINT_TABLE("37mm", "5mm", "130mm", "138mm", strStyle + document.getElementById("jy_detail_content").innerHTML);
  12052. LODOP.SET_PRINT_STYLEA(0, "Vorient", 3);
  12053. LODOP.ADD_PRINT_HTM("0mm", "5mm", "130mm", "200mm", strStyle + document.getElementById("jy_detail_title").innerHTML);
  12054. LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
  12055. LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
  12056. LODOP.ADD_PRINT_HTM("177mm", "5mm", "130mm", "200mm", strStyle + document.getElementById("jy_detail_foot").innerHTML);
  12057. LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
  12058. LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
  12059. }
  12060. if (printType == 1) {
  12061. LODOP.PREVIEW();
  12062. } else if (printType == 2) {
  12063. LODOP.PRINT_SETUP();
  12064. }
  12065. }
  12066. /**
  12067. * 初始化科室下拉选
  12068. */
  12069. function initExecUnit() {
  12070. //父科室列表
  12071. $.ajax({
  12072. type: "GET",
  12073. url: '/thmz/allUnitCode',
  12074. dataType: "json",
  12075. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  12076. success: function (data) {
  12077. if (data == '401' || data == 401) {
  12078. window.location.href = '/thmz/login/view'
  12079. return;
  12080. }
  12081. $('#execUnit').empty(); //清空resText里面的所有内容
  12082. $('#zlExecUnit').empty(); //清空resText里面的所有内容
  12083. var html = '';
  12084. $.each(data.data, function (commentIndex, comment) {
  12085. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + '-' + comment.code + ')</option>';
  12086. });
  12087. $('#execUnit').html(html);
  12088. $('#execUnit').selectpicker('refresh');
  12089. $('#zlExecUnit').html(html);
  12090. $('#zlExecUnit').selectpicker('refresh');
  12091. }
  12092. });
  12093. }
  12094. /**
  12095. * 初始化证件类型下拉选
  12096. */
  12097. function initCertificateTypeSelect() {
  12098. $.ajax({
  12099. type: "GET",
  12100. url: '/thmz/listCertificateType',
  12101. contentType: "application/json;charset=UTF-8",
  12102. dataType: "json",
  12103. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  12104. success: function (res) {
  12105. if (res == '401' || res == 401) {
  12106. window.location.href = '/thmz/login/view'
  12107. return;
  12108. }
  12109. if (res.code == 0) {
  12110. res.data.forEach(function (item, index) {
  12111. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  12112. $('#rapidAcceptsUserCertificateType').append(html);
  12113. $('#editUserCertificateType').append(html);
  12114. $('#crbMainCardCertificateType').append(html);
  12115. });
  12116. $('#rapidAcceptsUserCertificateType').selectpicker('refresh');
  12117. $('#editUserCertificateType').selectpicker('refresh');
  12118. $('#crbMainCardCertificateType').selectpicker('refresh');
  12119. } else {
  12120. errorMesage(res);
  12121. }
  12122. }
  12123. });
  12124. }
  12125. /**
  12126. * 加载病历信息编辑预览
  12127. * @param patientId
  12128. * @param times
  12129. * @param type 1 编辑 2 预览
  12130. */
  12131. function showMzBlRecordModal(patientId, times, type) {
  12132. $.ajax({
  12133. type: "GET",
  12134. url: '/thmz/getMzBlrecord?patientId=' + patientId + '&times=' + times,
  12135. contentType: "application/json;charset=UTF-8",
  12136. dataType: "json",
  12137. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  12138. success: function (res) {
  12139. if (res == '401' || res == 401) {
  12140. window.location.href = '/thmz/login/view'
  12141. return;
  12142. }
  12143. if (res.code == 0) {
  12144. var mzPatientMi = res.mzPatientMi;
  12145. $("#editPatientId").text(mzPatientMi.patientId);
  12146. $("#editPatientName").text(mzPatientMi.name);
  12147. $("#editPatientGender").text(mzPatientMi.gender);
  12148. $("#editPatientAge").text(mzPatientMi.ageString);
  12149. var mzBlRecord = res.mzBlRecord;
  12150. $("#editEmrChiefComplaint").val(mzBlRecord.emrChiefComplaint == null ? "" : mzBlRecord.emrChiefComplaint);
  12151. $("#editEmrHpi").val(mzBlRecord.emrHpi == null ? "" : mzBlRecord.emrHpi);
  12152. $("#editEmrPs").val(mzBlRecord.emrPs == null ? "" : mzBlRecord.emrPs);
  12153. $("#editPersonalHistory").val(mzBlRecord.personalHistory == null ? "" : mzBlRecord.personalHistory);
  12154. $("#editFamilyHistory").val(mzBlRecord.familyHistory == null ? "" : mzBlRecord.familyHistory);
  12155. $("#editFzZl").val(mzBlRecord.fzZl == null ? "" : mzBlRecord.fzZl);
  12156. $("#editObstericalHistory").val(mzBlRecord.obstericalHistory == null ? "" : mzBlRecord.obstericalHistory);
  12157. $("#editQtjc").val(mzBlRecord.emrPe == null ? "" : mzBlRecord.emrPe);
  12158. setSelectedAttr("editZd", mzBlRecord.icdCode, mzBlRecord.icdText);
  12159. var patientAllergenInfoList = res.patientAllergenInfoList;
  12160. if (patientAllergenInfoList != null && patientAllergenInfoList.length > 0) {
  12161. var zdAllergen = [];
  12162. var ypDitList = [];
  12163. var zdAllergenHtml = '';
  12164. var ypDitListHtml = '';
  12165. var zdAllergeCodes = null;
  12166. var zdAllergeTexts = null;
  12167. var ypDitListodes = null;
  12168. var ypDitListTexts = null;
  12169. for (var i = 0; i < patientAllergenInfoList.length; i++) {
  12170. var patientAllergenInfo = patientAllergenInfoList[i];
  12171. if (patientAllergenInfo.type == 0 || patientAllergenInfo.type == '0') {
  12172. zdAllergen[zdAllergen.length] = patientAllergenInfo.allergenCode;
  12173. zdAllergenHtml += '<option value="' + patientAllergenInfo.allergenCode + '">' + patientAllergenInfo.allergenName + '</option>';
  12174. if (zdAllergeCodes == null) {
  12175. zdAllergeCodes = patientAllergenInfo.allergenCode;
  12176. zdAllergeTexts = patientAllergenInfo.allergenName;
  12177. } else {
  12178. zdAllergeCodes += "," + patientAllergenInfo.allergenCode;
  12179. zdAllergeTexts += "," + patientAllergenInfo.allergenName;
  12180. }
  12181. } else if (patientAllergenInfo.type == 1 || patientAllergenInfo.type == '1') {
  12182. ypDitList[ypDitList.length] = patientAllergenInfo.allergenCode;
  12183. ypDitListHtml += '<option value="' + patientAllergenInfo.allergenCode + '">' + patientAllergenInfo.allergenName + '</option>';
  12184. if (zdAllergeCodes == null) {
  12185. ypDitListodes = patientAllergenInfo.allergenCode;
  12186. ypDitListTexts = patientAllergenInfo.allergenName;
  12187. } else {
  12188. ypDitListodes += "," + patientAllergenInfo.allergenCode;
  12189. ypDitListTexts += "," + patientAllergenInfo.allergenName;
  12190. }
  12191. }
  12192. }
  12193. $("#editZdAllergen").empty();
  12194. $('#editZdAllergen').append(zdAllergenHtml);
  12195. $('#editZdAllergen').selectpicker('refresh');
  12196. $("#editYpDitList").empty();
  12197. $('#editYpDitList').append(ypDitListHtml);
  12198. $('#editYpDitList').selectpicker('refresh');
  12199. $("#editZdAllergen").selectpicker('val', zdAllergen);
  12200. $("#editZdAllergen").selectpicker('refresh');
  12201. $("#editYpDitList").selectpicker('val', ypDitList);
  12202. $("#editYpDitList").selectpicker('refresh');
  12203. $("#editZdAllergen").attr("selectedCodes", zdAllergeCodes);
  12204. $("#editZdAllergen").attr("selectedTexts", zdAllergeTexts);
  12205. $("#editYpDitList").attr("selectedCodes", ypDitListodes);
  12206. $("#editYpDitList").attr("selectedTexts", ypDitListTexts);
  12207. }
  12208. var tentativeDiagnosis = mzBlRecord.tentativeDiagnosis == null ? "" : mzBlRecord.tentativeDiagnosis;
  12209. if ((mzBlRecord.icdCode == null || mzBlRecord.icdCode == "") && mzBlRecord.icdText != null && mzBlRecord.icdText != "") {
  12210. if (tentativeDiagnosis == null || tentativeDiagnosis == "") {
  12211. tentativeDiagnosis = mzBlRecord.icdText;
  12212. } else {
  12213. tentativeDiagnosis = mzBlRecord.icdText + " " + tentativeDiagnosis;
  12214. }
  12215. }
  12216. $("#edittentativeDiagnosis").val(tentativeDiagnosis);
  12217. $("#editEmrJkjy").val(mzBlRecord.emrJkjy == null ? "" : mzBlRecord.emrJkjy);
  12218. $("#bl_weight").val(mzBlRecord.weight == 0 ? null : mzBlRecord.weight);
  12219. $("#bl_temperature").val(mzBlRecord.temperature == 0 ? null : mzBlRecord.temperature);
  12220. $("#bl_sphygmus").val(mzBlRecord.sphygmus == 0 ? null : mzBlRecord.sphygmus);
  12221. $("#bl_breathe").val(mzBlRecord.breathe == 0 ? null : mzBlRecord.breathe);
  12222. $("#bl_pressure_high").val(mzBlRecord.pressureHigh == 0 ? null : mzBlRecord.pressureHigh);
  12223. $("#bl_pressure_floor").val(mzBlRecord.pressureFloor == 0 ? null : mzBlRecord.pressureFloor);
  12224. $("#bl_pressure_high_left").val(mzBlRecord.pressureHighLeft == 0 ? null : mzBlRecord.pressureHighLeft);
  12225. $("#bl_pressure_floor_left").val(mzBlRecord.pressureFloorLeft == 0 ? null : mzBlRecord.pressureFloorLeft);
  12226. if (mzBlRecord.emrProcess != null && mzBlRecord.emrProcess != "") {
  12227. var reg = new RegExp("</br>", "g");//g,表示全部替换。
  12228. var editEmrProcess = mzBlRecord.emrProcess.replace(reg, "\n");
  12229. reg = new RegExp("&nbsp;", "g");//g,表示全部替换。
  12230. editEmrProcess = editEmrProcess.replace(reg, "");
  12231. $("#editEmrProcess").val(editEmrProcess);
  12232. } else {
  12233. $("#editEmrProcess").val("");
  12234. }
  12235. if (type == 1) {
  12236. $("#mzBlRecorTitle").html("门诊病历【编辑】");
  12237. $("#setOtherEmrProcess").removeClass("in").addClass("hide");
  12238. $("#openBlRecordModel").removeClass("hide").addClass("in");
  12239. $("#setEmrProcess").removeClass("hide").addClass("in");
  12240. $("#visitingDetailModal").modal("hide");
  12241. } else if (type == 2) {
  12242. $("#mzBlRecorTitle").html("门诊病历【预览】");
  12243. $("#setOtherEmrProcess").removeClass("hide").addClass("in");
  12244. $("#openBlRecordModel").removeClass("in").addClass("hide");
  12245. $("#setEmrProcess").removeClass("in").addClass("hide");
  12246. //因为预览的时候,关闭预览框没有清空数据,且 此时基础数据的病历次数被清空
  12247. if ($("#mzBlTimes").val() != null && $("#mzBlTimes").val() != "" && ($("#baseMzBlTimes").val() == null || $("#baseMzBlTimes").val() == "")) {
  12248. $("#baseMzBlTimes").val($("#mzBlTimes").val());
  12249. }
  12250. $("#otherBlRecordModal").modal("hide");
  12251. }
  12252. $("#mzBlTimes").val(mzBlRecord.times);
  12253. $("#editMzBlRecordModal").modal();
  12254. } else {
  12255. errorMesage(res);
  12256. }
  12257. }
  12258. });
  12259. }
  12260. /**
  12261. * 清空区域
  12262. */
  12263. function clearInput() {
  12264. //编辑病历的时候,没有基础病历的就诊次数,如果是预览病历的时候,有基础病历的次数
  12265. var baseMzBlTimes = $("#baseMzBlTimes").val();
  12266. $("#editPatientId").text(null);
  12267. $("#editPatientName").text(null);
  12268. $("#editPatientGender").text(null);
  12269. $("#editPatientAge").text(null);
  12270. $("#editEmrChiefComplaint").val(null);
  12271. $("#editEmrHpi").val(null);
  12272. $("#editEmrPs").val(null);
  12273. $("#editPersonalHistory").val(null);
  12274. $("#editFamilyHistory").val(null);
  12275. $("#editFzZl").val(null);
  12276. $("#editObstericalHistory").val(null);
  12277. $("#bl_weight").val(null);
  12278. $("#bl_sphygmus").val(null);
  12279. $("#bl_breathe").val(null);
  12280. $("#bl_pressure_high").val(null);
  12281. $("#bl_pressure_floor").val(null);
  12282. $("#bl_pressure_high_left").val(null);
  12283. $("#bl_pressure_floor_left").val(null);
  12284. $("#editQtjc").val(null);
  12285. $("#editZd").selectpicker('val', null);
  12286. $("#editZd").selectpicker('refresh');
  12287. $("#edittentativeDiagnosis").val(null);
  12288. $("#editEmrProcess").val(null);
  12289. $("#editEmrJkjy").val(null);
  12290. $("#mzBlTimes").val(null);
  12291. if (baseMzBlTimes != null && baseMzBlTimes != "") {
  12292. $("#otherBlRecordModal").modal();
  12293. }
  12294. }
  12295. /**
  12296. * 保存门诊病历
  12297. */
  12298. function setEmrProcess() {
  12299. $("#editMzBlRecordModal").modal("hide");
  12300. $("#messageModal").modal();
  12301. $("#messageContent").html("确认修改当前门诊病历吗?");
  12302. $("#messageButton").off("click").on("click", function (t) {
  12303. $("#messageModal").modal("hide");
  12304. sendEmrProcess();
  12305. });
  12306. $("#cancelButton").off("click").on("click", function (t) {
  12307. $("#editMzBlRecordModal").modal();
  12308. });
  12309. }
  12310. /**
  12311. * 提交保存门诊病历
  12312. */
  12313. function sendEmrProcess() {
  12314. //修改告警人员
  12315. var icdCodes = $("#editZd").val();
  12316. var icdCodeStr = null;
  12317. if (icdCodes != null && icdCodes.length > 0) {
  12318. for (var i = 0; i < icdCodes.length; i++) {
  12319. if (icdCodeStr == null) {
  12320. icdCodeStr = icdCodes[i];
  12321. } else {
  12322. icdCodeStr += "," + icdCodes[i];
  12323. }
  12324. }
  12325. }
  12326. //设置过敏源
  12327. var patientAllergenInfoList = [];
  12328. var zdAllergen = $("#editZdAllergen").val();
  12329. var ypDitList = $("#editYpDitList").val();
  12330. if (zdAllergen != null && zdAllergen.length > 0) {
  12331. for (var i = 0; i < zdAllergen.length; i++) {
  12332. var tempJson = JSON.parse('{}');
  12333. tempJson.allergenCode = zdAllergen[i];
  12334. tempJson.type = 0;
  12335. patientAllergenInfoList[patientAllergenInfoList.length] = tempJson;
  12336. }
  12337. }
  12338. if (ypDitList != null && ypDitList.length > 0) {
  12339. for (var i = 0; i < ypDitList.length; i++) {
  12340. var tempJson = JSON.parse('{}');
  12341. tempJson.allergenCode = ypDitList[i];
  12342. tempJson.type = 1;
  12343. patientAllergenInfoList[patientAllergenInfoList.length] = tempJson;
  12344. }
  12345. }
  12346. $.ajax({
  12347. type: "POST",
  12348. url: '/thmz/setEmrProcess',
  12349. contentType: "application/json;charset=UTF-8",
  12350. dataType: "json",
  12351. data: JSON.stringify({
  12352. "patientId": $("#editPatientId").text(),
  12353. "times": $("#mzBlTimes").val(),
  12354. "emrChiefComplaint": $("#editEmrChiefComplaint").val(),
  12355. "emrHpi": $("#editEmrHpi").val(),
  12356. "emrPs": $("#editEmrPs").val(),
  12357. "personalHistory": $("#editPersonalHistory").val(),
  12358. "familyHistory": $("#editFamilyHistory").val(),
  12359. "fzZl": $("#editFzZl").val(),
  12360. "obstericalHistory": $("#editObstericalHistory").val(),
  12361. "emrPe": $("#editQtjc").val(),
  12362. "weight": $("#bl_weight").val(),
  12363. "temperature": $("#bl_temperature").val(),
  12364. "sphygmus": $("#bl_sphygmus").val(),
  12365. "breathe": $("#bl_breathe").val(),
  12366. "pressureHigh": $("#bl_pressure_high").val(),
  12367. "pressureFloor": $("#bl_pressure_floor").val(),
  12368. "pressureHighLeft": $("#bl_pressure_high_left").val(),
  12369. "pressureFloorLeft": $("#bl_pressure_floor_left").val(),
  12370. "icdCode": icdCodeStr,
  12371. "icdText": $('#editZd').next().attr("title"),
  12372. "tentativeDiagnosis": $("#edittentativeDiagnosis").val(),
  12373. "emrJkjy": $("#editEmrJkjy").val(),
  12374. "emrProcess": $("#editEmrProcess").val(),
  12375. "patientAllergenInfoList": patientAllergenInfoList
  12376. }),
  12377. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  12378. success: function (res) {
  12379. if (res == '401' || res == 401) {
  12380. window.location.href = '/thmz/login/view'
  12381. return;
  12382. }
  12383. if (res.code == 0) {
  12384. clearInput();
  12385. successMesage(res);
  12386. $("#editMzBlRecordModal").modal("hide");
  12387. } else {
  12388. errorMesage(res);
  12389. }
  12390. }
  12391. });
  12392. }
  12393. /**
  12394. * 打开待合并病历列表弹框
  12395. */
  12396. function openBlRecordModel() {
  12397. $("#editMzBlRecordModal").modal("hide");
  12398. $("#otherBlRecordModal").modal();
  12399. initOtherMzBlRecordList();
  12400. }
  12401. /**
  12402. * 关闭待合并病历列表
  12403. */
  12404. function closeBlRecordModel() {
  12405. $('#baseMzBlTimes').val(null);
  12406. $("#visitingDetailModal").modal();
  12407. }
  12408. /**
  12409. * 病历列表
  12410. */
  12411. function initOtherMzBlRecordList() {
  12412. $('#other_bl_record_table').bootstrapTable("destroy");
  12413. $('#other_bl_record_table').bootstrapTable({
  12414. url: '/thmz/getMzBlRecordList', //请求后台的URL(*)
  12415. method: 'post', //请求方式(*)
  12416. toolbar: '#toolbar', //工具按钮用哪个容器
  12417. striped: true, //是否显示行间隔色
  12418. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  12419. pagination: true, //是否显示分页(*)
  12420. sortable: true, //是否启用排序
  12421. sortOrder: "desc", //排序方式
  12422. queryParams: queryOtherParams, //传递参数(*)
  12423. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  12424. pageNumber: 1, //初始化加载第一页,默认第一页
  12425. pageSize: 5, //每页的记录行数(*)
  12426. pageList: [10, 15, 25, 50, 100], //可供选择的每页的行数(*)
  12427. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  12428. strictSearch: true,
  12429. showColumns: false, //是否显示所有的列
  12430. showRefresh: false, //是否显示刷新按钮
  12431. minimumCountColumns: 2, //最少允许的列数
  12432. clickToSelect: true, //是否启用点击选中行
  12433. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  12434. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  12435. cardView: false, //是否显示详细视图
  12436. detailView: false,
  12437. //rowStyle:rowStyle,//通过自定义函数设置行样式
  12438. ajaxOptions: {
  12439. headers: {
  12440. 'Accept': 'application/json',
  12441. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  12442. }
  12443. },
  12444. columns: [
  12445. {
  12446. title: '操作',
  12447. field: 'op',
  12448. align: "center",
  12449. valign: 'middle',
  12450. formatter: function (value, row, index) {
  12451. 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>';
  12452. return [str].join('');
  12453. }
  12454. },
  12455. {
  12456. field: 'patientId',
  12457. title: '门诊ID',
  12458. align: "center",
  12459. valign: 'middle'
  12460. }, {
  12461. field: 'patientName',
  12462. title: '患者姓名',
  12463. align: "center",
  12464. valign: 'middle'
  12465. }, {
  12466. field: 'deptCode',
  12467. title: '就诊科室',
  12468. align: "center",
  12469. valign: 'middle'
  12470. }, {
  12471. field: 'doctorCode',
  12472. title: '接诊医师',
  12473. align: "center",
  12474. valign: 'middle'
  12475. }, {
  12476. field: 'firstOrNot',
  12477. title: '初/复诊',
  12478. align: "center",
  12479. valign: 'middle',
  12480. formatter: function (value, row, index) {
  12481. if (value == '1') {
  12482. return "复诊";
  12483. }
  12484. return "初诊";
  12485. }
  12486. }
  12487. , {
  12488. field: 'visitDate',
  12489. title: '就诊时间',
  12490. align: "center",
  12491. valign: 'middle',
  12492. formatter: function (value, row, index) {
  12493. if (value == null || value == "") {
  12494. return "";
  12495. }
  12496. return format(value, "yyyy-MM-dd HH:mm:ss");
  12497. }
  12498. }
  12499. ],
  12500. responseHandler: function (res) {
  12501. if (res == '401' || res == 401) {
  12502. window.location.href = '/thmz/login/view'
  12503. return;
  12504. }
  12505. var ress = eval(res);
  12506. if (ress.code == -1) {
  12507. if (ress.message != null && ress.message != '') {
  12508. errorMesage(ress);
  12509. }
  12510. return {
  12511. "total": 0,//总页数
  12512. "rows": {} //数据
  12513. };
  12514. }
  12515. return {
  12516. "total": ress.total,//总页数
  12517. "rows": ress.data //数据
  12518. };
  12519. },
  12520. });
  12521. }
  12522. /**
  12523. * 构建列表查询参数
  12524. * @param params
  12525. * @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}}
  12526. */
  12527. function queryOtherParams(params) {
  12528. var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
  12529. patientId: $("#editPatientId").text(),
  12530. exceptTimes: $("#mzBlTimes").val(),
  12531. pageSize: params.limit, //页面大小
  12532. pageIndex: params.offset / params.limit, //页码
  12533. };
  12534. return temp;
  12535. }
  12536. /**
  12537. * 提取处理意见保存
  12538. */
  12539. function setOtherEmrProcess() {
  12540. $("#editMzBlRecordModal").modal("hide");
  12541. $("#messageModal").modal();
  12542. $("#messageContent").html("确定要执行此次提取处理意见操作吗?");
  12543. $("#messageButton").off("click").on("click", function (t) {
  12544. $("#messageModal").modal("hide");
  12545. $.ajax({
  12546. type: "GET",
  12547. url: '/thmz/extractEmrProcess?patientId=' + $("#editPatientId").html() + '&baseTimes=' + $("#baseMzBlTimes").val() + '&times=' + $("#mzBlTimes").val(),
  12548. contentType: "application/json;charset=UTF-8",
  12549. dataType: "json",
  12550. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  12551. success: function (res) {
  12552. if (res == '401' || res == 401) {
  12553. window.location.href = '/thmz/login/view'
  12554. return;
  12555. }
  12556. if (res.code == 0) {
  12557. successMesage(res);
  12558. $("#editMzBlRecordModal").modal("hide");
  12559. } else {
  12560. errorMesage(res);
  12561. }
  12562. }
  12563. });
  12564. });
  12565. $("#cancelButton").off("click").on("click", function (t) {
  12566. $("#editMzBlRecordModal").modal();
  12567. });
  12568. }
  12569. /**
  12570. * 医保电子凭证读卡
  12571. * @param params
  12572. */
  12573. function siReadCard(params) {
  12574. $.ajax({
  12575. type: "GET",
  12576. url: 'http://localhost:8321/readcard/entry?param=' + params,
  12577. contentType: "application/json;charset=UTF-8",
  12578. dataType: "json",
  12579. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  12580. success: function (res) {
  12581. if (res == '401' || res == 401) {
  12582. window.location.href = '/thmz/login/view'
  12583. return;
  12584. }
  12585. //console.log(res);
  12586. if (res.code == 200) {
  12587. var data = JSON.parse(res.data);
  12588. queryUserInfoBySocialNoNotFillPatient('rapidAcceptsUserCardNo', "" + data.data.idNo + "", queryUserInfoByCardNo, 'rapidAcceptsModal');
  12589. } else {
  12590. errorMesage(res);
  12591. }
  12592. }
  12593. });
  12594. // window.open('ReadCard://'+prm, '_self')
  12595. }
  12596. /**
  12597. * 西药品类按钮点击事件 因为原插件有点未解决bug,点击title的时候,加载的列表非对应的,
  12598. * @param paneId
  12599. */
  12600. function xyTableOnClick(paneId) {
  12601. setTimeout(function () {
  12602. $("#xyTabContent div.tab-pane").each(function (index, obj) {
  12603. var targetId = $(obj).attr("id");
  12604. //如果处方内容是空的,就删除没有处方
  12605. if ($(obj).find("div.cf_content").children().length == 0) {
  12606. $(obj).remove();
  12607. $("[href='#" + targetId + "']").parent().remove();
  12608. } else if (targetId == paneId) {
  12609. $(obj).addClass("active").addClass("in");
  12610. } else {
  12611. $(obj).removeClass("active").removeClass("in");
  12612. }
  12613. });
  12614. }, 400);
  12615. }
  12616. /**
  12617. * 打开转诊弹层
  12618. */
  12619. function transferTreatment() {
  12620. $("#turnDept").selectpicker({
  12621. size: 5
  12622. });
  12623. $("#turnToConsultationTitle").html("转诊");
  12624. $("#opType").val(1);
  12625. $("#turnToConsultationDoctorDiv").removeClass("hide").addClass("in");
  12626. $("#turnDeptDiv").removeClass("hide").addClass("in");
  12627. $("#consultationDeptDiv").removeClass("in").addClass("hide");
  12628. //科室列表
  12629. $.ajax({
  12630. type: "GET",
  12631. url: '/thmz/getUnitCodeByRequestDay',
  12632. dataType: "json",
  12633. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  12634. success: function (data) {
  12635. if (data == '401' || data == 401) {
  12636. window.location.href = '/thmz/login/view'
  12637. return;
  12638. }
  12639. var html = '';
  12640. $.each(data.data, function (commentIndex, comment) {
  12641. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';
  12642. });
  12643. $('#turnDept').empty();
  12644. $('#turnDept').html(html);
  12645. $('#turnDept').selectpicker('refresh');
  12646. }
  12647. });
  12648. $("#turnToConsultationModal").modal();
  12649. }
  12650. /**
  12651. * 打开会诊弹层
  12652. */
  12653. function consultation() {
  12654. $("#consultationDept").selectpicker({
  12655. size: 5
  12656. });
  12657. $("#turnToConsultationTitle").html("发起会诊");
  12658. $("#opType").val(2);
  12659. $("#turnToConsultationDoctorDiv").removeClass("in").addClass("hide");
  12660. $("#consultationDeptDiv").removeClass("hide").addClass("in");
  12661. $("#turnDeptDiv").removeClass("in").addClass("hide");
  12662. //科室列表
  12663. $.ajax({
  12664. type: "GET",
  12665. url: '/thmz/allMzUnitCode',
  12666. dataType: "json",
  12667. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  12668. success: function (res) {
  12669. if (res == '401' || res == 401) {
  12670. window.location.href = '/thmz/login/view'
  12671. return;
  12672. }
  12673. var html = '';
  12674. $.each(res.data, function (commentIndex, comment) {
  12675. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';
  12676. });
  12677. $('#consultationDept').empty();
  12678. $('#consultationDept').html(html);
  12679. $('#consultationDept').selectpicker('refresh');
  12680. $.ajax({
  12681. type: "GET",
  12682. url: '/thmz/getUnConsultation?serialNo=' + $("#mzfzSerialNoInClick").val(),
  12683. dataType: "json",
  12684. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  12685. success: function (res) {
  12686. if (res == '401' || res == 401) {
  12687. window.location.href = '/thmz/login/view'
  12688. return;
  12689. }
  12690. var data = res.data;
  12691. if (data != null && data.length > 0) {
  12692. $('#consultationDept').selectpicker('val', data);
  12693. $('#consultationDept').selectpicker('refresh');
  12694. }
  12695. }
  12696. });
  12697. }
  12698. });
  12699. $("#turnToConsultationModal").modal();
  12700. }
  12701. /**
  12702. * 清空转诊和发起会诊区域
  12703. */
  12704. function clearTurnToConsultationInput() {
  12705. $("#turnDept").selectpicker('val', null);
  12706. $("#turnDept").selectpicker('refresh');
  12707. $("#consultationDept").selectpicker('val', null);
  12708. $("#consultationDept").selectpicker('refresh');
  12709. $("#turnToConsultationDoctor").selectpicker('val', null);
  12710. $("#turnToConsultationDoctor").selectpicker('refresh');
  12711. $("#turnToConsultationId").val(null);
  12712. $("#opType").val(null);
  12713. $("#turnToConsultationDoctorDiv").removeClass("in").addClass("hide");
  12714. $("#turnDeptDiv").removeClass("in").addClass("hide");
  12715. $("#consultationDeptDiv").removeClass("in").addClass("hide");
  12716. }
  12717. /**
  12718. * 清空门诊统筹额外内容区域
  12719. */
  12720. function clearExpContentRequired() {
  12721. $("#mdtrtGrpType").selectpicker('val', null);
  12722. $("#mdtrtGrpType").selectpicker('refresh');
  12723. $("#trumFlag").selectpicker('val', null);
  12724. $("#trumFlag").selectpicker('refresh');
  12725. $("#relTtpFlag").selectpicker('val', null);
  12726. $("#relTtpFlag").selectpicker('refresh');
  12727. $("#otpErReflFlag").selectpicker('val', null);
  12728. $("#otpErReflFlag").selectpicker('refresh');
  12729. }
  12730. /**
  12731. * 清空门诊统筹支付参数区域
  12732. */
  12733. function clearZgtczfInput() {
  12734. $("#zgmztczf").selectpicker('val', null);
  12735. $("#zgmztczf").selectpicker('refresh');
  12736. $("#grzhzf").selectpicker('val', null);
  12737. $("#grzhzf").selectpicker('refresh');
  12738. $("#readCardResult").val(null);
  12739. }
  12740. /**
  12741. * 保存转诊/会诊
  12742. */
  12743. function setTurnToConsultation() {
  12744. $("#turnToConsultationModal").modal("hide");
  12745. $("#messageModal").modal();
  12746. var opType = $("#opType").val();
  12747. var targetDeptNo = $("#turnDept").val();
  12748. var title = "确认提交转诊操作吗,提交后您将无法继续接诊该患者?";
  12749. if (opType == 2 || opType == "2") {
  12750. title = "确认提交本次会诊操作吗?";
  12751. var consultationDept = $("#consultationDept").val();
  12752. if (consultationDept != null && consultationDept.length > 0) {
  12753. targetDeptNo = null;
  12754. for (var i = 0; i < consultationDept.length; i++) {
  12755. if (targetDeptNo == null) {
  12756. targetDeptNo = consultationDept[i];
  12757. } else {
  12758. targetDeptNo += "," + consultationDept[i];
  12759. }
  12760. }
  12761. }
  12762. }
  12763. $("#messageContent").html(title);
  12764. $("#messageButton").off("click").on("click", function (t) {
  12765. $("#messageModal").modal("hide");
  12766. $.ajax({
  12767. type: "POST",
  12768. url: '/thmz/saveTurnToConsultation',
  12769. contentType: "application/json;charset=UTF-8",
  12770. dataType: "json",
  12771. data: JSON.stringify({
  12772. "id": $("#turnToConsultationId").val(),
  12773. "opType": opType,
  12774. "targetDeptNo": targetDeptNo,
  12775. "targetDoctorNo": $("#turnToConsultationDoctor").val(),
  12776. "serialNo": $("#mzfzSerialNoInClick").val(),
  12777. "remark": $("#turnToConsultationRemark").val(),
  12778. }),
  12779. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  12780. success: function (res) {
  12781. if (res == '401' || res == 401) {
  12782. window.location.href = '/thmz/login/view'
  12783. return;
  12784. }
  12785. if (res.code == 0) {
  12786. successMesage(res);
  12787. clearTurnToConsultationInput();
  12788. if (opType == 1 || opType == "1") {
  12789. //加载候诊患者列表
  12790. loadUnClinicTableList();
  12791. //加载接诊中患者列表
  12792. loadInClinicTableList();
  12793. clearWorkSpace();
  12794. }
  12795. } else {
  12796. $("#turnToConsultationModal").modal();
  12797. errorMesage(res);
  12798. }
  12799. }
  12800. });
  12801. });
  12802. $("#cancelButton").off("click");
  12803. }
  12804. /**
  12805. * 初始医生下拉选
  12806. * @param ampm 时间段区间
  12807. */
  12808. function initEmployee() {
  12809. var opType = $("#opType").val();
  12810. if (opType == 2) {
  12811. return;
  12812. }
  12813. $("#turnToConsultationDoctor").selectpicker({
  12814. size: 5
  12815. });
  12816. //医生列表
  12817. $.ajax({
  12818. type: "GET",
  12819. url: '/thmz/getDoctorCodeByRequestDay?unitCode=' + $('#turnDept').val(),
  12820. dataType: "json",
  12821. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  12822. success: function (res) {
  12823. if (res == '401' || res == 401) {
  12824. window.location.href = '/thmz/login/view'
  12825. return;
  12826. }
  12827. var html = '';
  12828. var defaultCode = null;
  12829. $.each(res.data, function (commentIndex, comment) {
  12830. var employeeName = comment.employee.employeeName;
  12831. if (comment.leftNum != null) {
  12832. employeeName = employeeName + " 余号(" + comment.leftNum + ")"
  12833. }
  12834. html += '<option value="' + comment.employee.employeeCode + '" data-chargeType="' + comment.chargeType + '" data-checkFee="' + comment.checkFee + '" data-mzyRequestId="' + comment.mzyRequestId + '">' + employeeName + '</option>';
  12835. if (res.data.length == 1) {
  12836. //如果只有一个号别,默认选中
  12837. defaultCode = comment.employee.employeeCode;
  12838. }
  12839. });
  12840. $('#turnToConsultationDoctor').empty();
  12841. $('#turnToConsultationDoctor').html(html);
  12842. $('#turnToConsultationDoctor').selectpicker('refresh');
  12843. if (defaultCode != null) {
  12844. //如果有无需选择医生的选项,默认选择
  12845. $('#turnToConsultationDoctor').selectpicker('val', defaultCode);
  12846. $('#turnToConsultationDoctor').selectpicker('refresh');
  12847. }
  12848. }
  12849. });
  12850. }
  12851. /**
  12852. * 设置挂号号别
  12853. * @param patientId
  12854. * @param times
  12855. * @param reqType
  12856. */
  12857. function setMzReqType(patientId,times,reqType) {
  12858. if(stringIsBlank(reqType)){
  12859. postAjaxJsonHttpRequst("/thmz/queryMzOrderDetails",{patientId:patientId,times:times},true,function (res) {
  12860. if(res.code == 0 && res.data != null){
  12861. $("#mzReqTypeName").text(res.data.reqTypeName)
  12862. $("#mzReqType").val(res.data.reqType)
  12863. if(res.data.reqType == '45') {
  12864. $("#mzOrderTypeSelect").val('4');
  12865. $('#mzOrderTypeSelect').selectpicker('refresh');
  12866. }
  12867. }
  12868. })
  12869. }else {
  12870. getAjaxRequst("/thmz/getMzChargeTypeByCode",{code:reqType},true,function (res) {
  12871. if(res.code == 0 && res.data != null){
  12872. $("#mzReqType").val(reqType)
  12873. $("#mzReqTypeName").text(res.data.name)
  12874. if(reqType == '45'){
  12875. $("#mzOrderTypeSelect").val('4');
  12876. $('#mzOrderTypeSelect').selectpicker('refresh');
  12877. }
  12878. }
  12879. })
  12880. }
  12881. }
  12882. /**
  12883. * 选择处方类型进行效验
  12884. */
  12885. function verifyMzOrderType() {
  12886. let mzOrderTypeSelectVal = $("#mzOrderTypeSelect").val();
  12887. if(mzOrderTypeSelectVal == '3'){
  12888. if(stringIsBlank(curOpspDiseCode)){
  12889. errorMesageSimaple('不是特门病人,请先点击[查询特门]并选中特门编码!')
  12890. $("#mzOrderTypeSelect").val('1');
  12891. $('#mzOrderTypeSelect').selectpicker('refresh');
  12892. return
  12893. }
  12894. }
  12895. let mzReqTypeVal = $("#mzReqType").val()
  12896. if(mzOrderTypeSelectVal == '4' && mzReqTypeVal != '45'){
  12897. errorMesageSimaple('当前病人不是GCP实验类型,不能选择该选项!')
  12898. $("#mzOrderTypeSelect").val('1');
  12899. $('#mzOrderTypeSelect').selectpicker('refresh');
  12900. return
  12901. }
  12902. }
  12903. /**
  12904. * 初始化门诊处方类型下拉框
  12905. */
  12906. function initMzOrderTypeSelect() {
  12907. getAjaxRequst("/thmz/queryMzOrderType",{},true,function (res) {
  12908. let html = ''
  12909. $.each(res.data, function (commentIndex, comment) {
  12910. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  12911. });
  12912. $('#mzOrderTypeSelect').empty();
  12913. $('#mzOrderTypeSelect').html(html);
  12914. $('#mzOrderTypeSelect').selectpicker('refresh');
  12915. $('#mzOrderTypeSelect').val('1');
  12916. $('#mzOrderTypeSelect').selectpicker('refresh');
  12917. })
  12918. }
  12919. /**
  12920. * 选择门诊统筹支付时校验门诊诊断是否是标准诊断,校验医生是否具有医保编码
  12921. */
  12922. function verifyInsuranceInfo() {
  12923. var zgmztczf = $("#zgmztczf").val();
  12924. if (zgmztczf != null && (zgmztczf == 1 || zgmztczf == "1")) {
  12925. $('#mzOrderTypeSelect').val('2');
  12926. $('#mzOrderTypeSelect').selectpicker('refresh');
  12927. postAjaxJsonHttpRequst("/thmz/queryVisitTypeName",{patientId:$("#patientId").text()},true,function (res) {
  12928. if(res.code ==0){
  12929. if(!stringIsBlank(res.data)){
  12930. warningMesageSimaple("该患者为股东卡用户,选择医保门诊统筹将不能享受股东卡优惠,请告知患者,请悉知!")
  12931. }
  12932. }
  12933. })
  12934. var diagnoseValue = $("#diagnoseValue").val();
  12935. if (diagnoseValue == null || diagnoseValue == "" || diagnoseValue.length == 0) {
  12936. errorMesageSimaple("门诊统筹就诊必须使用标准的医保诊断,请修改诊断或者消门诊统筹选项");
  12937. // $("#zgmztczf").selectpicker('val', null);
  12938. // $("#zgmztczf").selectpicker('refresh');
  12939. return false;
  12940. }
  12941. diagnoseValue = diagnoseValue.replace(/,/g, "");
  12942. if (diagnoseValue == null || diagnoseValue == "" || diagnoseValue.length == 0) {
  12943. errorMesageSimaple("门诊统筹就诊必须使用标准的医保诊断,请修改诊断或者消门诊统筹选项");
  12944. // $("#zgmztczf").selectpicker('val', null);
  12945. // $("#zgmztczf").selectpicker('refresh');
  12946. return false;
  12947. }
  12948. var ybCode = localStorage.getItem("ybCode");
  12949. if (ybCode == null || ybCode == "" || ybCode.length == 0) {
  12950. errorMesageSimaple("您还没有医保赋码,无法进行门诊统筹接诊,请取消门诊统筹选项");
  12951. // $("#zgmztczf").selectpicker('val', null);
  12952. // $("#zgmztczf").selectpicker('refresh');
  12953. return false;
  12954. }
  12955. }else {
  12956. if($('#mzOrderTypeSelect').val() =='2'){
  12957. $('#mzOrderTypeSelect').val('1');
  12958. $('#mzOrderTypeSelect').selectpicker('refresh');
  12959. }
  12960. }
  12961. return true;
  12962. }
  12963. /**
  12964. * 已诊列表发起会诊
  12965. * @param patientId
  12966. */
  12967. function consultationCliniced(patientId) {
  12968. $.ajax({
  12969. type: "GET",
  12970. url: '/thmz/getLastClinicedFzOrder?patientId=' + patientId,
  12971. dataType: "json",
  12972. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  12973. success: function (res) {
  12974. if (res == '401' || res == 401) {
  12975. window.location.href = '/thmz/login/view'
  12976. return;
  12977. }
  12978. if (res.code == 0) {
  12979. $("#visitingDetailModal").modal("hide");
  12980. $("#mzfzSerialNoInClick").val(res.data.serialNo);
  12981. consultation();
  12982. } else {
  12983. errorMesage(res);
  12984. }
  12985. }
  12986. });
  12987. }
  12988. /**
  12989. * 计算诊疗金额
  12990. * @param flag true ,直接计算总价, false 还要计算总量
  12991. */
  12992. function calculateZl(flag) {
  12993. if (!flag) {
  12994. var itemQuantity = $("#itemQuantity").val();
  12995. if (itemQuantity == null) {
  12996. return;
  12997. }
  12998. var dayZlNum = $("#dayZlNum").val();
  12999. if (dayZlNum == null) {
  13000. return;
  13001. }
  13002. //频率
  13003. var times = $('#orderFrequencyZl').find("option:selected").attr('desc');
  13004. if (times == null) {
  13005. return;
  13006. }
  13007. var totalNumZl = Multiply(Multiply(itemQuantity, dayZlNum), times);
  13008. $("#totalNumZl").val(totalNumZl);
  13009. }
  13010. //总量
  13011. var totalNumZl = $("#totalNumZl").val();
  13012. if (totalNumZl == null) {
  13013. return;
  13014. }
  13015. //单价
  13016. var zlItemPrice = $("#zlItemPrice").val();
  13017. if (zlItemPrice == null) {
  13018. return;
  13019. }
  13020. $("#totalAmountZl").val(Multiply(totalNumZl, zlItemPrice));
  13021. }
  13022. /**
  13023. *打印外伤无第三方责任承诺书
  13024. */
  13025. function printNoThirdParty() {
  13026. printNoThirdPartyCommon(1);
  13027. }
  13028. /**
  13029. * 打印外伤无第三方责任承诺书
  13030. * @param printType 打印模式 1 预览打印 2 打印设置
  13031. */
  13032. function printNoThirdPartyCommon(printType) {
  13033. warningMesageSimaple("请提醒患者至医保窗口审核,审核通过方能报销!");
  13034. var title = "外伤无第三方责任承诺书";
  13035. setPrint();
  13036. LODOP = getLodop();
  13037. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院" + title);
  13038. LODOP.SET_PRINT_STYLE("FontSize", 7); //字体大小
  13039. //设置默认打印机
  13040. LODOP.SET_PRINTER_INDEX(printIndex);
  13041. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  13042. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  13043. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  13044. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", title);//对新建的纸张重命名
  13045. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  13046. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  13047. // var strStyle = "<style>table{width: 96%;}</style>";
  13048. var strStyle = "<style>table{width: 96%;margin-top: 20px;margin-bottom: 10px;} table,th {border-width: 1px;border-style: solid;border-collapse: collapse}</style>";
  13049. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("print_no_third_party_table").innerHTML);
  13050. if (printType == 1) {
  13051. LODOP.PREVIEW();
  13052. } else if (printType == 2) {
  13053. LODOP.PRINT_SETUP();
  13054. }
  13055. }
  13056. /**
  13057. * 打印自费承诺书
  13058. */
  13059. function printSelfPay() {
  13060. printSelfPayCommon(1);
  13061. }
  13062. /**
  13063. * 打印自费承诺书
  13064. * @param printType 打印模式 1 预览打印 2 打印设置
  13065. */
  13066. function printSelfPayCommon(printType) {
  13067. var title = "参保人员门诊统筹医保支付告知审核表";
  13068. setPrint();
  13069. LODOP = getLodop();
  13070. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院" + title);
  13071. LODOP.SET_PRINT_STYLE("FontSize", 7); //字体大小
  13072. //设置默认打印机
  13073. LODOP.SET_PRINTER_INDEX(printIndex);
  13074. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  13075. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  13076. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  13077. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", title);//对新建的纸张重命名
  13078. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  13079. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  13080. // var strStyle = "<style>table{width: 96%;}</style>";
  13081. //table,th {border-width: 1px;border-style: solid;border-collapse: collapse}
  13082. var strStyle = "<style>table{width: 96%;margin-top: 20px;margin-bottom: 10px;} </style>";
  13083. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("self_pay_table").innerHTML);
  13084. if (printType == 1) {
  13085. LODOP.PREVIEW();
  13086. } else if (printType == 2) {
  13087. LODOP.PRINT_SETUP();
  13088. }
  13089. }
  13090. /**
  13091. * 将科室缓存到内存中
  13092. */
  13093. function saveDeptConfig() {
  13094. var clinicDeptNo = $("#clinicDeptNo").val();
  13095. if (clinicDeptNo != null && clinicDeptNo != "") {
  13096. var userIdCode = localStorage.getItem("userIdCode");
  13097. localStorage.setItem(userIdCode, clinicDeptNo);
  13098. }
  13099. $("#selectDeptModal").modal("hide");
  13100. }
  13101. /**
  13102. * 合理用药药品说明书
  13103. */
  13104. function hlyyypsms() {
  13105. $("#western_medicine_name").webuiPopover('hide');
  13106. var code = $("#western_medicine_current_code").val();
  13107. var serial = $("#western_medicine_current_serial").val();
  13108. $("#hlyyTitle").html("药品说明书");
  13109. showHlyyModel('hlyysmsDiv', 'hlyysmsLoading', 'hlyysmsModal', "http://172.16.32.121:9097/web/sms/hpms_medi_show.aspx?his_code=" + code + "_" + serial);
  13110. }
  13111. /**
  13112. * 预约挂号
  13113. * @param patientId
  13114. */
  13115. function registration(patientId) {
  13116. clearRegistrationModal();
  13117. $("#patientIdRegistration").val(patientId);
  13118. $("#visitingDetailModal").modal('hide');
  13119. $("#registrationModal").modal();
  13120. }
  13121. /**
  13122. * 初始门诊时间区间下拉选
  13123. */
  13124. function initMzWorkTime() {
  13125. $("#ampm").selectpicker({
  13126. size: 10
  13127. });
  13128. $.ajax({
  13129. type: "GET",
  13130. url: '/thmz/getMzWorkTime',
  13131. dataType: "json",
  13132. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  13133. success: function (res) {
  13134. if (res == '401' || res == 401) {
  13135. window.location.href = '/thmz/login/view'
  13136. return;
  13137. }
  13138. var html = '';
  13139. var ampm = null;
  13140. $.each(res.data, function (commentIndex, comment) {
  13141. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  13142. // if (ampm == null || (ampm != "a" && ampm != "p")) {
  13143. // var startTime = paseToFullTime(comment.startTime);
  13144. // var endTime = paseToFullTime(comment.endTime);
  13145. // if (range(startTime, endTime)) {
  13146. // ampm = comment.code;
  13147. // }
  13148. // }
  13149. });
  13150. $('#ampm').empty(); //清空resText里面的所有内容
  13151. $('#ampm').html(html);
  13152. $('#ampm').selectpicker('refresh');
  13153. // $("#ampm").selectpicker('val', ampm);
  13154. // $('#ampm').selectpicker('refresh');
  13155. initDeptPlus(1);
  13156. }
  13157. });
  13158. }
  13159. /**
  13160. * 初始科室下拉选
  13161. * @param ampm 时间段区间
  13162. */
  13163. function initDeptPlus(type) {
  13164. var ampm = $("#ampm").val();
  13165. if (type == 1) {
  13166. setAmTimes(ampm);
  13167. }
  13168. $("#deptNo").selectpicker({
  13169. size: 10
  13170. });
  13171. var apTimes = $("#apTimes").val();
  13172. //科室列表
  13173. $.ajax({
  13174. type: "GET",
  13175. url: '/thmz/getUnitCodeByRequestDayAndAmpm?ampm=' + $("#ampm").val() + '&date=' + $("#registrationTime").val() + "&apTimes=" + apTimes,
  13176. dataType: "json",
  13177. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  13178. success: function (data) {
  13179. if (data == '401' || data == 401) {
  13180. window.location.href = '/thmz/login/view'
  13181. return;
  13182. }
  13183. var html = '';
  13184. $.each(data.data, function (commentIndex, comment) {
  13185. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';
  13186. });
  13187. $('#deptNo').empty();
  13188. $('#deptNo').html(html);
  13189. $('#deptNo').selectpicker('refresh');
  13190. $('#chargeType').empty();
  13191. $('#chargeType').selectpicker('refresh');
  13192. emptyInput();
  13193. }
  13194. });
  13195. }
  13196. /**
  13197. * 设置时间下拉选
  13198. * @param ampm
  13199. */
  13200. function setAmTimes(ampm) {
  13201. if (ampm == "a" || ampm == "p") {
  13202. $("#apTimesDiv").removeClass("hide").addClass("in");
  13203. $("#doctorDiv").css("margin-top", "10px");
  13204. var timeHtml = null;
  13205. var defaultTime = null;
  13206. var date = new Date($("#registrationTime").val());
  13207. var currentDate = getCurrentDate();
  13208. var afterToday = date.getTime() > currentDate.getTime();
  13209. if (ampm == "a") {
  13210. if (afterToday || range(paseToFullTime("00:00"), paseToFullTime("08:30"))) {
  13211. defaultTime = "a1";
  13212. timeHtml = '<option value="a1">08:00-08:30</option><option value="a2">08:30-09:00</option><option value="a3">09:00-09:30</option><option value="a4">09:30-10:00</option><option value="a5">10:00-10:30</option><option value="a6">10:30-11:00</option><option value="a7">11:00-11:30</option><option value="a8">11:30-12:00</option>';
  13213. } else if (range(paseToFullTime("08:30"), paseToFullTime("09:00"))) {
  13214. defaultTime = "a2";
  13215. timeHtml = '<option value="a2">08:30-09:00</option><option value="a3">09:00-09:30</option><option value="a4">09:30-10:00</option><option value="a5">10:00-10:30</option><option value="a6">10:30-11:00</option><option value="a7">11:00-11:30</option><option value="a8">11:30-12:00</option>';
  13216. } else if (range(paseToFullTime("09:00"), paseToFullTime("09:30"))) {
  13217. defaultTime = "a3";
  13218. timeHtml = '<option value="a3">09:00-09:30</option><option value="a4">09:30-10:00</option><option value="a5">10:00-10:30</option><option value="a6">10:30-11:00</option><option value="a7">11:00-11:30</option><option value="a8">11:30-12:00</option>';
  13219. } else if (range(paseToFullTime("09:30"), paseToFullTime("10:00"))) {
  13220. defaultTime = "a4";
  13221. timeHtml = '<option value="a4">09:30-10:00</option><option value="a5">10:00-10:30</option><option value="a6">10:30-11:00</option><option value="a7">11:00-11:30</option><option value="a8">11:30-12:00</option>';
  13222. } else if (range(paseToFullTime("10:00"), paseToFullTime("10:30"))) {
  13223. defaultTime = "a5";
  13224. timeHtml = '<option value="a5">10:00-10:30</option><option value="a6">10:30-11:00</option><option value="a7">11:00-11:30</option><option value="a8">11:30-12:00</option>';
  13225. } else if (range(paseToFullTime("10:30"), paseToFullTime("11:00"))) {
  13226. defaultTime = "a6";
  13227. timeHtml = '<option value="a6">10:30-11:00</option><option value="a7">11:00-11:30</option><option value="a8">11:30-12:00</option>';
  13228. } else if (range(paseToFullTime("11:00"), paseToFullTime("11:30"))) {
  13229. defaultTime = "a7";
  13230. timeHtml = '<option value="a7">11:00-11:30</option><option value="a8">11:30-12:00</option>';
  13231. } else if (range(paseToFullTime("11:30"), paseToFullTime("12:00"))) {
  13232. defaultTime = "a8";
  13233. timeHtml = '<option value="a8">11:30-12:00</option>';
  13234. }
  13235. } else {
  13236. if (afterToday || range(paseToFullTime("00:00"), paseToFullTime("14:30"))) {
  13237. defaultTime = "p1";
  13238. timeHtml = '<option value="p1">14:00-14:30</option><option value="p2">14:30-15:00</option><option value="p3">15:00-15:30</option><option value="p4">15:30-16:00</option><option value="p5">16:00-16:30</option><option value="p6">16:30-17:00</option><option value="p7">17:00-17:30</option>';
  13239. } else if (range(paseToFullTime("14:30"), paseToFullTime("15:00"))) {
  13240. defaultTime = "p2";
  13241. timeHtml = '<option value="p2">14:30-15:00</option><option value="p3">15:00-15:30</option><option value="p4">15:30-16:00</option><option value="p5">16:00-16:30</option><option value="p6">16:30-17:00</option><option value="p7">17:00-17:30</option>';
  13242. } else if (range(paseToFullTime("15:00"), paseToFullTime("15:30"))) {
  13243. defaultTime = "p3";
  13244. timeHtml = '<option value="p3">15:00-15:30</option><option value="p4">15:30-16:00</option><option value="p5">16:00-16:30</option><option value="p6">16:30-17:00</option><option value="p7">17:00-17:30</option>';
  13245. } else if (range(paseToFullTime("15:30"), paseToFullTime("16:00"))) {
  13246. defaultTime = "p4";
  13247. timeHtml = '<option value="p4">15:30-16:00</option><option value="p5">16:00-16:30</option><option value="p6">16:30-17:00</option><option value="p7">17:00-17:30</option>';
  13248. } else if (range(paseToFullTime("16:00"), paseToFullTime("16:30"))) {
  13249. defaultTime = "p5";
  13250. timeHtml = '<option value="p5">16:00-16:30</option><option value="p6">16:30-17:00</option><option value="p7">17:00-17:30</option>';
  13251. } else if (range(paseToFullTime("16:30"), paseToFullTime("17:00"))) {
  13252. defaultTime = "p6";
  13253. timeHtml = '<option value="p6">16:30-17:00</option><option value="p7">17:00-17:30</option>';
  13254. } else if (range(paseToFullTime("17:00"), paseToFullTime("17:30"))) {
  13255. defaultTime = "p7";
  13256. timeHtml = '<option value="p7">17:00-17:30</option>';
  13257. }
  13258. }
  13259. $('#apTimes').html(timeHtml);
  13260. $('#apTimes').selectpicker('refresh');
  13261. $("#apTimes").selectpicker('val', defaultTime);
  13262. $('#apTimes').selectpicker('refresh');
  13263. $("#chargeTypeDiv").css("margin-top", "10px");
  13264. $("#apTimesDiv").removeClass("hide").addClass("in");
  13265. } else {
  13266. $("#apTimes").selectpicker('val', null);
  13267. $('#apTimes').selectpicker('refresh');
  13268. $("#apTimesDiv").removeClass("in").addClass("hide");
  13269. $("#chargeTypeDiv").css("margin-top", "0px");
  13270. }
  13271. }
  13272. /**
  13273. * 初始门诊号别下拉选
  13274. */
  13275. function initChargeType() {
  13276. $.ajax({
  13277. type: "GET",
  13278. url: '/thmz/getChargeTypeByRequestDayAndDoctor?unitCode=' + $('#deptNo').val() + "&ampm=" + $("#ampm").val() + '&date=' + $("#registrationTime").val() + "&apTime=" + $("#apTimes").val(),
  13279. dataType: "json",
  13280. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  13281. success: function (res) {
  13282. if (res == '401' || res == 401) {
  13283. window.location.href = '/thmz/login/view'
  13284. return;
  13285. }
  13286. var html = '';
  13287. var defaultCode = null;
  13288. $.each(res.data, function (commentIndex, comment) {
  13289. if (res.data.length == 1) {
  13290. //如果只有一个号别,默认选中
  13291. defaultCode = comment.code;
  13292. }
  13293. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  13294. });
  13295. $('#chargeType').empty(); //清空resText里面的所有内容
  13296. $('#chargeType').html(html);
  13297. $('#chargeType').selectpicker('refresh');
  13298. if (defaultCode != null) {
  13299. //如果有默认选项,默认选择
  13300. $('#chargeType').selectpicker('val', defaultCode);
  13301. $('#chargeType').selectpicker('refresh');
  13302. initDoctorInfo();
  13303. }
  13304. emptyInput();
  13305. }
  13306. });
  13307. }
  13308. /**
  13309. * 初始医生下拉选
  13310. * @param ampm 时间段区间
  13311. */
  13312. function initDoctorInfo() {
  13313. $("#doctorInfo").selectpicker({
  13314. size: 10
  13315. });
  13316. //医生列表
  13317. $.ajax({
  13318. type: "GET",
  13319. url: '/thmz/getDoctorCodeByRequestDayAndDoctor?unitCode=' + $('#deptNo').val() + "&ampm=" + $("#ampm").val() + "&chargeType=" + $("#chargeType").val() + '&date=' + $("#registrationTime").val() + "&apTime=" + $("#apTimes").val(),
  13320. dataType: "json",
  13321. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  13322. success: function (res) {
  13323. if (res == '401' || res == 401) {
  13324. window.location.href = '/thmz/login/view'
  13325. return;
  13326. }
  13327. var html = '';
  13328. var defaultCode = null;
  13329. $.each(res.data, function (commentIndex, comment) {
  13330. var employeeName = comment.employee.employeeName;
  13331. if (comment.leftNum != null) {
  13332. employeeName = employeeName + " 余号(" + comment.leftNum + ")"
  13333. }
  13334. html += '<option value="' + comment.employee.employeeCode + '" data-chargeType="' + comment.chargeType + '" data-checkFee="' + comment.checkFee + '" data-mzyRequestId="' + comment.mzyRequestId + '">' + employeeName + '</option>';
  13335. if (res.data.length == 1) {
  13336. //如果只有一个号别,默认选中
  13337. defaultCode = comment.employee.employeeCode;
  13338. }
  13339. });
  13340. $('#doctorInfo').empty();
  13341. $('#doctorInfo').html(html);
  13342. $('#doctorInfo').selectpicker('refresh');
  13343. //validator.checkAll($("#regi_form"));
  13344. if (defaultCode != null) {
  13345. //如果有无需选择医生的选项,默认选择
  13346. $('#doctorInfo').selectpicker('val', defaultCode);
  13347. $('#doctorInfo').selectpicker('refresh');
  13348. fitFee();
  13349. }
  13350. }
  13351. });
  13352. }
  13353. /**
  13354. * 设置挂号费等费用
  13355. */
  13356. function fitFee() {
  13357. var mzyRequestId = $('#doctorInfo').find("option:selected").attr('data-mzyRequestId');
  13358. var checkFee = $('#doctorInfo').find("option:selected").attr('data-checkFee');
  13359. $("#checkFee").val(checkFee);
  13360. $("#totalFee").val(checkFee);
  13361. $.ajax({
  13362. type: "GET",
  13363. url: '/thmz/getMzChargeTypeByMzyRequestId?mzyRequestId=' + mzyRequestId + "&birthDay=&patientId=" + $("#patientIdRegistration").val(),
  13364. dataType: "json",
  13365. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  13366. success: function (res) {
  13367. if (res == '401' || res == 401) {
  13368. window.location.href = '/thmz/login/view'
  13369. return;
  13370. }
  13371. $("#registrationFee").val(res.data.reqFee);
  13372. $("#hospitalFee").val(res.data.clinicFee);
  13373. $("#othFee").val(parseFloat(res.data.othFee) - parseFloat(checkFee));
  13374. checkFee = parseFloat(res.data.reqFee) + parseFloat(res.data.clinicFee) + parseFloat(res.data.othFee);
  13375. $("#totalFee").val(checkFee);
  13376. }
  13377. });
  13378. }
  13379. /**
  13380. * 科室与时间区间下拉选改变时清空输入框内容
  13381. */
  13382. function emptyInput() {
  13383. $('#doctorInfo').empty();
  13384. $('#doctorInfo').selectpicker('refresh');
  13385. $("#registrationFee").val(0.00);
  13386. $("#hospitalFee").val(0.00);
  13387. $("#checkFee").val(0.00);
  13388. $("#othFee").val(0.00);
  13389. $("#totalFee").val(0.00);
  13390. }
  13391. /**
  13392. * 科室与时间区间下拉选改变时清空输入框内容
  13393. */
  13394. function clearRegistrationModal() {
  13395. $("#patientIdRegistration").val(null);
  13396. $("#registrationTime").val(null);
  13397. $('#ampm').selectpicker('val', null);
  13398. $('#ampm').selectpicker('refresh');
  13399. $('#deptNo').empty();
  13400. $('#deptNo').selectpicker('refresh');
  13401. $('#chargeType').empty();
  13402. $('#chargeType').selectpicker('refresh');
  13403. $('#doctorInfo').empty();
  13404. $('#doctorInfo').selectpicker('refresh');
  13405. $('#apTimes').empty();
  13406. $('#apTimes').selectpicker('refresh');
  13407. $("#registrationFee").val(0.00);
  13408. $("#hospitalFee").val(0.00);
  13409. $("#checkFee").val(0.00);
  13410. $("#othFee").val(0.00);
  13411. $("#totalFee").val(0.00);
  13412. }
  13413. /**
  13414. * 保存挂号信息
  13415. */
  13416. function saveMzyReqrecUnPay() {
  13417. $("#registrationModal").modal('hide');
  13418. $("#messageModal").modal();
  13419. $("#messageContent").html("确定提交本次预约挂号申请吗?");
  13420. $("#messageButton").off("click").bind("click", function (t) {
  13421. $("#messageModal").modal('hide');
  13422. realSaveMzyReqrecUnPay();
  13423. });
  13424. $("#cancelButton").off("click").bind("click", function (t) {
  13425. $("#messageModal").modal('hide');
  13426. $("#registrationModal").modal();
  13427. });
  13428. }
  13429. /**
  13430. * 保存挂号信息
  13431. */
  13432. function realSaveMzyReqrecUnPay() {
  13433. $("#saveRegistration").attr("disabled", true);
  13434. var mzyRequestId = $('#doctorInfo').find("option:selected").attr('data-mzyRequestId');
  13435. var patientId = $("#patientIdRegistration").val();
  13436. var totalFee = $("#totalFee").val();
  13437. $.ajax({
  13438. type: "POST",
  13439. url: '/thmz/saveMzyReqrec',
  13440. contentType: "application/json;charset=UTF-8",
  13441. dataType: "json",
  13442. data: JSON.stringify({
  13443. "mzyReqrec": {
  13444. "patientId": patientId,
  13445. "ampm": $("#ampm").val(),
  13446. "apTime": $("#apTimes").val(),
  13447. "unitCode": $("#deptNo").val(),
  13448. "chargeType": $("#chargeType").val(),
  13449. "requestDayStr": $("#registrationTime").val()
  13450. }, "mzyRequestId": mzyRequestId, "totalFee": totalFee, "payMark": "5"
  13451. }),
  13452. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  13453. success: function (res) {
  13454. if (res == '401' || res == 401) {
  13455. window.location.href = '/thmz/login/view'
  13456. return;
  13457. }
  13458. if (res.code == 0) {
  13459. successMesage(res);
  13460. clearRegistrationModal();
  13461. $("#registrationModal").modal('hide');
  13462. } else {
  13463. errorMesage(res);
  13464. }
  13465. $("#saveRegistration").attr("disabled", false);
  13466. }
  13467. });
  13468. }
  13469. //打开门诊电子病历
  13470. function openEmr() {
  13471. $.ajax({
  13472. type: "GET",
  13473. url: '/thmz/getMzjsdHost',
  13474. dataType: "json",
  13475. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  13476. success: function (res) {
  13477. if (res == '401' || res == 401) {
  13478. window.location.href = '/thmz/login/view'
  13479. return;
  13480. }
  13481. if (res.code == 0) {
  13482. let times = $("#visitTimes").val();
  13483. let patientId = $("#patientId").text();
  13484. if(stringIsBlank(patientId)){
  13485. return errorMesageSimaple('门诊号不能为空,请先接诊')
  13486. }
  13487. let age = $("#patientAge").text();
  13488. let sex= $("#patientGender").text();
  13489. let userIdCode = localStorage.getItem("userIdCode");
  13490. let patNo = window.btoa(JSON.stringify({
  13491. patientId:patientId,
  13492. times: Number(times),
  13493. userIdCode:userIdCode
  13494. })
  13495. )
  13496. window.open(`${res.data}/mzEmr/${patNo}`, '_blank');
  13497. }
  13498. }
  13499. });
  13500. }
  13501. //打开pacs检查
  13502. function openPacsJc() {
  13503. getAjaxRequst("/thmz/getPacsUrl",{},true,function (res) {
  13504. if (res == '401' || res == 401) {
  13505. window.location.href = '/thmz/login/view'
  13506. return;
  13507. }
  13508. if(res.code == 0 ){
  13509. let patientId = $("#patientId").text();
  13510. let pacsurl = res.data +"/Index.htm?CLINICALNUM="+patientId
  13511. window.open(pacsurl, '_blank');
  13512. }else {
  13513. errorMesage(res)
  13514. }
  13515. })
  13516. }
  13517. //打开检查检验
  13518. function openJcJyPacsModal() {
  13519. $("#previewJcJyPacsModal").modal()
  13520. getAjaxRequst("/thmz/getMzjsdHost",{},true,function (res) {
  13521. if (res == '401' || res == 401) {
  13522. window.location.href = '/thmz/login/view'
  13523. return;
  13524. }
  13525. if(res.code == 0){
  13526. let userIdCode = localStorage.getItem("userIdCode");
  13527. let patNo = $("#patientId").text();
  13528. let end = format(new Date(),'yyyy-MM-dd')
  13529. let start = format(getPreviousDays(new Date(),30),'yyyy-MM-dd')
  13530. let showUrl = `${res.data}/jumpRedirect?url=%2FinspectionResult%3FpatNo%3D${patNo}%26start%3D${start}%26end%3D${end}&code=${userIdCode}`
  13531. $("#jyjcpacsDiv").attr("src", showUrl);
  13532. }
  13533. })
  13534. }
  13535. function openDiscountLv() {
  13536. $("#discountLvModal").modal();
  13537. postAjaxJsonHttpRequst("/thmz/queryDiscountLv",{patientId: $("#patientId").text()},true,function (res) {
  13538. if(res.code == 0){
  13539. if(res.data != null){
  13540. $("#discountLv").val(res.data)
  13541. $('#discountLv').selectpicker('refresh');
  13542. }
  13543. }else {
  13544. errorMesage(res)
  13545. }
  13546. })
  13547. }
  13548. //保存股东卡优先级
  13549. function saveDiscountLv() {
  13550. postAjaxJsonHttpRequst("/thmz/updateDiscountLv",{patientId: $("#patientId").text(),discountLv : $("#discountLv").val()},true,function (res) {
  13551. if(res.code == 0){
  13552. successMesageSimaple("修改成功")
  13553. $("#discountLvModal").modal("hide");
  13554. }else {
  13555. errorMesage(res)
  13556. }
  13557. })
  13558. }
  13559. //打开医技预约
  13560. function openYjYyModal() {
  13561. getAjaxRequst("/thmz/getYjYyUrl",{},true,function (res) {
  13562. if (res == '401' || res == 401) {
  13563. window.location.href = '/thmz/login/view'
  13564. return;
  13565. }
  13566. if(res.code == 0 ){
  13567. let patientId = $("#patientId").text();
  13568. let yjyyUrl = res.data +"?MZH="+patientId
  13569. window.open(yjyyUrl, '_blank');
  13570. }else {
  13571. errorMesage(res)
  13572. }
  13573. })
  13574. }
  13575. function getPreviousDays(date, days) {
  13576. var prevDate = new Date(date); // 创建一个与指定日期相同的新日期对象
  13577. prevDate.setDate(date.getDate() - days); // 将日期设置为前几天(days)的日期
  13578. return prevDate;
  13579. }
  13580. function stringIsBlank(val) {
  13581. try {
  13582. val = val.trim()
  13583. } catch {
  13584. }
  13585. return typeof val === 'undefined' || val === null || val === ''
  13586. }
  13587. //是否开启复制粘贴
  13588. function initCopy() {
  13589. getAjaxRequst("/thmz/initCopy",{},true,function (res) {
  13590. if(res.code == -1){
  13591. document.oncontextmenu = function(event){
  13592. event.returnValue = false;
  13593. }
  13594. document.onkeydown = function(event){
  13595. if(event.ctrlKey && window.event.keyCode == 67){
  13596. return false;
  13597. }
  13598. if(event.ctrlKey && window.event.keyCode == 86){
  13599. return false;
  13600. }
  13601. }
  13602. }else {
  13603. document.oncontextmenu = function(event){
  13604. event.returnValue = true;
  13605. }
  13606. document.onkeydown = function(event){
  13607. if(event.ctrlKey && window.event.keyCode == 67){
  13608. return true;
  13609. }
  13610. if(event.ctrlKey && window.event.keyCode == 86){
  13611. return true;
  13612. }
  13613. }
  13614. }
  13615. })
  13616. }