clinic.js 379 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708
  1. //@ sourceURL=clinic.js
  2. //判断病人列表是否在加载中,防止重复加载
  3. var msg_list_loading = false;
  4. //挂号卡片列表页面下标
  5. var pageIndex = 0;
  6. //药品使用方法,天数和频次的集合
  7. var groupIdMap = null;
  8. var LODOP; //声明为全局变量
  9. //默认打印机下标
  10. var printIndex = -1;
  11. // //当前光标点击的元素ID
  12. var currentEleId = null;
  13. //打开检查检验报告的时候不知道哪个有报告,如果检查没有就自动打开检验,但是为了防止死循环,次数加到1就不在进行重试
  14. var retryCount = 0;
  15. $(function () {
  16. initGenderSelect();
  17. iniAdmissStatus();
  18. initListDeptSelect();
  19. initResponceTypeSelect();
  20. initTemplateTypeSelect();
  21. initTemplateKindTypeSelect('templateKindType');
  22. initZyClassTypeSelect();
  23. initInstructionSelect();
  24. setSelectSize();
  25. initCertificateTypeSelect();
  26. $('#editUserBirthDayGroup').datetimepicker({
  27. format: 'yyyy-mm-dd',
  28. language: 'zh-CN',
  29. minView: "month",
  30. });
  31. initDaterangepickerWithId('reportrange', "right");
  32. formatCheck();
  33. //数据校验
  34. init_validator();
  35. //初始频次下拉选
  36. initOrderFrequencys("orderFrequency", true);
  37. //初始用药方式下拉选
  38. initSupplyTypes();
  39. //加载候诊患者列表
  40. loadUnClinicTableList();
  41. //加载接诊中患者列表
  42. loadInClinicTableList();
  43. //加载已接诊患者列表
  44. loadClinicTableList();
  45. //每隔一分钟秒读加载候诊患者列表
  46. setInterval(function () {
  47. //加载候诊患者列表
  48. loadUnClinicTableList();
  49. //加载已接诊患者列表 病人会缴费,需要刷新状态
  50. loadClinicTableList();
  51. }, 60000);
  52. //初始化快速接诊病人姓名栏事件
  53. initUserList();
  54. //初始化主诉弹出层
  55. initRecommendList();
  56. //卡号输入改变事件
  57. cardNoChange();
  58. /**
  59. * 患者信息修改
  60. */
  61. $("#saveEditUser").on("click", function (t) {
  62. modifyPatient();
  63. });
  64. // /**
  65. // * 保存入院证
  66. // */
  67. // $("#saveBeHospitalized").on("click", function (t) {
  68. // saveBeHospitalized();
  69. // });
  70. /**
  71. * 打印入院证
  72. */
  73. $("#printBeHospitalized").on("click", function (t) {
  74. modifyPatient();
  75. });
  76. //折叠按钮初始化
  77. $('.collapse-link').on('click', function () {
  78. var $BOX_PANEL = $(this).closest('.x_panel_mine'),
  79. $ICON = $(this).find('i'),
  80. $BOX_CONTENT = $BOX_PANEL.find('.x_content');
  81. // fix for some div with hardcoded fix class
  82. if ($BOX_PANEL.attr('style')) {
  83. $BOX_CONTENT.slideToggle(200, function () {
  84. $BOX_PANEL.removeAttr('style');
  85. });
  86. } else {
  87. $BOX_CONTENT.slideToggle(200);
  88. $BOX_PANEL.css('height', 'auto');
  89. }
  90. $ICON.toggleClass('fa-chevron-up fa-chevron-down');
  91. });
  92. /**
  93. * 接诊
  94. */
  95. $("#clinicalReception").on("click", function (t) {
  96. var patientIdDb = $("#patientIdDb").val();
  97. if (patientIdDb == null || patientIdDb == "") {
  98. errorMesageSimaple("当前未选择病人,无法接诊");
  99. return;
  100. }
  101. $.ajax({
  102. type: "GET",
  103. url: '/thmz/getMzfzPatientOrderByPatientId?patientId=' + patientIdDb,
  104. contentType: "application/json;charset=UTF-8",
  105. dataType: "json",
  106. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  107. success: function (res) {
  108. if (res == '401' || res == 401) {
  109. window.location.href = '/thmz/login/view'
  110. return;
  111. }
  112. if (res.code == 0) {
  113. if (res.data != null && res.data.length > 0) {
  114. if (res.data.length == 1) {
  115. //快速接诊的时候不知道分诊号
  116. clinicalReception(patientIdDb, res.data[0].serialNo);
  117. } else {
  118. $("#mzfzPatientOrderModal").modal();
  119. $("#mzfzPatientOrderTable").html(null);
  120. for (var i = 0; i < res.data.length; i++) {
  121. var roomCode = res.data[i].roomCode;
  122. if (roomCode == null || roomCode == "null") {
  123. roomCode = "";
  124. }
  125. $("<tr data-target='" + res.data[i].serialNo + "'><td>" + res.data[i].patientId + "</td><td>" + res.data[i].name + "</td><td>" + res.data[i].deptCode + "</td><td>" + res.data[i].doctorCode + "</td><td>" + roomCode + "</td></tr>").appendTo("#mzfzPatientOrderTable").bind('click', function () {
  126. $("#mzfzPatientOrderModal").modal("hide");
  127. clinicalReception(patientIdDb, $(this).attr("data-target"));
  128. });
  129. }
  130. }
  131. clearRapidAcceptsModal();
  132. $("#rapidAcceptsModal").modal("hide");
  133. } else {
  134. errorMesageSimaple("当前病人没有分诊信息");
  135. }
  136. } else if(res.code == 200){
  137. clearRapidAcceptsModal();
  138. $("#rapidAcceptsModal").modal("hide");
  139. clinicalReception(patientIdDb, null);
  140. }else{
  141. errorMesage(res);
  142. }
  143. }
  144. });
  145. });
  146. /**
  147. * 存为范本
  148. */
  149. $("#saveapidAccepts").on("click", function (t) {
  150. // var symptom = $("#symptom").val();
  151. // if (symptom == null || symptom == "") {
  152. // errorMesageSimaple("主诉不能为空!");
  153. // return;
  154. // }
  155. //var emrHpi = $("#emrHpi").val();
  156. // if (emrHpi == null || emrHpi == "") {
  157. // errorMesageSimaple("现病史不能为空!");
  158. // return;
  159. // }
  160. // var diagnoseValue = $("#diagnoseValue").val();
  161. // var tentativeDiagnosis = $("#tentativeDiagnosis").val();
  162. // if (diagnoseValue != null) {
  163. // var reg = new RegExp(',', "g")
  164. // diagnoseValue = diagnoseValue.replace(reg, '');
  165. // }
  166. // if ((diagnoseValue == null || diagnoseValue == "") && (tentativeDiagnosis == null || tentativeDiagnosis == "")) {
  167. // errorMesageSimaple("诊断和初步诊断不能同时为空!");
  168. // return;
  169. // }
  170. //关闭帮助框
  171. $("#treeButton").webuiPopover('hide');
  172. $("#western_medicine_name").webuiPopover('hide');
  173. $("#chinese_medicine_name").webuiPopover('hide');
  174. $("#jcJyItem").webuiPopover('hide');
  175. $("#saveapidAcceptsModal").modal("show");
  176. });
  177. /**
  178. * 实例化智能问诊弹窗
  179. */
  180. // $("[data-toggle='popover']").popover();
  181. $("#box-arrow-left").popover({
  182. html: 'true',
  183. content: '<div id="smartAssistPopoverContent"></div>'
  184. });
  185. //初始化药品分组下拉选
  186. initGroupOrder();
  187. // 初始化用药天数下拉选
  188. initDayNum();
  189. //页面加载完成初始化西药处方
  190. //initNavTabs(0);
  191. //页面加载完成初始化住院处方
  192. //initNavTabs(3);
  193. //初始医生工作太配置
  194. initWorkspaceConfigForCurrent();
  195. initExecUnit();
  196. /**
  197. * 西药点击事件
  198. */
  199. $("#western_medicine_name").on("click", function (t) {
  200. var obj = $("#westernMedicinePopoverContent").parent().parent().parent();
  201. if ($(obj).hasClass("in") || $(obj).css("display") == "block") {
  202. $('#western_medicine_name').webuiPopover('hide');
  203. $("#treeButton").webuiPopover('hide');
  204. return;
  205. }
  206. $('#western_medicine_name').webuiPopover('show');
  207. loadYpList(0);
  208. });
  209. /**
  210. * 中药点击事件
  211. */
  212. $("#chinese_medicine_name").on("click", function (t) {
  213. var obj = $("#chineseMedicinePopoverContent").parent().parent().parent();
  214. if ($(obj).hasClass("in") || $(obj).css("display") == "block") {
  215. $('#chinese_medicine_name').webuiPopover('hide');
  216. $("#treeButton").webuiPopover('hide');
  217. return;
  218. }
  219. $('#chinese_medicine_name').webuiPopover('show');
  220. loadYpList(1);
  221. });
  222. /**
  223. * 项目点击事件
  224. */
  225. $("#jcJyItem").on("click", function (t) {
  226. if ($("#jcJyItemPopoverContent").parent().parent().parent().hasClass("in")) {
  227. $('#jcJyItem').webuiPopover('hide');
  228. $("#treeButton").webuiPopover('hide');
  229. return;
  230. }
  231. $('#jcJyItem').webuiPopover('show');
  232. loadjcJyItemList();
  233. });
  234. initYshPart();
  235. initJyZdSample();
  236. setTimeout(function () {
  237. getLodop();
  238. }, 800);
  239. //键盘监听回车键
  240. $(document).unbind("keyup").keyup(function (event) {
  241. if (event.keyCode == 13) { //是否是回车
  242. var el = event.srcElement || event.target;
  243. var id = el.getAttribute("id");
  244. var current_code = $("#current_code").val();
  245. var index = getIndex("bill_item_group");
  246. if (id == null || id == "") {
  247. id = el.getAttribute("data-id");
  248. }
  249. if (id == null || id == "") {
  250. var search = el.getAttribute("aria-label");
  251. if (search == "Search") {
  252. id = $(el).parent().parent().prev().attr("data-id");
  253. }
  254. }
  255. if(id!=null && id != ""){
  256. //将当前点击的id记录下
  257. currentEleId=id;
  258. }else if(currentEleId!=null){
  259. id=currentEleId;
  260. }
  261. //回车时,光标不在任何区域判断是不是在药品和诊疗开立区域
  262. if (id == null || id == "") {
  263. var index = getIndex("bill_item_group");
  264. if (index == 0) {
  265. if (current_code != null && current_code != "") {
  266. //当前页面是西药保存页面,且有药品选中
  267. $("#supplyType").next().click();
  268. }
  269. } else if (index == 1) {
  270. //当前页面是中草药保存页面,且有药品选中
  271. } else if (index == 2) {
  272. if (current_code != null && current_code != "") {
  273. //当前页面是医技保存页面,且有选中
  274. if ($("#jyZdSampleDiv").hasClass('hide')) {
  275. //检验物是隐藏,说明现在是检查
  276. $("#yshPart").next().click();
  277. } else {
  278. //此时是检验
  279. $("#jyZdSample").next().click();
  280. }
  281. }
  282. } else if (index == 3) {
  283. //当前页面是住院保存页面
  284. $("#inpatientWardBeHospitalized").next().click();
  285. return;
  286. }
  287. }
  288. console.log("id=" + id);
  289. var customization = $("div.customization").not(".hide");
  290. //回车时,光标不在任何区域,默认点击主诉
  291. if (id == null || id == "") {
  292. var eleId = $(customization[0]).attr("target-id");
  293. $("#" + eleId).focus();
  294. if (eleId == 'symptom') {
  295. $("#" + eleId).click();
  296. }
  297. console.log("eleId=" + eleId);
  298. } else if (id == 'symptom' || id == 'emrHpi' || id == 'emrPs' || id == 'personalHistory' || id == 'familyHistory' || id == 'obstericalHistory' || id == 'otherCheck' || id == 'diagnose' || id == 'tentativeDiagnosis') {
  299. console.log("1id=" + id);
  300. if (id != $(customization[customization.length - 1]).attr("target-id")) {
  301. var next = $("#" + id + "Flag").next();
  302. while($(next).hasClass("foreclose") || $(next).hasClass("hide")){
  303. next=$(next).next();
  304. }
  305. var eleId = $(next).attr("target-id");
  306. $("#" + eleId).focus();
  307. if (eleId == 'diagnose' || id == 'diagnose' || id == 'symptom') {
  308. $("#" + eleId).click();
  309. }
  310. console.log("1eleId=" + eleId);
  311. } else {
  312. var data_target=$("#symptom").attr("data-target");
  313. $("#"+data_target).find("a.close").click();
  314. data_target=$("#diagnose").attr("data-target");
  315. $("#"+data_target).find("a.close").click();
  316. if (index == 0) {
  317. $("#western_medicine_name").focus();
  318. } else if (index == 1) {
  319. $("#chinese_medicine_name").focus();
  320. } else if (index == 2) {
  321. $("#jcJyItem").focus();
  322. } else if (index == 3) {
  323. $("#inpatientWardBeHospitalized").next().click();
  324. }
  325. }
  326. } else if (id == 'zy_drugWin') {
  327. $("#zyInstruction").next().click();
  328. } else if (id == 'zyInstruction') {
  329. var ariaExpanded = $("#zyInstruction").next().attr("aria-expanded");
  330. if (ariaExpanded == true || ariaExpanded == "true") {
  331. $("#zyInstruction").next().click();
  332. }
  333. $("#saveChineseMedicine").click();
  334. $("#zyfs").focus();
  335. // saveMedicine(1);
  336. }
  337. // else if (id == 'saveChineseMedicine') {
  338. // $("input.zyfs").focus();
  339. // }
  340. else if (id == 'zyfs') {
  341. $("#zy_orderFrequency_1").next().click();
  342. } else if (id == 'zy_orderFrequency_1') {
  343. $("#useType_1").next().click();
  344. } else if (id == 'useType_1') {
  345. $("#cyJssm").next().click();
  346. } else if (id == 'cyJssm') {
  347. $("#zy_supplyType_1").next().click();
  348. } else if (id == 'zy_supplyType_1') {
  349. $("#chinese_medicine_name").focus();
  350. $("#chinese_medicine_name").click();
  351. } else if (id == 'supplyType') {
  352. $("#drugWinUnit").next().click();
  353. } else if (id == 'drugWinUnit') {
  354. $("#drugWin").focus();
  355. } else if (id == 'drugWin') {
  356. $("#dayNum").next().click();
  357. } else if (id == 'dayNum') {
  358. $("#orderFrequency").next().click();
  359. } else if (id == 'orderFrequency') {
  360. $("#gross").focus();
  361. } else if (id == 'gross') {
  362. $("#packUnit").next().click();
  363. } else if (id == 'packUnit') {
  364. $("#medicalAdvice").next().click();
  365. } else if (id == 'medicalAdvice') {
  366. var ariaExpanded = $("#medicalAdvice").next().attr("aria-expanded");
  367. if (ariaExpanded == true || ariaExpanded == "true") {
  368. $("#medicalAdvice").next().click();
  369. }
  370. saveMedicine(0);
  371. $("#western_medicine_name").focus();
  372. } else if (id == 'saveWesternMedicine') {
  373. $("#western_medicine_name").focus();
  374. $("#western_medicine_name").click();
  375. }
  376. else if (id == 'chargeUnit') {
  377. $("#itemQuantity").focus();
  378. } else if (id == 'itemQuantity' || id == 'jyZdSample' || id == 'yshPart') {
  379. $("#execUnit").next().click();
  380. } else if (id == 'execUnit') {
  381. var ariaExpanded = $("#execUnit").next().attr("aria-expanded");
  382. if (ariaExpanded == true || ariaExpanded == "true") {
  383. $("#execUnit").next().click();
  384. }
  385. $("#remark").focus();
  386. } else if (id == 'remark') {
  387. saveJyJcItem(true);
  388. } else if (id == 'saveJyJcItem') {
  389. $("#jcJyItem").focus();
  390. $("#jcJyItem").click();
  391. } else if (id == 'inpatientWardBeHospitalized') {
  392. $("#smallWardBeHospitalized").next().click();
  393. } else if (id == 'smallWardBeHospitalized') {
  394. $("#admissStatus").next().click();
  395. } else if (id == 'admissStatus') {
  396. saveZyReq(true);
  397. } else if (id == 'western_medicine_name') {
  398. if (current_code != null && current_code != "") {
  399. //已经选中药品,跳到用法
  400. $("#supplyType").next().click();
  401. } else {
  402. //药品查询框是空白的,打开查询框
  403. $("#western_medicine_name").click();
  404. }
  405. } else if (id == 'chinese_medicine_name') {
  406. if (current_code != null && current_code != "") {
  407. $("#supplyType").next().click();
  408. }else {
  409. $("#chinese_medicine_name").click();
  410. }
  411. } else if (id == 'jcJyItem') {
  412. if (current_code != null && current_code != "") {
  413. $("#supplyType").next().click();
  414. }else {
  415. $("#jcJyItem").click();
  416. }
  417. } else if (id == 'zy_req_button') {
  418. //当前页面是住院保存页面,此时光标在入院按钮上
  419. console.log("入院按钮")
  420. $("#inpatientWardBeHospitalized").next().click();
  421. }
  422. }
  423. });
  424. //打印检查检验报告单
  425. $('#btn_print').click(function () {
  426. printJyJcReport(1);
  427. });
  428. //打印设置检查检验报告单
  429. $('#btn_print_setup').click(function () {
  430. printJyJcReport(2);
  431. });
  432. });
  433. /**
  434. * 打开配置页面
  435. */
  436. function configWorkspaceModal() {
  437. initWorkspaceConfigForCurrent();
  438. $("#configWorkspaceModal").modal("show");
  439. }
  440. /**
  441. * 初始化用药天数下拉选
  442. */
  443. function initDayNum() {
  444. var html = '';
  445. for (var i = 1; i <= 84; i++) {
  446. html += '<option value="' + i + '">' + i + '</option>';
  447. }
  448. $('#dayNum').html(html);
  449. $('#dayNum').selectpicker('refresh');
  450. }
  451. /**
  452. * 初始化药品分组下拉选
  453. */
  454. function initGroupOrder() {
  455. var html = '<option value="1">1</option>';
  456. $('#groupId').html(html);
  457. $('#groupId').selectpicker('refresh');
  458. $("#groupId").selectpicker('val', 1);
  459. $('#groupId').selectpicker('refresh');
  460. groupIdMap = new Map();
  461. }
  462. /**
  463. * 追加分组
  464. */
  465. function appendGroupOrder() {
  466. var last = parseInt($("#groupId > option:last").val());
  467. last++;
  468. var html = '<option value="' + last + '">' + last + '</option>';
  469. $('#groupId').append(html);
  470. $('#groupId').selectpicker('refresh');
  471. }
  472. /**
  473. * 组号改变事件
  474. */
  475. function groupIdChange() {
  476. var last = parseInt($("#groupId > option:last").val());
  477. var groupId = $("#groupId").val();
  478. if (groupId == last) {
  479. //是新增药品清空药品输入区域
  480. var updateFlag = $("#update_flag").val();
  481. var currentCode = $("#current_code").val();
  482. //当前时新增药品,而且没有选择药品的时候,组号变更,清空区域
  483. if ((updateFlag == undefined || updateFlag == null || updateFlag == "false" || updateFlag == false) && (currentCode == null || currentCode == "")) {
  484. clearWesternMedicine(true);
  485. }
  486. } else {
  487. var map = groupIdMap.get(groupId);
  488. if (map != null) {
  489. var supplyType = map.get("supplyType");
  490. var orderFrequency = map.get("orderFrequency");
  491. var dayNum = map.get("dayNum");
  492. //用法编码
  493. $("#supplyType").selectpicker('val', supplyType);
  494. $('#supplyType').selectpicker('refresh');
  495. //$("#supplyType").attr("disabled", "disabled");
  496. //天数
  497. $("#dayNum").selectpicker('val', dayNum);
  498. $('#dayNum').selectpicker('refresh');
  499. // $("#dayNum").attr("disabled", "disabled");
  500. //频次编码
  501. $("#orderFrequency").selectpicker('val', orderFrequency);
  502. $('#orderFrequency').selectpicker('refresh');
  503. // $("#orderFrequency").attr("disabled", "disabled");
  504. }
  505. }
  506. }
  507. /**
  508. * 关闭智能问诊弹框
  509. */
  510. function closePopover() {
  511. //$(".popover").popover('hide');
  512. $("#box-arrow-left").click();
  513. }
  514. /**
  515. * 加载智能问诊弹框内容
  516. */
  517. function contentMethod() {
  518. setTimeout(function () {
  519. $(".popover div.arrow").css("display", "none");
  520. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  521. if (popoverId == undefined) {
  522. return;
  523. }
  524. var left = $("#" + popoverId).css("left");
  525. left = left.replace("px", "");
  526. left = parseInt(left);
  527. left = left + 55;
  528. $("#" + popoverId).css("height", "100%").css("top", "0px").css("left", left + "px").css("border-radius", "0px").css("z-index", "11");
  529. $("#" + popoverId + " .popover-content").css("height", "100%");
  530. $("#smartAssistPopoverContent").css("height", "100%");
  531. var html = ' <div style="height: 24%;padding-left: 15px;width: 100%;">' +
  532. ' <button type="button" style="cursor: default;margin-bottom: 0px;margin-right: 0px; font-size: 12px;"' +
  533. ' class="btn btn-primary">' +
  534. ' <span id="patientHisData"></span>就医轨迹' +
  535. ' </button>' +
  536. ' <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true" onclick="closePopover()">×</span>' +
  537. ' </button>' +
  538. ' <div style="height: calc(100% - 39px);border: 1px solid #DDDDDD;margin-top: 5px;width: 100%;">' +
  539. ' <form class="form-horizontal form-label-left mz-fixed-form" novalidate autocomplete="off"' +
  540. ' style="height: 100%;overflow-y: auto;width: 100%;text-align: -webkit-center;position: relative;" id="patientHisDataForm">' +
  541. ' </form>' +
  542. ' </div>' +
  543. ' </div>' +
  544. ' <div style="height: 23%;padding-left: 15px;width: 100%;">' +
  545. ' <button type="button" style="cursor: default;margin-bottom: 0px;margin-right: 0px;margin-top: 5px;"' +
  546. ' class="btn btn-primary">' +
  547. ' <span id="recommendType"></span>推荐' +
  548. ' </button>' +
  549. ' <div style="height: calc(100% - 44px);border: 1px solid #DDDDDD;overflow-y: auto;margin-top: 5px;width: 100%;">' +
  550. ' <form class="form-horizontal form-label-left mz-fixed-form" novalidate autocomplete="off"' +
  551. ' style="height: 100%;overflow-y: auto;width: 100%;text-align: -webkit-center;position: relative;" id="recommendForm">' +
  552. ' <img src="/thmz/images/no-recommend.png" style="height: 120px;position: absolute;top: 50%;transform: translateY(-50%);margin-left: -30px;">' +
  553. ' </form>' +
  554. ' </div>' +
  555. ' </div>' +
  556. ' <div style="height: 53%;padding-left: 15px;width: 100%;">' +
  557. ' <button type="button"' +
  558. ' style="cursor: default;margin-bottom: 0px;margin-right: 0px;margin-top: 5px; font-size: 12px;"' +
  559. ' class="btn btn-primary">' +
  560. ' 医疗范本' +
  561. ' </button>' +
  562. ' <div class="item" style="width: 230px;height: 35px;float: right;line-height: 35px;margin-right: 40px;">' +
  563. ' <label class="control-label col-md-4 col-sm-4 col-xs-12" for="templateKindTypeForm">范文类型' +
  564. ' </label>' +
  565. ' <div class="col-md-8 col-sm-8 col-xs-12">' +
  566. ' <select class="form-control selectpicker show-tick" title="请选择" onchange="fitTemplateData()"' +
  567. ' id="templateKindTypeForm">' +
  568. ' </select>' +
  569. ' </div>' +
  570. ' </div>' +
  571. ' <div style="height: calc(100% - 44px);border: 1px solid #DDDDDD;overflow-y: auto;margin-top: 5px;width: 100%;position: relative;">' +
  572. ' <form class="form-horizontal form-label-left mz-fixed-form" novalidate autocomplete="off"' +
  573. ' style="height: 100%;overflow-y: auto;width: 100%;" id="TemplateData">' +
  574. ' </form>' +
  575. ' </div>' +
  576. ' </div>';
  577. $("#smartAssistPopoverContent").html(html);
  578. initTemplateKindTypeSelect('templateKindTypeForm');
  579. fitPatientHisData();
  580. fitSymptomData();
  581. fitEmrHpiData();
  582. fitEmrPsData();
  583. fitDiagnoseData();
  584. fitTemplateData();
  585. }, 100);
  586. // setTimeout(function () {
  587. // $("#patientHisDataForm").html("aadsasfasdfasdfasdfasdfsdfasdfasdfasdfdfafda");
  588. // },1000);
  589. }
  590. /**
  591. * 设置患者的就诊轨迹
  592. */
  593. function fitPatientHisData() {
  594. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  595. if (!$("#" + popoverId).hasClass("in")) {
  596. return;
  597. }
  598. var emptyHtml = '<img src="/thmz/images/locus.png" style="height: 120px;position: absolute;top: 50%;transform: translateY(-50%);margin-left: -30px;">';
  599. if (($("#patientId").text() == null || $("#patientId").text() == "") && ($("#userName").val() == null || $("#userName").val() == "")) {
  600. $("#patientHisDataForm").html(emptyHtml);
  601. return;
  602. }
  603. var patientId = $("#patientId").text();
  604. if (patientId == null || patientId == "") {
  605. patientId = $("#userName").val();
  606. }
  607. $.ajax({
  608. type: "POST",
  609. url: '/thmz/getClinicWithPage',
  610. contentType: "application/json;charset=UTF-8",
  611. dataType: "json",
  612. data: JSON.stringify({
  613. "patientId": patientId,
  614. //"clinicStatuses": [5, 6],
  615. "clinicStatuses": [6],
  616. "pageSize": 10000,
  617. "offset": 0,
  618. "beginDate": "2012-02-01 00:00:00",
  619. "endDate": format(new Date(), "yyyy-MM-dd HH:mm:ss"),
  620. "doctorCode": "-1"
  621. }),
  622. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  623. success: function (res) {
  624. if (res == '401' || res == 401) {
  625. window.location.href = '/thmz/login/view'
  626. return;
  627. }
  628. if (res.code == 0) {
  629. var html = '';
  630. var data = res.data;
  631. if (data == null || data.length == 0) {
  632. html += emptyHtml;
  633. } else {
  634. for (var i = 0; i < data.length; i++) {
  635. var icdText = data[i].icdText;
  636. if (icdText == null) {
  637. // continue;
  638. icdText = "空白诊断";
  639. }
  640. icdText = icdText.trim();
  641. html += ' <div class="item form-group thmz_alert" style="width: 100%;">';
  642. html += ' <div style="float: left;width: 172px;">';
  643. html += ' <img src="/thmz/css/bootstrap/bootstrap-icons-1.5.0/stopwatch.svg"';
  644. html += ' style="margin-left: 10px!important;vertical-align: -.15em;margin-right: 10px!important;"/>';
  645. html += ' <span style="width: 120px;margin-right: 20px!important;">' + format(data[i].opDay, "yyyy-MM-dd HH:mm") + '</span>';
  646. html += ' </div>';
  647. html += ' <div style="text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 172px);"';
  648. html += ' title="' + icdText + '">诊断:<a style="cursor: pointer; color: #2e69eb;"';
  649. html += ' onclick="visitingDetailModal(\'' + data[i].patientId + '\',' + data[i].times + ',' + data[i].id + ',' + data[i].clinicStatus + ')">' + icdText + '</a>';
  650. html += ' </div>';
  651. html += ' </div>';
  652. }
  653. }
  654. var patientName = $("#patientName").text();
  655. if ((patientName == null || patientName == "") && res.mzPatientMi != null) {
  656. patientName = res.mzPatientMi.name;
  657. }
  658. $("#patientHisData").text(patientName + "的");
  659. if (($("#patientId").text() == null || $("#patientId").text() == "") && ($("#userName").val() == null || $("#userName").val() == "")) {
  660. $("#patientHisDataForm").html(emptyHtml);
  661. } else {
  662. $("#patientHisDataForm").html(html);
  663. }
  664. } else {
  665. errorMesage(res);
  666. }
  667. }
  668. });
  669. }
  670. /**
  671. * 设置主诉推荐
  672. */
  673. function fitSymptomData() {
  674. fitRecommendData(12);
  675. }
  676. /**
  677. * 设置现病史推荐
  678. */
  679. function fitEmrHpiData() {
  680. fitRecommendData(5);
  681. }
  682. /**
  683. * 设置既往史推荐
  684. */
  685. function fitEmrPsData() {
  686. fitRecommendData(6);
  687. }
  688. /**
  689. * 设置诊断推荐
  690. */
  691. function fitDiagnoseData() {
  692. fitRecommendData(13);
  693. }
  694. /**
  695. * 设置推荐通用方法
  696. */
  697. function fitRecommendData(paramsType) {
  698. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  699. if (!$("#" + popoverId).hasClass("in")) {
  700. return;
  701. }
  702. var inputId = "symptom";
  703. var text = "主诉";
  704. if (paramsType == 5) {
  705. inputId = "emrHpi";
  706. text = "现病史";
  707. } else if (paramsType == 6) {
  708. inputId = "emrPs";
  709. text = "既往史";
  710. } else if (paramsType == 13) {
  711. inputId = "diagnose";
  712. text = "诊断";
  713. }
  714. //光标不在现病史上
  715. if (document.activeElement.id != inputId) {
  716. return;
  717. }
  718. $("#recommendType").html(text);
  719. var emptyHtml = '<img src="/thmz/images/no-recommend.png" style="height: 120px;position: absolute;top: 50%;transform: translateY(-50%);margin-left: -30px;">';
  720. $.ajax({
  721. type: "GET",
  722. url: '/thmz/getTCommonParamsByParamsType?paramsType=' + paramsType + '&commonParams=&pageSize=10',
  723. contentType: "application/json;charset=UTF-8",
  724. dataType: "json",
  725. async: false,
  726. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  727. success: function (res) {
  728. if (res == '401' || res == 401) {
  729. window.location.href = '/thmz/login/view'
  730. return;
  731. }
  732. if (res.code == 0) {
  733. var html = '';
  734. var data = res.data;
  735. if (data == null || data.length == 0) {
  736. html += emptyHtml;
  737. } else {
  738. for (var i = 0; i < data.length; i++) {
  739. var paramsContent = data[i].paramsContent;
  740. html += ' <div class="item form-group thmz_alert" style="width: 100%;">';
  741. html += ' <div style="margin-left: 10px;float: left;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 60px);" title="' + paramsContent + '">';
  742. html += paramsContent;
  743. html += ' </div>';
  744. html += ' <div style="float: left;width: 36px;cursor: pointer;"';
  745. html += ' onclick="fitAppeal(\'' + paramsContent + '\',' + paramsType + ',' + data[i].id + ')">';
  746. html += ' <img';
  747. html += ' src="/thmz/css/bootstrap/bootstrap-icons-1.5.0/cursor-fill.svg"';
  748. html += ' style="margin-left: 10px!important;vertical-align: -.15em;margin-right: 10px!important;"/>';
  749. html += ' </div>';
  750. html += ' </div>';
  751. }
  752. }
  753. $("#recommendForm").html(html);
  754. } else {
  755. errorMesage(res);
  756. }
  757. }
  758. });
  759. }
  760. /**
  761. * 设置医疗范文方法
  762. */
  763. function fitTemplateData() {
  764. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  765. if (!$("#" + popoverId).hasClass("in")) {
  766. return;
  767. }
  768. 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;">';
  769. $.ajax({
  770. type: "GET",
  771. url: '/thmz/getTemplate?templateKindType=' + $("#templateKindTypeForm").val(),
  772. contentType: "application/json;charset=UTF-8",
  773. dataType: "json",
  774. async: false,
  775. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  776. success: function (res) {
  777. if (res == '401' || res == 401) {
  778. window.location.href = '/thmz/login/view'
  779. return;
  780. }
  781. if (res.code == 0) {
  782. var html = '';
  783. var data = res.data;
  784. if (data == null || data.length == 0) {
  785. html += emptyHtml;
  786. } else {
  787. for (var i = 0; i < data.length; i++) {
  788. var template = data[i];
  789. html += ' <div class="item form-group thmz_alert" style="width: 100%;">';
  790. html += ' <div title="' + template.name + '"';
  791. html += ' style="margin-left: 10px!important;float: left;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: 100px;">';
  792. html += template.name;
  793. html += ' </div>';
  794. html += ' <div style="float: left;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 160px);"';
  795. html += ' title="' + template.icdText + '">诊断:<a';
  796. html += ' style="cursor: pointer; color: #2e69eb;"';
  797. html += ' onclick="medicalModelModal(' + template.id + ')">' + template.icdText + '</a>';
  798. html += ' </div>';
  799. html += ' <div style="float: left;width: 36px;cursor: pointer;" onclick="medicalModelModal(' + template.id + ')"><img';
  800. html += ' src="/thmz/css/bootstrap/bootstrap-icons-1.5.0/cursor-fill.svg"';
  801. html += ' style="margin-left: 10px!important;vertical-align: -.15em;margin-right: 10px!important;"/>';
  802. html += ' </div>';
  803. html += ' </div>';
  804. }
  805. }
  806. $("#TemplateData").html(html);
  807. } else {
  808. errorMesage(res);
  809. }
  810. }
  811. });
  812. }
  813. /**
  814. * 清空快速接诊弹窗
  815. */
  816. function clearRapidAcceptsModal() {
  817. $("#rapidAcceptsUserName").val(null);
  818. $("#rapidAcceptsUserCode").val(null);
  819. $("#patientIdDb").val(null);
  820. $("#rapidAcceptsUserCardNo").val(null);
  821. $("#rapidAcceptsUserGender").selectpicker('val', 0);
  822. $("#rapidAcceptsUserGender").selectpicker('refresh');
  823. $("#rapidAcceptsUserPhoneNum").val(null);
  824. $("#rapidAcceptsUserIdCard").val(null);
  825. $("#rapidAcceptsUserIdCard").attr("title", null);
  826. $("#rapidAcceptsUserPhoneNum").attr("title", null);
  827. }
  828. /**
  829. * 清空接诊台用户信息
  830. * @param flag 是否清空分诊流水哈 true 清空
  831. */
  832. function clearUser(flag) {
  833. $("#patientName").html("");
  834. $("#patientAge").html("");
  835. $("#patientGender").html("");
  836. $("#patientId").text(null);
  837. $("#editUser").css("display", "none");
  838. $("#clearUser").css("display", "none");
  839. $("#fetchSpcSlwinfo").css("display", "none");
  840. $("#patientPhone").html("");
  841. $("#patientPhoneLabel").hide();
  842. $("#patientResponseType").html("");
  843. $("#first").next().click();
  844. $("#patientHisData").text("");
  845. if (flag) {
  846. $("#mzfzSerialNoInClick").val(null);
  847. }
  848. }
  849. /**
  850. * 卡号输入改变事件
  851. */
  852. function cardNoChange() {
  853. if (window.ActiveXObject || "ActiveXObject" in window) {
  854. $("#rapidAcceptsUserCardNo").on('input propertychange', function () {
  855. queryUserInfoByCardNo();
  856. });
  857. } else {
  858. $("#rapidAcceptsUserCardNo").on('input οninput', function () {
  859. queryUserInfoByCardNo();
  860. });
  861. }
  862. }
  863. /**
  864. * 刷新就诊列表
  865. */
  866. function refreshClinic() {
  867. loadInClinicTableList();
  868. loadClinicTableList();
  869. }
  870. /**
  871. * 加载已接诊患者列表
  872. */
  873. function loadClinicTableList() {
  874. //loadCommonClinicTableList("tb_table_clinic","/thmz/getClinicWithPage");
  875. loadCommonClinicTableList("tb_table_clinic", queryParamsClinic);
  876. }
  877. /**
  878. * 加载患者列表通用方法
  879. * @param id
  880. * @param queryParams
  881. */
  882. function loadCommonClinicTableList(id, queryParams) {
  883. $('#' + id).bootstrapTable('refresh');
  884. $('#' + id).bootstrapTable({
  885. url: "/thmz/getClinicWithPage", //请求后台的URL(*)
  886. method: 'post', //请求方式(*)
  887. toolbar: '#toolbar', //工具按钮用哪个容器
  888. striped: true, //是否显示行间隔色
  889. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  890. pagination: true, //是否显示分页(*)
  891. sortable: true, //是否启用排序
  892. sortOrder: "asc", //排序方式
  893. queryParams: queryParams, //传递参数(*)
  894. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  895. pageNumber: 1, //初始化加载第一页,默认第一页
  896. pageSize: 5, //每页的记录行数(*)
  897. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  898. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  899. strictSearch: true,
  900. showColumns: false, //是否显示所有的列
  901. showRefresh: false, //是否显示刷新按钮
  902. minimumCountColumns: 2, //最少允许的列数
  903. clickToSelect: true, //是否启用点击选中行
  904. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  905. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  906. cardView: false, //是否显示详细视图
  907. detailView: false,
  908. //rowStyle:rowStyle,//通过自定义函数设置行样式
  909. ajaxOptions: {
  910. headers: {
  911. 'Accept': 'application/json',
  912. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  913. }
  914. },
  915. columns: [
  916. {
  917. field: 'patientName',
  918. title: '姓名/性别/年龄',
  919. align: "center",
  920. valign: 'middle',
  921. // sortable: true
  922. formatter: function (value, row, index) {
  923. return value + "/" + row.gender + "/" + row.age + "岁";
  924. }
  925. }, {
  926. field: 'opDay',
  927. title: '接诊时间',
  928. align: "center",
  929. valign: 'middle',
  930. // sortable: true
  931. formatter: function (value, row, index) {
  932. return format(value, "MM/dd HH:mm");
  933. }
  934. }
  935. , {
  936. title: '操作',
  937. align: "center",
  938. valign: 'middle',
  939. // sortable: true,
  940. formatter: function (value, row, index) {
  941. if (row.clinicStatus == 5) {
  942. 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>';
  943. // 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>';
  944. } else if (row.clinicStatus == 6) {
  945. 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>';
  946. } else if (row.clinicStatus == 7) {
  947. 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>';
  948. }
  949. }
  950. }
  951. ],
  952. responseHandler: function (res) {
  953. if (res == '401' || res == 401) {
  954. window.location.href = '/thmz/login/view'
  955. return;
  956. }
  957. var ress = eval(res);
  958. if (ress.code == -1) {
  959. new PNotify({
  960. title: '错误提示',
  961. text: ress.message,
  962. type: 'error',
  963. hide: false,
  964. styling: 'bootstrap3'
  965. });
  966. return {
  967. "total": 0,//总页数
  968. "rows": {} //数据
  969. };
  970. }
  971. return {
  972. "total": ress.total,//总页数
  973. "rows": ress.data //数据
  974. };
  975. },
  976. onLoadSuccess: function (data) {
  977. $(".pagination-detail").css("display", "none");
  978. if (id == "tb_table_clinic") {
  979. $("#ClinicNum").html(data.total);
  980. } else {
  981. $("#inClinicNum").html(data.total);
  982. }
  983. }
  984. });
  985. }
  986. /**
  987. * 得到查询的参数 接诊中
  988. * @param params
  989. * @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}}
  990. */
  991. function queryParamsInClinic(params) {
  992. var temp = {
  993. pageSize: params.limit,
  994. pageIndex: params.offset / params.limit, //页码
  995. statusFlagList: [8]
  996. };
  997. return temp;
  998. };
  999. /**
  1000. * 得到查询的参数
  1001. * @param params
  1002. * @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}}
  1003. */
  1004. function queryParamsClinic(params) {
  1005. var rePortRangeArr = getRePortRangeArr();
  1006. var temp = {
  1007. beginDate: rePortRangeArr[0],
  1008. endDate: rePortRangeArr[1],
  1009. commonParams: $("#userName").val(),
  1010. clinicStatuses: [5, 6, 7],
  1011. pageSize: params.limit,
  1012. offset: params.offset
  1013. };
  1014. return temp;
  1015. };
  1016. /**
  1017. * 加载待诊患者列表方法
  1018. */
  1019. function loadUnClinicTableList() {
  1020. loadCanClinicTableList("tb_table_un_clinic", queryParamsUnClinic);
  1021. }
  1022. /**
  1023. * 加载接诊中患者列表方法
  1024. */
  1025. function loadInClinicTableList() {
  1026. loadCanClinicTableList("tb_table_in_clinic", queryParamsInClinic);
  1027. }
  1028. /**
  1029. * 加载待诊和接诊中患者列表通用方法方法
  1030. */
  1031. function loadCanClinicTableList(id, queryParams) {
  1032. $('#' + id).bootstrapTable('refresh');
  1033. $('#' + id).bootstrapTable({
  1034. url: "/thmz/getUnClinicWithPage", //请求后台的URL(*)
  1035. method: 'post', //请求方式(*)
  1036. toolbar: '#toolbar', //工具按钮用哪个容器
  1037. striped: true, //是否显示行间隔色
  1038. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  1039. pagination: true, //是否显示分页(*)
  1040. sortable: true, //是否启用排序
  1041. sortOrder: "asc", //排序方式
  1042. queryParams: queryParams, //传递参数(*)
  1043. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  1044. pageNumber: 1, //初始化加载第一页,默认第一页
  1045. pageSize: 5, //每页的记录行数(*)
  1046. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  1047. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  1048. strictSearch: true,
  1049. showColumns: false, //是否显示所有的列
  1050. showRefresh: false, //是否显示刷新按钮
  1051. minimumCountColumns: 2, //最少允许的列数
  1052. clickToSelect: true, //是否启用点击选中行
  1053. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  1054. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  1055. cardView: false, //是否显示详细视图
  1056. detailView: false,
  1057. //rowStyle:rowStyle,//通过自定义函数设置行样式
  1058. ajaxOptions: {
  1059. headers: {
  1060. 'Accept': 'application/json',
  1061. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  1062. }
  1063. },
  1064. columns: [
  1065. {
  1066. field: 'name',
  1067. title: '姓名/性别/年龄',
  1068. align: "center",
  1069. valign: 'middle',
  1070. // sortable: true
  1071. formatter: function (value, row, index) {
  1072. return value + "/" + row.gender + "/" + row.age + "岁";
  1073. }
  1074. }, {
  1075. field: 'visitDate',
  1076. title: '分诊时间',
  1077. align: "center",
  1078. valign: 'middle',
  1079. // sortable: true
  1080. formatter: function (value, row, index) {
  1081. return format(value, "MM/dd HH:mm");
  1082. }
  1083. }
  1084. , {
  1085. title: '操作',
  1086. align: "center",
  1087. valign: 'middle',
  1088. // sortable: true,
  1089. formatter: function (value, row, index) {
  1090. if (row.statusFlag == 0) {
  1091. return '<a title="接诊" onclick="clinicalReception(\'' + row.patientId + '\',\'' + row.serialNo + '\')" style="cursor: pointer">接诊</a>';
  1092. } else if (row.statusFlag == 8) {
  1093. //TODO 继续接诊需要新方法
  1094. return '<a title="继续接诊" onclick="clinicalReception(\'' + row.patientId + '\',\'' + row.serialNo + '\')" style="cursor: pointer">续诊</a> <a title="取消接诊" onclick="cancelClinic(\'' + row.patientId + '\',\'' + row.times + '\')" style="cursor: pointer">消诊</a>';
  1095. } else if (row.statusFlag == 1 || row.statusFlag == 2 || row.statusFlag == 3) {
  1096. return '<a title="通知" onclick="clinicCallNumber(\'' + row.serialNo + '\')" style="cursor: pointer">通知</a>&nbsp;<a title="接诊" onclick="clinicalReception(\'' + row.patientId + '\',\'' + row.serialNo + '\')" style="cursor: pointer">接诊</a>';
  1097. }
  1098. }
  1099. }
  1100. ],
  1101. responseHandler: function (res) {
  1102. if (res == '401' || res == 401) {
  1103. window.location.href = '/thmz/login/view'
  1104. return;
  1105. }
  1106. var ress = eval(res);
  1107. if (ress.code == -1) {
  1108. new PNotify({
  1109. title: '错误提示',
  1110. text: ress.message,
  1111. type: 'error',
  1112. hide: false,
  1113. styling: 'bootstrap3'
  1114. });
  1115. return {
  1116. "total": 0,//总页数
  1117. "rows": {} //数据
  1118. };
  1119. }
  1120. return {
  1121. "total": ress.total,//总页数
  1122. "rows": ress.data //数据
  1123. };
  1124. },
  1125. onLoadSuccess: function (data) {
  1126. $(".pagination-detail").css("display", "none");
  1127. $("#unClinicNum").html(data.total);
  1128. }
  1129. });
  1130. }
  1131. /**
  1132. * 得到查询的参数
  1133. * @param params
  1134. * @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}}
  1135. */
  1136. function queryParamsUnClinic(params) {
  1137. var temp = {
  1138. pageSize: params.limit,
  1139. pageIndex: params.offset / params.limit, //页码
  1140. statusFlagList: [0, 1, 2, 3]
  1141. };
  1142. return temp;
  1143. };
  1144. /**
  1145. * 通知叫号
  1146. * @param serialNo
  1147. */
  1148. function clinicCallNumber(serialNo) {
  1149. $.ajax({
  1150. type: "GET",
  1151. url: '/thmz/clinicCallNumber?serialNo=' + serialNo,
  1152. contentType: "application/json;charset=UTF-8",
  1153. dataType: "json",
  1154. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1155. success: function (res) {
  1156. if (res == '401' || res == 401) {
  1157. window.location.href = '/thmz/login/view'
  1158. return;
  1159. }
  1160. if (res.code == 0) {
  1161. successMesage(res);
  1162. } else {
  1163. errorMesage(res);
  1164. }
  1165. }
  1166. });
  1167. }
  1168. /**
  1169. * 接诊方法
  1170. * @param patientId 门诊id
  1171. * @param serialNo 分诊流水号
  1172. */
  1173. function clinicalReception(patientId, serialNo) {
  1174. var existPatientId = $("#patientId").text();
  1175. if (existPatientId != null && existPatientId != "" && existPatientId != patientId) {
  1176. $("#messageModal").modal();
  1177. $("#messageContent").html("当前有病人正在接诊,是否切换?");
  1178. $("#messageButton").off("click").on("click", function (t) {
  1179. $("#messageModal").modal("hide");
  1180. //当前有人在接诊,提示是否需要切换和保存
  1181. $("#messagePrescriptionModal").modal();
  1182. $("#confirmPrescriptionButton").off("click").on("click", function (t) {
  1183. $("#messagePrescriptionModal").modal("hide");
  1184. //先保存目前接诊信息,再切换就诊人
  1185. var jsonData = getParamsForpPrescription();
  1186. $.ajax({
  1187. type: "POST",
  1188. url: '/thmz/savePrescription',
  1189. contentType: "application/json;charset=UTF-8",
  1190. dataType: "json",
  1191. data: JSON.stringify(jsonData),
  1192. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1193. success: function (res) {
  1194. if (res == '401' || res == 401) {
  1195. window.location.href = '/thmz/login/view'
  1196. return;
  1197. }
  1198. if (res.code == 0) {
  1199. clearWorkSpace();
  1200. realClinicalReception(patientId, serialNo);
  1201. //加载已接诊患者列表
  1202. loadClinicTableList();
  1203. } else {
  1204. errorMesage(res);
  1205. }
  1206. }
  1207. });
  1208. });
  1209. $("#cancelPrescriptionButton").off("click").on("click", function (t) {
  1210. $("#messagePrescriptionModal").modal("hide");
  1211. clearWorkSpace();
  1212. realClinicalReception(patientId, serialNo);
  1213. });
  1214. });
  1215. $("#cancelButton").off("click");
  1216. } else {
  1217. realClinicalReception(patientId, serialNo);
  1218. }
  1219. }
  1220. /**
  1221. * 取消接诊
  1222. * @param patientId
  1223. */
  1224. function cancelClinic(patientId, times) {
  1225. $("#messageModal").modal();
  1226. $("#messageContent").html("确认取消当前病人的接诊记录吗?");
  1227. $("#messageButton").off("click").on("click", function (t) {
  1228. $("#messageModal").modal("hide");
  1229. $.ajax({
  1230. type: "GET",
  1231. url: '/thmz/cancelClinic?patientId=' + patientId + "&times=" + times,
  1232. contentType: "application/json;charset=UTF-8",
  1233. dataType: "json",
  1234. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1235. success: function (res) {
  1236. if (res == '401' || res == 401) {
  1237. window.location.href = '/thmz/login/view'
  1238. return;
  1239. }
  1240. if (res.code == 0) {
  1241. if (res.data == null || res.data.length == 0) {
  1242. return;
  1243. }
  1244. successMesage(res);
  1245. if (times > 0) {
  1246. loadUnClinicTableList();
  1247. loadInClinicTableList();
  1248. }
  1249. } else if (res.code == -1) {
  1250. errorMesage(res);
  1251. }
  1252. }
  1253. });
  1254. });
  1255. $("#cancelButton").off("click");
  1256. };
  1257. /**
  1258. * 设置当前接诊病人信息
  1259. * @param mzPatientMi
  1260. */
  1261. function setMzPatientInfo(mzPatientMi) {
  1262. $("#patientName").html(mzPatientMi.name);
  1263. $("#patientAge").html(mzPatientMi.age);
  1264. $("#patientGender").html(mzPatientMi.gender);
  1265. $("#patientId").text(mzPatientMi.patientId);
  1266. $("#editUser").css("display", "inline-block");
  1267. $("#clearUser").css("display", "inline-block");
  1268. if (mzPatientMi.phoneNo != null && mzPatientMi.phoneNo != '') {
  1269. $("#patientPhone").html(mzPatientMi.phoneNo);
  1270. $("#patientPhoneLabel").show();
  1271. } else {
  1272. $("#patientPhoneLabel").hide();
  1273. }
  1274. $("#patientResponseType").html(mzPatientMi.responseTypeName);
  1275. if (mzPatientMi.times == 1) {
  1276. $("#first").next().click();
  1277. } else {
  1278. $("#not").next().click();
  1279. }
  1280. $("#patientHisData").text(mzPatientMi.name);
  1281. fitPatientHisData();
  1282. setTmResponseType(mzPatientMi.patientId);
  1283. }
  1284. /**
  1285. * 判断是否是特门病人
  1286. * @param patientId
  1287. */
  1288. function setTmResponseType(patientId) {
  1289. $.ajax({
  1290. type: "GET",
  1291. url: '/thmz/fetchSpcSlwinfo?patientId=' + patientId,
  1292. contentType: "application/json;charset=UTF-8",
  1293. dataType: "json",
  1294. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1295. success: function (res) {
  1296. if (res == '401' || res == 401) {
  1297. window.location.href = '/thmz/login/view'
  1298. return;
  1299. }
  1300. if (res.code == 0) {
  1301. if (res.data != null && res.data.length > 0) {
  1302. $("#patientResponseType").html("特殊门诊");
  1303. $("#fetchSpcSlwinfo").css("display", "inline-block");
  1304. }
  1305. }
  1306. }
  1307. });
  1308. }
  1309. /**
  1310. * 特门详情
  1311. * @param patientId
  1312. */
  1313. function fetchSpcSlwinfo() {
  1314. var patientId = $("#patientId").text();
  1315. $.ajax({
  1316. type: "GET",
  1317. url: '/thmz/fetchSpcSlwinfo?patientId=' + patientId,
  1318. contentType: "application/json;charset=UTF-8",
  1319. dataType: "json",
  1320. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1321. success: function (res) {
  1322. if (res == '401' || res == 401) {
  1323. window.location.href = '/thmz/login/view'
  1324. return;
  1325. }
  1326. if (res.code == 0) {
  1327. if (res.data != null && res.data.length > 0) {
  1328. $("#fetchSpcSlwinfoModal").modal();
  1329. $("#fetchSpcSlwinfoTable").html(null);
  1330. for (var i = 0; i < res.data.length; i++) {
  1331. var begndate = res.data[i].begndate;
  1332. if (begndate == null || begndate == "null") {
  1333. begndate = "";
  1334. }
  1335. var enddate = res.data[i].enddate;
  1336. if (enddate == null || enddate == "null") {
  1337. enddate = "";
  1338. }
  1339. var opspDiseName = res.data[i].opspDiseName;
  1340. if (opspDiseName == null || opspDiseName == "null") {
  1341. opspDiseName = "";
  1342. }
  1343. var opspDiseCode = res.data[i].opspDiseCode;
  1344. if (opspDiseCode == null || opspDiseCode == "null") {
  1345. opspDiseCode = "";
  1346. }
  1347. var ideFixmedinsName = res.data[i].ideFixmedinsName;
  1348. if (ideFixmedinsName == null || ideFixmedinsName == "null") {
  1349. ideFixmedinsName = "";
  1350. }
  1351. $("<tr><td>" + begndate + "</td><td>" + enddate + "</td><td>" + opspDiseCode + "</td><td>" + opspDiseName + "</td><td>" + ideFixmedinsName + "</td></tr>").appendTo("#fetchSpcSlwinfoTable");
  1352. // .bind('click', function () {
  1353. // $("#fetchSpcSlwinfoModal").modal("hide");
  1354. // clinicalReception(patientIdDb, $(this).attr("data-target"));
  1355. // });
  1356. }
  1357. } else {
  1358. errorMesage(res);
  1359. }
  1360. } else {
  1361. errorMesage(res);
  1362. }
  1363. }
  1364. });
  1365. }
  1366. /**
  1367. * 真实的接诊方法
  1368. * @param patientId
  1369. * @param serialNo 分诊流水号
  1370. */
  1371. function realClinicalReception(patientId, serialNo) {
  1372. $.ajax({
  1373. type: "GET",
  1374. url: '/thmz/saveClinic?patientId=' + patientId + "&serialNo=" + serialNo,
  1375. contentType: "application/json;charset=UTF-8",
  1376. dataType: "json",
  1377. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1378. success: function (res) {
  1379. if (res == '401' || res == 401) {
  1380. window.location.href = '/thmz/login/view'
  1381. return;
  1382. }
  1383. if (res.code == 0) {
  1384. if (res.data != null) {
  1385. var mzPatientMi = res.data;
  1386. setMzPatientInfo(mzPatientMi);
  1387. $("#mzfzSerialNoInClick").val(serialNo);
  1388. //加载候诊患者列表
  1389. loadUnClinicTableList();
  1390. //加载接诊中患者列表
  1391. loadInClinicTableList();
  1392. }
  1393. } else {
  1394. errorMesage(res);
  1395. }
  1396. }
  1397. });
  1398. }
  1399. /**
  1400. * 清空工作台
  1401. */
  1402. function clearWorkSpace() {
  1403. clearUser(true);
  1404. clearWorkSpaceExcludeUser();
  1405. }
  1406. /**
  1407. * 清空工作台除了用户信息
  1408. */
  1409. function clearWorkSpaceExcludeUser() {
  1410. $("#symptom").val(null);
  1411. $("#emrHpi").val(null);
  1412. $("#emrPs").val(null);
  1413. $("#personalHistory").val(null);
  1414. $("#familyHistory").val(null);
  1415. $("#obstericalHistory").val(null);
  1416. $("#weight").val(null);
  1417. $("#temperature").val(null);
  1418. $("#sphygmus").val(null);
  1419. $("#breathe").val(null);
  1420. $("#pressure_high").val(null);
  1421. $("#pressure_floor").val(null);
  1422. $("#pressure_high_left").val(null);
  1423. $("#pressure_floor_left").val(null);
  1424. $("#tentativeDiagnosis").val(null);
  1425. $("#otherCheck").val(null);
  1426. $("#diagnoseValue").val(null);
  1427. $("#diagnoseTags").html(null);
  1428. $("#healthEducation").html(null);
  1429. clearWesternMedicine(true);
  1430. clearChineseMedicine();
  1431. clearJyJcItem();
  1432. clearZyReq();
  1433. //initNavTabs(0);
  1434. clearNavTabs(0);
  1435. clearNavTabs(1);
  1436. clearNavTabs(2);
  1437. clearNavTabs(3);
  1438. clearApidAcceptsModal();
  1439. $("#totalAmount").text(0);
  1440. }
  1441. /**
  1442. * 医疗范文详情预览
  1443. * @param id
  1444. */
  1445. function medicalModelModal(id) {
  1446. $.ajax({
  1447. type: "GET",
  1448. url: '/thmz/getTemplateById?id=' + id,
  1449. contentType: "application/json;charset=UTF-8",
  1450. dataType: "json",
  1451. async: false,
  1452. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1453. success: function (res) {
  1454. if (res == '401' || res == 401) {
  1455. window.location.href = '/thmz/login/view'
  1456. return;
  1457. }
  1458. if (res.code == 0) {
  1459. var jsonData = JSON.parse(res.data.templateData);
  1460. $("#vmedicalModelName").text(res.data.name);
  1461. $("#idTemplate").val(res.data.id);
  1462. $("#zsTemplate").html(jsonData.mzBlRecord.emrChiefComplaint);
  1463. $("#xbsTemplate").html(jsonData.mzBlRecord.emrHpi);
  1464. var icdText = res.data.icdText;
  1465. $("#zdTemplate").html("");
  1466. $("#xyzlContent").html("");
  1467. $("#zyzlContent").html("");
  1468. $("#zlyjContent").html("");
  1469. if (icdText != null) {
  1470. var arr = icdText.split(",");
  1471. var html = "";
  1472. for (var i = 0; i < arr.length; i++) {
  1473. if (i == 0) {
  1474. html += ' <div class="tagZdy tagZdy-back">';
  1475. } else {
  1476. html += ' <div class="tagZdy tagZdy-back-green">';
  1477. }
  1478. html += arr[i];
  1479. html += '</div>';
  1480. }
  1481. $("#zdTemplate").html(html);
  1482. }
  1483. var emrProcess = jsonData.mzBlRecord.emrProcess;
  1484. if (emrProcess != null) {
  1485. var xy = null;
  1486. if (emrProcess.indexOf("西药治疗:") >= 0) {
  1487. if (emrProcess.indexOf("中药治疗:") >= 0) {
  1488. xy = emrProcess.substring(emrProcess.indexOf("西药治疗:") + 5, emrProcess.indexOf("中药治疗:"));
  1489. } else if (emrProcess.indexOf("医技与诊疗:") >= 0) {
  1490. xy = emrProcess.substring(emrProcess.indexOf("西药治疗:") + 5, emrProcess.indexOf("医技与诊疗:"));
  1491. } else {
  1492. xy = emrProcess.substring(emrProcess.indexOf("西药治疗:") + 5);
  1493. }
  1494. var arr = xy.split("_");
  1495. if (arr != null && arr.length > 0) {
  1496. var xyhtml = "";
  1497. for (var i = 0; i < arr.length; i++) {
  1498. xyhtml += "<div>";
  1499. xyhtml += arr[i];
  1500. xyhtml += "</div>";
  1501. }
  1502. $("#xyzlContent").html(xyhtml);
  1503. $("#xyzlTitle").removeClass("hide").addClass("in");
  1504. } else {
  1505. $("#xyzlTitle").removeClass("in").addClass("hide");
  1506. }
  1507. } else {
  1508. $("#xyzlTitle").removeClass("in").addClass("hide");
  1509. }
  1510. var zy = null;
  1511. if (emrProcess.indexOf("中药治疗:") >= 0) {
  1512. if (emrProcess.indexOf("医技与诊疗:") >= 0) {
  1513. zy = emrProcess.substring(emrProcess.indexOf("中药治疗:") + 5, emrProcess.indexOf("医技与诊疗:"));
  1514. } else {
  1515. zy = emrProcess.substring(emrProcess.indexOf("中药治疗:") + 5);
  1516. }
  1517. var zyArr = zy.split("_");
  1518. if (zyArr != null && zyArr.length > 0) {
  1519. var zyhtml = "";
  1520. for (var i = 1; i < zyArr.length; i++) {
  1521. zyhtml += "<div>";
  1522. zyhtml += zyArr[i];
  1523. zyhtml += "</div>";
  1524. }
  1525. var zyfs = zyArr[0].substring(zyArr[0].indexOf("付数:") + 3);
  1526. if (zyfs != null && zyfs != "") {
  1527. zyhtml += " <div>";
  1528. zyhtml += ' <div style="text-indent: 2em;">';
  1529. zyhtml += ' <div>';
  1530. zyhtml += 'x<span>';
  1531. zyhtml += zyfs;
  1532. zyhtml += '</span> 付</div></div></div>';
  1533. }
  1534. $("#zyzlContent").html(zyhtml);
  1535. $("#zyzlTitle").removeClass("hide").addClass("in");
  1536. } else {
  1537. $("#zyzlTitle").removeClass("in").addClass("hide");
  1538. }
  1539. } else {
  1540. $("#zyzlTitle").removeClass("in").addClass("hide");
  1541. }
  1542. if (emrProcess.indexOf("医技与诊疗:") >= 0) {
  1543. var zlyj = emrProcess.substring(emrProcess.indexOf("医技与诊疗:") + 6);
  1544. var zlyjArr = zlyj.split("_");
  1545. if (zlyjArr != null && zlyjArr.length > 0) {
  1546. var zlyjhtml = "";
  1547. for (var i = 0; i < zlyjArr.length; i++) {
  1548. zlyjhtml += "<div>";
  1549. zlyjhtml += zlyjArr[i];
  1550. zlyjhtml += "</div>";
  1551. }
  1552. $("#zlyjContent").html(zlyjhtml);
  1553. $("#zlyjTitle").removeClass("hide").addClass("in");
  1554. } else {
  1555. $("#zlyjTitle").removeClass("in").addClass("hide");
  1556. }
  1557. } else {
  1558. $("#zlyjTitle").removeClass("in").addClass("hide");
  1559. }
  1560. }
  1561. } else {
  1562. errorMesage(res);
  1563. }
  1564. }
  1565. });
  1566. $("#medicalModelModal").modal();
  1567. }
  1568. /**
  1569. * 诊疗项目回写
  1570. * @param code
  1571. * @param mzChargeDetail
  1572. */
  1573. function callBackZlDetail(code, mzChargeDetail) {
  1574. //诊疗项目
  1575. $.ajax({
  1576. type: "GET",
  1577. url: '/thmz/getJcJyItemByCommonParams?commonParams=' + code,
  1578. contentType: "application/json;charset=UTF-8",
  1579. dataType: "json",
  1580. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1581. async: false,
  1582. success: function (res) {
  1583. if (res == '401' || res == 401) {
  1584. window.location.href = '/thmz/login/view'
  1585. return;
  1586. }
  1587. if (res.code == 0) {
  1588. if (res.data != null && res.data.length > 0) {
  1589. //如果
  1590. if ($("#zlTab").find("li") == null || $("#zlTab").find("li").length == 0) {
  1591. initNavTabs(2);
  1592. }
  1593. var row = res.data[0];
  1594. $("#jcJyItem").val(row.name);
  1595. $("#jcJyItem").blur();
  1596. $("#jcjyItemPrice").val(row.chargeAmount);
  1597. $("#chargeUnit").val(row.specification);
  1598. $("#current_code").val(row.code);
  1599. $("#remark").val(mzChargeDetail.instructionText);
  1600. $("#jcJyZltype").val(row.type);
  1601. if (mzChargeDetail.execDept != null && mzChargeDetail.execDept != "") {
  1602. $("#execUnit").selectpicker('val', mzChargeDetail.execDept);
  1603. $('#execUnit').selectpicker('refresh');
  1604. }
  1605. $("#itemQuantity").val(mzChargeDetail.quantity);
  1606. saveJyJcItem(false);
  1607. }
  1608. } else {
  1609. errorMesage(res);
  1610. }
  1611. }
  1612. });
  1613. }
  1614. /**
  1615. * 处方回写
  1616. * @param jsonData 处方数据
  1617. * @param type 回写类型 0 全部回写 1 医疗范文 2 就诊详情
  1618. */
  1619. function editPrescription(jsonData, type) {
  1620. var firstOrNot = jsonData.firstOrNot;
  1621. var conciseRecordsFlagYlfw = $("#conciseRecordsYlfw").parent().hasClass("checked");
  1622. var prescriptionSubsidiaryFlagYlfw = $("#prescriptionSubsidiaryYlfw").parent().hasClass("checked");
  1623. var conciseRecordsFlagJzxq = $("#conciseRecordsJzxq").parent().hasClass("checked");
  1624. var prescriptionSubsidiaryFlagJzxq = $("#prescriptionSubsidiaryJzxq").parent().hasClass("checked");
  1625. if (firstOrNot == 0) {
  1626. $("#first").next().click();
  1627. } else if (firstOrNot == 1) {
  1628. $("#not").next().click();
  1629. }
  1630. if (type == 0 || (type == 1 && conciseRecordsFlagYlfw == true) || (type == 2 && conciseRecordsFlagJzxq == true)) {
  1631. $("#symptom").val(jsonData.mzBlRecord.emrChiefComplaint);
  1632. $("#emrHpi").val(jsonData.mzBlRecord.emrHpi);
  1633. $("#emrPs").val(jsonData.mzBlRecord.emrPs);
  1634. $("#personalHistory").val(jsonData.mzBlRecord.personalHistory);
  1635. $("#familyHistory").val(jsonData.mzBlRecord.familyHistory);
  1636. $("#obstericalHistory").val(jsonData.mzBlRecord.obstericalHistory);
  1637. if (jsonData.mzBlRecord.weight != null && jsonData.mzBlRecord.weight != 0) {
  1638. $("#weight").val(jsonData.mzBlRecord.weight);
  1639. } else {
  1640. $("#weight").val("");
  1641. }
  1642. if (jsonData.mzBlRecord.temperature != null && jsonData.mzBlRecord.temperature != 0) {
  1643. $("#temperature").val(jsonData.mzBlRecord.temperature);
  1644. } else {
  1645. $("#temperature").val("");
  1646. }
  1647. if (jsonData.mzBlRecord.sphygmus != null && jsonData.mzBlRecord.sphygmus != 0) {
  1648. $("#sphygmus").val(jsonData.mzBlRecord.sphygmus);
  1649. } else {
  1650. $("#sphygmus").val("");
  1651. }
  1652. if (jsonData.mzBlRecord.breathe != null && jsonData.mzBlRecord.breathe != 0) {
  1653. $("#breathe").val(jsonData.mzBlRecord.breathe);
  1654. } else {
  1655. $("#breathe").val("");
  1656. }
  1657. if (jsonData.mzBlRecord.pressureHigh != null && jsonData.mzBlRecord.pressureHigh != 0) {
  1658. $("#pressure_high").val(jsonData.mzBlRecord.pressureHigh);
  1659. } else {
  1660. $("#pressure_high").val("");
  1661. }
  1662. if (jsonData.mzBlRecord.pressureFloor != null && jsonData.mzBlRecord.pressureFloor != 0) {
  1663. $("#pressure_floor").val(jsonData.mzBlRecord.pressureFloor);
  1664. } else {
  1665. $("#pressure_floor").val("");
  1666. }
  1667. if (jsonData.mzBlRecord.pressureHighLeft != null && jsonData.mzBlRecord.pressureHighLeft != 0) {
  1668. $("#pressure_high_left").val(jsonData.mzBlRecord.pressureHighLeft);
  1669. } else {
  1670. $("#pressure_high_left").val("");
  1671. }
  1672. if (jsonData.mzBlRecord.pressureFloorLeft != null && jsonData.mzBlRecord.pressureFloorLeft != 0) {
  1673. $("#pressure_floor_left").val(jsonData.mzBlRecord.pressureFloorLeft);
  1674. } else {
  1675. $("#pressure_floor_left").val("");
  1676. }
  1677. $("#tentativeDiagnosis").val(jsonData.mzBlRecord.tentativeDiagnosis);
  1678. $("#otherCheck").val(jsonData.mzBlRecord.emrPe);
  1679. var icdCode = jsonData.icdCode;
  1680. var icdText = jsonData.icdText;
  1681. var icdCodeArr = icdCode != null ? icdCode.split(",") : null;
  1682. var icdTextArr = icdText != null ? icdText.split(",") : null;
  1683. if (icdCodeArr != null && icdCodeArr.length > 0 && icdTextArr != null && icdTextArr.length > 0) {
  1684. for (var i = 0; i < icdCodeArr.length; i++) {
  1685. fitDiagnoseValue(icdTextArr[i], icdCodeArr[i]);
  1686. }
  1687. }
  1688. $("#healthEducation").val(jsonData.mzBlRecord.emrJkjy);
  1689. }
  1690. if (type == 0 || (type == 1 && prescriptionSubsidiaryFlagYlfw == true) || (type == 2 && prescriptionSubsidiaryFlagJzxq == true)) {
  1691. var mzChargeDetailList = jsonData.mzChargeDetailList;
  1692. var mzZyReq = jsonData.mzZyReq;
  1693. //中药的公共参数是否已经设置了
  1694. var hadSetZyFullParams = false;
  1695. //西药,成药,医材,麻精,中药,诊疗
  1696. if (mzChargeDetailList != null && mzChargeDetailList.length > 0) {
  1697. for (var i = 0; i < mzChargeDetailList.length; i++) {
  1698. var mzChargeDetail = mzChargeDetailList[i];
  1699. var groupNo = mzChargeDetail.groupNo;
  1700. var code = mzChargeDetail.chargeItemCode;
  1701. var serial = mzChargeDetail.serial;
  1702. if (groupNo == "00") {
  1703. callBackZlDetail(code, mzChargeDetail);
  1704. } else if (groupNo == "71" || groupNo == "91" || groupNo == "111" || groupNo == "131") {
  1705. // 71 西成药 91 医材 111 精一 131 精二
  1706. var groupOrder = mzChargeDetail.groupOrder;
  1707. if (groupOrder == null || groupOrder == 'null' || groupOrder == "") {
  1708. groupOrder = 1;
  1709. }
  1710. $("#groupId").selectpicker('val', groupOrder);
  1711. $('#groupId').selectpicker('refresh');
  1712. checkYpInfo(code, serial, groupNo, false);
  1713. // 给药方式 同组药品给药方式相同
  1714. $("#supplyType").selectpicker('val', mzChargeDetail.supplyCode);
  1715. $('#supplyType').selectpicker('refresh');
  1716. $("#drugWin").val(mzChargeDetail.drugQuan);
  1717. $("#drugWinUnit").selectpicker('val', mzChargeDetail.drugUnit);
  1718. $('#drugWinUnit').selectpicker('refresh');
  1719. //天数 同组药品天数相同
  1720. $("#dayNum").selectpicker('val', mzChargeDetail.orderDays);
  1721. $('#dayNum').selectpicker('refresh');
  1722. //频次编码 同组药品频次编码相同
  1723. $("#orderFrequency").selectpicker('val', mzChargeDetail.frequency);
  1724. $('#orderFrequency').selectpicker('refresh');
  1725. if (mzChargeDetail.tryFlag == 1 || mzChargeDetail.tryFlag == "1") {
  1726. $("#tryFlag").parent().addClass("checked");
  1727. } else {
  1728. $("#tryFlag").parent().removeClass("checked");
  1729. }
  1730. $("#gross").val(mzChargeDetail.quantity);
  1731. $("#totalRetprice").val(Multiply(mzChargeDetail.quantity, $("#packRetprice").val()).toFixed(2));
  1732. $("#medicalAdvice").selectpicker('val', mzChargeDetail.instructionCode);
  1733. $('#medicalAdvice').selectpicker('refresh');
  1734. saveWesternMedicine(false);
  1735. $("#western_medicine_button").click();
  1736. } else {
  1737. //中药与颗粒剂
  1738. checkZyInfo(code, serial, false);
  1739. //类型
  1740. $("#zyClassType").selectpicker('val', groupNo);
  1741. $('#zyClassType').selectpicker('refresh');
  1742. $("#zy_drugWin").val(mzChargeDetail.quantity);
  1743. $("#zyInstruction").selectpicker('val', mzChargeDetail.instructionCode);
  1744. $('#zyInstruction').selectpicker('refresh');
  1745. saveChineseMedicine(false);
  1746. if (!hadSetZyFullParams) {
  1747. hadSetZyFullParams = true;
  1748. $("input.zyfs").val(mzChargeDetail.drugWin);
  1749. $("#zy_orderFrequency_1").selectpicker('val', mzChargeDetail.frequency);
  1750. $('#zy_orderFrequency_1').selectpicker('refresh');
  1751. $("#useType_1").selectpicker('val', mzChargeDetail.cyFysm);
  1752. $('#useType_1').selectpicker('refresh');
  1753. $("#cyJssm").selectpicker('val', mzChargeDetail.cyJssm);
  1754. $('#cyJssm').selectpicker('refresh');
  1755. $("#zy_supplyType_1").selectpicker('val', mzChargeDetail.cyDj);
  1756. $('#zy_supplyType_1').selectpicker('refresh');
  1757. }
  1758. $("#chinese_medicine_button").click();
  1759. }
  1760. }
  1761. }
  1762. //检验与检查
  1763. var mzYjReqList = jsonData.mzYjReqList;
  1764. if (mzYjReqList != null && mzYjReqList.length > 0) {
  1765. for (var i = 0; i < mzYjReqList.length; i++) {
  1766. var mzYjReq = mzYjReqList[i];
  1767. var code = mzYjReq.orderCode;
  1768. var jcJyZltype = null;
  1769. if (mzYjReq.reqType == 2) {
  1770. jcJyZltype = 1;
  1771. $("#jyZdSample").selectpicker('val', mzYjReq.inspectStuff);
  1772. $('#jyZdSample').selectpicker('refresh');
  1773. } else if (mzYjReq.reqType == 3) {
  1774. jcJyZltype = 2;
  1775. $("#yshPart").selectpicker('val', mzYjReq.inspectPart);
  1776. $('#yshPart').selectpicker('refresh');
  1777. }
  1778. $("#jcJyZltype").val(jcJyZltype);
  1779. checkJcJyItemInfo(code, null, jcJyZltype, false);
  1780. $("#remark").val(mzYjReq.jyRemark);
  1781. if (mzYjReq.execDept != null && mzYjReq.execDept != "") {
  1782. $("#execUnit").selectpicker('val', mzYjReq.execDept);
  1783. $('#execUnit').selectpicker('refresh');
  1784. }
  1785. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  1786. saveJyJcItem(false);
  1787. $("#jcJyItemChargeDetail").removeClass("in").addClass("hide");
  1788. }
  1789. $("#yj_req_button").click();
  1790. }
  1791. //入院证
  1792. if (mzZyReq != null && mzZyReq.reqDept != null && mzZyReq.reqDept != "") {
  1793. $("#inpatientWardBeHospitalized").selectpicker('val', mzZyReq.reqDept);
  1794. $('#inpatientWardBeHospitalized').selectpicker('refresh');
  1795. initSmallDeptByDept();
  1796. $("#admissStatus").selectpicker('val', mzZyReq.admissStatus);
  1797. $('#admissStatus').selectpicker('refresh');
  1798. setTimeout(function () {
  1799. $("#smallWardBeHospitalized").selectpicker('val', mzZyReq.smallDept);
  1800. $('#smallWardBeHospitalized').selectpicker('refresh');
  1801. saveZyReq(false);
  1802. }, 500);
  1803. $("#zy_req_button").click();
  1804. }
  1805. }
  1806. setTimeout(function () {
  1807. //设置总金额 计算金额的时候,可能处方还没有回写完
  1808. calculateTotalAmount();
  1809. }, 1000);
  1810. }
  1811. /**
  1812. * 调用医疗范文
  1813. */
  1814. function callTemplate() {
  1815. clearWorkSpaceExcludeUser();
  1816. $.ajax({
  1817. type: "GET",
  1818. url: '/thmz/increaseNumber?id=' + $("#idTemplate").val(),
  1819. contentType: "application/json;charset=UTF-8",
  1820. dataType: "json",
  1821. async: false,
  1822. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1823. success: function (res) {
  1824. if (res == '401' || res == 401) {
  1825. window.location.href = '/thmz/login/view'
  1826. return;
  1827. }
  1828. if (res.code == 0) {
  1829. var jsonData = JSON.parse(res.data.templateData);
  1830. editPrescription(jsonData, 1);
  1831. $("#templateId").val(res.data.id);
  1832. $("#templateName").val(res.data.name);
  1833. $("#templateKindType").selectpicker('val', res.data.templateKindType);
  1834. $("#templateKindType").selectpicker('refresh');
  1835. $("#templateType").selectpicker('val', res.data.templateType);
  1836. $("#templateType").selectpicker('refresh');
  1837. $("#medicalModelModal").modal("hide");
  1838. closePopover();
  1839. } else {
  1840. errorMesage(res);
  1841. }
  1842. }
  1843. });
  1844. }
  1845. /**
  1846. * 底层填充推荐方法
  1847. * @param paramsType
  1848. * @param appeal
  1849. * @param inputId
  1850. */
  1851. function extracted(paramsType, appeal, inputId) {
  1852. if (paramsType == 13) {
  1853. var contentArr = appeal.split(",");
  1854. if (contentArr != null && contentArr.length > 0) {
  1855. for (var i = 0; i < contentArr.length; i++) {
  1856. var content = contentArr[i].replace(")", "").replace("(", "-");
  1857. var diagnoseArr = content.split("-");
  1858. if (diagnoseArr == null || diagnoseArr.length == 0) {
  1859. continue;
  1860. }
  1861. fitDiagnoseValue(diagnoseArr[0], diagnoseArr[1]);
  1862. }
  1863. }
  1864. } else {
  1865. $("#" + inputId).val(appeal);
  1866. }
  1867. }
  1868. /**
  1869. * 填充推荐
  1870. * @param appeal
  1871. * @param paramsType
  1872. * @param id
  1873. */
  1874. function fitAppeal(appeal, paramsType, id) {
  1875. var inputId = "symptom";
  1876. var text = "主诉项已经录入,是否覆盖?";
  1877. if (paramsType == 5) {
  1878. inputId = "emrHpi";
  1879. text = "现病史项已经录入,是否覆盖?";
  1880. } else if (paramsType == 6) {
  1881. inputId = "emrPs";
  1882. text = "既往史项已经录入,是否覆盖?";
  1883. } else if (paramsType == 13) {
  1884. inputId = "diagnoseValue";
  1885. text = "诊断项已经录入,是否覆盖?";
  1886. }
  1887. var symptom = $("#" + inputId).val();
  1888. if (paramsType == 13 && (symptom == ",," || symptom == ",")) {
  1889. symptom = null;
  1890. }
  1891. if (symptom != null && symptom != "") {
  1892. $("#messageModal").modal();
  1893. $("#messageContent").html(text);
  1894. $("#messageButton").off("click").on("click", function (t) {
  1895. $("#messageModal").modal("hide");
  1896. if (paramsType == 13) {
  1897. $("#" + inputId).val(null);
  1898. $("#diagnoseTags").html(null);
  1899. }
  1900. extracted(paramsType, appeal, inputId);
  1901. });
  1902. $("#cancelButton").off("click");
  1903. } else {
  1904. extracted(paramsType, appeal, inputId);
  1905. }
  1906. $.ajax({
  1907. type: "GET",
  1908. url: '/thmz/increaseTcCommonParamsNumber?id=' + id,
  1909. contentType: "application/json;charset=UTF-8",
  1910. dataType: "json",
  1911. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1912. success: function (res) {
  1913. }
  1914. });
  1915. }
  1916. /**
  1917. * 初始嘱托下拉选
  1918. */
  1919. function initInstructionSelect() {
  1920. //西药医嘱
  1921. $.ajax({
  1922. type: "GET",
  1923. url: '/thmz/getMzZdInstructionByType?instructionType=0',
  1924. contentType: "application/json;charset=UTF-8",
  1925. dataType: "json",
  1926. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1927. success: function (res) {
  1928. if (res == '401' || res == 401) {
  1929. window.location.href = '/thmz/login/view'
  1930. return;
  1931. }
  1932. if (res.code == 0) {
  1933. res.data.forEach(function (item, index) {
  1934. var html = '<option value="' + item.code + '">' + item.instructionText + '</option>';
  1935. $('#medicalAdvice').append(html);
  1936. });
  1937. $('#medicalAdvice').selectpicker('refresh');
  1938. } else {
  1939. errorMesage(res);
  1940. }
  1941. }
  1942. });
  1943. //中药医嘱
  1944. $.ajax({
  1945. type: "GET",
  1946. url: '/thmz/getMzZdInstructionByType?instructionType=1',
  1947. contentType: "application/json;charset=UTF-8",
  1948. dataType: "json",
  1949. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1950. success: function (res) {
  1951. if (res == '401' || res == 401) {
  1952. window.location.href = '/thmz/login/view'
  1953. return;
  1954. }
  1955. if (res.code == 0) {
  1956. res.data.forEach(function (item, index) {
  1957. var html = '<option value="' + item.code + '">' + item.instructionText.trim() + '</option>';
  1958. $('#zyInstruction').append(html);
  1959. });
  1960. $('#zyInstruction').selectpicker('refresh');
  1961. } else {
  1962. errorMesage(res);
  1963. }
  1964. }
  1965. });
  1966. }
  1967. /**
  1968. * 设置下拉选的尺寸
  1969. */
  1970. function setSelectSize() {
  1971. $(".selectpicker").selectpicker({
  1972. dropuAuto: false,
  1973. size: 10
  1974. });
  1975. //$('#icdCodeBeHospitalized').parent().addClass("hide");
  1976. }
  1977. /**
  1978. * 初始化性别下拉选
  1979. */
  1980. function initGenderSelect() {
  1981. var gender = '<option value="1">男</option><option value="2">女</option><option value="0">未知</option>';
  1982. $('#rapidAcceptsUserGender').html(gender);
  1983. $('#rapidAcceptsUserGender').selectpicker('refresh');
  1984. $('#editUserGender').html(gender);
  1985. $('#editUserGender').selectpicker('refresh');
  1986. //医疗范文状态
  1987. var templateStatus = '<option value="0">启用</option><option value="1">停用</option>';
  1988. $('#templateStatus').html(templateStatus);
  1989. $('#templateStatus').selectpicker('refresh');
  1990. }
  1991. /**
  1992. * 初始化中药类型下拉选
  1993. */
  1994. function initZyClassTypeSelect() {
  1995. var gender = '<option value="81">普通</option><option value="82">颗粒剂</option>';
  1996. $('#zyClassType').html(gender);
  1997. $('#zyClassType').selectpicker('refresh');
  1998. //$('#zyClassType').selectpicker('val', "81");
  1999. // $('#zyClassType').selectpicker('refresh');
  2000. }
  2001. /**
  2002. * 初始化病人身份类别下拉选
  2003. */
  2004. function initResponceTypeSelect() {
  2005. $.ajax({
  2006. type: "GET",
  2007. url: '/thmz/getMzResponceType',
  2008. contentType: "application/json;charset=UTF-8",
  2009. dataType: "json",
  2010. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2011. success: function (res) {
  2012. if (res == '401' || res == 401) {
  2013. window.location.href = '/thmz/login/view'
  2014. return;
  2015. }
  2016. if (res.code == 0) {
  2017. res.data.forEach(function (item, index) {
  2018. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  2019. $('#patientsNature').append(html);
  2020. $('#editUserPatientsNature').append(html);
  2021. // $('#responeTypeBeHospitalized').append(html);
  2022. });
  2023. $('#patientsNature').selectpicker('refresh');
  2024. $('#editUserPatientsNature').selectpicker('refresh');
  2025. } else {
  2026. errorMesage(res);
  2027. }
  2028. }
  2029. });
  2030. }
  2031. /**
  2032. * 所有的入院状态
  2033. */
  2034. function iniAdmissStatus() {
  2035. $.ajax({
  2036. type: "GET",
  2037. url: '/thmz/getAdmissStatus',
  2038. dataType: "json",
  2039. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2040. success: function (res) {
  2041. if (res == '401' || res == 401) {
  2042. window.location.href = '/thmz/login/view'
  2043. return;
  2044. }
  2045. var html = '';
  2046. $.each(res.data, function (commentIndex, comment) {
  2047. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  2048. });
  2049. $('#admissStatus').empty();
  2050. $('#admissStatus').html(html);
  2051. $('#admissStatus').selectpicker('destroy').selectpicker('refresh');
  2052. }
  2053. });
  2054. }
  2055. /**
  2056. * 入院登记的病区列表
  2057. */
  2058. function initListDeptSelect() {
  2059. //科室列表
  2060. $.ajax({
  2061. type: "GET",
  2062. url: '/thmz/allInpatientWard',
  2063. dataType: "json",
  2064. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2065. success: function (data) {
  2066. if (data == '401' || data == 401) {
  2067. window.location.href = '/thmz/login/view'
  2068. return;
  2069. }
  2070. var html = '';
  2071. $.each(data.data, function (commentIndex, comment) {
  2072. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';
  2073. });
  2074. $('#inpatientWardBeHospitalized').empty();
  2075. $('#inpatientWardBeHospitalized').html(html);
  2076. $('#inpatientWardBeHospitalized').selectpicker('refresh');
  2077. initSmallDeptByDept();
  2078. }
  2079. });
  2080. }
  2081. /**
  2082. * 小科室列表
  2083. */
  2084. function initSmallDeptByDept() {
  2085. //小科室列表
  2086. $.ajax({
  2087. type: "GET",
  2088. url: '/thmz/getSmallDeptByDept?code=' + $('#inpatientWardBeHospitalized').val(),
  2089. dataType: "json",
  2090. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2091. success: function (res) {
  2092. if (res == '401' || res == 401) {
  2093. window.location.href = '/thmz/login/view'
  2094. return;
  2095. }
  2096. var html = '';
  2097. $.each(res.data, function (commentIndex, comment) {
  2098. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  2099. });
  2100. $('#smallWardBeHospitalized').empty();
  2101. $('#smallWardBeHospitalized').html(html);
  2102. $('#smallWardBeHospitalized').selectpicker('destroy').selectpicker('refresh');
  2103. }
  2104. });
  2105. //病床数
  2106. $.ajax({
  2107. type: "GET",
  2108. url: '/thmz/getBedStatusNumByDept?code=' + $('#inpatientWardBeHospitalized').val(),
  2109. dataType: "json",
  2110. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2111. success: function (res) {
  2112. if (res == '401' || res == 401) {
  2113. window.location.href = '/thmz/login/view'
  2114. return;
  2115. }
  2116. if (res.code == 0) {
  2117. var data = res.data;
  2118. if (data == null) {
  2119. $("#totalBedNum").val(0);
  2120. $("#freeBedNum").val(0);
  2121. $("#occupationBedNum").val(0);
  2122. } else {
  2123. $("#totalBedNum").val(data.total);
  2124. $("#freeBedNum").val(data.free);
  2125. $("#occupationBedNum").val(data.occupation);
  2126. }
  2127. } else {
  2128. errorMesage(res);
  2129. }
  2130. }
  2131. });
  2132. }
  2133. //
  2134. // /**
  2135. // * 初始化诊断下拉选
  2136. // */
  2137. // function initIcdSelect() {
  2138. // var icdCodeInputBeHospitalized = $("#icdCodeInputBeHospitalized").val()
  2139. // $.ajax({
  2140. // type: "GET",
  2141. // url: '/thmz/getTCommonParamsByParamsType?paramsType=4&commonParams=' + icdCodeInputBeHospitalized + '&pageSize=100',
  2142. // contentType: "application/json;charset=UTF-8",
  2143. // dataType: "json",
  2144. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2145. // success: function (res) {
  2146. // if (res == '401' || res == 401) {
  2147. // window.location.href = '/thmz/login/view'
  2148. // return;
  2149. // }
  2150. // var html = '';
  2151. // if (res.code == 0) {
  2152. // if (res.data != null && res.data.length > 0) {
  2153. // var html = '';
  2154. // for (var i = 0; i < res.data.length; i++) {
  2155. // html += '<option value="' + res.data[i].paramsCode + '">' + res.data[i].paramsName + '(' + res.data[i].paramsCode + ')</option>';
  2156. // }
  2157. // $('#icdCodeBeHospitalized').empty();
  2158. // $('#icdCodeBeHospitalized').html(html);
  2159. // $('#icdCodeBeHospitalized').selectpicker('destroy').selectpicker('refresh');
  2160. // $('#icdCodeBeHospitalized').parent().addClass("open");
  2161. // $('#icdCodeBeHospitalized').next().addClass("hide");
  2162. // $('#icdCodeBeHospitalized').next().next().css("margin-top", "-34px");
  2163. // }
  2164. // } else {
  2165. // errorMesage(res);
  2166. // }
  2167. // }
  2168. // });
  2169. // }
  2170. //
  2171. // /**
  2172. // * 设置诊断内容
  2173. // */
  2174. // function setIcdText() {
  2175. // var icdCodeBeHospitalized = $('#icdCodeBeHospitalized option:selected').text();
  2176. // if (icdCodeBeHospitalized != null) {
  2177. // var icdText = icdCodeBeHospitalized.substring(0, icdCodeBeHospitalized.indexOf("("));
  2178. // $("#icdTextBeHospitalized").val(icdText);
  2179. // $("#icdCodeInputBeHospitalized").val($('#icdCodeBeHospitalized').val());
  2180. // $("#icdTextBeHospitalized").attr("title", icdText);
  2181. // } else {
  2182. // $("#icdTextBeHospitalized").val("");
  2183. // $("#icdCodeInputBeHospitalized").val("");
  2184. // $("#icdTextBeHospitalized").attr("title", "");
  2185. // }
  2186. // $('#icdCodeBeHospitalized').parent().addClass("hide");
  2187. // }
  2188. /**
  2189. * 初始化医疗范文范围下拉选
  2190. */
  2191. function initTemplateTypeSelect() {
  2192. $.ajax({
  2193. type: "GET",
  2194. url: '/thmz/getTemplateTypes',
  2195. contentType: "application/json;charset=UTF-8",
  2196. dataType: "json",
  2197. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2198. success: function (res) {
  2199. if (res == '401' || res == 401) {
  2200. window.location.href = '/thmz/login/view'
  2201. return;
  2202. }
  2203. if (res.code == 0) {
  2204. res.data.forEach(function (item) {
  2205. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  2206. $('#templateType').append(html);
  2207. });
  2208. $('#templateType').selectpicker('refresh');
  2209. } else {
  2210. errorMesage(res);
  2211. }
  2212. }
  2213. });
  2214. }
  2215. /**
  2216. * 初始化医疗范文类型下拉选
  2217. * @param templateKindTypeId
  2218. */
  2219. function initTemplateKindTypeSelect(templateKindTypeId) {
  2220. $.ajax({
  2221. type: "GET",
  2222. url: '/thmz/getTemplateKindTypes',
  2223. contentType: "application/json;charset=UTF-8",
  2224. dataType: "json",
  2225. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2226. success: function (res) {
  2227. if (res == '401' || res == 401) {
  2228. window.location.href = '/thmz/login/view'
  2229. return;
  2230. }
  2231. if (res.code == 0) {
  2232. res.data.forEach(function (item) {
  2233. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  2234. $('#' + templateKindTypeId).append(html);
  2235. });
  2236. $('#' + templateKindTypeId).selectpicker('refresh');
  2237. } else {
  2238. errorMesage(res);
  2239. }
  2240. }
  2241. });
  2242. }
  2243. /**
  2244. * 初始频次下拉选
  2245. * @param id
  2246. * @param async 是否是异步 true 异步 false 同步
  2247. */
  2248. function initOrderFrequencys(id, async) {
  2249. $.ajax({
  2250. type: "GET",
  2251. url: '/thmz/getOrderFrequencys',
  2252. dataType: "json",
  2253. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2254. async: async,
  2255. success: function (res) {
  2256. if (res == '401' || res == 401) {
  2257. window.location.href = '/thmz/login/view'
  2258. return;
  2259. }
  2260. var html = '';
  2261. $.each(res.data, function (commentIndex, comment) {
  2262. html += '<option value="' + comment.code + '" desc="' + comment.times + '">' + comment.name + '(' + comment.code + ')' + '</option>';
  2263. });
  2264. $('#' + id).empty();
  2265. $('#' + id).html(html);
  2266. $('#' + id).selectpicker('refresh');
  2267. }
  2268. });
  2269. }
  2270. /**
  2271. * 初始用药方式下拉选
  2272. */
  2273. function initSupplyTypes() {
  2274. $.ajax({
  2275. type: "GET",
  2276. url: '/thmz/getSupplyTypes',
  2277. dataType: "json",
  2278. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2279. success: function (res) {
  2280. if (res == '401' || res == 401) {
  2281. window.location.href = '/thmz/login/view'
  2282. return;
  2283. }
  2284. var html = '';
  2285. $.each(res.data, function (commentIndex, comment) {
  2286. if (comment.supplyOcc === "71") {
  2287. html += '<option value="' + comment.supplyCode + '">' + comment.supplyName + '[' + comment.pyCode + ']' + '</option>';
  2288. }
  2289. });
  2290. $('#supplyType').empty();
  2291. $('#supplyType').html(html);
  2292. $('#supplyType').selectpicker('refresh');
  2293. }
  2294. });
  2295. }
  2296. /**
  2297. * 初始煎药方式下拉选
  2298. * @param async 是否是异步 true 异步 false 同步
  2299. */
  2300. function initZySupplyTypes(id, async) {
  2301. setSelectSize();
  2302. $.ajax({
  2303. type: "GET",
  2304. url: '/thmz/getSupplyTypes',
  2305. dataType: "json",
  2306. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2307. async: async,
  2308. success: function (res) {
  2309. if (res == '401' || res == 401) {
  2310. window.location.href = '/thmz/login/view'
  2311. return;
  2312. }
  2313. var html = '';
  2314. $.each(res.data, function (commentIndex, comment) {
  2315. if (comment.supplyOcc === "81") {
  2316. // html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  2317. html += '<option value="' + comment.supplyCode + '">' + comment.supplyName + '[' + comment.pyCode + ']' + '</option>';
  2318. }
  2319. });
  2320. $('#' + id).empty();
  2321. $('#' + id).html(html);
  2322. $('#' + id).selectpicker('refresh');
  2323. }
  2324. });
  2325. }
  2326. /**
  2327. * 初始查检查部位
  2328. */
  2329. function initYshPart() {
  2330. setSelectSize();
  2331. $.ajax({
  2332. type: "GET",
  2333. url: '/thmz/getYshPart',
  2334. dataType: "json",
  2335. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2336. success: function (res) {
  2337. if (res == '401' || res == 401) {
  2338. window.location.href = '/thmz/login/view'
  2339. return;
  2340. }
  2341. var html = '';
  2342. $.each(res.data, function (commentIndex, comment) {
  2343. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')' + '</option>';
  2344. });
  2345. $('#yshPart').empty();
  2346. $('#yshPart').html(html);
  2347. $('#yshPart').selectpicker('refresh');
  2348. }
  2349. });
  2350. }
  2351. /**
  2352. * 初始化验物下拉选
  2353. */
  2354. function initJyZdSample() {
  2355. setSelectSize();
  2356. $.ajax({
  2357. type: "GET",
  2358. url: '/thmz/getJyZdSample',
  2359. dataType: "json",
  2360. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2361. success: function (res) {
  2362. if (res == '401' || res == 401) {
  2363. window.location.href = '/thmz/login/view'
  2364. return;
  2365. }
  2366. var html = '';
  2367. $.each(res.data, function (commentIndex, comment) {
  2368. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')' + '</option>';
  2369. });
  2370. $('#jyZdSample').empty();
  2371. $('#jyZdSample').html(html);
  2372. $('#jyZdSample').selectpicker('refresh');
  2373. }
  2374. });
  2375. }
  2376. /**
  2377. * 保存当前药品到右边处方区域
  2378. * @param index 0 西药 1中药 2 诊疗和社备
  2379. */
  2380. function saveMedicine(index) {
  2381. if (index == 0) {
  2382. // //每个处方不能超过5个药品
  2383. // var tableId = $("#xyTab li.active").find("a").attr("href");
  2384. // var childrens = $(tableId).find("div:eq(0)").children().length;
  2385. // if (childrens === 5) {
  2386. // $("#messageModal").modal();
  2387. // $("#messageContent").html("单张处方最多只能开具5个药品,是否需要新增处方?");
  2388. // $("#messageButton").off("click").on("click", function (t) {
  2389. // $("#messageModal").modal("hide");
  2390. // refreshNavTabs(index);
  2391. // saveWesternMedicine();
  2392. // });
  2393. // } else {
  2394. // saveWesternMedicine();
  2395. // }
  2396. saveWesternMedicine(true);
  2397. } else if (index == 1) {
  2398. saveChineseMedicine(true);
  2399. }
  2400. }
  2401. /**
  2402. * 保存当前药品到右边处方区域 西药
  2403. * calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  2404. */
  2405. function saveWesternMedicine(calculateTotalAmountFlag) {
  2406. //组号
  2407. var groupId = $("#groupId").val();
  2408. //药品名称
  2409. var westernMedicineNamme = $("#western_medicine_name").val();
  2410. //当前药品编码
  2411. var currentCode = $("#current_code").val();
  2412. //当前药品规格
  2413. var currentSerial = $("#current_serial").val();
  2414. //当前药房编码
  2415. var currentGroupNo = $("#current_groupNo").val();
  2416. //用法编码
  2417. var supplyType = $("#supplyType").val();
  2418. //用法描述
  2419. var supplyTypeText = $('#supplyType option:selected').text();
  2420. supplyTypeText = supplyTypeText.substring(0, supplyTypeText.indexOf("["));
  2421. //药品默认单次使用剂量
  2422. var drugWinDb = $("#drugWinDb").val();
  2423. //处方实际单次使用剂量
  2424. var drugWin = $("#drugWin").val();
  2425. //剂量单位
  2426. var drugWinUnit = $('#drugWinUnit option:selected').text();
  2427. //drugWinUnit = drugWinUnit.substring(0, drugWinUnit.indexOf("("));
  2428. //天数
  2429. var dayNum = $("#dayNum").val();
  2430. //频次编码
  2431. var orderFrequency = $("#orderFrequency").val();
  2432. //频次描述
  2433. var orderFrequencyText = $('#orderFrequency option:selected').text();
  2434. orderFrequencyText = orderFrequencyText.substring(0, orderFrequencyText.indexOf("("));
  2435. //总量
  2436. var gross = $("#gross").val();
  2437. //包装单位
  2438. var packUnit = $("#packUnit").val();
  2439. if (packUnit == null) {
  2440. packUnit = "";
  2441. }
  2442. //医嘱码
  2443. var medicalAdvice = $("#medicalAdvice").val();
  2444. //医嘱内容
  2445. var medicalAdviceText = $('#medicalAdvice option:selected').text();
  2446. medicalAdviceText = medicalAdviceText.substring(0, medicalAdviceText.indexOf("("));
  2447. //金额
  2448. var totalRetprice = parseFloat($("#totalRetprice").val());
  2449. //单价
  2450. var packRetprice = $("#packRetprice").val();
  2451. //皮试
  2452. var tryFlag = $("#tryFlag").parent().hasClass("checked");
  2453. if (currentCode == null || currentCode == '') {
  2454. errorMesageSimaple("未选择任何药品!");
  2455. return;
  2456. }
  2457. if (currentGroupNo != '91') {
  2458. if (supplyType == null || supplyType == "") {
  2459. errorMesageSimaple("用法为空!");
  2460. return;
  2461. }
  2462. if (drugWin == null || drugWin == "") {
  2463. errorMesageSimaple("剂量为空!");
  2464. return;
  2465. }
  2466. if (dayNum == null || dayNum == "") {
  2467. errorMesageSimaple("天数为空!");
  2468. return;
  2469. }
  2470. if (orderFrequency == null || orderFrequency == "") {
  2471. errorMesageSimaple("频次为空!");
  2472. return;
  2473. }
  2474. }
  2475. if (gross == null || gross == "") {
  2476. errorMesageSimaple("总量为空!");
  2477. return;
  2478. }
  2479. var manufactoryName = $("#manufactoryName").val();
  2480. var html = '<div class="form-group">';
  2481. html += groupId + '.<span style="margin-left: 5px"></span>';
  2482. html += westernMedicineNamme;
  2483. if (manufactoryName != null && manufactoryName != 'null' && manufactoryName != "") {
  2484. html += "(" + manufactoryName + ")"
  2485. }
  2486. html += '&nbsp;&nbsp;&nbsp;&nbsp;';
  2487. html += $("#specification").val();
  2488. html += '&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;';
  2489. //html += drugWinDb + drugWinUnit + ' 共';
  2490. html += gross + packUnit + " " + '<br/><span style="margin-left: 15px"></span>';
  2491. html += '用法:' + supplyTypeText + ' ';
  2492. html += drugWin + drugWinUnit + ' ';
  2493. html += '频次:' + orderFrequencyText + ' ';
  2494. html += dayNum + '天 ';
  2495. if (tryFlag == "true" || tryFlag == true) {
  2496. html += '皮试 ';
  2497. }
  2498. if (medicalAdvice != null && medicalAdvice != '') {
  2499. html += '医嘱:' + medicalAdviceText;
  2500. }
  2501. html += ' <i class="fa fa-long-arrow-left" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;margin-left: 10px;" onclick="editWesternMedicine(this)"></i>';
  2502. 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>';
  2503. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  2504. html += '<input type="hidden" class="temporary_items_serial" value="' + currentSerial + '"/>';
  2505. html += '<input type="hidden" class="temporary_items_amount" value="' + totalRetprice + '"/>';
  2506. html += '<input type="hidden" class="temporary_items_groupId" value="' + groupId + '"/>';
  2507. html += '<input type="hidden" class="temporary_items_westernMedicineNamme" value="' + westernMedicineNamme + '"/>';
  2508. html += '<input type="hidden" class="temporary_items_drugWinDb" value="' + drugWinDb + '"/>';
  2509. html += '<input type="hidden" class="temporary_items_drugWin" value="' + drugWin + '"/>';
  2510. html += '<input type="hidden" class="temporary_items_drugWinUnit" value="' + $("#drugWinUnit").val() + '"/>';
  2511. html += '<input type="hidden" class="temporary_items_gross" value="' + gross + '"/>';
  2512. html += '<input type="hidden" class="temporary_items_packUnit" value="' + packUnit + '"/>';
  2513. html += '<input type="hidden" class="temporary_items_supplyType" value="' + supplyType + '"/>';
  2514. html += '<input type="hidden" class="temporary_items_orderFrequency" value="' + orderFrequency + '"/>';
  2515. html += '<input type="hidden" class="temporary_items_dayNum" value="' + dayNum + '"/>';
  2516. html += '<input type="hidden" class="temporary_items_medicalAdvice" value="' + medicalAdvice + '"/>';
  2517. html += '<input type="hidden" class="temporary_items_medicalAdviceText" value="' + medicalAdviceText + '"/>';
  2518. html += '<input type="hidden" class="temporary_items_packRetprice" value="' + packRetprice + '"/>';
  2519. html += '<input type="hidden" class="temporary_items_tryFlag" value="' + tryFlag + '"/>';
  2520. html += '</div>';
  2521. var tableId = $("#xyTab li.active").find("a").attr("href");
  2522. //是新增药品还是编辑 true 修改 默认false
  2523. var updateFlag = $("#update_flag").val();
  2524. if (updateFlag == undefined || updateFlag == null) {
  2525. updateFlag = false;
  2526. }
  2527. // //原药品金额 如果是修改则需要设置
  2528. // var temporaryItemsAmount = 0;
  2529. //当前需要被移除元素的下个兄弟节点
  2530. var nextObj = null;
  2531. //当前修改的药品是不是最后一个
  2532. var isLast = false;
  2533. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  2534. if (formGroups != null && formGroups.length > 0) {
  2535. //如果是修改,需要减去原来的费用
  2536. if (updateFlag == "true" || updateFlag == true) {
  2537. for (var i = 0; i < formGroups.length; i++) {
  2538. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  2539. var temporaryItemsSerial = $(formGroups[i]).find("input.temporary_items_serial").val();
  2540. if (temporaryItemsCode === currentCode && temporaryItemsSerial === currentSerial) {
  2541. //temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  2542. if (formGroups.length > 1) {
  2543. nextObj = $(formGroups[i]).next();
  2544. }
  2545. isLast = (i + 1) === formGroups.length;
  2546. $(formGroups[i]).remove();
  2547. break;
  2548. }
  2549. }
  2550. } else {
  2551. //因为药品可以换组号,要保证相同组号的在一起
  2552. for (var i = 0; i < formGroups.length; i++) {
  2553. var temporaryItemsGroupId = parseInt($(formGroups[i]).find("input.temporary_items_groupId").val());
  2554. //如果当前的组号小与遍历到的组号,说明是原组号的下一个兄弟节点,新的药品插入到兄弟节点前就可以了
  2555. if (temporaryItemsGroupId > groupId) {
  2556. nextObj = $(formGroups[i]);
  2557. break;
  2558. }
  2559. }
  2560. }
  2561. }
  2562. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  2563. if (nextObj == null || isLast) {
  2564. $(tableId).find("div:eq(0)").append(html);
  2565. } else {
  2566. $(nextObj).before(html);
  2567. }
  2568. //设置当前处方金额
  2569. //calculateCfAmount(tableId, totalRetprice, temporaryItemsAmount, 0, 0);
  2570. if (calculateTotalAmountFlag) {
  2571. //设置总金额
  2572. calculateTotalAmount();
  2573. }
  2574. //判断当前组号是不是最后一个,是最后一个组号,就需要新增组号
  2575. var groupIdLast = $("#groupId option:last-child").text();
  2576. if (groupId === groupIdLast) {
  2577. appendGroupOrder();
  2578. }
  2579. //设置药品的用法,频次,天数
  2580. var map = groupIdMap.get(groupId);
  2581. if (map == null) {
  2582. map = new Map();
  2583. map.put("supplyType", supplyType);
  2584. map.put("orderFrequency", orderFrequency);
  2585. map.put("dayNum", dayNum);
  2586. groupIdMap.put(groupId, map);
  2587. }
  2588. //设置当前药品的品类
  2589. $(tableId).find("input.current_groupNo").val($("#current_groupNo").val());
  2590. clearWesternMedicine(false);
  2591. }
  2592. /**
  2593. * 上移
  2594. * @param obj
  2595. */
  2596. function arrowUp(obj) {
  2597. var parentObject = $(obj).parent();
  2598. if ($(parentObject).prev() == null) {
  2599. return;
  2600. }
  2601. //当前元素的序号
  2602. var thisJcjyItemGroupId = null;
  2603. //前一个兄弟节点的序号
  2604. var prevJcjyItemGroupId = null;
  2605. //当是项目时有序号,进行序号调整
  2606. if ($(parentObject).find("span.jcjyItemGroupId") != null) {
  2607. thisJcjyItemGroupId = $(parentObject).find("span.jcjyItemGroupId").html();
  2608. prevJcjyItemGroupId = $(parentObject).prev().find("span.jcjyItemGroupId").html();
  2609. $(parentObject).find("span.jcjyItemGroupId").html(prevJcjyItemGroupId);
  2610. $(parentObject).prev().find("span.jcjyItemGroupId").html(thisJcjyItemGroupId);
  2611. }
  2612. $(parentObject).prev().before($(parentObject));
  2613. }
  2614. /**
  2615. * 下移
  2616. * @param obj
  2617. */
  2618. function arrowDown(obj) {
  2619. var parentObject = $(obj).parent();
  2620. if ($(parentObject).next() == null) {
  2621. return;
  2622. }
  2623. //当前元素的序号
  2624. var thisJcjyItemGroupId = null;
  2625. //后一个兄弟节点的序号
  2626. var afterJcjyItemGroupId = null;
  2627. //当是项目时有序号,进行序号调整
  2628. if ($(parentObject).find("span.jcjyItemGroupId") != null) {
  2629. thisJcjyItemGroupId = $(parentObject).find("span.jcjyItemGroupId").html();
  2630. afterJcjyItemGroupId = $(parentObject).after().find("span.jcjyItemGroupId").html();
  2631. $(parentObject).find("span.jcjyItemGroupId").html(afterJcjyItemGroupId);
  2632. $(parentObject).after().find("span.jcjyItemGroupId").html(thisJcjyItemGroupId);
  2633. }
  2634. $(parentObject).next().after($(parentObject));
  2635. }
  2636. /**
  2637. * 修改西药
  2638. * @param obj
  2639. */
  2640. function editWesternMedicine(obj) {
  2641. //是新增药品还是编辑 true 修改 默认false
  2642. $("#update_flag").val(true);
  2643. var parentObject = $(obj).parent();
  2644. //组号
  2645. $("#groupId").val($(parentObject).find("input.temporary_items_groupId").val());
  2646. $('#groupId').selectpicker('refresh');
  2647. //药品名称
  2648. $("#western_medicine_name").val($(parentObject).find("input.temporary_items_westernMedicineNamme").val());
  2649. var code = $(parentObject).find("input.temporary_items_code").val();
  2650. var serial = $(parentObject).find("input.temporary_items_serial").val();
  2651. //当前药品编码
  2652. $("#current_code").val(code);
  2653. //当前药品规格
  2654. $("#current_serial").val(serial);
  2655. //用法编码
  2656. $("#supplyType").val($(parentObject).find("input.temporary_items_supplyType").val());
  2657. $('#supplyType').selectpicker('refresh');
  2658. //药品默认单次使用剂量
  2659. $("#drugWinDb").val($(parentObject).find("input.temporary_items_drugWinDb").val());
  2660. //处方实际单次使用剂量
  2661. $("#drugWin").val($(parentObject).find("input.temporary_items_drugWin").val());
  2662. //天数
  2663. $("#dayNum").val($(parentObject).find("input.temporary_items_dayNum").val());
  2664. $('#dayNum').selectpicker('refresh');
  2665. //频次编码
  2666. $("#orderFrequency").val($(parentObject).find("input.temporary_items_orderFrequency").val());
  2667. $('#orderFrequency').selectpicker('refresh');
  2668. //总量
  2669. $("#gross").val($(parentObject).find("input.temporary_items_gross").val());
  2670. //医嘱
  2671. $("#medicalAdvice").val($(parentObject).find("input.temporary_items_medicalAdvice").val());
  2672. $('#medicalAdvice').selectpicker('refresh');
  2673. //金额
  2674. $("#totalRetprice").val($(parentObject).find("input.temporary_items_amount").val());
  2675. //单价
  2676. $("#packRetprice").val($(parentObject).find("input.temporary_items_packRetprice").val());
  2677. //皮试
  2678. var tryFlag = $(parentObject).find("input.temporary_items_tryFlag").val();
  2679. if (tryFlag == true || tryFlag == "true") {
  2680. $("#tryFlag").parent().addClass("checked");
  2681. $("#tryFlag").parent().parent().parent().removeClass("hide").addClass("in");
  2682. }
  2683. $.ajax({
  2684. type: "GET",
  2685. url: '/thmz/getYpZdDictByCodeAndSerial?code=' + code + "&serial=" + serial,
  2686. contentType: "application/json;charset=UTF-8",
  2687. dataType: "json",
  2688. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2689. success: function (res) {
  2690. if (res == '401' || res == 401) {
  2691. window.location.href = '/thmz/login/view'
  2692. return;
  2693. }
  2694. if (res.code == 0) {
  2695. if (res.data != null) {
  2696. var drugWinHtml = '';
  2697. if (res.data.weight != null) {
  2698. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  2699. $("#drugWin").val(res.data.weight);
  2700. $("#drugWinDb").val(res.data.weight);
  2701. }
  2702. drugWinHtml = '<option value="' + res.data.weighUnit + '" desc="' + res.data.weight + '">' + res.data.weighUnitDesc + '</option>';
  2703. }
  2704. if (res.data.volum != null) {
  2705. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  2706. $("#drugWin").val(res.data.volum);
  2707. $("#drugWinDb").val(res.data.volum);
  2708. }
  2709. drugWinHtml += '<option value="' + res.data.volUnit + '" desc="' + res.data.volum + '">' + res.data.volUnitDesc + '</option>';
  2710. }
  2711. if (res.data.miniUnit != null && res.data.miniUnit != "") {
  2712. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  2713. $("#drugWin").val(1);
  2714. $("#drugWinDb").val(1);
  2715. }
  2716. drugWinHtml += '<option value="' + res.data.miniUnit + '" desc="1">' + res.data.miniUnitDesc + '</option>';
  2717. }
  2718. $('#drugWinUnit').html(drugWinHtml);
  2719. $('#drugWinUnit').selectpicker('refresh');
  2720. //剂量单位
  2721. $("#drugWinUnit").val($(parentObject).find("input.temporary_items_drugWinUnit").val());
  2722. $('#drugWinUnit').selectpicker('refresh');
  2723. if (res.data.packUnitDesc != null && res.data.packUnitDesc != "") {
  2724. var html = '<option value="' + res.data.packUnitDesc + '" >' + res.data.packUnitDesc + '</option>';
  2725. $('#packUnit').html(html);
  2726. $('#packUnit').selectpicker('refresh');
  2727. //包装单位
  2728. $("#packUnit").val($(parentObject).find("input.temporary_items_packUnit").val());
  2729. $('#packUnit').selectpicker('refresh');
  2730. }
  2731. if (res.data.psFlag != null && (res.data.psFlag == 1 || res.data.psFlag == "1")) {
  2732. $("#tryFlag").parent().parent().parent().removeClass("hide").addClass("in");
  2733. } else {
  2734. $("#tryFlag").parent().parent().parent().removeClass("in").addClass("hide");
  2735. }
  2736. }
  2737. } else {
  2738. errorMesage(res);
  2739. }
  2740. }
  2741. });
  2742. }
  2743. /**
  2744. * 修改中药
  2745. * @param obj
  2746. */
  2747. function editChineseMedicine(obj) {
  2748. //是新增药品还是编辑 true 修改 默认false
  2749. $("#update_flag").val(true);
  2750. var parentObject = $(obj).parent();
  2751. //当前药品编码
  2752. $("#current_code").val($(parentObject).find("input.temporary_items_code").val());
  2753. //当前药品规格
  2754. $("#current_serial").val($(parentObject).find("input.temporary_items_serial").val());
  2755. //中药类型
  2756. $("#zyClassType").val($(parentObject).find("input.temporary_items_zyClassType").val());
  2757. $('#zyClassType').selectpicker('refresh');
  2758. //药品名称
  2759. $("#chinese_medicine_name").val($(parentObject).find("input.temporary_items_chineseMedicineNamme").val());
  2760. //单价
  2761. $("#zy_packRetprice").val($(parentObject).find("input.temporary_items_zyPackRetprice").val());
  2762. //处方实际单次使用剂量
  2763. $("#zy_drugWin").val($(parentObject).find("input.temporary_items_drugWin").val());
  2764. //医嘱码
  2765. $("#zyInstruction").val($(parentObject).find("input.temporary_items_zyInstruction").val());
  2766. $('#zyInstruction').selectpicker('refresh');
  2767. }
  2768. /**
  2769. * 修改项目
  2770. * @param obj
  2771. */
  2772. function editJyJcItem(obj) {
  2773. //是新增药品还是编辑 true 修改 默认false
  2774. $("#update_flag").val(true);
  2775. var parentObject = $(obj).parent();
  2776. //当前项目编码
  2777. $("#current_code").val($(parentObject).find("input.temporary_items_code").val());
  2778. //项目名称
  2779. $("#jcJyItem").val($(parentObject).find("input.temporary_items_jcJyItemName").val());
  2780. //单价
  2781. $("#jcjyItemPrice").val($(parentObject).find("input.temporary_items_amount").val());
  2782. //备注
  2783. $("#remark").val($(parentObject).find("input.temporary_items_remark").val());
  2784. var chargeUnit = $(parentObject).find("input.temporary_items_desc_value").val();
  2785. var jcJyZltype = $(parentObject).find("input.temporary_items_type").val();
  2786. //数量
  2787. var itemQuantity = $(parentObject).find("input.temporary_items_itemQuantity").val();
  2788. //执行科室
  2789. var execUnit = $(parentObject).find("input.temporary_items_execUnit").val();
  2790. $("#execUnit").selectpicker('val', execUnit);
  2791. $('#execUnit').selectpicker('refresh');
  2792. if (jcJyZltype == 1 || jcJyZltype == "1") {
  2793. $("#jyZdSample").selectpicker('val', chargeUnit);
  2794. $('#jyZdSample').selectpicker('refresh');
  2795. $("#jyZdSampleDiv").removeClass("hide").addClass("in");
  2796. $("#chargeUnitDiv").removeClass("in").addClass("hide");
  2797. $("#yshPartDiv").removeClass("in").addClass("hide");
  2798. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  2799. $("#itemQuantityDiv").removeClass("in").addClass("hide");
  2800. } else if (jcJyZltype == 2 || jcJyZltype == "2") {
  2801. $("#yshPart").selectpicker('val', chargeUnit);
  2802. $('#yshPart').selectpicker('refresh');
  2803. $("#yshPartDiv").removeClass("hide").addClass("in");
  2804. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  2805. $("#chargeUnitDiv").removeClass("in").addClass("hide");
  2806. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  2807. $("#itemQuantityDiv").removeClass("in").addClass("hide");
  2808. } else if (jcJyZltype == 3 || jcJyZltype == "3") {
  2809. //描述
  2810. $("#chargeUnit").val(chargeUnit);
  2811. $("#itemQuantity").val(itemQuantity);
  2812. $("#chargeUnitDiv").removeClass("hide").addClass("in");
  2813. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  2814. $("#yshPartDiv").removeClass("in").addClass("hide");
  2815. $("#jcJyItemChargeDetail").removeClass("in").addClass("hide");
  2816. $("#itemQuantityDiv").removeClass("hide").addClass("in");
  2817. }
  2818. $("#jcJyZltype").val(jcJyZltype);
  2819. }
  2820. /**
  2821. * 保存当前项目到右边处方区域 需要提示加价
  2822. * @param calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  2823. */
  2824. function saveJyJcItem(calculateTotalAmountFlag) {
  2825. //6岁内提示加价
  2826. var patientAge = $("#patientAge").text();
  2827. if (patientAge != null && patientAge != "" && patientAge < 6) {
  2828. $.ajax({
  2829. type: "GET",
  2830. url: '/thmz/checkAdditionally?code=' + $("#current_code").val() + "&jcJyZltype=" + $("#jcJyZltype").val(),
  2831. contentType: "application/json;charset=UTF-8",
  2832. dataType: "json",
  2833. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2834. success: function (res) {
  2835. if (res == '401' || res == 401) {
  2836. window.location.href = '/thmz/login/view'
  2837. return;
  2838. }
  2839. if (res.code == 0) {
  2840. if (res.data != undefined && res.data != null && res.data.co != null && res.data.co == 1 && res.data.xlCode != null && res.data.xlCode != "") {
  2841. var xlCode = res.data.xlCode;
  2842. xlCode = Multiply(100, xlCode);
  2843. $("#messageModal").modal();
  2844. $("#messageContent").html("根据【湘医保发〔2020〕51 号】价格通知,6岁以内的小朋友诊疗费上调" + xlCode + "%,是否需要继续添加该项目?");
  2845. $("#messageButton").off("click").on("click", function (t) {
  2846. $("#messageModal").modal("hide");
  2847. saveJyJcItemReal(true);
  2848. });
  2849. $("#cancelButton").off("click");
  2850. } else {
  2851. //虽然是不满6岁,但是也没有需要加收的项目,直接保存
  2852. saveJyJcItemReal(calculateTotalAmountFlag);
  2853. }
  2854. } else {
  2855. errorMesage(res);
  2856. }
  2857. }
  2858. });
  2859. } else {
  2860. saveJyJcItemReal(calculateTotalAmountFlag);
  2861. }
  2862. }
  2863. /**
  2864. * 保存当前项目到右边处方区域
  2865. * @param calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  2866. */
  2867. function saveJyJcItemReal(calculateTotalAmountFlag) {
  2868. var tableId = $("#zlTab li.active").find("a").attr("href");
  2869. //组号
  2870. var groupId = $(tableId).find("div:eq(0)").children().length + 1;
  2871. //项目名称
  2872. var jcJyItem = $("#jcJyItem").val();
  2873. //当前项目编码
  2874. var currentCode = $("#current_code").val();
  2875. //当前项目价格
  2876. var jcjyItemPrice = $("#jcjyItemPrice").val();
  2877. //描述
  2878. var chargeUnit = $("#chargeUnit").val();
  2879. //执行科室
  2880. var execUnit = $("#execUnit").val();
  2881. //执行科室
  2882. var execUnitName = $('#execUnit option:selected').text();
  2883. execUnitName = execUnitName.substring(0, execUnitName.indexOf("("));
  2884. //次数
  2885. var itemQuantity = $("#itemQuantity").val();
  2886. //描述编码
  2887. var chargeUnitCode = chargeUnit;
  2888. var chargeUnitName = " 描述:";
  2889. //备注
  2890. var remark = $("#remark").val();
  2891. //项目类型
  2892. var jcJyZltype = $("#jcJyZltype").val();
  2893. if (jcJyZltype == "1" || jcJyZltype == 1) {
  2894. //检验
  2895. chargeUnit = $('#jyZdSample option:selected').text();
  2896. chargeUnit = chargeUnit.substring(0, chargeUnit.indexOf("("));
  2897. chargeUnitCode = $('#jyZdSample').val();
  2898. chargeUnitName = " 检验物:";
  2899. } else if (jcJyZltype == "2" || jcJyZltype == 2) {
  2900. //检查
  2901. chargeUnit = $('#yshPart option:selected').text();
  2902. chargeUnit = chargeUnit.substring(0, chargeUnit.indexOf("("));
  2903. chargeUnitCode = $('#yshPart').val();
  2904. chargeUnitName = " 检查部位:";
  2905. }
  2906. if (currentCode == null || currentCode == '') {
  2907. if (calculateTotalAmountFlag == true) {
  2908. errorMesageSimaple("未选择任何项目!");
  2909. }
  2910. return;
  2911. }
  2912. //原药品金额 如果是修改则需要设置
  2913. var temporaryItemsAmount = 0;
  2914. //当前需要被移除元素的下个兄弟节点
  2915. var nextObj = null;
  2916. //当前修改的药品是不是最后一个
  2917. var isLast = false;
  2918. //是新增药品还是编辑 true 修改 默认false
  2919. var updateFlag = $("#update_flag").val();
  2920. if (updateFlag == undefined || updateFlag == null) {
  2921. updateFlag = false;
  2922. }
  2923. //如果是修改,需要减去原来的费用
  2924. //原组号
  2925. var oriGroupId = null;
  2926. if (updateFlag == "true" || updateFlag == true) {
  2927. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  2928. if (formGroups != null && formGroups.length > 0) {
  2929. for (var i = 0; i < formGroups.length; i++) {
  2930. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  2931. if (temporaryItemsCode === currentCode) {
  2932. temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  2933. if (formGroups.length > 1) {
  2934. nextObj = $(formGroups[i]).next();
  2935. }
  2936. isLast = (i + 1) === formGroups.length;
  2937. oriGroupId = $(formGroups[i]).find("span.jcjyItemGroupId").text();
  2938. $(formGroups[i]).remove();
  2939. break;
  2940. }
  2941. }
  2942. }
  2943. }
  2944. if (oriGroupId != null) {
  2945. groupId = oriGroupId;
  2946. }
  2947. var html = '<div class="form-group">';
  2948. html += '<span class="jcjyItemGroupId">' + groupId + '</span>.<span style="margin-left: 5px"></span>'
  2949. html += jcJyItem + ' ';
  2950. if (jcJyZltype == "3" || jcJyZltype == 3) {
  2951. html += " 数量:" + itemQuantity;
  2952. }
  2953. if (execUnit != null && execUnit != "") {
  2954. html += " 执行科室:" + execUnitName;
  2955. }
  2956. if (chargeUnit != null && chargeUnit != '') {
  2957. html += chargeUnitName + chargeUnit;
  2958. }
  2959. if (remark != null && remark != '') {
  2960. html += ' 备注:' + remark;
  2961. }
  2962. 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>';
  2963. 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>';
  2964. 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>';
  2965. if ($("#jcJyItemChargeDetail").hasClass("in")) {
  2966. 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>';
  2967. }
  2968. 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>';
  2969. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  2970. html += '<input type="hidden" class="temporary_items_jcJyItemName" value="' + jcJyItem + '"/>';
  2971. html += '<input type="hidden" class="temporary_items_amount" value="' + jcjyItemPrice + '"/>';
  2972. html += '<input type="hidden" class="temporary_items_remark" value="' + remark + '"/>';
  2973. html += '<input type="hidden" class="temporary_items_type" value="' + jcJyZltype + '"/>';
  2974. html += '<input type="hidden" class="temporary_items_desc_value" value="' + chargeUnitCode + '"/>';
  2975. html += '<input type="hidden" class="temporary_items_itemQuantity" value="' + itemQuantity + '"/>';
  2976. html += '<input type="hidden" class="temporary_items_execUnit" value="' + execUnit + '"/>';
  2977. html += '</div>';
  2978. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  2979. if (nextObj == null || isLast) {
  2980. $(tableId).find("div:eq(0)").append(html);
  2981. } else {
  2982. $(nextObj).before(html);
  2983. }
  2984. //设置当前处方金额
  2985. //calculateCfAmount(tableId, jcjyItemPrice, temporaryItemsAmount, 2, 0);
  2986. if (calculateTotalAmountFlag) {
  2987. //设置总金额
  2988. calculateTotalAmount();
  2989. }
  2990. clearJyJcItem();
  2991. }
  2992. /**
  2993. * 临时保存住院证
  2994. * @param messageFlag 是否需要提醒已经存在的入院申请 true 提示
  2995. */
  2996. function saveZyReq(messageFlag) {
  2997. //如果
  2998. if ($("#zyReqTab").find("li") == null || $("#zyReqTab").find("li").length == 0) {
  2999. initNavTabs(3);
  3000. }
  3001. var tableId = $("#zyReqTab li.active").find("a").attr("href");
  3002. //病区编码
  3003. var inpatientWardBeHospitalized = $("#inpatientWardBeHospitalized").val();
  3004. //小病室编码
  3005. var smallWardBeHospitalized = $("#smallWardBeHospitalized").val();
  3006. //入院状态编码
  3007. var admissStatus = $("#admissStatus").val();
  3008. //病区名称
  3009. var inpatientWardText = $('#inpatientWardBeHospitalized option:selected').text();
  3010. //小科室名称
  3011. var smallWardText = $('#smallWardBeHospitalized option:selected').text();
  3012. //入院状态名称
  3013. var admissStatusText = $('#admissStatus option:selected').text();
  3014. if (inpatientWardBeHospitalized == null || inpatientWardBeHospitalized == '') {
  3015. errorMesageSimaple("未选择入院病区!");
  3016. return;
  3017. }
  3018. if (admissStatus == null || admissStatus == '') {
  3019. errorMesageSimaple("未选择入院状态!");
  3020. return;
  3021. }
  3022. if (messageFlag == "true" || messageFlag == true) {
  3023. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  3024. if (formGroups != null && formGroups.length > 0) {
  3025. $("#messageModal").modal();
  3026. $("#messageContent").html("当前病人已经有一个暂存的入院申请,是否需要替换该申请?");
  3027. $("#messageButton").off("click").on("click", function (t) {
  3028. $("#messageModal").modal("hide");
  3029. saveZyReq(false);
  3030. });
  3031. $("#cancelButton").off("click");
  3032. return;
  3033. }
  3034. }
  3035. var html = '<div class="form-group"> 收住院';
  3036. if (inpatientWardText != null) {
  3037. html += " [" + inpatientWardText;
  3038. }
  3039. if (smallWardText != null) {
  3040. html += " (" + smallWardText + ") ";
  3041. }
  3042. if (inpatientWardText != null) {
  3043. html += "] ";
  3044. }
  3045. if (admissStatusText != null) {
  3046. html += admissStatusText;
  3047. }
  3048. html += ' 侯床';
  3049. //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>';
  3050. 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>';
  3051. html += '<input type="hidden" class="temporary_inpatient_ward" value="' + inpatientWardBeHospitalized + '"/>';
  3052. html += '<input type="hidden" class="temporary_items_small_ward" value="' + smallWardBeHospitalized + '"/>';
  3053. html += '<input type="hidden" class="temporary_items_admiss_status" value="' + admissStatus + '"/>';
  3054. html += '</div>';
  3055. $(tableId).find("div:eq(0)").html(html);
  3056. clearZyReq();
  3057. }
  3058. /**
  3059. * 删除药品或者项目
  3060. * @param index 0 西药 1 中药 2 项目
  3061. * @param obj 当前点击的对象
  3062. */
  3063. function removeYpOrProject(index, obj) {
  3064. var tabId = null;
  3065. //西药
  3066. if (index == 0) {
  3067. tabId = "xyTab";
  3068. } else if (index == 1) {
  3069. //中成药
  3070. tabId = "zyTab";
  3071. } else if (index == 2) {
  3072. //医技与诊疗
  3073. tabId = "zlTab";
  3074. } else if (index == 3) {
  3075. //入院
  3076. tabId = "zyReqTab";
  3077. }
  3078. var tableId = $("#" + tabId + " li.active").find("a").attr("href");
  3079. //var totalRetprice = $(obj).parent().find("input.temporary_items_amount").val();
  3080. //calculateCfAmount(tableId, totalRetprice, null, index, 1);
  3081. //医技的序号调整一下
  3082. if (index == 2) {
  3083. var nextAll = $(obj).parent().nextAll();
  3084. if (nextAll != null && nextAll.length > 0) {
  3085. for (var i = 0; i < nextAll.length; i++) {
  3086. var index = $(nextAll[i]).find(".jcjyItemGroupId").text();
  3087. $(nextAll[i]).find(".jcjyItemGroupId").text(index - 1);
  3088. }
  3089. }
  3090. }
  3091. $(obj).parent().remove();
  3092. if (index != 3) {
  3093. calculateTotalAmount();
  3094. }
  3095. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  3096. if (formGroups == null || formGroups.length == 0) {
  3097. if (index == 0) {
  3098. //西药被清空后,重置药房类型编码
  3099. $(tableId).find("input.current_groupNo").val(null);
  3100. //当本处方内容都被删除完后,也删除处方table
  3101. $("#" + tabId).find("a[href=\"" + tableId + "\"]").parent().remove();
  3102. $(tableId).remove();
  3103. //切换处方 最后一个被选中
  3104. $("#" + tabId).find("li:last > a").off("click").tab('show');
  3105. } else if (index == 1) {
  3106. //当中药处方被清空完后,重置当前中药类型为空
  3107. $("#current_zyClassType").val(null);
  3108. }
  3109. }
  3110. }
  3111. /**
  3112. * 清空西药
  3113. * @param flag 是否全部清空 因为 西药有分组,同一组的药品用药方式和频率以及天数一样,不能改变。所以不换组是不能改变 并且设置成不可编辑
  3114. */
  3115. function clearWesternMedicine(flag) {
  3116. $("#update_flag").val(false);
  3117. //药品名称
  3118. $("#western_medicine_name").val(null);
  3119. //当前药品编码
  3120. $("#current_code").val(null);
  3121. //当前药品规格
  3122. $("#current_serial").val(null);
  3123. //当前药房编码
  3124. $("#current_groupNo").val(null);
  3125. if (flag) {
  3126. //用法编码
  3127. $("#supplyType").selectpicker('val', null);
  3128. $('#supplyType').selectpicker('refresh');
  3129. //$("#supplyType").removeAttr("disabled");
  3130. //天数
  3131. $("#dayNum").selectpicker('val', null);
  3132. $('#dayNum').selectpicker('refresh');
  3133. // $("#dayNum").removeAttr("disabled");
  3134. //频次编码
  3135. $("#orderFrequency").selectpicker('val', null);
  3136. $('#orderFrequency').selectpicker('refresh');
  3137. // $("#orderFrequency").removeAttr("disabled");
  3138. }
  3139. //药品默认单次使用剂量
  3140. $("#drugWinDb").val(null);
  3141. //处方实际单次使用剂量
  3142. $("#drugWin").val(null);
  3143. //剂量单位
  3144. $("#drugWinUnit").selectpicker('val', null);
  3145. $('#drugWinUnit').selectpicker('refresh');
  3146. //总量
  3147. $("#gross").val(null);
  3148. //包装单位
  3149. $("#packUnit").selectpicker('val', null);
  3150. $('#packUnit').selectpicker('refresh');
  3151. //单价
  3152. $("#packRetprice").val(null);
  3153. //金额
  3154. $("#totalRetprice").val(null);
  3155. //医嘱
  3156. $("#medicalAdvice").selectpicker('val', null);
  3157. $('#medicalAdvice').selectpicker('refresh');
  3158. //皮试
  3159. $("#tryFlag").parent().removeClass('checked');
  3160. $("#tryFlag").parent().parent().parent().removeClass("in").addClass("hide");
  3161. //$("#gross").attr("readonly", "readonly");
  3162. $("#manufactoryName").val(null);
  3163. $("#specification").val(null);
  3164. }
  3165. /**
  3166. * 保存当前药品到右边处方区域 中药
  3167. * calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  3168. */
  3169. function saveChineseMedicine(calculateTotalAmountFlag) {
  3170. //药品名称
  3171. var chineseMedicineNamme = $("#chinese_medicine_name").val();
  3172. //当前药品编码
  3173. var currentCode = $("#current_code").val();
  3174. //当前药品规格
  3175. var currentSerial = $("#current_serial").val();
  3176. //处方实际单次使用剂量
  3177. var drugWin = $("#zy_drugWin").val();
  3178. //医嘱码
  3179. var zyInstruction = $("#zyInstruction").val();
  3180. //医嘱
  3181. var zyInstructionText = $('#zyInstruction option:selected').text();
  3182. //单价
  3183. var zyPackRetprice = parseFloat($("#zy_packRetprice").val());
  3184. //当前中药的总价
  3185. var totalRetprice = Multiply(drugWin, zyPackRetprice);
  3186. //中药类型
  3187. var zyClassType = $("#zyClassType").val();
  3188. //已经选中的药品类型, 中药不允许一个处方里有普通中药和颗粒剂
  3189. var currentYyClassType = $("#current_zyClassType").val();
  3190. if (currentYyClassType == null || currentYyClassType == "") {
  3191. //中药此时是第一次选择药品,不控制类型
  3192. $("#current_zyClassType").val(zyClassType);
  3193. } else if (currentYyClassType != zyClassType) {
  3194. errorMesageSimaple("同一个中药处方不允许同时出现普通中药和颗粒剂中药!");
  3195. return;
  3196. }
  3197. if (currentCode == null || currentCode == '') {
  3198. errorMesageSimaple("未选择任何药品!");
  3199. return;
  3200. }
  3201. var html = '<div class="form-group" style="float: left;">';
  3202. html += chineseMedicineNamme;
  3203. if (zyInstruction != null && zyInstruction != '') {
  3204. html += '[' + zyInstructionText + ']';
  3205. }
  3206. html += '<span style="margin-left: 5px"></span>';
  3207. html += drugWin + 'g';
  3208. 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>';
  3209. 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>';
  3210. 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>';
  3211. 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>';
  3212. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  3213. html += '<input type="hidden" class="temporary_items_serial" value="' + currentSerial + '"/>';
  3214. html += '<input type="hidden" class="temporary_items_amount" value="' + totalRetprice + '"/>';
  3215. html += '<input type="hidden" class="temporary_items_zyClassType" value="' + zyClassType + '"/>';
  3216. html += '<input type="hidden" class="temporary_items_chineseMedicineNamme" value="' + chineseMedicineNamme + '"/>';
  3217. html += '<input type="hidden" class="temporary_items_zyPackRetprice" value="' + zyPackRetprice + '"/>';
  3218. html += '<input type="hidden" class="temporary_items_drugWin" value="' + drugWin + '"/>';
  3219. html += '<input type="hidden" class="temporary_items_zyInstruction" value="' + zyInstruction + '"/>';
  3220. html += '<input type="hidden" class="temporary_items_zyInstructionText" value="' + zyInstructionText + '"/>';
  3221. html += '</div>';
  3222. var tableId = $("#zyTab li.active").find("a").attr("href");
  3223. //原药品金额 如果是修改则需要设置
  3224. var temporaryItemsAmount = 0;
  3225. //当前需要被移除元素的下个兄弟节点
  3226. var nextObj = null;
  3227. //当前修改的药品是不是最后一个
  3228. var isLast = false;
  3229. //是新增药品还是编辑 true 修改 默认false
  3230. var updateFlag = $("#update_flag").val();
  3231. if (updateFlag == undefined || updateFlag == null) {
  3232. updateFlag = false;
  3233. }
  3234. //如果是修改,需要减去原来的费用
  3235. if (updateFlag == "true" || updateFlag == true) {
  3236. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  3237. if (formGroups != null && formGroups.length > 0) {
  3238. for (var i = 0; i < formGroups.length; i++) {
  3239. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  3240. var temporaryItemsSerial = $(formGroups[i]).find("input.temporary_items_serial").val();
  3241. if (temporaryItemsCode === currentCode && temporaryItemsSerial === currentSerial) {
  3242. temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  3243. if (formGroups.length > 1) {
  3244. nextObj = $(formGroups[i]).next();
  3245. }
  3246. isLast = (i + 1) === formGroups.length;
  3247. $(formGroups[i]).remove();
  3248. break;
  3249. }
  3250. }
  3251. }
  3252. }
  3253. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  3254. if (nextObj == null || isLast) {
  3255. $(tableId).find("div:eq(0)").append(html);
  3256. } else {
  3257. $(nextObj).before(html);
  3258. }
  3259. //设置当前处方金额
  3260. // calculateCfAmount(tableId, totalRetprice, temporaryItemsAmount, 1, 0);
  3261. if (calculateTotalAmountFlag) {
  3262. //设置总金额
  3263. calculateTotalAmount();
  3264. }
  3265. clearChineseMedicine();
  3266. }
  3267. /**
  3268. * 清空中药
  3269. */
  3270. function clearChineseMedicine() {
  3271. $("#update_flag").val(false);
  3272. //药品名称
  3273. $("#chinese_medicine_name").val(null);
  3274. //当前药品编码
  3275. $("#current_code").val(null);
  3276. //当前药品规格
  3277. $("#current_serial").val(null);
  3278. //医嘱
  3279. $("#zyInstruction").selectpicker('val', null);
  3280. $('#zyInstruction').selectpicker('refresh');
  3281. //剂量
  3282. $("#zy_drugWin").val(null);
  3283. //单价
  3284. $("#zy_packRetprice").val(null);
  3285. }
  3286. /**
  3287. * 清空项目
  3288. */
  3289. function clearJyJcItem() {
  3290. $("#update_flag").val(false);
  3291. //项目名称
  3292. $("#jcJyItem").val(null);
  3293. //当前项目编码
  3294. $("#current_code").val(null);
  3295. //单价
  3296. $("#jcjyItemPrice").val(null);
  3297. //备注
  3298. $("#remark").val(null);
  3299. //描述
  3300. $("#chargeUnit").val(null);
  3301. $("#jcJyZltype").val(null);
  3302. $("#itemQuantity").val(1);
  3303. $("#jyZdSample").selectpicker('val', null);
  3304. $('#jyZdSample').selectpicker('refresh');
  3305. $("#yshPart").selectpicker('val', null);
  3306. $('#yshPart').selectpicker('refresh');
  3307. $("#execUnit").selectpicker('val', null);
  3308. $('#execUnit').selectpicker('refresh');
  3309. $("#jcJyItemChargeDetail").removeClass("in").addClass("hide");
  3310. $("#chargeUnitDiv").removeClass("in").addClass("hide");
  3311. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  3312. $("#yshPartDiv").removeClass("in").addClass("hide");
  3313. $("#itemQuantityDiv").removeClass("in").addClass("hide");
  3314. }
  3315. /**
  3316. * 清空入院证输入框
  3317. */
  3318. function clearZyReq() {
  3319. $("#inpatientWardBeHospitalized").selectpicker('val', null);
  3320. $('#inpatientWardBeHospitalized').selectpicker('refresh');
  3321. $("#smallWardBeHospitalized").selectpicker('val', null);
  3322. $('#smallWardBeHospitalized').selectpicker('refresh');
  3323. $("#admissStatus").selectpicker('val', null);
  3324. $('#admissStatus').selectpicker('refresh');
  3325. $("#totalBedNum").val(null);
  3326. $("#freeBedNum").val(null);
  3327. $("#occupationBedNum").val(null);
  3328. initSmallDeptByDept();
  3329. }
  3330. /**
  3331. * 计算总金额
  3332. */
  3333. function calculateTotalAmount() {
  3334. var jsonData = getParamsForpPrescription();
  3335. $.ajax({
  3336. type: "POST",
  3337. url: '/thmz/getAmountForTempPrescription',
  3338. contentType: "application/json;charset=UTF-8",
  3339. dataType: "json",
  3340. data: JSON.stringify(jsonData),
  3341. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3342. success: function (res) {
  3343. if (res == '401' || res == 401) {
  3344. window.location.href = '/thmz/login/view'
  3345. return;
  3346. }
  3347. if (res.code == 0) {
  3348. $("#totalAmount").html(res.data.amount.toFixed(1));
  3349. var arrs = $("span.cf_amount");
  3350. for (var i = 0; i < arrs.length; i++) {
  3351. if (res.data.amountList[i] != undefined && res.data.amountList[i] != null) {
  3352. $(arrs[i]).html(res.data.amountList[i].toFixed(1));
  3353. }
  3354. }
  3355. // var arrs = $("#xyTabContent").find("span.cf_amount");
  3356. // for (var i = 0; i < arrs.length; i++) {
  3357. // $(arrs[i]).html(res.data.xyAmount.toFixed(1));
  3358. // }
  3359. // $("#zyTabContent").find("span.cf_amount").html(res.data.zyAmount.toFixed(1));
  3360. // if (res.data.yjAmount != null) {
  3361. // //如果
  3362. // if ($("#zlTab").find("li") == null || $("#zlTab").find("li").length == 0) {
  3363. // initNavTabs(2);
  3364. // }
  3365. // $("#zlTabContent").find("span.cf_amount").html(res.data.yjAmount.toFixed(1));
  3366. // }
  3367. } else {
  3368. errorMesage(res);
  3369. }
  3370. }
  3371. });
  3372. }
  3373. // /**
  3374. // * 打开住院处理窗口
  3375. // * @param data
  3376. // */
  3377. // function beHospitalized() {
  3378. // $("#beHospitalizedModal").modal();
  3379. // //根据病人门诊id查询病人的入院申请
  3380. // $.ajax({
  3381. // type: "GET",
  3382. // url: '/thmz/getMzZyReqByPatientId?patientId=' + $("#patientId").text(),
  3383. // contentType: "application/json;charset=UTF-8",
  3384. // dataType: "json",
  3385. // headers: {
  3386. // 'Accept': 'application/json',
  3387. // 'Authorization': 'Bearer ' + localStorage.getItem("token")
  3388. // },
  3389. // success: function (resZyz) {
  3390. // if (resZyz == '401' || resZyz == 401) {
  3391. // window.location.href = '/thmz/login/view'
  3392. // return;
  3393. // }
  3394. // if (resZyz.code == 0) {
  3395. // $("#icdCodeInputBeHospitalized").val(resZyz.data.icdCode);
  3396. // $("#icdTextBeHospitalized").val(resZyz.data.icdText);
  3397. // $("#icdTextBeHospitalized").attr("title", resZyz.data.icdText);
  3398. // $("#inpatientWardBeHospitalized").selectpicker('val', resZyz.data.reqDept);
  3399. // $("#inpatientWardBeHospitalized").selectpicker('refresh');
  3400. // initSmallDeptByDept();
  3401. // $("#smallWardBeHospitalized").selectpicker('val', resZyz.data.smallDept);
  3402. // $("#smallWardBeHospitalized").selectpicker('refresh');
  3403. // $("#admissStatus").selectpicker('val', resZyz.data.admissStatus);
  3404. // $("#admissStatus").selectpicker('refresh');
  3405. // $("#zyReqVisitDate").val(format(resZyz.data.visitDate, "yyyy-MM-dd HH:mm:ss"));
  3406. // }
  3407. // }
  3408. // });
  3409. // }
  3410. /**
  3411. * 打开编辑用户信息窗口
  3412. * @param data
  3413. */
  3414. function editUserModal() {
  3415. $("#editUserModal").modal();
  3416. $.ajax({
  3417. type: "GET",
  3418. url: '/thmz/getByPatientId?patientId=' + $("#patientId").text(),
  3419. contentType: "application/json;charset=UTF-8",
  3420. dataType: "json",
  3421. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3422. success: function (res) {
  3423. if (res == '401' || res == 401) {
  3424. window.location.href = '/thmz/login/view'
  3425. return;
  3426. }
  3427. if (res.code == 0) {
  3428. if (res.data != null) {
  3429. //延时调用,因为当前弹框还没有加载出来,校验规则无法获取光标与模拟光标丢失事件,延时可以等弹框加载出来后模拟事件
  3430. setTimeout(function () {
  3431. fillPlusPatinet(res.data);
  3432. }, 400);
  3433. }
  3434. } else {
  3435. errorMesage(res);
  3436. }
  3437. }
  3438. });
  3439. }
  3440. /**
  3441. * 处方类型按钮切换事件
  3442. * @param object
  3443. * @param objectIndex
  3444. */
  3445. function billItemButtonChange(object, objectIndex) {
  3446. $(".nav-tabs").removeClass("in").addClass("hide");
  3447. $(".tab-content").removeClass("in").addClass("hide");
  3448. $(".nav-tabs:eq(" + objectIndex + ")").removeClass("hide").addClass("in");
  3449. $(".tab-content:eq(" + objectIndex + ")").removeClass("hide").addClass("in");
  3450. // initNavTabs(objectIndex);
  3451. $("#bill_item_group").find("button").each(function (index, element) {
  3452. if ($(element).hasClass("btn-primary")) {
  3453. $(element).removeClass("btn-primary").addClass("btn-default");
  3454. }
  3455. $("#rp_form" + index).removeClass("show").addClass("hide");
  3456. });
  3457. $("#rp_form" + objectIndex).removeClass("hide").addClass("show");
  3458. $(object).removeClass("btn-default").addClass("btn-primary");
  3459. $("#western_medicine_name").webuiPopover('hide');
  3460. $("#chinese_medicine_name").webuiPopover('hide');
  3461. $("#jcJyItem").webuiPopover('hide');
  3462. if (objectIndex == 0) {
  3463. $("#western_medicine_name").focus();
  3464. // $("#western_medicine_name").click();
  3465. // currentEleId = 'western_medicine_name';
  3466. } else if (objectIndex == 1) {
  3467. $("#chinese_medicine_name").focus();
  3468. // $("#chinese_medicine_name").click();
  3469. // currentEleId = 'chinese_medicine_name';
  3470. } else if (objectIndex == 2) {
  3471. $("#jcJyItem").focus();
  3472. // $("#jcJyItem").click();
  3473. // currentEleId = 'jcJyItem';
  3474. } else if (objectIndex == 3) {
  3475. // currentEleId = 'freeBedNum';
  3476. }
  3477. }
  3478. /**
  3479. * 打开快速接诊窗口
  3480. * @param data
  3481. */
  3482. function rapidAcceptsModal() {
  3483. $("#rapidAcceptsModal").modal();
  3484. //延迟触发 默认光标在卡号输入框
  3485. setTimeout('$("#rapidAcceptsUserCardNo").focus();', 500);
  3486. }
  3487. /**
  3488. * checkBox样式
  3489. */
  3490. function formatCheck() {
  3491. if ($("input.flat")[0]) {
  3492. $(document).ready(function () {
  3493. $('input.flat').iCheck({
  3494. checkboxClass: 'icheckbox_flat-blue',
  3495. radioClass: 'iradio_flat-blue'
  3496. });
  3497. });
  3498. }
  3499. }
  3500. /**
  3501. * 卡号有变化后查询病人信息
  3502. */
  3503. function queryUserInfoByCardNo() {
  3504. //当反写的id不存在,说明不是查询后的改变事件,触发查询
  3505. var rapidAcceptsUserCardNo = $("#rapidAcceptsUserCardNo").val();
  3506. var index = rapidAcceptsUserCardNo.indexOf("-");
  3507. if (($("#patientIdDb").val() == null || $("#patientIdDb").val() == "") && ((index > 0 && index == rapidAcceptsUserCardNo.length - 2) || rapidAcceptsUserCardNo.length == 8)) {
  3508. $("#cardNo").attr("title", rapidAcceptsUserCardNo);
  3509. $.ajax({
  3510. type: "GET",
  3511. url: '/thmz/getByIcCardNo?icCardNo=' + rapidAcceptsUserCardNo,
  3512. contentType: "application/json;charset=UTF-8",
  3513. dataType: "json",
  3514. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3515. success: function (res) {
  3516. if (res == '401' || res == 401) {
  3517. window.location.href = '/thmz/login/view'
  3518. return;
  3519. }
  3520. if (res.code == 0) {
  3521. if (res.data != null) {
  3522. $("#rapidAcceptsUserName").val(res.data.name);
  3523. $("#rapidAcceptsUserCode").val(res.data.patientId);
  3524. $("#patientIdDb").val(res.data.patientId);
  3525. $("#rapidAcceptsUserCardNo").val(res.data.icCardNo);
  3526. $("#rapidAcceptsUserGender").selectpicker('val', res.data.sex);
  3527. $("#rapidAcceptsUserGender").selectpicker('refresh');
  3528. $("#rapidAcceptsUserPhoneNum").val(res.data.phoneNo);
  3529. $("#rapidAcceptsUserIdCard").val(res.data.socialNo);
  3530. $("#rapidAcceptsUserIdCard").attr("title", res.data.socialNo);
  3531. $("#rapidAcceptsUserPhoneNum").attr("title", res.data.phoneNo);
  3532. //查询分诊号
  3533. $.ajax({
  3534. type: "POST",
  3535. url: '/thmz/getUnClinicWithPage',
  3536. contentType: "application/json;charset=UTF-8",
  3537. dataType: "json",
  3538. data: JSON.stringify({"patientId": res.data.patientId}),
  3539. headers: {
  3540. 'Accept': 'application/json',
  3541. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  3542. },
  3543. success: function (resFz) {
  3544. if (resFz == '401' || resFz == 401) {
  3545. window.location.href = '/thmz/login/view'
  3546. return;
  3547. }
  3548. if (resFz.code == 0) {
  3549. if (resFz.data == null || resFz.data.length == 0) {
  3550. errorMesageSimaple("没有查询到符合条件的分诊记录!");
  3551. clearRapidAcceptsModal();
  3552. return;
  3553. }
  3554. $("#mzfzSerialNo").val(resFz.data[0].serialNo);
  3555. }
  3556. }
  3557. });
  3558. } else {
  3559. errorMesageSimaple("病人信息不存在!");
  3560. }
  3561. } else {
  3562. errorMesage(res);
  3563. }
  3564. }
  3565. });
  3566. }
  3567. }
  3568. /**
  3569. * 清空快速接诊查询框
  3570. */
  3571. function clearRapidAccepts() {
  3572. $("#rapidAcceptsUserName").val(null);
  3573. $("#rapidAcceptsUserCode").val(null);
  3574. $("#patientIdDb").val(null);
  3575. $("#rapidAcceptsUserCardNo").val(null);
  3576. $("#rapidAcceptsUserGender").selectpicker('val', 0);
  3577. $("#rapidAcceptsUserGender").selectpicker('refresh');
  3578. $("#rapidAcceptsUserPhoneNum").val(null);
  3579. $("#rapidAcceptsUserIdCard").val(null);
  3580. $("#rapidAcceptsUserIdCard").attr("title", null);
  3581. $("#rapidAcceptsUserPhoneNum").attr("title", null);
  3582. $("#mzfzSerialNo").val(null);
  3583. $("#rapidAcceptsUserCardNo").focus();
  3584. }
  3585. /**
  3586. * 根据病人姓名输入框内容动态加载病人列表
  3587. */
  3588. function initUserList() {
  3589. //var width=$("#userName").css("width");
  3590. var settings = {
  3591. trigger: 'click',
  3592. content: '',
  3593. width: 170,
  3594. multi: true,
  3595. closeable: false,
  3596. style: '',
  3597. delay: 300,
  3598. padding: true,
  3599. height: 300,
  3600. };
  3601. var webuiPopover = $('#rapidAcceptsUserName').webuiPopover('destroy').webuiPopover(settings);
  3602. //用户姓名选中事件
  3603. $("#rapidAcceptsUserName").on("click", function (t) {
  3604. if ($(webuiPopover).css("display") == "block") {
  3605. refeshPatinetList(true);
  3606. }
  3607. });
  3608. }
  3609. /**
  3610. * 刷新候诊病人列表
  3611. */
  3612. function refeshPatinetList(flag) {
  3613. //如果是重新加载病人列表,需要重置下标
  3614. if (flag) {
  3615. //重置下标
  3616. pageIndex = 0;
  3617. msg_list_loading = true;
  3618. }
  3619. var userName = $('#rapidAcceptsUserName').val();
  3620. if (!(userName == null || userName == "" || isChinese(userName))) {
  3621. return;
  3622. }
  3623. $.ajax({
  3624. type: "POST",
  3625. url: '/thmz/getUnClinicWithPage',
  3626. contentType: "application/json;charset=UTF-8",
  3627. dataType: "json",
  3628. data: JSON.stringify({"name": userName, "pageIndex": pageIndex}),
  3629. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3630. success: function (res) {
  3631. if (res == '401' || res == 401) {
  3632. window.location.href = '/thmz/login/view'
  3633. return;
  3634. }
  3635. if (res.code == 0) {
  3636. if (res.data != null && res.data.length > 0) {
  3637. $("#webuiPopover0").css("display", "block");
  3638. $("#webuiPopover0 .webui-popover-content").css("max-height", "300px").css("height", "auto");
  3639. var html = '<div class="list-group">';
  3640. for (var i = 0; i < res.data.length; i++) {
  3641. var mzPatientMi = res.data[i];
  3642. html += '<a href="#" class="list-group-item list-group-item-action" onclick="fillUnClinicPatinet(\'' + mzPatientMi.patientId + '\')">';
  3643. if (mzPatientMi.gender == "男") {
  3644. html += '<img src="/thmz/images/boy.png"/>'
  3645. } else if (mzPatientMi.gender == "女") {
  3646. html += '<img src="/thmz/images/girl.png"/>'
  3647. } else if (mzPatientMi.gender == "未知" || mzPatientMi.gender == null) {
  3648. html += '<img src="/thmz/images/girl_or_boy.png"/>'
  3649. }
  3650. html += '<div>' + mzPatientMi.name + '&nbsp;' + mzPatientMi.gender + '&nbsp;';
  3651. if (mzPatientMi.age != null && mzPatientMi.age != "") {
  3652. html += mzPatientMi.age + '岁';
  3653. } else {
  3654. html += '**岁';
  3655. }
  3656. if (mzPatientMi.phoneNo != null && mzPatientMi.phoneNo != "") {
  3657. html += '<span>' + mzPatientMi.phoneNo + '</span>';
  3658. }
  3659. html += '</div></a>';
  3660. }
  3661. html += '</div>';
  3662. if (flag) {
  3663. $("#webuiPopover0 div.webui-popover-content").html("");
  3664. }
  3665. $("#webuiPopover0 div.webui-popover-content").append(html);
  3666. $("#webuiPopover0 div.arrow").css("left", "23px");
  3667. refeshPatinetListScrollEvent();
  3668. } else {
  3669. $("#webuiPopover0").css("display", "none");
  3670. }
  3671. }
  3672. //查询完成,设置加载完成
  3673. msg_list_loading = false;
  3674. }
  3675. });
  3676. }
  3677. /**
  3678. * 病人下拉列表滚动条滚动到底部时继续加载新纪录
  3679. */
  3680. function refeshPatinetListScrollEvent() {
  3681. $('.webui-popover-content').scroll(function (event) {
  3682. var top = $(this).scrollTop();
  3683. var height = $(this).height();
  3684. var scrollHeight = $(this).get(0).scrollHeight;
  3685. if (scrollHeight <= top + height) {
  3686. if (!msg_list_loading) {
  3687. msg_list_loading = true;
  3688. pageIndex = pageIndex + 1;
  3689. refeshPatinetList(false);
  3690. }
  3691. }
  3692. });
  3693. }
  3694. /**
  3695. * 按照病人id查询病人信息
  3696. * @param patientId
  3697. */
  3698. function fillUnClinicPatinet(patientId) {
  3699. $("#rapidAcceptsUserCardNo").val(patientId);
  3700. $("#webuiPopover0").css("display", "none");
  3701. queryUserInfoByCardNo();
  3702. }
  3703. /**
  3704. * 加载主诉,体格检查,诊断窗口
  3705. */
  3706. function initRecommendList() {
  3707. var width = $("#symptom").parent().css("width");
  3708. var settings = {
  3709. placement: 'bottom-right',//值: auto,top,right,bottom,left,top-right,top-left,bottom-right,bottom-left 要显示的位置
  3710. trigger: 'click', //值:click,hover 触发方式 manual 手动
  3711. content: '',//内容,内容可以是函数
  3712. width: width,
  3713. //arrow:false,//是否显示箭头
  3714. multi: true,//在页面允许其他弹出层
  3715. closeable: true,//显示关闭按钮
  3716. style: '', //值:'',inverse
  3717. delay: 300,//延迟时间, 悬浮属性才执行
  3718. padding: true,//内容填充
  3719. height: 320,
  3720. //offsetTop:10,
  3721. cache: true,//如果缓存设置为false,则popover将销毁并重新创建
  3722. };
  3723. //主诉弹窗
  3724. var symptomWebuiPopover = $('#symptom').webuiPopover('destroy').webuiPopover(settings);
  3725. //体格检查弹窗
  3726. settings.height = 260;
  3727. $('#weight').webuiPopover('destroy').webuiPopover(settings);
  3728. //诊断弹窗
  3729. settings.height = 320;
  3730. var diagnoseWebuiPopover = $('#diagnose').webuiPopover('destroy').webuiPopover(settings);
  3731. //西药弹窗
  3732. settings.width = 680;
  3733. settings.closeable = false;
  3734. settings.arrow = false;//显示箭头或不显示箭头
  3735. settings.content = '<div id="westernMedicinePopoverContent"><table id="tb_table_western_medicine"></table></div>';
  3736. //手动触发
  3737. settings.trigger = 'manual';
  3738. var westernMedicineWebuiPopover = $('#western_medicine_name').webuiPopover('destroy').webuiPopover(settings);
  3739. //中药弹窗
  3740. settings.trigger = 'click';
  3741. settings.content = '<div id="chineseMedicinePopoverContent"><table id="tb_table_chinese_medicine"></table></div>';
  3742. //手动触发
  3743. settings.trigger = 'manual';
  3744. var chineseMedicineWebuiPopover = $('#chinese_medicine_name').webuiPopover('destroy').webuiPopover(settings);
  3745. //诊疗与医技弹窗
  3746. settings.trigger = 'manual';
  3747. settings.content = '<div id="jcJyItemPopoverContent"><table id="tb_table_jc_jy_item"></table></div>';
  3748. var jcJyItemWebuiPopover = $('#jcJyItem').webuiPopover('destroy').webuiPopover(settings);
  3749. //主诉选中事件
  3750. $("#symptom").on("click", function (t) {
  3751. if ($(symptomWebuiPopover).css("display") == "block") {
  3752. $("#webuiPopover1 div.arrow").css("left", "23px");
  3753. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">主诉</span>';
  3754. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='contentHtml'>";
  3755. html += "</div>";
  3756. html += '<div style="height: 60px; line-height: 60px; font-size: 14px;">' +
  3757. '<div style="float: left">' +
  3758. '<span style="margin-left: 20px;">内容:</span> ' +
  3759. '</div>' +
  3760. '<div style="float: left;">' +
  3761. '<select class="form-control selectpicker show-tick" id="paramsType" dropupAuto="true">' +
  3762. '<option label="常用症状" value="0">常用症状</option>' +
  3763. '<option label="常用时间" value="1">常用时间</option>' +
  3764. '<option label="常用标点" value="2">常用标点</option>' +
  3765. '<option label="常用词" value="3">常用词</option>' +
  3766. '</select> ' +
  3767. '</div>' +
  3768. '<div style="width: 200px;float: left;margin-left: 10px;">' +
  3769. '<input id="paramsNameInput" class="form-control" type="text" style="position: relative;top: 13px;height: 34px;">' +
  3770. '</div>' +
  3771. '<div style="float: left;margin-left: 10px;">' +
  3772. ' <button type="button" class="btn" onclick="saveParams();"' +
  3773. ' style="height: 30px;line-height: 15px;border-color: #2e69eb!important;color: #2e69eb;background-color: white;">' +
  3774. ' <svg class="bi" width="1em" height="1em" fill="currentColor" style="vertical-align: -.15em;margin-right: 10px!important;color: #2e69eb;">' +
  3775. ' <use xlink:href="/thmz/css/bootstrap/bootstrap-icons-1.5.0/bootstrap-icons.svg#plus-circle"></use>' +
  3776. ' </svg>' +
  3777. '新增' +
  3778. ' </button>' +
  3779. ' </div>' +
  3780. '</div>';
  3781. $("#webuiPopover1 div.webui-popover-content").html(html);
  3782. $('#paramsType').selectpicker('refresh');
  3783. $("#paramsType").parent().css("width", "140px").css("height", "34px");
  3784. $("#webuiPopover1").css("z-index", "10");
  3785. if ($("#webuiPopover1").hasClass("in")) {
  3786. loadSymptom();
  3787. }
  3788. }
  3789. //加载智能接诊模块的主诉推荐
  3790. fitSymptomData();
  3791. });
  3792. //体格检查各输入框选中事件
  3793. $("#weight,#temperature,#sphygmus,#breathe,#pressure_high,#pressure_floor,#pressure_high_left,#pressure_floor_left").on("click", function (t) {
  3794. if ($("#webuiPopover2").css("display") == "block") {
  3795. $("#webuiPopover2").css("left", $("#webuiPopover1").css("left"));
  3796. if ($("#healthCheckupContentHtml").html() == null || $("#healthCheckupContentHtml").html() == "") {
  3797. $("#webuiPopover2 div.arrow").css("left", "23px");
  3798. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">体格检查</span>';
  3799. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='healthCheckupContentHtml'>";
  3800. html += "</div>";
  3801. $("#webuiPopover2 div.webui-popover-content").html(html);
  3802. $("#webuiPopover2").css("z-index", "10");
  3803. if ($("#webuiPopover2").hasClass("in")) {
  3804. loadHealthCheckup();
  3805. }
  3806. }
  3807. //loadSymptom();
  3808. } else {
  3809. $('#weight').webuiPopover('show');
  3810. $("#webuiPopover2").css("left", $("#webuiPopover1").css("left"));
  3811. if ($("#healthCheckupContentHtml").html() == null || $("#healthCheckupContentHtml").html() != "") {
  3812. $("#webuiPopover2 div.arrow").css("left", "23px");
  3813. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">体格检查</span>';
  3814. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='healthCheckupContentHtml'>";
  3815. html += "</div>";
  3816. $("#webuiPopover2 div.webui-popover-content").html(html);
  3817. $("#webuiPopover2").css("z-index", "10");
  3818. if ($("#webuiPopover2").hasClass("in")) {
  3819. loadHealthCheckup();
  3820. }
  3821. }
  3822. }
  3823. return false;
  3824. });
  3825. //诊断选中事件
  3826. $("#diagnose").on("click", function (t) {
  3827. if ($(diagnoseWebuiPopover).css("display") == "block") {
  3828. $("#webuiPopover3 div.arrow").css("left", "23px");
  3829. $("#webuiPopover3 a.close").css("margin-top", "15px");
  3830. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">诊断</span>';
  3831. html += '<div class="form-group has-feedback" style="float: right;width: 300px;margin-right: 20px;margin-top: 10px;">' +
  3832. ' <input type="text" class="form-control has-feedback-left" ' +
  3833. ' placeholder="搜索" style="padding-left: 10px;" oninput="loadDiagnose(this.value)" id="paramsDiagnose">' +
  3834. ' <span class="fa fa-search form-control-feedback right" aria-hidden="true" style="right: 0px;"></span>' +
  3835. ' </div>';
  3836. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='diagnoseContentHtml'>";
  3837. html += "</div>";
  3838. $("#webuiPopover3 div.webui-popover-content").html(html);
  3839. $("#webuiPopover3").css("z-index", "10");
  3840. //$("#paramsDiagnose").on('input propertychange', loadDiagnose($("#paramsDiagnose").val()));
  3841. loadDiagnose("");
  3842. }
  3843. //加载智能接诊模块的诊断推荐推荐
  3844. fitDiagnoseData();
  3845. });
  3846. //现病史选中事件
  3847. $("#emrHpi").on("click", function (t) {
  3848. //加载智能接诊模块的现病史推荐推荐
  3849. fitEmrHpiData();
  3850. });
  3851. //既往史选中事件
  3852. $("#emrPs").on("click", function (t) {
  3853. //加载智能接诊模块的既往史推荐推荐
  3854. fitEmrPsData();
  3855. });
  3856. // //西药选中事件
  3857. // $("#western_medicine_name").on("click", function (t) {
  3858. // if ($(westernMedicineWebuiPopover).css("display") == "block") {
  3859. // $("#westernMedicinePopoverContent").parent().parent().prev().css("left", "23px");
  3860. // loadYpList(0);
  3861. // }
  3862. // });
  3863. // //中药选中事件
  3864. // $("#chinese_medicine_name").on("click", function (t) {
  3865. // if ($(chineseMedicineWebuiPopover).css("display") == "block") {
  3866. // $("#chineseMedicinePopoverContent").parent().parent().prev().css("left", "23px");
  3867. // loadYpList(1);
  3868. // }
  3869. // });
  3870. // //诊疗与医技弹窗选中事件
  3871. // $("#jcJyItem").on("click", function (t) {
  3872. // if ($(jcJyItemWebuiPopover).css("display") == "block") {
  3873. // $("#jcJyItemPopoverContent").parent().parent().prev().css("left", "23px");
  3874. // loadjcJyItemList();
  3875. // }
  3876. // });
  3877. //帮助字典弹窗
  3878. settings.width = 450;
  3879. settings.height = 500;
  3880. settings.placement = 'right';//值: auto,top,right,bottom,left,top-right,top-left,bottom-right,bottom-left 要显示的位置
  3881. settings.content = '<div id="treePopoverContent"><div><ul id="treeDemo" class="ztree"></ul></div></div>';
  3882. settings.trigger = 'click';
  3883. var treeWebuiPopover = $('#treeButton').webuiPopover('destroy').webuiPopover(settings);
  3884. $("#treeButton").on("click", function (t) {
  3885. // $("#treePopoverContent").parent().parent().prev().css("left", "23px");
  3886. //初始化药品,检查检验菜单树
  3887. initzTree();
  3888. });
  3889. }
  3890. /**
  3891. * 新增通用参数
  3892. */
  3893. function saveParams() {
  3894. $.ajax({
  3895. type: "POST",
  3896. url: '/thmz/saveTCommonParams',
  3897. contentType: "application/json;charset=UTF-8",
  3898. dataType: "json",
  3899. data: JSON.stringify({
  3900. "paramsType": $("#paramsType").val(),
  3901. "paramsName": $("#paramsNameInput").val()
  3902. }),
  3903. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3904. success: function (res) {
  3905. if (res == '401' || res == 401) {
  3906. window.location.href = '/thmz/login/view'
  3907. return;
  3908. }
  3909. if (res.code == 0) {
  3910. successMesage(res);
  3911. loadSymptom();
  3912. $("#paramsNameInput").val(null);
  3913. // $("#paramsType").selectpicker('val', 0);
  3914. // $("#paramsType").selectpicker('refresh');
  3915. } else {
  3916. errorMesage(res);
  3917. }
  3918. }
  3919. });
  3920. }
  3921. /**
  3922. * 加载主诉参数列表
  3923. */
  3924. function loadSymptom() {
  3925. $.ajax({
  3926. type: "GET",
  3927. url: '/thmz/loadSymptom',
  3928. contentType: "application/json;charset=UTF-8",
  3929. dataType: "json",
  3930. async: false,
  3931. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3932. success: function (res) {
  3933. if (res == '401' || res == 401) {
  3934. window.location.href = '/thmz/login/view'
  3935. return;
  3936. }
  3937. var html = '';
  3938. if (res.code == 0) {
  3939. if (res.featureList != null && res.featureList.length > 0) {
  3940. html += '<div id="feature">';
  3941. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用症状:</div>';
  3942. html += '<div style="width: calc(100% - 80px); float: left;">';
  3943. for (var i = 0; i < res.featureList.length; i++) {
  3944. 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;">';
  3945. html += res.featureList[i].paramsName;
  3946. html += '</span></button>';
  3947. }
  3948. html += '</div><div style="clear:both"></div></div>';
  3949. }
  3950. if (res.timeList != null && res.timeList.length > 0) {
  3951. html += '<div id="time">';
  3952. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用时间:</div>';
  3953. html += '<div style="width: calc(100% - 80px); float: left;">';
  3954. for (var i = 0; i < res.timeList.length; i++) {
  3955. 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;">';
  3956. html += res.timeList[i].paramsName;
  3957. html += '</span></button>';
  3958. }
  3959. html += '</div><div style="clear:both"></div></div>';
  3960. }
  3961. if (res.characterList != null && res.characterList.length > 0) {
  3962. html += '<div id="character">';
  3963. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用标点:</div>';
  3964. html += '<div style="width: calc(100% - 80px); float: left;">';
  3965. for (var i = 0; i < res.characterList.length; i++) {
  3966. 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;">';
  3967. html += res.characterList[i].paramsName;
  3968. html += '</span></button>';
  3969. }
  3970. html += '</div><div style="clear:both"></div></div>';
  3971. }
  3972. if (res.wordsList != null && res.wordsList.length > 0) {
  3973. html += '<div id="words">';
  3974. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用词:</div>';
  3975. html += '<div style="width: calc(100% - 80px); float: left;">';
  3976. for (var i = 0; i < res.wordsList.length; i++) {
  3977. 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;">';
  3978. html += res.wordsList[i].paramsName;
  3979. html += '</span></button>';
  3980. }
  3981. html += '</div><div style="clear:both"></div></div>';
  3982. }
  3983. } else {
  3984. errorMesage(res);
  3985. }
  3986. $("#contentHtml").html(html);
  3987. }
  3988. });
  3989. }
  3990. /**
  3991. * 加载体格检查参数列表
  3992. */
  3993. function loadHealthCheckup() {
  3994. $.ajax({
  3995. type: "GET",
  3996. url: '/thmz/loadHealthCheckup',
  3997. contentType: "application/json;charset=UTF-8",
  3998. dataType: "json",
  3999. async: false,
  4000. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4001. success: function (res) {
  4002. if (res == '401' || res == 401) {
  4003. window.location.href = '/thmz/login/view'
  4004. return;
  4005. }
  4006. var html = '';
  4007. if (res.code == 0) {
  4008. if (res.weightList != null && res.weightList.length > 0) {
  4009. html += '<div id="weightDiv">';
  4010. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">体重:</div>';
  4011. html += '<div style="width: calc(100% - 80px); float: left;">';
  4012. for (var i = 0; i < res.weightList.length; i++) {
  4013. 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;">';
  4014. html += res.weightList[i].paramsName;
  4015. html += '</span></button>';
  4016. }
  4017. html += '</div><div style="clear:both"></div></div>';
  4018. }
  4019. if (res.temperatureList != null && res.temperatureList.length > 0) {
  4020. html += '<div id="temperatureDiv">';
  4021. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">体温:</div>';
  4022. html += '<div style="width: calc(100% - 80px); float: left;">';
  4023. for (var i = 0; i < res.temperatureList.length; i++) {
  4024. 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;">';
  4025. html += res.temperatureList[i].paramsName;
  4026. html += '</span></button>';
  4027. }
  4028. html += '</div><div style="clear:both"></div></div>';
  4029. }
  4030. if (res.sphygmusList != null && res.sphygmusList.length > 0) {
  4031. html += '<div id="sphygmusDiv">';
  4032. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">脉搏:</div>';
  4033. html += '<div style="width: calc(100% - 80px); float: left;">';
  4034. for (var i = 0; i < res.sphygmusList.length; i++) {
  4035. 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;">';
  4036. html += res.sphygmusList[i].paramsName;
  4037. html += '</span></button>';
  4038. }
  4039. html += '</div><div style="clear:both"></div></div>';
  4040. }
  4041. if (res.breatheList != null && res.breatheList.length > 0) {
  4042. html += '<div id="breatheDiv">';
  4043. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">呼吸:</div>';
  4044. html += '<div style="width: calc(100% - 80px); float: left;">';
  4045. for (var i = 0; i < res.breatheList.length; i++) {
  4046. 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;">';
  4047. html += res.breatheList[i].paramsName;
  4048. html += '</span></button>';
  4049. }
  4050. html += '</div><div style="clear:both"></div></div>';
  4051. }
  4052. if (res.pressureList != null && res.pressureList.length > 0) {
  4053. html += '<div id="pressureDiv">';
  4054. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">血压:</div>';
  4055. html += '<div style="width: calc(100% - 80px); float: left;">';
  4056. for (var i = 0; i < res.pressureList.length; i++) {
  4057. 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;">';
  4058. html += res.pressureList[i].paramsName;
  4059. html += '</span></button>';
  4060. }
  4061. html += '</div><div style="clear:both"></div></div>';
  4062. }
  4063. } else {
  4064. errorMesage(res);
  4065. }
  4066. $("#healthCheckupContentHtml").html(html);
  4067. }
  4068. });
  4069. }
  4070. /**
  4071. * 加载诊断参数列表
  4072. * @param value
  4073. */
  4074. function loadDiagnose(value) {
  4075. if (!$("#webuiPopover3").hasClass("in")) {
  4076. return;
  4077. }
  4078. $.ajax({
  4079. type: "GET",
  4080. url: '/thmz/getTCommonParamsByParamsType?paramsType=4&commonParams=' + value + '&pageSize=100',
  4081. contentType: "application/json;charset=UTF-8",
  4082. dataType: "json",
  4083. async: false,
  4084. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4085. success: function (res) {
  4086. if (res == '401' || res == 401) {
  4087. window.location.href = '/thmz/login/view'
  4088. return;
  4089. }
  4090. var html = '';
  4091. if (res.code == 0) {
  4092. if (res.data != null && res.data.length > 0) {
  4093. html += '<div>';
  4094. for (var i = 0; i < res.data.length; i++) {
  4095. html += '<button type="button" class="button_color" style="background-color: rgb(255, 255, 255);border: none;" onclick="fitDiagnoseValue(\'' + res.data[i].paramsName + '\',\'' + res.data[i].paramsCode + '\')"><span style="padding: 0px 5px;font-size: 20px;">';
  4096. html += res.data[i].paramsName;
  4097. html += '<small>&nbsp;&nbsp;(' + res.data[i].paramsCode + ')</small>';
  4098. html += '</span></button>';
  4099. }
  4100. html += '</div>';
  4101. }
  4102. } else {
  4103. errorMesage(res);
  4104. }
  4105. $("#diagnoseContentHtml").html(html);
  4106. }
  4107. });
  4108. }
  4109. /**
  4110. * 填充诊断
  4111. * @param value
  4112. * @param code
  4113. */
  4114. function fitDiagnoseValue(value, code) {
  4115. if (code === null || code === "") {
  4116. return;
  4117. }
  4118. var html = '';
  4119. var childrenNum = $("#diagnoseTags").children().length;
  4120. if (childrenNum == 6) {
  4121. errorMesageSimaple("最多填写六个诊断!");
  4122. return;
  4123. }
  4124. var diagnoseValue = $("#diagnoseValue").val();
  4125. if (diagnoseValue == null || diagnoseValue == "") {
  4126. diagnoseValue = code;
  4127. } else {
  4128. if (diagnoseValue.indexOf(code) != -1) {
  4129. errorMesageSimaple("诊断已存在,请勿重复添加!");
  4130. return;
  4131. }
  4132. diagnoseValue += "," + code;
  4133. }
  4134. $("#diagnoseValue").val(diagnoseValue);
  4135. if (childrenNum == 0) {
  4136. html += '<span class="el-tag--mainDiagnosis" ';
  4137. } else {
  4138. html += '<span class="el-tag--secondaryDiagnosis" ';
  4139. }
  4140. 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>';
  4141. $("#diagnoseTags").append(html);
  4142. $("#diagnoseTags").parent().parent().css("height", $("#diagnoseTags").height());
  4143. }
  4144. /**
  4145. * 移除诊断
  4146. * @param code
  4147. */
  4148. function removeDiagnoseValue(code) {
  4149. var childrenIndex = 0;
  4150. var children = $("#diagnoseTags").children();
  4151. for (var i = 0; i < children.length; i++) {
  4152. if ($(children[i]).attr("id") == code) {
  4153. childrenIndex = i;
  4154. break;
  4155. }
  4156. }
  4157. $($("#diagnoseTags").children("span")[childrenIndex]).remove();
  4158. if (childrenIndex == 0) {
  4159. $($("#diagnoseTags").children("span")[childrenIndex]).removeClass("el-tag--secondaryDiagnosis").addClass("el-tag--mainDiagnosis");
  4160. }
  4161. var diagnoseValue = $("#diagnoseValue").val();
  4162. $("#diagnoseValue").val(diagnoseValue.replace(code, ""));
  4163. $("#diagnoseTags").parent().parent().css("height", $("#diagnoseTags").height());
  4164. }
  4165. /**
  4166. * 点击通用参数属性值时设置值到对应的区域
  4167. * @param value
  4168. * @param id
  4169. */
  4170. function fitValue(value, id) {
  4171. //当选择的是血压时
  4172. if (id == "pressure_") {
  4173. var arr = value.split("/");
  4174. $("#pressure_high").val(arr[0]);
  4175. $("#pressure_floor").val(arr[1]);
  4176. if ($("#pressureLeftFlag").hasClass("in")) {
  4177. $("#pressure_high_left").val(arr[0]);
  4178. $("#pressure_floor_left").val(arr[1]);
  4179. }
  4180. //当选的是体重,体温,脉搏和呼吸时
  4181. } else if (id == "weight" || id == "temperature" || id == "sphygmus" || id == "breathe") {
  4182. $("#" + id).val(value);
  4183. } else {
  4184. //主诉拼写时
  4185. var valueExist = $("#" + id).val();
  4186. if (valueExist != null && valueExist != "") {
  4187. value = valueExist + value;
  4188. }
  4189. $("#" + id).val(value);
  4190. }
  4191. }
  4192. /**
  4193. * 加载药品列表数列表
  4194. * @param index
  4195. */
  4196. function loadYpList(index) {
  4197. //var medicinePopoverContent = null;
  4198. var tableMedicine = null;
  4199. var MedicineName = null;
  4200. //var groupNo=null;
  4201. if (index == 0) {
  4202. // medicinePopoverContent = "westernMedicinePopoverContent";
  4203. tableMedicine = "tb_table_western_medicine";
  4204. MedicineName = "western_medicine_name";
  4205. // groupNo=71;
  4206. }
  4207. if (index == 1) {
  4208. // medicinePopoverContent = "chineseMedicinePopoverContent";
  4209. tableMedicine = "tb_table_chinese_medicine";
  4210. MedicineName = "chinese_medicine_name";
  4211. // groupNo=$("#zyClassType").val();
  4212. }
  4213. // if (!$("#" + medicinePopoverContent).parent().parent().parent().hasClass("in")) {
  4214. // return;
  4215. // }
  4216. $('#' + tableMedicine).bootstrapTable('refresh');
  4217. $('#' + tableMedicine).bootstrapTable({
  4218. url: '/thmz/getYpListByCommonParams', //请求后台的URL(*)
  4219. method: 'GET', //请求方式(*)
  4220. toolbar: '#toolbar', //工具按钮用哪个容器
  4221. striped: true, //是否显示行间隔色
  4222. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  4223. pagination: false, //是否显示分页(*)
  4224. sortable: true, //是否启用排序
  4225. sortOrder: "asc", //排序方式
  4226. queryParams: function (params) {
  4227. var groupNo = null;
  4228. if (index == 0) {
  4229. groupNo = 71;
  4230. }
  4231. if (index == 1) {
  4232. groupNo = $("#zyClassType").val();
  4233. }
  4234. var temp = {
  4235. groupNo: groupNo,
  4236. commonParams: $("#" + MedicineName).val()
  4237. };
  4238. return temp;
  4239. }, //传递参数(*)
  4240. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  4241. pageNumber: 1, //初始化加载第一页,默认第一页
  4242. pageSize: 5, //每页的记录行数(*)
  4243. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  4244. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  4245. strictSearch: true,
  4246. showColumns: false, //是否显示所有的列
  4247. showRefresh: false, //是否显示刷新按钮
  4248. minimumCountColumns: 2, //最少允许的列数
  4249. clickToSelect: true, //是否启用点击选中行
  4250. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  4251. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  4252. cardView: false, //是否显示详细视图
  4253. detailView: false,
  4254. //rowStyle:rowStyle,//通过自定义函数设置行样式
  4255. ajaxOptions: {
  4256. headers: {
  4257. 'Accept': 'application/json',
  4258. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  4259. }
  4260. },
  4261. columns: [
  4262. {
  4263. field: 'code',
  4264. title: '编码',
  4265. align: "center",
  4266. valign: 'middle',
  4267. // sortable: true
  4268. }, {
  4269. field: 'name',
  4270. title: '药品名称',
  4271. align: "center",
  4272. valign: 'middle',
  4273. // sortable: true
  4274. }
  4275. , {
  4276. field: 'specification',
  4277. title: '规格',
  4278. align: "center",
  4279. valign: 'middle',
  4280. // sortable: true
  4281. }, {
  4282. field: 'manufactory',
  4283. title: '生产厂家',
  4284. align: "center",
  4285. valign: 'middle',
  4286. // sortable: true
  4287. }, {
  4288. field: 'miniUnitName',
  4289. title: '单位',
  4290. align: "center",
  4291. valign: 'middle',
  4292. // sortable: true
  4293. }, {
  4294. field: 'chargeAmount',
  4295. title: '零售价',
  4296. align: "center",
  4297. valign: 'middle',
  4298. // sortable: true
  4299. formatter: function (value, row, index) {
  4300. if (value == null) {
  4301. return '0.0元';
  4302. }
  4303. return value.toFixed(2) + "元";
  4304. }
  4305. }, {
  4306. field: 'drugWinDesc',
  4307. title: '剂量',
  4308. align: "center",
  4309. valign: 'middle',
  4310. // sortable: true
  4311. }, {
  4312. field: 'stockAmountVirtual',
  4313. title: '库存数量',
  4314. align: "center",
  4315. valign: 'middle',
  4316. // sortable: true
  4317. }
  4318. ],
  4319. responseHandler: function (res) {
  4320. if (res == '401' || res == 401) {
  4321. window.location.href = '/thmz/login/view'
  4322. return;
  4323. }
  4324. var ress = eval(res);
  4325. if (ress.code == -1) {
  4326. errorMesage(res);
  4327. return {
  4328. "total": 0,//总页数
  4329. "rows": {} //数据
  4330. };
  4331. }
  4332. return {
  4333. "total": ress.data.length,//总页数
  4334. "rows": ress.data //数据
  4335. };
  4336. },
  4337. onClickRow: function (row, $element) {
  4338. $('#' + MedicineName).webuiPopover('hide');
  4339. if (index == 0) {
  4340. checkYpInfo(row.code, row.serial, row.ypType, true);
  4341. }
  4342. if (index == 1) {
  4343. checkZyInfo(row.code, row.serial, true);
  4344. }
  4345. }
  4346. });
  4347. }
  4348. /**
  4349. * 按照药品的编码 和药品拆零规格查询药品信息 西药
  4350. * @param code
  4351. * @param serial
  4352. * @param groupNo
  4353. * @param needNotice 是否需要提示 当用户操作的时候 true 需要提示, 范文和处方回写的时候false不需要提示
  4354. */
  4355. function checkYpInfo(code, serial, groupNo, needNotice) {
  4356. //判断是否有重复的项目 返回true 说明有重复的
  4357. if (verifyRepeat(code, serial, 0)) {
  4358. return;
  4359. }
  4360. $("#current_groupNo").val(groupNo);
  4361. //不需要每次都关闭这个帮助字典
  4362. //$("#treeButton").webuiPopover('hide');
  4363. $.ajax({
  4364. type: "GET",
  4365. url: '/thmz/getYpZdDictByCodeAndSerial?code=' + code + "&serial=" + serial,
  4366. contentType: "application/json;charset=UTF-8",
  4367. dataType: "json",
  4368. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4369. async: needNotice,//当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  4370. success: function (res) {
  4371. if (res == '401' || res == 401) {
  4372. window.location.href = '/thmz/login/view'
  4373. return;
  4374. }
  4375. if (res.code == 0) {
  4376. if (res.data != null) {
  4377. //如果
  4378. if ($("#xyTab").find("li") == null || $("#xyTab").find("li").length == 0) {
  4379. initNavTabs(0);
  4380. }
  4381. var cfdesc = '普药';
  4382. if (groupNo == '91') {
  4383. cfdesc = '医材';
  4384. } else if (groupNo == '111') {
  4385. cfdesc = '麻、精一';
  4386. } else if (groupNo == '131') {
  4387. cfdesc = '精二';
  4388. }
  4389. // else if(groupNo=='151'){
  4390. // cfdesc='诊疗';
  4391. // }
  4392. //每个处方不能超过5个药品
  4393. var tableId = $("#xyTab li.active").find("a").attr("href");
  4394. var childrens = $(tableId).find("div:eq(0)").children().length;
  4395. var currentGroupNo = $(tableId).find("input.current_groupNo").val();
  4396. if (childrens === 5) {
  4397. if (needNotice) {
  4398. $("#messageModal").modal();
  4399. $("#messageContent").html("单张处方最多只能开具5个药品,是否需要新增处方?");
  4400. $("#messageButton").off("click").on("click", function (t) {
  4401. $("#messageModal").modal("hide");
  4402. refreshNavTabs(0, groupNo);
  4403. fitWesternMedicine(res, groupNo);
  4404. // //选中药品后,光标默认到用法
  4405. // $("#supplyType").next().click();
  4406. });
  4407. $("#cancelButton").off("click");
  4408. } else {
  4409. refreshNavTabs(0, groupNo);
  4410. fitWesternMedicine(res, groupNo);
  4411. }
  4412. } else if (currentGroupNo != null && currentGroupNo != '' && groupNo != currentGroupNo) {
  4413. //当前编辑的处方与选中的品类非同一处方能保存的
  4414. var currentGroupNos = $("#xyTabContent").find("input.current_groupNo");
  4415. //是否需要新增处方页,以保存医材处方
  4416. var needAddTable = true;
  4417. for (var i = 0; i < currentGroupNos.length; i++) {
  4418. if ($(currentGroupNos[i]).val() == groupNo) {
  4419. var next = $(currentGroupNos[i]).next();
  4420. if ($(next).children().length < 5) {
  4421. var parentId = $(currentGroupNos[i]).parent().attr("id");
  4422. //切换处方
  4423. $("#xyTab").find("a[href='#" + parentId + "']").off("click").tab('show');
  4424. //因为存在没有满5个的处方页,直接保存到该页
  4425. needAddTable = false;
  4426. fitWesternMedicine(res, groupNo);
  4427. }
  4428. }
  4429. }
  4430. if (needAddTable) {
  4431. //91 医材
  4432. var message = "医材需要单独处方,是否需要新增医材处方?";
  4433. if (groupNo == '71') {
  4434. message = "普通西成药需要单独处方,是否需要新增处方?"
  4435. } else if (groupNo == '111') {
  4436. message = "麻、精一药物需要单独处方,是否需要新增处方?"
  4437. } else if (groupNo == '131') {
  4438. message = "精二药物需要单独处方,是否需要新增处方?"
  4439. }
  4440. if (needNotice) {
  4441. $("#messageModal").modal();
  4442. $("#messageContent").html(message);
  4443. $("#messageButton").off("click").on("click", function (t) {
  4444. $("#messageModal").modal("hide");
  4445. refreshNavTabs(0, groupNo);
  4446. fitWesternMedicine(res, groupNo);
  4447. // //选中药品后,光标默认到用法
  4448. // $("#supplyType").next().click();
  4449. });
  4450. $("#cancelButton").off("click");
  4451. } else {
  4452. refreshNavTabs(0, groupNo);
  4453. fitWesternMedicine(res, groupNo);
  4454. }
  4455. }
  4456. //当前编辑的处方非普通西药处方
  4457. } else {
  4458. $("#xyTab li.active").find("a").find("small.cfdesc").text("(" + cfdesc + ")");
  4459. fitWesternMedicine(res, groupNo);
  4460. }
  4461. // if (needNotice) {
  4462. // //选中药品后,光标默认到用法
  4463. // $("#supplyType").next().click();
  4464. // // currentEleId = 'supplyType';
  4465. // }
  4466. }
  4467. } else {
  4468. errorMesage(res);
  4469. }
  4470. }
  4471. });
  4472. }
  4473. /**
  4474. * 按照药品的编码 和药品拆零规格查询药品信息 中药
  4475. * @param code
  4476. * @param serial
  4477. * @param async 当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  4478. */
  4479. function checkZyInfo(code, serial, async) {
  4480. //判断是否有重复的项目 返回true 说明有重复的
  4481. if (verifyRepeat(code, serial, 1)) {
  4482. return;
  4483. }
  4484. $.ajax({
  4485. type: "GET",
  4486. url: '/thmz/getYpZdDictByCodeAndSerial?code=' + code + "&serial=" + serial,
  4487. contentType: "application/json;charset=UTF-8",
  4488. dataType: "json",
  4489. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4490. async: async,//当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  4491. success: function (res) {
  4492. if (res == '401' || res == 401) {
  4493. window.location.href = '/thmz/login/view'
  4494. return;
  4495. }
  4496. if (res.code == 0) {
  4497. if (res.data != null) {
  4498. //如果
  4499. if ($("#zyTab").find("li") == null || $("#zyTab").find("li").length == 0) {
  4500. initNavTabs(1);
  4501. $("input.zyfs").val(1);
  4502. }
  4503. $("#chinese_medicine_name").val(res.data.name);
  4504. $("#chinese_medicine_name").blur();
  4505. $("#zy_drugWin").val(res.data.weight);
  4506. $("#zy_packRetprice").val(res.data.packRetprice);
  4507. $("#current_code").val(res.data.code);
  4508. $("#current_serial").val(res.data.serial);
  4509. if (async) {
  4510. //选中药品后,光标默认到数量输入框
  4511. $("#zy_drugWin").focus();
  4512. // currentEleId = 'zy_drugWin';
  4513. }
  4514. }
  4515. } else {
  4516. errorMesage(res);
  4517. }
  4518. }
  4519. });
  4520. }
  4521. /**
  4522. * 加载医技与诊疗列表
  4523. * @param index
  4524. */
  4525. function loadjcJyItemList() {
  4526. // if (!$("#jcJyItemPopoverContent").parent().parent().parent().hasClass("in")) {
  4527. // return;
  4528. // }
  4529. $('#tb_table_jc_jy_item').bootstrapTable('refresh');
  4530. $('#tb_table_jc_jy_item').bootstrapTable({
  4531. url: '/thmz/getJcJyItemByCommonParams', //请求后台的URL(*)
  4532. method: 'GET', //请求方式(*)
  4533. toolbar: '#toolbar', //工具按钮用哪个容器
  4534. striped: true, //是否显示行间隔色
  4535. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  4536. pagination: false, //是否显示分页(*)
  4537. sortable: true, //是否启用排序
  4538. sortOrder: "asc", //排序方式
  4539. queryParams: function (params) {
  4540. var temp = {
  4541. commonParams: $("#jcJyItem").val()
  4542. };
  4543. return temp;
  4544. }, //传递参数(*)
  4545. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  4546. pageNumber: 1, //初始化加载第一页,默认第一页
  4547. pageSize: 5, //每页的记录行数(*)
  4548. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  4549. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  4550. strictSearch: true,
  4551. showColumns: false, //是否显示所有的列
  4552. showRefresh: false, //是否显示刷新按钮
  4553. minimumCountColumns: 2, //最少允许的列数
  4554. clickToSelect: true, //是否启用点击选中行
  4555. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  4556. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  4557. cardView: false, //是否显示详细视图
  4558. detailView: false,
  4559. //rowStyle:rowStyle,//通过自定义函数设置行样式
  4560. ajaxOptions: {
  4561. headers: {
  4562. 'Accept': 'application/json',
  4563. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  4564. }
  4565. },
  4566. columns: [
  4567. {
  4568. field: 'code',
  4569. title: '编码',
  4570. align: "center",
  4571. valign: 'middle',
  4572. // sortable: true
  4573. }, {
  4574. field: 'name',
  4575. title: '名称',
  4576. align: "center",
  4577. valign: 'middle',
  4578. // sortable: true
  4579. }
  4580. , {
  4581. field: 'execUnitName',
  4582. title: '执行科室',
  4583. align: "center",
  4584. valign: 'middle',
  4585. // sortable: true
  4586. }
  4587. ],
  4588. responseHandler: function (res) {
  4589. if (res == '401' || res == 401) {
  4590. window.location.href = '/thmz/login/view'
  4591. return;
  4592. }
  4593. var ress = eval(res);
  4594. if (ress.code == -1) {
  4595. errorMesage(res);
  4596. return {
  4597. "total": 0,//总页数
  4598. "rows": {} //数据
  4599. };
  4600. }
  4601. return {
  4602. "total": ress.data.length,//总页数
  4603. "rows": ress.data //数据
  4604. };
  4605. },
  4606. onClickRow: function (row, $element) {
  4607. $('#jcJyItem').webuiPopover('hide');
  4608. $("#jcJyZltype").val(row.type);
  4609. $("#execUnit").selectpicker('val', row.execUnit);//默认不选中
  4610. $("#execUnit").selectpicker('refresh');
  4611. if (row.type == 3) {
  4612. //诊疗
  4613. if ($("#zlTab").find("li") == null || $("#zlTab").find("li").length == 0) {
  4614. initNavTabs(2);
  4615. }
  4616. $("#jcJyItem").val(row.name);
  4617. $("#jcJyItem").blur();
  4618. $("#jcjyItemPrice").val(row.chargeAmount);
  4619. $("#chargeUnit").val(row.specification);
  4620. $("#current_code").val(row.code);
  4621. $("#jcJyItemChargeDetail").removeClass("in").addClass("hide");
  4622. $("#chargeUnitDiv").removeClass("hide").addClass("in");
  4623. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  4624. $("#yshPartDiv").removeClass("in").addClass("hide");
  4625. $("#itemQuantityDiv").removeClass("hide").addClass("in");
  4626. $("#itemQuantity").val(1);
  4627. $("#chargeUnit").focus();
  4628. // currentEleId = 'chargeUnit';
  4629. return;
  4630. }
  4631. if (row.type == 1) {
  4632. //检验
  4633. $("#jyZdSampleDiv").removeClass("hide").addClass("in");
  4634. $("#chargeUnitDiv").removeClass("in").addClass("hide");
  4635. $("#yshPartDiv").removeClass("in").addClass("hide");
  4636. if (row.sampleCode != null && row.sampleCode != "") {
  4637. $("#jyZdSample").selectpicker('val', row.sampleCode);
  4638. $('#jyZdSample').selectpicker('refresh');
  4639. }
  4640. } else if (row.type == 2) {
  4641. //检查
  4642. $("#yshPartDiv").removeClass("hide").addClass("in");
  4643. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  4644. $("#chargeUnitDiv").removeClass("in").addClass("hide");
  4645. if (row.bwCode != null && row.bwCode != "") {
  4646. $("#yshPart").selectpicker('val', row.bwCode);
  4647. $('#yshPart').selectpicker('refresh');
  4648. }
  4649. }
  4650. $("#itemQuantityDiv").removeClass("in").addClass("hide");
  4651. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  4652. checkJcJyItemInfo(row.code, row.name, row.type, true);
  4653. }
  4654. });
  4655. }
  4656. /**
  4657. * 诊疗与医技选中
  4658. * @param code
  4659. * @param name 回写的时候可以设置null
  4660. * @param type 1 检验 2 检查 3 诊疗
  4661. * @param async 当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  4662. */
  4663. //function checkJcJyItemInfo(code, name, type) {
  4664. function checkJcJyItemInfo(code, name, type, async) {
  4665. //判断是否有重复的项目 返回true 说明有重复的
  4666. if (verifyRepeat(code, null, 2)) {
  4667. return;
  4668. }
  4669. //不需要每次都关闭帮助树
  4670. //$("#treeButton").webuiPopover('hide');
  4671. $.ajax({
  4672. type: "GET",
  4673. url: '/thmz/getJcJyItemChargeByCode?code=' + code + '&jcJyZltype=' + type,
  4674. contentType: "application/json;charset=UTF-8",
  4675. dataType: "json",
  4676. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4677. async: async,//当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  4678. success: function (res) {
  4679. if (res == '401' || res == 401) {
  4680. window.location.href = '/thmz/login/view'
  4681. return;
  4682. }
  4683. if (res.code == 0) {
  4684. if (res.data != null) {
  4685. //如果
  4686. if ($("#zlTab").find("li") == null || $("#zlTab").find("li").length == 0) {
  4687. initNavTabs(2);
  4688. }
  4689. if (name == null) {
  4690. name = res.name;
  4691. }
  4692. $("#jcJyItem").val(name);
  4693. $("#jcJyItem").blur();
  4694. $("#jcjyItemPrice").val(res.totalAmount);
  4695. $("#current_code").val(code);
  4696. $("#execUnit").selectpicker('val', res.execUnit);//默认不选中
  4697. $("#execUnit").selectpicker('refresh');
  4698. // if (async) {
  4699. // if (type == 1) {
  4700. // //选中项目后,光标默认到数量输入框
  4701. // $("#jyZdSample").next().click();
  4702. // // currentEleId = 'jyZdSample';
  4703. // } else if (type == 2) {
  4704. // $("#yshPart").next().click();
  4705. // // currentEleId = 'yshPart';
  4706. // }
  4707. // }
  4708. }
  4709. } else {
  4710. errorMesage(res);
  4711. }
  4712. }
  4713. });
  4714. }
  4715. /**
  4716. * 查询诊疗与医技项目明细
  4717. * @param code 编码
  4718. * @param jcJyZltype 1 检验 2 检查
  4719. */
  4720. function getJcJyItemChargeByCode(code, jcJyZltype) {
  4721. if (code != null) {
  4722. $("#itemCodeSearch").val(code);
  4723. $("#jcJyZltypeSearch").val(jcJyZltype);
  4724. } else if ($("#current_code").val() == null || $("#current_code").val() == '') {
  4725. errorMesageSimaple("未选中任何项目!");
  4726. return;
  4727. }
  4728. $("#jcJyItemModal").modal("show");
  4729. $('#jcJyItemTable').bootstrapTable('refresh');
  4730. $('#jcJyItemTable').bootstrapTable({
  4731. url: '/thmz/getJcJyItemChargeByCode', //请求后台的URL(*)
  4732. method: 'GET', //请求方式(*)
  4733. toolbar: '#toolbar', //工具按钮用哪个容器
  4734. striped: true, //是否显示行间隔色
  4735. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  4736. pagination: false, //是否显示分页(*)
  4737. sortable: true, //是否启用排序
  4738. sortOrder: "asc", //排序方式
  4739. queryParams: function (params) {
  4740. var itemCodeSearch = $("#itemCodeSearch").val();
  4741. var jcJyZltypeSearch = $("#jcJyZltypeSearch").val();
  4742. if (itemCodeSearch == null || itemCodeSearch == "") {
  4743. itemCodeSearch = $("#current_code").val();
  4744. jcJyZltypeSearch = $("#jcJyZltype").val();
  4745. }
  4746. var temp = {
  4747. code: itemCodeSearch,
  4748. jcJyZltype: jcJyZltypeSearch
  4749. };
  4750. return temp;
  4751. }, //传递参数(*)
  4752. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  4753. pageNumber: 1, //初始化加载第一页,默认第一页
  4754. pageSize: 5, //每页的记录行数(*)
  4755. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  4756. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  4757. strictSearch: true,
  4758. showColumns: false, //是否显示所有的列
  4759. showRefresh: false, //是否显示刷新按钮
  4760. minimumCountColumns: 2, //最少允许的列数
  4761. clickToSelect: true, //是否启用点击选中行
  4762. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  4763. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  4764. cardView: false, //是否显示详细视图
  4765. detailView: false,
  4766. //rowStyle:rowStyle,//通过自定义函数设置行样式
  4767. ajaxOptions: {
  4768. headers: {
  4769. 'Accept': 'application/json',
  4770. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  4771. }
  4772. },
  4773. columns: [
  4774. {
  4775. field: 'tcCode',
  4776. title: '项目编码',
  4777. align: "center",
  4778. valign: 'middle',
  4779. // sortable: true
  4780. }, {
  4781. field: 'code',
  4782. title: '收费编码',
  4783. align: "center",
  4784. valign: 'middle',
  4785. // sortable: true
  4786. }
  4787. , {
  4788. field: 'name',
  4789. title: '收费名称',
  4790. align: "center",
  4791. valign: 'middle',
  4792. // sortable: true
  4793. }, {
  4794. field: 'num',
  4795. title: '数量',
  4796. align: "center",
  4797. valign: 'middle',
  4798. // sortable: true
  4799. }, {
  4800. field: 'chargeAmount',
  4801. title: '单价',
  4802. align: "center",
  4803. valign: 'middle',
  4804. // sortable: true
  4805. formatter: function (value, row, index) {
  4806. if (value == null || value == "") {
  4807. return 0;
  4808. }
  4809. return value.toFixed(2);
  4810. }
  4811. }, {
  4812. field: 'totalAmount',
  4813. title: '总金额',
  4814. align: "center",
  4815. valign: 'middle',
  4816. // sortable: true
  4817. formatter: function (value, row, index) {
  4818. if (value == null || value == "") {
  4819. return 0;
  4820. }
  4821. return value.toFixed(2);
  4822. }
  4823. }
  4824. ],
  4825. responseHandler: function (res) {
  4826. if (res == '401' || res == 401) {
  4827. window.location.href = '/thmz/login/view'
  4828. return;
  4829. }
  4830. $("#itemCodeSearch").val(null);
  4831. var ress = eval(res);
  4832. if (ress.code == -1) {
  4833. errorMesage(res);
  4834. return {
  4835. "total": 0,//总页数
  4836. "rows": {} //数据
  4837. };
  4838. }
  4839. return {
  4840. "total": ress.data.length,//总页数
  4841. "rows": ress.data //数据
  4842. };
  4843. }
  4844. });
  4845. }
  4846. /**
  4847. * 判断是否有重复的项目 返回true 说明有重复的
  4848. * @param code
  4849. * @param serial
  4850. * @param index
  4851. */
  4852. function verifyRepeat(code, serial, index) {
  4853. //是新增药品还是编辑 true 修改 默认false
  4854. var updateFlag = $("#update_flag").val();
  4855. if (updateFlag == undefined || updateFlag == null) {
  4856. updateFlag = false;
  4857. }
  4858. if (updateFlag == "true" || updateFlag == true) {
  4859. return false;
  4860. }
  4861. var tabId = null;
  4862. //西药
  4863. if (index == 0) {
  4864. tabId = "xyTab";
  4865. } else if (index == 1) {
  4866. //中成药
  4867. tabId = "zyTab";
  4868. } else if (index == 2) {
  4869. //医技与诊疗
  4870. tabId = "zlTab";
  4871. } else if (index == 3) {
  4872. //入院
  4873. tabId = "zyReqTab";
  4874. }
  4875. var tableId = $("#" + tabId + " li.active").find("a").attr("href");
  4876. var items = $(tableId).find("div:eq(0)").find("div.form-group");
  4877. var groupId = null;
  4878. if (index == 0) {
  4879. groupId = $("#groupId").val();
  4880. }
  4881. if (items != null && items.length > 0) {
  4882. for (var i = 0; i < items.length; i++) {
  4883. if (serial == null) {
  4884. //西药需要判断组号,因为可能会有不同组的皮试用药,需要相同的药品
  4885. if (index == 0) {
  4886. var temporary_items_code = $(items[i]).find("input.temporary_items_code").val();
  4887. var temporary_items_groupId = $(items[i]).find("input.temporary_items_groupId").val();
  4888. if (code === temporary_items_code && groupId === temporary_items_groupId) {
  4889. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  4890. return true;
  4891. }
  4892. } else {
  4893. var temporary_items_code = $(items[i]).find("input.temporary_items_code").val();
  4894. if (code === temporary_items_code) {
  4895. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  4896. return true;
  4897. }
  4898. }
  4899. } else {
  4900. if (index == 0) {
  4901. var temporary_items_groupId = $(items[i]).find("input.temporary_items_groupId").val();
  4902. var temporary_items_code = $(items[i]).find("input.temporary_items_code").val();
  4903. var temporary_items_serial = $(items[i]).find("input.temporary_items_serial").val();
  4904. if (code === temporary_items_code && serial === temporary_items_serial && groupId === temporary_items_groupId) {
  4905. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  4906. return true;
  4907. }
  4908. } else {
  4909. var temporary_items_code = $(items[i]).find("input.temporary_items_code").val();
  4910. var temporary_items_serial = $(items[i]).find("input.temporary_items_serial").val();
  4911. if (code === temporary_items_code && serial === temporary_items_serial) {
  4912. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  4913. return true;
  4914. }
  4915. }
  4916. }
  4917. }
  4918. }
  4919. return false;
  4920. }
  4921. /**
  4922. * 初始化处方分页
  4923. * @param index 0 西药 1 中药 2 诊疗 3 入院
  4924. */
  4925. function initNavTabs(index) {
  4926. var tabId = null;
  4927. var tabContentId = null;
  4928. var paneId = null;
  4929. var cfdesc = '普药';
  4930. //西药
  4931. if (index == 0) {
  4932. tabId = "xyTab";
  4933. tabContentId = "xyTabContent";
  4934. paneId = "xycf_" + getUID();
  4935. } else if (index == 1) {
  4936. //中草药
  4937. tabId = "zyTab";
  4938. tabContentId = "zyTabContent";
  4939. paneId = "zycf_" + getUID();
  4940. cfdesc = '中草药';
  4941. } else if (index == 2) {
  4942. //医技
  4943. tabId = "zlTab";
  4944. tabContentId = "zlTabContent";
  4945. paneId = "zlcf_" + getUID();
  4946. cfdesc = '医技与诊疗';
  4947. } else if (index == 3) {
  4948. //医技
  4949. tabId = "zyReqTab";
  4950. tabContentId = "zyReqTabContent";
  4951. paneId = "zyReqcf_" + getUID();
  4952. cfdesc = '入院';
  4953. }
  4954. $("#" + tabId).html('<li class="active"><a href="#' + paneId + '" role="tab" data-toggle="tab">处方 <small class="cfdesc">(' + cfdesc + ')</small></a></li>');
  4955. var html = '<div class="tab-pane fade in active" id="' + paneId + '" style="height: 100%;min-height: 285px;position: relative;">';
  4956. html += '<img src="/thmz/images/prescription.png" style="margin-top: 5px;"/>';
  4957. html += '<input class="current_groupNo" type="hidden"/>';
  4958. html += ' <div class="cf_content rb_item" style="height: 230px;padding-top: 5px;overflow-y: auto;"></div>' +
  4959. ' <div style="height: 30px;border-top: 1px solid #ddd;width: 100%;position: absolute;bottom:0;padding-top: 10px;">';
  4960. html += '<div style="width: 460px;">'
  4961. if (index == 1) {
  4962. html += ' <div style="width: 130px;float: left;">' +
  4963. ' <label class="my_label_2">付数:</label>' +
  4964. ' <input type="text" class="form-control my_label_input_2 zyfs" id="zyfs"' +
  4965. ' placeholder="请输入" style="padding-left: 10px;" onchange="calculateZyAmount()">' +
  4966. ' </div>';
  4967. html += '<div style="width: 130px;float: left;">' +
  4968. ' <label class="my_label_2">频次:</label>' +
  4969. ' <div style="width: 85px;float: right;">' +
  4970. ' <select class="form-control selectpicker show-tick zy_orderFrequency"' +
  4971. ' title="请选择" data-live-search="true" onchange="calculate()" id="zy_orderFrequency_1">' +
  4972. ' </select>' +
  4973. ' </div>' +
  4974. ' </div>';
  4975. html += '<div style="width: 180px;float: left;">' +
  4976. ' <label class="my_label_2">用法:</label>' +
  4977. ' <div style="width: 135px;float: left;">' +
  4978. ' <select class="form-control selectpicker show-tick useType"' +
  4979. ' title="请选择" id="useType_1">' +
  4980. ' </select>' +
  4981. ' </div>' +
  4982. ' </div>';
  4983. html += '</div><div style="width: 460px;">'
  4984. html += '<input id="singleAmount" type="hidden"/>';
  4985. }
  4986. html += '<div style="width: 130px;float: left;padding-left: 7px;padding-top: 8px;">金额:<span class="cf_amount">0.0</span><span>元</span></div>';
  4987. //html += '<div style="width: 130px;float: left;padding-left: 7px;padding-top: 8px;"></div>';
  4988. if (index == 1) {
  4989. html += '<div style="width: 130px;float: left;">' +
  4990. ' <label class="my_label_2">液型:</label>' +
  4991. ' <div style="width: 85px;float: right;">' +
  4992. ' <select class="form-control selectpicker show-tick water" id="cyJssm">' +
  4993. ' </select>' +
  4994. ' </div>' +
  4995. ' </div>';
  4996. html += ' <div style="width: 180px;float: left;">' +
  4997. ' <label class="my_label_2">煎法:</label>' +
  4998. ' <div style="width: 135px;float: left;">' +
  4999. ' <select class="form-control selectpicker show-tick zy_supplyType"' +
  5000. ' title="请选择" id="zy_supplyType_1" onchange="calculateTotalAmount()">' +
  5001. ' </select>' +
  5002. ' </div>' +
  5003. ' </div>';
  5004. }
  5005. if (index == 0) {
  5006. html += '<div style="width: 310px;float: left;color: red;padding-top: 8px;">说明:此费用包含药品给药方式所产生的费用!</div>';
  5007. }
  5008. // else if (index == 1) {
  5009. // html += '<div style="width: 310px;float: left;color: red;padding-top: 8px;">说明:此费用包含药品代煎所产生的费用!</div>';
  5010. // }
  5011. html += '</div></div></div>';
  5012. $("#" + tabContentId).html(html);
  5013. if (index == 1) {
  5014. var useType = '<option value="1">饭前温服</option><option value="2">饭后温服</option><option value="3">饭前凉服</option><option value="4">饭后凉服</option><option value="5">顿服</option><option value="6">冲服</option><option value="7">外用</option>';
  5015. $('.useType').html(useType);
  5016. $('.useType').selectpicker('refresh');
  5017. var water = '<option value="加凉水">加凉水</option><option value="加温水">加温水</option><option value="加开水">加开水</option><option value="加冰水">加冰水</option><option value="加糖水">加糖水</option>';
  5018. $('.water').html(water);
  5019. $('.water').selectpicker('refresh');
  5020. initOrderFrequencys("zy_orderFrequency_1", false);
  5021. initZySupplyTypes("zy_supplyType_1", false);
  5022. }
  5023. }
  5024. /**
  5025. * 清空处方分页
  5026. * @param index 0 西药 1 中药 2 诊疗 3 入院
  5027. */
  5028. function clearNavTabs(index) {
  5029. var tabId = null;
  5030. var tabContentId = null;
  5031. //西药
  5032. if (index == 0) {
  5033. tabId = "xyTab";
  5034. tabContentId = "xyTabContent";
  5035. } else if (index == 1) {
  5036. //中草药
  5037. tabId = "zyTab";
  5038. tabContentId = "zyTabContent";
  5039. } else if (index == 2) {
  5040. //医技
  5041. tabId = "zlTab";
  5042. tabContentId = "zlTabContent";
  5043. } else if (index == 3) {
  5044. //医技
  5045. tabId = "zyReqTab";
  5046. tabContentId = "zyReqTabContent";
  5047. }
  5048. $("#" + tabId).html(null);
  5049. $("#" + tabContentId).html(null);
  5050. }
  5051. /**
  5052. * 添加处方分页
  5053. * @param index 0 西药 1 中药 2 诊疗 3 入院
  5054. * @param groupNo 71 普通西药 91 医材 111 麻、精一 131 精二 151 诊疗
  5055. */
  5056. function refreshNavTabs(index, groupNo) {
  5057. var tabId = null;
  5058. var tabContentId = null;
  5059. var paneIdPrfix = null;
  5060. var cfdesc = '普药';
  5061. //西药
  5062. if (index == 0) {
  5063. tabId = "xyTab";
  5064. tabContentId = "xyTabContent";
  5065. paneIdPrfix = "xycf_";
  5066. if (groupNo == '91') {
  5067. cfdesc = '医材';
  5068. } else if (groupNo == '111') {
  5069. cfdesc = '麻、精一';
  5070. } else if (groupNo == '131') {
  5071. cfdesc = '精二';
  5072. }
  5073. // else if(groupNo=='151'){
  5074. // cfdesc='诊疗';
  5075. // }
  5076. } else if (index == 1) {
  5077. //中草药
  5078. tabId = "zyTab";
  5079. tabContentId = "zyTabContent";
  5080. paneIdPrfix = "zycf_";
  5081. cfdesc = '中草药';
  5082. } else if (index == 2) {
  5083. //医技
  5084. tabId = "zlTab";
  5085. tabContentId = "zlTabContent";
  5086. paneIdPrfix = "zlcf_";
  5087. cfdesc = '医技与诊疗';
  5088. } else if (index == 3) {
  5089. //入院
  5090. tabId = "zyReqTab";
  5091. tabContentId = "zyReqTabContent";
  5092. paneIdPrfix = "zyReqcf_";
  5093. cfdesc = '入院';
  5094. }
  5095. // var tableId = $("#"+tabId+" li.active").find("a").attr("href");
  5096. // var length = $(tableId).find("div:eq(0)").children().length;
  5097. // if(length==0){
  5098. // //当前处方是空白的,不需要新增处方
  5099. // return;
  5100. // }
  5101. var cfTitle = "处方" + " <small class=\"cfdesc\">(" + cfdesc + ")</small>";
  5102. var paneId = paneIdPrfix + getUID();
  5103. //清除选中的样式
  5104. $("#" + tabId).find("li.active").removeClass("active");
  5105. $("#" + tabId).append('<li><a href="#' + paneId + '" role="tab" data-toggle="tab">' + cfTitle + '</a></li>');
  5106. var html = '<div class="tab-pane fade in active" id="' + paneId + '" style="height: 100%;min-height: 285px;position: relative;">' +
  5107. '<img src="/thmz/images/prescription.png" style="margin-top: 5px;"/>' +
  5108. '<input class="current_groupNo" type="hidden"/>' +
  5109. ' <div class="cf_content rb_item" style="height: 230px;padding-top: 5px;overflow-y: auto;"></div>' +
  5110. ' <div style="height: 30px;border-top: 1px solid #ddd;width: 100%;position: absolute;bottom:0;">' +
  5111. '<div style="width: 460px;">' +
  5112. '<div style="width: 130px;float: left;padding-left: 7px;padding-top: 8px;">金额:<span class="cf_amount">0.0</span><span>元</span></div>';
  5113. if (index == 0) {
  5114. html += '<div style="width: 310px;float: left;color: red;padding-top: 8px;">说明:此费用包含药品给药方式所产生的费用!</div>';
  5115. }
  5116. html += '</div></div>';
  5117. $("#" + tabContentId).append(html);
  5118. //切换处方
  5119. $("#" + tabId).find("a[href='#" + paneId + "']").off("click").tab('show');
  5120. }
  5121. /**
  5122. * 填充西药选中的内容
  5123. * @param res
  5124. * @param groupNo
  5125. */
  5126. function fitWesternMedicine(res, groupNo) {
  5127. $("#western_medicine_name").val(res.data.name);
  5128. $("#western_medicine_name").blur();
  5129. var drugWinHtml = '';
  5130. var index = null;
  5131. if (res.data.weight != null) {
  5132. $("#drugWin").val(res.data.weight);
  5133. $("#drugWinDb").val(res.data.weight);
  5134. drugWinHtml = '<option value="' + res.data.weighUnit + '" desc="' + res.data.weight + '">' + res.data.weighUnitDesc + '</option>';
  5135. index = res.data.weighUnit;
  5136. }
  5137. if (res.data.volum != null) {
  5138. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  5139. $("#drugWin").val(res.data.volum);
  5140. $("#drugWinDb").val(res.data.volum);
  5141. }
  5142. drugWinHtml += '<option value="' + res.data.volUnit + '" desc="' + res.data.volum + '">' + res.data.volUnitDesc + '</option>';
  5143. if (index == null) {
  5144. index = res.data.volUnit;
  5145. }
  5146. }
  5147. if (res.data.miniUnit != null && res.data.miniUnit != "") {
  5148. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  5149. $("#drugWin").val(1);
  5150. $("#drugWinDb").val(1);
  5151. }
  5152. drugWinHtml += '<option value="' + res.data.miniUnit + '" desc="1">' + res.data.miniUnitDesc + '</option>';
  5153. if (index == null) {
  5154. index = res.data.miniUnit;
  5155. }
  5156. }
  5157. $('#drugWinUnit').html(drugWinHtml);
  5158. $('#drugWinUnit').selectpicker('refresh');
  5159. $("#drugWinUnit").selectpicker('val', index);
  5160. $('#drugWinUnit').selectpicker('refresh');
  5161. if (res.data.packUnitDesc != null && res.data.packUnitDesc != "") {
  5162. var html = '<option value="' + res.data.packUnitDesc + '" >' + res.data.packUnitDesc + '</option>';
  5163. $('#packUnit').html(html);
  5164. $('#packUnit').selectpicker('refresh');
  5165. $("#packUnit").selectpicker('val', res.data.packUnitDesc);
  5166. $('#packUnit').selectpicker('refresh');
  5167. }
  5168. $("#packRetprice").val(res.data.packRetprice);
  5169. $("#packSize").val(res.data.packSize);
  5170. $("#current_code").val(res.data.code);
  5171. $("#current_serial").val(res.data.serial);
  5172. if ($("#dayNum").val() == null) {
  5173. //天数 同组药品天数相同
  5174. $("#dayNum").selectpicker('val', 1);
  5175. $('#dayNum').selectpicker('refresh');
  5176. }
  5177. if ($("#supplyType").val() == null && res.data.supplyType != null) {
  5178. // 给药方式 同组药品给药方式相同
  5179. $("#supplyType").selectpicker('val', res.data.supplyType);
  5180. $('#supplyType').selectpicker('refresh');
  5181. }
  5182. if ($("#orderFrequency").val() == null && res.data.frequency != null) {
  5183. //频次编码 同组药品频次编码相同
  5184. $("#orderFrequency").selectpicker('val', res.data.frequency);
  5185. $('#orderFrequency').selectpicker('refresh');
  5186. }
  5187. if ($("#orderFrequency").val() == null) {
  5188. //频次编码 防止频次为空
  5189. $("#orderFrequency").selectpicker('val', "ONCE");
  5190. $('#orderFrequency').selectpicker('refresh');
  5191. }
  5192. if (res.data.psFlag != null && (res.data.psFlag == 1 || res.data.psFlag == "1")) {
  5193. $("#tryFlag").parent().addClass("checked");
  5194. $("#tryFlag").parent().parent().parent().removeClass("hide").addClass("in");
  5195. } else {
  5196. $("#tryFlag").parent().removeClass("checked");
  5197. $("#tryFlag").parent().parent().parent().removeClass("in").addClass("hide");
  5198. }
  5199. $("#manufactoryName").val(res.data.manufactoryName);
  5200. $("#specification").val(res.data.specification);
  5201. // if (groupNo == "91") {
  5202. // //医材
  5203. // $("#gross").removeAttr("readonly")
  5204. // } else {
  5205. // $("#gross").attr("readonly", "readonly");
  5206. // }
  5207. calculate();
  5208. $("#western_medicine_name").focus();
  5209. }
  5210. /**
  5211. * 剂量单位改变事件
  5212. */
  5213. function drugWinUnitChange() {
  5214. var desc = $('#drugWinUnit').find("option:selected").attr('desc');
  5215. $("#drugWin").val(desc);
  5216. $("#drugWinDb").val(desc);
  5217. calculate();
  5218. }
  5219. /**
  5220. * 根据选择的内容计算总的用药量
  5221. */
  5222. function calculate() {
  5223. //最小规格剂量
  5224. var drugWinDb = $("#drugWinDb").val();
  5225. //天数
  5226. var dayNum = $("#dayNum").val();
  5227. //当前使用的最小剂量
  5228. var drugWin = $("#drugWin").val();
  5229. //频率
  5230. var times = $('#orderFrequency').find("option:selected").attr('desc');
  5231. //包装规格数量
  5232. var packSize = $("#packSize").val();
  5233. //单价
  5234. var packRetprice = $("#packRetprice").val();
  5235. //当前药房编码
  5236. var currentGroupNo = $("#current_groupNo").val();
  5237. if (drugWinDb == null || drugWinDb === "") {
  5238. if (currentGroupNo == '71') {
  5239. return;
  5240. }
  5241. drugWinDb = 1;
  5242. }
  5243. if (dayNum == null || dayNum === "") {
  5244. if (currentGroupNo == '71') {
  5245. return;
  5246. }
  5247. dayNum = 1;
  5248. }
  5249. if (drugWin == null || drugWin === "") {
  5250. if (currentGroupNo == '71') {
  5251. return;
  5252. }
  5253. drugWin = 1;
  5254. }
  5255. if (times == null || times === "") {
  5256. if (currentGroupNo == '71') {
  5257. return;
  5258. }
  5259. times = 1;
  5260. }
  5261. if (packSize == null || packSize === "") {
  5262. return;
  5263. }
  5264. //拆零总量
  5265. var scatteredTotalNum = Multiply(Multiply(dayNum, drugWin), times);
  5266. //整包装的数量
  5267. var totalNum = Math.ceil(Division(scatteredTotalNum, Multiply(packSize, drugWinDb)));
  5268. $("#gross").val(totalNum);
  5269. $("#totalRetprice").val(Multiply(totalNum, packRetprice).toFixed(2));
  5270. }
  5271. /**
  5272. * 根据选择的总量计算金额 只有医材的时候需要计算
  5273. */
  5274. function calculateSimple() {
  5275. //总量
  5276. var gross = $("#gross").val();
  5277. //单价
  5278. var packRetprice = $("#packRetprice").val();
  5279. $("#totalRetprice").val(Multiply(gross, packRetprice).toFixed(2));
  5280. //当前药房编码
  5281. var currentGroupNo = $("#current_groupNo").val();
  5282. if (currentGroupNo == '91') {
  5283. //医材默认天数为1
  5284. $("#dayNum").selectpicker('val', 1);
  5285. $('#dayNum').selectpicker('refresh');
  5286. $("#orderFrequency").selectpicker('val', "ONCE");
  5287. $('#orderFrequency').selectpicker('refresh');
  5288. }
  5289. }
  5290. /**
  5291. * 根据中药付数计算金额
  5292. */
  5293. function calculateZyAmount() {
  5294. var singleAmount = $("#singleAmount").val();
  5295. var tableId = $("#zyTab li.active").find("a").attr("href");
  5296. //获取中药付数
  5297. var zyfs = $(tableId).find("input.zyfs").val();
  5298. var cfAmount = Multiply(zyfs, singleAmount);
  5299. $(tableId).find("span.cf_amount").html(cfAmount);
  5300. calculateTotalAmount();
  5301. }
  5302. /**
  5303. * 将病人信息填入患者信息修改form
  5304. * @param patinet
  5305. */
  5306. function fillPlusPatinet(patinet) {
  5307. if (patinet != null) {
  5308. $("#editUserCode").val(patinet.patientId);
  5309. $("#editUserName").val(patinet.name);
  5310. $("#editUserName").blur();
  5311. $("#editUserAge").val(patinet.age);
  5312. $("#editUserAge").blur();
  5313. $("#editUserGender").selectpicker('val', patinet.sex);
  5314. $("#editUserGender").selectpicker('refresh');
  5315. $("#editUserGender").blur();
  5316. $("#editUserBirthDay").val(patinet.birthDayStr);
  5317. $("#editUserBirthDay").blur();
  5318. $('#editUserCertificateType').selectpicker('val', patinet.certificateType);
  5319. $('#editUserCertificateType').selectpicker('refresh');
  5320. $("#editUserCardNo").val(patinet.icCardNo);
  5321. $("#editUserCardNo").attr("title", patinet.icCardNo);
  5322. $("#editUserCardNo").blur();
  5323. $("#editUserPhoneNum").val(patinet.phoneNo);
  5324. $("#editUserPhoneNum").attr("title", patinet.phoneNo);
  5325. $("#editUserPhoneNum").blur();
  5326. $("#editUserPatientsNature").selectpicker('val', patinet.responseType);//默认选中
  5327. $('#editUserPatientsNature').selectpicker('refresh');
  5328. $("#editUserPatientsNature").blur();
  5329. $("#editUserIdCard").val(patinet.socialNo);
  5330. $("#editUserIdCard").attr("title", patinet.socialNo);
  5331. $("#editUserIdCard").blur();
  5332. $("#editUserAddress").val(patinet.address);
  5333. $("#editUserAddress").blur();
  5334. $("#editUserContact").val(patinet.relName);
  5335. $("#editUserContactPhone").val(patinet.contractName);
  5336. }
  5337. }
  5338. /**
  5339. * 修改病人信息
  5340. */
  5341. function modifyPatient() {
  5342. $.ajax({
  5343. type: "POST",
  5344. url: '/thmz/modifyPatient',
  5345. contentType: "application/json;charset=UTF-8",
  5346. dataType: "json",
  5347. data: JSON.stringify({
  5348. "name": $("#editUserName").val(),
  5349. "age": $("#editUserAge").val(),
  5350. "sex": $("#editUserGender").val(),
  5351. "birthDay": $("#editUserBirthDay").val(),
  5352. "certificateType": $("#editUserCertificateType").val(),
  5353. "icCardNo": $("#editUserCardNo").val(),
  5354. "phoneNo": $("#editUserPhoneNum").val(),
  5355. "responseType": $("#editUserPatientsNature").val(),
  5356. "socialNo": $("#editUserIdCard").val(),
  5357. "address": $("#editUserAddress").val(),
  5358. "patientId": $("#editUserCode").val(),
  5359. "relName": $("#editUserContact").val(),
  5360. "contractName": $("#editUserContactPhone").val()
  5361. }),
  5362. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5363. success: function (res) {
  5364. if (res == '401' || res == 401) {
  5365. window.location.href = '/thmz/login/view'
  5366. return;
  5367. }
  5368. if (res.code == 0) {
  5369. $('#editUserModal').modal('hide');
  5370. realClinicalReception($("#patientId").text(), $("#mzfzSerialNoInClick").val());
  5371. clearPlusPatinet();
  5372. } else {
  5373. errorMesage(res);
  5374. }
  5375. }
  5376. });
  5377. }
  5378. /**
  5379. * 将病人信息修改域置空
  5380. * @param patinet
  5381. */
  5382. function clearPlusPatinet() {
  5383. $("#editUserCode").val(null);
  5384. $("#editUserName").val(null);
  5385. $("#editUserAge").val(null);
  5386. $("#editUserGender").selectpicker('val', '1');
  5387. $("#editUserGender").selectpicker('refresh');
  5388. $("#editUserBirthDay").val(null);
  5389. $('#editUserCertificateType').selectpicker('val', '01');
  5390. $('#editUserCertificateType').selectpicker('refresh');
  5391. $("#editUserCardNo").val(null);
  5392. $("#editUserCardNo").attr("title", null);
  5393. $("#editUserPhoneNum").val(null);
  5394. $("#editUserPhoneNum").attr("title", null);
  5395. $("#editUserPatientsNature").selectpicker('val', '01');//默认选中
  5396. $('#editUserPatientsNature').selectpicker('refresh');
  5397. $("#editUserIdCard").val(null);
  5398. $("#editUserIdCard").attr("title", null);
  5399. $("#editUserAddress").val(null);
  5400. $("#editUserContact").val(null);
  5401. $("#editUserContactPhone").val(null);
  5402. }
  5403. // /**
  5404. // * 保存入院证
  5405. // */
  5406. // function saveBeHospitalized() {
  5407. // $.ajax({
  5408. // type: "POST",
  5409. // url: '/thmz/saveMzZyReq',
  5410. // contentType: "application/json;charset=UTF-8",
  5411. // dataType: "json",
  5412. // data: JSON.stringify({
  5413. // "patientId": $("#patientId").text(),
  5414. // "icdCode": $("#icdCodeBeHospitalized").val(),
  5415. // "icdText": $("#icdTextBeHospitalized").val(),
  5416. // "reqDept": $("#inpatientWardBeHospitalized").val(),
  5417. // "smallDept": $("#smallWardBeHospitalized").val(),
  5418. // "admissStatus": $("#admissStatus").val()
  5419. // }),
  5420. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5421. // success: function (res) {
  5422. // if (res == '401' || res == 401) {
  5423. // window.location.href = '/thmz/login/view'
  5424. // return;
  5425. // }
  5426. // if (res.code == 0) {
  5427. // successMesage(res);
  5428. // $('#beHospitalizedModal').modal('hide');
  5429. // loadInClinicTableList();
  5430. // loadClinicTableList();
  5431. // clearWorkSpace();
  5432. // } else {
  5433. // errorMesage(res);
  5434. // }
  5435. // }
  5436. // });
  5437. // }
  5438. /**
  5439. * 获取按钮组选择的下标
  5440. * @param id
  5441. * @returns {number}
  5442. */
  5443. function getIndex(id) {
  5444. var index = 0;
  5445. var item = $("#" + id).find("button");
  5446. for (var i = 0; i <= item.length; i++) {
  5447. if ($(item[i]).hasClass("btn-primary")) {
  5448. index = i;
  5449. break;
  5450. }
  5451. }
  5452. return index;
  5453. }
  5454. /**
  5455. * 获取时间选择器的时间数组
  5456. * @returns {string[]}
  5457. */
  5458. function getRePortRangeArr() {
  5459. var rePortRange = $('#reportrange span').html();
  5460. var rePortRangeArr = rePortRange.split(" - ");
  5461. rePortRangeArr[0] = rePortRangeArr[0] + " 00:00:00"
  5462. rePortRangeArr[1] = rePortRangeArr[1] + " 23:59:59"
  5463. return rePortRangeArr;
  5464. }
  5465. /**
  5466. * 初始医生工作太配置
  5467. */
  5468. function initWorkspaceConfigForCurrent() {
  5469. $.ajax({
  5470. type: "GET",
  5471. url: '/thmz/getWorkspaceConfigForCurrent',
  5472. dataType: "json",
  5473. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5474. success: function (res) {
  5475. if (res == '401' || res == 401) {
  5476. window.location.href = '/thmz/login/view'
  5477. return;
  5478. }
  5479. if (res.code == 0) {
  5480. if (res.data.symptomFlag == 1) {
  5481. $("#symptomFlag").removeClass("in").addClass("hide");
  5482. if ($("#symptomFlagCheck").parent().hasClass("checked")) {
  5483. $("#symptomFlagCheck").parent().parent().click();//当前选中改为不选中
  5484. }
  5485. } else if (res.data.symptomFlag == 0) {
  5486. $("#symptomFlag").removeClass("hide").addClass("in");
  5487. if (!$("#symptomFlagCheck").parent().hasClass("checked")) {
  5488. $("#symptomFlagCheck").parent().parent().click();//当前不选中改为选中
  5489. }
  5490. }
  5491. if (res.data.emrHpiFlag == 1) {
  5492. $("#emrHpiFlag").removeClass("in").addClass("hide");
  5493. if ($("#emrHpiFlagCheck").parent().hasClass("checked")) {
  5494. $("#emrHpiFlagCheck").parent().parent().click();//当前选中改为不选中
  5495. }
  5496. } else if (res.data.emrHpiFlag == 0) {
  5497. $("#emrHpiFlag").removeClass("hide").addClass("in");
  5498. if (!$("#emrHpiFlagCheck").parent().hasClass("checked")) {
  5499. $("#emrHpiFlagCheck").parent().parent().click();//当前不选中改为选中
  5500. }
  5501. }
  5502. if (res.data.emrPsFlag == 1) {
  5503. $("#emrPsFlag").removeClass("in").addClass("hide");
  5504. if ($("#emrPsFlagCheck").parent().hasClass("checked")) {
  5505. $("#emrPsFlagCheck").parent().parent().click();//当前选中改为不选中
  5506. }
  5507. } else if (res.data.emrPsFlag == 0) {
  5508. $("#emrPsFlag").removeClass("hide").addClass("in");
  5509. if (!$("#emrPsFlagCheck").parent().hasClass("checked")) {
  5510. $("#emrPsFlagCheck").parent().parent().click();//当前不选中改为选中
  5511. }
  5512. }
  5513. if (res.data.personalHistoryFlag == 1) {
  5514. $("#personalHistoryFlag").removeClass("in").addClass("hide");
  5515. if ($("#personalHistoryFlagCheck").parent().hasClass("checked")) {
  5516. $("#personalHistoryFlagCheck").parent().parent().click();//当前选中改为不选中
  5517. }
  5518. } else if (res.data.personalHistoryFlag == 0) {
  5519. $("#personalHistoryFlag").removeClass("hide").addClass("in");
  5520. if (!$("#personalHistoryFlagCheck").parent().hasClass("checked")) {
  5521. $("#personalHistoryFlagCheck").parent().parent().click();//当前不选中改为选中
  5522. }
  5523. }
  5524. if (res.data.familyHistoryFlag == 1) {
  5525. $("#familyHistoryFlag").removeClass("in").addClass("hide");
  5526. if ($("#familyHistoryFlagCheck").parent().hasClass("checked")) {
  5527. $("#familyHistoryFlagCheck").parent().parent().click();//当前选中改为不选中
  5528. }
  5529. } else if (res.data.familyHistoryFlag == 0) {
  5530. $("#familyHistoryFlag").removeClass("hide").addClass("in");
  5531. if (!$("#familyHistoryFlagCheck").parent().hasClass("checked")) {
  5532. $("#familyHistoryFlagCheck").parent().parent().click();//当前不选中改为选中
  5533. }
  5534. }
  5535. if (res.data.obstericalHistoryFlag == 1) {
  5536. $("#obstericalHistoryFlag").removeClass("in").addClass("hide");
  5537. if ($("#obstericalHistoryFlagCheck").parent().hasClass("checked")) {
  5538. $("#obstericalHistoryFlagCheck").parent().parent().click();//当前选中改为不选中
  5539. }
  5540. } else if (res.data.obstericalHistoryFlag == 0) {
  5541. $("#obstericalHistoryFlag").removeClass("hide").addClass("in");
  5542. if (!$("#obstericalHistoryFlagCheck").parent().hasClass("checked")) {
  5543. $("#obstericalHistoryFlagCheck").parent().parent().click();//当前不选中改为选中
  5544. }
  5545. }
  5546. if (res.data.pressureLeftFlag == 1) {
  5547. $("#pressureLeftFlag").removeClass("in").addClass("hide");
  5548. if ($("#pressureLeftFlagCheck").parent().hasClass("checked")) {
  5549. $("#pressureLeftFlagCheck").parent().parent().click();//当前选中改为不选中
  5550. }
  5551. } else if (res.data.pressureLeftFlag == 0) {
  5552. $("#pressureLeftFlag").removeClass("hide").addClass("in");
  5553. if (!$("#pressureLeftFlagCheck").parent().hasClass("checked")) {
  5554. $("#pressureLeftFlagCheck").parent().parent().click();//当前不选中改为选中
  5555. }
  5556. }
  5557. if (res.data.tentativeDiagnosisFlag == 1) {
  5558. $("#tentativeDiagnosisFlag").removeClass("in").addClass("hide");
  5559. if ($("#tentativeDiagnosisFlagCheck").parent().hasClass("checked")) {
  5560. $("#tentativeDiagnosisFlagCheck").parent().parent().click();//当前选中改为不选中
  5561. }
  5562. } else if (res.data.tentativeDiagnosisFlag == 0) {
  5563. $("#tentativeDiagnosisFlag").removeClass("hide").addClass("in");
  5564. if (!$("#tentativeDiagnosisFlagCheck").parent().hasClass("checked")) {
  5565. $("#tentativeDiagnosisFlagCheck").parent().parent().click();//当前不选中改为选中
  5566. }
  5567. }
  5568. } else {
  5569. errorMesage(res);
  5570. }
  5571. }
  5572. });
  5573. }
  5574. /**
  5575. * 保存医生工作台配置
  5576. */
  5577. function saveWorkspaceConfig() {
  5578. var symptomFlag = $("#symptomFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  5579. var emrHpiFlag = $("#emrHpiFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  5580. var emrPsFlag = $("#emrPsFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  5581. var personalHistoryFlag = $("#personalHistoryFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  5582. var familyHistoryFlag = $("#familyHistoryFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  5583. var obstericalHistoryFlag = $("#obstericalHistoryFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  5584. var pressureLeftFlag = $("#pressureLeftFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  5585. var tentativeDiagnosisFlag = $("#tentativeDiagnosisFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  5586. $.ajax({
  5587. type: "POST",
  5588. url: '/thmz/saveWorkspaceConfig',
  5589. contentType: "application/json;charset=UTF-8",
  5590. dataType: "json",
  5591. data: JSON.stringify({
  5592. "symptomFlag": symptomFlag,
  5593. "emrHpiFlag": emrHpiFlag,
  5594. "emrPsFlag": emrPsFlag,
  5595. "personalHistoryFlag": personalHistoryFlag,
  5596. "familyHistoryFlag": familyHistoryFlag,
  5597. "obstericalHistoryFlag": obstericalHistoryFlag,
  5598. "pressureLeftFlag": pressureLeftFlag,
  5599. "tentativeDiagnosisFlag": tentativeDiagnosisFlag
  5600. }),
  5601. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5602. success: function (res) {
  5603. if (res == '401' || res == 401) {
  5604. window.location.href = '/thmz/login/view'
  5605. return;
  5606. }
  5607. if (res.code == 0) {
  5608. //successMesage(res);
  5609. initWorkspaceConfigForCurrent();
  5610. $("#configWorkspaceModal").modal("hide");
  5611. } else {
  5612. errorMesage(res);
  5613. }
  5614. }
  5615. });
  5616. }
  5617. /**
  5618. * 初始化药品,检查检验菜单树
  5619. */
  5620. function initzTree() {
  5621. var index = getIndex("bill_item_group");
  5622. if (index == 0) {
  5623. $("#western_medicine_name").webuiPopover('hide');
  5624. $.ajax({
  5625. type: "GET",
  5626. url: '/thmz/getYpZdClasses',
  5627. contentType: "application/json;charset=UTF-8",
  5628. dataType: "json",
  5629. async: false,
  5630. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5631. success: function (res) {
  5632. if (res == '401' || res == 401) {
  5633. window.location.href = '/thmz/login/view'
  5634. return;
  5635. }
  5636. if (res.code == 0) {
  5637. // zTree 的参数配置,深入使用请参考 API 文档(setting 配置详解)
  5638. var setting = {
  5639. callback: {
  5640. onClick: zTreeOnClick
  5641. }
  5642. };
  5643. $.fn.zTree.init($("#treeDemo"), setting, res.data);
  5644. var webuiId=$("#treeButton").attr("data-target");
  5645. var top=$("#"+webuiId).css("top");
  5646. if(top.indexOf("-")==0){
  5647. $("#"+webuiId).css("top",'0px');
  5648. }
  5649. } else {
  5650. errorMesage(res);
  5651. }
  5652. }
  5653. });
  5654. } else if (index == 2) {
  5655. $("#jcJyItem").webuiPopover('hide');
  5656. $.ajax({
  5657. type: "GET",
  5658. url: '/thmz/getJyJcZdClasses',
  5659. contentType: "application/json;charset=UTF-8",
  5660. dataType: "json",
  5661. async: false,
  5662. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5663. success: function (res) {
  5664. if (res == '401' || res == 401) {
  5665. window.location.href = '/thmz/login/view'
  5666. return;
  5667. }
  5668. if (res.code == 0) {
  5669. // zTree 的参数配置,深入使用请参考 API 文档(setting 配置详解)
  5670. var setting = {
  5671. callback: {
  5672. onClick: zTreeOnClick
  5673. }
  5674. };
  5675. $.fn.zTree.init($("#treeDemo"), setting, res.data);
  5676. var webuiId=$("#treeButton").attr("data-target");
  5677. var top=$("#"+webuiId).css("top");
  5678. if(top.indexOf("-")==0){
  5679. $("#"+webuiId).css("top",'0px');
  5680. }
  5681. } else {
  5682. errorMesage(res);
  5683. }
  5684. }
  5685. });
  5686. } else if (index == 1) {
  5687. $("#treeButton").webuiPopover('hide');
  5688. warningMesageSimaple("中药暂无帮助字典");
  5689. } else {
  5690. $("#treeButton").webuiPopover('hide');
  5691. warningMesageSimaple("入院暂无帮助字典");
  5692. }
  5693. }
  5694. /**
  5695. * 节点点击事件
  5696. * @param event
  5697. * @param treeId
  5698. * @param treeNode
  5699. */
  5700. function zTreeOnClick(event, treeId, treeNode) {
  5701. var index = getIndex("bill_item_group");
  5702. if (index == 0) {
  5703. $("#western_medicine_name").val(treeNode.id);
  5704. $('#western_medicine_name').webuiPopover('show');
  5705. loadYpList(0);
  5706. } else if (index == 2) {
  5707. $("#jcJyItem").val(treeNode.id);
  5708. $('#jcJyItem').webuiPopover('show');
  5709. loadjcJyItemList();
  5710. }
  5711. }
  5712. /**
  5713. * 构建处方参数
  5714. * @returns {any}
  5715. */
  5716. function getParamsForpPrescription() {
  5717. var codes = $("#diagnoseValue").val();
  5718. var icdCode = null;
  5719. if (codes != null && codes.length > 0) {
  5720. var arr = codes.split(",");
  5721. if (arr != null) {
  5722. for (i = 0; i < arr.length; i++) {
  5723. if (arr[i] != "") {
  5724. if (icdCode == null) {
  5725. icdCode = arr[i];
  5726. } else {
  5727. icdCode += "," + arr[i];
  5728. }
  5729. }
  5730. }
  5731. }
  5732. }
  5733. var jsonData = JSON.parse('{"patientId": "","firstOrNot":"","icdCode": "","icdText": null,"jzFlag": "0","serialNo":"","mzBlRecord": {"firstOrNot": "","emrChiefComplaint": "","emrHpi": "","emrPs": "","emrPe": "","emrFzjc": null,"emrProcess": null,"emrXyy": "无","emrYypg": "无","emrGnpg": "无","emrJkjy": "","personalHistory": "","familyHistory": "","obstericalHistory": "","weight": "","temperature": "","sphygmus": "","breathe": "","pressureHigh": "","pressureFloor": "","pressureHighLeft": "","pressureFloorLeft": "","tentativeDiagnosis":"","prescriptionDetail":""},"mzChargeDetailList": [],"mzYjReqList": [],"mzZyReq": {"reqDept": "","smallDept": "","admissStatus": ""}}');
  5734. jsonData.patientId = $("#patientId").text();
  5735. jsonData.firstOrNot = $("input[name='firstOrNot']:checked").val();
  5736. jsonData.icdCode = icdCode;
  5737. jsonData.serialNo = $("#mzfzSerialNoInClick").val();
  5738. jsonData.mzBlRecord.firstOrNot = jsonData.firstOrNot;
  5739. jsonData.mzBlRecord.emrChiefComplaint = $("#symptom").val();
  5740. jsonData.mzBlRecord.emrHpi = $("#emrHpi").val();
  5741. jsonData.mzBlRecord.emrPs = $("#emrPs").val();
  5742. jsonData.mzBlRecord.emrPe = $("#otherCheck").val();
  5743. jsonData.mzBlRecord.emrJkjy = $("#healthEducation").val();
  5744. jsonData.mzBlRecord.personalHistory = $("#personalHistory").val();
  5745. jsonData.mzBlRecord.familyHistory = $("#familyHistory").val();
  5746. jsonData.mzBlRecord.obstericalHistory = $("#obstericalHistory").val();
  5747. jsonData.mzBlRecord.weight = $("#weight").val();
  5748. jsonData.mzBlRecord.temperature = $("#temperature").val();
  5749. jsonData.mzBlRecord.sphygmus = $("#sphygmus").val();
  5750. jsonData.mzBlRecord.breathe = $("#breathe").val();
  5751. jsonData.mzBlRecord.pressureHigh = $("#pressure_high").val();
  5752. jsonData.mzBlRecord.pressureFloor = $("#pressure_floor").val();
  5753. jsonData.mzBlRecord.pressureHighLeft = $("#pressure_high_left").val();
  5754. jsonData.mzBlRecord.pressureFloorLeft = $("#pressure_floor_left").val();
  5755. jsonData.mzBlRecord.tentativeDiagnosis = $("#tentativeDiagnosis").val();
  5756. //设置处方详情
  5757. var emrFzjc = null;
  5758. var xyTabContents = $("#xyTabContent").find("div.tab-pane");
  5759. //处方号
  5760. var orderNo = 0;
  5761. var arrs = $("span.cf_amount");
  5762. //西药设置
  5763. if (xyTabContents != null && xyTabContents.length > 0) {
  5764. for (var i = 0; i < xyTabContents.length; i++) {
  5765. //当前药品类型
  5766. var currentGroupNo = $(xyTabContents[i]).find("input.current_groupNo").val();
  5767. var formGroups = $(xyTabContents[i]).find("div.form-group");
  5768. if (formGroups != null && formGroups.length > 0) {
  5769. for (var j = 0; j < formGroups.length; j++) {
  5770. var tempJson = JSON.parse('{"chargeItemCode": "","serial": "","quantity": "","drugQuan": "","drugUnit": "","frequency": "","orderDays": "","paySelf": "0","drugWin": "1","instructionCode":"","instructionText":"","orderNo":"","groupOrder":"","supplyCode":"","cyJssm":"","cyDj":"","cyFysm":"","tryFlag":"0","groupNo":""}');
  5771. tempJson.chargeItemCode = $(formGroups[j]).find("input.temporary_items_code").val();
  5772. tempJson.serial = $(formGroups[j]).find("input.temporary_items_serial").val();
  5773. tempJson.quantity = $(formGroups[j]).find("input.temporary_items_gross").val();
  5774. tempJson.drugQuan = $(formGroups[j]).find("input.temporary_items_drugWin").val();
  5775. tempJson.drugUnit = $(formGroups[j]).find("input.temporary_items_drugWinUnit").val();
  5776. tempJson.frequency = $(formGroups[j]).find("input.temporary_items_orderFrequency").val();
  5777. tempJson.orderDays = $(formGroups[j]).find("input.temporary_items_dayNum").val();
  5778. tempJson.instructionCode = $(formGroups[j]).find("input.temporary_items_medicalAdvice").val();
  5779. tempJson.instructionText = $(formGroups[j]).find("input.temporary_items_medicalAdviceText").val();
  5780. tempJson.supplyCode = $(formGroups[j]).find("input.temporary_items_supplyType").val();
  5781. orderNo = i + 1;
  5782. tempJson.orderNo = orderNo;
  5783. tempJson.groupOrder = $(formGroups[j]).find("input.temporary_items_groupId").val();
  5784. tempJson.groupNo = currentGroupNo;
  5785. var tryFlag = $(formGroups[j]).find("input.temporary_items_tryFlag").val();
  5786. if (tryFlag == true || tryFlag == "true") {
  5787. tempJson.tryFlag = 1;
  5788. }
  5789. jsonData.mzChargeDetailList[jsonData.mzChargeDetailList.length] = tempJson;
  5790. }
  5791. }
  5792. }
  5793. }
  5794. //中草药
  5795. var zyTabContents = $("#zyTabContent").find("div.form-group");
  5796. if (zyTabContents != null && zyTabContents.length > 0) {
  5797. orderNo++;
  5798. var zyfs = $("input.zyfs").val();
  5799. //中药的类型
  5800. var currentZyClassType = $("#current_zyClassType").val();
  5801. for (var i = 0; i < zyTabContents.length; i++) {
  5802. var tempJson = JSON.parse('{"chargeItemCode": "","serial": "","quantity": "","drugQuan": "","drugUnit": "g","frequency": "","orderDays": "1","paySelf": "0","drugWin": "","instructionCode":"","instructionText":"","orderNo":"1","groupOrder":"1","supplyCode":"","cyJssm":"","cyDj":"","cyFysm":"","tryFlag":"0","groupNo":""}');
  5803. tempJson.chargeItemCode = $(zyTabContents[i]).find("input.temporary_items_code").val();
  5804. tempJson.serial = $(zyTabContents[i]).find("input.temporary_items_serial").val();
  5805. tempJson.quantity = $(zyTabContents[i]).find("input.temporary_items_drugWin").val();
  5806. tempJson.drugQuan = $(zyTabContents[i]).find("input.temporary_items_drugWin").val();
  5807. tempJson.drugWin = zyfs;
  5808. tempJson.frequency = $("#zy_orderFrequency_1").val();
  5809. tempJson.instructionCode = $(zyTabContents[i]).find("input.temporary_items_zyInstruction").val();
  5810. tempJson.instructionText = $(zyTabContents[i]).find("input.temporary_items_zyInstructionText").val();
  5811. tempJson.cyFysm = $("#useType_1").val();
  5812. tempJson.cyJssm = $("#cyJssm").val();
  5813. tempJson.cyDj = $("#zy_supplyType_1").val();
  5814. tempJson.orderNo = orderNo;
  5815. tempJson.groupNo = currentZyClassType;
  5816. jsonData.mzChargeDetailList[jsonData.mzChargeDetailList.length] = tempJson;
  5817. }
  5818. }
  5819. //设置诊疗与医技
  5820. var zlTabContents = $("#zlTabContent").find("div.form-group");
  5821. if (zlTabContents != null && zlTabContents.length > 0) {
  5822. orderNo++;
  5823. for (var i = 0; i < zlTabContents.length; i++) {
  5824. if (emrFzjc == null) {
  5825. emrFzjc = $(zlTabContents[i]).text();
  5826. } else {
  5827. emrFzjc += "," + $(zlTabContents[i]).text();
  5828. }
  5829. var tempJson = null;
  5830. //项目类型
  5831. var itemsType = $(zlTabContents[i]).find("input.temporary_items_type").val();
  5832. //执行科室
  5833. var execUnit = $(zlTabContents[i]).find("input.temporary_items_execUnit").val();
  5834. if (itemsType == "3" || itemsType == 3) {
  5835. //诊疗,放入药品类型中入库,因为诊疗是与药品一样直接入明细库,但是是与医技在同一处方开立页面开立
  5836. tempJson = JSON.parse('{"chargeItemCode": "","serial": "","quantity": "1","drugQuan": "1","drugUnit": "","frequency": "","orderDays": "1","paySelf": "0","drugWin": "1","instructionCode":"","instructionText":"","orderNo":"","groupOrder":"","supplyCode":"","cyJssm":"","cyDj":"","cyFysm":"","tryFlag":"0","groupNo":"00","execDept":""}');
  5837. tempJson.chargeItemCode = $(zlTabContents[i]).find("input.temporary_items_code").val();
  5838. tempJson.instructionText = $(zlTabContents[i]).find("input.temporary_items_remark").val();
  5839. tempJson.quantity = $(zlTabContents[i]).find("input.temporary_items_itemQuantity").val();
  5840. tempJson.orderNo = orderNo;
  5841. tempJson.execDept = execUnit;
  5842. jsonData.mzChargeDetailList[jsonData.mzChargeDetailList.length] = tempJson;
  5843. } else {
  5844. tempJson = JSON.parse('{"orderCode":"","inspectPart":"","inspectStuff":"","jyRemark":"","orderNo":"1","execDept":""}');
  5845. tempJson.orderCode = $(zlTabContents[i]).find("input.temporary_items_code").val();
  5846. if (itemsType == "1" || itemsType == 1) {
  5847. //检验
  5848. tempJson.inspectStuff = $(zlTabContents[i]).find("input.temporary_items_desc_value").val();
  5849. } else if (itemsType == "2" || itemsType == 2) {
  5850. //检查
  5851. tempJson.inspectPart = $(zlTabContents[i]).find("input.temporary_items_desc_value").val();
  5852. }
  5853. tempJson.jyRemark = $(zlTabContents[i]).find("input.temporary_items_remark").val();
  5854. tempJson.orderNo = orderNo;
  5855. tempJson.execDept = execUnit;
  5856. jsonData.mzYjReqList[jsonData.mzYjReqList.length] = tempJson;
  5857. }
  5858. }
  5859. }
  5860. //入院
  5861. var zyReqTabContents = $("#zyReqTabContent").find("div.form-group");
  5862. if (zyReqTabContents != null && zyReqTabContents.length > 0) {
  5863. jsonData.mzZyReq.reqDept = $(zyReqTabContents[0]).find("input.temporary_inpatient_ward").val();
  5864. jsonData.mzZyReq.smallDept = $(zyReqTabContents[0]).find("input.temporary_items_small_ward").val();
  5865. jsonData.mzZyReq.admissStatus = $(zyReqTabContents[0]).find("input.temporary_items_admiss_status").val();
  5866. }
  5867. //设置诊断名称
  5868. var icdText = null;
  5869. var tagsTexts = $("span.el-select__tags-text");
  5870. if (tagsTexts != null && tagsTexts.length > 0) {
  5871. for (var i = 0; i < tagsTexts.length; i++) {
  5872. if (icdText == null) {
  5873. icdText = $(tagsTexts[i]).text();
  5874. } else {
  5875. icdText += "," + $(tagsTexts[i]).text();
  5876. }
  5877. }
  5878. }
  5879. jsonData.icdText = icdText;
  5880. jsonData.mzBlRecord.emrFzjc = emrFzjc;
  5881. return jsonData;
  5882. }
  5883. /**
  5884. * 保存处方
  5885. */
  5886. function savePrescription() {
  5887. //关闭帮助框
  5888. $("#treeButton").webuiPopover('hide');
  5889. $("#western_medicine_name").webuiPopover('hide');
  5890. $("#chinese_medicine_name").webuiPopover('hide');
  5891. $("#jcJyItem").webuiPopover('hide');
  5892. $("#messageModal").modal();
  5893. $("#messageContent").html("确认保存处方吗?");
  5894. $("#messageButton").off("click").on("click", function (t) {
  5895. //$("#messageModal").modal("hide");
  5896. var jsonData = getParamsForpPrescription();
  5897. $.ajax({
  5898. type: "POST",
  5899. url: '/thmz/savePrescription',
  5900. contentType: "application/json;charset=UTF-8",
  5901. dataType: "json",
  5902. data: JSON.stringify(jsonData),
  5903. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5904. success: function (res) {
  5905. if (res == '401' || res == 401) {
  5906. window.location.href = '/thmz/login/view'
  5907. return;
  5908. }
  5909. if (res.code == 0) {
  5910. successMesage(res);
  5911. clearWorkSpace();
  5912. loadInClinicTableList();
  5913. loadClinicTableList();
  5914. //$("#messageModal").modal();
  5915. $("#messageContent").html("门诊处方保存成功,是否打印处方和门诊指引单?");
  5916. $("#messageButton").off("click").on("click", function (t) {
  5917. $("#messageModal").modal("hide");
  5918. printPrescription(res.data.patientId, res.data.times, res.data.id, 5, 1);
  5919. });
  5920. $("#cancelButton").off("click");
  5921. } else {
  5922. $("#messageModal").modal("hide");
  5923. errorMesage(res);
  5924. }
  5925. }
  5926. });
  5927. });
  5928. $("#cancelButton").off("click");
  5929. }
  5930. /**
  5931. * 保存医疗范文
  5932. */
  5933. function saveapidAccepts() {
  5934. var templateName = $("#templateName").val();
  5935. if (templateName == null || templateName == "") {
  5936. errorMesageSimaple("范文名称不能为空!");
  5937. return;
  5938. }
  5939. var templateKindType = $("#templateKindType").val();
  5940. if (templateKindType == null || templateKindType == "") {
  5941. errorMesageSimaple("范文类型不能为空!");
  5942. return;
  5943. }
  5944. var templateType = $("#templateType").val();
  5945. if (templateType == null || templateType == "") {
  5946. errorMesageSimaple("范文范围不能为空!");
  5947. return;
  5948. }
  5949. var templateStatus = $("#templateStatus").val();
  5950. if (templateStatus == null || templateStatus == "") {
  5951. errorMesageSimaple("范文状态不能为空!");
  5952. return;
  5953. }
  5954. $("#saveapidAcceptsModal").modal("hide");
  5955. $("#messageModal").modal();
  5956. $("#messageContent").html("确认保存医疗范文吗?");
  5957. $("#messageButton").off("click").on("click", function (t) {
  5958. $("#messageModal").modal("hide");
  5959. var jsonData = getParamsForpPrescription();
  5960. $.ajax({
  5961. type: "POST",
  5962. url: '/thmz/saveTemplate',
  5963. contentType: "application/json;charset=UTF-8",
  5964. dataType: "json",
  5965. data: JSON.stringify({
  5966. "id": $("#templateId").val(),
  5967. "name": templateName,
  5968. "icdText": jsonData.icdText != null ? jsonData.icdText : jsonData.mzBlRecord.tentativeDiagnosis,
  5969. "templateKindType": templateKindType,
  5970. "templateType": templateType,
  5971. "templateStatus": templateStatus,
  5972. "templateData": JSON.stringify(jsonData),
  5973. "emrChiefComplaint": $("#symptom").val(),
  5974. "emrHpi": $("#emrHpi").val(),
  5975. "emrPs": $("#emrPs").val(),
  5976. "icdCode": $("#diagnoseValue").val()
  5977. }),
  5978. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5979. success: function (res) {
  5980. if (res == '401' || res == 401) {
  5981. window.location.href = '/thmz/login/view'
  5982. return;
  5983. }
  5984. if (res.code == 0) {
  5985. successMesage(res);
  5986. //范本保存完不清空
  5987. //clearWorkSpace();
  5988. } else {
  5989. $("#saveapidAcceptsModal").modal();
  5990. errorMesage(res);
  5991. }
  5992. }
  5993. });
  5994. });
  5995. $("#cancelButton").off("click");
  5996. }
  5997. /**
  5998. * 停用医疗范文
  5999. */
  6000. function removeTemplate() {
  6001. $("#messageModal").modal();
  6002. $("#messageContent").html("确认停用医疗范文吗?");
  6003. $("#messageButton").off("click").on("click", function (t) {
  6004. $("#messageModal").modal("hide");
  6005. $.ajax({
  6006. type: "POST",
  6007. url: '/thmz/removeTemplate',
  6008. contentType: "application/json;charset=UTF-8",
  6009. dataType: "json",
  6010. data: JSON.stringify({
  6011. "id": $("#idTemplate").val()
  6012. }),
  6013. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6014. success: function (res) {
  6015. if (res == '401' || res == 401) {
  6016. window.location.href = '/thmz/login/view'
  6017. return;
  6018. }
  6019. if (res.code == 0) {
  6020. successMesage(res);
  6021. $("#medicalModelModal").modal("hide");
  6022. fitTemplateData();
  6023. } else {
  6024. errorMesage(res);
  6025. }
  6026. }
  6027. });
  6028. });
  6029. $("#cancelButton").off("click");
  6030. }
  6031. /**
  6032. * 清空医疗范文模块内容
  6033. */
  6034. function clearApidAcceptsModal() {
  6035. $("#templateId").val(null);
  6036. $("#templateName").val(null);
  6037. $("#templateKindType").selectpicker('val', 0);
  6038. $("#templateKindType").selectpicker('refresh');
  6039. $("#templateType").selectpicker('val', 0);
  6040. $("#templateType").selectpicker('refresh');
  6041. $("#templateStatus").selectpicker('val', 0);
  6042. $("#templateStatus").selectpicker('refresh');
  6043. }
  6044. /**
  6045. * 查询病人未缴费处方信息 加载到处方修改
  6046. * @param patientId
  6047. * @param times
  6048. * @param clnicId 就诊记录id
  6049. */
  6050. function getMzPrescriptionVoUnPaid(patientId, times, clnicId) {
  6051. var currentPatientId = $("#patientId").text();
  6052. //当前接诊的用户和操作接诊的是同一个人,不做任何操作
  6053. if (currentPatientId == patientId) {
  6054. warningMesageSimaple("当前病人正在接诊中,请勿重复操作!");
  6055. return;
  6056. }
  6057. if (currentPatientId == null || currentPatientId == "") {
  6058. //当前没有人接诊,直接接诊
  6059. getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId);
  6060. } else {
  6061. //当前有人在接诊,提示是否需要切换和保存
  6062. $("#messagePrescriptionModal").modal();
  6063. $("#confirmPrescriptionButton").off("click").on("click", function (t) {
  6064. $("#messagePrescriptionModal").modal("hide");
  6065. //先保存目前接诊信息,再切换就诊人
  6066. var jsonData = getParamsForpPrescription();
  6067. $.ajax({
  6068. type: "POST",
  6069. url: '/thmz/savePrescription',
  6070. contentType: "application/json;charset=UTF-8",
  6071. dataType: "json",
  6072. data: JSON.stringify(jsonData),
  6073. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6074. success: function (res) {
  6075. if (res == '401' || res == 401) {
  6076. window.location.href = '/thmz/login/view'
  6077. return;
  6078. }
  6079. if (res.code == 0) {
  6080. loadInClinicTableList();
  6081. loadClinicTableList();
  6082. getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId);
  6083. } else {
  6084. errorMesage(res);
  6085. }
  6086. }
  6087. });
  6088. });
  6089. $("#cancelPrescriptionButton").off("click").on("click", function (t) {
  6090. $("#messagePrescriptionModal").modal("hide");
  6091. getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId);
  6092. });
  6093. }
  6094. }
  6095. /**
  6096. * 查询病人未缴费处方信息 加载到处方修改 通用方法
  6097. * @param patientId
  6098. * @param times
  6099. * @param clnicId 就诊记录id
  6100. */
  6101. function getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId) {
  6102. $.ajax({
  6103. type: "GET",
  6104. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + "&times=" + times + "&MzBlRecordFlag=false&payMark=5&clnicId=null",
  6105. contentType: "application/json;charset=UTF-8",
  6106. dataType: "json",
  6107. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6108. success: function (res) {
  6109. if (res == '401' || res == 401) {
  6110. window.location.href = '/thmz/login/view'
  6111. return;
  6112. }
  6113. if (res.code == 0) {
  6114. clearWorkSpace();
  6115. setMzPatientInfo(res.mzPatientMi);
  6116. editPrescription(res.data, 0)
  6117. //修改患者的时候,将原纪录的就诊记录id带上,并借用分诊流水号字段传参
  6118. $("#mzfzSerialNoInClick").val("clnicId_" + clnicId);
  6119. } else {
  6120. errorMesage(res);
  6121. }
  6122. }
  6123. });
  6124. }
  6125. /**
  6126. * 查询病人已缴费处方信息 调用处方
  6127. * @param patientId
  6128. * @param times
  6129. * @param clnicId 就诊记录id
  6130. */
  6131. function getMzPrescriptionVoPaid(patientId, times, clnicId) {
  6132. $("#visitingDetailModal").modal("hide");
  6133. $("#messageModal").modal();
  6134. $("#messageContent").html("确认调用选中处方吗?将会覆盖当前处方。");
  6135. $("#messageButton").off("click").on("click", function (t) {
  6136. $("#messageModal").modal("hide");
  6137. $.ajax({
  6138. type: "GET",
  6139. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + "&times=" + times + "&MzBlRecordFlag=false&payMark=0&clnicId=null",
  6140. contentType: "application/json;charset=UTF-8",
  6141. dataType: "json",
  6142. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6143. success: function (res) {
  6144. if (res == '401' || res == 401) {
  6145. window.location.href = '/thmz/login/view'
  6146. return;
  6147. }
  6148. if (res.code == 0) {
  6149. var mzfzSerialNoInClick = $("#mzfzSerialNoInClick").val();
  6150. clearUser(false);
  6151. clearWorkSpaceExcludeUser();
  6152. setMzPatientInfo(res.mzPatientMi);
  6153. editPrescription(res.data, 2)
  6154. $("#mzfzSerialNoInClick").val(mzfzSerialNoInClick);
  6155. } else {
  6156. errorMesage(res);
  6157. }
  6158. }
  6159. });
  6160. });
  6161. $("#cancelButton").off("click");
  6162. }
  6163. /**
  6164. * 重复接诊
  6165. * @param patientId
  6166. * @param times
  6167. * @param clnicId
  6168. * @param deptCode 就诊科室编码
  6169. */
  6170. function repeatAccepts(patientId, times, clnicId, deptCode) {
  6171. $.ajax({
  6172. type: "GET",
  6173. url: '/thmz/validMzyReqrec?patientId=' + patientId + "&deptCode=" + deptCode,
  6174. contentType: "application/json;charset=UTF-8",
  6175. dataType: "json",
  6176. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6177. success: function (res) {
  6178. if (res == '401' || res == 401) {
  6179. window.location.href = '/thmz/login/view'
  6180. return;
  6181. }
  6182. if (res.code == 0) {
  6183. if (res.data == 0) {
  6184. $("#messageModal").modal();
  6185. $("#messageContent").html("挂号失效,确定继续就诊?");
  6186. $("#messageButton").off("click").on("click", function (t) {
  6187. $("#messageModal").modal("hide");
  6188. repeatAcceptsConfirm(patientId, times, clnicId);
  6189. });
  6190. $("#cancelButton").off("click");
  6191. return;
  6192. }
  6193. repeatAcceptsConfirm(patientId, times, clnicId);
  6194. } else {
  6195. errorMesage(res);
  6196. }
  6197. }
  6198. });
  6199. }
  6200. /**
  6201. * 重复接诊提示方法
  6202. * @param patientId
  6203. * @param times
  6204. * @param clnicId
  6205. */
  6206. function repeatAcceptsConfirm(patientId, times, clnicId) {
  6207. var currentPatientId = $("#patientId").text();
  6208. //当前接诊的用户和操作接诊的是同一个人,不做任何操作
  6209. if (currentPatientId == patientId) {
  6210. return;
  6211. }
  6212. if (currentPatientId == null || currentPatientId == "") {
  6213. //当前没有人接诊,直接接诊
  6214. repeatAcceptsCommon(patientId, times, clnicId);
  6215. } else {
  6216. //当前有人在接诊,提示是否需要切换和保存
  6217. $("#messagePrescriptionModal").modal();
  6218. $("#confirmPrescriptionButton").off("click").on("click", function (t) {
  6219. $("#messagePrescriptionModal").modal("hide");
  6220. //先保存目前接诊信息,再切换就诊人
  6221. var jsonData = getParamsForpPrescription();
  6222. $.ajax({
  6223. type: "POST",
  6224. url: '/thmz/savePrescription',
  6225. contentType: "application/json;charset=UTF-8",
  6226. dataType: "json",
  6227. data: JSON.stringify(jsonData),
  6228. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6229. success: function (res) {
  6230. if (res == '401' || res == 401) {
  6231. window.location.href = '/thmz/login/view'
  6232. return;
  6233. }
  6234. if (res.code == 0) {
  6235. repeatAcceptsCommon(patientId, times, clnicId);
  6236. //加载已接诊患者列表
  6237. loadClinicTableList();
  6238. } else {
  6239. errorMesage(res);
  6240. }
  6241. }
  6242. });
  6243. });
  6244. $("#cancelPrescriptionButton").off("click").on("click", function (t) {
  6245. $("#messagePrescriptionModal").modal("hide");
  6246. repeatAcceptsCommon(patientId, times, clnicId);
  6247. });
  6248. }
  6249. }
  6250. /**
  6251. * 重复接诊通用方法
  6252. * @param patientId
  6253. * @param times
  6254. * @param clnicId
  6255. */
  6256. function repeatAcceptsCommon(patientId, times, clnicId) {
  6257. $.ajax({
  6258. type: "GET",
  6259. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + "&times=" + times + "&MzBlRecordFlag=true&payMark=null&clnicId=null",
  6260. contentType: "application/json;charset=UTF-8",
  6261. dataType: "json",
  6262. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6263. success: function (res) {
  6264. if (res == '401' || res == 401) {
  6265. window.location.href = '/thmz/login/view'
  6266. return;
  6267. }
  6268. if (res.code == 0) {
  6269. clearWorkSpace();
  6270. setMzPatientInfo(res.mzPatientMi);
  6271. editPrescription(res.data, 0)
  6272. //修改患者的时候,将原纪录的就诊记录id带上,并借用分诊流水号字段传参
  6273. $("#mzfzSerialNoInClick").val("clnicId_" + clnicId);
  6274. } else {
  6275. errorMesage(res);
  6276. }
  6277. }
  6278. });
  6279. }
  6280. /**
  6281. * 就诊详情 已诊患者列表发起
  6282. * @param patientId
  6283. * @param times
  6284. * @param clnicId
  6285. * @param payMark
  6286. */
  6287. function prescriptionDetail(patientId, times, clnicId, payMark) {
  6288. prescriptionDetailCommon(patientId, times, clnicId, payMark, 0);
  6289. }
  6290. /**
  6291. * 就诊详情 历史轨迹发起
  6292. * @param patientId
  6293. * @param times
  6294. * @param clnicId
  6295. * @param clinicStatus
  6296. */
  6297. function visitingDetailModal(patientId, times, clnicId, clinicStatus) {
  6298. var payMark = null;
  6299. if (clinicStatus == 5) {
  6300. payMark = 5;
  6301. } else {
  6302. payMark = 0;
  6303. }
  6304. prescriptionDetailCommon(patientId, times, clnicId, payMark, 1);
  6305. }
  6306. /**
  6307. * 就诊详情通用方法
  6308. * @param patientId
  6309. * @param times
  6310. * @param clnicId
  6311. * @param payMark
  6312. * @param type 0 已诊患者列表发起 1 历史轨迹发起
  6313. */
  6314. function prescriptionDetailCommon(patientId, times, clnicId, payMark, type) {
  6315. $('#baseMzBlTimes').val(null);
  6316. var oriPayMark = payMark;
  6317. if (payMark == 1) {
  6318. //退费时,查看的明细还是处方开立的情况
  6319. payMark = 0;
  6320. }
  6321. $.ajax({
  6322. type: "GET",
  6323. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + '&times=' + times + '&MzBlRecordFlag=false&payMark=' + payMark + '&clnicId=' + clnicId,
  6324. contentType: "application/json;charset=UTF-8",
  6325. dataType: "json",
  6326. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6327. success: function (res) {
  6328. if (res == '401' || res == 401) {
  6329. window.location.href = '/thmz/login/view'
  6330. return;
  6331. }
  6332. if (res.code == 0) {
  6333. $("#visitingDetailModal").modal();
  6334. var jsonData = res.data;
  6335. var mzPatientMi = res.mzPatientMi;
  6336. $("#visitingDetailPatientName").text(mzPatientMi.name);
  6337. $("#visitingDetailPatientAge").text(mzPatientMi.age);
  6338. $("#visitingDetailPatientGender").val(mzPatientMi.gender);
  6339. $("#prescriptionDetail_zd").html("");
  6340. $("#prescriptionDetail_xyzlContent").html("");
  6341. $("#prescriptionDetail_zyzlContent").html("");
  6342. $("#prescriptionDetail_zlyjContent").html("");
  6343. if (res.opDate != null) {
  6344. $("#visitingDetailDate").text(res.opDate);
  6345. }
  6346. if (res.deptName != null) {
  6347. $("#visitingDetailDept").text(res.deptName);
  6348. }
  6349. if (res.doctorName != null) {
  6350. $("#visitingDetailDoctor").text(res.doctorName);
  6351. }
  6352. var firstOrNot = jsonData.mzBlRecord.firstOrNot;
  6353. if (firstOrNot == 0) {
  6354. $("#visitFlag").html("初诊");
  6355. $("#first").next().click();
  6356. } else if (firstOrNot == 1) {
  6357. $("#visitFlag").html("复诊");
  6358. $("#not").next().click();
  6359. }
  6360. if (oriPayMark == 0) {
  6361. $("#chargeImage").attr("src", "/thmz/images/charge.png");
  6362. } else if (oriPayMark == 1) {
  6363. $("#chargeImage").attr("src", "/thmz/images/refund.png");
  6364. } else if (oriPayMark == 5) {
  6365. $("#chargeImage").attr("src", "/thmz/images/nocharge.png");
  6366. }
  6367. var icdText = jsonData.icdText;
  6368. if (icdText != null) {
  6369. var arr = icdText.split(",");
  6370. var html = "";
  6371. for (var i = 0; i < arr.length; i++) {
  6372. if (i == 0) {
  6373. html += ' <div class="tagZdy tagZdy-back">';
  6374. } else {
  6375. html += ' <div class="tagZdy tagZdy-back-green">';
  6376. }
  6377. html += arr[i];
  6378. html += '</div>';
  6379. }
  6380. $("#prescriptionDetail_zd").html(html);
  6381. } else {
  6382. $("#prescriptionDetail_zd").html(jsonData.mzBlRecord.tentativeDiagnosis);
  6383. }
  6384. var emrProcess = jsonData.mzBlRecord.emrProcess;
  6385. if (emrProcess != null) {
  6386. var xy = null;
  6387. if (emrProcess.indexOf("西药治疗:") >= 0) {
  6388. if (emrProcess.indexOf("中药治疗:") >= 0) {
  6389. xy = emrProcess.substring(emrProcess.indexOf("西药治疗:") + 5, emrProcess.indexOf("中药治疗:"));
  6390. } else if (emrProcess.indexOf("医技与诊疗:") >= 0) {
  6391. xy = emrProcess.substring(emrProcess.indexOf("西药治疗:") + 5, emrProcess.indexOf("医技与诊疗:"));
  6392. } else if (emrProcess.indexOf("入院处理:") >= 0) {
  6393. xy = emrProcess.substring(emrProcess.indexOf("西药治疗:") + 5, emrProcess.indexOf("入院处理:"));
  6394. } else {
  6395. xy = emrProcess.substring(emrProcess.indexOf("西药治疗:") + 5);
  6396. }
  6397. var arr = xy.split("_");
  6398. if (arr != null && arr.length > 0) {
  6399. var xyhtml = "";
  6400. for (var i = 0; i < arr.length; i++) {
  6401. xyhtml += "<div style='margin-bottom: 5px;padding-left: 10px;'>";
  6402. xyhtml += arr[i];
  6403. xyhtml += "</div>";
  6404. }
  6405. $("#prescriptionDetail_xyzlContent").html(xyhtml);
  6406. $("#prescriptionDetail_xyzlTitle").removeClass("hide").addClass("in");
  6407. } else {
  6408. $("#prescriptionDetail_xyzlTitle").removeClass("in").addClass("hide");
  6409. }
  6410. } else {
  6411. $("#prescriptionDetail_xyzlTitle").removeClass("in").addClass("hide");
  6412. }
  6413. var zy = null;
  6414. if (emrProcess.indexOf("中药治疗:") >= 0) {
  6415. if (emrProcess.indexOf("医技与诊疗:") >= 0) {
  6416. zy = emrProcess.substring(emrProcess.indexOf("中药治疗:") + 5, emrProcess.indexOf("医技与诊疗:"));
  6417. } else if (emrProcess.indexOf("入院处理:") >= 0) {
  6418. zy = emrProcess.substring(emrProcess.indexOf("中药治疗:") + 5, emrProcess.indexOf("入院处理:"));
  6419. } else {
  6420. zy = emrProcess.substring(emrProcess.indexOf("中药治疗:") + 5);
  6421. }
  6422. var zyArr = zy.split("_");
  6423. if (zyArr != null && zyArr.length > 0) {
  6424. var zyhtml = "";
  6425. for (var i = 1; i < zyArr.length; i++) {
  6426. if (i % 4 == 1) {
  6427. zyhtml += '<div class="item form-group" style="margin-bottom: -5px;">';
  6428. }
  6429. zyhtml += '<div class="col-md-3 col-sm-3 col-xs-12">';
  6430. zyhtml += zyArr[i];
  6431. zyhtml += "</div>";
  6432. if (i % 4 == 0) {
  6433. zyhtml += '</div>';
  6434. }
  6435. }
  6436. var zyfs = zyArr[0].substring(zyArr[0].indexOf("付数:") + 3);
  6437. if (zyfs != null && zyfs != "") {
  6438. if (zyArr.length % 4 == 1) {
  6439. zyhtml += '<div class="item form-group" style="margin-bottom: -5px;">';
  6440. }
  6441. zyhtml += '<div class="col-md-3 col-sm-3 col-xs-12">';
  6442. zyhtml += ' <div style="text-indent: 2em;">';
  6443. zyhtml += ' <div>';
  6444. zyhtml += 'X<span>';
  6445. zyhtml += zyfs;
  6446. zyhtml += '</span> 付</div></div>';
  6447. zyhtml += '</div>';
  6448. }
  6449. $("#prescriptionDetail_zyzlContent").html(zyhtml);
  6450. $("#prescriptionDetail_zyzlTitle").removeClass("hide").addClass("in");
  6451. } else {
  6452. $("#prescriptionDetail_zyzlTitle").removeClass("in").addClass("hide");
  6453. }
  6454. } else {
  6455. $("#prescriptionDetail_zyzlTitle").removeClass("in").addClass("hide");
  6456. }
  6457. if (emrProcess.indexOf("医技与诊疗:") >= 0) {
  6458. var zlyj = null;
  6459. if (emrProcess.indexOf("入院处理:") >= 0) {
  6460. zlyj = emrProcess.substring(emrProcess.indexOf("医技与诊疗:") + 6, emrProcess.indexOf("入院处理:"));
  6461. } else {
  6462. zlyj = emrProcess.substring(emrProcess.indexOf("医技与诊疗:") + 6);
  6463. }
  6464. var zlyjArr = zlyj.split("_");
  6465. if (zlyjArr != null && zlyjArr.length > 0) {
  6466. var zlyjhtml = "";
  6467. for (var i = 0; i < zlyjArr.length; i++) {
  6468. zlyjhtml += "<div style='margin-bottom: 5px;padding-left: 10px;'>";
  6469. zlyjhtml += zlyjArr[i];
  6470. zlyjhtml += "</div>";
  6471. }
  6472. $("#prescriptionDetail_zlyjContent").html(zlyjhtml);
  6473. $("#prescriptionDetail_zlyjTitle").removeClass("hide").addClass("in");
  6474. } else {
  6475. $("#prescriptionDetail_zlyjTitle").removeClass("in").addClass("hide");
  6476. }
  6477. } else {
  6478. $("#prescriptionDetail_zlyjTitle").removeClass("in").addClass("hide");
  6479. }
  6480. if (emrProcess.indexOf("入院处理:") >= 0) {
  6481. var zyReq = emrProcess.substring(emrProcess.indexOf("入院处理:") + 5);
  6482. if (zyReq != null && zyReq != "") {
  6483. var zyReqhtml = "<div style='margin-bottom: 5px;padding-left: 10px;'>";
  6484. zyReqhtml += zyReq;
  6485. zyReqhtml += "</div>";
  6486. $("#prescriptionDetail_zyReqContent").html(zyReqhtml);
  6487. $("#prescriptionDetail_zyReqTitle").removeClass("hide").addClass("in");
  6488. } else {
  6489. $("#prescriptionDetail_zyReqTitle").removeClass("in").addClass("hide");
  6490. }
  6491. } else {
  6492. $("#prescriptionDetail_zyReqTitle").removeClass("in").addClass("hide");
  6493. }
  6494. }
  6495. $("#printJcReq").removeClass("in").addClass("hide");
  6496. $("#printJcReq").off("click");
  6497. $("#printJyReq").removeClass("in").addClass("hide");
  6498. $("#printJyReq").off("click");
  6499. $("#printJcReqSetup").removeClass("in").addClass("hide");
  6500. $("#printJcReqSetup").off("click");
  6501. $("#printJyReqSetup").removeClass("in").addClass("hide");
  6502. $("#printJyReqSetup").off("click");
  6503. $("#previewYjReq").removeClass("in").addClass("hide");
  6504. $("#previewYjReq").off("click");
  6505. $("#previewYjReqAll").removeClass("in").addClass("hide");
  6506. $("#previewYjReqAll").off("click");
  6507. if (jsonData.mzYjReqList != null && jsonData.mzYjReqList.length > 0) {
  6508. $("#previewYjReq").removeClass("hide").addClass("in");
  6509. $("#previewYjReq").off("click").on("click", function (t) {
  6510. previewYjReq(patientId, times);
  6511. });
  6512. }
  6513. if (res.yjReqCount != null && res.yjReqCount > 0) {
  6514. $("#previewYjReqAll").removeClass("hide").addClass("in");
  6515. $("#previewYjReqAll").off("click").on("click", function (t) {
  6516. previewYjReqAll(patientId);
  6517. });
  6518. }
  6519. if (type == 0) {
  6520. $("#callPrescription").removeClass("in").addClass("hide");
  6521. if ((jsonData.mzChargeDetailList == null || jsonData.mzChargeDetailList.length == 0) && (jsonData.mzYjReqList == null || jsonData.mzYjReqList.length == 0)) {
  6522. $("#printPrescription").removeClass("in").addClass("hide");
  6523. $("#printPrescriptionSetup").removeClass("in").addClass("hide");
  6524. } else {
  6525. $("#printPrescription").removeClass("hide").addClass("in");
  6526. $("#printPrescription").off("click").on("click", function (t) {
  6527. printPrescription(patientId, times, clnicId, payMark, 1);
  6528. });
  6529. $("#printPrescriptionSetup").removeClass("hide").addClass("in");
  6530. $("#printPrescriptionSetup").off("click").on("click", function (t) {
  6531. printPrescription(patientId, times, clnicId, payMark, 2);
  6532. });
  6533. }
  6534. if (jsonData.mzYjReqList != null && jsonData.mzYjReqList.length > 0) {
  6535. var hadJc = false;
  6536. var hadJy = false;
  6537. for (var i = 0; i < jsonData.mzYjReqList.length; i++) {
  6538. var mzYjReq = jsonData.mzYjReqList[i];
  6539. if (mzYjReq.reqType == 2) {
  6540. hadJy = true;
  6541. } else if (mzYjReq.reqType == 3) {
  6542. hadJc = true;
  6543. }
  6544. }
  6545. if (hadJc) {
  6546. $("#printJcReq").removeClass("hide").addClass("in");
  6547. $("#printJcReq").off("click").on("click", function (t) {
  6548. printYjReq(patientId, times, 3, 1);
  6549. });
  6550. $("#printJcReqSetup").removeClass("hide").addClass("in");
  6551. $("#printJcReqSetup").off("click").on("click", function (t) {
  6552. printYjReq(patientId, times, 3, 2);
  6553. });
  6554. }
  6555. if (hadJy) {
  6556. $("#printJyReq").removeClass("hide").addClass("in");
  6557. $("#printJyReq").off("click").on("click", function (t) {
  6558. printYjReq(patientId, times, 2, 1);
  6559. });
  6560. $("#printJyReqSetup").removeClass("hide").addClass("in");
  6561. $("#printJyReqSetup").off("click").on("click", function (t) {
  6562. printYjReq(patientId, times, 2, 2);
  6563. });
  6564. }
  6565. }
  6566. // $("#printBlRecord").removeClass("hide").addClass("in");
  6567. // $("#printBlRecord").off("click").on("click", function (t) {
  6568. // printBlRecord(patientId, times, 1);
  6569. // });
  6570. // $("#printBlRecordSetup").removeClass("hide").addClass("in");
  6571. // $("#printBlRecordSetup").off("click").on("click", function (t) {
  6572. // printBlRecord(patientId, times, 2);
  6573. // });
  6574. // $("#showMzBlRecordModal").removeClass("hide").addClass("in");
  6575. // $("#showMzBlRecordModal").off("click").on("click", function (t) {
  6576. // showMzBlRecordModal(patientId, times, 1);
  6577. // });
  6578. if (jsonData.mzZyReq == null || jsonData.mzZyReq.reqDept == null || jsonData.mzZyReq.reqDept == "") {
  6579. $("#printZyReq").removeClass("in").addClass("hide");
  6580. $("#printZyReq").off("click");
  6581. $("#printZyReqSetup").removeClass("in").addClass("hide");
  6582. $("#printZyReqSetup").off("click");
  6583. } else {
  6584. $("#printZyReq").removeClass("hide").addClass("in");
  6585. $("#printZyReq").off("click").on("click", function (t) {
  6586. printZyReq(patientId, 1);
  6587. });
  6588. $("#printZyReqSetup").removeClass("hide").addClass("in");
  6589. $("#printZyReqSetup").off("click").on("click", function (t) {
  6590. printZyReq(patientId, 2);
  6591. });
  6592. }
  6593. } else {
  6594. $("#printPrescription").removeClass("in").addClass("hide");
  6595. $("#printZyReq").removeClass("in").addClass("hide");
  6596. $("#printBlRecord").removeClass("in").addClass("hide");
  6597. $("#printJcReq").removeClass("in").addClass("hide");
  6598. $("#printJyReq").removeClass("in").addClass("hide");
  6599. $("#callPrescription").removeClass("hide").addClass("in");
  6600. $("#callPrescription").off("click").on("click", function (t) {
  6601. getMzPrescriptionVoPaid(patientId, times, clnicId);
  6602. });
  6603. }
  6604. if (oriPayMark == 1) {
  6605. $("#printPrescription").removeClass("in").addClass("hide");
  6606. $("#printPrescriptionSetup").removeClass("in").addClass("hide");
  6607. } else {
  6608. if ((jsonData.mzChargeDetailList == null || jsonData.mzChargeDetailList.length == 0) && (jsonData.mzYjReqList == null || jsonData.mzYjReqList.length == 0)) {
  6609. $("#printPrescription").removeClass("in").addClass("hide");
  6610. $("#printPrescriptionSetup").removeClass("in").addClass("hide");
  6611. } else {
  6612. $("#printPrescription").removeClass("hide").addClass("in");
  6613. $("#printPrescription").off("click").on("click", function (t) {
  6614. printPrescription(patientId, times, clnicId, payMark, 1);
  6615. });
  6616. $("#printPrescriptionSetup").removeClass("hide").addClass("in");
  6617. $("#printPrescriptionSetup").off("click").on("click", function (t) {
  6618. printPrescription(patientId, times, clnicId, payMark, 2);
  6619. });
  6620. }
  6621. }
  6622. $("#printBlRecord").removeClass("hide").addClass("in");
  6623. $("#printBlRecord").off("click").on("click", function (t) {
  6624. printBlRecord(patientId, times, 1);
  6625. });
  6626. $("#printBlRecordSetup").removeClass("hide").addClass("in");
  6627. $("#printBlRecordSetup").off("click").on("click", function (t) {
  6628. printBlRecord(patientId, times, 2);
  6629. });
  6630. $("#showMzBlRecordModal").removeClass("hide").addClass("in");
  6631. $("#showMzBlRecordModal").off("click").on("click", function (t) {
  6632. showMzBlRecordModal(patientId, times, 1);
  6633. });
  6634. if ($("#setupId").hasClass("fa-chevron-up")) {
  6635. //默认不展开打印设置
  6636. $("#setupId").parent().click();
  6637. }
  6638. // setTimeout(function () {
  6639. // if ($("#setupId").hasClass("fa-chevron-up")) {
  6640. // //默认不展开打印设置
  6641. // $("#setupId").parent().click();
  6642. // }
  6643. // }, 400);
  6644. } else {
  6645. errorMesage(res);
  6646. }
  6647. }
  6648. });
  6649. }
  6650. /**
  6651. * 查询默认打印机
  6652. */
  6653. function setPrint() {
  6654. if (printIndex >= 0) {
  6655. return;
  6656. }
  6657. $.ajax({
  6658. type: "GET",
  6659. url: '/thmz/getLastWindowsByCurrentUser',
  6660. contentType: "application/json;charset=UTF-8",
  6661. dataType: "json",
  6662. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6663. async: false,
  6664. success: function (res) {
  6665. if (res == '401' || res == 401) {
  6666. window.location.href = '/thmz/login/view'
  6667. return;
  6668. }
  6669. if (res.code == 0) {
  6670. printIndex = res.data.cgPrintIndex;
  6671. } else {
  6672. printIndex = -1;
  6673. }
  6674. }
  6675. });
  6676. }
  6677. function setTableHtml(prescriptionDetail) {
  6678. var html = "";
  6679. for (var j = 0; j < prescriptionDetail.length; j++) {
  6680. html += "<tr><td>";
  6681. html += prescriptionDetail[j].substring(0, prescriptionDetail[j].indexOf("用法"));
  6682. html += "</td></tr>";
  6683. html += "<tr><td>";
  6684. html += prescriptionDetail[j].substring(prescriptionDetail[j].indexOf("用法"));
  6685. html += "</td></tr>";
  6686. }
  6687. html += "<tr><td>&nbsp;&nbsp;&nbsp;&nbsp;------(以下空白)------</td></tr>";
  6688. return {html: html, j: j};
  6689. }
  6690. // /**
  6691. // * 打印门诊指引单
  6692. // * @param patientId
  6693. // * @param times
  6694. // */
  6695. // function printGuideCard(patientId, times) {
  6696. //
  6697. // }
  6698. /**
  6699. * 打印门诊处方
  6700. * @param patientId
  6701. * @param times
  6702. * @param clnicId
  6703. * @param payMark
  6704. * @param printType 打印模式 1 预览打印 2 打印设置
  6705. */
  6706. function printPrescription(patientId, times, clnicId, payMark, printType) {
  6707. $.ajax({
  6708. type: "GET",
  6709. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + '&times=' + times + '&MzBlRecordFlag=false&payMark=' + payMark + '&clnicId=' + clnicId,
  6710. contentType: "application/json;charset=UTF-8",
  6711. dataType: "json",
  6712. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6713. success: function (res) {
  6714. if (res == '401' || res == 401) {
  6715. window.location.href = '/thmz/login/view'
  6716. return;
  6717. }
  6718. if (res.code == 0) {
  6719. var prescriptionDetail = res.data.mzBlRecord.prescriptionDetail;
  6720. if (prescriptionDetail != null && prescriptionDetail != "") {
  6721. var prescriptionDetailJson = JSON.parse(prescriptionDetail);
  6722. //当前处方只开了住院证则只打印住院证
  6723. if (prescriptionDetailJson.xyPrescription.jePrescription.length == 0 && prescriptionDetailJson.xyPrescription.mjPrescription.length == 0 && prescriptionDetailJson.xyPrescription.pyPrescription.length == 0 && prescriptionDetailJson.xyPrescription.ycPrescription.length == 0 && prescriptionDetailJson.zlPrescription.length == 0 && prescriptionDetailJson.zyPrescription.length == 0 && prescriptionDetailJson.zyReqPrescription.length > 0) {
  6724. printZyReq(patientId, 1);
  6725. return;
  6726. }
  6727. var index = 0;
  6728. setPrint();
  6729. LODOP = getLodop();
  6730. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院处方笺");
  6731. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  6732. //设置默认打印机
  6733. LODOP.SET_PRINTER_INDEX(printIndex);
  6734. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  6735. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  6736. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  6737. //LODOP.SET_SHOW_MODE("SETUP_ENABLESS",getCheckSS());
  6738. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊处方笺");//对新建的纸张重命名
  6739. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  6740. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  6741. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  6742. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  6743. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  6744. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  6745. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  6746. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  6747. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  6748. var mzPatientMi = res.mzPatientMi;
  6749. $("#patientNamePrescription").text(mzPatientMi.name);
  6750. $("#patientGenderPrescription").text(mzPatientMi.gender);
  6751. $("#patientAgePrescription").text(mzPatientMi.age);
  6752. $("#patientIdPrescription").text(mzPatientMi.patientId);
  6753. $("#deptPrescription").text(res.deptName);
  6754. $("#doctorPrescription").text(res.doctorName);
  6755. $("#cfTime").text(res.opDate);
  6756. $("#socialNo").text(mzPatientMi.socialNo);
  6757. $("#zdPrescription").text(res.data.icdText);
  6758. $("#patientIdGuideCard").text(mzPatientMi.patientId);
  6759. $("#patientNameGuideCard").text(mzPatientMi.name);
  6760. $("#patientDateGuideCard").text(format(new Date(), "yyyy-MM-dd"));
  6761. //普药处方
  6762. var pyPrescription = prescriptionDetailJson.xyPrescription.pyPrescription;
  6763. if (pyPrescription != null && pyPrescription.length > 0) {
  6764. for (var i = 0; i < pyPrescription.length; i++) {
  6765. if (index > 0) {
  6766. LODOP.NewPageA();
  6767. }
  6768. var prescriptionDetail = pyPrescription[i].detail;
  6769. var __ret = setTableHtml(prescriptionDetail);
  6770. var html = __ret.html;
  6771. var j = __ret.j;
  6772. if (res.deptName != undefined && res.deptName != null) {
  6773. if (res.deptName.indexOf("儿") > 0) {
  6774. $("#typePrescription").text("儿科");
  6775. $("#cfTitle").text("儿科");
  6776. } else if (res.deptName.indexOf("急诊科") > 0) {
  6777. $("#typePrescription").text("急诊");
  6778. $("#cfTitle").text("急诊");
  6779. } else {
  6780. $("#typePrescription").text("普通处方");
  6781. $("#cfTitle").text("普通");
  6782. }
  6783. }
  6784. $("#prescriptionDetail").html(html);
  6785. $("#cfAmountPrint").text(pyPrescription[i].amount + "元 (不含注射费)");
  6786. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  6787. index++;
  6788. }
  6789. }
  6790. //医材处方
  6791. var ycPrescription = prescriptionDetailJson.xyPrescription.ycPrescription;
  6792. if (ycPrescription != null && ycPrescription.length > 0) {
  6793. for (var i = 0; i < ycPrescription.length; i++) {
  6794. if (index > 0) {
  6795. LODOP.NewPageA();
  6796. }
  6797. var prescriptionDetail = ycPrescription[i].detail;
  6798. var __ret = setTableHtml(prescriptionDetail);
  6799. var html = __ret.html;
  6800. var j = __ret.j;
  6801. if (res.deptName != undefined && res.deptName != null) {
  6802. if (res.deptName.indexOf("儿") > 0) {
  6803. $("#typePrescription").text("儿科");
  6804. $("#cfTitle").text("儿科");
  6805. } else if (res.deptName.indexOf("急诊科") > 0) {
  6806. $("#typePrescription").text("急诊");
  6807. $("#cfTitle").text("急诊");
  6808. } else {
  6809. $("#typePrescription").text("医材处方");
  6810. $("#cfTitle").text("普通");
  6811. }
  6812. }
  6813. $("#prescriptionDetail").html(html);
  6814. $("#cfAmountPrint").text(ycPrescription[i].amount + "元 ");
  6815. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  6816. index++;
  6817. }
  6818. }
  6819. //麻精处方
  6820. var mjPrescription = prescriptionDetailJson.xyPrescription.mjPrescription;
  6821. if (mjPrescription != null && mjPrescription.length > 0) {
  6822. for (var i = 0; i < mjPrescription.length; i++) {
  6823. if (index > 0) {
  6824. LODOP.NewPageA();
  6825. }
  6826. var prescriptionDetail = mjPrescription[i].detail;
  6827. var __ret = setTableHtml(prescriptionDetail);
  6828. var html = __ret.html;
  6829. var j = __ret.j;
  6830. $("#typePrescription").text("麻、精一处方");
  6831. $("#cfTitle").text("麻、精一");
  6832. $("#prescriptionDetail").html(html);
  6833. $("#cfAmountPrint").text(mjPrescription[i].amount + "元 (不含注射费)");
  6834. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  6835. index++;
  6836. }
  6837. }
  6838. //精二处方
  6839. var jePrescription = prescriptionDetailJson.xyPrescription.jePrescription;
  6840. if (jePrescription != null && jePrescription.length > 0) {
  6841. for (var i = 0; i < jePrescription.length; i++) {
  6842. if (index > 0) {
  6843. LODOP.NewPageA();
  6844. }
  6845. var prescriptionDetail = jePrescription[i].detail;
  6846. var __ret = setTableHtml(prescriptionDetail);
  6847. var html = __ret.html;
  6848. var j = __ret.j;
  6849. $("#typePrescription").text("精二处方");
  6850. $("#cfTitle").text("精二");
  6851. $("#prescriptionDetail").html(html);
  6852. $("#cfAmountPrint").text(jePrescription[i].amount + "元 (不含注射费)");
  6853. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  6854. index++;
  6855. }
  6856. }
  6857. //中药处方
  6858. if (prescriptionDetailJson.zyPrescription != null && prescriptionDetailJson.zyPrescription.length > 0) {
  6859. var zyPrescription = prescriptionDetailJson.zyPrescription[0].detail;
  6860. if (zyPrescription != null && zyPrescription.length > 0) {
  6861. var html = "";
  6862. for (var i = 0; i < zyPrescription.length; i++) {
  6863. if (i % 3 == 0) {
  6864. html += "<tr>";
  6865. }
  6866. html += "<td>";
  6867. html += zyPrescription[i].trim();
  6868. if (i % 3 == 2) {
  6869. html += "</td></tr>";
  6870. } else {
  6871. html += "</td>";
  6872. }
  6873. }
  6874. if (zyPrescription.length % 3 != 0) {
  6875. html += "</tr>";
  6876. }
  6877. html += "<tr><td>X " + prescriptionDetailJson.zyPrescription[0].zyfs + "付</td>";
  6878. var colNum = 1;
  6879. var frequency = prescriptionDetailJson.zyPrescription[0].frequency;
  6880. if (frequency != null && frequency != "") {
  6881. html += "<td>频率:" + frequency + "</td>";
  6882. colNum++;
  6883. }
  6884. var cyJssm = prescriptionDetailJson.zyPrescription[0].cyJssm;
  6885. if (cyJssm != null && cyJssm != "") {
  6886. html += "<td>加水说明:" + cyJssm + "</td>";
  6887. colNum++;
  6888. if (colNum % 3 == 0) {
  6889. html += "</tr>";
  6890. }
  6891. }
  6892. var cyFysm = prescriptionDetailJson.zyPrescription[0].cyFysm;
  6893. if (cyFysm != null && cyFysm != "") {
  6894. colNum++;
  6895. if (colNum % 3 == 1) {
  6896. html += "<tr>";
  6897. }
  6898. html += "<td>服用说明:" + cyFysm + "</td>";
  6899. if (colNum % 3 == 0) {
  6900. html += "</tr>";
  6901. }
  6902. }
  6903. var cyDj = prescriptionDetailJson.zyPrescription[0].cyDj;
  6904. if (cyDj != null && cyDj != "") {
  6905. colNum++;
  6906. if (colNum % 3 == 1) {
  6907. html += "<tr>";
  6908. }
  6909. html += "<td>" + cyDj + "</td>";
  6910. if (colNum % 3 == 0) {
  6911. html += "</tr>";
  6912. }
  6913. }
  6914. if (index > 0) {
  6915. LODOP.NewPageA();
  6916. }
  6917. if (res.deptName != undefined && res.deptName != null) {
  6918. if (res.deptName.indexOf("儿") > 0) {
  6919. $("#typePrescription").text("儿科");
  6920. $("#cfTitle").text("儿科");
  6921. } else if (res.deptName.indexOf("急诊科") > 0) {
  6922. $("#typePrescription").text("急诊");
  6923. $("#cfTitle").text("急诊");
  6924. } else {
  6925. $("#typePrescription").text("中药处方");
  6926. $("#cfTitle").text("普通");
  6927. }
  6928. }
  6929. $("#prescriptionDetail").html(html);
  6930. $("#cfAmountPrint").text(prescriptionDetailJson.zyPrescription[0].amount + "元 (不含代煎费)");
  6931. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  6932. index++;
  6933. }
  6934. }
  6935. if (prescriptionDetailJson.zlPrescription != null && prescriptionDetailJson.zlPrescription.length > 0) {
  6936. //诊疗处方
  6937. var zlPrescription = prescriptionDetailJson.zlPrescription[0].detail;
  6938. if (zlPrescription != null && zlPrescription.length > 0) {
  6939. var html = "";
  6940. for (var i = 0; i < zlPrescription.length; i++) {
  6941. html += "<tr><td>";
  6942. html += zlPrescription[i];
  6943. html += "</td></tr>";
  6944. }
  6945. if (index > 0) {
  6946. LODOP.NewPageA();
  6947. }
  6948. if (res.deptName != undefined && res.deptName != null) {
  6949. if (res.deptName.indexOf("儿") > 0) {
  6950. $("#typePrescription").text("儿科");
  6951. $("#cfTitle").text("儿科");
  6952. } else if (res.deptName.indexOf("急诊科") > 0) {
  6953. $("#typePrescription").text("急诊");
  6954. $("#cfTitle").text("急诊");
  6955. } else {
  6956. $("#typePrescription").text("诊疗处方");
  6957. $("#cfTitle").text("普通");
  6958. }
  6959. }
  6960. $("#prescriptionDetail").html(html);
  6961. $("#cfAmountPrint").text(prescriptionDetailJson.zlPrescription[0].amount + "元 ");
  6962. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  6963. index++;
  6964. }
  6965. }
  6966. $.ajax({
  6967. type: "GET",
  6968. url: '/thmz/getChargeDetailForGuideCard?patientId=' + patientId + '&times=' + times,
  6969. contentType: "application/json;charset=UTF-8",
  6970. dataType: "json",
  6971. headers: {
  6972. 'Accept': 'application/json',
  6973. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  6974. },
  6975. success: function (res) {
  6976. if (res == '401' || res == 401) {
  6977. window.location.href = '/thmz/login/view'
  6978. return;
  6979. }
  6980. if (res.code == 0) {
  6981. if (res.data != null && res.data.length > 0) {
  6982. var html = "";
  6983. for (var i = 0; i < res.data.length; i++) {
  6984. html += "<tr><td>" + res.data[i].itemType + "</td><td>" + Division(res.data[i].itemTotalFee, 100).toFixed(2) + "</td><td>" + res.data[i].execDeptName + "</td><td>" + res.data[i].execDeptAddress + "</td></tr>"
  6985. }
  6986. $("#guideCardDetail").html(html);
  6987. }
  6988. if (res.payQrcode != null && res.payQrcode != "") {
  6989. $("#payQrcodeGuideCard").html(null);
  6990. new QRCode(document.getElementById("payQrcodeGuideCard"), res.payQrcode); // 设置要生成二维码的链接
  6991. $("canvas").attr("id", "erw");
  6992. var canvas = document.getElementById('erw');
  6993. var src = canvas.toDataURL("image/png");
  6994. //var strDataURI =canvas.toDataURL("image/png");
  6995. $("#payQrcodeGuideCard").html("<img src='" + src + "' style='width:100px;height:100px;'/><div style='width: 100px;margin-top: 10px;text-align: center;'>微信支付</div>");
  6996. }
  6997. $("#totalAmountGuideCard").text("¥" + res.totalAmount);
  6998. // $("#imgcode").JsBarcode(patientId);
  6999. console.log(patientId);
  7000. JsBarcode('#imgcode', patientId, {
  7001. lineColor: '#333', //线条颜色
  7002. width: 2, //线宽
  7003. height: 60, //条码高度
  7004. displayValue: false, //是否显示文字信息
  7005. });
  7006. if (index > 0) {
  7007. LODOP.NewPageA();
  7008. }
  7009. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("guide_card_table").innerHTML);
  7010. //LODOP.PRINT();
  7011. if (printType == 1) {
  7012. LODOP.PREVIEW();
  7013. } else if (printType == 2) {
  7014. LODOP.PRINT_SETUP();
  7015. }
  7016. } else if (res.code == -2) {
  7017. if (printType == 1) {
  7018. LODOP.PREVIEW();
  7019. } else if (printType == 2) {
  7020. LODOP.PRINT_SETUP();
  7021. }
  7022. } else {
  7023. errorMesage(res);
  7024. }
  7025. }
  7026. });
  7027. // printGuideCard(patientId, times);
  7028. }
  7029. } else {
  7030. errorMesage(res);
  7031. }
  7032. }
  7033. });
  7034. }
  7035. /**
  7036. * 构建体征描述
  7037. * @param mzBlRecord
  7038. * @returns {*}
  7039. */
  7040. function getTz(mzBlRecord) {
  7041. var tz = null;
  7042. if (mzBlRecord.weight != null && mzBlRecord.weight != 0) {
  7043. var temp = "体重:" + mzBlRecord.weight + "kg ";
  7044. if (tz == null) {
  7045. tz = temp;
  7046. } else {
  7047. tz += " " + temp;
  7048. }
  7049. }
  7050. if (mzBlRecord.temperature != null && mzBlRecord.temperature != 0) {
  7051. var temp = "体温:" + mzBlRecord.temperature + "℃ ";
  7052. if (tz == null) {
  7053. tz = temp;
  7054. } else {
  7055. tz += " " + temp;
  7056. }
  7057. }
  7058. if (mzBlRecord.sphygmus != null && mzBlRecord.sphygmus != 0) {
  7059. var temp = "脉搏:" + mzBlRecord.sphygmus + "次/分 ";
  7060. if (tz == null) {
  7061. tz = temp;
  7062. } else {
  7063. tz += " " + temp;
  7064. }
  7065. }
  7066. if (mzBlRecord.breathe != null && mzBlRecord.breathe != 0) {
  7067. var temp = "呼吸:" + mzBlRecord.breathe + "次/分 ";
  7068. if (tz == null) {
  7069. tz = temp;
  7070. } else {
  7071. tz += " " + temp;
  7072. }
  7073. }
  7074. if (mzBlRecord.pressureHigh != null && mzBlRecord.pressureFloor != null && mzBlRecord.pressureHigh != 0 && mzBlRecord.pressureFloor != 0) {
  7075. var temp = "血压:" + mzBlRecord.pressureHigh + "/" + mzBlRecord.pressureFloor;
  7076. if (tz == null) {
  7077. tz = temp;
  7078. } else {
  7079. tz += " " + temp;
  7080. }
  7081. }
  7082. if (mzBlRecord.pressureHighLeft != null && mzBlRecord.pressureFloorLeft != null && mzBlRecord.pressureHighLeft != 0 && mzBlRecord.pressureFloorLeft != 0) {
  7083. var temp = "左血压:" + mzBlRecord.pressureHighLeft + "/" + mzBlRecord.pressureFloorLeft;
  7084. if (tz == null) {
  7085. tz = temp;
  7086. } else {
  7087. tz += " " + temp;
  7088. }
  7089. }
  7090. return tz;
  7091. }
  7092. /**
  7093. * 打印医技申请单
  7094. * @param patientId
  7095. * @param times
  7096. * @param type 申请单类型:2:检验;3:检查
  7097. * @param printType 打印模式 1 预览打印 2 打印设置
  7098. */
  7099. function printYjReq(patientId, times, type, printType) {
  7100. $.ajax({
  7101. type: "GET",
  7102. url: '/thmz/printYjReq?patientId=' + patientId + '&times=' + times + "&reqType=" + type,
  7103. contentType: "application/json;charset=UTF-8",
  7104. dataType: "json",
  7105. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7106. success: function (res) {
  7107. if (res == '401' || res == 401) {
  7108. window.location.href = '/thmz/login/view'
  7109. return;
  7110. }
  7111. if (res.code == 0) {
  7112. if (res.data == null || res.data.mzYjReqList == null || res.data.mzYjReqList.length == 0) {
  7113. errorMesageSimaple("没有医技申请单可以打印");
  7114. return;
  7115. }
  7116. setPrint();
  7117. LODOP = getLodop();
  7118. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院检查申请单");
  7119. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  7120. //设置默认打印机
  7121. LODOP.SET_PRINTER_INDEX(printIndex);
  7122. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  7123. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  7124. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  7125. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "检查申请单");//对新建的纸张重命名
  7126. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  7127. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  7128. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  7129. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  7130. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  7131. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  7132. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  7133. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  7134. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  7135. var mzPatientMi = res.data.mzPatientMi;
  7136. $("#patientIdJcReq").text(mzPatientMi.patientId);
  7137. $("#patientNameJcReq").text(mzPatientMi.name);
  7138. $("#patientGenderJcReq").text(mzPatientMi.gender);
  7139. $("#patientAgeJcReq").text(mzPatientMi.age + "岁");
  7140. $("#responseTypeJcReq").text(mzPatientMi.responseTypeName);
  7141. $("#patientCardNoJcReq").text(mzPatientMi.icCardNo);
  7142. $("#icdTextJcReq").text(res.data.mzVisitTable.icdText);
  7143. $("#patientIdJyReq").text(mzPatientMi.patientId);
  7144. $("#patientNameJyReq").text(mzPatientMi.name);
  7145. $("#patientGenderJyReq").text(mzPatientMi.gender);
  7146. $("#patientAgeJyReq").text(mzPatientMi.age + "岁");
  7147. $("#responseTypeJyReq").text(mzPatientMi.responseTypeName);
  7148. $("#patientCardNoJyReq").text(mzPatientMi.icCardNo);
  7149. $("#icdTextJyReq").text(res.data.mzVisitTable.icdText);
  7150. var mzBlRecord = res.data.mzBlRecord;
  7151. $("#jcReqEmrChiefComplaint").text(mzBlRecord.emrChiefComplaint);
  7152. $("#jcReqHis").text(mzBlRecord.emrHpi);
  7153. $("#jyReqEmrChiefComplaint").text(mzBlRecord.emrChiefComplaint);
  7154. $("#jyReqHis").text(mzBlRecord.emrHpi);
  7155. var tz = getTz(mzBlRecord);
  7156. $("#jcReqTz").text(tz);
  7157. $("#jcReqReqDept").text(res.data.deptName);
  7158. $("#jcReqReqDoctor").text(res.data.doctorName);
  7159. $("#jyReqTz").text(tz);
  7160. $("#jyReqReqDept").text(res.data.deptName);
  7161. $("#jyReqReqDoctor").text(res.data.doctorName);
  7162. //检验报告列表名
  7163. var jyTitle = '<tr><th style="min-height: 30px;border-bottom: 1px solid black;">检验项目</th><th style="min-height: 30px;border-bottom: 1px solid black;">标本</th><th style="min-height: 30px;border-bottom: 1px solid black;">单号</th></tr>';
  7164. var jyContent = "";
  7165. var needNewPageA = false;
  7166. for (var i = 0; i < res.data.mzYjReqList.length; i++) {
  7167. var obj = res.data.mzYjReqList[i];
  7168. if (i == 0) {
  7169. var dateStr = format(obj.reqDate, "yyyy-MM-dd");
  7170. $("#jcReqReqDate").text(dateStr);
  7171. $("#jyReqReqDate").text(dateStr);
  7172. }
  7173. if (obj.reqType == "3") {
  7174. if (i > 0) {
  7175. LODOP.NewPageA();
  7176. }
  7177. $("#reqNoJcReq").text(obj.reqNo);
  7178. $("#jcReqItem").text(obj.groupName);
  7179. $("#jcReqRemark").text(obj.jyRemark);
  7180. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("jc_card_table").innerHTML);
  7181. needNewPageA = true;
  7182. } else if (obj.reqType == "2") {
  7183. var inspectStuff = (obj.inspectStuff == null || obj.inspectStuff == "null") ? "" : obj.inspectStuff;
  7184. jyContent += '<tr><td style="min-height: 30px;">' + obj.groupName + '</td><td>' + inspectStuff + '</td><td>' + obj.reqNo + '</td></tr>';
  7185. }
  7186. }
  7187. if (jyContent != null && jyContent != "" && jyContent.length > 0) {
  7188. if (needNewPageA) {
  7189. LODOP.NewPageA();
  7190. }
  7191. jyContent = jyTitle + jyContent;
  7192. $("#jyContent").html(jyContent);
  7193. //检验
  7194. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("jy_card_table").innerHTML);
  7195. }
  7196. if (printType == 1) {
  7197. LODOP.PREVIEW();
  7198. } else if (printType == 2) {
  7199. LODOP.PRINT_SETUP();
  7200. }
  7201. } else {
  7202. errorMesage(res);
  7203. }
  7204. }
  7205. });
  7206. }
  7207. /**
  7208. * 打印门诊病历
  7209. * @param patientId
  7210. * @param times
  7211. * @param clnicId
  7212. * @param payMark
  7213. * @param printType 打印模式 1 预览打印 2 打印设置
  7214. */
  7215. function printBlRecord(patientId, times, printType) {
  7216. $.ajax({
  7217. type: "GET",
  7218. url: '/thmz/getMzBlrecord?patientId=' + patientId + '&times=' + times,
  7219. contentType: "application/json;charset=UTF-8",
  7220. dataType: "json",
  7221. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7222. success: function (res) {
  7223. if (res == '401' || res == 401) {
  7224. window.location.href = '/thmz/login/view'
  7225. return;
  7226. }
  7227. if (res.code == 0) {
  7228. setPrint();
  7229. LODOP = getLodop();
  7230. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院门诊病历");
  7231. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  7232. //设置默认打印机
  7233. LODOP.SET_PRINTER_INDEX(printIndex);
  7234. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  7235. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  7236. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  7237. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊病历");//对新建的纸张重命名
  7238. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  7239. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  7240. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  7241. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  7242. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  7243. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  7244. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  7245. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  7246. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  7247. var mzPatientMi = res.mzPatientMi;
  7248. $("#patientIdBlrecord").text(mzPatientMi.patientId);
  7249. $("#patientNameBlrecord").text(mzPatientMi.name);
  7250. $("#patientGenderBlrecord").text(mzPatientMi.gender);
  7251. $("#patientAgeBlrecord").text(mzPatientMi.age + "岁");
  7252. var mzBlRecord = res.mzBlRecord;
  7253. if (mzBlRecord.firstOrNot == "1") {
  7254. $("#firstOrNotTitle").text("复诊");
  7255. } else {
  7256. $("#firstOrNotTitle").text("初诊");
  7257. }
  7258. if (mzBlRecord.emrChiefComplaint != null && mzBlRecord.emrChiefComplaint != "") {
  7259. $("#emrChiefComplaintBlrecord").text(mzBlRecord.emrChiefComplaint);
  7260. $("#emrChiefComplaintBlrecord").parent().css("display", "block");
  7261. } else {
  7262. $("#emrChiefComplaintBlrecord").parent().css("display", "none");
  7263. }
  7264. if (mzBlRecord.emrHpi != null && mzBlRecord.emrHpi != "") {
  7265. $("#emrHpiBlrecord").text(mzBlRecord.emrHpi);
  7266. $("#emrHpiBlrecord").parent().css("display", "block");
  7267. } else {
  7268. $("#emrHpiBlrecord").parent().css("display", "none");
  7269. }
  7270. if (mzBlRecord.emrPs != null && mzBlRecord.emrPs != "") {
  7271. $("#emrPsBlrecord").text(mzBlRecord.emrPs);
  7272. $("#emrPsBlrecord").parent().css("display", "block");
  7273. } else {
  7274. $("#emrPsBlrecord").parent().css("display", "none");
  7275. }
  7276. if (mzBlRecord.personalHistory != null && mzBlRecord.personalHistory != "") {
  7277. $("#personalHistoryBlrecord").text(mzBlRecord.personalHistory);
  7278. $("#personalHistoryBlrecord").parent().css("display", "block");
  7279. } else {
  7280. $("#personalHistoryBlrecord").parent().css("display", "none");
  7281. }
  7282. if (mzBlRecord.familyHistory != null && mzBlRecord.familyHistory != "") {
  7283. $("#familyHistoryBlrecord").text(mzBlRecord.familyHistory);
  7284. $("#familyHistoryBlrecord").parent().css("display", "block");
  7285. } else {
  7286. $("#familyHistoryBlrecord").parent().css("display", "none");
  7287. }
  7288. if (mzBlRecord.obstericalHistory != null && mzBlRecord.obstericalHistory != "") {
  7289. $("#obstericalHistoryBlrecord").text(mzBlRecord.obstericalHistory);
  7290. $("#obstericalHistoryBlrecord").parent().css("display", "block");
  7291. } else {
  7292. $("#obstericalHistoryBlrecord").parent().css("display", "none");
  7293. }
  7294. var tz = getTz(mzBlRecord);
  7295. if (tz != null && tz != "") {
  7296. $("#tzjcBlrecord").text(tz);
  7297. $("#tzjcBlrecord").parent().css("display", "block");
  7298. } else {
  7299. $("#tzjcBlrecord").parent().css("display", "none");
  7300. }
  7301. if (mzBlRecord.emrPe != null && mzBlRecord.emrPe != "") {
  7302. $("#emrPeBlrecord").text(mzBlRecord.emrPe);
  7303. $("#emrPeBlrecord").parent().css("display", "block");
  7304. } else {
  7305. $("#emrPeBlrecord").parent().css("display", "none");
  7306. }
  7307. if (res.icdText != null && res.icdText != "") {
  7308. $("#icdTextBlrecord").text(res.icdText);
  7309. $("#icdTextBlrecord").parent().css("display", "block");
  7310. } else {
  7311. $("#icdTextBlrecord").parent().css("display", "none");
  7312. }
  7313. if (mzBlRecord.emrProcess != null && mzBlRecord.emrProcess != "") {
  7314. $("#emrProcessBlrecord").html(mzBlRecord.emrProcess);
  7315. $("#emrProcessBlrecord").parent().css("display", "block");
  7316. } else {
  7317. $("#emrProcessBlrecord").parent().css("display", "none");
  7318. }
  7319. if (mzBlRecord.emrJkjy != null && mzBlRecord.emrJkjy != "") {
  7320. $("#emrJkjyBlrecord").text(mzBlRecord.emrJkjy);
  7321. $("#emrJkjyBlrecord").parent().css("display", "block");
  7322. } else {
  7323. $("#emrJkjyBlrecord").parent().css("display", "none");
  7324. }
  7325. $("#visitDeptBlrecord").text(res.deptName);
  7326. $("#visitDoctorBlrecord").text(res.doctorName);
  7327. $("#visitDateBlrecord").text(res.visitDate);
  7328. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("mz_blrecord_card_table").innerHTML);
  7329. if (printType == 1) {
  7330. LODOP.PREVIEW();
  7331. } else if (printType == 2) {
  7332. LODOP.PRINT_SETUP();
  7333. }
  7334. } else {
  7335. errorMesage(res);
  7336. }
  7337. }
  7338. });
  7339. }
  7340. /**
  7341. * 将内容拼接空格,这样才会有下划线
  7342. * @param mzPatientMi
  7343. * @param maxLength 最大长度
  7344. * @returns {*}
  7345. */
  7346. function formatUnderline(params, maxLength) {
  7347. var length = 0;
  7348. if (params == null || params.length == 0) {
  7349. length = maxLength;
  7350. } else {
  7351. length = maxLength - params.length;
  7352. }
  7353. for (var i = 0; i < length; i++) {
  7354. params += " ";
  7355. }
  7356. return params;
  7357. }
  7358. /**
  7359. * 打印入院通知单
  7360. * @param patientId
  7361. * @param times
  7362. * @param clnicId
  7363. * @param payMark
  7364. * @param printType 打印模式 1 预览打印 2 打印设置
  7365. */
  7366. function printZyReq(patientId, printType) {
  7367. $.ajax({
  7368. type: "GET",
  7369. url: '/thmz/printZyReq?patientId=' + patientId,
  7370. contentType: "application/json;charset=UTF-8",
  7371. dataType: "json",
  7372. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7373. success: function (res) {
  7374. if (res == '401' || res == 401) {
  7375. window.location.href = '/thmz/login/view'
  7376. return;
  7377. }
  7378. if (res.code == 0) {
  7379. setPrint();
  7380. LODOP = getLodop();
  7381. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院入院通知单");
  7382. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  7383. //设置默认打印机
  7384. LODOP.SET_PRINTER_INDEX(printIndex);
  7385. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  7386. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  7387. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  7388. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "入院通知单");//对新建的纸张重命名
  7389. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  7390. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  7391. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  7392. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  7393. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  7394. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  7395. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  7396. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  7397. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  7398. var mzPatientMi = res.mzPatientMi;
  7399. var mzZyReq = res.mzZyReq;
  7400. var mzPatientId = formatUnderline(mzPatientMi.patientId, 15);
  7401. $("#patientIdZyReq").text(mzPatientId);
  7402. var mzPatientMiName = formatUnderline(mzPatientMi.name, 22);
  7403. $("#patientNameZyReq").text(mzPatientMiName);
  7404. var mzPatientGender = formatUnderline(mzPatientMi.gender, 10);
  7405. $("#patientGenderZyReq").text(mzPatientGender);
  7406. var mzPatientAge = formatUnderline(mzPatientMi.age + "岁", 6);
  7407. $("#patientAgeZyReq").text(mzPatientAge);
  7408. var mzPatientSocialNo = formatUnderline(mzPatientMi.socialNo, 48);
  7409. $("#sfzZyReq").text(mzPatientSocialNo);
  7410. $("#birthDateZyReq").text(format(mzPatientMi.birthDay, "yyyy-MM-dd"));
  7411. var mzPatientPhoneNo = formatUnderline(mzPatientMi.phoneNo, 55);
  7412. $("#phoneZyReq").text(mzPatientPhoneNo);
  7413. $("#responseTypeZyReq").text(mzPatientMi.responseTypeName);
  7414. var mzPatientMiAddress = formatUnderline(mzPatientMi.address, 31);
  7415. $("#addressZyReq").text(mzPatientMiAddress);
  7416. if (mzZyReq.icdCode == null || mzZyReq.icdCode == "" || mzZyReq.icdCode.length == 0) {
  7417. $("#icsCodeZyReq").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
  7418. var mzPatientMiIcdText = formatUnderline(mzZyReq.icdText, 29);
  7419. $("#icsTextZyReq").text(" " + mzPatientMiIcdText);
  7420. } else {
  7421. var mzPatientMiIcdCode = formatUnderline(mzZyReq.icdCode, 12);
  7422. $("#icsCodeZyReq").text(mzPatientMiIcdCode);
  7423. var mzPatientMiIcdText = formatUnderline(mzZyReq.icdText, 29);
  7424. $("#icsTextZyReq").text(mzPatientMiIcdText);
  7425. }
  7426. var mzZyReqReqWard = formatUnderline(mzZyReq.reqWard, 6);
  7427. $("#reqDeptZyReq").text(mzZyReqReqWard);
  7428. var mzZyReqSmallDept = formatUnderline(mzZyReq.smallDept, 27);
  7429. $("#smallDeptZyReq").text(mzZyReqSmallDept);
  7430. //$("#admissStatusZyReq").text(mzZyReq.admissStatus);
  7431. $("input:checkbox[value='" + mzZyReq.admissStatus + "']").attr('checked', 'true');
  7432. var mzZyReqVisitDate = formatUnderline(format(mzZyReq.visitDate, "yyyy-MM-dd HH:mm:ss"), 37);
  7433. $("#visitDateZyReq").text(mzZyReqVisitDate);
  7434. var mzZyReqDeptCode = formatUnderline(mzZyReq.deptCode, 15);
  7435. $("#deptCodeZyReq").text(mzZyReqDeptCode);
  7436. var mzZyReqDoctorCode = formatUnderline(mzZyReq.doctorCode, 16);
  7437. $("#doctorCodeZyReq").text(mzZyReqDoctorCode);
  7438. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("mz_zy_req_table").innerHTML);
  7439. if (printType == 1) {
  7440. LODOP.PREVIEW();
  7441. } else if (printType == 2) {
  7442. LODOP.PRINT_SETUP();
  7443. }
  7444. } else {
  7445. errorMesage(res);
  7446. }
  7447. }
  7448. });
  7449. }
  7450. /**
  7451. * 打开查看检查检验报告窗口(含往期)
  7452. * @param patientId
  7453. */
  7454. function previewYjReqAll(patientId) {
  7455. $("#visitingDetailModal").modal("hide");
  7456. $("#previewYjReqModal").modal();
  7457. $("#previewYjReqModalPatientId").val(patientId);
  7458. $("#previewYjReqModalTimes").val(null);
  7459. //重置参数
  7460. retryCount = 0;
  7461. initJcJyTable();
  7462. }
  7463. /**
  7464. * 打开查看检查检验报告窗口
  7465. * @param patientId 门诊病人ID
  7466. * @param times 就诊次数
  7467. */
  7468. function previewYjReq(patientId, times) {
  7469. $("#visitingDetailModal").modal("hide");
  7470. $("#previewYjReqModal").modal();
  7471. $("#previewYjReqModalPatientId").val(patientId);
  7472. $("#previewYjReqModalTimes").val(times);
  7473. //重置参数
  7474. retryCount = 0;
  7475. initJcJyTable();
  7476. }
  7477. /**
  7478. * 检查检验列表类型按钮切换事件
  7479. * @param object
  7480. */
  7481. function jcjyButtonChange(object) {
  7482. $("#jcjy_group").find("button").each(function (index, element) {
  7483. if ($(element).hasClass("btn-primary")) {
  7484. $(element).removeClass("btn-primary").addClass("btn-default");
  7485. }
  7486. });
  7487. $(object).removeClass("btn-default").addClass("btn-primary");
  7488. initJcJyTable();
  7489. }
  7490. /**
  7491. * 初始化检查检验报告列表
  7492. */
  7493. function initJcJyTable() {
  7494. clearInspectionDetail();
  7495. clearJcDetail();
  7496. var typeIndex = getIndex("jcjy_group");
  7497. if (typeIndex == 0) {
  7498. //检查
  7499. $('#tb_jy_pName_table_list').bootstrapTable("destroy");
  7500. $('#tb_jy_table_list').bootstrapTable("destroy");
  7501. initJcListTable();
  7502. $("#jy_detail").removeClass("in").addClass("hide");
  7503. $("#jc_detail").removeClass("hide").addClass("in");
  7504. } else {
  7505. $('#tb_table_list').bootstrapTable("destroy");
  7506. initJyListTable();
  7507. $("#jc_detail").removeClass("in").addClass("hide");
  7508. $("#jy_detail").removeClass("hide").addClass("in");
  7509. }
  7510. }
  7511. /**
  7512. * 初始化检查报告列表
  7513. */
  7514. function initJcListTable() {
  7515. $('#tb_table_list').bootstrapTable("destroy");
  7516. $('#tb_table_list').bootstrapTable({
  7517. url: '/thmz/getJcJyList', //请求后台的URL(*)
  7518. method: 'post', //请求方式(*)
  7519. toolbar: '#toolbar', //工具按钮用哪个容器
  7520. striped: true, //是否显示行间隔色
  7521. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  7522. pagination: true, //是否显示分页(*)
  7523. sortable: true, //是否启用排序
  7524. sortOrder: "asc", //排序方式
  7525. queryParams: queryParams, //传递参数(*)
  7526. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  7527. pageNumber: 1, //初始化加载第一页,默认第一页
  7528. pageSize: 5, //每页的记录行数(*)
  7529. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  7530. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  7531. strictSearch: true,
  7532. showColumns: false, //是否显示所有的列
  7533. showRefresh: false, //是否显示刷新按钮
  7534. minimumCountColumns: 2, //最少允许的列数
  7535. clickToSelect: true, //是否启用点击选中行
  7536. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  7537. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  7538. cardView: false, //是否显示详细视图
  7539. detailView: false,
  7540. //rowStyle:rowStyle,//通过自定义函数设置行样式
  7541. ajaxOptions: {
  7542. headers: {
  7543. 'Accept': 'application/json',
  7544. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  7545. }
  7546. },
  7547. columns: [
  7548. {
  7549. field: 'groupName',
  7550. title: '项目名称',
  7551. align: "center",
  7552. valign: 'middle',
  7553. }, {
  7554. field: 'reqDate',
  7555. title: '申请时间',
  7556. align: "center",
  7557. valign: 'middle',
  7558. formatter: function (value, row, index) {
  7559. if (value == null || value == "") {
  7560. return "";
  7561. }
  7562. return format(value, "yyyy-MM-dd HH:mm:ss");
  7563. }
  7564. }
  7565. ],
  7566. onClickRow: function (row) {
  7567. clearJcDetail();
  7568. $("#patientId_t").text(row.patientId);
  7569. $("#name_t").text(row.patientName);
  7570. $("#date_t").text(format(row.reqDate, "yyyy-MM-dd HH:mm:ss"));
  7571. fitJcDetail(row.reqNo);
  7572. },
  7573. responseHandler: function (res) {
  7574. if (res == '401' || res == 401) {
  7575. window.location.href = '/thmz/login/view'
  7576. return;
  7577. }
  7578. var ress = eval(res);
  7579. if (ress.code == -1) {
  7580. if (ress.message != null && ress.message != '') {
  7581. errorMesage(ress);
  7582. }
  7583. if (retryCount == 0) {
  7584. retryCount++;
  7585. $("#jyButton").click();
  7586. return;
  7587. }
  7588. return {
  7589. "total": 0,//总页数
  7590. "rows": {} //数据
  7591. };
  7592. }
  7593. if (ress.count <= 0 && retryCount == 0) {
  7594. retryCount++;
  7595. $("#jyButton").click();
  7596. return;
  7597. }
  7598. //有数据的时候,计数也需要加1,防止这时医生自己候点击检验没数据又跳回检查
  7599. retryCount++;
  7600. return {
  7601. "total": ress.count,//总页数
  7602. "rows": ress.data //数据
  7603. };
  7604. },
  7605. onLoadSuccess: function (data) {
  7606. $(".pagination-detail").css("display", "none");
  7607. }
  7608. });
  7609. }
  7610. /**
  7611. * 构建列表查询参数
  7612. * @param params
  7613. * @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}}
  7614. */
  7615. function queryParams(params) {
  7616. var patientId = $("#previewYjReqModalPatientId").val();
  7617. var times = $("#previewYjReqModalTimes").val();
  7618. return {
  7619. reqType: "3",
  7620. patientId: patientId,
  7621. times: times,
  7622. pageSize: params.limit, //页面大小
  7623. pageIndex: params.offset / params.limit //页码
  7624. };
  7625. };
  7626. /**
  7627. * 加载检查明细
  7628. * @param reqNo
  7629. */
  7630. function fitJcDetail(reqNo) {
  7631. $.ajax({
  7632. type: "GET",
  7633. url: '/thmz/getYjJcRecordReport?hisReqNo=' + reqNo,
  7634. contentType: "application/json;charset=UTF-8",
  7635. dataType: "json",
  7636. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7637. success: function (res) {
  7638. if (res == '401' || res == 401) {
  7639. window.location.href = '/thmz/login/view'
  7640. return;
  7641. }
  7642. if (res.code == 0) {
  7643. canBePrintJc = true;
  7644. $("#jy_detail").removeClass("in").addClass("hide");
  7645. $("#jc_detail").removeClass("hide").addClass("in");
  7646. var mzPatientMi = res.data.mzPatientMi;
  7647. $("#gender_jc").text(mzPatientMi.gender);
  7648. $("#age_jc").text(mzPatientMi.age);
  7649. var yjJcRecordReport = res.data.yjJcRecordReport;
  7650. $("#groupName").text(res.data.groupName);
  7651. $("#textJc").text(yjJcRecordReport.textJc);
  7652. $("#textZd").text(yjJcRecordReport.textZd);
  7653. var jcRecord = res.data.jcRecord;
  7654. $("#report_no").text(jcRecord.reportNo);
  7655. $("#reportId").text(jcRecord.reportId);
  7656. if (jcRecord.reportDate == null || jcRecord.reportDate == "") {
  7657. $("#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;");
  7658. } else {
  7659. $("#reportDate").text(format(jcRecord.reportDate, "yyyy-MM-dd HH:mm:ss"));
  7660. }
  7661. $("#confirmId").text(jcRecord.confirmId);
  7662. if (jcRecord.confirmDate == null || jcRecord.confirmDate == "") {
  7663. $("#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;");
  7664. } else {
  7665. $("#confirmDate").text(format(jcRecord.confirmDate, "yyyy-MM-dd HH:mm:ss"));
  7666. }
  7667. } else {
  7668. errorMesage(res);
  7669. }
  7670. }
  7671. });
  7672. }
  7673. /**
  7674. * 清空检查明细
  7675. * @param reqNo
  7676. */
  7677. function clearJcDetail() {
  7678. canBePrintJc = false;
  7679. $("#patientId_t").text("");
  7680. $("#name_t").text("");
  7681. $("#date_t").text("");
  7682. $("#gender_jc").text("");
  7683. $("#age_jc").text("");
  7684. $("#groupName").text("");
  7685. $("#textJc").text("");
  7686. $("#textZd").text("");
  7687. $("#report_no").text("");
  7688. $("#reportId").text("");
  7689. $("#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;");
  7690. $("#confirmId").text("");
  7691. $("#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;");
  7692. }
  7693. /**
  7694. * 初始化检验报告列表
  7695. */
  7696. function initJyListTable() {
  7697. var patientId = $("#previewYjReqModalPatientId").val();
  7698. var times = $("#previewYjReqModalTimes").val();
  7699. $('#tb_table_list').bootstrapTable("destroy");
  7700. $('#tb_table_list').bootstrapTable({
  7701. url: '/thmz/getJyListByPatientIdAndTimes?patientId=' + patientId + "&times=" + times, //请求后台的URL(*)
  7702. method: 'get', //请求方式(*)
  7703. toolbar: '#toolbar', //工具按钮用哪个容器
  7704. striped: true, //是否显示行间隔色
  7705. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  7706. pagination: true, //是否显示分页(*)
  7707. sortable: true, //是否启用排序
  7708. sortOrder: "asc", //排序方式
  7709. //queryParams: queryJyPNameParams, //传递参数(*)
  7710. sidePagination: "client", //分页方式:client客户端分页,server服务端分页(*)
  7711. pageNumber: 1, //初始化加载第一页,默认第一页
  7712. pageSize: 5, //每页的记录行数(*)
  7713. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  7714. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  7715. strictSearch: true,
  7716. showColumns: false, //是否显示所有的列
  7717. showRefresh: false, //是否显示刷新按钮
  7718. minimumCountColumns: 2, //最少允许的列数
  7719. clickToSelect: true, //是否启用点击选中行
  7720. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  7721. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  7722. cardView: false, //是否显示详细视图
  7723. detailView: false,
  7724. //rowStyle:rowStyle,//通过自定义函数设置行样式
  7725. ajaxOptions: {
  7726. headers: {
  7727. 'Accept': 'application/json',
  7728. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  7729. }
  7730. },
  7731. columns: [
  7732. {
  7733. field: 'aply_CTNT',
  7734. title: '检验名称',
  7735. align: "center",
  7736. valign: 'middle',
  7737. }, {
  7738. field: 'ordr_CREATE_DATE',
  7739. title: '检验时间',
  7740. align: "center",
  7741. valign: 'middle',
  7742. formatter: function (value, row, index) {
  7743. if (value == null || value == "") {
  7744. return "";
  7745. }
  7746. return format(value, "yyyy-MM-dd HH:mm:ss");
  7747. }
  7748. }
  7749. ],
  7750. onClickRow: function (row) {
  7751. queryInspectionDetail(row.ordr_ID);
  7752. },
  7753. responseHandler: function (res) {
  7754. if (res == '401' || res == 401) {
  7755. window.location.href = '/thmz/login/view'
  7756. return;
  7757. }
  7758. var ress = eval(res);
  7759. if (ress.code == -1) {
  7760. if (retryCount == 0) {
  7761. retryCount++;
  7762. $("#jcButton").click();
  7763. return;
  7764. }
  7765. if (ress.message != null && ress.message != '') {
  7766. errorMesage(ress);
  7767. }
  7768. return {
  7769. "total": ress.data.length,//总页数
  7770. "rows": ress.data //数据
  7771. };
  7772. }
  7773. if (ress.data.length <= 0 && retryCount == 0) {
  7774. retryCount++;
  7775. $("#jcButton").click();
  7776. return;
  7777. }
  7778. //有数据的时候,计数也需要加1,防止这时医生自己候点击检查没数据又跳回检验
  7779. retryCount++;
  7780. return {
  7781. "total": ress.data.length,//总页数
  7782. "rows": ress.data //数据
  7783. };
  7784. },
  7785. onLoadSuccess: function (data) {
  7786. $("#jy_table_table_div").find(".pagination-detail").css("display", "none");
  7787. }
  7788. });
  7789. }
  7790. /**
  7791. * 清空检验明细
  7792. * @param orderId
  7793. */
  7794. function clearInspectionDetail() {
  7795. canBePrintJy = false;
  7796. $("#patientId_t_jy").text("");
  7797. $("#name_t_jy").text("");
  7798. $("#gender_jy").text("");
  7799. $("#age_jy").text("");
  7800. $("#reqDept_t_jy").text("");
  7801. $("#bed_no_jy").text("");
  7802. $("#smpl_jy").text("");
  7803. $("#item_jy").text("");
  7804. $("#applyDate").text("");
  7805. $("#orderCreateDate").text("");
  7806. $("#auditTime").text("");
  7807. $("#orderUsrName").text("");
  7808. $("#testUsrName").text("");
  7809. $("#auditUsrName").text("");
  7810. $("#jyBody").html("");
  7811. }
  7812. /**
  7813. * 加载检验明细
  7814. * @param orderId
  7815. */
  7816. function queryInspectionDetail(orderId) {
  7817. clearInspectionDetail();
  7818. $.ajax({
  7819. type: "GET",
  7820. url: '/thmz/getInspectionDetail?orderId=' + orderId,
  7821. contentType: "application/json;charset=UTF-8",
  7822. dataType: "json",
  7823. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7824. success: function (res) {
  7825. if (res == '401' || res == 401) {
  7826. window.location.href = '/thmz/login/view'
  7827. return;
  7828. }
  7829. if (res.code == 0) {
  7830. canBePrintJy = true;
  7831. $("#jc_detail").removeClass("in").addClass("hide");
  7832. $("#jy_detail").removeClass("hide").addClass("in");
  7833. var mzPatientMi = res.mzPatientMi;
  7834. $("#patientId_t_jy").text(mzPatientMi.patientId);
  7835. $("#name_t_jy").text(mzPatientMi.name);
  7836. $("#gender_jy").text(mzPatientMi.gender);
  7837. $("#age_jy").text(mzPatientMi.age);
  7838. var html = "";
  7839. if (res.data != null) {
  7840. var inspectionHeader = res.data.inspectionHeader;
  7841. $("#reqDept_t_jy").text(inspectionHeader.dept_NAME);
  7842. $("#bed_no_jy").text(inspectionHeader.ptnt_BED_NO);
  7843. $("#smpl_jy").text(inspectionHeader.smpl_NAME);
  7844. $("#item_jy").text(inspectionHeader.aply_CNTN);
  7845. $("#applyDate").text(format(inspectionHeader.aply_DATE, "yyyy-MM-dd HH:mm:ss"));
  7846. $("#orderCreateDate").text(format(inspectionHeader.ordr_CREATE_DATE, "yyyy-MM-dd HH:mm:ss"));
  7847. $("#auditTime").text(format(inspectionHeader.audt_TIME, "yyyy-MM-dd HH:mm:ss"));
  7848. $("#orderUsrName").text(inspectionHeader.ordr_USR_NAME);
  7849. $("#testUsrName").text(inspectionHeader.test_USR_NAME);
  7850. $("#auditUsrName").text(inspectionHeader.audt_USR_NAME);
  7851. var inspectionItems = res.data.inspectionItems;
  7852. if (inspectionItems != null && inspectionItems.length > 0) {
  7853. for (var i = 0; i < inspectionItems.length; i++) {
  7854. html += "<tr>";
  7855. var obj = inspectionItems[i];
  7856. var itm_VALUE = (obj.itm_VALUE == null || obj.itm_VALUE == "" || obj.itm_VALUE == "null") ? obj.itm_STR_VALUE : obj.itm_VALUE;
  7857. var range = (obj.range == null || obj.range == "" || obj.range == "null") ? obj.range_STR : obj.range;
  7858. html += "<td width='25%'>" + obj.itm_NAME + "</td>";
  7859. html += "<td width='16.66%'>" + itm_VALUE + "</td>";
  7860. html += "<td width='16.66%'>" + obj.itm_UNIT + "</td>";
  7861. if (obj.itm_ALERT == null || obj.itm_ALERT == "") {
  7862. html += "<td width='16.66%'><span style=\"color:#67C23A;font-weight:bold\"></span></td>";
  7863. } else if (obj.itm_ALERT == "H") {
  7864. html += "<td width='16.66%'><span style=\"color:#F56C6C;font-weight:bold\">↑</span></td>";
  7865. } else if (obj.itm_ALERT == "L") {
  7866. html += "<td width='16.66%'><span style=\"color:#F56C6C;font-weight:bold\">↓</span></td>";
  7867. }
  7868. html += "<td width='25%'>" + range + "</td>";
  7869. html += "</tr>";
  7870. }
  7871. }
  7872. }
  7873. $("#jyBody").html(html);
  7874. } else {
  7875. errorMesage(res);
  7876. }
  7877. }
  7878. });
  7879. }
  7880. /**
  7881. * 打印检查检验报告单
  7882. * @param printType 打印模式 1 预览打印 2 打印设置
  7883. */
  7884. function printJyJcReport(printType) {
  7885. var typeIndex = getIndex("jcjy_group");
  7886. var title = "检查报告单";
  7887. if (typeIndex == 1) {
  7888. title = "检验报告单"
  7889. if (!canBePrintJy) {
  7890. warningMesageSimaple("没有任何【" + title + "】可供打印!");
  7891. return;
  7892. }
  7893. } else {
  7894. if (!canBePrintJc) {
  7895. warningMesageSimaple("没有任何【" + title + "】可供打印!");
  7896. return;
  7897. }
  7898. }
  7899. setPrint();
  7900. LODOP = getLodop();
  7901. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院" + title);
  7902. LODOP.SET_PRINT_STYLE("FontSize", 7); //字体大小
  7903. //设置默认打印机
  7904. LODOP.SET_PRINTER_INDEX(printIndex);
  7905. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  7906. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  7907. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  7908. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", title);//对新建的纸张重命名
  7909. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  7910. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  7911. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  7912. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  7913. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  7914. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  7915. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  7916. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  7917. var strStyle = "<style>table{width: 96%;} #jy_detail_content thead {border-bottom: 1px solid black;border-collapse: collapse;}</style>";
  7918. if (typeIndex == 0) {
  7919. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("jc_detail").innerHTML);
  7920. }
  7921. if (typeIndex == 1) {
  7922. LODOP.ADD_PRINT_TABLE("37mm", "5mm", "130mm", "138mm", strStyle + document.getElementById("jy_detail_content").innerHTML);
  7923. LODOP.SET_PRINT_STYLEA(0, "Vorient", 3);
  7924. LODOP.ADD_PRINT_HTM("0mm", "5mm", "130mm", "200mm", strStyle + document.getElementById("jy_detail_title").innerHTML);
  7925. LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
  7926. LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
  7927. LODOP.ADD_PRINT_HTM("177mm", "5mm", "130mm", "200mm", strStyle + document.getElementById("jy_detail_foot").innerHTML);
  7928. LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
  7929. LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
  7930. }
  7931. if (printType == 1) {
  7932. LODOP.PREVIEW();
  7933. } else if (printType == 2) {
  7934. LODOP.PRINT_SETUP();
  7935. }
  7936. }
  7937. /**
  7938. * 初始化科室下拉选
  7939. */
  7940. function initExecUnit() {
  7941. //父科室列表
  7942. $.ajax({
  7943. type: "GET",
  7944. url: '/thmz/allUnitCode',
  7945. dataType: "json",
  7946. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7947. success: function (data) {
  7948. if (data == '401' || data == 401) {
  7949. window.location.href = '/thmz/login/view'
  7950. return;
  7951. }
  7952. $('#execUnit').empty(); //清空resText里面的所有内容
  7953. var html = '';
  7954. $.each(data.data, function (commentIndex, comment) {
  7955. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + '-' + comment.code + ')</option>';
  7956. });
  7957. $('#execUnit').html(html);
  7958. $('#execUnit').selectpicker('refresh');
  7959. }
  7960. });
  7961. }
  7962. /**
  7963. * 初始化证件类型下拉选
  7964. */
  7965. function initCertificateTypeSelect() {
  7966. $.ajax({
  7967. type: "GET",
  7968. url: '/thmz/listCertificateType',
  7969. contentType: "application/json;charset=UTF-8",
  7970. dataType: "json",
  7971. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7972. success: function (res) {
  7973. if (res == '401' || res == 401) {
  7974. window.location.href = '/thmz/login/view'
  7975. return;
  7976. }
  7977. if (res.code == 0) {
  7978. res.data.forEach(function (item, index) {
  7979. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  7980. $('#certificateType').append(html);
  7981. $('#editUserCertificateType').append(html);
  7982. });
  7983. $('#editUserCertificateType').selectpicker('refresh');
  7984. } else {
  7985. errorMesage(res);
  7986. }
  7987. }
  7988. });
  7989. }
  7990. /**
  7991. * 加载病历信息编辑预览
  7992. * @param patientId
  7993. * @param times
  7994. * @param type 1 编辑 2 预览
  7995. */
  7996. function showMzBlRecordModal(patientId, times, type) {
  7997. $.ajax({
  7998. type: "GET",
  7999. url: '/thmz/getMzBlrecord?patientId=' + patientId + '&times=' + times,
  8000. contentType: "application/json;charset=UTF-8",
  8001. dataType: "json",
  8002. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8003. success: function (res) {
  8004. if (res == '401' || res == 401) {
  8005. window.location.href = '/thmz/login/view'
  8006. return;
  8007. }
  8008. if (res.code == 0) {
  8009. //$("#visitingDetailModal").modal("hide");
  8010. var mzPatientMi = res.mzPatientMi;
  8011. $("#editPatientId").text(mzPatientMi.patientId);
  8012. $("#editPatientName").text(mzPatientMi.name);
  8013. $("#editPatientGender").text(mzPatientMi.gender);
  8014. $("#editPatientAge").text(mzPatientMi.age + "岁");
  8015. var mzBlRecord = res.mzBlRecord;
  8016. // if (mzBlRecord.firstOrNot == "1") {
  8017. // $("#firstOrNotTitle").text("复诊");
  8018. // } else {
  8019. // $("#firstOrNotTitle").text("初诊");
  8020. // }
  8021. if (mzBlRecord.emrChiefComplaint != null && mzBlRecord.emrChiefComplaint != "") {
  8022. $("#editEmrChiefComplaint").val(mzBlRecord.emrChiefComplaint);
  8023. $("#editEmrChiefComplaint").parent().parent().parent().css("display", "block");
  8024. } else {
  8025. $("#editEmrChiefComplaint").parent().parent().parent().css("display", "none");
  8026. }
  8027. if (mzBlRecord.emrHpi != null && mzBlRecord.emrHpi != "") {
  8028. $("#editEmrHpi").val(mzBlRecord.emrHpi);
  8029. $("#editEmrHpi").parent().parent().parent().css("display", "block");
  8030. } else {
  8031. $("#editEmrHpi").parent().parent().parent().css("display", "none");
  8032. }
  8033. if (mzBlRecord.emrPs != null && mzBlRecord.emrPs != "") {
  8034. $("#editEmrPs").val(mzBlRecord.emrPs);
  8035. $("#editEmrPs").parent().parent().parent().css("display", "block");
  8036. } else {
  8037. $("#editEmrPs").parent().parent().parent().css("display", "none");
  8038. }
  8039. if (mzBlRecord.personalHistory != null && mzBlRecord.personalHistory != "") {
  8040. $("#editPersonalHistory").val(mzBlRecord.personalHistory);
  8041. $("#editPersonalHistory").parent().parent().parent().css("display", "block");
  8042. } else {
  8043. $("#editPersonalHistory").parent().parent().parent().css("display", "none");
  8044. }
  8045. if (mzBlRecord.familyHistory != null && mzBlRecord.familyHistory != "") {
  8046. $("#editFamilyHistory").val(mzBlRecord.familyHistory);
  8047. $("#editFamilyHistory").parent().parent().parent().css("display", "block");
  8048. } else {
  8049. $("#editFamilyHistory").parent().parent().parent().css("display", "none");
  8050. }
  8051. if (mzBlRecord.obstericalHistory != null && mzBlRecord.obstericalHistory != "") {
  8052. $("#editObstericalHistory").val(mzBlRecord.obstericalHistory);
  8053. $("#editObstericalHistory").parent().parent().parent().css("display", "block");
  8054. } else {
  8055. $("#editObstericalHistory").parent().parent().parent().css("display", "none");
  8056. }
  8057. var tz = getTz(mzBlRecord);
  8058. if (tz != null && tz != "") {
  8059. $("#editTgjc").val(tz);
  8060. $("#editTgjc").parent().parent().parent().css("display", "block");
  8061. } else {
  8062. $("#editTgjc").parent().parent().parent().css("display", "none");
  8063. }
  8064. if (mzBlRecord.emrPe != null && mzBlRecord.emrPe != "") {
  8065. $("#editQtjc").val(mzBlRecord.emrPe);
  8066. $("#editQtjc").parent().parent().parent().css("display", "block");
  8067. } else {
  8068. $("#editQtjc").parent().parent().parent().css("display", "none");
  8069. }
  8070. if (res.icdText != null && res.icdText != "") {
  8071. $("#editZd").val(res.icdText);
  8072. $("#editZd").parent().parent().parent().css("display", "block");
  8073. } else {
  8074. $("#editZd").parent().parent().parent().css("display", "none");
  8075. }
  8076. if (mzBlRecord.emrProcess != null && mzBlRecord.emrProcess != "") {
  8077. var reg = new RegExp("</br>", "g");//g,表示全部替换。
  8078. var editEmrProcess=mzBlRecord.emrProcess.replace(reg, "\n");
  8079. reg = new RegExp("&nbsp;", "g");//g,表示全部替换。
  8080. editEmrProcess=editEmrProcess.replace(reg, "");
  8081. $("#editEmrProcess").val(editEmrProcess);
  8082. $("#editEmrProcess").parent().parent().parent().css("display", "block");
  8083. } else {
  8084. $("#editEmrProcess").parent().parent().parent().css("display", "none");
  8085. }
  8086. if (mzBlRecord.emrJkjy != null && mzBlRecord.emrJkjy != "" && mzBlRecord.emrJkjy != "无") {
  8087. $("#editEmrJkjy").val(mzBlRecord.emrJkjy);
  8088. $("#editEmrJkjy").parent().parent().parent().css("display", "block");
  8089. } else {
  8090. $("#editEmrJkjy").parent().parent().parent().css("display", "none");
  8091. }
  8092. if (type == 1) {
  8093. $("#mzBlRecorTitle").html("门诊病历【编辑】");
  8094. $("#setOtherEmrProcess").removeClass("in").addClass("hide");
  8095. $("#openBlRecordModel").removeClass("hide").addClass("in");
  8096. $("#setEmrProcess").removeClass("hide").addClass("in");
  8097. $("#newEmrProcessDiv").removeClass("hide").addClass("in");
  8098. $("#visitingDetailModal").modal("hide");
  8099. } else if (type == 2) {
  8100. $("#mzBlRecorTitle").html("门诊病历【预览】");
  8101. $("#setOtherEmrProcess").removeClass("hide").addClass("in");
  8102. $("#openBlRecordModel").removeClass("in").addClass("hide");
  8103. $("#setEmrProcess").removeClass("in").addClass("hide");
  8104. $("#newEmrProcessDiv").removeClass("in").addClass("hide");
  8105. //因为预览的时候,关闭预览框没有清空数据,且 此时基础数据的病历次数被清空
  8106. if ($("#mzBlTimes").val() != null && $("#mzBlTimes").val() != "" && ($("#baseMzBlTimes").val() == null || $("#baseMzBlTimes").val() == "")) {
  8107. $("#baseMzBlTimes").val($("#mzBlTimes").val());
  8108. }
  8109. $("#otherBlRecordModal").modal("hide");
  8110. }
  8111. $("#mzBlTimes").val(mzBlRecord.times);
  8112. $("#editMzBlRecordModal").modal();
  8113. } else {
  8114. errorMesage(res);
  8115. }
  8116. }
  8117. });
  8118. }
  8119. /**
  8120. * 清空区域
  8121. */
  8122. function clearInput() {
  8123. //编辑病历的时候,没有基础病历的就诊次数,如果是预览病历的时候,有基础病历的次数
  8124. var baseMzBlTimes = $("#baseMzBlTimes").val();
  8125. $("#editPatientId").text(null);
  8126. $("#editPatientName").text(null);
  8127. $("#editPatientGender").text(null);
  8128. $("#editPatientAge").text(null);
  8129. $("#editEmrChiefComplaint").val(null);
  8130. $("#editEmrHpi").val(null);
  8131. $("#editEmrPs").val(null);
  8132. $("#editPersonalHistory").val(null);
  8133. $("#editFamilyHistory").val(null);
  8134. $("#editObstericalHistory").val(null);
  8135. $("#editTgjc").val(null);
  8136. $("#editQtjc").val(null);
  8137. $("#editZd").val(null);
  8138. $("#editEmrProcess").val(null);
  8139. $("#editEmrJkjy").val(null);
  8140. $("#newEmrProcess").val(null);
  8141. $("#mzBlTimes").val(null);
  8142. if (baseMzBlTimes != null && baseMzBlTimes != "") {
  8143. $("#otherBlRecordModal").modal();
  8144. }
  8145. }
  8146. /**
  8147. * 保存门诊病历
  8148. */
  8149. function setEmrProcess() {
  8150. $("#editMzBlRecordModal").modal("hide");
  8151. $("#messageModal").modal();
  8152. $("#messageContent").html("是否保存并替换已有补充处理意见?");
  8153. $("#messageButton").off("click").on("click", function (t) {
  8154. if ($("#newEmrProcess").val() == null || $("#newEmrProcess").val() == "") {
  8155. $("#messageContent").html("当前录入的补充处理为空,是否保存并替换已有补充处理意见?");
  8156. $("#messageButton").off("click").on("click", function (t) {
  8157. $("#messageModal").modal("hide");
  8158. sendEmrProcess();
  8159. });
  8160. } else {
  8161. $("#messageModal").modal("hide");
  8162. sendEmrProcess();
  8163. }
  8164. });
  8165. $("#cancelButton").off("click").on("click", function (t) {
  8166. $("#editMzBlRecordModal").modal();
  8167. });
  8168. }
  8169. /**
  8170. * 提交保存门诊病历
  8171. */
  8172. function sendEmrProcess() {
  8173. $.ajax({
  8174. type: "POST",
  8175. url: '/thmz/setEmrProcess',
  8176. contentType: "application/json;charset=UTF-8",
  8177. dataType: "json",
  8178. data: JSON.stringify({
  8179. "patientId": $("#editPatientId").text(),
  8180. "times": $("#mzBlTimes").val(),
  8181. "emrChiefComplaint": $("#editEmrChiefComplaint").val(),
  8182. "emrHpi": $("#editEmrHpi").val(),
  8183. "emrPs": $("#editEmrPs").val(),
  8184. "personalHistory": $("#editPersonalHistory").val(),
  8185. "familyHistory": $("#editFamilyHistory").val(),
  8186. "obstericalHistory": $("#editObstericalHistory").val(),
  8187. "emrJkjy": $("#editEmrJkjy").val(),
  8188. "emrProcess": $("#newEmrProcess").val()
  8189. }),
  8190. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8191. success: function (res) {
  8192. if (res == '401' || res == 401) {
  8193. window.location.href = '/thmz/login/view'
  8194. return;
  8195. }
  8196. if (res.code == 0) {
  8197. clearInput();
  8198. successMesage(res);
  8199. $("#editMzBlRecordModal").modal("hide");
  8200. } else {
  8201. errorMesage(res);
  8202. }
  8203. }
  8204. });
  8205. }
  8206. /**
  8207. * 打开待合并病历列表弹框
  8208. */
  8209. function openBlRecordModel() {
  8210. $("#editMzBlRecordModal").modal("hide");
  8211. $("#otherBlRecordModal").modal();
  8212. initOtherMzBlRecordList();
  8213. }
  8214. /**
  8215. * 关闭待合并病历列表
  8216. */
  8217. function closeBlRecordModel() {
  8218. $('#baseMzBlTimes').val(null);
  8219. $("#visitingDetailModal").modal();
  8220. }
  8221. /**
  8222. * 病历列表
  8223. */
  8224. function initOtherMzBlRecordList() {
  8225. $('#other_bl_record_table').bootstrapTable("destroy");
  8226. $('#other_bl_record_table').bootstrapTable({
  8227. url: '/thmz/getMzBlRecordList', //请求后台的URL(*)
  8228. method: 'post', //请求方式(*)
  8229. toolbar: '#toolbar', //工具按钮用哪个容器
  8230. striped: true, //是否显示行间隔色
  8231. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  8232. pagination: true, //是否显示分页(*)
  8233. sortable: true, //是否启用排序
  8234. sortOrder: "desc", //排序方式
  8235. queryParams: queryOtherParams, //传递参数(*)
  8236. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  8237. pageNumber: 1, //初始化加载第一页,默认第一页
  8238. pageSize: 5, //每页的记录行数(*)
  8239. pageList: [10, 15, 25, 50, 100], //可供选择的每页的行数(*)
  8240. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  8241. strictSearch: true,
  8242. showColumns: false, //是否显示所有的列
  8243. showRefresh: false, //是否显示刷新按钮
  8244. minimumCountColumns: 2, //最少允许的列数
  8245. clickToSelect: true, //是否启用点击选中行
  8246. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  8247. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  8248. cardView: false, //是否显示详细视图
  8249. detailView: false,
  8250. //rowStyle:rowStyle,//通过自定义函数设置行样式
  8251. ajaxOptions: {
  8252. headers: {
  8253. 'Accept': 'application/json',
  8254. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  8255. }
  8256. },
  8257. columns: [
  8258. {
  8259. title: '操作',
  8260. field: 'op',
  8261. align: "center",
  8262. valign: 'middle',
  8263. formatter: function (value, row, index) {
  8264. 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>';
  8265. return [str].join('');
  8266. }
  8267. },
  8268. {
  8269. field: 'patientId',
  8270. title: '门诊ID',
  8271. align: "center",
  8272. valign: 'middle'
  8273. }, {
  8274. field: 'patientName',
  8275. title: '患者姓名',
  8276. align: "center",
  8277. valign: 'middle'
  8278. }, {
  8279. field: 'deptCode',
  8280. title: '就诊科室',
  8281. align: "center",
  8282. valign: 'middle'
  8283. }, {
  8284. field: 'doctorCode',
  8285. title: '接诊医师',
  8286. align: "center",
  8287. valign: 'middle'
  8288. }, {
  8289. field: 'firstOrNot',
  8290. title: '初/复诊',
  8291. align: "center",
  8292. valign: 'middle',
  8293. formatter: function (value, row, index) {
  8294. if (value == '1') {
  8295. return "复诊";
  8296. }
  8297. return "初诊";
  8298. }
  8299. }
  8300. , {
  8301. field: 'visitDate',
  8302. title: '就诊时间',
  8303. align: "center",
  8304. valign: 'middle',
  8305. formatter: function (value, row, index) {
  8306. if (value == null || value == "") {
  8307. return "";
  8308. }
  8309. return format(value, "yyyy-MM-dd HH:mm:ss");
  8310. }
  8311. }
  8312. ],
  8313. responseHandler: function (res) {
  8314. if (res == '401' || res == 401) {
  8315. window.location.href = '/thmz/login/view'
  8316. return;
  8317. }
  8318. var ress = eval(res);
  8319. if (ress.code == -1) {
  8320. if (ress.message != null && ress.message != '') {
  8321. errorMesage(ress);
  8322. }
  8323. return {
  8324. "total": 0,//总页数
  8325. "rows": {} //数据
  8326. };
  8327. }
  8328. return {
  8329. "total": ress.total,//总页数
  8330. "rows": ress.data //数据
  8331. };
  8332. },
  8333. });
  8334. }
  8335. /**
  8336. * 构建列表查询参数
  8337. * @param params
  8338. * @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}}
  8339. */
  8340. function queryOtherParams(params) {
  8341. var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
  8342. patientId: $("#editPatientId").text(),
  8343. exceptTimes: $("#mzBlTimes").val(),
  8344. pageSize: params.limit, //页面大小
  8345. pageIndex: params.offset / params.limit, //页码
  8346. };
  8347. return temp;
  8348. }
  8349. /**
  8350. * 提取处理意见保存
  8351. */
  8352. function setOtherEmrProcess() {
  8353. $("#editMzBlRecordModal").modal("hide");
  8354. $("#messageModal").modal();
  8355. $("#messageContent").html("确定要执行此次提取处理意见操作吗?");
  8356. $("#messageButton").off("click").on("click", function (t) {
  8357. $("#messageModal").modal("hide");
  8358. $.ajax({
  8359. type: "GET",
  8360. url: '/thmz/extractEmrProcess?patientId=' + $("#editPatientId").html() + '&baseTimes=' + $("#baseMzBlTimes").val() + '&times=' + $("#mzBlTimes").val(),
  8361. contentType: "application/json;charset=UTF-8",
  8362. dataType: "json",
  8363. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8364. success: function (res) {
  8365. if (res == '401' || res == 401) {
  8366. window.location.href = '/thmz/login/view'
  8367. return;
  8368. }
  8369. if (res.code == 0) {
  8370. successMesage(res);
  8371. $("#editMzBlRecordModal").modal("hide");
  8372. } else {
  8373. errorMesage(res);
  8374. }
  8375. }
  8376. });
  8377. });
  8378. $("#cancelButton").off("click").on("click", function (t) {
  8379. $("#editMzBlRecordModal").modal();
  8380. });
  8381. }