clinic.js 380 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734
  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 <= 112; 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" style="background: #EBEBE4;"><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" style="background: #EBEBE4;"><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" style="background: #EBEBE4;"><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. field: 'type',
  4588. title: '项目类型',
  4589. align: "center",
  4590. valign: 'middle',
  4591. // sortable: true
  4592. formatter: function (value, row, index) {
  4593. if(value==1 || value=="1"){
  4594. return "检验";
  4595. }
  4596. if(value==2 || value=="2"){
  4597. return "辅助检查";
  4598. }
  4599. if(value==3 || value=="3"){
  4600. return "诊疗";
  4601. }
  4602. return "";
  4603. }
  4604. },
  4605. ],
  4606. responseHandler: function (res) {
  4607. if (res == '401' || res == 401) {
  4608. window.location.href = '/thmz/login/view'
  4609. return;
  4610. }
  4611. var ress = eval(res);
  4612. if (ress.code == -1) {
  4613. errorMesage(res);
  4614. return {
  4615. "total": 0,//总页数
  4616. "rows": {} //数据
  4617. };
  4618. }
  4619. return {
  4620. "total": ress.data.length,//总页数
  4621. "rows": ress.data //数据
  4622. };
  4623. },
  4624. onClickRow: function (row, $element) {
  4625. $('#jcJyItem').webuiPopover('hide');
  4626. $("#jcJyZltype").val(row.type);
  4627. $("#execUnit").selectpicker('val', row.execUnit);//默认不选中
  4628. $("#execUnit").selectpicker('refresh');
  4629. if (row.type == 3) {
  4630. //诊疗
  4631. if ($("#zlTab").find("li") == null || $("#zlTab").find("li").length == 0) {
  4632. initNavTabs(2);
  4633. }
  4634. $("#jcJyItem").val(row.name);
  4635. $("#jcJyItem").blur();
  4636. $("#jcjyItemPrice").val(row.chargeAmount);
  4637. $("#chargeUnit").val(row.specification);
  4638. $("#current_code").val(row.code);
  4639. $("#jcJyItemChargeDetail").removeClass("in").addClass("hide");
  4640. $("#chargeUnitDiv").removeClass("hide").addClass("in");
  4641. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  4642. $("#yshPartDiv").removeClass("in").addClass("hide");
  4643. $("#itemQuantityDiv").removeClass("hide").addClass("in");
  4644. $("#itemQuantity").val(1);
  4645. $("#chargeUnit").focus();
  4646. // currentEleId = 'chargeUnit';
  4647. return;
  4648. }
  4649. if (row.type == 1) {
  4650. //检验
  4651. $("#jyZdSampleDiv").removeClass("hide").addClass("in");
  4652. $("#chargeUnitDiv").removeClass("in").addClass("hide");
  4653. $("#yshPartDiv").removeClass("in").addClass("hide");
  4654. if (row.sampleCode != null && row.sampleCode != "") {
  4655. $("#jyZdSample").selectpicker('val', row.sampleCode);
  4656. $('#jyZdSample').selectpicker('refresh');
  4657. }
  4658. } else if (row.type == 2) {
  4659. //检查
  4660. $("#yshPartDiv").removeClass("hide").addClass("in");
  4661. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  4662. $("#chargeUnitDiv").removeClass("in").addClass("hide");
  4663. if (row.bwCode != null && row.bwCode != "") {
  4664. $("#yshPart").selectpicker('val', row.bwCode);
  4665. $('#yshPart').selectpicker('refresh');
  4666. }
  4667. }
  4668. $("#itemQuantityDiv").removeClass("in").addClass("hide");
  4669. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  4670. checkJcJyItemInfo(row.code, row.name, row.type, true);
  4671. }
  4672. });
  4673. }
  4674. /**
  4675. * 诊疗与医技选中
  4676. * @param code
  4677. * @param name 回写的时候可以设置null
  4678. * @param type 1 检验 2 检查 3 诊疗
  4679. * @param async 当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  4680. */
  4681. //function checkJcJyItemInfo(code, name, type) {
  4682. function checkJcJyItemInfo(code, name, type, async) {
  4683. //判断是否有重复的项目 返回true 说明有重复的
  4684. if (verifyRepeat(code, null, 2)) {
  4685. return;
  4686. }
  4687. //不需要每次都关闭帮助树
  4688. //$("#treeButton").webuiPopover('hide');
  4689. $.ajax({
  4690. type: "GET",
  4691. url: '/thmz/getJcJyItemChargeByCode?code=' + code + '&jcJyZltype=' + type,
  4692. contentType: "application/json;charset=UTF-8",
  4693. dataType: "json",
  4694. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4695. async: async,//当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  4696. success: function (res) {
  4697. if (res == '401' || res == 401) {
  4698. window.location.href = '/thmz/login/view'
  4699. return;
  4700. }
  4701. if (res.code == 0) {
  4702. if (res.data != null) {
  4703. //如果
  4704. if ($("#zlTab").find("li") == null || $("#zlTab").find("li").length == 0) {
  4705. initNavTabs(2);
  4706. }
  4707. if (name == null) {
  4708. name = res.name;
  4709. }
  4710. $("#jcJyItem").val(name);
  4711. $("#jcJyItem").blur();
  4712. $("#jcjyItemPrice").val(res.totalAmount);
  4713. $("#current_code").val(code);
  4714. $("#execUnit").selectpicker('val', res.execUnit);//默认不选中
  4715. $("#execUnit").selectpicker('refresh');
  4716. // if (async) {
  4717. // if (type == 1) {
  4718. // //选中项目后,光标默认到数量输入框
  4719. // $("#jyZdSample").next().click();
  4720. // // currentEleId = 'jyZdSample';
  4721. // } else if (type == 2) {
  4722. // $("#yshPart").next().click();
  4723. // // currentEleId = 'yshPart';
  4724. // }
  4725. // }
  4726. }
  4727. } else {
  4728. errorMesage(res);
  4729. }
  4730. }
  4731. });
  4732. }
  4733. /**
  4734. * 查询诊疗与医技项目明细
  4735. * @param code 编码
  4736. * @param jcJyZltype 1 检验 2 检查
  4737. */
  4738. function getJcJyItemChargeByCode(code, jcJyZltype) {
  4739. if (code != null) {
  4740. $("#itemCodeSearch").val(code);
  4741. $("#jcJyZltypeSearch").val(jcJyZltype);
  4742. } else if ($("#current_code").val() == null || $("#current_code").val() == '') {
  4743. errorMesageSimaple("未选中任何项目!");
  4744. return;
  4745. }
  4746. $("#jcJyItemModal").modal("show");
  4747. $('#jcJyItemTable').bootstrapTable('refresh');
  4748. $('#jcJyItemTable').bootstrapTable({
  4749. url: '/thmz/getJcJyItemChargeByCode', //请求后台的URL(*)
  4750. method: 'GET', //请求方式(*)
  4751. toolbar: '#toolbar', //工具按钮用哪个容器
  4752. striped: true, //是否显示行间隔色
  4753. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  4754. pagination: false, //是否显示分页(*)
  4755. sortable: true, //是否启用排序
  4756. sortOrder: "asc", //排序方式
  4757. queryParams: function (params) {
  4758. var itemCodeSearch = $("#itemCodeSearch").val();
  4759. var jcJyZltypeSearch = $("#jcJyZltypeSearch").val();
  4760. if (itemCodeSearch == null || itemCodeSearch == "") {
  4761. itemCodeSearch = $("#current_code").val();
  4762. jcJyZltypeSearch = $("#jcJyZltype").val();
  4763. }
  4764. var temp = {
  4765. code: itemCodeSearch,
  4766. jcJyZltype: jcJyZltypeSearch
  4767. };
  4768. return temp;
  4769. }, //传递参数(*)
  4770. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  4771. pageNumber: 1, //初始化加载第一页,默认第一页
  4772. pageSize: 5, //每页的记录行数(*)
  4773. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  4774. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  4775. strictSearch: true,
  4776. showColumns: false, //是否显示所有的列
  4777. showRefresh: false, //是否显示刷新按钮
  4778. minimumCountColumns: 2, //最少允许的列数
  4779. clickToSelect: true, //是否启用点击选中行
  4780. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  4781. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  4782. cardView: false, //是否显示详细视图
  4783. detailView: false,
  4784. //rowStyle:rowStyle,//通过自定义函数设置行样式
  4785. ajaxOptions: {
  4786. headers: {
  4787. 'Accept': 'application/json',
  4788. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  4789. }
  4790. },
  4791. columns: [
  4792. {
  4793. field: 'tcCode',
  4794. title: '项目编码',
  4795. align: "center",
  4796. valign: 'middle',
  4797. // sortable: true
  4798. }, {
  4799. field: 'code',
  4800. title: '收费编码',
  4801. align: "center",
  4802. valign: 'middle',
  4803. // sortable: true
  4804. }
  4805. , {
  4806. field: 'name',
  4807. title: '收费名称',
  4808. align: "center",
  4809. valign: 'middle',
  4810. // sortable: true
  4811. }, {
  4812. field: 'num',
  4813. title: '数量',
  4814. align: "center",
  4815. valign: 'middle',
  4816. // sortable: true
  4817. }, {
  4818. field: 'chargeAmount',
  4819. title: '单价',
  4820. align: "center",
  4821. valign: 'middle',
  4822. // sortable: true
  4823. formatter: function (value, row, index) {
  4824. if (value == null || value == "") {
  4825. return 0;
  4826. }
  4827. return value.toFixed(2);
  4828. }
  4829. }, {
  4830. field: 'totalAmount',
  4831. title: '总金额',
  4832. align: "center",
  4833. valign: 'middle',
  4834. // sortable: true
  4835. formatter: function (value, row, index) {
  4836. if (value == null || value == "") {
  4837. return 0;
  4838. }
  4839. return value.toFixed(2);
  4840. }
  4841. }
  4842. ],
  4843. responseHandler: function (res) {
  4844. if (res == '401' || res == 401) {
  4845. window.location.href = '/thmz/login/view'
  4846. return;
  4847. }
  4848. $("#itemCodeSearch").val(null);
  4849. var ress = eval(res);
  4850. if (ress.code == -1) {
  4851. errorMesage(res);
  4852. return {
  4853. "total": 0,//总页数
  4854. "rows": {} //数据
  4855. };
  4856. }
  4857. return {
  4858. "total": ress.data.length,//总页数
  4859. "rows": ress.data //数据
  4860. };
  4861. }
  4862. });
  4863. }
  4864. /**
  4865. * 判断是否有重复的项目 返回true 说明有重复的
  4866. * @param code
  4867. * @param serial
  4868. * @param index
  4869. */
  4870. function verifyRepeat(code, serial, index) {
  4871. //是新增药品还是编辑 true 修改 默认false
  4872. var updateFlag = $("#update_flag").val();
  4873. if (updateFlag == undefined || updateFlag == null) {
  4874. updateFlag = false;
  4875. }
  4876. if (updateFlag == "true" || updateFlag == true) {
  4877. return false;
  4878. }
  4879. var tabId = null;
  4880. //西药
  4881. if (index == 0) {
  4882. tabId = "xyTab";
  4883. } else if (index == 1) {
  4884. //中成药
  4885. tabId = "zyTab";
  4886. } else if (index == 2) {
  4887. //医技与诊疗
  4888. tabId = "zlTab";
  4889. } else if (index == 3) {
  4890. //入院
  4891. tabId = "zyReqTab";
  4892. }
  4893. var tableId = $("#" + tabId + " li.active").find("a").attr("href");
  4894. var items = $(tableId).find("div:eq(0)").find("div.form-group");
  4895. var groupId = null;
  4896. if (index == 0) {
  4897. groupId = $("#groupId").val();
  4898. }
  4899. if (items != null && items.length > 0) {
  4900. for (var i = 0; i < items.length; i++) {
  4901. if (serial == null) {
  4902. //西药需要判断组号,因为可能会有不同组的皮试用药,需要相同的药品
  4903. if (index == 0) {
  4904. var temporary_items_code = $(items[i]).find("input.temporary_items_code").val();
  4905. var temporary_items_groupId = $(items[i]).find("input.temporary_items_groupId").val();
  4906. if (code === temporary_items_code && groupId === temporary_items_groupId) {
  4907. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  4908. return true;
  4909. }
  4910. } else {
  4911. var temporary_items_code = $(items[i]).find("input.temporary_items_code").val();
  4912. if (code === temporary_items_code) {
  4913. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  4914. return true;
  4915. }
  4916. }
  4917. } else {
  4918. if (index == 0) {
  4919. var temporary_items_groupId = $(items[i]).find("input.temporary_items_groupId").val();
  4920. var temporary_items_code = $(items[i]).find("input.temporary_items_code").val();
  4921. var temporary_items_serial = $(items[i]).find("input.temporary_items_serial").val();
  4922. if (code === temporary_items_code && serial === temporary_items_serial && groupId === temporary_items_groupId) {
  4923. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  4924. return true;
  4925. }
  4926. } else {
  4927. var temporary_items_code = $(items[i]).find("input.temporary_items_code").val();
  4928. var temporary_items_serial = $(items[i]).find("input.temporary_items_serial").val();
  4929. if (code === temporary_items_code && serial === temporary_items_serial) {
  4930. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  4931. return true;
  4932. }
  4933. }
  4934. }
  4935. }
  4936. }
  4937. return false;
  4938. }
  4939. /**
  4940. * 初始化处方分页
  4941. * @param index 0 西药 1 中药 2 诊疗 3 入院
  4942. */
  4943. function initNavTabs(index) {
  4944. var tabId = null;
  4945. var tabContentId = null;
  4946. var paneId = null;
  4947. var cfdesc = '普药';
  4948. //西药
  4949. if (index == 0) {
  4950. tabId = "xyTab";
  4951. tabContentId = "xyTabContent";
  4952. paneId = "xycf_" + getUID();
  4953. } else if (index == 1) {
  4954. //中草药
  4955. tabId = "zyTab";
  4956. tabContentId = "zyTabContent";
  4957. paneId = "zycf_" + getUID();
  4958. cfdesc = '中草药';
  4959. } else if (index == 2) {
  4960. //医技
  4961. tabId = "zlTab";
  4962. tabContentId = "zlTabContent";
  4963. paneId = "zlcf_" + getUID();
  4964. cfdesc = '医技与诊疗';
  4965. } else if (index == 3) {
  4966. //医技
  4967. tabId = "zyReqTab";
  4968. tabContentId = "zyReqTabContent";
  4969. paneId = "zyReqcf_" + getUID();
  4970. cfdesc = '入院';
  4971. }
  4972. $("#" + tabId).html('<li class="active"><a href="#' + paneId + '" role="tab" data-toggle="tab">处方 <small class="cfdesc">(' + cfdesc + ')</small></a></li>');
  4973. var html = '<div class="tab-pane fade in active" id="' + paneId + '" style="height: 100%;min-height: 285px;position: relative;">';
  4974. html += '<img src="/thmz/images/prescription.png" style="margin-top: 5px;"/>';
  4975. html += '<input class="current_groupNo" type="hidden"/>';
  4976. html += ' <div class="cf_content rb_item" style="height: 230px;padding-top: 5px;overflow-y: auto;"></div>' +
  4977. ' <div style="height: 30px;border-top: 1px solid #ddd;width: 100%;position: absolute;bottom:0;padding-top: 10px;">';
  4978. html += '<div style="width: 460px;">'
  4979. if (index == 1) {
  4980. html += ' <div style="width: 130px;float: left;">' +
  4981. ' <label class="my_label_2">付数:</label>' +
  4982. ' <input type="text" class="form-control my_label_input_2 zyfs" id="zyfs"' +
  4983. ' placeholder="请输入" style="padding-left: 10px;" onchange="calculateZyAmount()">' +
  4984. ' </div>';
  4985. html += '<div style="width: 130px;float: left;">' +
  4986. ' <label class="my_label_2">频次:</label>' +
  4987. ' <div style="width: 85px;float: right;">' +
  4988. ' <select class="form-control selectpicker show-tick zy_orderFrequency"' +
  4989. ' title="请选择" data-live-search="true" onchange="calculate()" id="zy_orderFrequency_1">' +
  4990. ' </select>' +
  4991. ' </div>' +
  4992. ' </div>';
  4993. html += '<div style="width: 180px;float: left;">' +
  4994. ' <label class="my_label_2">用法:</label>' +
  4995. ' <div style="width: 135px;float: left;">' +
  4996. ' <select class="form-control selectpicker show-tick useType"' +
  4997. ' title="请选择" id="useType_1">' +
  4998. ' </select>' +
  4999. ' </div>' +
  5000. ' </div>';
  5001. html += '</div><div style="width: 460px;">'
  5002. html += '<input id="singleAmount" type="hidden"/>';
  5003. }
  5004. html += '<div style="width: 130px;float: left;padding-left: 7px;padding-top: 8px;">金额:<span class="cf_amount">0.0</span><span>元</span></div>';
  5005. //html += '<div style="width: 130px;float: left;padding-left: 7px;padding-top: 8px;"></div>';
  5006. if (index == 1) {
  5007. html += '<div style="width: 130px;float: left;">' +
  5008. ' <label class="my_label_2">液型:</label>' +
  5009. ' <div style="width: 85px;float: right;">' +
  5010. ' <select class="form-control selectpicker show-tick water" id="cyJssm">' +
  5011. ' </select>' +
  5012. ' </div>' +
  5013. ' </div>';
  5014. html += ' <div style="width: 180px;float: left;">' +
  5015. ' <label class="my_label_2">煎法:</label>' +
  5016. ' <div style="width: 135px;float: left;">' +
  5017. ' <select class="form-control selectpicker show-tick zy_supplyType"' +
  5018. ' title="请选择" id="zy_supplyType_1" onchange="calculateTotalAmount()">' +
  5019. ' </select>' +
  5020. ' </div>' +
  5021. ' </div>';
  5022. }
  5023. if (index == 0) {
  5024. html += '<div style="width: 310px;float: left;color: red;padding-top: 8px;">说明:此费用包含药品给药方式所产生的费用!</div>';
  5025. }
  5026. // else if (index == 1) {
  5027. // html += '<div style="width: 310px;float: left;color: red;padding-top: 8px;">说明:此费用包含药品代煎所产生的费用!</div>';
  5028. // }
  5029. html += '</div></div></div>';
  5030. $("#" + tabContentId).html(html);
  5031. if (index == 1) {
  5032. 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>';
  5033. $('.useType').html(useType);
  5034. $('.useType').selectpicker('refresh');
  5035. var water = '<option value="加凉水">加凉水</option><option value="加温水">加温水</option><option value="加开水">加开水</option><option value="加冰水">加冰水</option><option value="加糖水">加糖水</option>';
  5036. $('.water').html(water);
  5037. $('.water').selectpicker('refresh');
  5038. initOrderFrequencys("zy_orderFrequency_1", false);
  5039. initZySupplyTypes("zy_supplyType_1", false);
  5040. }
  5041. }
  5042. /**
  5043. * 清空处方分页
  5044. * @param index 0 西药 1 中药 2 诊疗 3 入院
  5045. */
  5046. function clearNavTabs(index) {
  5047. var tabId = null;
  5048. var tabContentId = null;
  5049. //西药
  5050. if (index == 0) {
  5051. tabId = "xyTab";
  5052. tabContentId = "xyTabContent";
  5053. } else if (index == 1) {
  5054. //中草药
  5055. tabId = "zyTab";
  5056. tabContentId = "zyTabContent";
  5057. } else if (index == 2) {
  5058. //医技
  5059. tabId = "zlTab";
  5060. tabContentId = "zlTabContent";
  5061. } else if (index == 3) {
  5062. //医技
  5063. tabId = "zyReqTab";
  5064. tabContentId = "zyReqTabContent";
  5065. }
  5066. $("#" + tabId).html(null);
  5067. $("#" + tabContentId).html(null);
  5068. }
  5069. /**
  5070. * 添加处方分页
  5071. * @param index 0 西药 1 中药 2 诊疗 3 入院
  5072. * @param groupNo 71 普通西药 91 医材 111 麻、精一 131 精二 151 诊疗
  5073. */
  5074. function refreshNavTabs(index, groupNo) {
  5075. var tabId = null;
  5076. var tabContentId = null;
  5077. var paneIdPrfix = null;
  5078. var cfdesc = '普药';
  5079. //西药
  5080. if (index == 0) {
  5081. tabId = "xyTab";
  5082. tabContentId = "xyTabContent";
  5083. paneIdPrfix = "xycf_";
  5084. if (groupNo == '91') {
  5085. cfdesc = '医材';
  5086. } else if (groupNo == '111') {
  5087. cfdesc = '麻、精一';
  5088. } else if (groupNo == '131') {
  5089. cfdesc = '精二';
  5090. }
  5091. // else if(groupNo=='151'){
  5092. // cfdesc='诊疗';
  5093. // }
  5094. } else if (index == 1) {
  5095. //中草药
  5096. tabId = "zyTab";
  5097. tabContentId = "zyTabContent";
  5098. paneIdPrfix = "zycf_";
  5099. cfdesc = '中草药';
  5100. } else if (index == 2) {
  5101. //医技
  5102. tabId = "zlTab";
  5103. tabContentId = "zlTabContent";
  5104. paneIdPrfix = "zlcf_";
  5105. cfdesc = '医技与诊疗';
  5106. } else if (index == 3) {
  5107. //入院
  5108. tabId = "zyReqTab";
  5109. tabContentId = "zyReqTabContent";
  5110. paneIdPrfix = "zyReqcf_";
  5111. cfdesc = '入院';
  5112. }
  5113. // var tableId = $("#"+tabId+" li.active").find("a").attr("href");
  5114. // var length = $(tableId).find("div:eq(0)").children().length;
  5115. // if(length==0){
  5116. // //当前处方是空白的,不需要新增处方
  5117. // return;
  5118. // }
  5119. var cfTitle = "处方" + " <small class=\"cfdesc\">(" + cfdesc + ")</small>";
  5120. var paneId = paneIdPrfix + getUID();
  5121. //清除选中的样式
  5122. $("#" + tabId).find("li.active").removeClass("active");
  5123. $("#" + tabId).append('<li><a href="#' + paneId + '" role="tab" data-toggle="tab">' + cfTitle + '</a></li>');
  5124. var html = '<div class="tab-pane fade in active" id="' + paneId + '" style="height: 100%;min-height: 285px;position: relative;">' +
  5125. '<img src="/thmz/images/prescription.png" style="margin-top: 5px;"/>' +
  5126. '<input class="current_groupNo" type="hidden"/>' +
  5127. ' <div class="cf_content rb_item" style="height: 230px;padding-top: 5px;overflow-y: auto;"></div>' +
  5128. ' <div style="height: 30px;border-top: 1px solid #ddd;width: 100%;position: absolute;bottom:0;">' +
  5129. '<div style="width: 460px;">' +
  5130. '<div style="width: 130px;float: left;padding-left: 7px;padding-top: 8px;">金额:<span class="cf_amount">0.0</span><span>元</span></div>';
  5131. if (index == 0) {
  5132. html += '<div style="width: 310px;float: left;color: red;padding-top: 8px;">说明:此费用包含药品给药方式所产生的费用!</div>';
  5133. }
  5134. html += '</div></div>';
  5135. $("#" + tabContentId).append(html);
  5136. //切换处方
  5137. $("#" + tabId).find("a[href='#" + paneId + "']").off("click").tab('show');
  5138. }
  5139. /**
  5140. * 填充西药选中的内容
  5141. * @param res
  5142. * @param groupNo
  5143. */
  5144. function fitWesternMedicine(res, groupNo) {
  5145. $("#western_medicine_name").val(res.data.name);
  5146. $("#western_medicine_name").blur();
  5147. var drugWinHtml = '';
  5148. var index = null;
  5149. if (res.data.weight != null) {
  5150. $("#drugWin").val(res.data.weight);
  5151. $("#drugWinDb").val(res.data.weight);
  5152. drugWinHtml = '<option value="' + res.data.weighUnit + '" desc="' + res.data.weight + '">' + res.data.weighUnitDesc + '</option>';
  5153. index = res.data.weighUnit;
  5154. }
  5155. if (res.data.volum != null) {
  5156. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  5157. $("#drugWin").val(res.data.volum);
  5158. $("#drugWinDb").val(res.data.volum);
  5159. }
  5160. drugWinHtml += '<option value="' + res.data.volUnit + '" desc="' + res.data.volum + '">' + res.data.volUnitDesc + '</option>';
  5161. if (index == null) {
  5162. index = res.data.volUnit;
  5163. }
  5164. }
  5165. if (res.data.miniUnit != null && res.data.miniUnit != "") {
  5166. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  5167. $("#drugWin").val(1);
  5168. $("#drugWinDb").val(1);
  5169. }
  5170. drugWinHtml += '<option value="' + res.data.miniUnit + '" desc="1">' + res.data.miniUnitDesc + '</option>';
  5171. if (index == null) {
  5172. index = res.data.miniUnit;
  5173. }
  5174. }
  5175. $('#drugWinUnit').html(drugWinHtml);
  5176. $('#drugWinUnit').selectpicker('refresh');
  5177. $("#drugWinUnit").selectpicker('val', index);
  5178. $('#drugWinUnit').selectpicker('refresh');
  5179. if (res.data.packUnitDesc != null && res.data.packUnitDesc != "") {
  5180. var html = '<option value="' + res.data.packUnitDesc + '" >' + res.data.packUnitDesc + '</option>';
  5181. $('#packUnit').html(html);
  5182. $('#packUnit').selectpicker('refresh');
  5183. $("#packUnit").selectpicker('val', res.data.packUnitDesc);
  5184. $('#packUnit').selectpicker('refresh');
  5185. }
  5186. $("#packRetprice").val(res.data.packRetprice);
  5187. $("#packSize").val(res.data.packSize);
  5188. $("#current_code").val(res.data.code);
  5189. $("#current_serial").val(res.data.serial);
  5190. if ($("#dayNum").val() == null) {
  5191. //天数 同组药品天数相同
  5192. $("#dayNum").selectpicker('val', 1);
  5193. $('#dayNum').selectpicker('refresh');
  5194. }
  5195. if ($("#supplyType").val() == null && res.data.supplyType != null) {
  5196. // 给药方式 同组药品给药方式相同
  5197. $("#supplyType").selectpicker('val', res.data.supplyType);
  5198. $('#supplyType').selectpicker('refresh');
  5199. }
  5200. if ($("#orderFrequency").val() == null && res.data.frequency != null) {
  5201. //频次编码 同组药品频次编码相同
  5202. $("#orderFrequency").selectpicker('val', res.data.frequency);
  5203. $('#orderFrequency').selectpicker('refresh');
  5204. }
  5205. if ($("#orderFrequency").val() == null) {
  5206. //频次编码 防止频次为空
  5207. $("#orderFrequency").selectpicker('val', "ONCE");
  5208. $('#orderFrequency').selectpicker('refresh');
  5209. }
  5210. if (res.data.psFlag != null && (res.data.psFlag == 1 || res.data.psFlag == "1")) {
  5211. $("#tryFlag").parent().addClass("checked");
  5212. $("#tryFlag").parent().parent().parent().removeClass("hide").addClass("in");
  5213. } else {
  5214. $("#tryFlag").parent().removeClass("checked");
  5215. $("#tryFlag").parent().parent().parent().removeClass("in").addClass("hide");
  5216. }
  5217. $("#manufactoryName").val(res.data.manufactoryName);
  5218. $("#specification").val(res.data.specification);
  5219. // if (groupNo == "91") {
  5220. // //医材
  5221. // $("#gross").removeAttr("readonly")
  5222. // } else {
  5223. // $("#gross").attr("readonly", "readonly");
  5224. // }
  5225. calculate();
  5226. $("#western_medicine_name").focus();
  5227. }
  5228. /**
  5229. * 剂量单位改变事件
  5230. */
  5231. function drugWinUnitChange() {
  5232. var desc = $('#drugWinUnit').find("option:selected").attr('desc');
  5233. $("#drugWin").val(desc);
  5234. $("#drugWinDb").val(desc);
  5235. calculate();
  5236. }
  5237. /**
  5238. * 根据选择的内容计算总的用药量
  5239. */
  5240. function calculate() {
  5241. //最小规格剂量
  5242. var drugWinDb = $("#drugWinDb").val();
  5243. //天数
  5244. var dayNum = $("#dayNum").val();
  5245. //当前使用的最小剂量
  5246. var drugWin = $("#drugWin").val();
  5247. //频率
  5248. var times = $('#orderFrequency').find("option:selected").attr('desc');
  5249. //包装规格数量
  5250. var packSize = $("#packSize").val();
  5251. //单价
  5252. var packRetprice = $("#packRetprice").val();
  5253. //当前药房编码
  5254. var currentGroupNo = $("#current_groupNo").val();
  5255. if (drugWinDb == null || drugWinDb === "") {
  5256. if (currentGroupNo == '71') {
  5257. return;
  5258. }
  5259. drugWinDb = 1;
  5260. }
  5261. if (dayNum == null || dayNum === "") {
  5262. if (currentGroupNo == '71') {
  5263. return;
  5264. }
  5265. dayNum = 1;
  5266. }
  5267. if (drugWin == null || drugWin === "") {
  5268. if (currentGroupNo == '71') {
  5269. return;
  5270. }
  5271. drugWin = 1;
  5272. }
  5273. if (times == null || times === "") {
  5274. if (currentGroupNo == '71') {
  5275. return;
  5276. }
  5277. times = 1;
  5278. }
  5279. if (packSize == null || packSize === "") {
  5280. return;
  5281. }
  5282. //拆零总量
  5283. var scatteredTotalNum = Multiply(Multiply(dayNum, drugWin), times);
  5284. //整包装的数量
  5285. var totalNum = Math.ceil(Division(scatteredTotalNum, Multiply(packSize, drugWinDb)));
  5286. $("#gross").val(totalNum);
  5287. $("#totalRetprice").val(Multiply(totalNum, packRetprice).toFixed(2));
  5288. }
  5289. /**
  5290. * 根据选择的总量计算金额 只有医材的时候需要计算
  5291. */
  5292. function calculateSimple() {
  5293. //总量
  5294. var gross = $("#gross").val();
  5295. //单价
  5296. var packRetprice = $("#packRetprice").val();
  5297. $("#totalRetprice").val(Multiply(gross, packRetprice).toFixed(2));
  5298. //当前药房编码
  5299. var currentGroupNo = $("#current_groupNo").val();
  5300. if (currentGroupNo == '91') {
  5301. //医材默认天数为1
  5302. $("#dayNum").selectpicker('val', 1);
  5303. $('#dayNum').selectpicker('refresh');
  5304. $("#orderFrequency").selectpicker('val', "ONCE");
  5305. $('#orderFrequency').selectpicker('refresh');
  5306. }
  5307. }
  5308. /**
  5309. * 根据中药付数计算金额
  5310. */
  5311. function calculateZyAmount() {
  5312. var singleAmount = $("#singleAmount").val();
  5313. var tableId = $("#zyTab li.active").find("a").attr("href");
  5314. //获取中药付数
  5315. var zyfs = $(tableId).find("input.zyfs").val();
  5316. var cfAmount = Multiply(zyfs, singleAmount);
  5317. $(tableId).find("span.cf_amount").html(cfAmount);
  5318. calculateTotalAmount();
  5319. }
  5320. /**
  5321. * 将病人信息填入患者信息修改form
  5322. * @param patinet
  5323. */
  5324. function fillPlusPatinet(patinet) {
  5325. if (patinet != null) {
  5326. $("#editUserCode").val(patinet.patientId);
  5327. $("#editUserName").val(patinet.name);
  5328. $("#editUserName").blur();
  5329. $("#editUserAge").val(patinet.age);
  5330. $("#editUserAge").blur();
  5331. $("#editUserGender").selectpicker('val', patinet.sex);
  5332. $("#editUserGender").selectpicker('refresh');
  5333. $("#editUserGender").blur();
  5334. $("#editUserBirthDay").val(patinet.birthDayStr);
  5335. $("#editUserBirthDay").blur();
  5336. $('#editUserCertificateType').selectpicker('val', patinet.certificateType);
  5337. $('#editUserCertificateType').selectpicker('refresh');
  5338. $("#editUserCardNo").val(patinet.icCardNo);
  5339. $("#editUserCardNo").attr("title", patinet.icCardNo);
  5340. $("#editUserCardNo").blur();
  5341. $("#editUserPhoneNum").val(patinet.phoneNo);
  5342. $("#editUserPhoneNum").attr("title", patinet.phoneNo);
  5343. $("#editUserPhoneNum").blur();
  5344. $("#editUserPatientsNature").selectpicker('val', patinet.responseType);//默认选中
  5345. $('#editUserPatientsNature').selectpicker('refresh');
  5346. $("#editUserPatientsNature").blur();
  5347. $("#editUserIdCard").val(patinet.socialNo);
  5348. $("#editUserIdCard").attr("title", patinet.socialNo);
  5349. $("#editUserIdCard").blur();
  5350. $("#editUserAddress").val(patinet.address);
  5351. $("#editUserAddress").blur();
  5352. $("#editUserContact").val(patinet.relName);
  5353. $("#editUserContactPhone").val(patinet.contractName);
  5354. }
  5355. }
  5356. /**
  5357. * 修改病人信息
  5358. */
  5359. function modifyPatient() {
  5360. $.ajax({
  5361. type: "POST",
  5362. url: '/thmz/modifyPatient',
  5363. contentType: "application/json;charset=UTF-8",
  5364. dataType: "json",
  5365. data: JSON.stringify({
  5366. "name": $("#editUserName").val(),
  5367. "age": $("#editUserAge").val(),
  5368. "sex": $("#editUserGender").val(),
  5369. "birthDay": $("#editUserBirthDay").val(),
  5370. "certificateType": $("#editUserCertificateType").val(),
  5371. "icCardNo": $("#editUserCardNo").val(),
  5372. "phoneNo": $("#editUserPhoneNum").val(),
  5373. "responseType": $("#editUserPatientsNature").val(),
  5374. "socialNo": $("#editUserIdCard").val(),
  5375. "address": $("#editUserAddress").val(),
  5376. "patientId": $("#editUserCode").val(),
  5377. "relName": $("#editUserContact").val(),
  5378. "contractName": $("#editUserContactPhone").val()
  5379. }),
  5380. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5381. success: function (res) {
  5382. if (res == '401' || res == 401) {
  5383. window.location.href = '/thmz/login/view'
  5384. return;
  5385. }
  5386. if (res.code == 0) {
  5387. $('#editUserModal').modal('hide');
  5388. realClinicalReception($("#patientId").text(), $("#mzfzSerialNoInClick").val());
  5389. clearPlusPatinet();
  5390. } else {
  5391. errorMesage(res);
  5392. }
  5393. }
  5394. });
  5395. }
  5396. /**
  5397. * 将病人信息修改域置空
  5398. * @param patinet
  5399. */
  5400. function clearPlusPatinet() {
  5401. $("#editUserCode").val(null);
  5402. $("#editUserName").val(null);
  5403. $("#editUserAge").val(null);
  5404. $("#editUserGender").selectpicker('val', '1');
  5405. $("#editUserGender").selectpicker('refresh');
  5406. $("#editUserBirthDay").val(null);
  5407. $('#editUserCertificateType').selectpicker('val', '01');
  5408. $('#editUserCertificateType').selectpicker('refresh');
  5409. $("#editUserCardNo").val(null);
  5410. $("#editUserCardNo").attr("title", null);
  5411. $("#editUserPhoneNum").val(null);
  5412. $("#editUserPhoneNum").attr("title", null);
  5413. $("#editUserPatientsNature").selectpicker('val', '01');//默认选中
  5414. $('#editUserPatientsNature').selectpicker('refresh');
  5415. $("#editUserIdCard").val(null);
  5416. $("#editUserIdCard").attr("title", null);
  5417. $("#editUserAddress").val(null);
  5418. $("#editUserContact").val(null);
  5419. $("#editUserContactPhone").val(null);
  5420. }
  5421. // /**
  5422. // * 保存入院证
  5423. // */
  5424. // function saveBeHospitalized() {
  5425. // $.ajax({
  5426. // type: "POST",
  5427. // url: '/thmz/saveMzZyReq',
  5428. // contentType: "application/json;charset=UTF-8",
  5429. // dataType: "json",
  5430. // data: JSON.stringify({
  5431. // "patientId": $("#patientId").text(),
  5432. // "icdCode": $("#icdCodeBeHospitalized").val(),
  5433. // "icdText": $("#icdTextBeHospitalized").val(),
  5434. // "reqDept": $("#inpatientWardBeHospitalized").val(),
  5435. // "smallDept": $("#smallWardBeHospitalized").val(),
  5436. // "admissStatus": $("#admissStatus").val()
  5437. // }),
  5438. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5439. // success: function (res) {
  5440. // if (res == '401' || res == 401) {
  5441. // window.location.href = '/thmz/login/view'
  5442. // return;
  5443. // }
  5444. // if (res.code == 0) {
  5445. // successMesage(res);
  5446. // $('#beHospitalizedModal').modal('hide');
  5447. // loadInClinicTableList();
  5448. // loadClinicTableList();
  5449. // clearWorkSpace();
  5450. // } else {
  5451. // errorMesage(res);
  5452. // }
  5453. // }
  5454. // });
  5455. // }
  5456. /**
  5457. * 获取按钮组选择的下标
  5458. * @param id
  5459. * @returns {number}
  5460. */
  5461. function getIndex(id) {
  5462. var index = 0;
  5463. var item = $("#" + id).find("button");
  5464. for (var i = 0; i <= item.length; i++) {
  5465. if ($(item[i]).hasClass("btn-primary")) {
  5466. index = i;
  5467. break;
  5468. }
  5469. }
  5470. return index;
  5471. }
  5472. /**
  5473. * 获取时间选择器的时间数组
  5474. * @returns {string[]}
  5475. */
  5476. function getRePortRangeArr() {
  5477. var rePortRange = $('#reportrange span').html();
  5478. var rePortRangeArr = rePortRange.split(" - ");
  5479. rePortRangeArr[0] = rePortRangeArr[0] + " 00:00:00"
  5480. rePortRangeArr[1] = rePortRangeArr[1] + " 23:59:59"
  5481. return rePortRangeArr;
  5482. }
  5483. /**
  5484. * 初始医生工作太配置
  5485. */
  5486. function initWorkspaceConfigForCurrent() {
  5487. $.ajax({
  5488. type: "GET",
  5489. url: '/thmz/getWorkspaceConfigForCurrent',
  5490. dataType: "json",
  5491. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5492. success: function (res) {
  5493. if (res == '401' || res == 401) {
  5494. window.location.href = '/thmz/login/view'
  5495. return;
  5496. }
  5497. if (res.code == 0) {
  5498. if (res.data.symptomFlag == 1) {
  5499. $("#symptomFlag").removeClass("in").addClass("hide");
  5500. if ($("#symptomFlagCheck").parent().hasClass("checked")) {
  5501. $("#symptomFlagCheck").parent().parent().click();//当前选中改为不选中
  5502. }
  5503. } else if (res.data.symptomFlag == 0) {
  5504. $("#symptomFlag").removeClass("hide").addClass("in");
  5505. if (!$("#symptomFlagCheck").parent().hasClass("checked")) {
  5506. $("#symptomFlagCheck").parent().parent().click();//当前不选中改为选中
  5507. }
  5508. }
  5509. if (res.data.emrHpiFlag == 1) {
  5510. $("#emrHpiFlag").removeClass("in").addClass("hide");
  5511. if ($("#emrHpiFlagCheck").parent().hasClass("checked")) {
  5512. $("#emrHpiFlagCheck").parent().parent().click();//当前选中改为不选中
  5513. }
  5514. } else if (res.data.emrHpiFlag == 0) {
  5515. $("#emrHpiFlag").removeClass("hide").addClass("in");
  5516. if (!$("#emrHpiFlagCheck").parent().hasClass("checked")) {
  5517. $("#emrHpiFlagCheck").parent().parent().click();//当前不选中改为选中
  5518. }
  5519. }
  5520. if (res.data.emrPsFlag == 1) {
  5521. $("#emrPsFlag").removeClass("in").addClass("hide");
  5522. if ($("#emrPsFlagCheck").parent().hasClass("checked")) {
  5523. $("#emrPsFlagCheck").parent().parent().click();//当前选中改为不选中
  5524. }
  5525. } else if (res.data.emrPsFlag == 0) {
  5526. $("#emrPsFlag").removeClass("hide").addClass("in");
  5527. if (!$("#emrPsFlagCheck").parent().hasClass("checked")) {
  5528. $("#emrPsFlagCheck").parent().parent().click();//当前不选中改为选中
  5529. }
  5530. }
  5531. if (res.data.personalHistoryFlag == 1) {
  5532. $("#personalHistoryFlag").removeClass("in").addClass("hide");
  5533. if ($("#personalHistoryFlagCheck").parent().hasClass("checked")) {
  5534. $("#personalHistoryFlagCheck").parent().parent().click();//当前选中改为不选中
  5535. }
  5536. } else if (res.data.personalHistoryFlag == 0) {
  5537. $("#personalHistoryFlag").removeClass("hide").addClass("in");
  5538. if (!$("#personalHistoryFlagCheck").parent().hasClass("checked")) {
  5539. $("#personalHistoryFlagCheck").parent().parent().click();//当前不选中改为选中
  5540. }
  5541. }
  5542. if (res.data.familyHistoryFlag == 1) {
  5543. $("#familyHistoryFlag").removeClass("in").addClass("hide");
  5544. if ($("#familyHistoryFlagCheck").parent().hasClass("checked")) {
  5545. $("#familyHistoryFlagCheck").parent().parent().click();//当前选中改为不选中
  5546. }
  5547. } else if (res.data.familyHistoryFlag == 0) {
  5548. $("#familyHistoryFlag").removeClass("hide").addClass("in");
  5549. if (!$("#familyHistoryFlagCheck").parent().hasClass("checked")) {
  5550. $("#familyHistoryFlagCheck").parent().parent().click();//当前不选中改为选中
  5551. }
  5552. }
  5553. if (res.data.obstericalHistoryFlag == 1) {
  5554. $("#obstericalHistoryFlag").removeClass("in").addClass("hide");
  5555. if ($("#obstericalHistoryFlagCheck").parent().hasClass("checked")) {
  5556. $("#obstericalHistoryFlagCheck").parent().parent().click();//当前选中改为不选中
  5557. }
  5558. } else if (res.data.obstericalHistoryFlag == 0) {
  5559. $("#obstericalHistoryFlag").removeClass("hide").addClass("in");
  5560. if (!$("#obstericalHistoryFlagCheck").parent().hasClass("checked")) {
  5561. $("#obstericalHistoryFlagCheck").parent().parent().click();//当前不选中改为选中
  5562. }
  5563. }
  5564. if (res.data.pressureLeftFlag == 1) {
  5565. $("#pressureLeftFlag").removeClass("in").addClass("hide");
  5566. if ($("#pressureLeftFlagCheck").parent().hasClass("checked")) {
  5567. $("#pressureLeftFlagCheck").parent().parent().click();//当前选中改为不选中
  5568. }
  5569. } else if (res.data.pressureLeftFlag == 0) {
  5570. $("#pressureLeftFlag").removeClass("hide").addClass("in");
  5571. if (!$("#pressureLeftFlagCheck").parent().hasClass("checked")) {
  5572. $("#pressureLeftFlagCheck").parent().parent().click();//当前不选中改为选中
  5573. }
  5574. }
  5575. if (res.data.tentativeDiagnosisFlag == 1) {
  5576. $("#tentativeDiagnosisFlag").removeClass("in").addClass("hide");
  5577. if ($("#tentativeDiagnosisFlagCheck").parent().hasClass("checked")) {
  5578. $("#tentativeDiagnosisFlagCheck").parent().parent().click();//当前选中改为不选中
  5579. }
  5580. } else if (res.data.tentativeDiagnosisFlag == 0) {
  5581. $("#tentativeDiagnosisFlag").removeClass("hide").addClass("in");
  5582. if (!$("#tentativeDiagnosisFlagCheck").parent().hasClass("checked")) {
  5583. $("#tentativeDiagnosisFlagCheck").parent().parent().click();//当前不选中改为选中
  5584. }
  5585. }
  5586. } else {
  5587. errorMesage(res);
  5588. }
  5589. }
  5590. });
  5591. }
  5592. /**
  5593. * 保存医生工作台配置
  5594. */
  5595. function saveWorkspaceConfig() {
  5596. var symptomFlag = $("#symptomFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  5597. var emrHpiFlag = $("#emrHpiFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  5598. var emrPsFlag = $("#emrPsFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  5599. var personalHistoryFlag = $("#personalHistoryFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  5600. var familyHistoryFlag = $("#familyHistoryFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  5601. var obstericalHistoryFlag = $("#obstericalHistoryFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  5602. var pressureLeftFlag = $("#pressureLeftFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  5603. var tentativeDiagnosisFlag = $("#tentativeDiagnosisFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  5604. $.ajax({
  5605. type: "POST",
  5606. url: '/thmz/saveWorkspaceConfig',
  5607. contentType: "application/json;charset=UTF-8",
  5608. dataType: "json",
  5609. data: JSON.stringify({
  5610. "symptomFlag": symptomFlag,
  5611. "emrHpiFlag": emrHpiFlag,
  5612. "emrPsFlag": emrPsFlag,
  5613. "personalHistoryFlag": personalHistoryFlag,
  5614. "familyHistoryFlag": familyHistoryFlag,
  5615. "obstericalHistoryFlag": obstericalHistoryFlag,
  5616. "pressureLeftFlag": pressureLeftFlag,
  5617. "tentativeDiagnosisFlag": tentativeDiagnosisFlag
  5618. }),
  5619. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5620. success: function (res) {
  5621. if (res == '401' || res == 401) {
  5622. window.location.href = '/thmz/login/view'
  5623. return;
  5624. }
  5625. if (res.code == 0) {
  5626. //successMesage(res);
  5627. initWorkspaceConfigForCurrent();
  5628. $("#configWorkspaceModal").modal("hide");
  5629. } else {
  5630. errorMesage(res);
  5631. }
  5632. }
  5633. });
  5634. }
  5635. /**
  5636. * 初始化药品,检查检验菜单树
  5637. */
  5638. function initzTree() {
  5639. var index = getIndex("bill_item_group");
  5640. if (index == 0) {
  5641. $("#western_medicine_name").webuiPopover('hide');
  5642. $.ajax({
  5643. type: "GET",
  5644. url: '/thmz/getYpZdClasses',
  5645. contentType: "application/json;charset=UTF-8",
  5646. dataType: "json",
  5647. async: false,
  5648. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5649. success: function (res) {
  5650. if (res == '401' || res == 401) {
  5651. window.location.href = '/thmz/login/view'
  5652. return;
  5653. }
  5654. if (res.code == 0) {
  5655. // zTree 的参数配置,深入使用请参考 API 文档(setting 配置详解)
  5656. var setting = {
  5657. callback: {
  5658. onClick: zTreeOnClick
  5659. }
  5660. };
  5661. $.fn.zTree.init($("#treeDemo"), setting, res.data);
  5662. var webuiId=$("#treeButton").attr("data-target");
  5663. var top=$("#"+webuiId).css("top");
  5664. if(top.indexOf("-")==0){
  5665. $("#"+webuiId).css("top",'0px');
  5666. }
  5667. } else {
  5668. errorMesage(res);
  5669. }
  5670. }
  5671. });
  5672. } else if (index == 2) {
  5673. $("#jcJyItem").webuiPopover('hide');
  5674. $.ajax({
  5675. type: "GET",
  5676. url: '/thmz/getJyJcZdClasses',
  5677. contentType: "application/json;charset=UTF-8",
  5678. dataType: "json",
  5679. async: false,
  5680. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5681. success: function (res) {
  5682. if (res == '401' || res == 401) {
  5683. window.location.href = '/thmz/login/view'
  5684. return;
  5685. }
  5686. if (res.code == 0) {
  5687. // zTree 的参数配置,深入使用请参考 API 文档(setting 配置详解)
  5688. var setting = {
  5689. callback: {
  5690. onClick: zTreeOnClick
  5691. }
  5692. };
  5693. $.fn.zTree.init($("#treeDemo"), setting, res.data);
  5694. var webuiId=$("#treeButton").attr("data-target");
  5695. var top=$("#"+webuiId).css("top");
  5696. if(top.indexOf("-")==0){
  5697. $("#"+webuiId).css("top",'0px');
  5698. }
  5699. } else {
  5700. errorMesage(res);
  5701. }
  5702. }
  5703. });
  5704. } else if (index == 1) {
  5705. $("#treeButton").webuiPopover('hide');
  5706. warningMesageSimaple("中药暂无帮助字典");
  5707. } else {
  5708. $("#treeButton").webuiPopover('hide');
  5709. warningMesageSimaple("入院暂无帮助字典");
  5710. }
  5711. }
  5712. /**
  5713. * 节点点击事件
  5714. * @param event
  5715. * @param treeId
  5716. * @param treeNode
  5717. */
  5718. function zTreeOnClick(event, treeId, treeNode) {
  5719. var index = getIndex("bill_item_group");
  5720. if (index == 0) {
  5721. $("#western_medicine_name").val(treeNode.id);
  5722. $('#western_medicine_name').webuiPopover('show');
  5723. loadYpList(0);
  5724. } else if (index == 2) {
  5725. $("#jcJyItem").val(treeNode.id);
  5726. $('#jcJyItem').webuiPopover('show');
  5727. loadjcJyItemList();
  5728. }
  5729. }
  5730. /**
  5731. * 构建处方参数
  5732. * @returns {any}
  5733. */
  5734. function getParamsForpPrescription() {
  5735. var codes = $("#diagnoseValue").val();
  5736. var icdCode = null;
  5737. if (codes != null && codes.length > 0) {
  5738. var arr = codes.split(",");
  5739. if (arr != null) {
  5740. for (i = 0; i < arr.length; i++) {
  5741. if (arr[i] != "") {
  5742. if (icdCode == null) {
  5743. icdCode = arr[i];
  5744. } else {
  5745. icdCode += "," + arr[i];
  5746. }
  5747. }
  5748. }
  5749. }
  5750. }
  5751. 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": ""}}');
  5752. jsonData.patientId = $("#patientId").text();
  5753. jsonData.firstOrNot = $("input[name='firstOrNot']:checked").val();
  5754. jsonData.icdCode = icdCode;
  5755. jsonData.serialNo = $("#mzfzSerialNoInClick").val();
  5756. jsonData.mzBlRecord.firstOrNot = jsonData.firstOrNot;
  5757. jsonData.mzBlRecord.emrChiefComplaint = $("#symptom").val();
  5758. jsonData.mzBlRecord.emrHpi = $("#emrHpi").val();
  5759. jsonData.mzBlRecord.emrPs = $("#emrPs").val();
  5760. jsonData.mzBlRecord.emrPe = $("#otherCheck").val();
  5761. jsonData.mzBlRecord.emrJkjy = $("#healthEducation").val();
  5762. jsonData.mzBlRecord.personalHistory = $("#personalHistory").val();
  5763. jsonData.mzBlRecord.familyHistory = $("#familyHistory").val();
  5764. jsonData.mzBlRecord.obstericalHistory = $("#obstericalHistory").val();
  5765. jsonData.mzBlRecord.weight = $("#weight").val();
  5766. jsonData.mzBlRecord.temperature = $("#temperature").val();
  5767. jsonData.mzBlRecord.sphygmus = $("#sphygmus").val();
  5768. jsonData.mzBlRecord.breathe = $("#breathe").val();
  5769. jsonData.mzBlRecord.pressureHigh = $("#pressure_high").val();
  5770. jsonData.mzBlRecord.pressureFloor = $("#pressure_floor").val();
  5771. jsonData.mzBlRecord.pressureHighLeft = $("#pressure_high_left").val();
  5772. jsonData.mzBlRecord.pressureFloorLeft = $("#pressure_floor_left").val();
  5773. jsonData.mzBlRecord.tentativeDiagnosis = $("#tentativeDiagnosis").val();
  5774. //设置处方详情
  5775. var emrFzjc = null;
  5776. var xyTabContents = $("#xyTabContent").find("div.tab-pane");
  5777. //处方号
  5778. var orderNo = 0;
  5779. var arrs = $("span.cf_amount");
  5780. //西药设置
  5781. if (xyTabContents != null && xyTabContents.length > 0) {
  5782. for (var i = 0; i < xyTabContents.length; i++) {
  5783. //当前药品类型
  5784. var currentGroupNo = $(xyTabContents[i]).find("input.current_groupNo").val();
  5785. var formGroups = $(xyTabContents[i]).find("div.form-group");
  5786. if (formGroups != null && formGroups.length > 0) {
  5787. for (var j = 0; j < formGroups.length; j++) {
  5788. 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":""}');
  5789. tempJson.chargeItemCode = $(formGroups[j]).find("input.temporary_items_code").val();
  5790. tempJson.serial = $(formGroups[j]).find("input.temporary_items_serial").val();
  5791. tempJson.quantity = $(formGroups[j]).find("input.temporary_items_gross").val();
  5792. tempJson.drugQuan = $(formGroups[j]).find("input.temporary_items_drugWin").val();
  5793. tempJson.drugUnit = $(formGroups[j]).find("input.temporary_items_drugWinUnit").val();
  5794. tempJson.frequency = $(formGroups[j]).find("input.temporary_items_orderFrequency").val();
  5795. tempJson.orderDays = $(formGroups[j]).find("input.temporary_items_dayNum").val();
  5796. tempJson.instructionCode = $(formGroups[j]).find("input.temporary_items_medicalAdvice").val();
  5797. tempJson.instructionText = $(formGroups[j]).find("input.temporary_items_medicalAdviceText").val();
  5798. tempJson.supplyCode = $(formGroups[j]).find("input.temporary_items_supplyType").val();
  5799. orderNo = i + 1;
  5800. tempJson.orderNo = orderNo;
  5801. tempJson.groupOrder = $(formGroups[j]).find("input.temporary_items_groupId").val();
  5802. tempJson.groupNo = currentGroupNo;
  5803. var tryFlag = $(formGroups[j]).find("input.temporary_items_tryFlag").val();
  5804. if (tryFlag == true || tryFlag == "true") {
  5805. tempJson.tryFlag = 1;
  5806. }
  5807. jsonData.mzChargeDetailList[jsonData.mzChargeDetailList.length] = tempJson;
  5808. }
  5809. }
  5810. }
  5811. }
  5812. //中草药
  5813. var zyTabContents = $("#zyTabContent").find("div.form-group");
  5814. if (zyTabContents != null && zyTabContents.length > 0) {
  5815. orderNo++;
  5816. var zyfs = $("input.zyfs").val();
  5817. //中药的类型
  5818. var currentZyClassType = $("#current_zyClassType").val();
  5819. for (var i = 0; i < zyTabContents.length; i++) {
  5820. 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":""}');
  5821. tempJson.chargeItemCode = $(zyTabContents[i]).find("input.temporary_items_code").val();
  5822. tempJson.serial = $(zyTabContents[i]).find("input.temporary_items_serial").val();
  5823. tempJson.quantity = $(zyTabContents[i]).find("input.temporary_items_drugWin").val();
  5824. tempJson.drugQuan = $(zyTabContents[i]).find("input.temporary_items_drugWin").val();
  5825. tempJson.drugWin = zyfs;
  5826. tempJson.frequency = $("#zy_orderFrequency_1").val();
  5827. tempJson.instructionCode = $(zyTabContents[i]).find("input.temporary_items_zyInstruction").val();
  5828. tempJson.instructionText = $(zyTabContents[i]).find("input.temporary_items_zyInstructionText").val();
  5829. tempJson.cyFysm = $("#useType_1").val();
  5830. tempJson.cyJssm = $("#cyJssm").val();
  5831. tempJson.cyDj = $("#zy_supplyType_1").val();
  5832. tempJson.orderNo = orderNo;
  5833. tempJson.groupNo = currentZyClassType;
  5834. jsonData.mzChargeDetailList[jsonData.mzChargeDetailList.length] = tempJson;
  5835. }
  5836. }
  5837. //设置诊疗与医技
  5838. var zlTabContents = $("#zlTabContent").find("div.form-group");
  5839. if (zlTabContents != null && zlTabContents.length > 0) {
  5840. orderNo++;
  5841. for (var i = 0; i < zlTabContents.length; i++) {
  5842. if (emrFzjc == null) {
  5843. emrFzjc = $(zlTabContents[i]).text();
  5844. } else {
  5845. emrFzjc += "," + $(zlTabContents[i]).text();
  5846. }
  5847. var tempJson = null;
  5848. //项目类型
  5849. var itemsType = $(zlTabContents[i]).find("input.temporary_items_type").val();
  5850. //执行科室
  5851. var execUnit = $(zlTabContents[i]).find("input.temporary_items_execUnit").val();
  5852. if (itemsType == "3" || itemsType == 3) {
  5853. //诊疗,放入药品类型中入库,因为诊疗是与药品一样直接入明细库,但是是与医技在同一处方开立页面开立
  5854. 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":""}');
  5855. tempJson.chargeItemCode = $(zlTabContents[i]).find("input.temporary_items_code").val();
  5856. tempJson.instructionText = $(zlTabContents[i]).find("input.temporary_items_remark").val();
  5857. tempJson.quantity = $(zlTabContents[i]).find("input.temporary_items_itemQuantity").val();
  5858. tempJson.orderNo = orderNo;
  5859. tempJson.execDept = execUnit;
  5860. jsonData.mzChargeDetailList[jsonData.mzChargeDetailList.length] = tempJson;
  5861. } else {
  5862. tempJson = JSON.parse('{"orderCode":"","inspectPart":"","inspectStuff":"","jyRemark":"","orderNo":"1","execDept":""}');
  5863. tempJson.orderCode = $(zlTabContents[i]).find("input.temporary_items_code").val();
  5864. if (itemsType == "1" || itemsType == 1) {
  5865. //检验
  5866. tempJson.inspectStuff = $(zlTabContents[i]).find("input.temporary_items_desc_value").val();
  5867. } else if (itemsType == "2" || itemsType == 2) {
  5868. //检查
  5869. tempJson.inspectPart = $(zlTabContents[i]).find("input.temporary_items_desc_value").val();
  5870. }
  5871. tempJson.jyRemark = $(zlTabContents[i]).find("input.temporary_items_remark").val();
  5872. tempJson.orderNo = orderNo;
  5873. tempJson.execDept = execUnit;
  5874. jsonData.mzYjReqList[jsonData.mzYjReqList.length] = tempJson;
  5875. }
  5876. }
  5877. }
  5878. //入院
  5879. var zyReqTabContents = $("#zyReqTabContent").find("div.form-group");
  5880. if (zyReqTabContents != null && zyReqTabContents.length > 0) {
  5881. jsonData.mzZyReq.reqDept = $(zyReqTabContents[0]).find("input.temporary_inpatient_ward").val();
  5882. jsonData.mzZyReq.smallDept = $(zyReqTabContents[0]).find("input.temporary_items_small_ward").val();
  5883. jsonData.mzZyReq.admissStatus = $(zyReqTabContents[0]).find("input.temporary_items_admiss_status").val();
  5884. }
  5885. //设置诊断名称
  5886. var icdText = null;
  5887. var tagsTexts = $("span.el-select__tags-text");
  5888. if (tagsTexts != null && tagsTexts.length > 0) {
  5889. for (var i = 0; i < tagsTexts.length; i++) {
  5890. if (icdText == null) {
  5891. icdText = $(tagsTexts[i]).text();
  5892. } else {
  5893. icdText += "," + $(tagsTexts[i]).text();
  5894. }
  5895. }
  5896. }
  5897. jsonData.icdText = icdText;
  5898. jsonData.mzBlRecord.emrFzjc = emrFzjc;
  5899. return jsonData;
  5900. }
  5901. /**
  5902. * 保存处方
  5903. */
  5904. function savePrescription() {
  5905. //关闭帮助框
  5906. $("#treeButton").webuiPopover('hide');
  5907. $("#western_medicine_name").webuiPopover('hide');
  5908. $("#chinese_medicine_name").webuiPopover('hide');
  5909. $("#jcJyItem").webuiPopover('hide');
  5910. $("#messageModal").modal();
  5911. $("#messageContent").html("确认保存处方吗?");
  5912. $("#messageButton").off("click").on("click", function (t) {
  5913. //$("#messageModal").modal("hide");
  5914. var jsonData = getParamsForpPrescription();
  5915. $.ajax({
  5916. type: "POST",
  5917. url: '/thmz/savePrescription',
  5918. contentType: "application/json;charset=UTF-8",
  5919. dataType: "json",
  5920. data: JSON.stringify(jsonData),
  5921. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5922. success: function (res) {
  5923. if (res == '401' || res == 401) {
  5924. window.location.href = '/thmz/login/view'
  5925. return;
  5926. }
  5927. if (res.code == 0) {
  5928. successMesage(res);
  5929. clearWorkSpace();
  5930. loadInClinicTableList();
  5931. loadClinicTableList();
  5932. //$("#messageModal").modal();
  5933. $("#messageContent").html("门诊处方保存成功,是否打印处方和门诊指引单?");
  5934. $("#messageButton").off("click").on("click", function (t) {
  5935. $("#messageModal").modal("hide");
  5936. printPrescription(res.data.patientId, res.data.times, res.data.id, 5, 1);
  5937. });
  5938. $("#cancelButton").off("click");
  5939. } else {
  5940. $("#messageModal").modal("hide");
  5941. errorMesage(res);
  5942. }
  5943. }
  5944. });
  5945. });
  5946. $("#cancelButton").off("click");
  5947. }
  5948. /**
  5949. * 保存医疗范文
  5950. */
  5951. function saveapidAccepts() {
  5952. var templateName = $("#templateName").val();
  5953. if (templateName == null || templateName == "") {
  5954. errorMesageSimaple("范文名称不能为空!");
  5955. return;
  5956. }
  5957. var templateKindType = $("#templateKindType").val();
  5958. if (templateKindType == null || templateKindType == "") {
  5959. errorMesageSimaple("范文类型不能为空!");
  5960. return;
  5961. }
  5962. var templateType = $("#templateType").val();
  5963. if (templateType == null || templateType == "") {
  5964. errorMesageSimaple("范文范围不能为空!");
  5965. return;
  5966. }
  5967. var templateStatus = $("#templateStatus").val();
  5968. if (templateStatus == null || templateStatus == "") {
  5969. errorMesageSimaple("范文状态不能为空!");
  5970. return;
  5971. }
  5972. $("#saveapidAcceptsModal").modal("hide");
  5973. $("#messageModal").modal();
  5974. $("#messageContent").html("确认保存医疗范文吗?");
  5975. $("#messageButton").off("click").on("click", function (t) {
  5976. $("#messageModal").modal("hide");
  5977. var jsonData = getParamsForpPrescription();
  5978. $.ajax({
  5979. type: "POST",
  5980. url: '/thmz/saveTemplate',
  5981. contentType: "application/json;charset=UTF-8",
  5982. dataType: "json",
  5983. data: JSON.stringify({
  5984. "id": $("#templateId").val(),
  5985. "name": templateName,
  5986. "icdText": jsonData.icdText != null ? jsonData.icdText : jsonData.mzBlRecord.tentativeDiagnosis,
  5987. "templateKindType": templateKindType,
  5988. "templateType": templateType,
  5989. "templateStatus": templateStatus,
  5990. "templateData": JSON.stringify(jsonData),
  5991. "emrChiefComplaint": $("#symptom").val(),
  5992. "emrHpi": $("#emrHpi").val(),
  5993. "emrPs": $("#emrPs").val(),
  5994. "icdCode": $("#diagnoseValue").val()
  5995. }),
  5996. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5997. success: function (res) {
  5998. if (res == '401' || res == 401) {
  5999. window.location.href = '/thmz/login/view'
  6000. return;
  6001. }
  6002. if (res.code == 0) {
  6003. successMesage(res);
  6004. //范本保存完不清空
  6005. //clearWorkSpace();
  6006. } else {
  6007. $("#saveapidAcceptsModal").modal();
  6008. errorMesage(res);
  6009. }
  6010. }
  6011. });
  6012. });
  6013. $("#cancelButton").off("click");
  6014. }
  6015. /**
  6016. * 停用医疗范文
  6017. */
  6018. function removeTemplate() {
  6019. $("#messageModal").modal();
  6020. $("#messageContent").html("确认停用医疗范文吗?");
  6021. $("#messageButton").off("click").on("click", function (t) {
  6022. $("#messageModal").modal("hide");
  6023. $.ajax({
  6024. type: "POST",
  6025. url: '/thmz/removeTemplate',
  6026. contentType: "application/json;charset=UTF-8",
  6027. dataType: "json",
  6028. data: JSON.stringify({
  6029. "id": $("#idTemplate").val()
  6030. }),
  6031. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6032. success: function (res) {
  6033. if (res == '401' || res == 401) {
  6034. window.location.href = '/thmz/login/view'
  6035. return;
  6036. }
  6037. if (res.code == 0) {
  6038. successMesage(res);
  6039. $("#medicalModelModal").modal("hide");
  6040. fitTemplateData();
  6041. } else {
  6042. errorMesage(res);
  6043. }
  6044. }
  6045. });
  6046. });
  6047. $("#cancelButton").off("click");
  6048. }
  6049. /**
  6050. * 清空医疗范文模块内容
  6051. */
  6052. function clearApidAcceptsModal() {
  6053. $("#templateId").val(null);
  6054. $("#templateName").val(null);
  6055. $("#templateKindType").selectpicker('val', 0);
  6056. $("#templateKindType").selectpicker('refresh');
  6057. $("#templateType").selectpicker('val', 0);
  6058. $("#templateType").selectpicker('refresh');
  6059. $("#templateStatus").selectpicker('val', 0);
  6060. $("#templateStatus").selectpicker('refresh');
  6061. }
  6062. /**
  6063. * 查询病人未缴费处方信息 加载到处方修改
  6064. * @param patientId
  6065. * @param times
  6066. * @param clnicId 就诊记录id
  6067. */
  6068. function getMzPrescriptionVoUnPaid(patientId, times, clnicId) {
  6069. var currentPatientId = $("#patientId").text();
  6070. //当前接诊的用户和操作接诊的是同一个人,不做任何操作
  6071. if (currentPatientId == patientId) {
  6072. warningMesageSimaple("当前病人正在接诊中,请勿重复操作!");
  6073. return;
  6074. }
  6075. if (currentPatientId == null || currentPatientId == "") {
  6076. //当前没有人接诊,直接接诊
  6077. getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId);
  6078. } else {
  6079. //当前有人在接诊,提示是否需要切换和保存
  6080. $("#messagePrescriptionModal").modal();
  6081. $("#confirmPrescriptionButton").off("click").on("click", function (t) {
  6082. $("#messagePrescriptionModal").modal("hide");
  6083. //先保存目前接诊信息,再切换就诊人
  6084. var jsonData = getParamsForpPrescription();
  6085. $.ajax({
  6086. type: "POST",
  6087. url: '/thmz/savePrescription',
  6088. contentType: "application/json;charset=UTF-8",
  6089. dataType: "json",
  6090. data: JSON.stringify(jsonData),
  6091. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6092. success: function (res) {
  6093. if (res == '401' || res == 401) {
  6094. window.location.href = '/thmz/login/view'
  6095. return;
  6096. }
  6097. if (res.code == 0) {
  6098. loadInClinicTableList();
  6099. loadClinicTableList();
  6100. getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId);
  6101. } else {
  6102. errorMesage(res);
  6103. }
  6104. }
  6105. });
  6106. });
  6107. $("#cancelPrescriptionButton").off("click").on("click", function (t) {
  6108. $("#messagePrescriptionModal").modal("hide");
  6109. getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId);
  6110. });
  6111. }
  6112. }
  6113. /**
  6114. * 查询病人未缴费处方信息 加载到处方修改 通用方法
  6115. * @param patientId
  6116. * @param times
  6117. * @param clnicId 就诊记录id
  6118. */
  6119. function getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId) {
  6120. $.ajax({
  6121. type: "GET",
  6122. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + "&times=" + times + "&MzBlRecordFlag=false&payMark=5&clnicId=null",
  6123. contentType: "application/json;charset=UTF-8",
  6124. dataType: "json",
  6125. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6126. success: function (res) {
  6127. if (res == '401' || res == 401) {
  6128. window.location.href = '/thmz/login/view'
  6129. return;
  6130. }
  6131. if (res.code == 0) {
  6132. clearWorkSpace();
  6133. setMzPatientInfo(res.mzPatientMi);
  6134. editPrescription(res.data, 0)
  6135. //修改患者的时候,将原纪录的就诊记录id带上,并借用分诊流水号字段传参
  6136. $("#mzfzSerialNoInClick").val("clnicId_" + clnicId);
  6137. } else {
  6138. errorMesage(res);
  6139. }
  6140. }
  6141. });
  6142. }
  6143. /**
  6144. * 查询病人已缴费处方信息 调用处方
  6145. * @param patientId
  6146. * @param times
  6147. * @param clnicId 就诊记录id
  6148. */
  6149. function getMzPrescriptionVoPaid(patientId, times, clnicId) {
  6150. $("#visitingDetailModal").modal("hide");
  6151. $("#messageModal").modal();
  6152. $("#messageContent").html("确认调用选中处方吗?将会覆盖当前处方。");
  6153. $("#messageButton").off("click").on("click", function (t) {
  6154. $("#messageModal").modal("hide");
  6155. $.ajax({
  6156. type: "GET",
  6157. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + "&times=" + times + "&MzBlRecordFlag=false&payMark=0&clnicId=null",
  6158. contentType: "application/json;charset=UTF-8",
  6159. dataType: "json",
  6160. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6161. success: function (res) {
  6162. if (res == '401' || res == 401) {
  6163. window.location.href = '/thmz/login/view'
  6164. return;
  6165. }
  6166. if (res.code == 0) {
  6167. var mzfzSerialNoInClick = $("#mzfzSerialNoInClick").val();
  6168. clearUser(false);
  6169. clearWorkSpaceExcludeUser();
  6170. setMzPatientInfo(res.mzPatientMi);
  6171. editPrescription(res.data, 2)
  6172. $("#mzfzSerialNoInClick").val(mzfzSerialNoInClick);
  6173. } else {
  6174. errorMesage(res);
  6175. }
  6176. }
  6177. });
  6178. });
  6179. $("#cancelButton").off("click");
  6180. }
  6181. /**
  6182. * 重复接诊
  6183. * @param patientId
  6184. * @param times
  6185. * @param clnicId
  6186. * @param deptCode 就诊科室编码
  6187. */
  6188. function repeatAccepts(patientId, times, clnicId, deptCode) {
  6189. $.ajax({
  6190. type: "GET",
  6191. url: '/thmz/validMzyReqrec?patientId=' + patientId + "&deptCode=" + deptCode,
  6192. contentType: "application/json;charset=UTF-8",
  6193. dataType: "json",
  6194. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6195. success: function (res) {
  6196. if (res == '401' || res == 401) {
  6197. window.location.href = '/thmz/login/view'
  6198. return;
  6199. }
  6200. if (res.code == 0) {
  6201. if (res.data == 0) {
  6202. $("#messageModal").modal();
  6203. $("#messageContent").html("挂号失效,确定继续就诊?");
  6204. $("#messageButton").off("click").on("click", function (t) {
  6205. $("#messageModal").modal("hide");
  6206. repeatAcceptsConfirm(patientId, times, clnicId);
  6207. });
  6208. $("#cancelButton").off("click");
  6209. return;
  6210. }
  6211. repeatAcceptsConfirm(patientId, times, clnicId);
  6212. } else {
  6213. errorMesage(res);
  6214. }
  6215. }
  6216. });
  6217. }
  6218. /**
  6219. * 重复接诊提示方法
  6220. * @param patientId
  6221. * @param times
  6222. * @param clnicId
  6223. */
  6224. function repeatAcceptsConfirm(patientId, times, clnicId) {
  6225. var currentPatientId = $("#patientId").text();
  6226. //当前接诊的用户和操作接诊的是同一个人,不做任何操作
  6227. if (currentPatientId == patientId) {
  6228. return;
  6229. }
  6230. if (currentPatientId == null || currentPatientId == "") {
  6231. //当前没有人接诊,直接接诊
  6232. repeatAcceptsCommon(patientId, times, clnicId);
  6233. } else {
  6234. //当前有人在接诊,提示是否需要切换和保存
  6235. $("#messagePrescriptionModal").modal();
  6236. $("#confirmPrescriptionButton").off("click").on("click", function (t) {
  6237. $("#messagePrescriptionModal").modal("hide");
  6238. //先保存目前接诊信息,再切换就诊人
  6239. var jsonData = getParamsForpPrescription();
  6240. $.ajax({
  6241. type: "POST",
  6242. url: '/thmz/savePrescription',
  6243. contentType: "application/json;charset=UTF-8",
  6244. dataType: "json",
  6245. data: JSON.stringify(jsonData),
  6246. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6247. success: function (res) {
  6248. if (res == '401' || res == 401) {
  6249. window.location.href = '/thmz/login/view'
  6250. return;
  6251. }
  6252. if (res.code == 0) {
  6253. repeatAcceptsCommon(patientId, times, clnicId);
  6254. //加载已接诊患者列表
  6255. loadClinicTableList();
  6256. } else {
  6257. errorMesage(res);
  6258. }
  6259. }
  6260. });
  6261. });
  6262. $("#cancelPrescriptionButton").off("click").on("click", function (t) {
  6263. $("#messagePrescriptionModal").modal("hide");
  6264. repeatAcceptsCommon(patientId, times, clnicId);
  6265. });
  6266. }
  6267. }
  6268. /**
  6269. * 重复接诊通用方法
  6270. * @param patientId
  6271. * @param times
  6272. * @param clnicId
  6273. */
  6274. function repeatAcceptsCommon(patientId, times, clnicId) {
  6275. $.ajax({
  6276. type: "GET",
  6277. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + "&times=" + times + "&MzBlRecordFlag=true&payMark=null&clnicId=null",
  6278. contentType: "application/json;charset=UTF-8",
  6279. dataType: "json",
  6280. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6281. success: function (res) {
  6282. if (res == '401' || res == 401) {
  6283. window.location.href = '/thmz/login/view'
  6284. return;
  6285. }
  6286. if (res.code == 0) {
  6287. clearWorkSpace();
  6288. setMzPatientInfo(res.mzPatientMi);
  6289. editPrescription(res.data, 0)
  6290. //修改患者的时候,将原纪录的就诊记录id带上,并借用分诊流水号字段传参
  6291. $("#mzfzSerialNoInClick").val("clnicId_" + clnicId);
  6292. } else {
  6293. errorMesage(res);
  6294. }
  6295. }
  6296. });
  6297. }
  6298. /**
  6299. * 就诊详情 已诊患者列表发起
  6300. * @param patientId
  6301. * @param times
  6302. * @param clnicId
  6303. * @param payMark
  6304. */
  6305. function prescriptionDetail(patientId, times, clnicId, payMark) {
  6306. prescriptionDetailCommon(patientId, times, clnicId, payMark, 0);
  6307. }
  6308. /**
  6309. * 就诊详情 历史轨迹发起
  6310. * @param patientId
  6311. * @param times
  6312. * @param clnicId
  6313. * @param clinicStatus
  6314. */
  6315. function visitingDetailModal(patientId, times, clnicId, clinicStatus) {
  6316. var payMark = null;
  6317. if (clinicStatus == 5) {
  6318. payMark = 5;
  6319. } else {
  6320. payMark = 0;
  6321. }
  6322. prescriptionDetailCommon(patientId, times, clnicId, payMark, 1);
  6323. }
  6324. /**
  6325. * 就诊详情通用方法
  6326. * @param patientId
  6327. * @param times
  6328. * @param clnicId
  6329. * @param payMark
  6330. * @param type 0 已诊患者列表发起 1 历史轨迹发起
  6331. */
  6332. function prescriptionDetailCommon(patientId, times, clnicId, payMark, type) {
  6333. $('#baseMzBlTimes').val(null);
  6334. var oriPayMark = payMark;
  6335. if (payMark == 1) {
  6336. //退费时,查看的明细还是处方开立的情况
  6337. payMark = 0;
  6338. }
  6339. $.ajax({
  6340. type: "GET",
  6341. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + '&times=' + times + '&MzBlRecordFlag=false&payMark=' + payMark + '&clnicId=' + clnicId,
  6342. contentType: "application/json;charset=UTF-8",
  6343. dataType: "json",
  6344. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6345. success: function (res) {
  6346. if (res == '401' || res == 401) {
  6347. window.location.href = '/thmz/login/view'
  6348. return;
  6349. }
  6350. if (res.code == 0) {
  6351. $("#visitingDetailModal").modal();
  6352. var jsonData = res.data;
  6353. var mzPatientMi = res.mzPatientMi;
  6354. $("#visitingDetailPatientName").text(mzPatientMi.name);
  6355. $("#visitingDetailPatientAge").text(mzPatientMi.age);
  6356. $("#visitingDetailPatientGender").val(mzPatientMi.gender);
  6357. $("#prescriptionDetail_zd").html("");
  6358. $("#prescriptionDetail_xyzlContent").html("");
  6359. $("#prescriptionDetail_zyzlContent").html("");
  6360. $("#prescriptionDetail_zlyjContent").html("");
  6361. if (res.opDate != null) {
  6362. $("#visitingDetailDate").text(res.opDate);
  6363. }
  6364. if (res.deptName != null) {
  6365. $("#visitingDetailDept").text(res.deptName);
  6366. }
  6367. if (res.doctorName != null) {
  6368. $("#visitingDetailDoctor").text(res.doctorName);
  6369. }
  6370. var firstOrNot = jsonData.mzBlRecord.firstOrNot;
  6371. if (firstOrNot == 0) {
  6372. $("#visitFlag").html("初诊");
  6373. $("#first").next().click();
  6374. } else if (firstOrNot == 1) {
  6375. $("#visitFlag").html("复诊");
  6376. $("#not").next().click();
  6377. }
  6378. if (oriPayMark == 0) {
  6379. $("#chargeImage").attr("src", "/thmz/images/charge.png");
  6380. } else if (oriPayMark == 1) {
  6381. $("#chargeImage").attr("src", "/thmz/images/refund.png");
  6382. } else if (oriPayMark == 5) {
  6383. $("#chargeImage").attr("src", "/thmz/images/nocharge.png");
  6384. }
  6385. var icdText = jsonData.icdText;
  6386. if (icdText != null) {
  6387. var arr = icdText.split(",");
  6388. var html = "";
  6389. for (var i = 0; i < arr.length; i++) {
  6390. if (i == 0) {
  6391. html += ' <div class="tagZdy tagZdy-back">';
  6392. } else {
  6393. html += ' <div class="tagZdy tagZdy-back-green">';
  6394. }
  6395. html += arr[i];
  6396. html += '</div>';
  6397. }
  6398. $("#prescriptionDetail_zd").html(html);
  6399. } else {
  6400. $("#prescriptionDetail_zd").html(jsonData.mzBlRecord.tentativeDiagnosis);
  6401. }
  6402. var emrProcess = jsonData.mzBlRecord.emrProcess;
  6403. if (emrProcess != null) {
  6404. var xy = null;
  6405. if (emrProcess.indexOf("西药治疗:") >= 0) {
  6406. if (emrProcess.indexOf("中药治疗:") >= 0) {
  6407. xy = emrProcess.substring(emrProcess.indexOf("西药治疗:") + 5, emrProcess.indexOf("中药治疗:"));
  6408. } else if (emrProcess.indexOf("医技与诊疗:") >= 0) {
  6409. xy = emrProcess.substring(emrProcess.indexOf("西药治疗:") + 5, emrProcess.indexOf("医技与诊疗:"));
  6410. } else if (emrProcess.indexOf("入院处理:") >= 0) {
  6411. xy = emrProcess.substring(emrProcess.indexOf("西药治疗:") + 5, emrProcess.indexOf("入院处理:"));
  6412. } else {
  6413. xy = emrProcess.substring(emrProcess.indexOf("西药治疗:") + 5);
  6414. }
  6415. var arr = xy.split("_");
  6416. if (arr != null && arr.length > 0) {
  6417. var xyhtml = "";
  6418. for (var i = 0; i < arr.length; i++) {
  6419. xyhtml += "<div style='margin-bottom: 5px;padding-left: 10px;'>";
  6420. xyhtml += arr[i];
  6421. xyhtml += "</div>";
  6422. }
  6423. $("#prescriptionDetail_xyzlContent").html(xyhtml);
  6424. $("#prescriptionDetail_xyzlTitle").removeClass("hide").addClass("in");
  6425. } else {
  6426. $("#prescriptionDetail_xyzlTitle").removeClass("in").addClass("hide");
  6427. }
  6428. } else {
  6429. $("#prescriptionDetail_xyzlTitle").removeClass("in").addClass("hide");
  6430. }
  6431. var zy = null;
  6432. if (emrProcess.indexOf("中药治疗:") >= 0) {
  6433. if (emrProcess.indexOf("医技与诊疗:") >= 0) {
  6434. zy = emrProcess.substring(emrProcess.indexOf("中药治疗:") + 5, emrProcess.indexOf("医技与诊疗:"));
  6435. } else if (emrProcess.indexOf("入院处理:") >= 0) {
  6436. zy = emrProcess.substring(emrProcess.indexOf("中药治疗:") + 5, emrProcess.indexOf("入院处理:"));
  6437. } else {
  6438. zy = emrProcess.substring(emrProcess.indexOf("中药治疗:") + 5);
  6439. }
  6440. var zyArr = zy.split("_");
  6441. if (zyArr != null && zyArr.length > 0) {
  6442. var zyhtml = "";
  6443. for (var i = 1; i < zyArr.length; i++) {
  6444. if (i % 4 == 1) {
  6445. zyhtml += '<div class="item form-group" style="margin-bottom: -5px;">';
  6446. }
  6447. zyhtml += '<div class="col-md-3 col-sm-3 col-xs-12">';
  6448. zyhtml += zyArr[i];
  6449. zyhtml += "</div>";
  6450. if (i % 4 == 0) {
  6451. zyhtml += '</div>';
  6452. }
  6453. }
  6454. var zyfs = zyArr[0].substring(zyArr[0].indexOf("付数:") + 3);
  6455. if (zyfs != null && zyfs != "") {
  6456. if (zyArr.length % 4 == 1) {
  6457. zyhtml += '<div class="item form-group" style="margin-bottom: -5px;">';
  6458. }
  6459. zyhtml += '<div class="col-md-3 col-sm-3 col-xs-12">';
  6460. zyhtml += ' <div style="text-indent: 2em;">';
  6461. zyhtml += ' <div>';
  6462. zyhtml += 'X<span>';
  6463. zyhtml += zyfs;
  6464. zyhtml += '</span> 付</div></div>';
  6465. zyhtml += '</div>';
  6466. }
  6467. $("#prescriptionDetail_zyzlContent").html(zyhtml);
  6468. $("#prescriptionDetail_zyzlTitle").removeClass("hide").addClass("in");
  6469. } else {
  6470. $("#prescriptionDetail_zyzlTitle").removeClass("in").addClass("hide");
  6471. }
  6472. } else {
  6473. $("#prescriptionDetail_zyzlTitle").removeClass("in").addClass("hide");
  6474. }
  6475. if (emrProcess.indexOf("医技与诊疗:") >= 0) {
  6476. var zlyj = null;
  6477. if (emrProcess.indexOf("入院处理:") >= 0) {
  6478. zlyj = emrProcess.substring(emrProcess.indexOf("医技与诊疗:") + 6, emrProcess.indexOf("入院处理:"));
  6479. } else {
  6480. zlyj = emrProcess.substring(emrProcess.indexOf("医技与诊疗:") + 6);
  6481. }
  6482. var zlyjArr = zlyj.split("_");
  6483. if (zlyjArr != null && zlyjArr.length > 0) {
  6484. var zlyjhtml = "";
  6485. for (var i = 0; i < zlyjArr.length; i++) {
  6486. zlyjhtml += "<div style='margin-bottom: 5px;padding-left: 10px;'>";
  6487. zlyjhtml += zlyjArr[i];
  6488. zlyjhtml += "</div>";
  6489. }
  6490. $("#prescriptionDetail_zlyjContent").html(zlyjhtml);
  6491. $("#prescriptionDetail_zlyjTitle").removeClass("hide").addClass("in");
  6492. } else {
  6493. $("#prescriptionDetail_zlyjTitle").removeClass("in").addClass("hide");
  6494. }
  6495. } else {
  6496. $("#prescriptionDetail_zlyjTitle").removeClass("in").addClass("hide");
  6497. }
  6498. if (emrProcess.indexOf("入院处理:") >= 0) {
  6499. var zyReq = emrProcess.substring(emrProcess.indexOf("入院处理:") + 5);
  6500. if (zyReq != null && zyReq != "") {
  6501. var zyReqhtml = "<div style='margin-bottom: 5px;padding-left: 10px;'>";
  6502. zyReqhtml += zyReq;
  6503. zyReqhtml += "</div>";
  6504. $("#prescriptionDetail_zyReqContent").html(zyReqhtml);
  6505. $("#prescriptionDetail_zyReqTitle").removeClass("hide").addClass("in");
  6506. } else {
  6507. $("#prescriptionDetail_zyReqTitle").removeClass("in").addClass("hide");
  6508. }
  6509. } else {
  6510. $("#prescriptionDetail_zyReqTitle").removeClass("in").addClass("hide");
  6511. }
  6512. }
  6513. $("#printJcReq").removeClass("in").addClass("hide");
  6514. $("#printJcReq").off("click");
  6515. $("#printJyReq").removeClass("in").addClass("hide");
  6516. $("#printJyReq").off("click");
  6517. $("#printJcReqSetup").removeClass("in").addClass("hide");
  6518. $("#printJcReqSetup").off("click");
  6519. $("#printJyReqSetup").removeClass("in").addClass("hide");
  6520. $("#printJyReqSetup").off("click");
  6521. $("#previewYjReq").removeClass("in").addClass("hide");
  6522. $("#previewYjReq").off("click");
  6523. $("#previewYjReqAll").removeClass("in").addClass("hide");
  6524. $("#previewYjReqAll").off("click");
  6525. if (jsonData.mzYjReqList != null && jsonData.mzYjReqList.length > 0) {
  6526. $("#previewYjReq").removeClass("hide").addClass("in");
  6527. $("#previewYjReq").off("click").on("click", function (t) {
  6528. previewYjReq(patientId, times);
  6529. });
  6530. }
  6531. if (res.yjReqCount != null && res.yjReqCount > 0) {
  6532. $("#previewYjReqAll").removeClass("hide").addClass("in");
  6533. $("#previewYjReqAll").off("click").on("click", function (t) {
  6534. previewYjReqAll(patientId);
  6535. });
  6536. }
  6537. if (type == 0) {
  6538. $("#callPrescription").removeClass("in").addClass("hide");
  6539. if ((jsonData.mzChargeDetailList == null || jsonData.mzChargeDetailList.length == 0) && (jsonData.mzYjReqList == null || jsonData.mzYjReqList.length == 0)) {
  6540. $("#printPrescription").removeClass("in").addClass("hide");
  6541. $("#printPrescriptionSetup").removeClass("in").addClass("hide");
  6542. } else {
  6543. $("#printPrescription").removeClass("hide").addClass("in");
  6544. $("#printPrescription").off("click").on("click", function (t) {
  6545. printPrescription(patientId, times, clnicId, payMark, 1);
  6546. });
  6547. $("#printPrescriptionSetup").removeClass("hide").addClass("in");
  6548. $("#printPrescriptionSetup").off("click").on("click", function (t) {
  6549. printPrescription(patientId, times, clnicId, payMark, 2);
  6550. });
  6551. }
  6552. if (jsonData.mzYjReqList != null && jsonData.mzYjReqList.length > 0) {
  6553. var hadJc = false;
  6554. var hadJy = false;
  6555. for (var i = 0; i < jsonData.mzYjReqList.length; i++) {
  6556. var mzYjReq = jsonData.mzYjReqList[i];
  6557. if (mzYjReq.reqType == 2) {
  6558. hadJy = true;
  6559. } else if (mzYjReq.reqType == 3) {
  6560. hadJc = true;
  6561. }
  6562. }
  6563. if (hadJc) {
  6564. $("#printJcReq").removeClass("hide").addClass("in");
  6565. $("#printJcReq").off("click").on("click", function (t) {
  6566. printYjReq(patientId, times, 3, 1);
  6567. });
  6568. $("#printJcReqSetup").removeClass("hide").addClass("in");
  6569. $("#printJcReqSetup").off("click").on("click", function (t) {
  6570. printYjReq(patientId, times, 3, 2);
  6571. });
  6572. }
  6573. if (hadJy) {
  6574. $("#printJyReq").removeClass("hide").addClass("in");
  6575. $("#printJyReq").off("click").on("click", function (t) {
  6576. printYjReq(patientId, times, 2, 1);
  6577. });
  6578. $("#printJyReqSetup").removeClass("hide").addClass("in");
  6579. $("#printJyReqSetup").off("click").on("click", function (t) {
  6580. printYjReq(patientId, times, 2, 2);
  6581. });
  6582. }
  6583. }
  6584. // $("#printBlRecord").removeClass("hide").addClass("in");
  6585. // $("#printBlRecord").off("click").on("click", function (t) {
  6586. // printBlRecord(patientId, times, 1);
  6587. // });
  6588. // $("#printBlRecordSetup").removeClass("hide").addClass("in");
  6589. // $("#printBlRecordSetup").off("click").on("click", function (t) {
  6590. // printBlRecord(patientId, times, 2);
  6591. // });
  6592. // $("#showMzBlRecordModal").removeClass("hide").addClass("in");
  6593. // $("#showMzBlRecordModal").off("click").on("click", function (t) {
  6594. // showMzBlRecordModal(patientId, times, 1);
  6595. // });
  6596. if (jsonData.mzZyReq == null || jsonData.mzZyReq.reqDept == null || jsonData.mzZyReq.reqDept == "") {
  6597. $("#printZyReq").removeClass("in").addClass("hide");
  6598. $("#printZyReq").off("click");
  6599. $("#printZyReqSetup").removeClass("in").addClass("hide");
  6600. $("#printZyReqSetup").off("click");
  6601. } else {
  6602. $("#printZyReq").removeClass("hide").addClass("in");
  6603. $("#printZyReq").off("click").on("click", function (t) {
  6604. printZyReq(patientId, 1);
  6605. });
  6606. $("#printZyReqSetup").removeClass("hide").addClass("in");
  6607. $("#printZyReqSetup").off("click").on("click", function (t) {
  6608. printZyReq(patientId, 2);
  6609. });
  6610. }
  6611. } else {
  6612. $("#printPrescription").removeClass("in").addClass("hide");
  6613. $("#printZyReq").removeClass("in").addClass("hide");
  6614. $("#printBlRecord").removeClass("in").addClass("hide");
  6615. $("#printJcReq").removeClass("in").addClass("hide");
  6616. $("#printJyReq").removeClass("in").addClass("hide");
  6617. $("#callPrescription").removeClass("hide").addClass("in");
  6618. $("#callPrescription").off("click").on("click", function (t) {
  6619. getMzPrescriptionVoPaid(patientId, times, clnicId);
  6620. });
  6621. }
  6622. if (oriPayMark == 1) {
  6623. $("#printPrescription").removeClass("in").addClass("hide");
  6624. $("#printPrescriptionSetup").removeClass("in").addClass("hide");
  6625. } else {
  6626. if ((jsonData.mzChargeDetailList == null || jsonData.mzChargeDetailList.length == 0) && (jsonData.mzYjReqList == null || jsonData.mzYjReqList.length == 0)) {
  6627. $("#printPrescription").removeClass("in").addClass("hide");
  6628. $("#printPrescriptionSetup").removeClass("in").addClass("hide");
  6629. } else {
  6630. $("#printPrescription").removeClass("hide").addClass("in");
  6631. $("#printPrescription").off("click").on("click", function (t) {
  6632. printPrescription(patientId, times, clnicId, payMark, 1);
  6633. });
  6634. $("#printPrescriptionSetup").removeClass("hide").addClass("in");
  6635. $("#printPrescriptionSetup").off("click").on("click", function (t) {
  6636. printPrescription(patientId, times, clnicId, payMark, 2);
  6637. });
  6638. }
  6639. }
  6640. $("#printBlRecord").removeClass("hide").addClass("in");
  6641. $("#printBlRecord").off("click").on("click", function (t) {
  6642. printBlRecord(patientId, times, 1);
  6643. });
  6644. $("#printBlRecordSetup").removeClass("hide").addClass("in");
  6645. $("#printBlRecordSetup").off("click").on("click", function (t) {
  6646. printBlRecord(patientId, times, 2);
  6647. });
  6648. $("#showMzBlRecordModal").removeClass("hide").addClass("in");
  6649. $("#showMzBlRecordModal").off("click").on("click", function (t) {
  6650. showMzBlRecordModal(patientId, times, 1);
  6651. });
  6652. if ($("#setupId").hasClass("fa-chevron-up")) {
  6653. //默认不展开打印设置
  6654. $("#setupId").parent().click();
  6655. }
  6656. // setTimeout(function () {
  6657. // if ($("#setupId").hasClass("fa-chevron-up")) {
  6658. // //默认不展开打印设置
  6659. // $("#setupId").parent().click();
  6660. // }
  6661. // }, 400);
  6662. } else {
  6663. errorMesage(res);
  6664. }
  6665. }
  6666. });
  6667. }
  6668. /**
  6669. * 查询默认打印机
  6670. */
  6671. function setPrint() {
  6672. if (printIndex >= 0) {
  6673. return;
  6674. }
  6675. $.ajax({
  6676. type: "GET",
  6677. url: '/thmz/getLastWindowsByCurrentUser',
  6678. contentType: "application/json;charset=UTF-8",
  6679. dataType: "json",
  6680. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6681. async: false,
  6682. success: function (res) {
  6683. if (res == '401' || res == 401) {
  6684. window.location.href = '/thmz/login/view'
  6685. return;
  6686. }
  6687. if (res.code == 0) {
  6688. printIndex = res.data.cgPrintIndex;
  6689. } else {
  6690. printIndex = -1;
  6691. }
  6692. }
  6693. });
  6694. }
  6695. function setTableHtml(prescriptionDetail) {
  6696. var html = "";
  6697. for (var j = 0; j < prescriptionDetail.length; j++) {
  6698. html += "<tr><td>";
  6699. html += prescriptionDetail[j].substring(0, prescriptionDetail[j].indexOf("用法"));
  6700. html += "</td></tr>";
  6701. html += "<tr><td>";
  6702. html += prescriptionDetail[j].substring(prescriptionDetail[j].indexOf("用法"));
  6703. html += "</td></tr>";
  6704. }
  6705. html += "<tr><td>&nbsp;&nbsp;&nbsp;&nbsp;------(以下空白)------</td></tr>";
  6706. return {html: html, j: j};
  6707. }
  6708. // /**
  6709. // * 打印门诊指引单
  6710. // * @param patientId
  6711. // * @param times
  6712. // */
  6713. // function printGuideCard(patientId, times) {
  6714. //
  6715. // }
  6716. /**
  6717. * 打印门诊处方
  6718. * @param patientId
  6719. * @param times
  6720. * @param clnicId
  6721. * @param payMark
  6722. * @param printType 打印模式 1 预览打印 2 打印设置
  6723. */
  6724. function printPrescription(patientId, times, clnicId, payMark, printType) {
  6725. $.ajax({
  6726. type: "GET",
  6727. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + '&times=' + times + '&MzBlRecordFlag=false&payMark=' + payMark + '&clnicId=' + clnicId,
  6728. contentType: "application/json;charset=UTF-8",
  6729. dataType: "json",
  6730. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6731. success: function (res) {
  6732. if (res == '401' || res == 401) {
  6733. window.location.href = '/thmz/login/view'
  6734. return;
  6735. }
  6736. if (res.code == 0) {
  6737. var prescriptionDetail = res.data.mzBlRecord.prescriptionDetail;
  6738. if (prescriptionDetail != null && prescriptionDetail != "") {
  6739. var prescriptionDetailJson = JSON.parse(prescriptionDetail);
  6740. //当前处方只开了住院证则只打印住院证
  6741. 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) {
  6742. printZyReq(patientId, 1);
  6743. return;
  6744. }
  6745. var index = 0;
  6746. setPrint();
  6747. LODOP = getLodop();
  6748. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院处方笺");
  6749. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  6750. //设置默认打印机
  6751. LODOP.SET_PRINTER_INDEX(printIndex);
  6752. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  6753. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  6754. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  6755. //LODOP.SET_SHOW_MODE("SETUP_ENABLESS",getCheckSS());
  6756. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊处方笺");//对新建的纸张重命名
  6757. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  6758. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  6759. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  6760. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  6761. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  6762. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  6763. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  6764. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  6765. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  6766. var mzPatientMi = res.mzPatientMi;
  6767. $("#patientNamePrescription").text(mzPatientMi.name);
  6768. $("#patientGenderPrescription").text(mzPatientMi.gender);
  6769. $("#patientAgePrescription").text(mzPatientMi.age);
  6770. $("#patientIdPrescription").text(mzPatientMi.patientId);
  6771. $("#deptPrescription").text(res.deptName);
  6772. $("#doctorPrescription").text(res.doctorName);
  6773. $("#cfTime").text(res.opDate);
  6774. $("#socialNo").text(mzPatientMi.socialNo);
  6775. $("#zdPrescription").text(res.data.icdText);
  6776. $("#patientIdGuideCard").text(mzPatientMi.patientId);
  6777. $("#patientNameGuideCard").text(mzPatientMi.name);
  6778. $("#patientDateGuideCard").text(format(new Date(), "yyyy-MM-dd"));
  6779. //普药处方
  6780. var pyPrescription = prescriptionDetailJson.xyPrescription.pyPrescription;
  6781. if (pyPrescription != null && pyPrescription.length > 0) {
  6782. for (var i = 0; i < pyPrescription.length; i++) {
  6783. if (index > 0) {
  6784. LODOP.NewPageA();
  6785. }
  6786. var prescriptionDetail = pyPrescription[i].detail;
  6787. var __ret = setTableHtml(prescriptionDetail);
  6788. var html = __ret.html;
  6789. var j = __ret.j;
  6790. if (res.deptName != undefined && res.deptName != null) {
  6791. if (res.deptName.indexOf("儿") > 0) {
  6792. $("#typePrescription").text("儿科");
  6793. $("#cfTitle").text("儿科");
  6794. } else if (res.deptName.indexOf("急诊科") > 0) {
  6795. $("#typePrescription").text("急诊");
  6796. $("#cfTitle").text("急诊");
  6797. } else {
  6798. $("#typePrescription").text("普通处方");
  6799. $("#cfTitle").text("普通");
  6800. }
  6801. }
  6802. $("#prescriptionDetail").html(html);
  6803. $("#cfAmountPrint").text(pyPrescription[i].amount + "元 (不含注射费)");
  6804. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  6805. index++;
  6806. }
  6807. }
  6808. //医材处方
  6809. var ycPrescription = prescriptionDetailJson.xyPrescription.ycPrescription;
  6810. if (ycPrescription != null && ycPrescription.length > 0) {
  6811. for (var i = 0; i < ycPrescription.length; i++) {
  6812. if (index > 0) {
  6813. LODOP.NewPageA();
  6814. }
  6815. var prescriptionDetail = ycPrescription[i].detail;
  6816. var __ret = setTableHtml(prescriptionDetail);
  6817. var html = __ret.html;
  6818. var j = __ret.j;
  6819. if (res.deptName != undefined && res.deptName != null) {
  6820. if (res.deptName.indexOf("儿") > 0) {
  6821. $("#typePrescription").text("儿科");
  6822. $("#cfTitle").text("儿科");
  6823. } else if (res.deptName.indexOf("急诊科") > 0) {
  6824. $("#typePrescription").text("急诊");
  6825. $("#cfTitle").text("急诊");
  6826. } else {
  6827. $("#typePrescription").text("医材处方");
  6828. $("#cfTitle").text("普通");
  6829. }
  6830. }
  6831. $("#prescriptionDetail").html(html);
  6832. $("#cfAmountPrint").text(ycPrescription[i].amount + "元 ");
  6833. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  6834. index++;
  6835. }
  6836. }
  6837. //麻精处方
  6838. var mjPrescription = prescriptionDetailJson.xyPrescription.mjPrescription;
  6839. if (mjPrescription != null && mjPrescription.length > 0) {
  6840. for (var i = 0; i < mjPrescription.length; i++) {
  6841. if (index > 0) {
  6842. LODOP.NewPageA();
  6843. }
  6844. var prescriptionDetail = mjPrescription[i].detail;
  6845. var __ret = setTableHtml(prescriptionDetail);
  6846. var html = __ret.html;
  6847. var j = __ret.j;
  6848. $("#typePrescription").text("麻、精一处方");
  6849. $("#cfTitle").text("麻、精一");
  6850. $("#prescriptionDetail").html(html);
  6851. $("#cfAmountPrint").text(mjPrescription[i].amount + "元 (不含注射费)");
  6852. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  6853. index++;
  6854. }
  6855. }
  6856. //精二处方
  6857. var jePrescription = prescriptionDetailJson.xyPrescription.jePrescription;
  6858. if (jePrescription != null && jePrescription.length > 0) {
  6859. for (var i = 0; i < jePrescription.length; i++) {
  6860. if (index > 0) {
  6861. LODOP.NewPageA();
  6862. }
  6863. var prescriptionDetail = jePrescription[i].detail;
  6864. var __ret = setTableHtml(prescriptionDetail);
  6865. var html = __ret.html;
  6866. var j = __ret.j;
  6867. $("#typePrescription").text("精二处方");
  6868. $("#cfTitle").text("精二");
  6869. $("#prescriptionDetail").html(html);
  6870. $("#cfAmountPrint").text(jePrescription[i].amount + "元 (不含注射费)");
  6871. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  6872. index++;
  6873. }
  6874. }
  6875. //中药处方
  6876. if (prescriptionDetailJson.zyPrescription != null && prescriptionDetailJson.zyPrescription.length > 0) {
  6877. var zyPrescription = prescriptionDetailJson.zyPrescription[0].detail;
  6878. if (zyPrescription != null && zyPrescription.length > 0) {
  6879. var html = "";
  6880. for (var i = 0; i < zyPrescription.length; i++) {
  6881. if (i % 3 == 0) {
  6882. html += "<tr>";
  6883. }
  6884. html += "<td>";
  6885. html += zyPrescription[i].trim();
  6886. if (i % 3 == 2) {
  6887. html += "</td></tr>";
  6888. } else {
  6889. html += "</td>";
  6890. }
  6891. }
  6892. if (zyPrescription.length % 3 != 0) {
  6893. html += "</tr>";
  6894. }
  6895. html += "<tr><td>X " + prescriptionDetailJson.zyPrescription[0].zyfs + "付</td>";
  6896. var colNum = 1;
  6897. var frequency = prescriptionDetailJson.zyPrescription[0].frequency;
  6898. if (frequency != null && frequency != "") {
  6899. html += "<td>频率:" + frequency + "</td>";
  6900. colNum++;
  6901. }
  6902. var cyJssm = prescriptionDetailJson.zyPrescription[0].cyJssm;
  6903. if (cyJssm != null && cyJssm != "") {
  6904. html += "<td>加水说明:" + cyJssm + "</td>";
  6905. colNum++;
  6906. if (colNum % 3 == 0) {
  6907. html += "</tr>";
  6908. }
  6909. }
  6910. var cyFysm = prescriptionDetailJson.zyPrescription[0].cyFysm;
  6911. if (cyFysm != null && cyFysm != "") {
  6912. colNum++;
  6913. if (colNum % 3 == 1) {
  6914. html += "<tr>";
  6915. }
  6916. html += "<td>服用说明:" + cyFysm + "</td>";
  6917. if (colNum % 3 == 0) {
  6918. html += "</tr>";
  6919. }
  6920. }
  6921. var cyDj = prescriptionDetailJson.zyPrescription[0].cyDj;
  6922. if (cyDj != null && cyDj != "") {
  6923. colNum++;
  6924. if (colNum % 3 == 1) {
  6925. html += "<tr>";
  6926. }
  6927. html += "<td>" + cyDj + "</td>";
  6928. if (colNum % 3 == 0) {
  6929. html += "</tr>";
  6930. }
  6931. }
  6932. if (index > 0) {
  6933. LODOP.NewPageA();
  6934. }
  6935. if (res.deptName != undefined && res.deptName != null) {
  6936. if (res.deptName.indexOf("儿") > 0) {
  6937. $("#typePrescription").text("儿科");
  6938. $("#cfTitle").text("儿科");
  6939. } else if (res.deptName.indexOf("急诊科") > 0) {
  6940. $("#typePrescription").text("急诊");
  6941. $("#cfTitle").text("急诊");
  6942. } else {
  6943. $("#typePrescription").text("中药处方");
  6944. $("#cfTitle").text("普通");
  6945. }
  6946. }
  6947. $("#prescriptionDetail").html(html);
  6948. $("#cfAmountPrint").text(prescriptionDetailJson.zyPrescription[0].amount + "元 (不含代煎费)");
  6949. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  6950. index++;
  6951. }
  6952. }
  6953. if (prescriptionDetailJson.zlPrescription != null && prescriptionDetailJson.zlPrescription.length > 0) {
  6954. //诊疗处方
  6955. var zlPrescription = prescriptionDetailJson.zlPrescription[0].detail;
  6956. if (zlPrescription != null && zlPrescription.length > 0) {
  6957. var html = "";
  6958. for (var i = 0; i < zlPrescription.length; i++) {
  6959. html += "<tr><td>";
  6960. html += zlPrescription[i];
  6961. html += "</td></tr>";
  6962. }
  6963. if (index > 0) {
  6964. LODOP.NewPageA();
  6965. }
  6966. if (res.deptName != undefined && res.deptName != null) {
  6967. if (res.deptName.indexOf("儿") > 0) {
  6968. $("#typePrescription").text("儿科");
  6969. $("#cfTitle").text("儿科");
  6970. } else if (res.deptName.indexOf("急诊科") > 0) {
  6971. $("#typePrescription").text("急诊");
  6972. $("#cfTitle").text("急诊");
  6973. } else {
  6974. $("#typePrescription").text("诊疗处方");
  6975. $("#cfTitle").text("普通");
  6976. }
  6977. }
  6978. $("#prescriptionDetail").html(html);
  6979. $("#cfAmountPrint").text(prescriptionDetailJson.zlPrescription[0].amount + "元 ");
  6980. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  6981. index++;
  6982. }
  6983. }
  6984. $.ajax({
  6985. type: "GET",
  6986. url: '/thmz/getChargeDetailForGuideCard?patientId=' + patientId + '&times=' + times,
  6987. contentType: "application/json;charset=UTF-8",
  6988. dataType: "json",
  6989. headers: {
  6990. 'Accept': 'application/json',
  6991. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  6992. },
  6993. success: function (res) {
  6994. if (res == '401' || res == 401) {
  6995. window.location.href = '/thmz/login/view'
  6996. return;
  6997. }
  6998. if (res.code == 0) {
  6999. if (res.data != null && res.data.length > 0) {
  7000. var html = "";
  7001. for (var i = 0; i < res.data.length; i++) {
  7002. 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>"
  7003. }
  7004. $("#guideCardDetail").html(html);
  7005. }
  7006. if (res.payQrcode != null && res.payQrcode != "") {
  7007. $("#payQrcodeGuideCard").html(null);
  7008. new QRCode(document.getElementById("payQrcodeGuideCard"), res.payQrcode); // 设置要生成二维码的链接
  7009. $("canvas").attr("id", "erw");
  7010. var canvas = document.getElementById('erw');
  7011. var src = canvas.toDataURL("image/png");
  7012. //var strDataURI =canvas.toDataURL("image/png");
  7013. $("#payQrcodeGuideCard").html("<img src='" + src + "' style='width:100px;height:100px;'/><div style='width: 100px;margin-top: 10px;text-align: center;'>微信支付</div>");
  7014. }
  7015. $("#totalAmountGuideCard").text("¥" + res.totalAmount);
  7016. // $("#imgcode").JsBarcode(patientId);
  7017. console.log(patientId);
  7018. JsBarcode('#imgcode', patientId, {
  7019. lineColor: '#333', //线条颜色
  7020. width: 2, //线宽
  7021. height: 60, //条码高度
  7022. displayValue: false, //是否显示文字信息
  7023. });
  7024. if (index > 0) {
  7025. LODOP.NewPageA();
  7026. }
  7027. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("guide_card_table").innerHTML);
  7028. //LODOP.PRINT();
  7029. if (printType == 1) {
  7030. LODOP.PREVIEW();
  7031. } else if (printType == 2) {
  7032. LODOP.PRINT_SETUP();
  7033. }
  7034. } else if (res.code == -2) {
  7035. if (printType == 1) {
  7036. LODOP.PREVIEW();
  7037. } else if (printType == 2) {
  7038. LODOP.PRINT_SETUP();
  7039. }
  7040. } else {
  7041. errorMesage(res);
  7042. }
  7043. }
  7044. });
  7045. // printGuideCard(patientId, times);
  7046. }
  7047. } else {
  7048. errorMesage(res);
  7049. }
  7050. }
  7051. });
  7052. }
  7053. /**
  7054. * 构建体征描述
  7055. * @param mzBlRecord
  7056. * @returns {*}
  7057. */
  7058. function getTz(mzBlRecord) {
  7059. var tz = null;
  7060. if (mzBlRecord.weight != null && mzBlRecord.weight != 0) {
  7061. var temp = "体重:" + mzBlRecord.weight + "kg ";
  7062. if (tz == null) {
  7063. tz = temp;
  7064. } else {
  7065. tz += " " + temp;
  7066. }
  7067. }
  7068. if (mzBlRecord.temperature != null && mzBlRecord.temperature != 0) {
  7069. var temp = "体温:" + mzBlRecord.temperature + "℃ ";
  7070. if (tz == null) {
  7071. tz = temp;
  7072. } else {
  7073. tz += " " + temp;
  7074. }
  7075. }
  7076. if (mzBlRecord.sphygmus != null && mzBlRecord.sphygmus != 0) {
  7077. var temp = "脉搏:" + mzBlRecord.sphygmus + "次/分 ";
  7078. if (tz == null) {
  7079. tz = temp;
  7080. } else {
  7081. tz += " " + temp;
  7082. }
  7083. }
  7084. if (mzBlRecord.breathe != null && mzBlRecord.breathe != 0) {
  7085. var temp = "呼吸:" + mzBlRecord.breathe + "次/分 ";
  7086. if (tz == null) {
  7087. tz = temp;
  7088. } else {
  7089. tz += " " + temp;
  7090. }
  7091. }
  7092. if (mzBlRecord.pressureHigh != null && mzBlRecord.pressureFloor != null && mzBlRecord.pressureHigh != 0 && mzBlRecord.pressureFloor != 0) {
  7093. var temp = "血压:" + mzBlRecord.pressureHigh + "/" + mzBlRecord.pressureFloor;
  7094. if (tz == null) {
  7095. tz = temp;
  7096. } else {
  7097. tz += " " + temp;
  7098. }
  7099. }
  7100. if (mzBlRecord.pressureHighLeft != null && mzBlRecord.pressureFloorLeft != null && mzBlRecord.pressureHighLeft != 0 && mzBlRecord.pressureFloorLeft != 0) {
  7101. var temp = "左血压:" + mzBlRecord.pressureHighLeft + "/" + mzBlRecord.pressureFloorLeft;
  7102. if (tz == null) {
  7103. tz = temp;
  7104. } else {
  7105. tz += " " + temp;
  7106. }
  7107. }
  7108. return tz;
  7109. }
  7110. /**
  7111. * 打印医技申请单
  7112. * @param patientId
  7113. * @param times
  7114. * @param type 申请单类型:2:检验;3:检查
  7115. * @param printType 打印模式 1 预览打印 2 打印设置
  7116. */
  7117. function printYjReq(patientId, times, type, printType) {
  7118. $.ajax({
  7119. type: "GET",
  7120. url: '/thmz/printYjReq?patientId=' + patientId + '&times=' + times + "&reqType=" + type,
  7121. contentType: "application/json;charset=UTF-8",
  7122. dataType: "json",
  7123. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7124. success: function (res) {
  7125. if (res == '401' || res == 401) {
  7126. window.location.href = '/thmz/login/view'
  7127. return;
  7128. }
  7129. if (res.code == 0) {
  7130. if (res.data == null || res.data.mzYjReqList == null || res.data.mzYjReqList.length == 0) {
  7131. errorMesageSimaple("没有医技申请单可以打印");
  7132. return;
  7133. }
  7134. setPrint();
  7135. LODOP = getLodop();
  7136. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院检查申请单");
  7137. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  7138. //设置默认打印机
  7139. LODOP.SET_PRINTER_INDEX(printIndex);
  7140. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  7141. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  7142. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  7143. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "检查申请单");//对新建的纸张重命名
  7144. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  7145. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  7146. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  7147. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  7148. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  7149. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  7150. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  7151. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  7152. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  7153. var mzPatientMi = res.data.mzPatientMi;
  7154. $("#patientIdJcReq").text(mzPatientMi.patientId);
  7155. $("#patientNameJcReq").text(mzPatientMi.name);
  7156. $("#patientGenderJcReq").text(mzPatientMi.gender);
  7157. $("#patientAgeJcReq").text(mzPatientMi.age + "岁");
  7158. $("#responseTypeJcReq").text(mzPatientMi.responseTypeName);
  7159. $("#patientCardNoJcReq").text(mzPatientMi.icCardNo);
  7160. $("#icdTextJcReq").text(res.data.mzVisitTable.icdText);
  7161. $("#patientIdJyReq").text(mzPatientMi.patientId);
  7162. $("#patientNameJyReq").text(mzPatientMi.name);
  7163. $("#patientGenderJyReq").text(mzPatientMi.gender);
  7164. $("#patientAgeJyReq").text(mzPatientMi.age + "岁");
  7165. $("#responseTypeJyReq").text(mzPatientMi.responseTypeName);
  7166. $("#patientCardNoJyReq").text(mzPatientMi.icCardNo);
  7167. $("#icdTextJyReq").text(res.data.mzVisitTable.icdText);
  7168. var mzBlRecord = res.data.mzBlRecord;
  7169. $("#jcReqEmrChiefComplaint").text(mzBlRecord.emrChiefComplaint);
  7170. $("#jcReqHis").text(mzBlRecord.emrHpi);
  7171. $("#jyReqEmrChiefComplaint").text(mzBlRecord.emrChiefComplaint);
  7172. $("#jyReqHis").text(mzBlRecord.emrHpi);
  7173. var tz = getTz(mzBlRecord);
  7174. $("#jcReqTz").text(tz);
  7175. $("#jcReqReqDept").text(res.data.deptName);
  7176. $("#jcReqReqDoctor").text(res.data.doctorName);
  7177. $("#jyReqTz").text(tz);
  7178. $("#jyReqReqDept").text(res.data.deptName);
  7179. $("#jyReqReqDoctor").text(res.data.doctorName);
  7180. //检验报告列表名
  7181. 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>';
  7182. var jyContent = "";
  7183. var needNewPageA = false;
  7184. for (var i = 0; i < res.data.mzYjReqList.length; i++) {
  7185. var obj = res.data.mzYjReqList[i];
  7186. if (i == 0) {
  7187. var dateStr = format(obj.reqDate, "yyyy-MM-dd");
  7188. $("#jcReqReqDate").text(dateStr);
  7189. $("#jyReqReqDate").text(dateStr);
  7190. }
  7191. if (obj.reqType == "3") {
  7192. if (i > 0) {
  7193. LODOP.NewPageA();
  7194. }
  7195. $("#reqNoJcReq").text(obj.reqNo);
  7196. $("#jcReqItem").text(obj.groupName);
  7197. $("#jcReqRemark").text(obj.jyRemark);
  7198. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("jc_card_table").innerHTML);
  7199. needNewPageA = true;
  7200. } else if (obj.reqType == "2") {
  7201. var inspectStuff = (obj.inspectStuff == null || obj.inspectStuff == "null") ? "" : obj.inspectStuff;
  7202. jyContent += '<tr><td style="min-height: 30px;">' + obj.groupName + '</td><td>' + inspectStuff + '</td><td>' + obj.reqNo + '</td></tr>';
  7203. }
  7204. }
  7205. if (jyContent != null && jyContent != "" && jyContent.length > 0) {
  7206. if (needNewPageA) {
  7207. LODOP.NewPageA();
  7208. }
  7209. jyContent = jyTitle + jyContent;
  7210. $("#jyContent").html(jyContent);
  7211. //检验
  7212. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("jy_card_table").innerHTML);
  7213. }
  7214. if (printType == 1) {
  7215. LODOP.PREVIEW();
  7216. } else if (printType == 2) {
  7217. LODOP.PRINT_SETUP();
  7218. }
  7219. } else {
  7220. errorMesage(res);
  7221. }
  7222. }
  7223. });
  7224. }
  7225. /**
  7226. * 打印门诊病历
  7227. * @param patientId
  7228. * @param times
  7229. * @param clnicId
  7230. * @param payMark
  7231. * @param printType 打印模式 1 预览打印 2 打印设置
  7232. */
  7233. function printBlRecord(patientId, times, printType) {
  7234. $.ajax({
  7235. type: "GET",
  7236. url: '/thmz/getMzBlrecord?patientId=' + patientId + '&times=' + times,
  7237. contentType: "application/json;charset=UTF-8",
  7238. dataType: "json",
  7239. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7240. success: function (res) {
  7241. if (res == '401' || res == 401) {
  7242. window.location.href = '/thmz/login/view'
  7243. return;
  7244. }
  7245. if (res.code == 0) {
  7246. setPrint();
  7247. LODOP = getLodop();
  7248. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院门诊病历");
  7249. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  7250. //设置默认打印机
  7251. LODOP.SET_PRINTER_INDEX(printIndex);
  7252. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  7253. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  7254. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  7255. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊病历");//对新建的纸张重命名
  7256. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  7257. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  7258. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  7259. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  7260. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  7261. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  7262. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  7263. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  7264. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  7265. var mzPatientMi = res.mzPatientMi;
  7266. $("#patientIdBlrecord").text(mzPatientMi.patientId);
  7267. $("#patientNameBlrecord").text(mzPatientMi.name);
  7268. $("#patientGenderBlrecord").text(mzPatientMi.gender);
  7269. $("#patientAgeBlrecord").text(mzPatientMi.age + "岁");
  7270. var mzBlRecord = res.mzBlRecord;
  7271. if (mzBlRecord.firstOrNot == "1") {
  7272. $("#firstOrNotTitle").text("复诊");
  7273. } else {
  7274. $("#firstOrNotTitle").text("初诊");
  7275. }
  7276. if (mzBlRecord.emrChiefComplaint != null && mzBlRecord.emrChiefComplaint != "") {
  7277. $("#emrChiefComplaintBlrecord").text(mzBlRecord.emrChiefComplaint);
  7278. $("#emrChiefComplaintBlrecord").parent().css("display", "block");
  7279. } else {
  7280. $("#emrChiefComplaintBlrecord").parent().css("display", "none");
  7281. }
  7282. if (mzBlRecord.emrHpi != null && mzBlRecord.emrHpi != "") {
  7283. $("#emrHpiBlrecord").text(mzBlRecord.emrHpi);
  7284. $("#emrHpiBlrecord").parent().css("display", "block");
  7285. } else {
  7286. $("#emrHpiBlrecord").parent().css("display", "none");
  7287. }
  7288. if (mzBlRecord.emrPs != null && mzBlRecord.emrPs != "") {
  7289. $("#emrPsBlrecord").text(mzBlRecord.emrPs);
  7290. $("#emrPsBlrecord").parent().css("display", "block");
  7291. } else {
  7292. $("#emrPsBlrecord").parent().css("display", "none");
  7293. }
  7294. if (mzBlRecord.personalHistory != null && mzBlRecord.personalHistory != "") {
  7295. $("#personalHistoryBlrecord").text(mzBlRecord.personalHistory);
  7296. $("#personalHistoryBlrecord").parent().css("display", "block");
  7297. } else {
  7298. $("#personalHistoryBlrecord").parent().css("display", "none");
  7299. }
  7300. if (mzBlRecord.familyHistory != null && mzBlRecord.familyHistory != "") {
  7301. $("#familyHistoryBlrecord").text(mzBlRecord.familyHistory);
  7302. $("#familyHistoryBlrecord").parent().css("display", "block");
  7303. } else {
  7304. $("#familyHistoryBlrecord").parent().css("display", "none");
  7305. }
  7306. if (mzBlRecord.obstericalHistory != null && mzBlRecord.obstericalHistory != "") {
  7307. $("#obstericalHistoryBlrecord").text(mzBlRecord.obstericalHistory);
  7308. $("#obstericalHistoryBlrecord").parent().css("display", "block");
  7309. } else {
  7310. $("#obstericalHistoryBlrecord").parent().css("display", "none");
  7311. }
  7312. var tz = getTz(mzBlRecord);
  7313. if (tz != null && tz != "") {
  7314. $("#tzjcBlrecord").text(tz);
  7315. $("#tzjcBlrecord").parent().css("display", "block");
  7316. } else {
  7317. $("#tzjcBlrecord").parent().css("display", "none");
  7318. }
  7319. if (mzBlRecord.emrPe != null && mzBlRecord.emrPe != "") {
  7320. $("#emrPeBlrecord").text(mzBlRecord.emrPe);
  7321. $("#emrPeBlrecord").parent().css("display", "block");
  7322. } else {
  7323. $("#emrPeBlrecord").parent().css("display", "none");
  7324. }
  7325. if (res.icdText != null && res.icdText != "") {
  7326. $("#icdTextBlrecord").text(res.icdText);
  7327. $("#icdTextBlrecord").parent().css("display", "block");
  7328. } else {
  7329. $("#icdTextBlrecord").parent().css("display", "none");
  7330. }
  7331. if (mzBlRecord.emrProcess != null && mzBlRecord.emrProcess != "") {
  7332. $("#emrProcessBlrecord").html(mzBlRecord.emrProcess);
  7333. $("#emrProcessBlrecord").parent().css("display", "block");
  7334. } else {
  7335. $("#emrProcessBlrecord").parent().css("display", "none");
  7336. }
  7337. if (mzBlRecord.emrJkjy != null && mzBlRecord.emrJkjy != "") {
  7338. $("#emrJkjyBlrecord").text(mzBlRecord.emrJkjy);
  7339. $("#emrJkjyBlrecord").parent().css("display", "block");
  7340. } else {
  7341. $("#emrJkjyBlrecord").parent().css("display", "none");
  7342. }
  7343. $("#visitDeptBlrecord").text(res.deptName);
  7344. $("#visitDoctorBlrecord").text(res.doctorName);
  7345. $("#visitDateBlrecord").text(res.visitDate);
  7346. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("mz_blrecord_card_table").innerHTML);
  7347. if (printType == 1) {
  7348. LODOP.PREVIEW();
  7349. } else if (printType == 2) {
  7350. LODOP.PRINT_SETUP();
  7351. }
  7352. } else {
  7353. errorMesage(res);
  7354. }
  7355. }
  7356. });
  7357. }
  7358. /**
  7359. * 将内容拼接空格,这样才会有下划线
  7360. * @param mzPatientMi
  7361. * @param maxLength 最大长度
  7362. * @returns {*}
  7363. */
  7364. function formatUnderline(params, maxLength) {
  7365. var length = 0;
  7366. if (params == null || params.length == 0) {
  7367. length = maxLength;
  7368. } else {
  7369. length = maxLength - params.length;
  7370. }
  7371. for (var i = 0; i < length; i++) {
  7372. params += " ";
  7373. }
  7374. return params;
  7375. }
  7376. /**
  7377. * 打印入院通知单
  7378. * @param patientId
  7379. * @param times
  7380. * @param clnicId
  7381. * @param payMark
  7382. * @param printType 打印模式 1 预览打印 2 打印设置
  7383. */
  7384. function printZyReq(patientId, printType) {
  7385. $.ajax({
  7386. type: "GET",
  7387. url: '/thmz/printZyReq?patientId=' + patientId,
  7388. contentType: "application/json;charset=UTF-8",
  7389. dataType: "json",
  7390. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7391. success: function (res) {
  7392. if (res == '401' || res == 401) {
  7393. window.location.href = '/thmz/login/view'
  7394. return;
  7395. }
  7396. if (res.code == 0) {
  7397. setPrint();
  7398. LODOP = getLodop();
  7399. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院入院通知单");
  7400. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  7401. //设置默认打印机
  7402. LODOP.SET_PRINTER_INDEX(printIndex);
  7403. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  7404. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  7405. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  7406. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "入院通知单");//对新建的纸张重命名
  7407. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  7408. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  7409. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  7410. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  7411. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  7412. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  7413. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  7414. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  7415. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  7416. var mzPatientMi = res.mzPatientMi;
  7417. var mzZyReq = res.mzZyReq;
  7418. var mzPatientId = formatUnderline(mzPatientMi.patientId, 15);
  7419. $("#patientIdZyReq").text(mzPatientId);
  7420. var mzPatientMiName = formatUnderline(mzPatientMi.name, 22);
  7421. $("#patientNameZyReq").text(mzPatientMiName);
  7422. var mzPatientGender = formatUnderline(mzPatientMi.gender, 10);
  7423. $("#patientGenderZyReq").text(mzPatientGender);
  7424. var mzPatientAge = formatUnderline(mzPatientMi.age + "岁", 6);
  7425. $("#patientAgeZyReq").text(mzPatientAge);
  7426. var mzPatientSocialNo = formatUnderline(mzPatientMi.socialNo, 48);
  7427. $("#sfzZyReq").text(mzPatientSocialNo);
  7428. $("#birthDateZyReq").text(format(mzPatientMi.birthDay, "yyyy-MM-dd"));
  7429. var mzPatientPhoneNo = formatUnderline(mzPatientMi.phoneNo, 55);
  7430. $("#phoneZyReq").text(mzPatientPhoneNo);
  7431. $("#responseTypeZyReq").text(mzPatientMi.responseTypeName);
  7432. var mzPatientMiAddress = formatUnderline(mzPatientMi.address, 31);
  7433. $("#addressZyReq").text(mzPatientMiAddress);
  7434. if (mzZyReq.icdCode == null || mzZyReq.icdCode == "" || mzZyReq.icdCode.length == 0) {
  7435. $("#icsCodeZyReq").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
  7436. var mzPatientMiIcdText = formatUnderline(mzZyReq.icdText, 29);
  7437. $("#icsTextZyReq").text(" " + mzPatientMiIcdText);
  7438. } else {
  7439. var mzPatientMiIcdCode = formatUnderline(mzZyReq.icdCode, 12);
  7440. $("#icsCodeZyReq").text(mzPatientMiIcdCode);
  7441. var mzPatientMiIcdText = formatUnderline(mzZyReq.icdText, 29);
  7442. $("#icsTextZyReq").text(mzPatientMiIcdText);
  7443. }
  7444. var mzZyReqReqWard = formatUnderline(mzZyReq.reqWard, 6);
  7445. $("#reqDeptZyReq").text(mzZyReqReqWard);
  7446. var mzZyReqSmallDept = formatUnderline(mzZyReq.smallDept, 27);
  7447. $("#smallDeptZyReq").text(mzZyReqSmallDept);
  7448. //$("#admissStatusZyReq").text(mzZyReq.admissStatus);
  7449. $("input:checkbox[value='" + mzZyReq.admissStatus + "']").attr('checked', 'true');
  7450. var mzZyReqVisitDate = formatUnderline(format(mzZyReq.visitDate, "yyyy-MM-dd HH:mm:ss"), 37);
  7451. $("#visitDateZyReq").text(mzZyReqVisitDate);
  7452. var mzZyReqDeptCode = formatUnderline(mzZyReq.deptCode, 15);
  7453. $("#deptCodeZyReq").text(mzZyReqDeptCode);
  7454. var mzZyReqDoctorCode = formatUnderline(mzZyReq.doctorCode, 16);
  7455. $("#doctorCodeZyReq").text(mzZyReqDoctorCode);
  7456. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("mz_zy_req_table").innerHTML);
  7457. if (printType == 1) {
  7458. LODOP.PREVIEW();
  7459. } else if (printType == 2) {
  7460. LODOP.PRINT_SETUP();
  7461. }
  7462. } else {
  7463. errorMesage(res);
  7464. }
  7465. }
  7466. });
  7467. }
  7468. /**
  7469. * 打开查看检查检验报告窗口(含往期)
  7470. * @param patientId
  7471. */
  7472. function previewYjReqAll(patientId) {
  7473. $("#visitingDetailModal").modal("hide");
  7474. $("#previewYjReqModal").modal();
  7475. $("#previewYjReqModalPatientId").val(patientId);
  7476. $("#previewYjReqModalTimes").val(null);
  7477. //重置参数
  7478. retryCount = 0;
  7479. initJcJyTable();
  7480. }
  7481. /**
  7482. * 打开查看检查检验报告窗口
  7483. * @param patientId 门诊病人ID
  7484. * @param times 就诊次数
  7485. */
  7486. function previewYjReq(patientId, times) {
  7487. $("#visitingDetailModal").modal("hide");
  7488. $("#previewYjReqModal").modal();
  7489. $("#previewYjReqModalPatientId").val(patientId);
  7490. $("#previewYjReqModalTimes").val(times);
  7491. //重置参数
  7492. retryCount = 0;
  7493. initJcJyTable();
  7494. }
  7495. /**
  7496. * 检查检验列表类型按钮切换事件
  7497. * @param object
  7498. */
  7499. function jcjyButtonChange(object) {
  7500. $("#jcjy_group").find("button").each(function (index, element) {
  7501. if ($(element).hasClass("btn-primary")) {
  7502. $(element).removeClass("btn-primary").addClass("btn-default");
  7503. }
  7504. });
  7505. $(object).removeClass("btn-default").addClass("btn-primary");
  7506. initJcJyTable();
  7507. }
  7508. /**
  7509. * 初始化检查检验报告列表
  7510. */
  7511. function initJcJyTable() {
  7512. clearInspectionDetail();
  7513. clearJcDetail();
  7514. var typeIndex = getIndex("jcjy_group");
  7515. if (typeIndex == 0) {
  7516. //检查
  7517. $('#tb_jy_pName_table_list').bootstrapTable("destroy");
  7518. $('#tb_jy_table_list').bootstrapTable("destroy");
  7519. initJcListTable();
  7520. $("#jy_detail").removeClass("in").addClass("hide");
  7521. $("#jc_detail").removeClass("hide").addClass("in");
  7522. } else {
  7523. $('#tb_table_list').bootstrapTable("destroy");
  7524. initJyListTable();
  7525. $("#jc_detail").removeClass("in").addClass("hide");
  7526. $("#jy_detail").removeClass("hide").addClass("in");
  7527. }
  7528. }
  7529. /**
  7530. * 初始化检查报告列表
  7531. */
  7532. function initJcListTable() {
  7533. $('#tb_table_list').bootstrapTable("destroy");
  7534. $('#tb_table_list').bootstrapTable({
  7535. url: '/thmz/getJcJyList', //请求后台的URL(*)
  7536. method: 'post', //请求方式(*)
  7537. toolbar: '#toolbar', //工具按钮用哪个容器
  7538. striped: true, //是否显示行间隔色
  7539. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  7540. pagination: true, //是否显示分页(*)
  7541. sortable: true, //是否启用排序
  7542. sortOrder: "asc", //排序方式
  7543. queryParams: queryParams, //传递参数(*)
  7544. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  7545. pageNumber: 1, //初始化加载第一页,默认第一页
  7546. pageSize: 5, //每页的记录行数(*)
  7547. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  7548. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  7549. strictSearch: true,
  7550. showColumns: false, //是否显示所有的列
  7551. showRefresh: false, //是否显示刷新按钮
  7552. minimumCountColumns: 2, //最少允许的列数
  7553. clickToSelect: true, //是否启用点击选中行
  7554. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  7555. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  7556. cardView: false, //是否显示详细视图
  7557. detailView: false,
  7558. //rowStyle:rowStyle,//通过自定义函数设置行样式
  7559. ajaxOptions: {
  7560. headers: {
  7561. 'Accept': 'application/json',
  7562. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  7563. }
  7564. },
  7565. columns: [
  7566. {
  7567. field: 'groupName',
  7568. title: '项目名称',
  7569. align: "center",
  7570. valign: 'middle',
  7571. }, {
  7572. field: 'reqDate',
  7573. title: '申请时间',
  7574. align: "center",
  7575. valign: 'middle',
  7576. formatter: function (value, row, index) {
  7577. if (value == null || value == "") {
  7578. return "";
  7579. }
  7580. return format(value, "yyyy-MM-dd HH:mm:ss");
  7581. }
  7582. }
  7583. ],
  7584. onClickRow: function (row) {
  7585. clearJcDetail();
  7586. $("#patientId_t").text(row.patientId);
  7587. $("#name_t").text(row.patientName);
  7588. $("#date_t").text(format(row.reqDate, "yyyy-MM-dd HH:mm:ss"));
  7589. fitJcDetail(row.reqNo,row.patientId);
  7590. },
  7591. responseHandler: function (res) {
  7592. if (res == '401' || res == 401) {
  7593. window.location.href = '/thmz/login/view'
  7594. return;
  7595. }
  7596. var ress = eval(res);
  7597. if (ress.code == -1) {
  7598. if (ress.message != null && ress.message != '') {
  7599. errorMesage(ress);
  7600. }
  7601. if (retryCount == 0) {
  7602. retryCount++;
  7603. $("#jyButton").click();
  7604. return;
  7605. }
  7606. return {
  7607. "total": 0,//总页数
  7608. "rows": {} //数据
  7609. };
  7610. }
  7611. if (ress.count <= 0 && retryCount == 0) {
  7612. retryCount++;
  7613. $("#jyButton").click();
  7614. return;
  7615. }
  7616. //有数据的时候,计数也需要加1,防止这时医生自己候点击检验没数据又跳回检查
  7617. retryCount++;
  7618. return {
  7619. "total": ress.count,//总页数
  7620. "rows": ress.data //数据
  7621. };
  7622. },
  7623. onLoadSuccess: function (data) {
  7624. $(".pagination-detail").css("display", "none");
  7625. }
  7626. });
  7627. }
  7628. /**
  7629. * 构建列表查询参数
  7630. * @param params
  7631. * @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}}
  7632. */
  7633. function queryParams(params) {
  7634. var patientId = $("#previewYjReqModalPatientId").val();
  7635. var times = $("#previewYjReqModalTimes").val();
  7636. return {
  7637. reqType: "3",
  7638. patientId: patientId,
  7639. times: times,
  7640. pageSize: params.limit, //页面大小
  7641. pageIndex: params.offset / params.limit //页码
  7642. };
  7643. };
  7644. /**
  7645. * 加载检查明细
  7646. * @param reqNo
  7647. */
  7648. function fitJcDetail(reqNo,patientId) {
  7649. $.ajax({
  7650. type: "GET",
  7651. url: '/thmz/getYjJcRecordReport?hisReqNo=' + reqNo+"&patientId="+patientId,
  7652. contentType: "application/json;charset=UTF-8",
  7653. dataType: "json",
  7654. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7655. success: function (res) {
  7656. if (res == '401' || res == 401) {
  7657. window.location.href = '/thmz/login/view'
  7658. return;
  7659. }
  7660. if (res.code == 0) {
  7661. canBePrintJc = true;
  7662. $("#jy_detail").removeClass("in").addClass("hide");
  7663. $("#jc_detail").removeClass("hide").addClass("in");
  7664. var mzPatientMi = res.data.mzPatientMi;
  7665. $("#gender_jc").text(mzPatientMi.gender);
  7666. $("#age_jc").text(mzPatientMi.age);
  7667. var yjJcRecordReport = res.data.yjJcRecordReport;
  7668. $("#groupName").text(res.data.groupName);
  7669. $("#textJc").text(yjJcRecordReport.textJc);
  7670. $("#textZd").text(yjJcRecordReport.textZd);
  7671. var jcRecord = res.data.jcRecord;
  7672. $("#report_no").text(jcRecord.reportNo);
  7673. $("#reportId").text(jcRecord.reportId);
  7674. if (jcRecord.reportDate == null || jcRecord.reportDate == "") {
  7675. $("#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;");
  7676. } else {
  7677. $("#reportDate").text(format(jcRecord.reportDate, "yyyy-MM-dd HH:mm:ss"));
  7678. }
  7679. $("#confirmId").text(jcRecord.confirmId);
  7680. if (jcRecord.confirmDate == null || jcRecord.confirmDate == "") {
  7681. $("#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;");
  7682. } else {
  7683. $("#confirmDate").text(format(jcRecord.confirmDate, "yyyy-MM-dd HH:mm:ss"));
  7684. }
  7685. } else {
  7686. errorMesage(res);
  7687. }
  7688. }
  7689. });
  7690. }
  7691. /**
  7692. * 清空检查明细
  7693. * @param reqNo
  7694. */
  7695. function clearJcDetail() {
  7696. canBePrintJc = false;
  7697. $("#patientId_t").text("");
  7698. $("#name_t").text("");
  7699. $("#date_t").text("");
  7700. $("#gender_jc").text("");
  7701. $("#age_jc").text("");
  7702. $("#groupName").text("");
  7703. $("#textJc").text("");
  7704. $("#textZd").text("");
  7705. $("#report_no").text("");
  7706. $("#reportId").text("");
  7707. $("#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;");
  7708. $("#confirmId").text("");
  7709. $("#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;");
  7710. }
  7711. /**
  7712. * 初始化检验报告列表
  7713. */
  7714. function initJyListTable() {
  7715. var patientId = $("#previewYjReqModalPatientId").val();
  7716. var times = $("#previewYjReqModalTimes").val();
  7717. $('#tb_table_list').bootstrapTable("destroy");
  7718. $('#tb_table_list').bootstrapTable({
  7719. url: '/thmz/getJyListByPatientIdAndTimes?patientId=' + patientId + "&times=" + times, //请求后台的URL(*)
  7720. method: 'get', //请求方式(*)
  7721. toolbar: '#toolbar', //工具按钮用哪个容器
  7722. striped: true, //是否显示行间隔色
  7723. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  7724. pagination: true, //是否显示分页(*)
  7725. sortable: true, //是否启用排序
  7726. sortOrder: "asc", //排序方式
  7727. //queryParams: queryJyPNameParams, //传递参数(*)
  7728. sidePagination: "client", //分页方式:client客户端分页,server服务端分页(*)
  7729. pageNumber: 1, //初始化加载第一页,默认第一页
  7730. pageSize: 5, //每页的记录行数(*)
  7731. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  7732. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  7733. strictSearch: true,
  7734. showColumns: false, //是否显示所有的列
  7735. showRefresh: false, //是否显示刷新按钮
  7736. minimumCountColumns: 2, //最少允许的列数
  7737. clickToSelect: true, //是否启用点击选中行
  7738. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  7739. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  7740. cardView: false, //是否显示详细视图
  7741. detailView: false,
  7742. //rowStyle:rowStyle,//通过自定义函数设置行样式
  7743. ajaxOptions: {
  7744. headers: {
  7745. 'Accept': 'application/json',
  7746. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  7747. }
  7748. },
  7749. columns: [
  7750. {
  7751. field: 'aply_CTNT',
  7752. title: '检验名称',
  7753. align: "center",
  7754. valign: 'middle',
  7755. }, {
  7756. field: 'ordr_CREATE_DATE',
  7757. title: '检验时间',
  7758. align: "center",
  7759. valign: 'middle',
  7760. formatter: function (value, row, index) {
  7761. if (value == null || value == "") {
  7762. return "";
  7763. }
  7764. return format(value, "yyyy-MM-dd HH:mm:ss");
  7765. }
  7766. }
  7767. ],
  7768. onClickRow: function (row) {
  7769. queryInspectionDetail(row.ordr_ID);
  7770. },
  7771. responseHandler: function (res) {
  7772. if (res == '401' || res == 401) {
  7773. window.location.href = '/thmz/login/view'
  7774. return;
  7775. }
  7776. var ress = eval(res);
  7777. if (ress.code == -1) {
  7778. if (retryCount == 0) {
  7779. retryCount++;
  7780. $("#jcButton").click();
  7781. return;
  7782. }
  7783. if (ress.message != null && ress.message != '') {
  7784. errorMesage(ress);
  7785. }
  7786. return {
  7787. "total": ress.data.length,//总页数
  7788. "rows": ress.data //数据
  7789. };
  7790. }
  7791. if (ress.data.length <= 0 && retryCount == 0) {
  7792. retryCount++;
  7793. $("#jcButton").click();
  7794. return;
  7795. }
  7796. //有数据的时候,计数也需要加1,防止这时医生自己候点击检查没数据又跳回检验
  7797. retryCount++;
  7798. return {
  7799. "total": ress.data.length,//总页数
  7800. "rows": ress.data //数据
  7801. };
  7802. },
  7803. onLoadSuccess: function (data) {
  7804. $("#jy_table_table_div").find(".pagination-detail").css("display", "none");
  7805. }
  7806. });
  7807. }
  7808. /**
  7809. * 清空检验明细
  7810. * @param orderId
  7811. */
  7812. function clearInspectionDetail() {
  7813. canBePrintJy = false;
  7814. $("#patientId_t_jy").text("");
  7815. $("#name_t_jy").text("");
  7816. $("#gender_jy").text("");
  7817. $("#age_jy").text("");
  7818. $("#reqDept_t_jy").text("");
  7819. $("#bed_no_jy").text("");
  7820. $("#smpl_jy").text("");
  7821. $("#item_jy").text("");
  7822. $("#applyDate").text("");
  7823. $("#orderCreateDate").text("");
  7824. $("#auditTime").text("");
  7825. $("#orderUsrName").text("");
  7826. $("#testUsrName").text("");
  7827. $("#auditUsrName").text("");
  7828. $("#jyBody").html("");
  7829. }
  7830. /**
  7831. * 加载检验明细
  7832. * @param orderId
  7833. */
  7834. function queryInspectionDetail(orderId) {
  7835. clearInspectionDetail();
  7836. $.ajax({
  7837. type: "GET",
  7838. url: '/thmz/getInspectionDetail?orderId=' + orderId,
  7839. contentType: "application/json;charset=UTF-8",
  7840. dataType: "json",
  7841. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7842. success: function (res) {
  7843. if (res == '401' || res == 401) {
  7844. window.location.href = '/thmz/login/view'
  7845. return;
  7846. }
  7847. if (res.code == 0) {
  7848. canBePrintJy = true;
  7849. $("#jc_detail").removeClass("in").addClass("hide");
  7850. $("#jy_detail").removeClass("hide").addClass("in");
  7851. var mzPatientMi = res.mzPatientMi;
  7852. $("#patientId_t_jy").text(mzPatientMi.patientId);
  7853. $("#name_t_jy").text(mzPatientMi.name);
  7854. $("#gender_jy").text(mzPatientMi.gender);
  7855. $("#age_jy").text(mzPatientMi.age);
  7856. var html = "";
  7857. if (res.data != null) {
  7858. var inspectionHeader = res.data.inspectionHeader;
  7859. $("#reqDept_t_jy").text(inspectionHeader.dept_NAME);
  7860. $("#bed_no_jy").text(inspectionHeader.ptnt_BED_NO);
  7861. $("#smpl_jy").text(inspectionHeader.smpl_NAME);
  7862. $("#item_jy").text(inspectionHeader.aply_CNTN);
  7863. $("#applyDate").text(format(inspectionHeader.aply_DATE, "yyyy-MM-dd HH:mm:ss"));
  7864. $("#orderCreateDate").text(format(inspectionHeader.ordr_CREATE_DATE, "yyyy-MM-dd HH:mm:ss"));
  7865. $("#auditTime").text(format(inspectionHeader.audt_TIME, "yyyy-MM-dd HH:mm:ss"));
  7866. $("#orderUsrName").text(inspectionHeader.ordr_USR_NAME);
  7867. $("#testUsrName").text(inspectionHeader.test_USR_NAME);
  7868. $("#auditUsrName").text(inspectionHeader.audt_USR_NAME);
  7869. var inspectionItems = res.data.inspectionItems;
  7870. if (inspectionItems != null && inspectionItems.length > 0) {
  7871. for (var i = 0; i < inspectionItems.length; i++) {
  7872. html += "<tr>";
  7873. var obj = inspectionItems[i];
  7874. var itm_VALUE =obj.itm_VALUE;
  7875. if(itm_VALUE==null || itm_VALUE=="null"){
  7876. itm_VALUE="";
  7877. }
  7878. itm_VALUE+= (obj.itm_STR_VALUE == null || obj.itm_STR_VALUE == "null") ? "" : obj.itm_STR_VALUE;
  7879. var range =obj.range;
  7880. if(range==null || range=="null"){
  7881. range="";
  7882. }
  7883. range+= (obj.range_STR == null || obj.range_STR == "null") ? "" : obj.range_STR;
  7884. html += "<td width='25%'>" + obj.itm_NAME + "</td>";
  7885. html += "<td width='16.66%'>" + itm_VALUE + "</td>";
  7886. html += "<td width='16.66%'>" + obj.itm_UNIT + "</td>";
  7887. if (obj.itm_ALERT == null || obj.itm_ALERT == "") {
  7888. html += "<td width='16.66%'><span style=\"color:#67C23A;font-weight:bold\"></span></td>";
  7889. } else if (obj.itm_ALERT == "H") {
  7890. html += "<td width='16.66%'><span style=\"color:#F56C6C;font-weight:bold\">↑</span></td>";
  7891. } else if (obj.itm_ALERT == "L") {
  7892. html += "<td width='16.66%'><span style=\"color:#F56C6C;font-weight:bold\">↓</span></td>";
  7893. }
  7894. html += "<td width='25%'>" + range + "</td>";
  7895. html += "</tr>";
  7896. }
  7897. }
  7898. }
  7899. $("#jyBody").html(html);
  7900. } else {
  7901. errorMesage(res);
  7902. }
  7903. }
  7904. });
  7905. }
  7906. /**
  7907. * 打印检查检验报告单
  7908. * @param printType 打印模式 1 预览打印 2 打印设置
  7909. */
  7910. function printJyJcReport(printType) {
  7911. var typeIndex = getIndex("jcjy_group");
  7912. var title = "检查报告单";
  7913. if (typeIndex == 1) {
  7914. title = "检验报告单"
  7915. if (!canBePrintJy) {
  7916. warningMesageSimaple("没有任何【" + title + "】可供打印!");
  7917. return;
  7918. }
  7919. } else {
  7920. if (!canBePrintJc) {
  7921. warningMesageSimaple("没有任何【" + title + "】可供打印!");
  7922. return;
  7923. }
  7924. }
  7925. setPrint();
  7926. LODOP = getLodop();
  7927. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院" + title);
  7928. LODOP.SET_PRINT_STYLE("FontSize", 7); //字体大小
  7929. //设置默认打印机
  7930. LODOP.SET_PRINTER_INDEX(printIndex);
  7931. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  7932. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  7933. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  7934. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", title);//对新建的纸张重命名
  7935. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  7936. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  7937. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  7938. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  7939. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  7940. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  7941. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  7942. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  7943. var strStyle = "<style>table{width: 96%;} #jy_detail_content thead {border-bottom: 1px solid black;border-collapse: collapse;}</style>";
  7944. if (typeIndex == 0) {
  7945. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("jc_detail").innerHTML);
  7946. }
  7947. if (typeIndex == 1) {
  7948. LODOP.ADD_PRINT_TABLE("37mm", "5mm", "130mm", "138mm", strStyle + document.getElementById("jy_detail_content").innerHTML);
  7949. LODOP.SET_PRINT_STYLEA(0, "Vorient", 3);
  7950. LODOP.ADD_PRINT_HTM("0mm", "5mm", "130mm", "200mm", strStyle + document.getElementById("jy_detail_title").innerHTML);
  7951. LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
  7952. LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
  7953. LODOP.ADD_PRINT_HTM("177mm", "5mm", "130mm", "200mm", strStyle + document.getElementById("jy_detail_foot").innerHTML);
  7954. LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
  7955. LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
  7956. }
  7957. if (printType == 1) {
  7958. LODOP.PREVIEW();
  7959. } else if (printType == 2) {
  7960. LODOP.PRINT_SETUP();
  7961. }
  7962. }
  7963. /**
  7964. * 初始化科室下拉选
  7965. */
  7966. function initExecUnit() {
  7967. //父科室列表
  7968. $.ajax({
  7969. type: "GET",
  7970. url: '/thmz/allUnitCode',
  7971. dataType: "json",
  7972. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7973. success: function (data) {
  7974. if (data == '401' || data == 401) {
  7975. window.location.href = '/thmz/login/view'
  7976. return;
  7977. }
  7978. $('#execUnit').empty(); //清空resText里面的所有内容
  7979. var html = '';
  7980. $.each(data.data, function (commentIndex, comment) {
  7981. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + '-' + comment.code + ')</option>';
  7982. });
  7983. $('#execUnit').html(html);
  7984. $('#execUnit').selectpicker('refresh');
  7985. }
  7986. });
  7987. }
  7988. /**
  7989. * 初始化证件类型下拉选
  7990. */
  7991. function initCertificateTypeSelect() {
  7992. $.ajax({
  7993. type: "GET",
  7994. url: '/thmz/listCertificateType',
  7995. contentType: "application/json;charset=UTF-8",
  7996. dataType: "json",
  7997. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7998. success: function (res) {
  7999. if (res == '401' || res == 401) {
  8000. window.location.href = '/thmz/login/view'
  8001. return;
  8002. }
  8003. if (res.code == 0) {
  8004. res.data.forEach(function (item, index) {
  8005. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  8006. $('#certificateType').append(html);
  8007. $('#editUserCertificateType').append(html);
  8008. });
  8009. $('#editUserCertificateType').selectpicker('refresh');
  8010. } else {
  8011. errorMesage(res);
  8012. }
  8013. }
  8014. });
  8015. }
  8016. /**
  8017. * 加载病历信息编辑预览
  8018. * @param patientId
  8019. * @param times
  8020. * @param type 1 编辑 2 预览
  8021. */
  8022. function showMzBlRecordModal(patientId, times, type) {
  8023. $.ajax({
  8024. type: "GET",
  8025. url: '/thmz/getMzBlrecord?patientId=' + patientId + '&times=' + times,
  8026. contentType: "application/json;charset=UTF-8",
  8027. dataType: "json",
  8028. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8029. success: function (res) {
  8030. if (res == '401' || res == 401) {
  8031. window.location.href = '/thmz/login/view'
  8032. return;
  8033. }
  8034. if (res.code == 0) {
  8035. //$("#visitingDetailModal").modal("hide");
  8036. var mzPatientMi = res.mzPatientMi;
  8037. $("#editPatientId").text(mzPatientMi.patientId);
  8038. $("#editPatientName").text(mzPatientMi.name);
  8039. $("#editPatientGender").text(mzPatientMi.gender);
  8040. $("#editPatientAge").text(mzPatientMi.age + "岁");
  8041. var mzBlRecord = res.mzBlRecord;
  8042. // if (mzBlRecord.firstOrNot == "1") {
  8043. // $("#firstOrNotTitle").text("复诊");
  8044. // } else {
  8045. // $("#firstOrNotTitle").text("初诊");
  8046. // }
  8047. if (mzBlRecord.emrChiefComplaint != null && mzBlRecord.emrChiefComplaint != "") {
  8048. $("#editEmrChiefComplaint").val(mzBlRecord.emrChiefComplaint);
  8049. $("#editEmrChiefComplaint").parent().parent().parent().css("display", "block");
  8050. } else {
  8051. $("#editEmrChiefComplaint").parent().parent().parent().css("display", "none");
  8052. }
  8053. if (mzBlRecord.emrHpi != null && mzBlRecord.emrHpi != "") {
  8054. $("#editEmrHpi").val(mzBlRecord.emrHpi);
  8055. $("#editEmrHpi").parent().parent().parent().css("display", "block");
  8056. } else {
  8057. $("#editEmrHpi").parent().parent().parent().css("display", "none");
  8058. }
  8059. if (mzBlRecord.emrPs != null && mzBlRecord.emrPs != "") {
  8060. $("#editEmrPs").val(mzBlRecord.emrPs);
  8061. $("#editEmrPs").parent().parent().parent().css("display", "block");
  8062. } else {
  8063. $("#editEmrPs").parent().parent().parent().css("display", "none");
  8064. }
  8065. if (mzBlRecord.personalHistory != null && mzBlRecord.personalHistory != "") {
  8066. $("#editPersonalHistory").val(mzBlRecord.personalHistory);
  8067. $("#editPersonalHistory").parent().parent().parent().css("display", "block");
  8068. } else {
  8069. $("#editPersonalHistory").parent().parent().parent().css("display", "none");
  8070. }
  8071. if (mzBlRecord.familyHistory != null && mzBlRecord.familyHistory != "") {
  8072. $("#editFamilyHistory").val(mzBlRecord.familyHistory);
  8073. $("#editFamilyHistory").parent().parent().parent().css("display", "block");
  8074. } else {
  8075. $("#editFamilyHistory").parent().parent().parent().css("display", "none");
  8076. }
  8077. if (mzBlRecord.obstericalHistory != null && mzBlRecord.obstericalHistory != "") {
  8078. $("#editObstericalHistory").val(mzBlRecord.obstericalHistory);
  8079. $("#editObstericalHistory").parent().parent().parent().css("display", "block");
  8080. } else {
  8081. $("#editObstericalHistory").parent().parent().parent().css("display", "none");
  8082. }
  8083. var tz = getTz(mzBlRecord);
  8084. if (tz != null && tz != "") {
  8085. $("#editTgjc").val(tz);
  8086. $("#editTgjc").parent().parent().parent().css("display", "block");
  8087. } else {
  8088. $("#editTgjc").parent().parent().parent().css("display", "none");
  8089. }
  8090. if (mzBlRecord.emrPe != null && mzBlRecord.emrPe != "") {
  8091. $("#editQtjc").val(mzBlRecord.emrPe);
  8092. $("#editQtjc").parent().parent().parent().css("display", "block");
  8093. } else {
  8094. $("#editQtjc").parent().parent().parent().css("display", "none");
  8095. }
  8096. if (res.icdText != null && res.icdText != "") {
  8097. $("#editZd").val(res.icdText);
  8098. $("#editZd").parent().parent().parent().css("display", "block");
  8099. } else {
  8100. $("#editZd").parent().parent().parent().css("display", "none");
  8101. }
  8102. if (mzBlRecord.emrProcess != null && mzBlRecord.emrProcess != "") {
  8103. var reg = new RegExp("</br>", "g");//g,表示全部替换。
  8104. var editEmrProcess=mzBlRecord.emrProcess.replace(reg, "\n");
  8105. reg = new RegExp("&nbsp;", "g");//g,表示全部替换。
  8106. editEmrProcess=editEmrProcess.replace(reg, "");
  8107. $("#editEmrProcess").val(editEmrProcess);
  8108. $("#editEmrProcess").parent().parent().parent().css("display", "block");
  8109. } else {
  8110. $("#editEmrProcess").parent().parent().parent().css("display", "none");
  8111. }
  8112. if (mzBlRecord.emrJkjy != null && mzBlRecord.emrJkjy != "" && mzBlRecord.emrJkjy != "无") {
  8113. $("#editEmrJkjy").val(mzBlRecord.emrJkjy);
  8114. $("#editEmrJkjy").parent().parent().parent().css("display", "block");
  8115. } else {
  8116. $("#editEmrJkjy").parent().parent().parent().css("display", "none");
  8117. }
  8118. if (type == 1) {
  8119. $("#mzBlRecorTitle").html("门诊病历【编辑】");
  8120. $("#setOtherEmrProcess").removeClass("in").addClass("hide");
  8121. $("#openBlRecordModel").removeClass("hide").addClass("in");
  8122. $("#setEmrProcess").removeClass("hide").addClass("in");
  8123. $("#newEmrProcessDiv").removeClass("hide").addClass("in");
  8124. $("#visitingDetailModal").modal("hide");
  8125. } else if (type == 2) {
  8126. $("#mzBlRecorTitle").html("门诊病历【预览】");
  8127. $("#setOtherEmrProcess").removeClass("hide").addClass("in");
  8128. $("#openBlRecordModel").removeClass("in").addClass("hide");
  8129. $("#setEmrProcess").removeClass("in").addClass("hide");
  8130. $("#newEmrProcessDiv").removeClass("in").addClass("hide");
  8131. //因为预览的时候,关闭预览框没有清空数据,且 此时基础数据的病历次数被清空
  8132. if ($("#mzBlTimes").val() != null && $("#mzBlTimes").val() != "" && ($("#baseMzBlTimes").val() == null || $("#baseMzBlTimes").val() == "")) {
  8133. $("#baseMzBlTimes").val($("#mzBlTimes").val());
  8134. }
  8135. $("#otherBlRecordModal").modal("hide");
  8136. }
  8137. $("#mzBlTimes").val(mzBlRecord.times);
  8138. $("#editMzBlRecordModal").modal();
  8139. } else {
  8140. errorMesage(res);
  8141. }
  8142. }
  8143. });
  8144. }
  8145. /**
  8146. * 清空区域
  8147. */
  8148. function clearInput() {
  8149. //编辑病历的时候,没有基础病历的就诊次数,如果是预览病历的时候,有基础病历的次数
  8150. var baseMzBlTimes = $("#baseMzBlTimes").val();
  8151. $("#editPatientId").text(null);
  8152. $("#editPatientName").text(null);
  8153. $("#editPatientGender").text(null);
  8154. $("#editPatientAge").text(null);
  8155. $("#editEmrChiefComplaint").val(null);
  8156. $("#editEmrHpi").val(null);
  8157. $("#editEmrPs").val(null);
  8158. $("#editPersonalHistory").val(null);
  8159. $("#editFamilyHistory").val(null);
  8160. $("#editObstericalHistory").val(null);
  8161. $("#editTgjc").val(null);
  8162. $("#editQtjc").val(null);
  8163. $("#editZd").val(null);
  8164. $("#editEmrProcess").val(null);
  8165. $("#editEmrJkjy").val(null);
  8166. $("#newEmrProcess").val(null);
  8167. $("#mzBlTimes").val(null);
  8168. if (baseMzBlTimes != null && baseMzBlTimes != "") {
  8169. $("#otherBlRecordModal").modal();
  8170. }
  8171. }
  8172. /**
  8173. * 保存门诊病历
  8174. */
  8175. function setEmrProcess() {
  8176. $("#editMzBlRecordModal").modal("hide");
  8177. $("#messageModal").modal();
  8178. $("#messageContent").html("是否保存并替换已有补充处理意见?");
  8179. $("#messageButton").off("click").on("click", function (t) {
  8180. if ($("#newEmrProcess").val() == null || $("#newEmrProcess").val() == "") {
  8181. $("#messageContent").html("当前录入的补充处理为空,是否保存并替换已有补充处理意见?");
  8182. $("#messageButton").off("click").on("click", function (t) {
  8183. $("#messageModal").modal("hide");
  8184. sendEmrProcess();
  8185. });
  8186. } else {
  8187. $("#messageModal").modal("hide");
  8188. sendEmrProcess();
  8189. }
  8190. });
  8191. $("#cancelButton").off("click").on("click", function (t) {
  8192. $("#editMzBlRecordModal").modal();
  8193. });
  8194. }
  8195. /**
  8196. * 提交保存门诊病历
  8197. */
  8198. function sendEmrProcess() {
  8199. $.ajax({
  8200. type: "POST",
  8201. url: '/thmz/setEmrProcess',
  8202. contentType: "application/json;charset=UTF-8",
  8203. dataType: "json",
  8204. data: JSON.stringify({
  8205. "patientId": $("#editPatientId").text(),
  8206. "times": $("#mzBlTimes").val(),
  8207. "emrChiefComplaint": $("#editEmrChiefComplaint").val(),
  8208. "emrHpi": $("#editEmrHpi").val(),
  8209. "emrPs": $("#editEmrPs").val(),
  8210. "personalHistory": $("#editPersonalHistory").val(),
  8211. "familyHistory": $("#editFamilyHistory").val(),
  8212. "obstericalHistory": $("#editObstericalHistory").val(),
  8213. "emrJkjy": $("#editEmrJkjy").val(),
  8214. "emrProcess": $("#newEmrProcess").val()
  8215. }),
  8216. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8217. success: function (res) {
  8218. if (res == '401' || res == 401) {
  8219. window.location.href = '/thmz/login/view'
  8220. return;
  8221. }
  8222. if (res.code == 0) {
  8223. clearInput();
  8224. successMesage(res);
  8225. $("#editMzBlRecordModal").modal("hide");
  8226. } else {
  8227. errorMesage(res);
  8228. }
  8229. }
  8230. });
  8231. }
  8232. /**
  8233. * 打开待合并病历列表弹框
  8234. */
  8235. function openBlRecordModel() {
  8236. $("#editMzBlRecordModal").modal("hide");
  8237. $("#otherBlRecordModal").modal();
  8238. initOtherMzBlRecordList();
  8239. }
  8240. /**
  8241. * 关闭待合并病历列表
  8242. */
  8243. function closeBlRecordModel() {
  8244. $('#baseMzBlTimes').val(null);
  8245. $("#visitingDetailModal").modal();
  8246. }
  8247. /**
  8248. * 病历列表
  8249. */
  8250. function initOtherMzBlRecordList() {
  8251. $('#other_bl_record_table').bootstrapTable("destroy");
  8252. $('#other_bl_record_table').bootstrapTable({
  8253. url: '/thmz/getMzBlRecordList', //请求后台的URL(*)
  8254. method: 'post', //请求方式(*)
  8255. toolbar: '#toolbar', //工具按钮用哪个容器
  8256. striped: true, //是否显示行间隔色
  8257. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  8258. pagination: true, //是否显示分页(*)
  8259. sortable: true, //是否启用排序
  8260. sortOrder: "desc", //排序方式
  8261. queryParams: queryOtherParams, //传递参数(*)
  8262. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  8263. pageNumber: 1, //初始化加载第一页,默认第一页
  8264. pageSize: 5, //每页的记录行数(*)
  8265. pageList: [10, 15, 25, 50, 100], //可供选择的每页的行数(*)
  8266. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  8267. strictSearch: true,
  8268. showColumns: false, //是否显示所有的列
  8269. showRefresh: false, //是否显示刷新按钮
  8270. minimumCountColumns: 2, //最少允许的列数
  8271. clickToSelect: true, //是否启用点击选中行
  8272. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  8273. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  8274. cardView: false, //是否显示详细视图
  8275. detailView: false,
  8276. //rowStyle:rowStyle,//通过自定义函数设置行样式
  8277. ajaxOptions: {
  8278. headers: {
  8279. 'Accept': 'application/json',
  8280. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  8281. }
  8282. },
  8283. columns: [
  8284. {
  8285. title: '操作',
  8286. field: 'op',
  8287. align: "center",
  8288. valign: 'middle',
  8289. formatter: function (value, row, index) {
  8290. 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>';
  8291. return [str].join('');
  8292. }
  8293. },
  8294. {
  8295. field: 'patientId',
  8296. title: '门诊ID',
  8297. align: "center",
  8298. valign: 'middle'
  8299. }, {
  8300. field: 'patientName',
  8301. title: '患者姓名',
  8302. align: "center",
  8303. valign: 'middle'
  8304. }, {
  8305. field: 'deptCode',
  8306. title: '就诊科室',
  8307. align: "center",
  8308. valign: 'middle'
  8309. }, {
  8310. field: 'doctorCode',
  8311. title: '接诊医师',
  8312. align: "center",
  8313. valign: 'middle'
  8314. }, {
  8315. field: 'firstOrNot',
  8316. title: '初/复诊',
  8317. align: "center",
  8318. valign: 'middle',
  8319. formatter: function (value, row, index) {
  8320. if (value == '1') {
  8321. return "复诊";
  8322. }
  8323. return "初诊";
  8324. }
  8325. }
  8326. , {
  8327. field: 'visitDate',
  8328. title: '就诊时间',
  8329. align: "center",
  8330. valign: 'middle',
  8331. formatter: function (value, row, index) {
  8332. if (value == null || value == "") {
  8333. return "";
  8334. }
  8335. return format(value, "yyyy-MM-dd HH:mm:ss");
  8336. }
  8337. }
  8338. ],
  8339. responseHandler: function (res) {
  8340. if (res == '401' || res == 401) {
  8341. window.location.href = '/thmz/login/view'
  8342. return;
  8343. }
  8344. var ress = eval(res);
  8345. if (ress.code == -1) {
  8346. if (ress.message != null && ress.message != '') {
  8347. errorMesage(ress);
  8348. }
  8349. return {
  8350. "total": 0,//总页数
  8351. "rows": {} //数据
  8352. };
  8353. }
  8354. return {
  8355. "total": ress.total,//总页数
  8356. "rows": ress.data //数据
  8357. };
  8358. },
  8359. });
  8360. }
  8361. /**
  8362. * 构建列表查询参数
  8363. * @param params
  8364. * @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}}
  8365. */
  8366. function queryOtherParams(params) {
  8367. var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
  8368. patientId: $("#editPatientId").text(),
  8369. exceptTimes: $("#mzBlTimes").val(),
  8370. pageSize: params.limit, //页面大小
  8371. pageIndex: params.offset / params.limit, //页码
  8372. };
  8373. return temp;
  8374. }
  8375. /**
  8376. * 提取处理意见保存
  8377. */
  8378. function setOtherEmrProcess() {
  8379. $("#editMzBlRecordModal").modal("hide");
  8380. $("#messageModal").modal();
  8381. $("#messageContent").html("确定要执行此次提取处理意见操作吗?");
  8382. $("#messageButton").off("click").on("click", function (t) {
  8383. $("#messageModal").modal("hide");
  8384. $.ajax({
  8385. type: "GET",
  8386. url: '/thmz/extractEmrProcess?patientId=' + $("#editPatientId").html() + '&baseTimes=' + $("#baseMzBlTimes").val() + '&times=' + $("#mzBlTimes").val(),
  8387. contentType: "application/json;charset=UTF-8",
  8388. dataType: "json",
  8389. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8390. success: function (res) {
  8391. if (res == '401' || res == 401) {
  8392. window.location.href = '/thmz/login/view'
  8393. return;
  8394. }
  8395. if (res.code == 0) {
  8396. successMesage(res);
  8397. $("#editMzBlRecordModal").modal("hide");
  8398. } else {
  8399. errorMesage(res);
  8400. }
  8401. }
  8402. });
  8403. });
  8404. $("#cancelButton").off("click").on("click", function (t) {
  8405. $("#editMzBlRecordModal").modal();
  8406. });
  8407. }