clinic.js 502 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615
  1. //@ sourceURL=clinic.js
  2. //判断病人列表是否在加载中,防止重复加载
  3. var msg_list_loading = false;
  4. //挂号卡片列表页面下标
  5. var pageIndex = 0;
  6. //药品使用方法,天数和频次的集合
  7. var groupIdMap = null;
  8. var LODOP; //声明为全局变量
  9. //默认打印机下标
  10. var printIndex = -1;
  11. // //上一個光标点击的元素ID
  12. var prevEleId = null;
  13. //打开检查检验报告的时候不知道哪个有报告,如果检查没有就自动打开检验,但是为了防止死循环,次数加到1就不在进行重试
  14. var retryCount = 0;
  15. //是否在读卡中
  16. var mztczfSiReadCardStatus = false;
  17. //药品组号与处方号关系
  18. var gropuIdAndOrderNoMap = null;
  19. //上一个药品大类
  20. //var prevCategoriesFlag = null;
  21. //处方回调和修改的时候处方号与处方tab的关系
  22. var orderNoAndTableIdMap = null;
  23. //处方回调和修改的时候处方tab与处方号的关系
  24. var tableIdAndOrderNoMap = null;
  25. $(function () {
  26. initGenderSelect();
  27. iniAdmissStatus();
  28. initListDeptSelect();
  29. //initTryResultSelect();
  30. initResponceTypeSelect();
  31. initTemplateTypeSelect("templateType");
  32. initTemplateKindTypeSelect('templateKindType');
  33. initZyClassTypeSelect();
  34. initInstructionSelect();
  35. setSelectSize();
  36. initCertificateTypeSelect();
  37. initMztcSelect();
  38. $('#editUserBirthDayGroup').datetimepicker({
  39. format: 'yyyy-mm-dd',
  40. language: 'zh-CN',
  41. minView: "month",
  42. });
  43. initDaterangepickerWithId('reportrange', "right");
  44. formatCheck();
  45. //数据校验
  46. init_validator();
  47. //初始频次下拉选
  48. initOrderFrequencys("orderFrequency", true);
  49. //初始频次下拉选
  50. initOrderFrequencys("orderFrequencyZl", true);
  51. //初始用药方式下拉选
  52. initSupplyTypes();
  53. //加载候诊患者列表
  54. loadUnClinicTableList();
  55. //加载接诊中患者列表
  56. loadInClinicTableList();
  57. //加载已接诊患者列表
  58. loadClinicTableList();
  59. //每隔一分钟秒读加载候诊患者列表
  60. setInterval(function () {
  61. //加载候诊患者列表
  62. loadUnClinicTableList();
  63. //加载已接诊患者列表 病人会缴费,需要刷新状态
  64. loadClinicTableList();
  65. }, 60000);
  66. //初始化快速接诊病人姓名栏事件
  67. initUserList();
  68. //初始化主诉弹出层
  69. initRecommendList();
  70. //卡号输入改变事件
  71. cardNoChange();
  72. //初始化省份
  73. initProvince(3);
  74. /**
  75. * 患者信息修改
  76. */
  77. $("#saveEditUser").on("click", function (t) {
  78. modifyPatient();
  79. });
  80. // /**
  81. // * 保存入院证
  82. // */
  83. // $("#saveBeHospitalized").on("click", function (t) {
  84. // saveBeHospitalized();
  85. // });
  86. /**
  87. * 打印入院证
  88. */
  89. $("#printBeHospitalized").on("click", function (t) {
  90. modifyPatient();
  91. });
  92. //折叠按钮初始化
  93. $('.collapse-link').on('click', function () {
  94. var $BOX_PANEL = $(this).closest('.x_panel_mine'),
  95. $ICON = $(this).find('i'),
  96. $BOX_CONTENT = $BOX_PANEL.find('.x_content');
  97. // fix for some div with hardcoded fix class
  98. if ($BOX_PANEL.attr('style')) {
  99. $BOX_CONTENT.slideToggle(200, function () {
  100. $BOX_PANEL.removeAttr('style');
  101. });
  102. } else {
  103. $BOX_CONTENT.slideToggle(200);
  104. $BOX_PANEL.css('height', 'auto');
  105. }
  106. $ICON.toggleClass('fa-chevron-up fa-chevron-down');
  107. });
  108. /**
  109. * 接诊
  110. */
  111. $("#clinicalReception").on("click", function (t) {
  112. var patientIdDb = $("#patientIdDb").val();
  113. if (patientIdDb == null || patientIdDb == "") {
  114. errorMesageSimaple("当前未选择病人,无法接诊");
  115. return;
  116. }
  117. $.ajax({
  118. type: "GET",
  119. url: '/thmz/getMzfzPatientOrderByPatientId?patientId=' + patientIdDb,
  120. contentType: "application/json;charset=UTF-8",
  121. dataType: "json",
  122. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  123. success: function (res) {
  124. if (res == '401' || res == 401) {
  125. window.location.href = '/thmz/login/view'
  126. return;
  127. }
  128. if (res.code == 0) {
  129. if (res.data != null && res.data.length > 0) {
  130. if (res.data.length == 1) {
  131. $("#turnToConsultationIdInClick").val(res.data[0].turnToConsultationId);
  132. clinicalReception(patientIdDb, res.data[0].serialNo, res.data[0].reqType);
  133. } else {
  134. $("#mzfzPatientOrderModal").modal();
  135. $("#mzfzPatientOrderTable").html(null);
  136. for (var i = 0; i < res.data.length; i++) {
  137. var roomCode = res.data[i].roomCode;
  138. if (roomCode == null || roomCode == "null") {
  139. roomCode = "";
  140. }
  141. var doctorCode = (res.data[i].doctorCode == null || res.data[i].doctorCode == 'null') ? '' : res.data[i].doctorCode;
  142. $("<tr data-target='" + res.data[i].serialNo + "' data-target-reqType='" + res.data[i].reqType + "' data-target-turnToConsultationId='" + res.data[i].turnToConsultationId + "'><td>" + res.data[i].patientId + "</td><td>" + res.data[i].name + "</td><td>" + res.data[i].deptCode + "</td><td>" + doctorCode + "</td><td>" + roomCode + "</td></tr>").appendTo("#mzfzPatientOrderTable").bind('click', function () {
  143. $("#mzfzPatientOrderModal").modal("hide");
  144. $("#turnToConsultationIdInClick").val($(this).attr("data-target-turnToConsultationId"));
  145. clinicalReception(patientIdDb, $(this).attr("data-target"), $(this).attr("data-target-reqType"));
  146. });
  147. }
  148. }
  149. clearRapidAcceptsModal();
  150. $("#rapidAcceptsModal").modal("hide");
  151. } else {
  152. errorMesageSimaple("当前病人没有分诊信息");
  153. }
  154. } else if (res.code == 200) {
  155. clearRapidAcceptsModal();
  156. $("#rapidAcceptsModal").modal("hide");
  157. clinicalReception(patientIdDb, null, null);
  158. } else {
  159. errorMesage(res);
  160. }
  161. }
  162. });
  163. });
  164. /**
  165. * 存为范本
  166. */
  167. $("#saveapidAccepts").on("click", function (t) {
  168. //关闭帮助框
  169. $("#treeButton").webuiPopover('hide');
  170. $("#western_medicine_name").webuiPopover('hide');
  171. $("#chinese_medicine_name").webuiPopover('hide');
  172. $("#jcJyItem").webuiPopover('hide');
  173. $("#zlItem").webuiPopover('hide');
  174. $("#saveapidAcceptsModal").modal("show");
  175. });
  176. /**
  177. * 实例化智能问诊弹窗
  178. */
  179. // $("[data-toggle='popover']").popover();
  180. $("#box-arrow-left").popover({
  181. html: 'true',
  182. content: '<div id="smartAssistPopoverContent"></div>'
  183. });
  184. //初始化药品分组下拉选
  185. initGroupOrder();
  186. // 初始化用药天数下拉选
  187. initDayNum();
  188. //页面加载完成初始化西药处方
  189. //initNavTabs(0);
  190. //页面加载完成初始化住院处方
  191. //initNavTabs(3);
  192. //初始医生工作太配置
  193. initWorkspaceConfigForCurrent();
  194. initExecUnit();
  195. /**
  196. * 西药点击事件
  197. */
  198. $("#western_medicine_name").on("click", function (t) {
  199. var obj = $("#westernMedicinePopoverContent").parent().parent().parent();
  200. if ($(obj).hasClass("in") || $(obj).css("display") == "block") {
  201. $('#western_medicine_name').webuiPopover('hide');
  202. $("#treeButton").webuiPopover('hide');
  203. return;
  204. }
  205. $('#western_medicine_name').webuiPopover('show');
  206. loadYpList(0, null);
  207. });
  208. /**
  209. * 中药点击事件
  210. */
  211. $("#chinese_medicine_name").on("click", function (t) {
  212. var obj = $("#chineseMedicinePopoverContent").parent().parent().parent();
  213. if ($(obj).hasClass("in") || $(obj).css("display") == "block") {
  214. $('#chinese_medicine_name').webuiPopover('hide');
  215. $("#treeButton").webuiPopover('hide');
  216. return;
  217. }
  218. $('#chinese_medicine_name').webuiPopover('show');
  219. loadYpList(1, null);
  220. });
  221. /**
  222. * 辅助检查、检验点击事件
  223. */
  224. $("#jcJyItem").on("click", function (t) {
  225. var obj = $("#jcJyItemPopoverContent").parent().parent().parent();
  226. if ($(obj).hasClass("in") || $(obj).css("display") == "block") {
  227. $('#jcJyItem').webuiPopover('hide');
  228. $("#treeButton").webuiPopover('hide');
  229. return;
  230. }
  231. $('#jcJyItem').webuiPopover('show');
  232. loadjcJyItemList(null);
  233. });
  234. /**
  235. * 诊疗点击事件
  236. */
  237. $("#zlItem").on("click", function (t) {
  238. var obj = $("#zlItemPopoverContent").parent().parent().parent();
  239. if ($(obj).hasClass("in") || $(obj).css("display") == "block") {
  240. $('#zlItem').webuiPopover('hide');
  241. $("#treeButton").webuiPopover('hide');
  242. return;
  243. }
  244. $('#zlItem').webuiPopover('show');
  245. loadZlItemList(null);
  246. });
  247. initYshPart();
  248. initJyZdSample();
  249. setTimeout(function () {
  250. getLodop();
  251. }, 800);
  252. //键盘监听回车键
  253. $(document).unbind("keyup").keyup(function (event) {
  254. var index = getIndex("bill_item_group");
  255. if (event.keyCode == 13) { //是否是回车
  256. var el = event.srcElement || event.target;
  257. var id = el.getAttribute("id");
  258. var current_code = null;
  259. if (index == 0) {
  260. current_code = $("#western_medicine_current_code").val();
  261. } else if (index == 1) {
  262. current_code = $("#chinese_medicine_current_code").val();
  263. } else if (index == 2) {
  264. current_code = $("#jcjy_current_code").val();
  265. } else if (index == 3) {
  266. current_code = $("#zl_current_code").val();
  267. }
  268. if (id == null || id == "") {
  269. id = el.getAttribute("data-id");
  270. }
  271. if (id == null || id == "") {
  272. var search = el.getAttribute("aria-label");
  273. if (search == "Search") {
  274. id = $(el).parent().parent().prev().attr("data-id");
  275. }
  276. }
  277. if (id != null && id != "") {
  278. //将当前点击的id记录下
  279. //prevEleId = id;
  280. } else if (prevEleId != null) {
  281. id = prevEleId;
  282. }
  283. //回车时,光标不在任何区域判断是不是在药品和诊疗开立区域
  284. if (id == null || id == "") {
  285. var index = getIndex("bill_item_group");
  286. if (index == 0) {
  287. if (current_code != null && current_code != "") {
  288. //当前页面是西药保存页面,且有药品选中
  289. $("#supplyType").next().click();
  290. }
  291. } else if (index == 1) {
  292. //当前页面是中草药保存页面,且有药品选中
  293. } else if (index == 2) {
  294. if (current_code != null && current_code != "") {
  295. //当前页面是医技保存页面,且有选中
  296. if ($("#jyZdSampleDiv").hasClass('in')) {
  297. //此时是检验
  298. $("#jyZdSample").next().click();
  299. } else if ($("#yshPartDiv").hasClass('in')) {
  300. //说明现在是检查
  301. $("#yshPart").next().click();
  302. }
  303. }
  304. } else if (index == 3) {
  305. //诊疗
  306. $("#yshPart").next().click();
  307. return;
  308. } else if (index == 4) {
  309. //当前页面是住院保存页面
  310. $("#inpatientWardBeHospitalized").next().click();
  311. return;
  312. }
  313. }
  314. var customization = $("div.customization").not(".hide");
  315. // //回车时,光标不在任何区域,默认点击主诉
  316. // if (id == null || id == "") {
  317. // var eleId = $(customization[0]).attr("target-id");
  318. // $("#" + eleId).focus();
  319. // if (eleId == 'symptom') {
  320. // $("#" + eleId).click();
  321. // }
  322. // console.log("eleId=" + eleId);
  323. // } else
  324. if (id == 'symptom' || id == 'emrHpi' || id == 'emrPs' || id == 'personalHistory' || id == 'familyHistory' || id == 'obstericalHistory' || id == 'otherCheck' || id == 'diagnose' || id == 'tentativeDiagnosis') {
  325. console.log("1id=" + id);
  326. if (id != $(customization[customization.length - 1]).attr("target-id")) {
  327. var next = $("#" + id + "Flag").next();
  328. while ($(next).hasClass("foreclose") || $(next).hasClass("hide")) {
  329. next = $(next).next();
  330. }
  331. var eleId = $(next).attr("target-id");
  332. $("#" + eleId).focus();
  333. if (eleId == 'diagnose' || id == 'diagnose' || id == 'symptom') {
  334. $("#" + eleId).click();
  335. }
  336. console.log("1eleId=" + eleId);
  337. } else {
  338. var data_target = $("#symptom").attr("data-target");
  339. $("#" + data_target).find("a.close").click();
  340. data_target = $("#diagnose").attr("data-target");
  341. $("#" + data_target).find("a.close").click();
  342. if (index == 0) {
  343. $("#western_medicine_name").focus();
  344. } else if (index == 1) {
  345. $("#chinese_medicine_name").focus();
  346. } else if (index == 2) {
  347. $("#jcJyItem").focus();
  348. } else if (index == 3) {
  349. $("#zlItem").focus();
  350. } else if (index == 4) {
  351. $("#inpatientWardBeHospitalized").next().click();
  352. }
  353. }
  354. } else if (id == 'zy_drugWin') {
  355. $("#zyInstruction").next().click();
  356. } else if (id == 'zyInstruction') {
  357. var ariaExpanded = $("#zyInstruction").next().attr("aria-expanded");
  358. if (ariaExpanded == true || ariaExpanded == "true") {
  359. $("#zyInstruction").next().click();
  360. }
  361. $("#saveChineseMedicine").click();
  362. $("#chinese_medicine_name").focus();
  363. $("#chinese_medicine_name").click();
  364. }
  365. else if (id == 'cyJssm') {
  366. $("#cyJsl").focus();
  367. } else if (id == 'cyJsl') {
  368. $("#cyZql").focus();
  369. } else if (id == 'cyZql') {
  370. $("#cyFj").focus();
  371. } else if (id == 'cyFj') {
  372. $("#cyFfcs").focus();
  373. } else if (id == 'cyFj') {
  374. $("#cyFfcs").focus();
  375. } else if (id == 'cyFfcs') {
  376. $("#useType_1").next().click();
  377. } else if (id == 'useType_1') {
  378. $("#cyMtjs").focus();
  379. } else if (id == 'cyMtjs') {
  380. $("#zyfs").focus();
  381. } else if (id == 'zyfs') {
  382. $("#zy_supplyType_1").next().click();
  383. } else if (id == 'supplyType') {
  384. $("#drugWinUnit").next().click();
  385. } else if (id == 'drugWinUnit') {
  386. $("#drugWin").focus();
  387. } else if (id == 'drugWin') {
  388. $("#dayNum").next().click();
  389. } else if (id == 'dayNum') {
  390. $("#orderFrequency").next().click();
  391. } else if (id == 'orderFrequency') {
  392. $("#gross").focus();
  393. } else if (id == 'gross') {
  394. $("#packUnit").next().click();
  395. } else if (id == 'packUnit') {
  396. $("#medicalAdvice").next().click();
  397. } else if (id == 'medicalAdvice') {
  398. var ariaExpanded = $("#medicalAdvice").next().attr("aria-expanded");
  399. if (ariaExpanded == true || ariaExpanded == "true") {
  400. $("#medicalAdvice").next().click();
  401. }
  402. saveMedicine(0);
  403. $("#western_medicine_name").focus();
  404. } else if (id == 'saveWesternMedicine') {
  405. $("#western_medicine_name").focus();
  406. $("#western_medicine_name").click();
  407. } else if (id == 'jyZdSample' || id == 'yshPart') {
  408. $("#execUnit").next().click();
  409. } else if (id == 'execUnit') {
  410. var ariaExpanded = $("#execUnit").next().attr("aria-expanded");
  411. if (ariaExpanded == true || ariaExpanded == "true") {
  412. $("#execUnit").next().click();
  413. }
  414. $("#remark").focus();
  415. } else if (id == 'remark') {
  416. saveJyJcItem(true);
  417. $("#jcJyItem").focus();
  418. } else if (id == 'chargeUnit') {
  419. $("#itemQuantity").focus();
  420. } else if (id == 'itemQuantity') {
  421. $("#dayZlNum").next().click();
  422. } else if (id == 'dayZlNum') {
  423. var ariaExpanded = $("#dayZlNum").next().attr("aria-expanded");
  424. if (ariaExpanded == true || ariaExpanded == "true") {
  425. $("#dayZlNum").next().click();
  426. }
  427. $("#orderFrequencyZl").next().click();
  428. } else if (id == 'orderFrequencyZl') {
  429. var ariaExpanded = $("#orderFrequencyZl").next().attr("aria-expanded");
  430. if (ariaExpanded == true || ariaExpanded == "true") {
  431. $("#orderFrequencyZl").next().click();
  432. }
  433. $("#totalNumZl").focus();
  434. } else if (id == 'totalNumZl') {
  435. $("#zlExecUnit").next().click();
  436. } else if (id == 'zlExecUnit') {
  437. var ariaExpanded = $("#zlExecUnit").next().attr("aria-expanded");
  438. if (ariaExpanded == true || ariaExpanded == "true") {
  439. $("#zlExecUnit").next().click();
  440. }
  441. $("#zlRemark").focus();
  442. } else if (id == 'zlRemark') {
  443. saveZlItem(true);
  444. $("#zlItem").focus();
  445. } else if (id == 'inpatientWardBeHospitalized') {
  446. $("#smallWardBeHospitalized").next().click();
  447. } else if (id == 'smallWardBeHospitalized') {
  448. $("#admissStatus").next().click();
  449. } else if (id == 'admissStatus') {
  450. saveZyReq(true);
  451. $("#zy_req_button").focus();
  452. } else if (id == 'western_medicine_name') {
  453. var webuiID = $("#western_medicine_name").attr("data-target");
  454. if (webuiID == null || webuiID == "null" || webuiID == "") {
  455. //药品查询框是空白的,打开查询框
  456. $("#western_medicine_name").click();
  457. return;
  458. }
  459. //选择框打开
  460. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  461. var arr = $("#tb_table_western_medicine").find("tbody").find("tr.trhover");
  462. if (arr != undefined && arr != null && arr.length > 0) {
  463. var dataIndex = $(arr).attr("data-index");
  464. var tableData = $("#tb_table_western_medicine").bootstrapTable('getData');
  465. if (tableData != null && tableData.length > 0 && dataIndex != null) {
  466. var trData = tableData[dataIndex];
  467. checkYpInfo(trData.code, trData.serial, trData.ypType, true, null);
  468. $("#western_medicine_name").click();
  469. }
  470. } else {
  471. //药品查询框是空白的,打开查询框
  472. $("#western_medicine_name").click();
  473. }
  474. } else {
  475. if (current_code != null && current_code != "") {
  476. //已经选中药品,跳到用法
  477. $("#supplyType").next().click();
  478. } else {
  479. //药品查询框是空白的,打开查询框
  480. $("#western_medicine_name").click();
  481. }
  482. }
  483. } else if (id == 'chinese_medicine_name') {
  484. var webuiID = $("#chinese_medicine_name").attr("data-target");
  485. if (webuiID == null || webuiID == "null" || webuiID == "") {
  486. $("#chinese_medicine_name").click();
  487. return;
  488. }
  489. //选择框打开
  490. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  491. var arr = $("#tb_table_chinese_medicine").find("tbody").find("tr.trhover");
  492. if (arr != undefined && arr != null && arr.length > 0) {
  493. var dataIndex = $(arr).attr("data-index");
  494. var tableData = $("#tb_table_chinese_medicine").bootstrapTable('getData');
  495. if (tableData != null && tableData.length > 0 && dataIndex != null) {
  496. var trData = tableData[dataIndex];
  497. checkZyInfo(trData.code, trData.serial, true);
  498. $("#chinese_medicine_name").click();
  499. }
  500. } else {
  501. //药品查询框是空白的,打开查询框
  502. $("#chinese_medicine_name").click();
  503. }
  504. } else {
  505. if (current_code != null && current_code != "") {
  506. //已经选中药品,跳到剂量
  507. $("#zy_drugWin").next().click();
  508. } else {
  509. //药品查询框是空白的,打开查询框
  510. $("#chinese_medicine_name").click();
  511. }
  512. }
  513. } else if (id == 'jcJyItem') {
  514. var webuiID = $("#jcJyItem").attr("data-target");
  515. if (webuiID == null || webuiID == "null" || webuiID == "") {
  516. $("#jcJyItem").click();
  517. return;
  518. }
  519. //选择框打开
  520. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  521. var arr = $("#tb_table_jc_jy_item").find("tbody").find("tr.trhover");
  522. if (arr != undefined && arr != null && arr.length > 0) {
  523. var dataIndex = $(arr).attr("data-index");
  524. var tableData = $("#tb_table_jc_jy_item").bootstrapTable('getData');
  525. if (tableData != null && tableData.length > 0 && dataIndex != null) {
  526. var trData = tableData[dataIndex];
  527. $('#jcJyItem').webuiPopover('hide');
  528. $("#jcJyZltype").val(trData.type);
  529. $("#execUnit").selectpicker('val', trData.execUnit);//默认不选中
  530. $("#execUnit").selectpicker('refresh');
  531. if (trData.type == 1) {
  532. //检验
  533. $("#jyZdSampleDiv").removeClass("hide").addClass("in");
  534. $("#chargeUnitDiv").removeClass("in").addClass("hide");
  535. $("#yshPartDiv").removeClass("in").addClass("hide");
  536. if (trData.sampleCode != null && trData.sampleCode != "") {
  537. $("#jyZdSample").selectpicker('val', trData.sampleCode);
  538. $('#jyZdSample').selectpicker('refresh');
  539. }
  540. } else if (trData.type == 2) {
  541. //检查
  542. $("#yshPartDiv").removeClass("hide").addClass("in");
  543. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  544. $("#chargeUnitDiv").removeClass("in").addClass("hide");
  545. if (trData.bwCode != null && trData.bwCode != "") {
  546. $("#yshPart").selectpicker('val', trData.bwCode);
  547. $('#yshPart').selectpicker('refresh');
  548. }
  549. }
  550. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  551. checkJcJyItemInfo(trData.code, trData.name, trData.type, true);
  552. }
  553. } else {
  554. //药品查询框是空白的,打开查询框
  555. $("#jcJyItem").click();
  556. }
  557. } else {
  558. if (current_code != null && current_code != "") {
  559. //如果是保存失败的,重新打开输入框查询
  560. if (prevEleId == 'remark') {
  561. $("#jcJyItem").click();
  562. } else {
  563. //当前页面是医技保存页面,且有选中
  564. if ($("#jyZdSampleDiv").hasClass('in')) {
  565. //此时是检验
  566. $("#jyZdSample").next().click();
  567. } else if ($("#yshPartDiv").hasClass('in')) {
  568. //说明现在是检查
  569. $("#yshPart").next().click();
  570. }
  571. }
  572. } else {
  573. //药品查询框是空白的,打开查询框
  574. $("#jcJyItem").click();
  575. }
  576. }
  577. } else if (id == 'zlItem') {
  578. var webuiID = $("#zlItem").attr("data-target");
  579. if (webuiID == null || webuiID == "null" || webuiID == "") {
  580. $("#zlItem").click();
  581. return;
  582. }
  583. //选择框打开
  584. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  585. var arr = $("#tb_table_zl_item").find("tbody").find("tr.trhover");
  586. if (arr != undefined && arr != null && arr.length > 0) {
  587. var dataIndex = $(arr).attr("data-index");
  588. var tableData = $("#tb_table_zl_item").bootstrapTable('getData');
  589. if (tableData != null && tableData.length > 0 && dataIndex != null) {
  590. var trData = tableData[dataIndex];
  591. $('#zlItem').webuiPopover('hide');
  592. $("#zlExecUnit").selectpicker('val', trData.execUnit);//默认不选中
  593. $("#zlExecUnit").selectpicker('refresh');
  594. //诊疗
  595. if ($("#zlTab").find("li") == null || $("#zlTab").find("li").length == 0) {
  596. initNavTabs(3, null, null);
  597. }
  598. $("#zlItem").val(trData.name);
  599. $("#zlItem").blur();
  600. $("#zlItemPrice").val(trData.chargeAmount);
  601. $("#chargeUnit").val(trData.specification);
  602. $("#zl_current_code").val(trData.code);
  603. $("#itemQuantity").val(1);
  604. $("#chargeUnit").focus();
  605. }
  606. } else {
  607. //药品查询框是空白的,打开查询框
  608. $("#zlItem").click();
  609. }
  610. } else {
  611. if (current_code != null && current_code != "") {
  612. //如果是保存失败的,重新打开输入框查询
  613. if (prevEleId == 'zlRemark') {
  614. $("#zlItem").click();
  615. } else {
  616. $("#chargeUnit").focus();
  617. }
  618. } else {
  619. //药品查询框是空白的,打开查询框
  620. $("#zlItem").click();
  621. }
  622. }
  623. } else if (id == 'zy_req_button') {
  624. //当前页面是住院保存页面,此时光标在入院按钮上
  625. console.log("入院按钮")
  626. $("#inpatientWardBeHospitalized").next().click();
  627. }
  628. if (id != null && id != "") {
  629. //将当前点击的id记录下
  630. prevEleId = id;
  631. }
  632. } else if (event.keyCode == 37) {
  633. // //左键事件
  634. // if(index==0){
  635. // return;
  636. // }
  637. // var prevObject=$("#bill_item_group").find("button")[index-1];
  638. // $(prevObject).click();
  639. } else if (event.keyCode == 38) {
  640. //上键事件
  641. var tableId = null;
  642. var inputId = null;
  643. var contentId = null;
  644. if (index == 0) {
  645. tableId = "tb_table_western_medicine";
  646. inputId = "western_medicine_name";
  647. contentId = "westernMedicinePopoverContent";
  648. } else if (index == 1) {
  649. tableId = "tb_table_chinese_medicine";
  650. inputId = "chinese_medicine_name";
  651. contentId = "chineseMedicinePopoverContent";
  652. } else if (index == 2) {
  653. tableId = "tb_table_jc_jy_item";
  654. inputId = "jcJyItem";
  655. contentId = "jcJyItemPopoverContent";
  656. } else if (index == 3) {
  657. tableId = "tb_table_zl_item";
  658. inputId = "zlItem";
  659. contentId = "zlItemPopoverContent";
  660. }
  661. if (inputId == null) {
  662. return;
  663. }
  664. var webuiID = $("#" + inputId).attr("data-target");
  665. if (webuiID == null || webuiID == "null" || webuiID == "") {
  666. return;
  667. }
  668. //选择框打开
  669. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  670. var arr = $("#" + tableId).find("tbody").find("tr.trhover");
  671. var prev = $(arr).prev();
  672. if (arr != undefined && arr != null && arr.length > 0) {
  673. if (prev != undefined && prev != null && prev.length > 0) {
  674. $(arr).removeClass("trhover");
  675. $(prev).addClass("trhover");
  676. var height = $(arr).css("height");
  677. $("#" + contentId).parent().animate({scrollTop: "-=" + height}, 100);
  678. }
  679. } else {
  680. var arrs = $("#" + tableId).find("tbody").find("tr");
  681. $(arrs[0]).addClass("trhover");
  682. var height = $(arrs[0]).css("height");
  683. $("#" + contentId).parent().animate({scrollTop: "+=" + height}, 100);
  684. }
  685. }
  686. } else if (event.keyCode == 39) {
  687. // //右键事件
  688. // if(index==4){
  689. // return;
  690. // }
  691. // var nextObject=$("#bill_item_group").find("button")[index+1];
  692. // $(nextObject).click();
  693. } else if (event.keyCode == 40) {
  694. //下键事件
  695. var tableId = null;
  696. var inputId = null;
  697. var contentId = null;
  698. if (index == 0) {
  699. tableId = "tb_table_western_medicine";
  700. inputId = "western_medicine_name";
  701. contentId = "westernMedicinePopoverContent";
  702. } else if (index == 1) {
  703. tableId = "tb_table_chinese_medicine";
  704. inputId = "chinese_medicine_name";
  705. contentId = "chineseMedicinePopoverContent";
  706. } else if (index == 2) {
  707. tableId = "tb_table_jc_jy_item";
  708. inputId = "jcJyItem";
  709. contentId = "jcJyItemPopoverContent";
  710. } else if (index == 3) {
  711. tableId = "tb_table_zl_item";
  712. inputId = "zlItem";
  713. contentId = "zlItemPopoverContent";
  714. }
  715. if (inputId == null) {
  716. return;
  717. }
  718. var webuiID = $("#" + inputId).attr("data-target");
  719. if (webuiID == null || webuiID == "null" || webuiID == "") {
  720. return;
  721. }
  722. //选择框打开
  723. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  724. var arr = $("#" + tableId).find("tbody").find("tr.trhover");
  725. var next = $(arr).next();
  726. if (arr != undefined && arr != null && arr.length > 0) {
  727. if (next != undefined && next != null && next.length > 0) {
  728. $(arr).removeClass("trhover");
  729. $(next).addClass("trhover");
  730. var height = $(arr).css("height");
  731. $("#" + contentId).parent().animate({scrollTop: "+=" + height}, 100);
  732. }
  733. } else {
  734. var arrs = $("#" + tableId).find("tbody").find("tr");
  735. $(arrs[0]).addClass("trhover");
  736. var height = $(arrs[0]).css("height");
  737. $("#" + contentId).parent().animate({scrollTop: "+=" + height}, 100);
  738. }
  739. }
  740. }
  741. });
  742. //打印检查检验报告单
  743. $('#btn_print').click(function () {
  744. printJyJcReport(1);
  745. });
  746. //打印设置检查检验报告单
  747. $('#btn_print_setup').click(function () {
  748. printJyJcReport(2);
  749. });
  750. /**
  751. * 医保电子凭证读卡
  752. */
  753. $("#siReadCard").on("click", function (t) {
  754. siReadCard();
  755. });
  756. /**
  757. * 门诊统筹支付医保电子凭证读卡
  758. */
  759. $("#mztczfSiReadCard").on("click", function (t) {
  760. mztczfSiReadCard(true);
  761. });
  762. /**
  763. * 快速接诊页面 -未挂号患者信息查询处编辑患者信息
  764. */
  765. $("#rapidAcceptsEditUser").on("click", function (t) {
  766. editUserModal($("#rapidAcceptsUserCode").val(), 2);
  767. });
  768. //监听滚动停止处理逻辑开始
  769. let t1 = 0;
  770. let t2 = 0;
  771. let timer = null; // 定时器
  772. $("#scroll-wrap").on("scroll", function () {
  773. // 滚动
  774. clearTimeout(timer)
  775. timer = setTimeout(isScrollEnd, 100)
  776. t1 = $("#scroll-wrap").scrollTop();
  777. })
  778. function isScrollEnd() {
  779. t2 = $("#scroll-wrap").scrollTop();
  780. if (t2 == t1) {
  781. clearTimeout(timer)
  782. closeObjectWebui(true);
  783. console.log("滚动停止", t2) // 这里处理
  784. }
  785. }
  786. //监听滚动停止处理逻辑结束
  787. });
  788. /**
  789. * 打开配置页面
  790. */
  791. function configWorkspaceModal() {
  792. initWorkspaceConfigForCurrent();
  793. $("#configWorkspaceModal").modal("show");
  794. }
  795. /**
  796. * 初始化用药天数下拉选
  797. */
  798. function initDayNum() {
  799. var html = '';
  800. for (var i = 1; i <= 112; i++) {
  801. html += '<option value="' + i + '">' + i + '</option>';
  802. }
  803. $('#dayNum').html(html);
  804. $('#dayNum').selectpicker('refresh');
  805. $('#dayZlNum').html(html);
  806. $('#dayZlNum').selectpicker('refresh');
  807. }
  808. /**
  809. * 处方回调
  810. */
  811. function resetGroupIdSelect() {
  812. var groupIds = $("#groupId option");
  813. var usedGroupIdInputs = $("#xyTabContent").find("input.temporary_items_groupId");
  814. if (usedGroupIdInputs != null && usedGroupIdInputs.length > 0) {
  815. let lastGroupId = 0;
  816. for (var i = 0; i < usedGroupIdInputs.length; i++) {
  817. var groupId = Number($(usedGroupIdInputs[i]).val());
  818. if (groupId > lastGroupId) {
  819. lastGroupId = groupId;
  820. }
  821. }
  822. if (groupIds != null && groupIds.length > 1) {
  823. for (var i = 0; i < groupIds.length; i++) {
  824. var groupId = $(groupIds[i]).val();
  825. if (groupId <= lastGroupId) {
  826. continue;
  827. }
  828. $(groupIds[i]).remove();
  829. //删除给药方式与其他属性的缓存
  830. groupIdMap.remove(groupId);
  831. }
  832. appendGroupOrder();
  833. }
  834. } else if (groupIds != null && groupIds.length > 1) {
  835. initGroupOrder();
  836. }
  837. }
  838. /**
  839. * 初始化药品分组下拉选
  840. */
  841. function initGroupOrder() {
  842. var html = '<option value="1">1</option>';
  843. $('#groupId').html(html);
  844. $('#groupId').selectpicker('refresh');
  845. $("#groupId").selectpicker('val', 1);
  846. $('#groupId').selectpicker('refresh');
  847. groupIdMap = new Map();
  848. }
  849. /**
  850. * 追加分组
  851. */
  852. function appendGroupOrder() {
  853. var last = parseInt($("#groupId > option:last").val());
  854. last++;
  855. var html = '<option value="' + last + '">' + last + '</option>';
  856. $('#groupId').append(html);
  857. $('#groupId').selectpicker('refresh');
  858. }
  859. /**
  860. * 组号改变事件
  861. */
  862. function groupIdChange() {
  863. //var last = parseInt($("#groupId > option:last").val());
  864. var groupId = $("#groupId").val();
  865. var keys = groupIdMap.keySet();
  866. if (keys.indexOf(groupId)<0) {
  867. //是新增药品清空药品输入区域
  868. var updateFlag = $("#western_medicine_update_flag").val();
  869. var currentCode = $("#western_medicine_current_code").val();
  870. //当前时新增药品,而且没有选择药品的时候,组号变更,清空区域
  871. if ((updateFlag == undefined || updateFlag == null || updateFlag == "false" || updateFlag == false) && (currentCode == null || currentCode == "")) {
  872. clearWesternMedicine(true);
  873. }
  874. } else {
  875. var map = groupIdMap.get(groupId);
  876. if (map != null) {
  877. var supplyType = map.get("supplyType");
  878. var orderFrequency = map.get("orderFrequency");
  879. var dayNum = map.get("dayNum");
  880. //用法编码
  881. $("#supplyType").selectpicker('val', supplyType);
  882. $('#supplyType').selectpicker('refresh');
  883. //$("#supplyType").attr("disabled", "disabled");
  884. //天数
  885. $("#dayNum").selectpicker('val', dayNum);
  886. $('#dayNum').selectpicker('refresh');
  887. // $("#dayNum").attr("disabled", "disabled");
  888. //频次编码
  889. $("#orderFrequency").selectpicker('val', orderFrequency);
  890. $('#orderFrequency').selectpicker('refresh');
  891. // $("#orderFrequency").attr("disabled", "disabled");
  892. }
  893. }
  894. }
  895. /**
  896. * 关闭智能问诊弹框
  897. */
  898. function closePopover() {
  899. //$(".popover").popover('hide');
  900. $("#box-arrow-left").click();
  901. }
  902. /**
  903. * 关闭项目选择框
  904. * ReOpen 是否重新打开 true 打开 false 不打开
  905. */
  906. function closeObjectWebui(ReOpen) {
  907. var index = getIndex("bill_item_group");
  908. var currentCode = "western_medicine_name";
  909. if (index == 1) {
  910. currentCode = "chinese_medicine_name";
  911. } else if (index == 2) {
  912. currentCode = "jcJyItem";
  913. } else if (index == 3) {
  914. currentCode = "zlItem";
  915. }
  916. var webuiID = $("#" + currentCode).attr("data-target");
  917. if (webuiID != null && webuiID != "null" && webuiID != "") {
  918. //选择框打开
  919. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  920. $("#" + currentCode).click();
  921. if (ReOpen) {
  922. $("#" + currentCode).click();
  923. }
  924. }
  925. }
  926. var symptomID = $("#symptom").attr("data-target");
  927. if (symptomID != null && symptomID != "null" && symptomID != "") {
  928. //选择框打开
  929. if ($("#" + symptomID).hasClass("in") || $("#" + symptomID).css("display") == "block") {
  930. $("#symptom").click();
  931. if (ReOpen) {
  932. $("#symptom").click();
  933. }
  934. }
  935. }
  936. var weightID = $("#weight").attr("data-target");
  937. if (weightID != null && weightID != "null" && weightID != "") {
  938. //选择框打开
  939. if ($("#" + weightID).hasClass("in") || $("#" + weightID).css("display") == "block") {
  940. $("#weight").click();
  941. if (ReOpen) {
  942. $("#weight").click();
  943. }
  944. }
  945. }
  946. var diagnoseID = $("#diagnose").attr("data-target");
  947. if (diagnoseID != null && diagnoseID != "null" && diagnoseID != "") {
  948. //选择框打开
  949. if ($("#" + diagnoseID).hasClass("in") || $("#" + diagnoseID).css("display") == "block") {
  950. $("#diagnose").click();
  951. if (ReOpen) {
  952. $("#diagnose").click();
  953. }
  954. }
  955. }
  956. }
  957. /**
  958. * 加载智能问诊弹框内容
  959. */
  960. function contentMethod() {
  961. setTimeout(function () {
  962. closeObjectWebui(false);
  963. $(".popover div.arrow").css("display", "none");
  964. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  965. if (popoverId == undefined) {
  966. return;
  967. }
  968. var left = $("#" + popoverId).css("left");
  969. left = left.replace("px", "");
  970. left = parseInt(left);
  971. left = left + 55;
  972. $("#" + popoverId).css("height", "100%").css("top", "0px").css("left", left + "px").css("border-radius", "0px").css("z-index", "11");
  973. $("#" + popoverId + " .popover-content").css("height", "100%");
  974. $("#smartAssistPopoverContent").css("height", "100%");
  975. var html = ' <div style="height: 24%;padding-left: 15px;width: 100%;">' +
  976. ' <button type="button" style="cursor: default;margin-bottom: 0px;margin-right: 0px; font-size: 12px;"' +
  977. ' class="btn btn-primary">' +
  978. ' <span id="patientHisData"></span>就医轨迹' +
  979. ' </button>' +
  980. ' <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true" onclick="closePopover()">×</span>' +
  981. ' </button>' +
  982. ' <div style="height: calc(100% - 39px);border: 1px solid #DDDDDD;margin-top: 5px;width: 100%;">' +
  983. ' <form class="form-horizontal form-label-left mz-fixed-form" novalidate autocomplete="off"' +
  984. ' style="height: 100%;overflow-y: auto;width: 100%;text-align: -webkit-center;position: relative;" id="patientHisDataForm">' +
  985. ' </form>' +
  986. ' </div>' +
  987. ' </div>' +
  988. ' <div style="height: 23%;padding-left: 15px;width: 100%;">' +
  989. ' <button type="button" style="cursor: default;margin-bottom: 0px;margin-right: 0px;margin-top: 5px;"' +
  990. ' class="btn btn-primary">' +
  991. ' <span id="recommendType"></span>推荐' +
  992. ' </button>' +
  993. ' <div style="height: calc(100% - 44px);border: 1px solid #DDDDDD;overflow-y: auto;margin-top: 5px;width: 100%;">' +
  994. ' <form class="form-horizontal form-label-left mz-fixed-form" novalidate autocomplete="off"' +
  995. ' style="height: 100%;overflow-y: auto;width: 100%;text-align: -webkit-center;position: relative;" id="recommendForm">' +
  996. ' <img src="/thmz/images/no-recommend.png" style="height: 120px;position: absolute;top: 50%;transform: translateY(-50%);margin-left: -30px;">' +
  997. ' </form>' +
  998. ' </div>' +
  999. ' </div>' +
  1000. ' <div style="height: 53%;padding-left: 15px;width: 100%;">' +
  1001. ' <button type="button"' +
  1002. ' style="cursor: default;margin-bottom: 0px;margin-right: 0px;margin-top: 5px; font-size: 12px;"' +
  1003. ' class="btn btn-primary">' +
  1004. ' 医疗范本' +
  1005. ' </button>' +
  1006. ' <div class="item" style="width: 230px;height: 35px;float: right;line-height: 35px;margin-right: 40px;">' +
  1007. ' <div class="col-md-6 col-sm-6 col-xs-12">' +
  1008. ' <select class="form-control selectpicker show-tick" title="范文范围" onchange="fitTemplateData()"' +
  1009. ' id="templateTypeForm">' +
  1010. ' </select>' +
  1011. ' </div>' +
  1012. ' <div class="col-md-6 col-sm-6 col-xs-12">' +
  1013. ' <select class="form-control selectpicker show-tick" title="范文类型" onchange="fitTemplateData()"' +
  1014. ' id="templateKindTypeForm">' +
  1015. ' </select>' +
  1016. ' </div>' +
  1017. ' </div>' +
  1018. ' <div style="height: calc(100% - 44px);border: 1px solid #DDDDDD;overflow-y: auto;margin-top: 5px;width: 100%;position: relative;">' +
  1019. ' <form class="form-horizontal form-label-left mz-fixed-form" novalidate autocomplete="off"' +
  1020. ' style="height: 100%;overflow-y: auto;width: 100%;" id="TemplateData">' +
  1021. ' </form>' +
  1022. ' </div>' +
  1023. ' </div>';
  1024. $("#smartAssistPopoverContent").html(html);
  1025. initTemplateTypeSelect("templateTypeForm");
  1026. initTemplateKindTypeSelect('templateKindTypeForm');
  1027. fitPatientHisData();
  1028. fitSymptomData();
  1029. fitEmrHpiData();
  1030. fitEmrPsData();
  1031. fitDiagnoseData();
  1032. fitTemplateData();
  1033. }, 100);
  1034. // setTimeout(function () {
  1035. // $("#patientHisDataForm").html("aadsasfasdfasdfasdfasdfsdfasdfasdfasdfdfafda");
  1036. // },1000);
  1037. }
  1038. /**
  1039. * 设置患者的就诊轨迹
  1040. */
  1041. function fitPatientHisData() {
  1042. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  1043. if (!$("#" + popoverId).hasClass("in")) {
  1044. return;
  1045. }
  1046. var emptyHtml = '<img src="/thmz/images/locus.png" style="height: 120px;position: absolute;top: 50%;transform: translateY(-50%);margin-left: -30px;">';
  1047. if (($("#patientId").text() == null || $("#patientId").text() == "") && ($("#userName").val() == null || $("#userName").val() == "")) {
  1048. $("#patientHisDataForm").html(emptyHtml);
  1049. return;
  1050. }
  1051. var patientId = $("#patientId").text();
  1052. if (patientId == null || patientId == "") {
  1053. patientId = $("#userName").val();
  1054. }
  1055. $.ajax({
  1056. type: "POST",
  1057. url: '/thmz/getClinicWithPage',
  1058. contentType: "application/json;charset=UTF-8",
  1059. dataType: "json",
  1060. data: JSON.stringify({
  1061. "commonParams": patientId,
  1062. //"clinicStatuses": [5, 6],
  1063. "clinicStatuses": [6],
  1064. "pageSize": 10000,
  1065. "offset": 0,
  1066. "beginDate": "2012-02-01 00:00:00",
  1067. "endDate": format(new Date(), "yyyy-MM-dd HH:mm:ss"),
  1068. "doctorCode": "-1"
  1069. }),
  1070. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1071. success: function (res) {
  1072. if (res == '401' || res == 401) {
  1073. window.location.href = '/thmz/login/view'
  1074. return;
  1075. }
  1076. if (res.code == 0) {
  1077. var html = '';
  1078. var data = res.data;
  1079. if (data == null || data.length == 0) {
  1080. html += emptyHtml;
  1081. } else {
  1082. for (var i = 0; i < data.length; i++) {
  1083. var icdText = data[i].icdText;
  1084. if (icdText == null) {
  1085. // continue;
  1086. icdText = "空白诊断";
  1087. }
  1088. icdText = icdText.trim();
  1089. html += ' <div class="item form-group thmz_alert" style="width: 100%;">';
  1090. html += ' <div style="float: left;width: 172px;">';
  1091. html += ' <img src="/thmz/css/bootstrap/bootstrap-icons-1.5.0/stopwatch.svg"';
  1092. html += ' style="margin-left: 10px!important;vertical-align: -.15em;margin-right: 10px!important;"/>';
  1093. html += ' <span style="width: 120px;margin-right: 20px!important;">' + format(data[i].opDay, "yyyy-MM-dd HH:mm") + '</span>';
  1094. html += ' </div>';
  1095. html += ' <div style="text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 172px);"';
  1096. html += ' title="' + icdText + '">诊断:<a style="cursor: pointer; color: #2e69eb;"';
  1097. html += ' onclick="visitingDetailModal(\'' + data[i].patientId + '\',' + data[i].times + ',' + data[i].id + ',' + data[i].clinicStatus + ')">' + icdText + '</a>';
  1098. html += ' </div>';
  1099. html += ' </div>';
  1100. }
  1101. }
  1102. var patientName = $("#patientName").text();
  1103. if (patientName == null || patientName == "") {
  1104. if (res.mzPatientMi != null) {
  1105. patientName = res.mzPatientMi.name;
  1106. } else {
  1107. patientName = patientId;
  1108. }
  1109. }
  1110. $("#patientHisData").text(patientName + "的");
  1111. if (($("#patientId").text() == null || $("#patientId").text() == "") && ($("#userName").val() == null || $("#userName").val() == "")) {
  1112. $("#patientHisDataForm").html(emptyHtml);
  1113. } else {
  1114. $("#patientHisDataForm").html(html);
  1115. }
  1116. } else {
  1117. errorMesage(res);
  1118. }
  1119. }
  1120. });
  1121. }
  1122. /**
  1123. * 设置主诉推荐
  1124. */
  1125. function fitSymptomData() {
  1126. fitRecommendData(12);
  1127. }
  1128. /**
  1129. * 设置现病史推荐
  1130. */
  1131. function fitEmrHpiData() {
  1132. fitRecommendData(5);
  1133. }
  1134. /**
  1135. * 设置既往史推荐
  1136. */
  1137. function fitEmrPsData() {
  1138. fitRecommendData(6);
  1139. }
  1140. /**
  1141. * 设置诊断推荐
  1142. */
  1143. function fitDiagnoseData() {
  1144. fitRecommendData(13);
  1145. }
  1146. /**
  1147. * 设置推荐通用方法
  1148. */
  1149. function fitRecommendData(paramsType) {
  1150. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  1151. if (!$("#" + popoverId).hasClass("in")) {
  1152. return;
  1153. }
  1154. var inputId = "symptom";
  1155. var text = "主诉";
  1156. if (paramsType == 5) {
  1157. inputId = "emrHpi";
  1158. text = "现病史";
  1159. } else if (paramsType == 6) {
  1160. inputId = "emrPs";
  1161. text = "既往史";
  1162. } else if (paramsType == 13) {
  1163. inputId = "diagnose";
  1164. text = "诊断";
  1165. }
  1166. //光标不在现病史上
  1167. if (document.activeElement.id != inputId) {
  1168. return;
  1169. }
  1170. $("#recommendType").html(text);
  1171. var emptyHtml = '<img src="/thmz/images/no-recommend.png" style="height: 120px;position: absolute;top: 50%;transform: translateY(-50%);margin-left: -30px;">';
  1172. $.ajax({
  1173. type: "GET",
  1174. url: '/thmz/getTCommonParamsByParamsType?paramsType=' + paramsType + '&commonParams=&pageSize=10',
  1175. contentType: "application/json;charset=UTF-8",
  1176. dataType: "json",
  1177. async: false,
  1178. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1179. success: function (res) {
  1180. if (res == '401' || res == 401) {
  1181. window.location.href = '/thmz/login/view'
  1182. return;
  1183. }
  1184. if (res.code == 0) {
  1185. var html = '';
  1186. var data = res.data;
  1187. if (data == null || data.length == 0) {
  1188. html += emptyHtml;
  1189. } else {
  1190. for (var i = 0; i < data.length; i++) {
  1191. var paramsContent = data[i].paramsContent;
  1192. html += ' <div class="item form-group thmz_alert" style="width: 100%;">';
  1193. html += ' <div style="margin-left: 10px;float: left;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 60px);" title="' + paramsContent + '">';
  1194. html += paramsContent;
  1195. html += ' </div>';
  1196. html += ' <div style="float: left;width: 36px;cursor: pointer;"';
  1197. html += ' onclick="fitAppeal(\'' + paramsContent + '\',' + paramsType + ',' + data[i].id + ')">';
  1198. html += ' <img';
  1199. html += ' src="/thmz/css/bootstrap/bootstrap-icons-1.5.0/cursor-fill.svg"';
  1200. html += ' style="margin-left: 10px!important;vertical-align: -.15em;margin-right: 10px!important;"/>';
  1201. html += ' </div>';
  1202. html += ' </div>';
  1203. }
  1204. }
  1205. $("#recommendForm").html(html);
  1206. } else {
  1207. errorMesage(res);
  1208. }
  1209. }
  1210. });
  1211. }
  1212. /**
  1213. * 设置医疗范文方法
  1214. */
  1215. function fitTemplateData() {
  1216. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  1217. if (!$("#" + popoverId).hasClass("in")) {
  1218. return;
  1219. }
  1220. 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;">';
  1221. $.ajax({
  1222. type: "GET",
  1223. url: '/thmz/getTemplate?templateKindType=' + $("#templateKindTypeForm").val() + '&templateType=' + $("#templateTypeForm").val(),
  1224. contentType: "application/json;charset=UTF-8",
  1225. dataType: "json",
  1226. async: false,
  1227. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1228. success: function (res) {
  1229. if (res == '401' || res == 401) {
  1230. window.location.href = '/thmz/login/view'
  1231. return;
  1232. }
  1233. if (res.code == 0) {
  1234. var html = '';
  1235. var data = res.data;
  1236. if (data == null || data.length == 0) {
  1237. html += emptyHtml;
  1238. } else {
  1239. for (var i = 0; i < data.length; i++) {
  1240. var template = data[i];
  1241. var icdText = (template.icdText == null || template.icdText == "") ? "无" : template.icdText;
  1242. html += ' <div class="item form-group thmz_alert" style="width: 100%;">';
  1243. html += ' <div title="' + template.name + '"';
  1244. html += ' style="margin-left: 10px!important;float: left;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: 100px;">';
  1245. html += template.name;
  1246. html += ' </div>';
  1247. html += ' <div style="float: left;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 160px);"';
  1248. html += ' title="' + template.icdText + '">诊断:<a';
  1249. html += ' style="cursor: pointer; color: #2e69eb;"';
  1250. html += ' onclick="medicalModelModal(' + template.id + ')">' + icdText + '</a>';
  1251. html += ' </div>';
  1252. html += ' <div style="float: left;width: 36px;cursor: pointer;" onclick="medicalModelModal(' + template.id + ')"><img';
  1253. html += ' src="/thmz/css/bootstrap/bootstrap-icons-1.5.0/cursor-fill.svg"';
  1254. html += ' style="margin-left: 10px!important;vertical-align: -.15em;margin-right: 10px!important;"/>';
  1255. html += ' </div>';
  1256. html += ' </div>';
  1257. }
  1258. }
  1259. $("#TemplateData").html(html);
  1260. } else {
  1261. errorMesage(res);
  1262. }
  1263. }
  1264. });
  1265. }
  1266. /**
  1267. * 清空快速接诊弹窗
  1268. */
  1269. function clearRapidAcceptsModal() {
  1270. $("#rapidAcceptsUserName").val(null);
  1271. $("#rapidAcceptsUserCode").val(null);
  1272. $("#patientIdDb").val(null);
  1273. $("#rapidAcceptsUserCardNo").val(null);
  1274. $("#rapidAcceptsUserGender").selectpicker('val', 0);
  1275. $("#rapidAcceptsUserGender").selectpicker('refresh');
  1276. $("#rapidAcceptsUserPhoneNum").val(null);
  1277. $('#rapidAcceptsUserCertificateType').selectpicker('val', '01');
  1278. $('#rapidAcceptsUserCertificateType').selectpicker('refresh');
  1279. $("#rapidAcceptsUserIdCard").val(null);
  1280. $("#rapidAcceptsUserIdCard").attr("title", null);
  1281. $("#rapidAcceptsUserPhoneNum").attr("title", null);
  1282. $('#rapidAcceptsProvinceCode').selectpicker('val', null);
  1283. $('#rapidAcceptsProvinceCode').selectpicker('refresh');
  1284. $('#rapidAcceptsCityCode').selectpicker('val', null);
  1285. $('#rapidAcceptsCityCode').selectpicker('refresh');
  1286. $('#rapidAcceptsDistrictCode').selectpicker('val', null);
  1287. $('#rapidAcceptsDistrictCode').selectpicker('refresh');
  1288. $("#rapidAcceptsDetail").val(null);
  1289. $("#rapidAcceptsDetail").attr("title", null);
  1290. $("#rapidAcceptsUserContact").val(null);
  1291. $("#rapidAcceptsUserContactPhone").val(null);
  1292. }
  1293. /**
  1294. * 清空接诊台用户信息
  1295. * @param flag 是否清空分诊流水哈 true 清空
  1296. */
  1297. function clearUser(flag) {
  1298. $("#patientName").html("");
  1299. $("#patientAge").html("");
  1300. $("#patientGender").html("");
  1301. $("#patientId").text(null);
  1302. $("#editUser").css("display", "none");
  1303. $("#clearUser").css("display", "none");
  1304. $("#fetchSpcSlwinfo").css("display", "none");
  1305. $("#patientPhone").html("");
  1306. $("#patientPhoneLabel").hide();
  1307. $("#patientResponseType").html("");
  1308. $("#first").next().click();
  1309. $("#patientHisData").text("");
  1310. if (flag) {
  1311. $("#transferTreatment").css("display", "none");
  1312. $("#consultation").css("display", "none");
  1313. $("#mzfzSerialNoInClick").val(null);
  1314. $("#mzfzReqTypeNoInClick").val(null);
  1315. $("#turnToConsultationIdInClick").val(null);
  1316. }
  1317. }
  1318. /**
  1319. * 卡号输入改变事件
  1320. */
  1321. function cardNoChange() {
  1322. if (window.ActiveXObject || "ActiveXObject" in window) {
  1323. $("#rapidAcceptsUserCardNo").on('input propertychange', function () {
  1324. queryUserInfoByCardNo();
  1325. });
  1326. } else {
  1327. $("#rapidAcceptsUserCardNo").on('input οninput', function () {
  1328. queryUserInfoByCardNo();
  1329. });
  1330. }
  1331. }
  1332. /**
  1333. * 刷新就诊列表
  1334. */
  1335. function refreshClinic() {
  1336. loadInClinicTableList();
  1337. loadClinicTableList();
  1338. fitPatientHisData();
  1339. }
  1340. /**
  1341. * 加载已接诊患者列表
  1342. */
  1343. function loadClinicTableList() {
  1344. //loadCommonClinicTableList("tb_table_clinic","/thmz/getClinicWithPage");
  1345. loadCommonClinicTableList("tb_table_clinic", queryParamsClinic);
  1346. }
  1347. /**
  1348. * 加载患者列表通用方法
  1349. * @param id
  1350. * @param queryParams
  1351. */
  1352. function loadCommonClinicTableList(id, queryParams) {
  1353. $('#' + id).bootstrapTable('refresh');
  1354. $('#' + id).bootstrapTable({
  1355. url: "/thmz/getClinicWithPage", //请求后台的URL(*)
  1356. method: 'post', //请求方式(*)
  1357. toolbar: '#toolbar', //工具按钮用哪个容器
  1358. striped: true, //是否显示行间隔色
  1359. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  1360. pagination: true, //是否显示分页(*)
  1361. sortable: true, //是否启用排序
  1362. sortOrder: "asc", //排序方式
  1363. queryParams: queryParams, //传递参数(*)
  1364. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  1365. pageNumber: 1, //初始化加载第一页,默认第一页
  1366. pageSize: 5, //每页的记录行数(*)
  1367. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  1368. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  1369. strictSearch: true,
  1370. showColumns: false, //是否显示所有的列
  1371. showRefresh: false, //是否显示刷新按钮
  1372. minimumCountColumns: 2, //最少允许的列数
  1373. clickToSelect: true, //是否启用点击选中行
  1374. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  1375. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  1376. cardView: false, //是否显示详细视图
  1377. detailView: false,
  1378. //rowStyle:rowStyle,//通过自定义函数设置行样式
  1379. ajaxOptions: {
  1380. headers: {
  1381. 'Accept': 'application/json',
  1382. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  1383. }
  1384. },
  1385. columns: [
  1386. {
  1387. field: 'patientName',
  1388. title: '姓名/性别/年龄',
  1389. align: "center",
  1390. valign: 'middle',
  1391. // sortable: true
  1392. formatter: function (value, row, index) {
  1393. var age = row.age;
  1394. if (age == null || age == "null") {
  1395. age = "";
  1396. }
  1397. return value + "/" + row.gender + "/" + age;
  1398. }
  1399. }, {
  1400. field: 'opDay',
  1401. title: '接诊时间',
  1402. align: "center",
  1403. valign: 'middle',
  1404. // sortable: true
  1405. formatter: function (value, row, index) {
  1406. return format(value, "MM/dd HH:mm");
  1407. }
  1408. }
  1409. , {
  1410. title: '操作',
  1411. align: "center",
  1412. valign: 'middle',
  1413. // sortable: true,
  1414. formatter: function (value, row, index) {
  1415. if (row.clinicStatus == 5) {
  1416. 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>';
  1417. // 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>';
  1418. } else if (row.clinicStatus == 6) {
  1419. 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>';
  1420. } else if (row.clinicStatus == 7) {
  1421. 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>';
  1422. }
  1423. }
  1424. }
  1425. ],
  1426. responseHandler: function (res) {
  1427. if (res == '401' || res == 401) {
  1428. window.location.href = '/thmz/login/view'
  1429. return;
  1430. }
  1431. var ress = eval(res);
  1432. if (ress.code == -1) {
  1433. new PNotify({
  1434. title: '错误提示',
  1435. text: ress.message,
  1436. type: 'error',
  1437. hide: false,
  1438. styling: 'bootstrap3'
  1439. });
  1440. return {
  1441. "total": 0,//总页数
  1442. "rows": {} //数据
  1443. };
  1444. }
  1445. return {
  1446. "total": ress.total,//总页数
  1447. "rows": ress.data //数据
  1448. };
  1449. },
  1450. onLoadSuccess: function (data) {
  1451. $(".pagination-detail").css("display", "none");
  1452. if (id == "tb_table_clinic") {
  1453. $("#ClinicNum").html(data.total);
  1454. } else {
  1455. $("#inClinicNum").html(data.total);
  1456. }
  1457. }
  1458. });
  1459. }
  1460. /**
  1461. * 得到查询的参数 接诊中
  1462. * @param params
  1463. * @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}}
  1464. */
  1465. function queryParamsInClinic(params) {
  1466. var temp = {
  1467. pageSize: params.limit,
  1468. pageIndex: params.offset / params.limit, //页码
  1469. statusFlagList: [8]
  1470. };
  1471. return temp;
  1472. };
  1473. /**
  1474. * 得到查询的参数
  1475. * @param params
  1476. * @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}}
  1477. */
  1478. function queryParamsClinic(params) {
  1479. var rePortRangeArr = getRePortRangeArr();
  1480. var commonParams = $("#userName").val();
  1481. var needDateParams = commonParams == null || commonParams == "null" || commonParams == "";
  1482. var temp = {
  1483. beginDate: needDateParams ? rePortRangeArr[0] : "2012-02-01 00:00:00",
  1484. endDate: needDateParams ? rePortRangeArr[1] : format(new Date(), "yyyy-MM-dd HH:mm:ss"),
  1485. commonParams: commonParams,
  1486. clinicStatuses: [5, 6, 7],
  1487. pageSize: params.limit,
  1488. offset: params.offset
  1489. };
  1490. return temp;
  1491. };
  1492. /**
  1493. * 加载待诊患者列表方法
  1494. */
  1495. function loadUnClinicTableList() {
  1496. loadCanClinicTableList("tb_table_un_clinic", queryParamsUnClinic);
  1497. }
  1498. /**
  1499. * 加载接诊中患者列表方法
  1500. */
  1501. function loadInClinicTableList() {
  1502. loadCanClinicTableList("tb_table_in_clinic", queryParamsInClinic);
  1503. }
  1504. /**
  1505. * 加载待诊和接诊中患者列表通用方法方法
  1506. */
  1507. function loadCanClinicTableList(id, queryParams) {
  1508. $('#' + id).bootstrapTable('refresh');
  1509. $('#' + id).bootstrapTable({
  1510. url: "/thmz/getUnClinicWithPage", //请求后台的URL(*)
  1511. method: 'post', //请求方式(*)
  1512. toolbar: '#toolbar', //工具按钮用哪个容器
  1513. striped: true, //是否显示行间隔色
  1514. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  1515. pagination: true, //是否显示分页(*)
  1516. sortable: true, //是否启用排序
  1517. sortOrder: "asc", //排序方式
  1518. queryParams: queryParams, //传递参数(*)
  1519. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  1520. pageNumber: 1, //初始化加载第一页,默认第一页
  1521. pageSize: 2, //每页的记录行数(*)
  1522. pageList: [2, 5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  1523. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  1524. strictSearch: true,
  1525. showColumns: false, //是否显示所有的列
  1526. showRefresh: false, //是否显示刷新按钮
  1527. minimumCountColumns: 2, //最少允许的列数
  1528. clickToSelect: true, //是否启用点击选中行
  1529. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  1530. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  1531. cardView: false, //是否显示详细视图
  1532. detailView: false,
  1533. //rowStyle:rowStyle,//通过自定义函数设置行样式
  1534. ajaxOptions: {
  1535. headers: {
  1536. 'Accept': 'application/json',
  1537. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  1538. }
  1539. },
  1540. columns: [
  1541. {
  1542. field: 'name',
  1543. title: '姓名/性别/年龄',
  1544. align: "center",
  1545. valign: 'middle',
  1546. // sortable: true
  1547. formatter: function (value, row, index) {
  1548. return value + "/" + row.gender + "/" + row.age;
  1549. }
  1550. }, {
  1551. field: 'visitDate',
  1552. title: '分诊时间',
  1553. align: "center",
  1554. valign: 'middle',
  1555. // sortable: true
  1556. formatter: function (value, row, index) {
  1557. return format(value, "MM/dd HH:mm");
  1558. }
  1559. }
  1560. , {
  1561. title: '操作',
  1562. align: "center",
  1563. valign: 'middle',
  1564. // sortable: true,
  1565. formatter: function (value, row, index) {
  1566. if (row.statusFlag == 0) {
  1567. return '<a title="接诊" onclick="clinicalReception(\'' + row.patientId + '\',\'' + row.serialNo + '\',' + row.reqType + ')" style="cursor: pointer">接诊</a>';
  1568. } else if (row.statusFlag == 8) {
  1569. //TODO 继续接诊需要新方法
  1570. return '<a title="继续接诊" onclick="clinicalReception(\'' + row.patientId + '\',\'' + row.serialNo + '\',' + row.reqType + ')" style="cursor: pointer">续诊</a> <a title="取消接诊" onclick="cancelClinic(\'' + row.patientId + '\',\'' + row.times + '\')" style="cursor: pointer">消诊</a>';
  1571. } else if (row.statusFlag == 1 || row.statusFlag == 2 || row.statusFlag == 3) {
  1572. return '<a title="通知" onclick="clinicCallNumber(\'' + row.serialNo + '\')" style="cursor: pointer">通知</a>&nbsp;<a title="接诊" onclick="clinicalReception(\'' + row.patientId + '\',\'' + row.serialNo + '\',' + row.reqType + ')" style="cursor: pointer">接诊</a>';
  1573. }
  1574. }
  1575. }
  1576. ],
  1577. responseHandler: function (res) {
  1578. if (res == '401' || res == 401) {
  1579. window.location.href = '/thmz/login/view'
  1580. return;
  1581. }
  1582. var ress = eval(res);
  1583. if (ress.code == -1) {
  1584. new PNotify({
  1585. title: '错误提示',
  1586. text: ress.message,
  1587. type: 'error',
  1588. hide: false,
  1589. styling: 'bootstrap3'
  1590. });
  1591. return {
  1592. "total": 0,//总页数
  1593. "rows": {} //数据
  1594. };
  1595. }
  1596. return {
  1597. "total": ress.total,//总页数
  1598. "rows": ress.data //数据
  1599. };
  1600. },
  1601. onLoadSuccess: function (data) {
  1602. $(".pagination-detail").css("display", "none");
  1603. $("#unClinicNum").html(data.total);
  1604. }
  1605. });
  1606. }
  1607. /**
  1608. * 得到查询的参数
  1609. * @param params
  1610. * @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}}
  1611. */
  1612. function queryParamsUnClinic(params) {
  1613. var temp = {
  1614. pageSize: params.limit,
  1615. pageIndex: params.offset / params.limit, //页码
  1616. statusFlagList: [0, 1, 2, 3]
  1617. };
  1618. return temp;
  1619. };
  1620. /**
  1621. * 通知叫号
  1622. * @param serialNo
  1623. */
  1624. function clinicCallNumber(serialNo) {
  1625. $.ajax({
  1626. type: "GET",
  1627. url: '/thmz/clinicCallNumber?serialNo=' + serialNo,
  1628. contentType: "application/json;charset=UTF-8",
  1629. dataType: "json",
  1630. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1631. success: function (res) {
  1632. if (res == '401' || res == 401) {
  1633. window.location.href = '/thmz/login/view'
  1634. return;
  1635. }
  1636. if (res.code == 0) {
  1637. successMesage(res);
  1638. } else {
  1639. errorMesage(res);
  1640. }
  1641. }
  1642. });
  1643. }
  1644. /**
  1645. * 接诊方法
  1646. * @param patientId 门诊id
  1647. * @param serialNo 分诊流水号
  1648. * @param reqType 号表类别
  1649. */
  1650. function clinicalReception(patientId, serialNo, reqType) {
  1651. var existPatientId = $("#patientId").text();
  1652. if (existPatientId != null && existPatientId != "" && existPatientId != patientId) {
  1653. $("#messageModal").modal();
  1654. $("#messageContent").html("当前有病人正在接诊,是否切换?");
  1655. $("#messageButton").off("click").on("click", function (t) {
  1656. $("#messageModal").modal("hide");
  1657. //当前有人在接诊,提示是否需要切换和保存
  1658. $("#messagePrescriptionModal").modal();
  1659. $("#confirmPrescriptionButton").off("click").on("click", function (t) {
  1660. $("#messagePrescriptionModal").modal("hide");
  1661. //先保存目前接诊信息,再切换就诊人
  1662. var jsonData = getParamsForpPrescription(1);
  1663. $.ajax({
  1664. type: "POST",
  1665. url: '/thmz/savePrescription',
  1666. contentType: "application/json;charset=UTF-8",
  1667. dataType: "json",
  1668. data: JSON.stringify(jsonData),
  1669. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1670. success: function (res) {
  1671. if (res == '401' || res == 401) {
  1672. window.location.href = '/thmz/login/view'
  1673. return;
  1674. }
  1675. if (res.code == 0) {
  1676. clearWorkSpace();
  1677. realClinicalReception(patientId, serialNo, reqType);
  1678. //加载已接诊患者列表
  1679. loadClinicTableList();
  1680. } else {
  1681. errorMesage(res);
  1682. }
  1683. }
  1684. });
  1685. });
  1686. $("#cancelPrescriptionButton").off("click").on("click", function (t) {
  1687. $("#messagePrescriptionModal").modal("hide");
  1688. clearWorkSpace();
  1689. realClinicalReception(patientId, serialNo, reqType);
  1690. });
  1691. });
  1692. $("#cancelButton").off("click");
  1693. } else {
  1694. realClinicalReception(patientId, serialNo, reqType);
  1695. }
  1696. }
  1697. /**
  1698. * 取消接诊
  1699. * @param patientId
  1700. */
  1701. function cancelClinic(patientId, times) {
  1702. $("#messageModal").modal();
  1703. $("#messageContent").html("确认取消当前病人的接诊记录吗?");
  1704. $("#messageButton").off("click").on("click", function (t) {
  1705. $("#messageModal").modal("hide");
  1706. $.ajax({
  1707. type: "GET",
  1708. url: '/thmz/cancelClinic?patientId=' + patientId + "&times=" + times,
  1709. contentType: "application/json;charset=UTF-8",
  1710. dataType: "json",
  1711. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1712. success: function (res) {
  1713. if (res == '401' || res == 401) {
  1714. window.location.href = '/thmz/login/view'
  1715. return;
  1716. }
  1717. if (res.code == 0) {
  1718. if (res.data == null || res.data.length == 0) {
  1719. return;
  1720. }
  1721. successMesage(res);
  1722. if (times > 0) {
  1723. loadUnClinicTableList();
  1724. loadInClinicTableList();
  1725. clearWorkSpace();
  1726. }
  1727. } else if (res.code == -1) {
  1728. errorMesage(res);
  1729. }
  1730. }
  1731. });
  1732. });
  1733. $("#cancelButton").off("click");
  1734. };
  1735. /**
  1736. * 设置当前接诊病人信息
  1737. * @param mzPatientMi
  1738. */
  1739. function setMzPatientInfo(mzPatientMi) {
  1740. $.ajax({
  1741. type: "GET",
  1742. url: '/thmz/getDeptNoByCurrentPatientId?patientId=' + mzPatientMi.patientId,
  1743. contentType: "application/json;charset=UTF-8",
  1744. dataType: "json",
  1745. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1746. success: function (res) {
  1747. if (res == '401' || res == 401) {
  1748. window.location.href = '/thmz/login/view'
  1749. return;
  1750. }
  1751. if (res.code == 0) {
  1752. //当前患者就诊科室编码
  1753. localStorage.setItem("currentDeptNo", res.data);
  1754. } else if (res.code == -1) {
  1755. errorMesage(res);
  1756. }
  1757. }
  1758. });
  1759. $("#patientName").html(mzPatientMi.name);
  1760. //var age = getAge(mzPatientMi);
  1761. $("#patientAge").html(mzPatientMi.ageString);
  1762. $("#patientGender").html(mzPatientMi.gender);
  1763. $("#patientId").text(mzPatientMi.patientId);
  1764. $("#editUser").css("display", "inline-block");
  1765. $("#clearUser").css("display", "inline-block");
  1766. if (mzPatientMi.phoneNo != null && mzPatientMi.phoneNo != '') {
  1767. $("#patientPhone").html(mzPatientMi.phoneNo);
  1768. $("#patientPhoneLabel").show();
  1769. } else {
  1770. $("#patientPhoneLabel").hide();
  1771. }
  1772. $("#patientResponseType").html(mzPatientMi.responseTypeName);
  1773. if (mzPatientMi.times == 1) {
  1774. $("#first").next().click();
  1775. } else {
  1776. $("#not").next().click();
  1777. }
  1778. $("#patientHisData").text(mzPatientMi.name);
  1779. fitPatientHisData();
  1780. setTmResponseType(mzPatientMi.patientId);
  1781. }
  1782. /**
  1783. * 判断是否是特门病人
  1784. * @param patientId
  1785. */
  1786. function setTmResponseType(patientId) {
  1787. $.ajax({
  1788. type: "GET",
  1789. url: '/thmz/fetchSpcSlwinfo?patientId=' + patientId,
  1790. contentType: "application/json;charset=UTF-8",
  1791. dataType: "json",
  1792. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1793. success: function (res) {
  1794. if (res == '401' || res == 401) {
  1795. window.location.href = '/thmz/login/view'
  1796. return;
  1797. }
  1798. if (res.code == 0) {
  1799. if (res.data != null && res.data.length > 0) {
  1800. $("#patientResponseType").html("特殊门诊");
  1801. $("#fetchSpcSlwinfo").css("display", "inline-block");
  1802. }
  1803. }
  1804. }
  1805. });
  1806. }
  1807. /**
  1808. * 特门详情
  1809. * @param patientId
  1810. */
  1811. function fetchSpcSlwinfo() {
  1812. var patientId = $("#patientId").text();
  1813. $.ajax({
  1814. type: "GET",
  1815. url: '/thmz/fetchSpcSlwinfo?patientId=' + patientId,
  1816. contentType: "application/json;charset=UTF-8",
  1817. dataType: "json",
  1818. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1819. success: function (res) {
  1820. if (res == '401' || res == 401) {
  1821. window.location.href = '/thmz/login/view'
  1822. return;
  1823. }
  1824. if (res.code == 0) {
  1825. if (res.data != null && res.data.length > 0) {
  1826. $("#fetchSpcSlwinfoModal").modal();
  1827. $("#fetchSpcSlwinfoTable").html(null);
  1828. for (var i = 0; i < res.data.length; i++) {
  1829. var begndate = res.data[i].begndate;
  1830. if (begndate == null || begndate == "null") {
  1831. begndate = "";
  1832. }
  1833. var enddate = res.data[i].enddate;
  1834. if (enddate == null || enddate == "null") {
  1835. enddate = "";
  1836. }
  1837. var opspDiseName = res.data[i].opspDiseName;
  1838. if (opspDiseName == null || opspDiseName == "null") {
  1839. opspDiseName = "";
  1840. }
  1841. var opspDiseCode = res.data[i].opspDiseCode;
  1842. if (opspDiseCode == null || opspDiseCode == "null") {
  1843. opspDiseCode = "";
  1844. }
  1845. var ideFixmedinsName = res.data[i].ideFixmedinsName;
  1846. if (ideFixmedinsName == null || ideFixmedinsName == "null") {
  1847. ideFixmedinsName = "";
  1848. }
  1849. $("<tr><td>" + begndate + "</td><td>" + enddate + "</td><td>" + opspDiseCode + "</td><td>" + opspDiseName + "</td><td>" + ideFixmedinsName + "</td></tr>").appendTo("#fetchSpcSlwinfoTable");
  1850. // .bind('click', function () {
  1851. // $("#fetchSpcSlwinfoModal").modal("hide");
  1852. // clinicalReception(patientIdDb, $(this).attr("data-target"));
  1853. // });
  1854. }
  1855. } else {
  1856. errorMesage(res);
  1857. }
  1858. } else {
  1859. errorMesage(res);
  1860. }
  1861. }
  1862. });
  1863. }
  1864. /**
  1865. * 初诊的时候设置患者生命体征
  1866. * @param res
  1867. */
  1868. function setMzSmtz(res) {
  1869. var mzYshTzxx = res.mzYshTzxx;
  1870. if (mzYshTzxx != null) {
  1871. if (mzYshTzxx.valueTz != null) {
  1872. $("#weight").val(mzYshTzxx.valueTz);
  1873. }
  1874. if (mzYshTzxx.valueTw != null) {
  1875. $("#temperature").val(mzYshTzxx.valueTw);
  1876. }
  1877. if (mzYshTzxx.valueMb != null) {
  1878. $("#sphygmus").val(mzYshTzxx.valueMb);
  1879. }
  1880. if (mzYshTzxx.valueHx != null) {
  1881. $("#breathe").val(mzYshTzxx.valueHx);
  1882. }
  1883. if (mzYshTzxx.valueSsy != null) {
  1884. $("#pressure_high").val(mzYshTzxx.valueSsy);
  1885. }
  1886. if (mzYshTzxx.valueSzy != null) {
  1887. $("#pressure_floor").val(mzYshTzxx.valueSzy);
  1888. }
  1889. }
  1890. }
  1891. /**
  1892. * 真实的接诊方法
  1893. * @param patientId
  1894. * @param serialNo 分诊流水号
  1895. * @param reqType 号表类别
  1896. */
  1897. function realClinicalReception(patientId, serialNo, reqType) {
  1898. var turnToConsultationIdInClick = $("#turnToConsultationIdInClick").val();
  1899. if (turnToConsultationIdInClick == null || turnToConsultationIdInClick == "null") {
  1900. turnToConsultationIdInClick = 0;
  1901. }
  1902. $.ajax({
  1903. type: "GET",
  1904. url: '/thmz/saveClinic?patientId=' + patientId + "&serialNo=" + serialNo + "&turnToConsultationId=" + turnToConsultationIdInClick,
  1905. contentType: "application/json;charset=UTF-8",
  1906. dataType: "json",
  1907. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1908. success: function (res) {
  1909. if (res == '401' || res == 401) {
  1910. window.location.href = '/thmz/login/view'
  1911. return;
  1912. }
  1913. if (res.code == 0) {
  1914. if (res.data != null) {
  1915. var mzPatientMi = res.data;
  1916. setMzPatientInfo(mzPatientMi);
  1917. setMzSmtz(res);
  1918. $("#mzfzSerialNoInClick").val(serialNo);
  1919. $("#mzfzReqTypeNoInClick").val(reqType);
  1920. //有分诊流水号 且 不是简易门诊 或 会诊目标科室接诊
  1921. if (serialNo != null && serialNo != "null") {
  1922. if (!(reqType == 10 || reqType == "10" || reqType == "16" || reqType == 16 || reqType == -200)) {
  1923. $("#transferTreatment").css("display", "inline-block");
  1924. }
  1925. $("#consultation").css("display", "inline-block");
  1926. }
  1927. //加载候诊患者列表
  1928. loadUnClinicTableList();
  1929. //加载接诊中患者列表
  1930. loadInClinicTableList();
  1931. //查询患者的门诊统筹信息
  1932. queryInsuinfo(patientId);
  1933. }
  1934. } else {
  1935. errorMesage(res);
  1936. }
  1937. }
  1938. });
  1939. }
  1940. /**
  1941. * 查询患者的门诊统筹信息
  1942. * @param patientId
  1943. */
  1944. function queryInsuinfo(patientId) {
  1945. $.ajax({
  1946. type: "GET",
  1947. url: '/thmz/queryInsuinfo?patientId=' + patientId,
  1948. contentType: "application/json;charset=UTF-8",
  1949. dataType: "json",
  1950. headers: {
  1951. 'Accept': 'application/json',
  1952. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  1953. },
  1954. success: function (res) {
  1955. if (res == '401' || res == 401) {
  1956. window.location.href = '/thmz/login/view'
  1957. return;
  1958. }
  1959. if (res.code == 0) {
  1960. $("#zgmztczfDiv").removeClass("hide").addClass("in");
  1961. $("#mztczfSiReadCard").removeClass("hide").addClass("in");
  1962. var ybCode = localStorage.getItem("ybCode");
  1963. if (ybCode != null && ybCode != "" && ybCode.length > 0) {
  1964. $("#zgmztczf").selectpicker('val', 1);
  1965. $("#zgmztczf").selectpicker('refresh');
  1966. }
  1967. if (res.balc != null) {
  1968. var balc = Number(res.balc);
  1969. if (balc > 0) {
  1970. $("#grzhzfDiv").removeClass("hide").addClass("in");
  1971. }
  1972. }
  1973. } else if (res.code == -1) {
  1974. errorMesageSimaple(res.message);
  1975. } else if (res.code == -2) {
  1976. warningMesageSimaple(res.message);
  1977. }
  1978. }
  1979. });
  1980. }
  1981. /**
  1982. * 读医保电子凭证
  1983. * @param asyncFlag true 异步 false 同步
  1984. */
  1985. function mztczfSiReadCard(asyncFlag) {
  1986. mztczfSiReadCardStatus = true;
  1987. $.ajax({
  1988. type: "GET",
  1989. url: 'http://localhost:8321/readcard/entry?param=qrcode_01101',
  1990. contentType: "application/json;charset=UTF-8",
  1991. dataType: "json",
  1992. async: asyncFlag,
  1993. headers: {
  1994. 'Accept': 'application/json',
  1995. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  1996. },
  1997. success: function (res) {
  1998. mztczfSiReadCardStatus = false;
  1999. if (res == '401' || res == 401) {
  2000. window.location.href = '/thmz/login/view'
  2001. return;
  2002. }
  2003. //console.log(res);
  2004. if (res.code == 200) {
  2005. var data = JSON.parse(res.data);
  2006. $("#readCardResult").val(JSON.stringify(data.data));
  2007. $("#messageContent").html("读卡成功,是否保存处方?");
  2008. } else {
  2009. $("#messageContent").html("读卡失败,是否保存处方(不享受门诊统筹)?");
  2010. errorMesage(res);
  2011. }
  2012. },
  2013. error: function (XMLHttpRequest, textStatus, errorThrown) {
  2014. mztczfSiReadCardStatus = false;
  2015. $("#messageContent").html("读卡异常,是否保存处方(不享受门诊统筹)?");
  2016. }
  2017. });
  2018. }
  2019. /**
  2020. * 实际读医保电子凭证
  2021. * @param asyncFlag true 异步 false 同步
  2022. */
  2023. function realMztczfSiReadCard(asyncFlag) {
  2024. }
  2025. /**
  2026. * 清空工作台
  2027. */
  2028. function clearWorkSpace() {
  2029. clearUser(true);
  2030. clearWorkSpaceExcludeUser(1);
  2031. }
  2032. /**
  2033. * 清空工作台除了用户信息
  2034. * @param source 1 清空工作台 2 调用模板 3 调用历史处方
  2035. */
  2036. function clearWorkSpaceExcludeUser(source) {
  2037. var conciseRecordsFlag = false;
  2038. if (source == 2) {
  2039. conciseRecordsFlag = $("#conciseRecordsYlfw").prop("checked");
  2040. } else if (source == 3) {
  2041. conciseRecordsFlag = $("#conciseRecordsJzxq").prop("checked");
  2042. }
  2043. if (source == 1 || conciseRecordsFlag) {
  2044. $("#symptom").val(null);
  2045. $("#emrHpi").val(null);
  2046. $("#emrPs").val(null);
  2047. $("#personalHistory").val(null);
  2048. $("#familyHistory").val(null);
  2049. $("#obstericalHistory").val(null);
  2050. $("#weight").val(null);
  2051. $("#temperature").val(null);
  2052. $("#sphygmus").val(null);
  2053. $("#breathe").val(null);
  2054. $("#pressure_high").val(null);
  2055. $("#pressure_floor").val(null);
  2056. $("#pressure_high_left").val(null);
  2057. $("#pressure_floor_left").val(null);
  2058. $("#tentativeDiagnosis").val(null);
  2059. $("#otherCheck").val(null);
  2060. $("#diagnoseValue").val(null);
  2061. $("#diagnoseTags").html(null);
  2062. $("#healthEducation").val(null);
  2063. }
  2064. //清空工作台的时候需要调用
  2065. if (source == 1) {
  2066. clearWesternMedicine(true);
  2067. clearChineseMedicine();
  2068. clearJyJcItem();
  2069. clearZlItem();
  2070. clearZyReq();
  2071. //initNavTabs(0);
  2072. clearNavTabs(0);
  2073. clearNavTabs(1);
  2074. clearNavTabs(2);
  2075. clearNavTabs(3);
  2076. clearNavTabs(4);
  2077. clearApidAcceptsModal();
  2078. clearTurnToConsultationInput();
  2079. clearZgtczfInput();
  2080. gropuIdAndOrderNoMap = null;
  2081. //prevCategoriesFlag = null;
  2082. initGroupOrder();
  2083. localStorage.removeItem("currentDeptNo");
  2084. }
  2085. $("#totalAmount").text(0);
  2086. }
  2087. /**
  2088. * 构造西药处方详情和模板预览方法
  2089. * @param pyPrescription
  2090. * @param contentId 内容ID
  2091. * @param titleId 标题ID
  2092. * @param checkBox 是否需要增加ckeckBox
  2093. */
  2094. function fitxyContent(pyPrescription, contentId, titleId, checkBox) {
  2095. if (pyPrescription != null && pyPrescription.length > 0) {
  2096. var xypyHtml = "";
  2097. for (var i = 0; i < pyPrescription.length; i++) {
  2098. var py = pyPrescription[i];
  2099. if (py == null || py.length == 0) {
  2100. continue;
  2101. }
  2102. var detail = py.detail;
  2103. if (detail == null || detail.length == 0) {
  2104. continue;
  2105. }
  2106. for (var j = 0; j < detail.length; j++) {
  2107. var pyDetail = detail[j];
  2108. if (checkBox) {
  2109. xypyHtml += "<div style='cursor: pointer;' data-id='" + pyDetail.orderCode + "'>";
  2110. xypyHtml += "<input type='checkbox'/>";
  2111. xypyHtml += "<span onclick='rowDataClick(this)'>";
  2112. } else {
  2113. xypyHtml += "<div>";
  2114. }
  2115. xypyHtml += "<span style='color: red;'>" + pyDetail.groupOrder + "." + "</span>";
  2116. xypyHtml += pyDetail.name;
  2117. xypyHtml += " ";
  2118. xypyHtml += pyDetail.specification;
  2119. xypyHtml += " X ";
  2120. xypyHtml += pyDetail.quantity;
  2121. xypyHtml += pyDetail.packUnit;
  2122. xypyHtml += " 用法: ";
  2123. xypyHtml += pyDetail.supplyName;
  2124. xypyHtml += " ";
  2125. xypyHtml += pyDetail.drugQuan;
  2126. xypyHtml += pyDetail.unitDesc;
  2127. xypyHtml += " ";
  2128. xypyHtml += pyDetail.frequency;
  2129. xypyHtml += " ";
  2130. xypyHtml += pyDetail.orderDays;
  2131. xypyHtml += "天 ";
  2132. if (pyDetail.tryFlag != undefined && pyDetail.tryFlag != null && pyDetail.tryFlag != "null" && pyDetail.tryFlag != "") {
  2133. xypyHtml += pyDetail.tryFlag;
  2134. } else if (pyDetail.tryResult != undefined && pyDetail.tryResult != null && pyDetail.tryResult != "null" && pyDetail.tryResult != "") {
  2135. xypyHtml += pyDetail.tryResult;
  2136. }
  2137. if (checkBox) {
  2138. xypyHtml += "</span>";
  2139. }
  2140. xypyHtml += "</div>";
  2141. }
  2142. }
  2143. afterFitContent(contentId, xypyHtml, titleId);
  2144. } else {
  2145. $("#" + titleId).removeClass("in").addClass("hide");
  2146. $("#" + contentId).html("");
  2147. }
  2148. }
  2149. /**
  2150. * 构造中药处方详情和模板预览方法
  2151. * @param zyPrescription
  2152. * @param contentId 内容ID
  2153. * @param titleId 标题ID
  2154. * @param checkBox 是否需要增加ckeckBox
  2155. */
  2156. function fitzyContent(zyPrescription, contentId, titleId, checkBox) {
  2157. if (zyPrescription == null || zyPrescription.length == 0) {
  2158. $("#" + titleId).removeClass("in").addClass("hide");
  2159. $("#" + contentId).html("");
  2160. return;
  2161. }
  2162. var zyDetail = zyPrescription[0];
  2163. if (zyDetail == null || zyDetail.length == 0) {
  2164. $("#" + titleId).removeClass("in").addClass("hide");
  2165. $("#" + contentId).html("");
  2166. return;
  2167. }
  2168. var detail = zyDetail.detail;
  2169. if (detail == null || detail.length == 0) {
  2170. $("#" + titleId).removeClass("in").addClass("hide");
  2171. $("#" + contentId).html("");
  2172. return;
  2173. }
  2174. var zypyHtml = "";
  2175. for (var i = 0; i < detail.length; i++) {
  2176. //zypyHtml += '<div class="item form-group" style="margin-bottom: -5px;">';
  2177. var zy = detail[i];
  2178. if (zy == null || zy.length == 0) {
  2179. continue;
  2180. }
  2181. if (checkBox) {
  2182. zypyHtml += "<div class=\"col-md-3 col-sm-3 col-xs-12\" style='cursor: pointer;' data-id='" + zy.orderCode + "'>";
  2183. zypyHtml += "<input type='checkbox'/>";
  2184. zypyHtml += "<span onclick='rowDataClick(this)'>";
  2185. } else {
  2186. zypyHtml += "<div class=\"col-md-3 col-sm-3 col-xs-12\">";
  2187. }
  2188. zypyHtml += zy.name;
  2189. var instructionText = zy.instructionText;
  2190. if (instructionText != null && instructionText != "") {
  2191. zypyHtml += "[";
  2192. zypyHtml += instructionText;
  2193. zypyHtml += "]";
  2194. }
  2195. zypyHtml += zy.quantity;
  2196. zypyHtml += "g";
  2197. if (checkBox) {
  2198. zypyHtml += "</span>";
  2199. }
  2200. zypyHtml += "</div>";
  2201. // if (i % 4 == 0) {
  2202. // zypyHtml += '</div>';
  2203. // }
  2204. }
  2205. // if(detail.length%4!=0){
  2206. // for(var i=0;i<4-(detail.length%4);i++){
  2207. // zypyHtml += "<div class=\"col-md-3 col-sm-3 col-xs-12\"></div>";
  2208. // }
  2209. // }
  2210. var zyfs = zyDetail.zyfs;
  2211. if (zyfs != null && zyfs != "") {
  2212. zypyHtml += " <div class=\"col-md-12 col-sm-12 col-xs-12\">";
  2213. zypyHtml += ' <div style="text-indent: 2em;">';
  2214. zypyHtml += ' <div>';
  2215. zypyHtml += 'x<span>';
  2216. zypyHtml += zyfs;
  2217. zypyHtml += '</span> 付</div>';
  2218. }
  2219. afterFitContent(contentId, zypyHtml, titleId);
  2220. }
  2221. /**
  2222. * 构造辅助检查、检验处方详情和模板预览方法
  2223. * @param jcjyPrescription
  2224. * @param contentId 内容ID
  2225. * @param titleId 标题ID
  2226. * @param checkBox 是否需要增加ckeckBox
  2227. */
  2228. function fitJcjyContent(jcjyPrescription, contentId, titleId, checkBox) {
  2229. if (jcjyPrescription == null || jcjyPrescription.length == 0) {
  2230. $("#" + titleId).removeClass("in").addClass("hide");
  2231. $("#" + contentId).html("");
  2232. return;
  2233. }
  2234. var jcjyDetail = jcjyPrescription[0];
  2235. if (jcjyDetail == null || jcjyDetail.length == 0) {
  2236. $("#" + titleId).removeClass("in").addClass("hide");
  2237. $("#" + contentId).html("");
  2238. return;
  2239. }
  2240. var detail = jcjyDetail.detail;
  2241. if (detail == null || detail.length == 0) {
  2242. $("#" + titleId).removeClass("in").addClass("hide");
  2243. $("#" + contentId).html("");
  2244. return;
  2245. }
  2246. var jcjyHtml = "";
  2247. for (var i = 0; i < detail.length; i++) {
  2248. var jcjy = detail[i];
  2249. if (jcjy == null || jcjy.length == 0) {
  2250. continue;
  2251. }
  2252. if (checkBox) {
  2253. jcjyHtml += "<div style='cursor: pointer;' data-id='" + jcjy.orderCode + "'>";
  2254. jcjyHtml += "<input type='checkbox'/>";
  2255. jcjyHtml += "<span onclick='rowDataClick(this)'>";
  2256. } else {
  2257. jcjyHtml += "<div>";
  2258. }
  2259. jcjyHtml += jcjy.index + ".";
  2260. jcjyHtml += jcjy.name;
  2261. var drugUnit = jcjy.drugUnit;
  2262. if (drugUnit == undefined || drugUnit == null || drugUnit == "") {
  2263. drugUnit = "";
  2264. }
  2265. var drugQuan = jcjy.drugQuan;
  2266. if (drugQuan != undefined && drugQuan != null && drugQuan != "") {
  2267. jcjyHtml += " 单量:" + drugQuan + drugUnit;
  2268. }
  2269. var orderDays = jcjy.orderDays;
  2270. if (orderDays != undefined && orderDays != null && orderDays != "") {
  2271. jcjyHtml += " 天数:" + orderDays + "天";
  2272. }
  2273. var frequency = jcjy.frequency;
  2274. if (frequency != undefined && frequency != null && frequency != "") {
  2275. jcjyHtml += " 频次:" + frequency;
  2276. }
  2277. var quantity = jcjy.quantity;
  2278. if (quantity != undefined && quantity != null && quantity != "") {
  2279. jcjyHtml += " 总量:" + quantity + drugUnit;
  2280. }
  2281. if (checkBox) {
  2282. jcjyHtml += "</span>";
  2283. }
  2284. jcjyHtml += "</div>";
  2285. }
  2286. afterFitContent(contentId, jcjyHtml, titleId);
  2287. }
  2288. /**
  2289. * 构造入院处方详情和模板预览方法
  2290. * @param jcjyPrescription
  2291. * @param contentId 内容ID
  2292. * @param titleId 标题ID
  2293. * @param checkBox 是否需要增加ckeckBox
  2294. */
  2295. function fitZyReqContent(zyReqPrescription, contentId, titleId, checkBox) {
  2296. if (zyReqPrescription == null || zyReqPrescription.length == 0) {
  2297. $("#" + titleId).removeClass("in").addClass("hide");
  2298. $("#" + contentId).html("");
  2299. return;
  2300. }
  2301. var zyReqHtml = "";
  2302. if (checkBox) {
  2303. zyReqHtml += "<div style='cursor: pointer;'>";
  2304. zyReqHtml += "<input type='checkbox'/>";
  2305. zyReqHtml += "<span onclick='rowDataClick(this)'>";
  2306. } else {
  2307. zyReqHtml += "<div>";
  2308. }
  2309. zyReqHtml += "收住院 [";
  2310. zyReqHtml += zyReqPrescription.reqDept;
  2311. if (zyReqPrescription.smallDept != null && zyReqPrescription.smallDept != "") {
  2312. zyReqHtml += "(" + zyReqPrescription.smallDept + ")";
  2313. }
  2314. zyReqHtml += "]";
  2315. if (zyReqPrescription.admissStatus != null && zyReqPrescription.admissStatus != "") {
  2316. zyReqHtml += zyReqPrescription.admissStatus;
  2317. }
  2318. zyReqHtml += " 侯床";
  2319. if (checkBox) {
  2320. zyReqHtml += "</span>";
  2321. }
  2322. zyReqHtml += "</div>";
  2323. afterFitContent(contentId, zyReqHtml, titleId);
  2324. }
  2325. /**
  2326. * 处方详情构造方法后续事件,如所有的复选框默认勾选
  2327. * @param contentId
  2328. * @param zyReqHtml
  2329. * @param titleId
  2330. */
  2331. function afterFitContent(contentId, zyReqHtml, titleId) {
  2332. $("#" + contentId).html(zyReqHtml);
  2333. $("#" + titleId).removeClass("hide").addClass("in");
  2334. //是否默认勾选处方回调
  2335. var checkboxFlag = localStorage.getItem("checkboxFlag");
  2336. if (checkboxFlag != null && (checkboxFlag == "0" || checkboxFlag == 0)) {
  2337. $("#" + titleId).find("input[type='checkbox']").prop("checked", true);
  2338. $("#" + contentId).find("input[type='checkbox']").each(function (index, obj) {
  2339. $(obj).prop("checked", true);
  2340. });
  2341. } else {
  2342. $("#" + titleId).find("input[type='checkbox']").prop("checked", false);
  2343. }
  2344. }
  2345. /**
  2346. * 模板、详情页行数据点击事件
  2347. * @param obj
  2348. */
  2349. function rowDataClick(obj) {
  2350. $(obj).prev().click();
  2351. }
  2352. /**
  2353. * 模板、详情页治疗分类标题点击事件
  2354. * @param obj
  2355. * @param source 0 是标题的行点击事件 1 标题的checkbox本身触发
  2356. */
  2357. function titleClick(obj, source) {
  2358. var contentObj = $(obj).parent().next();
  2359. var check = $(obj).prop("checked");
  2360. if (source == 0) {
  2361. var prev = $(obj).prev();
  2362. check = !$(prev).prop("checked");
  2363. $(prev).prop("checked", check)
  2364. }
  2365. if (contentObj != null) {
  2366. $(contentObj).children().each(function (index, object) {
  2367. //以下两个方法,单独调用一个可能不行
  2368. $(object).find("input[type='checkbox']").prop("checked", check) //如果鼠标点击选中了,执行后可以取消选中
  2369. });
  2370. }
  2371. }
  2372. /**
  2373. * 处方明细复选框点击事件
  2374. * @param obj
  2375. * @param source 0 是标题的行点击事件 1 标题的checkbox本身触发
  2376. */
  2377. function prescriptionCfmxChosice(obj, source) {
  2378. var check = $(obj).prop("checked");
  2379. if (source == 0) {
  2380. var prev = $(obj).prev();
  2381. check = !$(prev).prop("checked");
  2382. //以下两个方法,单独调用一个可能不行
  2383. $(prev).prop("checked", check) //如果鼠标点击选中了,执行后可以取消选中
  2384. }
  2385. var conents = $(obj).parent().parent().nextAll();
  2386. if (conents == null || conents.length == 0) {
  2387. return;
  2388. }
  2389. $(conents).each(function (index, object) {
  2390. //以下两个方法,单独调用一个可能不行
  2391. $(object).find("div:eq(0)").find("input[type='checkbox']").prop("checked", check) //如果鼠标点击选中了,执行后可以取消选中
  2392. var contentObj = $(object).find("div:eq(1)");
  2393. if (contentObj != null) {
  2394. $(contentObj).children().each(function (contentIndex, contentObject) {
  2395. $(contentObject).find("input[type='checkbox']").prop("checked", check) //如果鼠标点击选中了,执行后可以取消选中
  2396. });
  2397. }
  2398. });
  2399. }
  2400. /**
  2401. * 简明病历标题点击事件
  2402. * @param obj
  2403. */
  2404. function prescriptionJmblChosice(obj) {
  2405. var prev = $(obj).prev();
  2406. var check = !$(prev).prop("checked");
  2407. $(prev).prop("checked", check); //如果鼠标点击选中了,执行后可以取消选中
  2408. }
  2409. /**
  2410. * 医疗范文详情预览
  2411. * @param id
  2412. */
  2413. function medicalModelModal(id) {
  2414. closeObjectWebui(false);
  2415. //是否默认勾选处方回调
  2416. var checkboxFlag = localStorage.getItem("checkboxFlag");
  2417. if (checkboxFlag != null && (checkboxFlag == "0" || checkboxFlag == 0)) {
  2418. $("#conciseRecordsYlfw").prop("checked", true);
  2419. $("#prescriptionSubsidiaryYlfw").prop("checked", true);
  2420. } else {
  2421. $("#conciseRecordsYlfw").prop("checked", false);
  2422. $("#prescriptionSubsidiaryYlfw").prop("checked", false);
  2423. }
  2424. $.ajax({
  2425. type: "GET",
  2426. url: '/thmz/getTemplateById?id=' + id,
  2427. contentType: "application/json;charset=UTF-8",
  2428. dataType: "json",
  2429. async: false,
  2430. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2431. success: function (res) {
  2432. if (res == '401' || res == 401) {
  2433. window.location.href = '/thmz/login/view'
  2434. return;
  2435. }
  2436. if (res.code == 0) {
  2437. var jsonData = JSON.parse(res.data.templateData);
  2438. $("#vmedicalModelName").text(res.data.name);
  2439. $("#idTemplate").val(res.data.id);
  2440. $("#zsTemplate").html(jsonData.mzBlRecord.emrChiefComplaint);
  2441. $("#xbsTemplate").html(jsonData.mzBlRecord.emrHpi);
  2442. $("#tgjcTemplate").html(jsonData.mzBlRecord.emrPe);
  2443. $("#jkjyTemplate").html(jsonData.mzBlRecord.emrJkjy);
  2444. var icdText = res.data.icdText;
  2445. $("#zdTemplate").html("");
  2446. $("#xypyContent").html("");
  2447. $("#xymjContent").html("");
  2448. $("#xyjeContent").html("");
  2449. $("#yczlContent").html("");
  2450. $("#zyzlContent").html("");
  2451. $("#zlyjContent").html("");
  2452. if (icdText != null) {
  2453. var arr = icdText.split(",");
  2454. var html = "";
  2455. for (var i = 0; i < arr.length; i++) {
  2456. if (i == 0) {
  2457. html += ' <div class="tagZdy tagZdy-back">';
  2458. } else {
  2459. html += ' <div class="tagZdy tagZdy-back-green">';
  2460. }
  2461. html += arr[i];
  2462. html += '</div>';
  2463. }
  2464. $("#zdTemplate").html(html);
  2465. }
  2466. var prescriptionDetail = jsonData.mzBlRecord.prescriptionDetail;
  2467. if (prescriptionDetail != null && prescriptionDetail != "") {
  2468. prescriptionDetail = JSON.parse(prescriptionDetail);
  2469. var xyPrescription = prescriptionDetail.xyPrescription;
  2470. if (xyPrescription != null) {
  2471. fitxyContent(xyPrescription.pyPrescription, "xypyContent", "xypyTitle", true);
  2472. fitxyContent(xyPrescription.mjPrescription, "xymjContent", "xymjTitle", true);
  2473. fitxyContent(xyPrescription.jePrescription, "xyjeContent", "xyjeTitle", true);
  2474. fitxyContent(xyPrescription.ycPrescription, "yczlContent", "yczlTitle", true);
  2475. } else {
  2476. $("#xypyTitle").removeClass("in").addClass("hide");
  2477. $("#xypyContent").html("");
  2478. $("#xymjTitle").removeClass("in").addClass("hide");
  2479. $("#xymjContent").html("");
  2480. $("#xyjeTitle").removeClass("in").addClass("hide");
  2481. $("#xyjeContent").html("");
  2482. $("#yczlTitle").removeClass("in").addClass("hide");
  2483. $("#yczlContent").html("");
  2484. }
  2485. var zyPrescription = prescriptionDetail.zyPrescription;
  2486. if (zyPrescription != null) {
  2487. fitzyContent(zyPrescription, "zyzlContent", "zyzlTitle", true);
  2488. } else {
  2489. $("#zyzlTitle").removeClass("in").addClass("hide");
  2490. $("#zyzlContent").html("");
  2491. }
  2492. var jcjyPrescription = prescriptionDetail.jcjyPrescription;
  2493. if (jcjyPrescription != null) {
  2494. fitJcjyContent(jcjyPrescription, "jcjyContent", "jcjyTitle", true);
  2495. } else {
  2496. $("#jcjyTitle").removeClass("in").addClass("hide");
  2497. $("#jcjyContent").html("");
  2498. }
  2499. var zlPrescription = prescriptionDetail.zlPrescription;
  2500. if (zlPrescription != null) {
  2501. fitJcjyContent(zlPrescription, "zlContent", "zlTitle", true);
  2502. } else {
  2503. $("#zlTitle").removeClass("in").addClass("hide");
  2504. $("#zlContent").html("");
  2505. }
  2506. var zyReqPrescription = prescriptionDetail.zyReqPrescription;
  2507. if (zyReqPrescription != null) {
  2508. fitZyReqContent(zyReqPrescription, "zyReqContent", "zyReqTitle", true);
  2509. } else {
  2510. $("#zyReqTitle").removeClass("in").addClass("hide");
  2511. $("#zyReqContent").html("");
  2512. }
  2513. } else {
  2514. $("#xypyTitle").removeClass("in").addClass("hide");
  2515. $("#xypyContent").html("");
  2516. $("#xymjTitle").removeClass("in").addClass("hide");
  2517. $("#xymjContent").html("");
  2518. $("#xyjeTitle").removeClass("in").addClass("hide");
  2519. $("#xyjeContent").html("");
  2520. $("#yczlTitle").removeClass("in").addClass("hide");
  2521. $("#yczlContent").html("");
  2522. $("#zyzlTitle").removeClass("in").addClass("hide");
  2523. $("#zyzlContent").html("");
  2524. $("#jcjyTitle").removeClass("in").addClass("hide");
  2525. $("#jcjyContent").html("");
  2526. $("#zlTitle").removeClass("in").addClass("hide");
  2527. $("#zlContent").html("");
  2528. $("#zyReqTitle").removeClass("in").addClass("hide");
  2529. $("#zyReqContent").html("");
  2530. }
  2531. } else {
  2532. errorMesage(res);
  2533. }
  2534. }
  2535. });
  2536. $("#medicalModelModal").modal();
  2537. }
  2538. /**
  2539. * 诊疗项目回写
  2540. * @param code
  2541. * @param mzChargeDetail
  2542. */
  2543. function callBackZlDetail(code, mzChargeDetail) {
  2544. //诊疗项目
  2545. $.ajax({
  2546. type: "GET",
  2547. url: '/thmz/getZdChargeItemByCode?code=' + code,
  2548. contentType: "application/json;charset=UTF-8",
  2549. dataType: "json",
  2550. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2551. async: false,
  2552. success: function (res) {
  2553. if (res == '401' || res == 401) {
  2554. window.location.href = '/thmz/login/view'
  2555. return;
  2556. }
  2557. if (res.code == 0) {
  2558. //如果
  2559. if ($("#zlTab").find("li") == null || $("#zlTab").find("li").length == 0) {
  2560. initNavTabs(3, null, null);
  2561. }
  2562. $("#zlItem").val(res.data.name);
  2563. $("#zlItem").blur();
  2564. $("#descriptions").val(res.data.descriptions);
  2565. $("#zlItemPrice").val(res.data.chargeAmount);
  2566. $("#chargeUnit").val(res.data.chargeUnit);
  2567. $("#zl_current_code").val(res.data.code);
  2568. $("#zlRemark").val(mzChargeDetail.instructionText);
  2569. $("#dayZlNum").selectpicker('val', mzChargeDetail.orderDays);
  2570. $('#dayZlNum').selectpicker('refresh');
  2571. $("#orderFrequencyZl").selectpicker('val', mzChargeDetail.frequency);
  2572. $('#orderFrequencyZl').selectpicker('refresh');
  2573. if (mzChargeDetail.execDept != null && mzChargeDetail.execDept != "") {
  2574. $("#zlExecUnit").selectpicker('val', mzChargeDetail.execDept);
  2575. $('#zlExecUnit').selectpicker('refresh');
  2576. }
  2577. $("#itemQuantity").val(mzChargeDetail.drugQuan);
  2578. $("#totalNumZl").val(mzChargeDetail.quantity);
  2579. saveZlItem(false);
  2580. } else {
  2581. errorMesage(res);
  2582. }
  2583. }
  2584. });
  2585. }
  2586. /**
  2587. * 处方回写
  2588. * @param jsonData 处方数据
  2589. * @param type 回写类型 0 全部回写 1 医疗范文 2 就诊详情
  2590. */
  2591. function editPrescription(jsonData, type) {
  2592. orderNoAndTableIdMap = new Map();
  2593. tableIdAndOrderNoMap = new Map();
  2594. var firstOrNot = jsonData.firstOrNot;
  2595. var conciseRecordsFlag = false;
  2596. if (type == 1) {
  2597. conciseRecordsFlag = $("#conciseRecordsYlfw").prop("checked");
  2598. } else if (type == 2) {
  2599. conciseRecordsFlag = $("#conciseRecordsJzxq").prop("checked");
  2600. }
  2601. if (firstOrNot == 0) {
  2602. $("#first").next().click();
  2603. } else if (firstOrNot == 1) {
  2604. $("#not").next().click();
  2605. }
  2606. if (type == 0 || conciseRecordsFlag) {
  2607. $("#symptom").val(jsonData.mzBlRecord.emrChiefComplaint);
  2608. $("#emrHpi").val(jsonData.mzBlRecord.emrHpi);
  2609. $("#emrPs").val(jsonData.mzBlRecord.emrPs);
  2610. $("#personalHistory").val(jsonData.mzBlRecord.personalHistory);
  2611. $("#familyHistory").val(jsonData.mzBlRecord.familyHistory);
  2612. $("#obstericalHistory").val(jsonData.mzBlRecord.obstericalHistory);
  2613. if (jsonData.mzBlRecord.weight != null && jsonData.mzBlRecord.weight != 0) {
  2614. $("#weight").val(jsonData.mzBlRecord.weight);
  2615. } else {
  2616. $("#weight").val("");
  2617. }
  2618. if (jsonData.mzBlRecord.temperature != null && jsonData.mzBlRecord.temperature != 0) {
  2619. $("#temperature").val(jsonData.mzBlRecord.temperature);
  2620. } else {
  2621. $("#temperature").val("");
  2622. }
  2623. if (jsonData.mzBlRecord.sphygmus != null && jsonData.mzBlRecord.sphygmus != 0) {
  2624. $("#sphygmus").val(jsonData.mzBlRecord.sphygmus);
  2625. } else {
  2626. $("#sphygmus").val("");
  2627. }
  2628. if (jsonData.mzBlRecord.breathe != null && jsonData.mzBlRecord.breathe != 0) {
  2629. $("#breathe").val(jsonData.mzBlRecord.breathe);
  2630. } else {
  2631. $("#breathe").val("");
  2632. }
  2633. if (jsonData.mzBlRecord.pressureHigh != null && jsonData.mzBlRecord.pressureHigh != 0) {
  2634. $("#pressure_high").val(jsonData.mzBlRecord.pressureHigh);
  2635. } else {
  2636. $("#pressure_high").val("");
  2637. }
  2638. if (jsonData.mzBlRecord.pressureFloor != null && jsonData.mzBlRecord.pressureFloor != 0) {
  2639. $("#pressure_floor").val(jsonData.mzBlRecord.pressureFloor);
  2640. } else {
  2641. $("#pressure_floor").val("");
  2642. }
  2643. if (jsonData.mzBlRecord.pressureHighLeft != null && jsonData.mzBlRecord.pressureHighLeft != 0) {
  2644. $("#pressure_high_left").val(jsonData.mzBlRecord.pressureHighLeft);
  2645. } else {
  2646. $("#pressure_high_left").val("");
  2647. }
  2648. if (jsonData.mzBlRecord.pressureFloorLeft != null && jsonData.mzBlRecord.pressureFloorLeft != 0) {
  2649. $("#pressure_floor_left").val(jsonData.mzBlRecord.pressureFloorLeft);
  2650. } else {
  2651. $("#pressure_floor_left").val("");
  2652. }
  2653. $("#tentativeDiagnosis").val(jsonData.mzBlRecord.tentativeDiagnosis);
  2654. $("#otherCheck").val(jsonData.mzBlRecord.emrPe);
  2655. var icdCode = jsonData.icdCode;
  2656. if (icdCode != null && icdCode != "" && icdCode.length > 0) {
  2657. $.ajax({
  2658. type: "GET",
  2659. url: '/thmz/getZdIcdByCodes?icdCode=' + icdCode,
  2660. contentType: "application/json;charset=UTF-8",
  2661. dataType: "json",
  2662. async: false,
  2663. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2664. success: function (res) {
  2665. if (res == '401' || res == 401) {
  2666. window.location.href = '/thmz/login/view'
  2667. return;
  2668. }
  2669. if (res.code == 0) {
  2670. if (res.data != null && res.data.length > 0) {
  2671. for (var i = 0; i < res.data.length; i++) {
  2672. fitDiagnoseValue(res.data[i].name, res.data[i].code);
  2673. }
  2674. }
  2675. } else {
  2676. errorMesage(res);
  2677. }
  2678. }
  2679. });
  2680. }
  2681. $("#healthEducation").val(jsonData.mzBlRecord.emrJkjy);
  2682. }
  2683. //西药选中的数据组
  2684. var xyArrays = [];
  2685. //中药选中的数据组
  2686. var zyArrays = [];
  2687. //辅助检查、检验选中的数据组
  2688. var jcjyArrays = [];
  2689. //诊疗选中的数据组
  2690. var zlArrays = [];
  2691. //住院选中的数据组
  2692. var zyReqArrays = [];
  2693. //组号与同组药数量的map
  2694. var groupOrderAndLengthMap = new Map();
  2695. //处方号与同处方号药数量的map
  2696. var orderNoAndLengthMap = new Map();
  2697. //住院回写
  2698. var zyReqCallBack = false;
  2699. if (type == 1) {
  2700. setCallBackArrays("xypyContent", xyArrays, groupOrderAndLengthMap, orderNoAndLengthMap);
  2701. setCallBackArrays("xymjContent", xyArrays, groupOrderAndLengthMap, orderNoAndLengthMap);
  2702. setCallBackArrays("xyjeContent", xyArrays, groupOrderAndLengthMap, orderNoAndLengthMap);
  2703. setCallBackArrays("yczlContent", xyArrays, groupOrderAndLengthMap, orderNoAndLengthMap);
  2704. setCallBackArrays("zyzlContent", zyArrays, null, null);
  2705. setCallBackArrays("jcjyContent", jcjyArrays, null, null);
  2706. setCallBackArrays("zlContent", zlArrays, null, null);
  2707. zyReqCallBack = $("#zyReqContent").find("input").prop("checked");
  2708. } else if (type == 2) {
  2709. setCallBackArrays("prescriptionDetail_xypyContent", xyArrays, groupOrderAndLengthMap, orderNoAndLengthMap);
  2710. setCallBackArrays("prescriptionDetail_xymjContent", xyArrays, groupOrderAndLengthMap, orderNoAndLengthMap);
  2711. setCallBackArrays("prescriptionDetail_xyjeContent", xyArrays, groupOrderAndLengthMap, orderNoAndLengthMap);
  2712. setCallBackArrays("prescriptionDetail_yczlContent", xyArrays, groupOrderAndLengthMap, orderNoAndLengthMap);
  2713. setCallBackArrays("prescriptionDetail_zyzlContent", zyArrays, null, null);
  2714. setCallBackArrays("prescriptionDetail_jcjyContent", jcjyArrays, null, null);
  2715. setCallBackArrays("prescriptionDetail_zlContent", zlArrays, null, null);
  2716. zyReqCallBack = $("#prescriptionDetail_zyReqContent").find("input").prop("checked");
  2717. } else if (type == 0) {
  2718. zyReqCallBack = true;
  2719. }
  2720. var mzChargeDetailList = jsonData.mzChargeDetailList;
  2721. var mzZyReq = jsonData.mzZyReq;
  2722. //中药的公共参数是否已经设置了
  2723. var hadSetZyFullParams = false;
  2724. //西药,成药,医材,麻精,中药,诊疗
  2725. if (mzChargeDetailList != null && mzChargeDetailList.length > 0) {
  2726. //当前实际回写的组号
  2727. var currentOrderNo = null;
  2728. //处方号与药品类型关系
  2729. var orderAndGroupNoMap = new Map();
  2730. // mzChargeDetailList.sort(function (a, b) {
  2731. // return a.groupNo - b.groupNo
  2732. // });
  2733. for (var i = 0; i < mzChargeDetailList.length; i++) {
  2734. var mzChargeDetail = mzChargeDetailList[i];
  2735. var groupNo = mzChargeDetail.groupNo;
  2736. var code = mzChargeDetail.chargeItemCode;
  2737. var serial = mzChargeDetail.serial;
  2738. if (groupNo == "00") {
  2739. if (type != 0 && !isInArray(code, zlArrays)) {
  2740. continue;
  2741. }
  2742. callBackZlDetail(code, mzChargeDetail);
  2743. } else if (groupNo == "71" || groupNo == "91" || groupNo == "111" || groupNo == "131") {
  2744. // 71 西成药 91 医材 111 精一 131 精二
  2745. var groupOrder = mzChargeDetail.groupOrder;
  2746. if (groupOrder == null || groupOrder == 'null' || groupOrder == "") {
  2747. groupOrder = 1;
  2748. }
  2749. var orderNo = mzChargeDetail.orderNo;
  2750. orderAndGroupNoMap.put(orderNo, groupNo);
  2751. if (type != 0 && !isInArray(code + "_" + serial + "_" + groupOrder + "_" + orderNo, xyArrays)) {
  2752. continue;
  2753. }
  2754. var lastGroupOrder = parseInt($("#groupId > option:last").val());
  2755. while (lastGroupOrder < groupOrder) {
  2756. appendGroupOrder();
  2757. lastGroupOrder = parseInt($("#groupId > option:last").val());
  2758. }
  2759. //appendGroupOrder()
  2760. $("#groupId").selectpicker('val', groupOrder);
  2761. $('#groupId').selectpicker('refresh');
  2762. //模板和历史轨迹回调的时候,如果前一个处方不满5个,就将后面的处方的药品添加到上一个处方中,但如果同一组药不能全部添加到上一个处方,就不会追加到该处方中
  2763. var orderNoLength = orderNoAndLengthMap.get(orderNo);
  2764. if (currentOrderNo == null) {
  2765. currentOrderNo = orderNo;
  2766. } else if (orderAndGroupNoMap.get(currentOrderNo) != orderAndGroupNoMap.get(orderNo)) {
  2767. var currentGroupNos = $("#xyTabContent").find("input.current_groupNo");
  2768. //查询还没有满5个的处方页
  2769. var tempOrderNo = null;
  2770. for (var k = 0; k < currentGroupNos.length; k++) {
  2771. if ($(currentGroupNos[k]).val() == groupNo) {
  2772. var next = $(currentGroupNos[k]).next();
  2773. if ($(next).children().length < 4) {
  2774. var parentId = $(currentGroupNos[k]).parent().attr("id");
  2775. tempOrderNo = tableIdAndOrderNoMap.get(parentId);
  2776. }
  2777. }
  2778. }
  2779. currentOrderNo = tempOrderNo;
  2780. } else if (currentOrderNo != orderNo && orderNoLength < 5) {
  2781. var currentOrderNoLength = orderNoAndLengthMap.get(currentOrderNo);
  2782. var groupOrderLength = groupOrderAndLengthMap.get(groupOrder);
  2783. if (groupOrderLength + currentOrderNoLength <= 5) {
  2784. currentOrderNoLength = currentOrderNoLength + 1;
  2785. orderNoLength = orderNoLength - 1;
  2786. groupOrderLength = groupOrderLength - 1;
  2787. orderNoAndLengthMap.put(currentOrderNo, currentOrderNoLength);
  2788. orderNoAndLengthMap.put(orderNo, orderNoLength);
  2789. groupOrderAndLengthMap.put(groupOrder, groupOrderLength);
  2790. orderNo = currentOrderNo;
  2791. if (currentOrderNoLength == 5) {
  2792. var currentGroupNos = $("#xyTabContent").find("input.current_groupNo");
  2793. //查询还没有满5个的处方页,
  2794. var tempOrderNo = null;
  2795. for (var k = 0; k < currentGroupNos.length; k++) {
  2796. if ($(currentGroupNos[k]).val() == groupNo) {
  2797. var next = $(currentGroupNos[k]).next();
  2798. //这里判断是4,是因为已经把组号设置了,所以要减去1
  2799. if ($(next).children().length < 4) {
  2800. var parentId = $(currentGroupNos[k]).parent().attr("id");
  2801. tempOrderNo = tableIdAndOrderNoMap.get(parentId);
  2802. }
  2803. }
  2804. }
  2805. currentOrderNo = tempOrderNo;
  2806. }
  2807. } else {
  2808. currentOrderNo = orderNo;
  2809. }
  2810. }
  2811. checkYpInfo(code, serial, groupNo, false, orderNo);
  2812. // 给药方式 同组药品给药方式相同
  2813. $("#supplyType").selectpicker('val', mzChargeDetail.supplyCode);
  2814. $('#supplyType').selectpicker('refresh');
  2815. $("#drugWin").val(mzChargeDetail.drugQuan);
  2816. $("#drugWinUnit").selectpicker('val', mzChargeDetail.drugUnit);
  2817. $('#drugWinUnit').selectpicker('refresh');
  2818. //天数 同组药品天数相同
  2819. $("#dayNum").selectpicker('val', mzChargeDetail.orderDays);
  2820. $('#dayNum').selectpicker('refresh');
  2821. //频次编码 同组药品频次编码相同
  2822. $("#orderFrequency").selectpicker('val', mzChargeDetail.frequency);
  2823. $('#orderFrequency').selectpicker('refresh');
  2824. if (mzChargeDetail.tryFlag == 1 || mzChargeDetail.tryFlag == "1") {
  2825. $("#tryResult").selectpicker('val', 100);
  2826. $('#tryResult').selectpicker('refresh');
  2827. } else if (mzChargeDetail.tryResult != null && mzChargeDetail.tryResult != "null" && mzChargeDetail.tryResult != "") {
  2828. $("#tryResult").selectpicker('val', mzChargeDetail.tryResult);
  2829. $('#tryResult').selectpicker('refresh');
  2830. }
  2831. $("#gross").val(mzChargeDetail.quantity);
  2832. $("#totalRetprice").val(Multiply(mzChargeDetail.quantity, $("#packRetprice").val()).toFixed(2));
  2833. $("#medicalAdvice").selectpicker('val', mzChargeDetail.instructionCode);
  2834. $('#medicalAdvice').selectpicker('refresh');
  2835. saveWesternMedicineWithCheck(false, orderNo);
  2836. $("#western_medicine_button").click();
  2837. $("#xyTab").find("li:eq(0) a").off("click").click();
  2838. } else {
  2839. if (type != 0 && !isInArray(code + "_" + serial, zyArrays)) {
  2840. continue;
  2841. }
  2842. //中药与颗粒剂
  2843. checkZyInfo(code, serial, false);
  2844. //类型
  2845. $("#zyClassType").selectpicker('val', groupNo);
  2846. $('#zyClassType').selectpicker('refresh');
  2847. $("#zy_drugWin").val(mzChargeDetail.quantity);
  2848. $("#zyInstruction").selectpicker('val', mzChargeDetail.instructionCode);
  2849. $('#zyInstruction').selectpicker('refresh');
  2850. saveChineseMedicine(false);
  2851. if (!hadSetZyFullParams) {
  2852. hadSetZyFullParams = true;
  2853. $("input.zyfs").val(mzChargeDetail.drugWin);
  2854. // $("#zy_orderFrequency_1").selectpicker('val', mzChargeDetail.frequency);
  2855. // $('#zy_orderFrequency_1').selectpicker('refresh');
  2856. $("#useType_1").selectpicker('val', mzChargeDetail.cyFysm);
  2857. $('#useType_1').selectpicker('refresh');
  2858. $("#cyJssm").selectpicker('val', mzChargeDetail.cyJssm);
  2859. $('#cyJssm').selectpicker('refresh');
  2860. $("#cyJsl").val(mzChargeDetail.cyJsl);
  2861. $("#cyZql").val(mzChargeDetail.cyZql);
  2862. $("#cyFj").val(mzChargeDetail.cyFj);
  2863. $("#cyFfcs").val(mzChargeDetail.cyFfcs);
  2864. $("#cyMtjs").val(mzChargeDetail.cyMtjs);
  2865. $("#zy_supplyType_1").selectpicker('val', mzChargeDetail.cyDj);
  2866. $('#zy_supplyType_1').selectpicker('refresh');
  2867. }
  2868. $("#chinese_medicine_button").click();
  2869. }
  2870. }
  2871. }
  2872. //检验与检查
  2873. var mzYjReqList = jsonData.mzYjReqList;
  2874. if (mzYjReqList != null && mzYjReqList.length > 0) {
  2875. for (var i = 0; i < mzYjReqList.length; i++) {
  2876. var mzYjReq = mzYjReqList[i];
  2877. var code = mzYjReq.orderCode;
  2878. if (type != 0 && !isInArray(code, jcjyArrays)) {
  2879. continue;
  2880. }
  2881. var jcJyZltype = null;
  2882. if (mzYjReq.reqType == 2) {
  2883. jcJyZltype = 1;
  2884. $("#jyZdSample").selectpicker('val', mzYjReq.inspectStuff);
  2885. $('#jyZdSample').selectpicker('refresh');
  2886. } else if (mzYjReq.reqType == 3) {
  2887. jcJyZltype = 2;
  2888. $("#yshPart").selectpicker('val', mzYjReq.inspectPart);
  2889. $('#yshPart').selectpicker('refresh');
  2890. }
  2891. $("#jcJyZltype").val(jcJyZltype);
  2892. checkJcJyItemInfo(code, null, jcJyZltype, false);
  2893. $("#remark").val(mzYjReq.jyRemark);
  2894. if (mzYjReq.execDept != null && mzYjReq.execDept != "") {
  2895. $("#execUnit").selectpicker('val', mzYjReq.execDept);
  2896. $('#execUnit').selectpicker('refresh');
  2897. }
  2898. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  2899. saveJyJcItem(false);
  2900. $("#jcJyItemChargeDetail").removeClass("in").addClass("hide");
  2901. }
  2902. $("#yj_req_button").click();
  2903. }
  2904. //入院证
  2905. if (zyReqCallBack && mzZyReq != null && mzZyReq.reqDept != null && mzZyReq.reqDept != "") {
  2906. $("#inpatientWardBeHospitalized").selectpicker('val', mzZyReq.reqDept);
  2907. $('#inpatientWardBeHospitalized').selectpicker('refresh');
  2908. initSmallDeptByDept();
  2909. $("#admissStatus").selectpicker('val', mzZyReq.admissStatus);
  2910. $('#admissStatus').selectpicker('refresh');
  2911. setTimeout(function () {
  2912. $("#smallWardBeHospitalized").selectpicker('val', mzZyReq.smallDept);
  2913. $('#smallWardBeHospitalized').selectpicker('refresh');
  2914. saveZyReq(false);
  2915. }, 500);
  2916. $("#zy_req_button").click();
  2917. }
  2918. setTimeout(function () {
  2919. //设置总金额 计算金额的时候,可能处方还没有回写完
  2920. calculateTotalAmount(false);
  2921. }, 1000);
  2922. //清空映射map
  2923. orderNoAndTableIdMap = null;
  2924. tableIdAndOrderNoMap = null;
  2925. }
  2926. /**
  2927. * 根据勾选内容设置选中集合
  2928. * @param id 区域id
  2929. * @param arrays 集合
  2930. * @param groupOrderAndLengthMap 组号与同组药数量的map
  2931. * @param orderNoAndLengthMap 处方号与同处方号药数量的map
  2932. */
  2933. function setCallBackArrays(id, arrays, groupOrderAndLengthMap, orderNoAndLengthMap) {
  2934. var contents = $("#" + id).children();
  2935. if (contents == null || contents.length == 0) {
  2936. return;
  2937. }
  2938. $(contents).each(function (index, obj) {
  2939. var checked = $(obj).find("input").prop("checked");
  2940. var data_id = $(obj).attr("data-id");
  2941. if (checked && data_id != undefined && data_id != null && data_id != "null" && data_id != "") {
  2942. arrays[arrays.length] = data_id;
  2943. var dataArr = null;
  2944. //设置组号与同组药品数量关系
  2945. if (groupOrderAndLengthMap != null) {
  2946. dataArr = data_id.split("_");
  2947. if (dataArr != null && dataArr.length >= 3) {
  2948. var groupOrder = Number(dataArr[2]);
  2949. var length = groupOrderAndLengthMap.get(groupOrder);
  2950. if (length == null || length == "") {
  2951. length = 0;
  2952. }
  2953. length++;
  2954. groupOrderAndLengthMap.put(groupOrder, length);
  2955. }
  2956. }
  2957. //设置处方号与同处方号药品数量关系
  2958. if (orderNoAndLengthMap != null) {
  2959. if (dataArr == null) {
  2960. dataArr = data_id.split("_");
  2961. }
  2962. if (dataArr != null && dataArr.length >= 4) {
  2963. var orderNo = Number(dataArr[3]);
  2964. var length = orderNoAndLengthMap.get(orderNo);
  2965. if (length == null || length == "") {
  2966. length = 0;
  2967. }
  2968. length++;
  2969. orderNoAndLengthMap.put(orderNo, length);
  2970. }
  2971. }
  2972. }
  2973. });
  2974. }
  2975. /**
  2976. * 调用医疗范文
  2977. */
  2978. function callTemplate() {
  2979. clearWorkSpaceExcludeUser(2);
  2980. $.ajax({
  2981. type: "GET",
  2982. url: '/thmz/increaseNumber?id=' + $("#idTemplate").val(),
  2983. contentType: "application/json;charset=UTF-8",
  2984. dataType: "json",
  2985. async: false,
  2986. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2987. success: function (res) {
  2988. if (res == '401' || res == 401) {
  2989. window.location.href = '/thmz/login/view'
  2990. return;
  2991. }
  2992. if (res.code == 0) {
  2993. var jsonData = JSON.parse(res.data.templateData);
  2994. editPrescription(jsonData, 1);
  2995. $("#templateId").val(res.data.id);
  2996. $("#templateName").val(res.data.name);
  2997. $("#templateKindType").selectpicker('val', res.data.templateKindType);
  2998. $("#templateKindType").selectpicker('refresh');
  2999. $("#templateType").selectpicker('val', res.data.templateType);
  3000. $("#templateType").selectpicker('refresh');
  3001. $('#operationType').selectpicker('val', 1);
  3002. $('#operationType').selectpicker('refresh');
  3003. $("#operationTypeDiv").removeClass("hide").addClass("in");
  3004. $("#medicalModelModal").modal("hide");
  3005. closePopover();
  3006. } else {
  3007. errorMesage(res);
  3008. }
  3009. }
  3010. });
  3011. }
  3012. /**
  3013. * 底层填充推荐方法
  3014. * @param paramsType
  3015. * @param appeal
  3016. * @param inputId
  3017. */
  3018. function extracted(paramsType, appeal, inputId) {
  3019. if (paramsType == 13) {
  3020. var contentArr = appeal.split(",");
  3021. if (contentArr != null && contentArr.length > 0) {
  3022. for (var i = 0; i < contentArr.length; i++) {
  3023. var content = contentArr[i].replace(")", "").replace("(", "-");
  3024. var diagnoseArr = content.split("-");
  3025. if (diagnoseArr == null || diagnoseArr.length == 0) {
  3026. continue;
  3027. }
  3028. fitDiagnoseValue(diagnoseArr[0], diagnoseArr[1]);
  3029. }
  3030. }
  3031. } else {
  3032. $("#" + inputId).val(appeal);
  3033. }
  3034. }
  3035. /**
  3036. * 填充推荐
  3037. * @param appeal
  3038. * @param paramsType
  3039. * @param id
  3040. */
  3041. function fitAppeal(appeal, paramsType, id) {
  3042. var inputId = "symptom";
  3043. var text = "主诉项已经录入,是否覆盖?";
  3044. if (paramsType == 5) {
  3045. inputId = "emrHpi";
  3046. text = "现病史项已经录入,是否覆盖?";
  3047. } else if (paramsType == 6) {
  3048. inputId = "emrPs";
  3049. text = "既往史项已经录入,是否覆盖?";
  3050. } else if (paramsType == 13) {
  3051. inputId = "diagnoseValue";
  3052. text = "诊断项已经录入,是否覆盖?";
  3053. }
  3054. var symptom = $("#" + inputId).val();
  3055. if (paramsType == 13 && (symptom == ",," || symptom == ",")) {
  3056. symptom = null;
  3057. }
  3058. if (symptom != null && symptom != "") {
  3059. $("#messageModal").modal();
  3060. $("#messageContent").html(text);
  3061. $("#messageButton").off("click").on("click", function (t) {
  3062. $("#messageModal").modal("hide");
  3063. if (paramsType == 13) {
  3064. $("#" + inputId).val(null);
  3065. $("#diagnoseTags").html(null);
  3066. }
  3067. extracted(paramsType, appeal, inputId);
  3068. });
  3069. $("#cancelButton").off("click");
  3070. } else {
  3071. extracted(paramsType, appeal, inputId);
  3072. }
  3073. $.ajax({
  3074. type: "GET",
  3075. url: '/thmz/increaseTcCommonParamsNumber?id=' + id,
  3076. contentType: "application/json;charset=UTF-8",
  3077. dataType: "json",
  3078. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3079. success: function (res) {
  3080. }
  3081. });
  3082. }
  3083. /**
  3084. * 初始嘱托下拉选
  3085. */
  3086. function initInstructionSelect() {
  3087. //西药医嘱
  3088. $.ajax({
  3089. type: "GET",
  3090. url: '/thmz/getMzZdInstructionByType?instructionType=0',
  3091. contentType: "application/json;charset=UTF-8",
  3092. dataType: "json",
  3093. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3094. success: function (res) {
  3095. if (res == '401' || res == 401) {
  3096. window.location.href = '/thmz/login/view'
  3097. return;
  3098. }
  3099. if (res.code == 0) {
  3100. res.data.forEach(function (item, index) {
  3101. var html = '<option value="' + item.code + '">' + item.instructionText + '</option>';
  3102. $('#medicalAdvice').append(html);
  3103. });
  3104. $('#medicalAdvice').selectpicker('refresh');
  3105. } else {
  3106. errorMesage(res);
  3107. }
  3108. }
  3109. });
  3110. //中药医嘱
  3111. $.ajax({
  3112. type: "GET",
  3113. url: '/thmz/getMzZdInstructionByType?instructionType=1',
  3114. contentType: "application/json;charset=UTF-8",
  3115. dataType: "json",
  3116. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3117. success: function (res) {
  3118. if (res == '401' || res == 401) {
  3119. window.location.href = '/thmz/login/view'
  3120. return;
  3121. }
  3122. if (res.code == 0) {
  3123. res.data.forEach(function (item, index) {
  3124. var html = '<option value="' + item.code + '">' + item.instructionText.trim() + '</option>';
  3125. $('#zyInstruction').append(html);
  3126. });
  3127. $('#zyInstruction').selectpicker('refresh');
  3128. } else {
  3129. errorMesage(res);
  3130. }
  3131. }
  3132. });
  3133. }
  3134. /**
  3135. * 设置下拉选的尺寸
  3136. */
  3137. function setSelectSize() {
  3138. $(".selectpicker").selectpicker({
  3139. dropuAuto: false,
  3140. size: 10
  3141. });
  3142. //select 从后台加载数据,并保留之前选择的内容
  3143. dynamicSelectWithOri("editZd", '/thmz/getAllZdIcdCommonParams?commonParams=');
  3144. }
  3145. /**
  3146. * 初始化性别下拉选
  3147. */
  3148. function initGenderSelect() {
  3149. var gender = '<option value="1">男</option><option value="2">女</option><option value="0">未知</option>';
  3150. $('#rapidAcceptsUserGender').html(gender);
  3151. $('#rapidAcceptsUserGender').selectpicker('refresh');
  3152. $('#editUserGender').html(gender);
  3153. $('#editUserGender').selectpicker('refresh');
  3154. //医疗范文状态
  3155. var templateStatus = '<option value="0">启用</option><option value="1">停用</option>';
  3156. $('#templateStatus').html(templateStatus);
  3157. $('#templateStatus').selectpicker('refresh');
  3158. //医疗范文操作类型
  3159. var operationType = '<option value="0">新增</option><option value="1">修改</option>';
  3160. $('#operationType').html(operationType);
  3161. $('#operationType').selectpicker('refresh');
  3162. }
  3163. /**
  3164. * 初始化中药类型下拉选
  3165. */
  3166. function initZyClassTypeSelect() {
  3167. var gender = '<option value="81">普通</option><option value="82">颗粒剂</option>';
  3168. $('#zyClassType').html(gender);
  3169. $('#zyClassType').selectpicker('refresh');
  3170. //$('#zyClassType').selectpicker('val', "81");
  3171. // $('#zyClassType').selectpicker('refresh');
  3172. }
  3173. /**
  3174. * 初始化皮试结果下拉选
  3175. * @param categoriesFlag 0 口服 2 注射针剂
  3176. */
  3177. function initTryResultSelect(categoriesFlag) {
  3178. var tryResult = '';
  3179. if (categoriesFlag == 2 || categoriesFlag == "2") {
  3180. tryResult += '<option value="100">皮试</option>';
  3181. }
  3182. tryResult += '<option value="0">阴性</option><option value="3">免试</option>';
  3183. //var tryResult = '<option value="100">皮试</option><option value="0">阴性</option><option value="3">免试</option>';
  3184. $('#tryResult').html(tryResult);
  3185. $('#tryResult').selectpicker('refresh');
  3186. //口服药选择皮试结果
  3187. $("#tryResult").parent().parent().parent().removeClass("hide").addClass("in");
  3188. }
  3189. /**
  3190. * 初始化病人身份类别下拉选
  3191. */
  3192. function initResponceTypeSelect() {
  3193. $.ajax({
  3194. type: "GET",
  3195. url: '/thmz/getMzResponceType',
  3196. contentType: "application/json;charset=UTF-8",
  3197. dataType: "json",
  3198. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3199. success: function (res) {
  3200. if (res == '401' || res == 401) {
  3201. window.location.href = '/thmz/login/view'
  3202. return;
  3203. }
  3204. if (res.code == 0) {
  3205. res.data.forEach(function (item, index) {
  3206. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  3207. $('#patientsNature').append(html);
  3208. $('#editUserPatientsNature').append(html);
  3209. // $('#responeTypeBeHospitalized').append(html);
  3210. });
  3211. $('#patientsNature').selectpicker('refresh');
  3212. $('#editUserPatientsNature').selectpicker('refresh');
  3213. } else {
  3214. errorMesage(res);
  3215. }
  3216. }
  3217. });
  3218. }
  3219. /**
  3220. * 所有的入院状态
  3221. */
  3222. function iniAdmissStatus() {
  3223. $.ajax({
  3224. type: "GET",
  3225. url: '/thmz/getAdmissStatus',
  3226. dataType: "json",
  3227. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3228. success: function (res) {
  3229. if (res == '401' || res == 401) {
  3230. window.location.href = '/thmz/login/view'
  3231. return;
  3232. }
  3233. var html = '';
  3234. $.each(res.data, function (commentIndex, comment) {
  3235. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  3236. });
  3237. $('#admissStatus').empty();
  3238. $('#admissStatus').html(html);
  3239. $('#admissStatus').selectpicker('destroy').selectpicker('refresh');
  3240. }
  3241. });
  3242. }
  3243. /**
  3244. * 入院登记的病区列表
  3245. */
  3246. function initListDeptSelect() {
  3247. //科室列表
  3248. $.ajax({
  3249. type: "GET",
  3250. url: '/thmz/allInpatientWard',
  3251. dataType: "json",
  3252. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3253. success: function (data) {
  3254. if (data == '401' || data == 401) {
  3255. window.location.href = '/thmz/login/view'
  3256. return;
  3257. }
  3258. var html = '';
  3259. $.each(data.data, function (commentIndex, comment) {
  3260. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';
  3261. });
  3262. $('#inpatientWardBeHospitalized').empty();
  3263. $('#inpatientWardBeHospitalized').html(html);
  3264. $('#inpatientWardBeHospitalized').selectpicker('refresh');
  3265. initSmallDeptByDept();
  3266. }
  3267. });
  3268. }
  3269. /**
  3270. * 小科室列表
  3271. */
  3272. function initSmallDeptByDept() {
  3273. let code = escape($('#inpatientWardBeHospitalized').val()).replace(/\+/g, '%2B');
  3274. //小科室列表
  3275. $.ajax({
  3276. type: "GET",
  3277. url: '/thmz/getSmallDeptByDept?code=' + code,
  3278. dataType: "json",
  3279. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3280. success: function (res) {
  3281. if (res == '401' || res == 401) {
  3282. window.location.href = '/thmz/login/view'
  3283. return;
  3284. }
  3285. var html = '';
  3286. $.each(res.data, function (commentIndex, comment) {
  3287. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  3288. });
  3289. $('#smallWardBeHospitalized').empty();
  3290. $('#smallWardBeHospitalized').html(html);
  3291. $('#smallWardBeHospitalized').selectpicker('destroy').selectpicker('refresh');
  3292. }
  3293. });
  3294. //病床数
  3295. $.ajax({
  3296. type: "GET",
  3297. url: '/thmz/getBedStatusNumByDept?code=' + code,
  3298. dataType: "json",
  3299. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3300. success: function (res) {
  3301. if (res == '401' || res == 401) {
  3302. window.location.href = '/thmz/login/view'
  3303. return;
  3304. }
  3305. if (res.code == 0) {
  3306. var data = res.data;
  3307. if (data == null) {
  3308. $("#totalBedNum").val(0);
  3309. $("#freeBedNum").val(0);
  3310. $("#occupationBedNum").val(0);
  3311. } else {
  3312. $("#totalBedNum").val(data.total);
  3313. $("#freeBedNum").val(data.free);
  3314. $("#occupationBedNum").val(data.occupation);
  3315. }
  3316. } else {
  3317. errorMesage(res);
  3318. }
  3319. }
  3320. });
  3321. }
  3322. /**
  3323. * 初始化门诊统筹下拉选
  3324. */
  3325. function initMztcSelect() {
  3326. var selectHtml = '<option value="0">否</option><option value="1">是</option>';
  3327. $('#zgmztczf').html(selectHtml);
  3328. $('#zgmztczf').selectpicker('refresh');
  3329. $('#grzhzf').html(selectHtml);
  3330. $('#grzhzf').selectpicker('refresh');
  3331. }
  3332. /**
  3333. * 初始化医疗范文范围下拉选
  3334. * @param templateTypeId
  3335. */
  3336. function initTemplateTypeSelect(templateTypeId) {
  3337. $.ajax({
  3338. type: "GET",
  3339. url: '/thmz/getTemplateTypes',
  3340. contentType: "application/json;charset=UTF-8",
  3341. dataType: "json",
  3342. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3343. success: function (res) {
  3344. if (res == '401' || res == 401) {
  3345. window.location.href = '/thmz/login/view'
  3346. return;
  3347. }
  3348. if (res.code == 0) {
  3349. res.data.forEach(function (item) {
  3350. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  3351. $('#' + templateTypeId).append(html);
  3352. });
  3353. $('#' + templateTypeId).selectpicker('refresh');
  3354. // $('#'+templateTypeId).selectpicker('val', "0");
  3355. // $('#'+templateTypeId).selectpicker('refresh');
  3356. } else {
  3357. errorMesage(res);
  3358. }
  3359. }
  3360. });
  3361. }
  3362. /**
  3363. * 初始化医疗范文类型下拉选
  3364. * @param templateKindTypeId
  3365. */
  3366. function initTemplateKindTypeSelect(templateKindTypeId) {
  3367. $.ajax({
  3368. type: "GET",
  3369. url: '/thmz/getTemplateKindTypes',
  3370. contentType: "application/json;charset=UTF-8",
  3371. dataType: "json",
  3372. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3373. success: function (res) {
  3374. if (res == '401' || res == 401) {
  3375. window.location.href = '/thmz/login/view'
  3376. return;
  3377. }
  3378. if (res.code == 0) {
  3379. res.data.forEach(function (item) {
  3380. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  3381. $('#' + templateKindTypeId).append(html);
  3382. });
  3383. $('#' + templateKindTypeId).selectpicker('refresh');
  3384. } else {
  3385. errorMesage(res);
  3386. }
  3387. }
  3388. });
  3389. }
  3390. /**
  3391. * 初始频次下拉选
  3392. * @param id
  3393. * @param async 是否是异步 true 异步 false 同步
  3394. */
  3395. function initOrderFrequencys(id, async) {
  3396. $.ajax({
  3397. type: "GET",
  3398. url: '/thmz/getXyOrderFrequencys',
  3399. dataType: "json",
  3400. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3401. async: async,
  3402. success: function (res) {
  3403. if (res == '401' || res == 401) {
  3404. window.location.href = '/thmz/login/view'
  3405. return;
  3406. }
  3407. var html = '';
  3408. $.each(res.data, function (commentIndex, comment) {
  3409. html += '<option value="' + comment.code + '" desc="' + comment.times + '">' + comment.name + '(' + comment.code + ')' + '</option>';
  3410. });
  3411. $('#' + id).empty();
  3412. $('#' + id).html(html);
  3413. $('#' + id).selectpicker('refresh');
  3414. }
  3415. });
  3416. }
  3417. /**
  3418. * 初始中药频次下拉选
  3419. * @param id
  3420. * @param async 是否是异步 true 异步 false 同步
  3421. */
  3422. function initZyOrderFrequencys(id, async) {
  3423. $.ajax({
  3424. type: "GET",
  3425. url: '/thmz/getZyOrderFrequencys',
  3426. dataType: "json",
  3427. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3428. async: async,
  3429. success: function (res) {
  3430. if (res == '401' || res == 401) {
  3431. window.location.href = '/thmz/login/view'
  3432. return;
  3433. }
  3434. var html = '';
  3435. $.each(res.data, function (commentIndex, comment) {
  3436. html += '<option value="' + comment.code + '" desc="' + comment.times + '">' + comment.name + '(' + comment.code + ')' + '</option>';
  3437. });
  3438. $('#' + id).empty();
  3439. $('#' + id).html(html);
  3440. $('#' + id).selectpicker('refresh');
  3441. }
  3442. });
  3443. }
  3444. /**
  3445. * 初始中药服用说明
  3446. */
  3447. function initAllMzYshZdFysm() {
  3448. $.ajax({
  3449. type: "GET",
  3450. url: '/thmz/getAllMzYshZdFysm',
  3451. dataType: "json",
  3452. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3453. async: false,
  3454. success: function (res) {
  3455. if (res == '401' || res == 401) {
  3456. window.location.href = '/thmz/login/view'
  3457. return;
  3458. }
  3459. var html = '';
  3460. $.each(res.data, function (commentIndex, comment) {
  3461. if (comment.name.indexOf(",") < 0) {
  3462. //过滤组合的用法
  3463. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  3464. }
  3465. });
  3466. $('.useType').empty();
  3467. $('.useType').html(html);
  3468. $('.useType').selectpicker('refresh');
  3469. $('.useType').selectpicker('val', "2");
  3470. $('.useType').selectpicker('refresh');
  3471. }
  3472. });
  3473. }
  3474. /**
  3475. * 初始用药方式下拉选
  3476. */
  3477. function initSupplyTypes() {
  3478. $.ajax({
  3479. type: "GET",
  3480. url: '/thmz/getSupplyTypes',
  3481. dataType: "json",
  3482. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3483. success: function (res) {
  3484. if (res == '401' || res == 401) {
  3485. window.location.href = '/thmz/login/view'
  3486. return;
  3487. }
  3488. var html = '';
  3489. $.each(res.data, function (commentIndex, comment) {
  3490. if (comment.supplyOcc === "71") {
  3491. html += '<option value="' + comment.supplyCode + '">' + comment.supplyName + '[' + comment.pyCode + ']' + '</option>';
  3492. }
  3493. });
  3494. $('#supplyType').empty();
  3495. $('#supplyType').html(html);
  3496. $('#supplyType').selectpicker('refresh');
  3497. }
  3498. });
  3499. }
  3500. /**
  3501. * 初始煎药方式下拉选
  3502. * @param async 是否是异步 true 异步 false 同步
  3503. */
  3504. function initZySupplyTypes(id, async) {
  3505. setSelectSize();
  3506. $.ajax({
  3507. type: "GET",
  3508. url: '/thmz/getSupplyTypes',
  3509. dataType: "json",
  3510. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3511. async: async,
  3512. success: function (res) {
  3513. if (res == '401' || res == 401) {
  3514. window.location.href = '/thmz/login/view'
  3515. return;
  3516. }
  3517. var html = '';
  3518. $.each(res.data, function (commentIndex, comment) {
  3519. if (comment.supplyOcc === "81") {
  3520. // html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  3521. html += '<option value="' + comment.supplyCode + '">' + comment.supplyName + '[' + comment.pyCode + ']' + '</option>';
  3522. }
  3523. });
  3524. $('#' + id).empty();
  3525. $('#' + id).html(html);
  3526. $('#' + id).selectpicker('refresh');
  3527. }
  3528. });
  3529. }
  3530. /**
  3531. * 初始查检查部位
  3532. */
  3533. function initYshPart() {
  3534. setSelectSize();
  3535. $.ajax({
  3536. type: "GET",
  3537. url: '/thmz/getYshPart',
  3538. dataType: "json",
  3539. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3540. success: function (res) {
  3541. if (res == '401' || res == 401) {
  3542. window.location.href = '/thmz/login/view'
  3543. return;
  3544. }
  3545. var html = '';
  3546. $.each(res.data, function (commentIndex, comment) {
  3547. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')' + '</option>';
  3548. });
  3549. $('#yshPart').empty();
  3550. $('#yshPart').html(html);
  3551. $('#yshPart').selectpicker('refresh');
  3552. }
  3553. });
  3554. }
  3555. /**
  3556. * 初始化验物下拉选
  3557. */
  3558. function initJyZdSample() {
  3559. setSelectSize();
  3560. $.ajax({
  3561. type: "GET",
  3562. url: '/thmz/getJyZdSample',
  3563. dataType: "json",
  3564. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3565. success: function (res) {
  3566. if (res == '401' || res == 401) {
  3567. window.location.href = '/thmz/login/view'
  3568. return;
  3569. }
  3570. var html = '';
  3571. $.each(res.data, function (commentIndex, comment) {
  3572. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')' + '</option>';
  3573. });
  3574. $('#jyZdSample').empty();
  3575. $('#jyZdSample').html(html);
  3576. $('#jyZdSample').selectpicker('refresh');
  3577. }
  3578. });
  3579. }
  3580. /**
  3581. * 保存当前药品到右边处方区域
  3582. * @param index 0 西药 1中药 2 诊疗和社备
  3583. */
  3584. function saveMedicine(index) {
  3585. if (index == 0) {
  3586. saveWesternMedicineWithCheck(true, null);
  3587. } else if (index == 1) {
  3588. saveChineseMedicine(true);
  3589. }
  3590. }
  3591. /**
  3592. * 保存当前药品到右边处方区域 西药
  3593. * calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  3594. * orderNoParmams
  3595. */
  3596. function saveWesternMedicineWithCheck(calculateTotalAmountFlag, orderNoParmams) {
  3597. //是新增药品还是编辑 true 修改 默认false
  3598. var updateFlag = $("#western_medicine_update_flag").val();
  3599. if (updateFlag == "true" || updateFlag == true) {
  3600. saveWesternMedicine(calculateTotalAmountFlag);
  3601. }else {
  3602. //当前药房编码
  3603. var currentGroupNo = $("#current_groupNo").val();
  3604. if ($("#xyTab").find("li") == null || $("#xyTab").find("li").length == 0) {
  3605. initNavTabs(0, currentGroupNo, orderNoParmams);
  3606. }
  3607. var tableId = $("#xyTab li.active").find("a").attr("href");
  3608. var childrens = $(tableId).find("div:eq(0)").children().length;
  3609. var thisGroupNo = $(tableId).find("input.current_groupNo").val();
  3610. var flag = childrens === 5;
  3611. if (!calculateTotalAmountFlag) {
  3612. flag = childrens === 5 && $(tableId).is(':last-child');
  3613. }
  3614. if (thisGroupNo != null && thisGroupNo != '' && currentGroupNo != thisGroupNo) {
  3615. //当前编辑的处方与选中的品类非同一处方能保存的
  3616. var currentGroupNos = $("#xyTabContent").find("input.current_groupNo");
  3617. //是否需要新增处方页,以保存医材处方
  3618. var needAddTable = true;
  3619. for (var i = 0; i < currentGroupNos.length; i++) {
  3620. if ($(currentGroupNos[i]).val() == currentGroupNo) {
  3621. var next = $(currentGroupNos[i]).next();
  3622. if (needAddTable && $(next).children().length < 5) {
  3623. var parentId = $(currentGroupNos[i]).parent().attr("id");
  3624. //切换处方
  3625. $("#xyTab").find("a[href='#" + parentId + "']").off("click").tab('show');
  3626. //$("#xyTab").find("a[href='#" + tableId + "']").off("click").click();
  3627. //因为存在没有满5个的处方页,直接保存到该页
  3628. needAddTable = false;
  3629. }
  3630. }
  3631. }
  3632. if (needAddTable) {
  3633. //91 医材
  3634. var message = "医材需要单独处方,是否需要新增医材处方?";
  3635. if (currentGroupNo == '71') {
  3636. message = "普通西成药需要单独处方,是否需要新增处方?"
  3637. } else if (currentGroupNo == '111') {
  3638. message = "麻、精一药物需要单独处方,是否需要新增处方?"
  3639. } else if (currentGroupNo == '131') {
  3640. message = "精二药物需要单独处方,是否需要新增处方?"
  3641. }
  3642. if (calculateTotalAmountFlag) {
  3643. $("#messageModal").modal();
  3644. $("#messageContent").html(message);
  3645. $("#messageButton").off("click").on("click", function (t) {
  3646. $("#messageModal").modal("hide");
  3647. refreshNavTabs(0, currentGroupNo, orderNoParmams);
  3648. saveWesternMedicine(calculateTotalAmountFlag);
  3649. });
  3650. $("#cancelButton").off("click").on("click", function (t) {
  3651. return;
  3652. });
  3653. }
  3654. }
  3655. } else if (flag) {
  3656. if (calculateTotalAmountFlag) {
  3657. $("#messageModal").modal();
  3658. $("#messageContent").html("单张处方最多只能开具5个药品,是否需要新增处方?");
  3659. $("#messageButton").off("click").on("click", function (t) {
  3660. $("#messageModal").modal("hide");
  3661. refreshNavTabs(0, currentGroupNo, orderNoParmams);
  3662. saveWesternMedicine(calculateTotalAmountFlag);
  3663. });
  3664. $("#cancelButton").off("click").on("click", function (t) {
  3665. return;
  3666. });
  3667. }
  3668. } else {
  3669. saveWesternMedicine(calculateTotalAmountFlag);
  3670. }
  3671. }
  3672. }
  3673. /**
  3674. * 保存当前药品到右边处方区域 西药
  3675. * calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  3676. */
  3677. function saveWesternMedicine(calculateTotalAmountFlag) {
  3678. //当前药房编码
  3679. var currentGroupNo = $("#current_groupNo").val();
  3680. //药品名称
  3681. var westernMedicineNamme = $("#western_medicine_name").val();
  3682. var tableId = $("#xyTab li.active").find("a").attr("href");
  3683. if(tableId==undefined){
  3684. refreshNavTabs(0, currentGroupNo, null);
  3685. tableId = $("#xyTab li.active").find("a").attr("href");
  3686. }
  3687. var thisGroupNo = $(tableId).find("input.current_groupNo").val();
  3688. if(currentGroupNo!=thisGroupNo){
  3689. //91 医材
  3690. var type="医材";
  3691. if (currentGroupNo == '71') {
  3692. type = "普通西成药"
  3693. } else if (currentGroupNo == '111') {
  3694. type = "麻、精一药物"
  3695. } else if (currentGroupNo == '131') {
  3696. type = "精二药物"
  3697. }
  3698. errorMesageSimaple("【"+westernMedicineNamme+"】是"+type+",无法保存到当前处方,请切换或者新增相应的处方进行保存。");
  3699. return;
  3700. }
  3701. //当前处方选项卡下标
  3702. var xyTabIndex = $("#xyTab li.active").index();
  3703. //组号
  3704. var groupId = $("#groupId").val();
  3705. if (gropuIdAndOrderNoMap == null) {
  3706. gropuIdAndOrderNoMap = new Map();
  3707. }
  3708. var exitIndex = gropuIdAndOrderNoMap.get(groupId);
  3709. if (exitIndex == null) {
  3710. exitIndex = xyTabIndex;
  3711. gropuIdAndOrderNoMap.put(groupId, xyTabIndex);
  3712. }
  3713. if (xyTabIndex != exitIndex) {
  3714. var westernMedicineUpdateFlag = $("#western_medicine_update_flag").val();
  3715. var westernMedicineOriGroupId = $("#western_medicine_ori_group_id").val();
  3716. //非修改组号的情况下就需要切换组号
  3717. if (!((westernMedicineUpdateFlag == true || westernMedicineUpdateFlag == "true") && westernMedicineOriGroupId != groupId)) {
  3718. groupId = parseInt($("#groupId > option:last").val());
  3719. $("#groupId").selectpicker('val', groupId);
  3720. $('#groupId').selectpicker('refresh');
  3721. gropuIdAndOrderNoMap.put(groupId, xyTabIndex);
  3722. appendGroupOrder();
  3723. }
  3724. warningMesageSimaple("同一组药必须出现在同一个处方中,当前组号已经被其他处方使用,系统已自动为您重新分配组号!");
  3725. //return;
  3726. }
  3727. //当前药品编码
  3728. var currentCode = $("#western_medicine_current_code").val();
  3729. //当前药品规格
  3730. var currentSerial = $("#western_medicine_current_serial").val();
  3731. //用法编码
  3732. var supplyType = $("#supplyType").val();
  3733. //用法描述
  3734. var supplyTypeText = $('#supplyType option:selected').text();
  3735. supplyTypeText = supplyTypeText.substring(0, supplyTypeText.indexOf("["));
  3736. //药品默认单次使用剂量
  3737. var drugWinDb = $("#drugWinDb").val();
  3738. //处方实际单次使用剂量
  3739. var drugWin = $("#drugWin").val();
  3740. //剂量单位
  3741. var drugWinUnit = $('#drugWinUnit option:selected').text();
  3742. //drugWinUnit = drugWinUnit.substring(0, drugWinUnit.indexOf("("));
  3743. //天数
  3744. var dayNum = $("#dayNum").val();
  3745. //频次编码
  3746. var orderFrequency = $("#orderFrequency").val();
  3747. //频次描述
  3748. var orderFrequencyText = $('#orderFrequency option:selected').text();
  3749. orderFrequencyText = orderFrequencyText.substring(0, orderFrequencyText.indexOf("("));
  3750. //总量
  3751. var gross = $("#gross").val();
  3752. //包装单位
  3753. var packUnit = $("#packUnit").val();
  3754. if (packUnit == null) {
  3755. packUnit = "";
  3756. }
  3757. //医嘱码
  3758. var medicalAdvice = $("#medicalAdvice").val();
  3759. //医嘱内容
  3760. var medicalAdviceText = $('#medicalAdvice option:selected').text();
  3761. medicalAdviceText = medicalAdviceText.substring(0, medicalAdviceText.indexOf("("));
  3762. //金额
  3763. var totalRetprice = parseFloat($("#totalRetprice").val());
  3764. //单价
  3765. var packRetprice = $("#packRetprice").val();
  3766. //皮试结果
  3767. var tryResult = $("#tryResult").val();
  3768. //药品大类标志
  3769. var categoriesFlag = $("#categoriesFlag").val();
  3770. if (currentCode == null || currentCode == '') {
  3771. errorMesageSimaple("未选择任何药品!");
  3772. return;
  3773. }
  3774. if (currentGroupNo != '91') {
  3775. if (supplyType == null || supplyType == "") {
  3776. errorMesageSimaple("用法为空!");
  3777. return;
  3778. }
  3779. if (drugWin == null || drugWin == "") {
  3780. errorMesageSimaple("剂量为空!");
  3781. return;
  3782. }
  3783. if (dayNum == null || dayNum == "") {
  3784. errorMesageSimaple("天数为空!");
  3785. return;
  3786. }
  3787. if (orderFrequency == null || orderFrequency == "") {
  3788. errorMesageSimaple("频次为空!");
  3789. return;
  3790. }
  3791. }
  3792. if (gross == null || gross == "") {
  3793. errorMesageSimaple("总量为空!");
  3794. return;
  3795. }
  3796. var manufactoryName = $("#manufactoryName").val();
  3797. var html = '<div class="form-group">';
  3798. html += groupId + '.<span style="margin-left: 5px"></span>';
  3799. html += westernMedicineNamme;
  3800. if (manufactoryName != null && manufactoryName != 'null' && manufactoryName != "") {
  3801. html += "(" + manufactoryName + ")"
  3802. }
  3803. html += '&nbsp;&nbsp;&nbsp;&nbsp;';
  3804. html += $("#specification").val();
  3805. html += '&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;';
  3806. //html += drugWinDb + drugWinUnit + ' 共';
  3807. html += gross + packUnit + " " + '<br/><span style="margin-left: 15px"></span>';
  3808. html += '用法:' + supplyTypeText + ' ';
  3809. html += drugWin + drugWinUnit + ' ';
  3810. html += '频次:' + orderFrequencyText + ' ';
  3811. html += dayNum + '天 ';
  3812. if (tryResult != null && tryResult != 'null' && tryResult != "") {
  3813. if (tryResult == "100" || tryResult == 100) {
  3814. html += '皮试 ';
  3815. } else {
  3816. html += '皮试结果: ' + $('#tryResult option:selected').text();
  3817. }
  3818. }
  3819. if (medicalAdvice != null && medicalAdvice != '') {
  3820. html += '医嘱:' + medicalAdviceText;
  3821. }
  3822. 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>';
  3823. 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>';
  3824. html += ' <i class="fa fa-long-arrow-left" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;" onclick="editWesternMedicine(this)"></i>';
  3825. 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>';
  3826. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  3827. html += '<input type="hidden" class="temporary_items_serial" value="' + currentSerial + '"/>';
  3828. html += '<input type="hidden" class="temporary_items_amount" value="' + totalRetprice + '"/>';
  3829. html += '<input type="hidden" class="temporary_items_groupId" value="' + groupId + '"/>';
  3830. html += '<input type="hidden" class="temporary_items_westernMedicineNamme" value="' + westernMedicineNamme + '"/>';
  3831. html += '<input type="hidden" class="temporary_items_drugWinDb" value="' + drugWinDb + '"/>';
  3832. html += '<input type="hidden" class="temporary_items_drugWin" value="' + drugWin + '"/>';
  3833. html += '<input type="hidden" class="temporary_items_drugWinUnit" value="' + $("#drugWinUnit").val() + '"/>';
  3834. html += '<input type="hidden" class="temporary_items_gross" value="' + gross + '"/>';
  3835. html += '<input type="hidden" class="temporary_items_packUnit" value="' + packUnit + '"/>';
  3836. html += '<input type="hidden" class="temporary_items_supplyType" value="' + supplyType + '"/>';
  3837. html += '<input type="hidden" class="temporary_items_orderFrequency" value="' + orderFrequency + '"/>';
  3838. html += '<input type="hidden" class="temporary_items_dayNum" value="' + dayNum + '"/>';
  3839. html += '<input type="hidden" class="temporary_items_medicalAdvice" value="' + medicalAdvice + '"/>';
  3840. html += '<input type="hidden" class="temporary_items_medicalAdviceText" value="' + medicalAdviceText + '"/>';
  3841. html += '<input type="hidden" class="temporary_items_packRetprice" value="' + packRetprice + '"/>';
  3842. html += '<input type="hidden" class="temporary_items_tryResult" value="' + tryResult + '"/>';
  3843. html += '<input type="hidden" class="temporary_items_currentGroupNo" value="' + currentGroupNo + '"/>';
  3844. html += '<input type="hidden" class="temporary_items_categoriesFlag" value="' + categoriesFlag + '"/>';
  3845. html += '</div>';
  3846. var tableId = $("#xyTab li.active").find("a").attr("href");
  3847. //是新增药品还是编辑 true 修改 默认false
  3848. var updateFlag = $("#western_medicine_update_flag").val();
  3849. if (updateFlag == undefined || updateFlag == null) {
  3850. updateFlag = false;
  3851. }
  3852. // //原药品金额 如果是修改则需要设置
  3853. // var temporaryItemsAmount = 0;
  3854. //当前需要被移除元素的下个兄弟节点
  3855. var nextObj = null;
  3856. //当前修改的药品是不是最后一个
  3857. var isLast = false;
  3858. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  3859. if (formGroups != null && formGroups.length > 0) {
  3860. //如果是修改,需要减去原来的费用
  3861. if (updateFlag == "true" || updateFlag == true) {
  3862. //药品有可能会修改,所以,判断的时候要用原药品编码
  3863. var updateOriCode = $("#update_ori_code").val();
  3864. //规格有可能会修改,所以,判断的时候要用原规格
  3865. var updateOriSerial = $("#update_ori_serial").val();
  3866. //组号有可能会修改,所以,判断的时候要用原组号
  3867. var westernMedicineOriGroupId = $("#western_medicine_ori_group_id").val();
  3868. for (var i = 0; i < formGroups.length; i++) {
  3869. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  3870. var temporaryItemsSerial = $(formGroups[i]).find("input.temporary_items_serial").val();
  3871. var temporaryItemsGroupId = $(formGroups[i]).find("input.temporary_items_groupId").val();
  3872. if (temporaryItemsCode === updateOriCode && temporaryItemsSerial === updateOriSerial && temporaryItemsGroupId == westernMedicineOriGroupId) {
  3873. //temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  3874. if (formGroups.length > 1) {
  3875. nextObj = $(formGroups[i]).next();
  3876. }
  3877. isLast = (i + 1) === formGroups.length;
  3878. $(formGroups[i]).remove();
  3879. break;
  3880. }
  3881. }
  3882. } else {
  3883. //因为药品可以换组号,要保证相同组号的在一起
  3884. for (var i = 0; i < formGroups.length; i++) {
  3885. var temporaryItemsGroupId = parseInt($(formGroups[i]).find("input.temporary_items_groupId").val());
  3886. //如果当前的组号小与遍历到的组号,说明是原组号的下一个兄弟节点,新的药品插入到兄弟节点前就可以了
  3887. if (temporaryItemsGroupId > groupId) {
  3888. nextObj = $(formGroups[i]);
  3889. break;
  3890. }
  3891. }
  3892. }
  3893. }
  3894. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  3895. if (nextObj == null || isLast) {
  3896. $(tableId).find("div:eq(0)").append(html);
  3897. } else {
  3898. $(nextObj).before(html);
  3899. }
  3900. //设置当前处方金额
  3901. //calculateCfAmount(tableId, totalRetprice, temporaryItemsAmount, 0, 0);
  3902. if (calculateTotalAmountFlag) {
  3903. //设置总金额
  3904. calculateTotalAmount(true);
  3905. resetGroupIdSelect()
  3906. }
  3907. //判断当前组号是不是最后一个,是最后一个组号,就需要新增组号
  3908. var groupIdLast = $("#groupId option:last-child").text();
  3909. if (groupId === groupIdLast) {
  3910. appendGroupOrder();
  3911. }
  3912. //设置药品的用法,频次,天数
  3913. var map = groupIdMap.get(groupId);
  3914. if (map == null) {
  3915. map = new Map();
  3916. map.put("supplyType", supplyType);
  3917. map.put("orderFrequency", orderFrequency);
  3918. map.put("dayNum", dayNum);
  3919. groupIdMap.put(groupId, map);
  3920. }
  3921. //设置当前药品的品类
  3922. $(tableId).find("input.current_groupNo").val($("#current_groupNo").val());
  3923. clearWesternMedicine(false);
  3924. resetGroupIdMap();
  3925. }
  3926. /**
  3927. * 上移
  3928. * @param obj
  3929. */
  3930. function arrowUp(obj) {
  3931. var parentObject = $(obj).parent();
  3932. if ($(parentObject).prev() == null) {
  3933. return;
  3934. }
  3935. //当前元素的序号
  3936. var thisJcjyItemGroupId = null;
  3937. //前一个兄弟节点的序号
  3938. var prevJcjyItemGroupId = null;
  3939. //当是项目时有序号,进行序号调整
  3940. if ($(parentObject).find("span.jcjyItemGroupId") != null) {
  3941. thisJcjyItemGroupId = $(parentObject).find("span.jcjyItemGroupId").html();
  3942. prevJcjyItemGroupId = $(parentObject).prev().find("span.jcjyItemGroupId").html();
  3943. $(parentObject).find("span.jcjyItemGroupId").html(prevJcjyItemGroupId);
  3944. $(parentObject).prev().find("span.jcjyItemGroupId").html(thisJcjyItemGroupId);
  3945. }
  3946. $(parentObject).prev().before($(parentObject));
  3947. }
  3948. /**
  3949. * 下移
  3950. * @param obj
  3951. */
  3952. function arrowDown(obj) {
  3953. var parentObject = $(obj).parent();
  3954. if ($(parentObject).next() == null) {
  3955. return;
  3956. }
  3957. //当前元素的序号
  3958. var thisJcjyItemGroupId = null;
  3959. //后一个兄弟节点的序号
  3960. var afterJcjyItemGroupId = null;
  3961. //当是项目时有序号,进行序号调整
  3962. if ($(parentObject).find("span.jcjyItemGroupId") != null) {
  3963. thisJcjyItemGroupId = $(parentObject).find("span.jcjyItemGroupId").html();
  3964. afterJcjyItemGroupId = $(parentObject).after().find("span.jcjyItemGroupId").html();
  3965. $(parentObject).find("span.jcjyItemGroupId").html(afterJcjyItemGroupId);
  3966. $(parentObject).after().find("span.jcjyItemGroupId").html(thisJcjyItemGroupId);
  3967. }
  3968. $(parentObject).next().after($(parentObject));
  3969. }
  3970. /**
  3971. * 修改西药
  3972. * @param obj
  3973. */
  3974. function editWesternMedicine(obj) {
  3975. clearWesternMedicine(true);
  3976. //是新增药品还是编辑 true 修改 默认false
  3977. $("#western_medicine_update_flag").val(true);
  3978. var parentObject = $(obj).parent();
  3979. //组号
  3980. $("#groupId").val($(parentObject).find("input.temporary_items_groupId").val());
  3981. //组号有可能会修改,所以,判断的时候要用原组号
  3982. $("#western_medicine_ori_group_id").val($(parentObject).find("input.temporary_items_groupId").val());
  3983. $('#groupId').selectpicker('refresh');
  3984. //药品名称
  3985. $("#western_medicine_name").val($(parentObject).find("input.temporary_items_westernMedicineNamme").val());
  3986. var code = $(parentObject).find("input.temporary_items_code").val();
  3987. var serial = $(parentObject).find("input.temporary_items_serial").val();
  3988. //当前药品编码
  3989. $("#western_medicine_current_code").val(code);
  3990. //当前药品规格
  3991. $("#western_medicine_current_serial").val(serial);
  3992. //当前修改药品原始编码
  3993. $("#update_ori_code").val(code);
  3994. //当前修改的药品原始规格
  3995. $("#update_ori_serial").val(serial);
  3996. //用法编码
  3997. $("#supplyType").val($(parentObject).find("input.temporary_items_supplyType").val());
  3998. $('#supplyType').selectpicker('refresh');
  3999. //药品默认单次使用剂量
  4000. $("#drugWinDb").val($(parentObject).find("input.temporary_items_drugWinDb").val());
  4001. //处方实际单次使用剂量
  4002. $("#drugWin").val($(parentObject).find("input.temporary_items_drugWin").val());
  4003. //天数
  4004. $("#dayNum").val($(parentObject).find("input.temporary_items_dayNum").val());
  4005. $('#dayNum').selectpicker('refresh');
  4006. //频次编码
  4007. $("#orderFrequency").val($(parentObject).find("input.temporary_items_orderFrequency").val());
  4008. $('#orderFrequency').selectpicker('refresh');
  4009. //总量
  4010. $("#gross").val($(parentObject).find("input.temporary_items_gross").val());
  4011. //医嘱
  4012. $("#medicalAdvice").val($(parentObject).find("input.temporary_items_medicalAdvice").val());
  4013. $('#medicalAdvice').selectpicker('refresh');
  4014. //金额
  4015. $("#totalRetprice").val($(parentObject).find("input.temporary_items_amount").val());
  4016. //单价
  4017. $("#packRetprice").val($(parentObject).find("input.temporary_items_packRetprice").val());
  4018. //皮试结果
  4019. var tryResult = $(parentObject).find("input.temporary_items_tryResult").val();
  4020. //设置当前药品类型
  4021. $("#current_groupNo").val($(parentObject).find("input.temporary_items_currentGroupNo").val());
  4022. //设置当前药品大类
  4023. $("#categoriesFlag").val($(parentObject).find("input.temporary_items_categoriesFlag").val());
  4024. $.ajax({
  4025. type: "GET",
  4026. url: '/thmz/getYpZdDictByCodeAndSerial?code=' + code + "&serial=" + serial + "&deptNo=" + localStorage.getItem("currentDeptNo"),
  4027. contentType: "application/json;charset=UTF-8",
  4028. dataType: "json",
  4029. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4030. success: function (res) {
  4031. if (res == '401' || res == 401) {
  4032. window.location.href = '/thmz/login/view'
  4033. return;
  4034. }
  4035. if (res.code == 0) {
  4036. if (res.data != null) {
  4037. var drugWinHtml = '';
  4038. if (res.data.weight != null) {
  4039. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  4040. $("#drugWin").val(res.data.weight);
  4041. $("#drugWinDb").val(res.data.weight);
  4042. }
  4043. drugWinHtml = '<option value="' + res.data.weighUnit + '" desc="' + res.data.weight + '">' + res.data.weighUnitDesc + '</option>';
  4044. }
  4045. if (res.data.volum != null) {
  4046. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  4047. $("#drugWin").val(res.data.volum);
  4048. $("#drugWinDb").val(res.data.volum);
  4049. }
  4050. drugWinHtml += '<option value="' + res.data.volUnit + '" desc="' + res.data.volum + '">' + res.data.volUnitDesc + '</option>';
  4051. }
  4052. if (res.data.miniUnit != null && res.data.miniUnit != "") {
  4053. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  4054. $("#drugWin").val(1);
  4055. $("#drugWinDb").val(1);
  4056. }
  4057. drugWinHtml += '<option value="' + res.data.miniUnit + '" desc="1">' + res.data.miniUnitDesc + '</option>';
  4058. }
  4059. $('#drugWinUnit').html(drugWinHtml);
  4060. $('#drugWinUnit').selectpicker('refresh');
  4061. //剂量单位
  4062. $("#drugWinUnit").val($(parentObject).find("input.temporary_items_drugWinUnit").val());
  4063. $('#drugWinUnit').selectpicker('refresh');
  4064. if (res.data.packUnitDesc != null && res.data.packUnitDesc != "") {
  4065. var html = '<option value="' + res.data.packUnitDesc + '" >' + res.data.packUnitDesc + '</option>';
  4066. $('#packUnit').html(html);
  4067. $('#packUnit').selectpicker('refresh');
  4068. //包装单位
  4069. $("#packUnit").val($(parentObject).find("input.temporary_items_packUnit").val());
  4070. $('#packUnit').selectpicker('refresh');
  4071. }
  4072. if (res.data.psFlag != null && (res.data.psFlag == 1 || res.data.psFlag == "1")) {
  4073. if (res.data.categoriesFlag == 0 || res.data.categoriesFlag == "0" || res.data.categoriesFlag == 2 || res.data.categoriesFlag == "2") {
  4074. initTryResultSelect(res.data.categoriesFlag);
  4075. $("#tryResult").val(tryResult);
  4076. $('#tryResult').selectpicker('refresh');
  4077. }
  4078. }
  4079. $("#packSize").val(res.data.packSize);
  4080. //厂家名称
  4081. $("#manufactoryName").val(res.data.manufactoryName);
  4082. //规格
  4083. $("#specification").val(res.data.specification);
  4084. }
  4085. } else {
  4086. errorMesage(res);
  4087. }
  4088. }
  4089. });
  4090. }
  4091. /**
  4092. * 修改中药
  4093. * @param obj
  4094. */
  4095. function editChineseMedicine(obj) {
  4096. //是新增药品还是编辑 true 修改 默认false
  4097. $("#chinese_medicine_update_flag").val(true);
  4098. var parentObject = $(obj).parent();
  4099. //当前药品编码
  4100. $("#chinese_medicine_current_code").val($(parentObject).find("input.temporary_items_code").val());
  4101. //当前药品规格
  4102. $("#chinese_medicine_current_serial").val($(parentObject).find("input.temporary_items_serial").val());
  4103. //当前修改药品原始编码
  4104. $("#update_ori_code").val($(parentObject).find("input.temporary_items_code").val());
  4105. //当前修改的药品原始规格
  4106. $("#update_ori_serial").val($(parentObject).find("input.temporary_items_serial").val());
  4107. //中药类型
  4108. $("#zyClassType").val($(parentObject).find("input.temporary_items_zyClassType").val());
  4109. $('#zyClassType').selectpicker('refresh');
  4110. //药品名称
  4111. $("#chinese_medicine_name").val($(parentObject).find("input.temporary_items_chineseMedicineNamme").val());
  4112. //单价
  4113. $("#zy_packRetprice").val($(parentObject).find("input.temporary_items_zyPackRetprice").val());
  4114. //处方实际单次使用剂量
  4115. $("#zy_drugWin").val($(parentObject).find("input.temporary_items_drugWin").val());
  4116. //医嘱码
  4117. $("#zyInstruction").val($(parentObject).find("input.temporary_items_zyInstruction").val());
  4118. $('#zyInstruction').selectpicker('refresh');
  4119. }
  4120. /**
  4121. * 修改辅助检查、检验项目
  4122. * @param obj
  4123. */
  4124. function editJyJcItem(obj) {
  4125. //是新增药品还是编辑 true 修改 默认false
  4126. $("#jcjy_update_flag").val(true);
  4127. var parentObject = $(obj).parent();
  4128. //当前项目编码
  4129. $("#jcjy_current_code").val($(parentObject).find("input.temporary_items_code").val());
  4130. $("#update_ori_code").val($(parentObject).find("input.temporary_items_code").val());
  4131. //项目名称
  4132. $("#jcJyItem").val($(parentObject).find("input.temporary_items_jcJyItemName").val());
  4133. //单价
  4134. $("#jcjyItemPrice").val($(parentObject).find("input.temporary_items_amount").val());
  4135. //备注
  4136. $("#remark").val($(parentObject).find("input.temporary_items_remark").val());
  4137. var chargeUnit = $(parentObject).find("input.temporary_items_desc_value").val();
  4138. var jcJyZltype = $(parentObject).find("input.temporary_items_type").val();
  4139. //执行科室
  4140. var execUnit = $(parentObject).find("input.temporary_items_execUnit").val();
  4141. $("#execUnit").selectpicker('val', execUnit);
  4142. $('#execUnit').selectpicker('refresh');
  4143. if (jcJyZltype == 1 || jcJyZltype == "1") {
  4144. $("#jyZdSample").selectpicker('val', chargeUnit);
  4145. $('#jyZdSample').selectpicker('refresh');
  4146. $("#jyZdSampleDiv").removeClass("hide").addClass("in");
  4147. $("#yshPartDiv").removeClass("in").addClass("hide");
  4148. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  4149. } else if (jcJyZltype == 2 || jcJyZltype == "2") {
  4150. $("#yshPart").selectpicker('val', chargeUnit);
  4151. $('#yshPart').selectpicker('refresh');
  4152. $("#yshPartDiv").removeClass("hide").addClass("in");
  4153. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  4154. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  4155. }
  4156. $("#jcJyZltype").val(jcJyZltype);
  4157. }
  4158. /**
  4159. * 修改诊疗项目
  4160. * @param obj
  4161. */
  4162. function editZlItem(obj) {
  4163. //是新增药品还是编辑 true 修改 默认false
  4164. $("#zl_update_flag").val(true);
  4165. var parentObject = $(obj).parent();
  4166. //当前项目编码
  4167. $("#zl_current_code").val($(parentObject).find("input.temporary_items_code").val());
  4168. $("#update_ori_code").val($(parentObject).find("input.temporary_items_code").val());
  4169. //项目名称
  4170. $("#zlItem").val($(parentObject).find("input.temporary_items_zlItemName").val());
  4171. //单价
  4172. $("#zlItemPrice").val($(parentObject).find("input.temporary_items_amount").val());
  4173. //备注
  4174. $("#zlRemark").val($(parentObject).find("input.temporary_items_remark").val());
  4175. var chargeUnit = $(parentObject).find("input.temporary_items_desc_value").val();
  4176. //数量
  4177. var itemQuantity = $(parentObject).find("input.temporary_items_itemQuantity").val();
  4178. //执行科室
  4179. var execUnit = $(parentObject).find("input.temporary_items_execUnit").val();
  4180. var descriptions = $(parentObject).find("input.temporary_items_code").val();
  4181. if (descriptions != null && descriptions != "" && descriptions != 'null') {
  4182. $("#descriptions").val(descriptions);
  4183. }
  4184. var dayZlNum = $(parentObject).find("input.temporary_items_dayZlNum").val();
  4185. if (dayZlNum != null && dayZlNum != "" && dayZlNum != 'null') {
  4186. $("#dayZlNum").selectpicker('val', dayZlNum);
  4187. $('#dayZlNum').selectpicker('refresh');
  4188. }
  4189. var orderFrequencyZl = $(parentObject).find("input.temporary_items_orderFrequencyZl").val();
  4190. if (orderFrequencyZl != null && orderFrequencyZl != "" && orderFrequencyZl != 'null') {
  4191. $("#orderFrequencyZl").selectpicker('val', orderFrequencyZl);
  4192. $('#orderFrequencyZl').selectpicker('refresh');
  4193. }
  4194. var totalNumZl = $(parentObject).find("input.temporary_items_totalNumZl").val();
  4195. if (totalNumZl != null && totalNumZl != "" && totalNumZl != 'null') {
  4196. $("#totalNumZl").val(totalNumZl);
  4197. }
  4198. $("#zlExecUnit").selectpicker('val', execUnit);
  4199. $('#zlExecUnit').selectpicker('refresh');
  4200. //描述
  4201. $("#chargeUnit").val(chargeUnit);
  4202. $("#itemQuantity").val(itemQuantity);
  4203. calculateZl(true);
  4204. }
  4205. /**
  4206. * 保存当前辅助检查、检验项目到右边处方区域 需要提示加价
  4207. * @param calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  4208. */
  4209. function saveJyJcItem(calculateTotalAmountFlag) {
  4210. //6岁内提示加价
  4211. var patientAge = $("#patientAge").text();
  4212. if (calculateTotalAmountFlag && patientAge != null && patientAge != "" && patientAge < 6) {
  4213. $.ajax({
  4214. type: "GET",
  4215. url: '/thmz/checkAdditionally?code=' + $("#jcjy_current_code").val() + "&jcJyZltype=" + $("#jcJyZltype").val(),
  4216. contentType: "application/json;charset=UTF-8",
  4217. dataType: "json",
  4218. async: false,
  4219. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4220. success: function (res) {
  4221. if (res == '401' || res == 401) {
  4222. window.location.href = '/thmz/login/view'
  4223. return;
  4224. }
  4225. if (res.code == 0) {
  4226. if (res.data != undefined && res.data != null && res.data.co != null && res.data.co == 1 && res.data.xlCode != null && res.data.xlCode != "") {
  4227. var xlCode = res.data.xlCode;
  4228. xlCode = Multiply(100, xlCode);
  4229. $("#messageModal").modal();
  4230. $("#messageContent").html("根据【湘医保发〔2020〕51 号】价格通知,6岁以内的小朋友诊疗费上调" + xlCode + "%,是否需要继续添加该项目?");
  4231. $("#messageButton").off("click").on("click", function (t) {
  4232. $("#messageModal").modal("hide");
  4233. saveJyJcItemReal(calculateTotalAmountFlag);
  4234. });
  4235. $("#cancelButton").off("click");
  4236. } else {
  4237. //虽然是不满6岁,但是也没有需要加收的项目,直接保存
  4238. saveJyJcItemReal(calculateTotalAmountFlag);
  4239. }
  4240. } else {
  4241. errorMesage(res);
  4242. }
  4243. }
  4244. });
  4245. } else {
  4246. saveJyJcItemReal(calculateTotalAmountFlag);
  4247. }
  4248. }
  4249. /**
  4250. * 保存当前项目到右边处方区域
  4251. * @param calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  4252. */
  4253. function saveJyJcItemReal(calculateTotalAmountFlag) {
  4254. var tableId = $("#jcjyTab li.active").find("a").attr("href");
  4255. //组号
  4256. var groupId = $(tableId).find("div:eq(0)").children().length + 1;
  4257. //项目名称
  4258. var jcJyItem = $("#jcJyItem").val();
  4259. //当前项目编码
  4260. var currentCode = $("#jcjy_current_code").val();
  4261. //当前项目价格
  4262. var jcjyItemPrice = $("#jcjyItemPrice").val();
  4263. //执行科室
  4264. var execUnit = $("#execUnit").val();
  4265. //执行科室
  4266. var execUnitName = $('#execUnit option:selected').text();
  4267. execUnitName = execUnitName.substring(0, execUnitName.indexOf("("));
  4268. //描述编码
  4269. var chargeUnitCode = null;
  4270. var chargeUnitName = "";
  4271. //检验物或者检查部位
  4272. var chargeUnit = null;
  4273. //备注
  4274. var remark = $("#remark").val();
  4275. //项目类型
  4276. var jcJyZltype = $("#jcJyZltype").val();
  4277. if (jcJyZltype == "1" || jcJyZltype == 1) {
  4278. //检验
  4279. chargeUnit = $('#jyZdSample option:selected').text();
  4280. chargeUnit = chargeUnit.substring(0, chargeUnit.indexOf("("));
  4281. chargeUnitCode = $('#jyZdSample').val();
  4282. chargeUnitName = " 检验物:";
  4283. } else if (jcJyZltype == "2" || jcJyZltype == 2) {
  4284. //检查
  4285. chargeUnit = $('#yshPart option:selected').text();
  4286. chargeUnit = chargeUnit.substring(0, chargeUnit.indexOf("("));
  4287. chargeUnitCode = $('#yshPart').val();
  4288. chargeUnitName = " 检查部位:";
  4289. }
  4290. if (currentCode == null || currentCode == '') {
  4291. if (calculateTotalAmountFlag == true) {
  4292. errorMesageSimaple("未选择任何项目!");
  4293. }
  4294. return;
  4295. }
  4296. //判断是否有重复的项目 返回true 说明有重复的
  4297. //彩超加收一个部位的不限制多开
  4298. if ("003913" != currentCode && verifyRepeat(currentCode, null, chargeUnitCode, 2)) {
  4299. return;
  4300. }
  4301. //原药品金额 如果是修改则需要设置
  4302. var temporaryItemsAmount = 0;
  4303. //当前需要被移除元素的下个兄弟节点
  4304. var nextObj = null;
  4305. //当前修改的药品是不是最后一个
  4306. var isLast = false;
  4307. //是新增药品还是编辑 true 修改 默认false
  4308. var updateFlag = $("#jcjy_update_flag").val();
  4309. if (updateFlag == undefined || updateFlag == null) {
  4310. updateFlag = false;
  4311. }
  4312. //如果是修改,需要减去原来的费用
  4313. //原组号
  4314. var oriGroupId = null;
  4315. if (updateFlag == "true" || updateFlag == true) {
  4316. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  4317. if (formGroups != null && formGroups.length > 0) {
  4318. var updateOriCode = $("#update_ori_code").val();
  4319. for (var i = 0; i < formGroups.length; i++) {
  4320. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  4321. if (temporaryItemsCode === updateOriCode) {
  4322. temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  4323. if (formGroups.length > 1) {
  4324. nextObj = $(formGroups[i]).next();
  4325. }
  4326. isLast = (i + 1) === formGroups.length;
  4327. oriGroupId = $(formGroups[i]).find("span.jcjyItemGroupId").text();
  4328. $(formGroups[i]).remove();
  4329. break;
  4330. }
  4331. }
  4332. }
  4333. }
  4334. if (oriGroupId != null) {
  4335. groupId = oriGroupId;
  4336. }
  4337. var html = '<div class="form-group">';
  4338. html += '<span class="jcjyItemGroupId">' + groupId + '</span>.<span style="margin-left: 5px"></span>'
  4339. html += jcJyItem + ' ';
  4340. if (jcJyZltype == "3" || jcJyZltype == 3) {
  4341. html += " 数量:" + itemQuantity;
  4342. }
  4343. if (execUnit != null && execUnit != "") {
  4344. html += " 执行科室:" + execUnitName;
  4345. }
  4346. if (chargeUnit != null && chargeUnit != '') {
  4347. html += chargeUnitName + chargeUnit;
  4348. }
  4349. if (remark != null && remark != '') {
  4350. html += ' 备注:' + remark;
  4351. }
  4352. 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>';
  4353. 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>';
  4354. 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>';
  4355. 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>';
  4356. if ($("#jcJyItemChargeDetail").hasClass("in")) {
  4357. 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>';
  4358. }
  4359. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  4360. html += '<input type="hidden" class="temporary_items_jcJyItemName" value="' + jcJyItem + '"/>';
  4361. html += '<input type="hidden" class="temporary_items_amount" value="' + jcjyItemPrice + '"/>';
  4362. html += '<input type="hidden" class="temporary_items_remark" value="' + remark + '"/>';
  4363. html += '<input type="hidden" class="temporary_items_type" value="' + jcJyZltype + '"/>';
  4364. html += '<input type="hidden" class="temporary_items_desc_value" value="' + chargeUnitCode + '"/>';
  4365. html += '<input type="hidden" class="temporary_items_execUnit" value="' + execUnit + '"/>';
  4366. html += '</div>';
  4367. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  4368. if (nextObj == null || isLast) {
  4369. $(tableId).find("div:eq(0)").append(html);
  4370. } else {
  4371. $(nextObj).before(html);
  4372. }
  4373. //设置当前处方金额
  4374. //calculateCfAmount(tableId, jcjyItemPrice, temporaryItemsAmount, 2, 0);
  4375. if (calculateTotalAmountFlag) {
  4376. //设置总金额
  4377. calculateTotalAmount(true);
  4378. }
  4379. clearJyJcItem();
  4380. }
  4381. /**
  4382. * 保存当前诊疗项目到右边处方区域 需要提示加价
  4383. * @param calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  4384. */
  4385. function saveZlItem(calculateTotalAmountFlag) {
  4386. //6岁内提示加价
  4387. var patientAge = $("#patientAge").text();
  4388. if (calculateTotalAmountFlag && patientAge != null && patientAge != "" && patientAge < 6) {
  4389. $.ajax({
  4390. type: "GET",
  4391. url: '/thmz/checkAdditionally?code=' + $("#zl_current_code").val() + "&jcJyZltype=3",
  4392. contentType: "application/json;charset=UTF-8",
  4393. dataType: "json",
  4394. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4395. async: false,
  4396. success: function (res) {
  4397. if (res == '401' || res == 401) {
  4398. window.location.href = '/thmz/login/view'
  4399. return;
  4400. }
  4401. if (res.code == 0) {
  4402. if (res.data != undefined && res.data != null && res.data.co != null && res.data.co == 1 && res.data.xlCode != null && res.data.xlCode != "") {
  4403. var xlCode = res.data.xlCode;
  4404. xlCode = Multiply(100, xlCode);
  4405. $("#messageModal").modal();
  4406. $("#messageContent").html("根据【湘医保发〔2020〕51 号】价格通知,6岁以内的小朋友诊疗费上调" + xlCode + "%,是否需要继续添加该项目?");
  4407. $("#messageButton").off("click").on("click", function (t) {
  4408. $("#messageModal").modal("hide");
  4409. saveZlItemReal(calculateTotalAmountFlag);
  4410. });
  4411. $("#cancelButton").off("click");
  4412. } else {
  4413. //虽然是不满6岁,但是也没有需要加收的项目,直接保存
  4414. saveZlItemReal(calculateTotalAmountFlag);
  4415. }
  4416. } else {
  4417. errorMesage(res);
  4418. }
  4419. }
  4420. });
  4421. } else {
  4422. saveZlItemReal(calculateTotalAmountFlag);
  4423. }
  4424. }
  4425. /**
  4426. * 保存当前项目到右边处方区域
  4427. * @param calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  4428. */
  4429. function saveZlItemReal(calculateTotalAmountFlag) {
  4430. var tableId = $("#zlTab li.active").find("a").attr("href");
  4431. //组号
  4432. var groupId = $(tableId).find("div:eq(0)").children().length + 1;
  4433. //项目名称
  4434. var zlItem = $("#zlItem").val();
  4435. //当前项目编码
  4436. var currentCode = $("#zl_current_code").val();
  4437. //当前项目价格
  4438. var zlItemPrice = $("#zlItemPrice").val();
  4439. //单位
  4440. var chargeUnit = $("#chargeUnit").val();
  4441. //执行科室
  4442. var zlExecUnit = $("#zlExecUnit").val();
  4443. //执行科室
  4444. var zlExecUnitName = $('#zlExecUnit option:selected').text();
  4445. zlExecUnitName = zlExecUnitName.substring(0, zlExecUnitName.indexOf("("));
  4446. //单量
  4447. var itemQuantity = $("#itemQuantity").val();
  4448. //规格
  4449. var descriptions = $("#descriptions").val();
  4450. //天数
  4451. var dayZlNum = $("#dayZlNum").val();
  4452. //频次
  4453. var orderFrequencyZl = $("#orderFrequencyZl").val();
  4454. //总量
  4455. var totalNumZl = $("#totalNumZl").val();
  4456. //描述编码
  4457. var chargeUnitCode = chargeUnit;
  4458. //备注
  4459. var remark = $("#zlRemark").val();
  4460. if (calculateTotalAmountFlag == true) {
  4461. if (currentCode == null || currentCode == '') {
  4462. errorMesageSimaple("未选择任何项目!");
  4463. return;
  4464. }
  4465. if (totalNumZl == null || totalNumZl == "" || totalNumZl == "null") {
  4466. errorMesageSimaple("项目使用总量为空!");
  4467. return;
  4468. }
  4469. }
  4470. //判断是否有重复的项目 返回true 说明有重复的
  4471. if (verifyRepeat(currentCode, null, null, 3)) {
  4472. return;
  4473. }
  4474. //原药品金额 如果是修改则需要设置
  4475. var temporaryItemsAmount = 0;
  4476. //当前需要被移除元素的下个兄弟节点
  4477. var nextObj = null;
  4478. //当前修改的药品是不是最后一个
  4479. var isLast = false;
  4480. //是新增药品还是编辑 true 修改 默认false
  4481. var updateFlag = $("#zl_update_flag").val();
  4482. if (updateFlag == undefined || updateFlag == null) {
  4483. updateFlag = false;
  4484. }
  4485. //如果是修改,需要减去原来的费用
  4486. //原组号
  4487. var oriGroupId = null;
  4488. if (updateFlag == "true" || updateFlag == true) {
  4489. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  4490. if (formGroups != null && formGroups.length > 0) {
  4491. var updateOriCode = $("#update_ori_code").val();
  4492. for (var i = 0; i < formGroups.length; i++) {
  4493. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  4494. if (temporaryItemsCode === updateOriCode) {
  4495. temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  4496. if (formGroups.length > 1) {
  4497. nextObj = $(formGroups[i]).next();
  4498. }
  4499. isLast = (i + 1) === formGroups.length;
  4500. oriGroupId = $(formGroups[i]).find("span.zlItemGroupId").text();
  4501. $(formGroups[i]).remove();
  4502. break;
  4503. }
  4504. }
  4505. }
  4506. }
  4507. if (oriGroupId != null) {
  4508. groupId = oriGroupId;
  4509. }
  4510. var html = '<div class="form-group">';
  4511. html += '<span class="zlItemGroupId">' + groupId + '</span>.<span style="margin-left: 5px"></span>'
  4512. html += zlItem + ' ';
  4513. if (descriptions != null && descriptions != "") {
  4514. html += " 规格:" + descriptions;
  4515. }
  4516. html += " 单量:" + itemQuantity;
  4517. if (chargeUnit != null && chargeUnit != '') {
  4518. html += chargeUnit;
  4519. }
  4520. if (dayZlNum != null && dayZlNum != "") {
  4521. html += " 天数:" + dayZlNum + "天";
  4522. }
  4523. if (orderFrequencyZl != null && orderFrequencyZl != "") {
  4524. html += " 频次:" + orderFrequencyZl;
  4525. }
  4526. if (totalNumZl != null && totalNumZl != "") {
  4527. html += " 总量:" + totalNumZl;
  4528. if (chargeUnit != null && chargeUnit != '') {
  4529. html += chargeUnit;
  4530. }
  4531. }
  4532. if (zlExecUnit != null && zlExecUnit != "") {
  4533. html += " 执行科室:" + zlExecUnitName;
  4534. }
  4535. if (remark != null && remark != '') {
  4536. html += ' 备注:' + remark;
  4537. }
  4538. 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>';
  4539. 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>';
  4540. html += ' <i class="fa fa-long-arrow-left" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;" onclick="editZlItem(this)"></i>';
  4541. 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>';
  4542. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  4543. html += '<input type="hidden" class="temporary_items_zlItemName" value="' + zlItem + '"/>';
  4544. html += '<input type="hidden" class="temporary_items_amount" value="' + zlItemPrice + '"/>';
  4545. html += '<input type="hidden" class="temporary_items_remark" value="' + remark + '"/>';
  4546. html += '<input type="hidden" class="temporary_items_desc_value" value="' + chargeUnitCode + '"/>';
  4547. html += '<input type="hidden" class="temporary_items_itemQuantity" value="' + itemQuantity + '"/>';
  4548. html += '<input type="hidden" class="temporary_items_execUnit" value="' + zlExecUnit + '"/>';
  4549. html += '<input type="hidden" class="temporary_items_descriptions" value="' + descriptions + '"/>';
  4550. html += '<input type="hidden" class="temporary_items_dayZlNum" value="' + dayZlNum + '"/>';
  4551. html += '<input type="hidden" class="temporary_items_orderFrequencyZl" value="' + orderFrequencyZl + '"/>';
  4552. html += '<input type="hidden" class="temporary_items_totalNumZl" value="' + totalNumZl + '"/>';
  4553. html += '</div>';
  4554. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  4555. if (nextObj == null || isLast) {
  4556. $(tableId).find("div:eq(0)").append(html);
  4557. } else {
  4558. $(nextObj).before(html);
  4559. }
  4560. //设置当前处方金额
  4561. //calculateCfAmount(tableId, jcjyItemPrice, temporaryItemsAmount, 2, 0);
  4562. if (calculateTotalAmountFlag) {
  4563. //设置总金额
  4564. calculateTotalAmount(true);
  4565. }
  4566. clearZlItem();
  4567. }
  4568. /**
  4569. * 临时保存住院证
  4570. * @param messageFlag 是否需要提醒已经存在的入院申请 true 提示
  4571. */
  4572. function saveZyReq(messageFlag) {
  4573. //如果
  4574. if ($("#zyReqTab").find("li") == null || $("#zyReqTab").find("li").length == 0) {
  4575. initNavTabs(4, null, null);
  4576. }
  4577. var tableId = $("#zyReqTab li.active").find("a").attr("href");
  4578. //病区编码
  4579. var inpatientWardBeHospitalized = $("#inpatientWardBeHospitalized").val();
  4580. //小病室编码
  4581. var smallWardBeHospitalized = $("#smallWardBeHospitalized").val();
  4582. //入院状态编码
  4583. var admissStatus = $("#admissStatus").val();
  4584. //病区名称
  4585. var inpatientWardText = $('#inpatientWardBeHospitalized option:selected').text();
  4586. //小科室名称
  4587. var smallWardText = $('#smallWardBeHospitalized option:selected').text();
  4588. //入院状态名称
  4589. var admissStatusText = $('#admissStatus option:selected').text();
  4590. if (inpatientWardBeHospitalized == null || inpatientWardBeHospitalized == '') {
  4591. errorMesageSimaple("未选择入院病区!");
  4592. return;
  4593. }
  4594. if (admissStatus == null || admissStatus == '') {
  4595. errorMesageSimaple("未选择入院状态!");
  4596. return;
  4597. }
  4598. if (messageFlag == "true" || messageFlag == true) {
  4599. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  4600. if (formGroups != null && formGroups.length > 0) {
  4601. $("#messageModal").modal();
  4602. $("#messageContent").html("当前病人已经有一个暂存的入院申请,是否需要替换该申请?");
  4603. $("#messageButton").off("click").on("click", function (t) {
  4604. $("#messageModal").modal("hide");
  4605. saveZyReq(false);
  4606. });
  4607. $("#cancelButton").off("click");
  4608. return;
  4609. }
  4610. }
  4611. var html = '<div class="form-group"> 收住院';
  4612. if (inpatientWardText != null) {
  4613. html += " [" + inpatientWardText;
  4614. }
  4615. if (smallWardText != null) {
  4616. html += " (" + smallWardText + ") ";
  4617. }
  4618. if (inpatientWardText != null) {
  4619. html += "] ";
  4620. }
  4621. if (admissStatusText != null) {
  4622. html += admissStatusText;
  4623. }
  4624. html += ' 侯床';
  4625. //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>';
  4626. 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>';
  4627. html += '<input type="hidden" class="temporary_inpatient_ward" value="' + inpatientWardBeHospitalized + '"/>';
  4628. html += '<input type="hidden" class="temporary_items_small_ward" value="' + smallWardBeHospitalized + '"/>';
  4629. html += '<input type="hidden" class="temporary_items_admiss_status" value="' + admissStatus + '"/>';
  4630. html += '</div>';
  4631. $(tableId).find("div:eq(0)").html(html);
  4632. clearZyReq();
  4633. }
  4634. /**
  4635. * 删除药品或者项目
  4636. * @param index 0 西药 1 中药 2 检查检验 3诊疗
  4637. * @param obj 当前点击的对象
  4638. */
  4639. function removeYpOrProject(index, obj) {
  4640. var tabId = null;
  4641. var className = null;
  4642. //西药
  4643. if (index == 0) {
  4644. tabId = "xyTab";
  4645. } else if (index == 1) {
  4646. //中成药
  4647. tabId = "zyTab";
  4648. } else if (index == 2) {
  4649. //辅助检查、检验
  4650. className = ".jcjyItemGroupId";
  4651. tabId = "jcjyTab";
  4652. } else if (index == 3) {
  4653. //诊疗
  4654. className = ".zlItemGroupId";
  4655. tabId = "zlTab";
  4656. } else if (index == 4) {
  4657. //入院
  4658. tabId = "zyReqTab";
  4659. }
  4660. var tableId = $("#" + tabId + " li.active").find("a").attr("href");
  4661. //var totalRetprice = $(obj).parent().find("input.temporary_items_amount").val();
  4662. //calculateCfAmount(tableId, totalRetprice, null, index, 1);
  4663. //医技和诊疗的序号调整一下
  4664. if (index == 2 || index == 3) {
  4665. var nextAll = $(obj).parent().nextAll();
  4666. if (nextAll != null && nextAll.length > 0) {
  4667. for (var i = 0; i < nextAll.length; i++) {
  4668. var index = $(nextAll[i]).find(className).text();
  4669. $(nextAll[i]).find(className).text(index - 1);
  4670. }
  4671. }
  4672. }
  4673. var temporaryItemsGroupId= $(obj).parent().find("input.temporary_items_groupId").val();
  4674. var temporaryItemsGroupIds=$(obj).parent().parent().find("input.temporary_items_groupId");
  4675. if(temporaryItemsGroupIds!=null && temporaryItemsGroupIds.length>0){
  4676. var count=0;
  4677. for(var i=0;i<temporaryItemsGroupIds.length;i++){
  4678. if(temporaryItemsGroupId==$(temporaryItemsGroupIds[i]).val()){
  4679. count++;
  4680. }
  4681. }
  4682. //当前删除的药品组号是最后一个的时候,清空缓存
  4683. if(count==1){
  4684. groupIdMap.remove(temporaryItemsGroupId);
  4685. gropuIdAndOrderNoMap.remove(temporaryItemsGroupId);
  4686. }
  4687. }
  4688. $(obj).parent().remove();
  4689. if (index != 4) {
  4690. calculateTotalAmount(false);
  4691. }
  4692. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  4693. if (formGroups == null || formGroups.length == 0) {
  4694. if (index == 0) {
  4695. //西药被清空后,重置药房类型编码
  4696. $(tableId).find("input.current_groupNo").val(null);
  4697. //当本处方内容都被删除完后,也删除处方table
  4698. $("#" + tabId).find("a[href=\"" + tableId + "\"]").parent().remove();
  4699. $(tableId).remove();
  4700. //切换处方 最后一个被选中
  4701. $("#" + tabId).find("li:last > a").off("click").tab('show');
  4702. } else if (index == 1) {
  4703. //当中药处方被清空完后,重置当前中药类型为空
  4704. $("#current_zyClassType").val(null);
  4705. }
  4706. }
  4707. if(index==0){
  4708. resetGroupIdMap();
  4709. }
  4710. }
  4711. /**
  4712. * 重置组号与用法、频率天数缓存关系
  4713. */
  4714. function resetGroupIdMap() {
  4715. var temporaryItemsGroupIds=$("#xyTabContent").find("input.temporary_items_groupId");
  4716. if(temporaryItemsGroupIds!=null && temporaryItemsGroupIds.length>0){
  4717. var list=[];
  4718. for(var i=0;i<temporaryItemsGroupIds.length;i++){
  4719. var groupId=$(temporaryItemsGroupIds[i]).val();
  4720. if(list.indexOf(groupId)<0){
  4721. list.push(groupId);
  4722. }
  4723. }
  4724. var keys = groupIdMap.keySet();
  4725. for(var i=0;i<keys.length;i++){
  4726. var key=keys[i];
  4727. if(list.indexOf(key)<0){
  4728. groupIdMap.remove(key);
  4729. }
  4730. }
  4731. }
  4732. }
  4733. /**
  4734. * 清空西药
  4735. * @param flag 是否全部清空 因为 西药有分组,同一组的药品用药方式和频率以及天数一样,不能改变。所以不换组是不能改变 并且设置成不可编辑
  4736. */
  4737. function clearWesternMedicine(flag) {
  4738. $("#western_medicine_update_flag").val(false);
  4739. $("#western_medicine_ori_group_id").val(null);
  4740. $("#update_ori_code").val(null);
  4741. $("#update_ori_serial").val(null);
  4742. //药品名称
  4743. $("#western_medicine_name").val(null);
  4744. //当前药品编码
  4745. $("#western_medicine_current_code").val(null);
  4746. //当前药品规格
  4747. $("#western_medicine_current_serial").val(null);
  4748. //当前药房编码
  4749. $("#current_groupNo").val(null);
  4750. if (flag) {
  4751. //用法编码
  4752. $("#supplyType").selectpicker('val', null);
  4753. $('#supplyType').selectpicker('refresh');
  4754. //$("#supplyType").removeAttr("disabled");
  4755. //天数
  4756. $("#dayNum").selectpicker('val', null);
  4757. $('#dayNum').selectpicker('refresh');
  4758. // $("#dayNum").removeAttr("disabled");
  4759. //频次编码
  4760. $("#orderFrequency").selectpicker('val', null);
  4761. $('#orderFrequency').selectpicker('refresh');
  4762. // $("#orderFrequency").removeAttr("disabled");
  4763. }
  4764. //药品默认单次使用剂量
  4765. $("#drugWinDb").val(null);
  4766. //处方实际单次使用剂量
  4767. $("#drugWin").val(null);
  4768. //剂量单位
  4769. $("#drugWinUnit").selectpicker('val', null);
  4770. $('#drugWinUnit').selectpicker('refresh');
  4771. //总量
  4772. $("#gross").val(null);
  4773. //包装单位
  4774. $("#packUnit").selectpicker('val', null);
  4775. $('#packUnit').selectpicker('refresh');
  4776. //单价
  4777. $("#packRetprice").val(null);
  4778. //金额
  4779. $("#totalRetprice").val(null);
  4780. //医嘱
  4781. $("#medicalAdvice").selectpicker('val', null);
  4782. $('#medicalAdvice').selectpicker('refresh');
  4783. $("#tryResult").parent().parent().parent().removeClass("in").addClass("hide");
  4784. //皮试结果
  4785. $("#tryResult").selectpicker('val', null);
  4786. $('#tryResult').selectpicker('refresh');
  4787. //$("#gross").attr("readonly", "readonly");
  4788. $("#manufactoryName").val(null);
  4789. $("#specification").val(null);
  4790. $("#categoriesFlag").val(null);
  4791. }
  4792. /**
  4793. * 保存当前药品到右边处方区域 中药
  4794. * calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  4795. */
  4796. function saveChineseMedicine(calculateTotalAmountFlag) {
  4797. //药品名称
  4798. var chineseMedicineNamme = $("#chinese_medicine_name").val();
  4799. //当前药品编码
  4800. var currentCode = $("#chinese_medicine_current_code").val();
  4801. //当前药品规格
  4802. var currentSerial = $("#chinese_medicine_current_serial").val();
  4803. //处方实际单次使用剂量
  4804. var drugWin = $("#zy_drugWin").val();
  4805. //医嘱码
  4806. var zyInstruction = $("#zyInstruction").val();
  4807. //医嘱
  4808. var zyInstructionText = $('#zyInstruction option:selected').text();
  4809. //单价
  4810. var zyPackRetprice = parseFloat($("#zy_packRetprice").val());
  4811. //当前中药的总价
  4812. var totalRetprice = Multiply(drugWin, zyPackRetprice);
  4813. //中药类型
  4814. var zyClassType = $("#zyClassType").val();
  4815. //已经选中的药品类型, 中药不允许一个处方里有普通中药和颗粒剂
  4816. var currentYyClassType = $("#current_zyClassType").val();
  4817. if (currentYyClassType == null || currentYyClassType == "") {
  4818. //中药此时是第一次选择药品,不控制类型
  4819. $("#current_zyClassType").val(zyClassType);
  4820. } else if (currentYyClassType != zyClassType) {
  4821. errorMesageSimaple("同一个中药处方不允许同时出现普通中药和颗粒剂中药!");
  4822. return;
  4823. }
  4824. if (currentCode == null || currentCode == '') {
  4825. errorMesageSimaple("未选择任何药品!");
  4826. return;
  4827. }
  4828. var html = '<div class="form-group" style="float: left;">';
  4829. html += chineseMedicineNamme;
  4830. if (zyInstruction != null && zyInstruction != '') {
  4831. html += '[' + zyInstructionText + ']';
  4832. }
  4833. html += '<span style="margin-left: 5px"></span>';
  4834. html += drugWin + 'g';
  4835. 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>';
  4836. 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>';
  4837. 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>';
  4838. 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>';
  4839. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  4840. html += '<input type="hidden" class="temporary_items_serial" value="' + currentSerial + '"/>';
  4841. html += '<input type="hidden" class="temporary_items_amount" value="' + totalRetprice + '"/>';
  4842. html += '<input type="hidden" class="temporary_items_zyClassType" value="' + zyClassType + '"/>';
  4843. html += '<input type="hidden" class="temporary_items_chineseMedicineNamme" value="' + chineseMedicineNamme + '"/>';
  4844. html += '<input type="hidden" class="temporary_items_zyPackRetprice" value="' + zyPackRetprice + '"/>';
  4845. html += '<input type="hidden" class="temporary_items_drugWin" value="' + drugWin + '"/>';
  4846. html += '<input type="hidden" class="temporary_items_zyInstruction" value="' + zyInstruction + '"/>';
  4847. html += '<input type="hidden" class="temporary_items_zyInstructionText" value="' + zyInstructionText + '"/>';
  4848. html += '</div>';
  4849. var tableId = $("#zyTab li.active").find("a").attr("href");
  4850. //原药品金额 如果是修改则需要设置
  4851. var temporaryItemsAmount = 0;
  4852. //当前需要被移除元素的下个兄弟节点
  4853. var nextObj = null;
  4854. //当前修改的药品是不是最后一个
  4855. var isLast = false;
  4856. //是新增药品还是编辑 true 修改 默认false
  4857. var updateFlag = $("#chinese_medicine_update_flag").val();
  4858. if (updateFlag == undefined || updateFlag == null) {
  4859. updateFlag = false;
  4860. }
  4861. //如果是修改,需要减去原来的费用
  4862. if (updateFlag == "true" || updateFlag == true) {
  4863. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  4864. if (formGroups != null && formGroups.length > 0) {
  4865. //药品有可能会修改,所以,判断的时候要用原药品编码
  4866. var updateOriCode = $("#update_ori_code").val();
  4867. //规格有可能会修改,所以,判断的时候要用原规格
  4868. var updateOriSerial = $("#update_ori_serial").val();
  4869. for (var i = 0; i < formGroups.length; i++) {
  4870. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  4871. var temporaryItemsSerial = $(formGroups[i]).find("input.temporary_items_serial").val();
  4872. if (temporaryItemsCode === updateOriCode && temporaryItemsSerial === updateOriSerial) {
  4873. temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  4874. if (formGroups.length > 1) {
  4875. nextObj = $(formGroups[i]).next();
  4876. }
  4877. isLast = (i + 1) === formGroups.length;
  4878. $(formGroups[i]).remove();
  4879. break;
  4880. }
  4881. }
  4882. }
  4883. }
  4884. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  4885. if (nextObj == null || isLast) {
  4886. $(tableId).find("div:eq(0)").append(html);
  4887. } else {
  4888. $(nextObj).before(html);
  4889. }
  4890. //设置当前处方金额
  4891. // calculateCfAmount(tableId, totalRetprice, temporaryItemsAmount, 1, 0);
  4892. if (calculateTotalAmountFlag) {
  4893. //设置总金额
  4894. calculateTotalAmount(true);
  4895. }
  4896. clearChineseMedicine();
  4897. }
  4898. /**
  4899. * 清空中药
  4900. */
  4901. function clearChineseMedicine() {
  4902. $("#chinese_medicine_update_flag").val(false);
  4903. $("#update_ori_code").val(null);
  4904. $("#update_ori_serial").val(null);
  4905. //药品名称
  4906. $("#chinese_medicine_name").val(null);
  4907. //当前药品编码
  4908. $("#chinese_medicine_current_code").val(null);
  4909. //当前药品规格
  4910. $("#chinese_medicine_current_serial").val(null);
  4911. //医嘱
  4912. $("#zyInstruction").selectpicker('val', null);
  4913. $('#zyInstruction').selectpicker('refresh');
  4914. //剂量
  4915. $("#zy_drugWin").val(null);
  4916. //单价
  4917. $("#zy_packRetprice").val(null);
  4918. }
  4919. /**
  4920. * 清空辅助检查、检验项目
  4921. */
  4922. function clearJyJcItem() {
  4923. $("#update_ori_code").val(null);
  4924. $("#jcjy_update_flag").val(false);
  4925. //项目名称
  4926. $("#jcJyItem").val(null);
  4927. //当前项目编码
  4928. $("#jcjy_current_code").val(null);
  4929. //单价
  4930. $("#jcjyItemPrice").val(null);
  4931. //备注
  4932. $("#remark").val(null);
  4933. $("#jcJyZltype").val(null);
  4934. $("#jyZdSample").selectpicker('val', null);
  4935. $('#jyZdSample').selectpicker('refresh');
  4936. $("#yshPart").selectpicker('val', null);
  4937. $('#yshPart').selectpicker('refresh');
  4938. $("#execUnit").selectpicker('val', null);
  4939. $('#execUnit').selectpicker('refresh');
  4940. $("#jcJyItemChargeDetail").removeClass("in").addClass("hide");
  4941. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  4942. $("#yshPartDiv").removeClass("in").addClass("hide");
  4943. }
  4944. /**
  4945. * 清空诊疗项目
  4946. */
  4947. function clearZlItem() {
  4948. $("#update_ori_code").val(null);
  4949. $("#zl_update_flag").val(false);
  4950. //项目名称
  4951. $("#zlItem").val(null);
  4952. //当前项目编码
  4953. $("#zl_current_code").val(null);
  4954. //单价
  4955. $("#zlItemPrice").val(null);
  4956. //备注
  4957. $("#zlRemark").val(null);
  4958. //描述
  4959. $("#chargeUnit").val(null);
  4960. $("#itemQuantity").val(1);
  4961. $("#descriptions").val(null);
  4962. $("#dayZlNum").selectpicker('val', 1);
  4963. $('#dayZlNum').selectpicker('refresh');
  4964. $("#orderFrequencyZl").selectpicker('val', 'ONCE');
  4965. $('#orderFrequencyZl').selectpicker('refresh');
  4966. $("#totalNumZl").val(null);
  4967. $("#totalAmountZl").val(null);
  4968. $("#zlExecUnit").selectpicker('val', null);
  4969. $('#zlExecUnit').selectpicker('refresh');
  4970. }
  4971. /**
  4972. * 清空入院证输入框
  4973. */
  4974. function clearZyReq() {
  4975. $("#inpatientWardBeHospitalized").selectpicker('val', null);
  4976. $('#inpatientWardBeHospitalized').selectpicker('refresh');
  4977. $("#smallWardBeHospitalized").selectpicker('val', null);
  4978. $('#smallWardBeHospitalized').selectpicker('refresh');
  4979. $("#admissStatus").selectpicker('val', null);
  4980. $('#admissStatus').selectpicker('refresh');
  4981. $("#totalBedNum").val(null);
  4982. $("#freeBedNum").val(null);
  4983. $("#occupationBedNum").val(null);
  4984. initSmallDeptByDept();
  4985. }
  4986. /**
  4987. * 计算总金额
  4988. * @param needRemoveLastObject 是否需要删除最后一次加进来的项目
  4989. */
  4990. function calculateTotalAmount(needRemoveLastObject) {
  4991. //调用后去除所有的验证提示
  4992. $("div.alert ").each(function (index, obj) {
  4993. $(obj).remove();
  4994. });
  4995. var jsonData = getParamsForpPrescription(3);
  4996. $.ajax({
  4997. type: "POST",
  4998. url: '/thmz/getAmountForTempPrescription',
  4999. contentType: "application/json;charset=UTF-8",
  5000. dataType: "json",
  5001. data: JSON.stringify(jsonData),
  5002. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5003. success: function (res) {
  5004. if (res == '401' || res == 401) {
  5005. window.location.href = '/thmz/login/view'
  5006. return;
  5007. }
  5008. if (res.code == 0) {
  5009. $("#totalAmount").html(res.data.amount.toFixed(1));
  5010. var arrs = $("span.cf_amount");
  5011. for (var i = 0; i < arrs.length; i++) {
  5012. if (res.data.amountList[i] != undefined && res.data.amountList[i] != null) {
  5013. $(arrs[i]).html(res.data.amountList[i].toFixed(1));
  5014. }
  5015. }
  5016. } else {
  5017. if (needRemoveLastObject) {
  5018. var index = getIndex("bill_item_group");
  5019. var tabId = null;
  5020. //西药
  5021. if (index == 0) {
  5022. tabId = "xyTab";
  5023. } else if (index == 1) {
  5024. //中成药
  5025. tabId = "zyTab";
  5026. } else if (index == 2) {
  5027. //辅助检查、检验
  5028. tabId = "jcjyTab";
  5029. } else if (index == 3) {
  5030. //诊疗
  5031. tabId = "zlTab";
  5032. } else if (index == 4) {
  5033. //入院
  5034. tabId = "zyReqTab";
  5035. }
  5036. var tableId = $("#" + tabId + " li.active").find("a").attr("href");
  5037. var last = $(tableId).find("div:eq(0)").find("div:last");
  5038. if (last != null) {
  5039. $(last).find("i:eq(2)").click();
  5040. $(last).find("i:eq(3)").click();
  5041. }
  5042. }
  5043. errorMesage(res);
  5044. }
  5045. }
  5046. });
  5047. }
  5048. // /**
  5049. // * 打开住院处理窗口
  5050. // * @param data
  5051. // */
  5052. // function beHospitalized() {
  5053. // $("#beHospitalizedModal").modal();
  5054. // //根据病人门诊id查询病人的入院申请
  5055. // $.ajax({
  5056. // type: "GET",
  5057. // url: '/thmz/getMzZyReqByPatientId?patientId=' + $("#patientId").text(),
  5058. // contentType: "application/json;charset=UTF-8",
  5059. // dataType: "json",
  5060. // headers: {
  5061. // 'Accept': 'application/json',
  5062. // 'Authorization': 'Bearer ' + localStorage.getItem("token")
  5063. // },
  5064. // success: function (resZyz) {
  5065. // if (resZyz == '401' || resZyz == 401) {
  5066. // window.location.href = '/thmz/login/view'
  5067. // return;
  5068. // }
  5069. // if (resZyz.code == 0) {
  5070. // $("#icdCodeInputBeHospitalized").val(resZyz.data.icdCode);
  5071. // $("#icdTextBeHospitalized").val(resZyz.data.icdText);
  5072. // $("#icdTextBeHospitalized").attr("title", resZyz.data.icdText);
  5073. // $("#inpatientWardBeHospitalized").selectpicker('val', resZyz.data.reqDept);
  5074. // $("#inpatientWardBeHospitalized").selectpicker('refresh');
  5075. // initSmallDeptByDept();
  5076. // $("#smallWardBeHospitalized").selectpicker('val', resZyz.data.smallDept);
  5077. // $("#smallWardBeHospitalized").selectpicker('refresh');
  5078. // $("#admissStatus").selectpicker('val', resZyz.data.admissStatus);
  5079. // $("#admissStatus").selectpicker('refresh');
  5080. // $("#zyReqVisitDate").val(format(resZyz.data.visitDate, "yyyy-MM-dd HH:mm:ss"));
  5081. // }
  5082. // }
  5083. // });
  5084. // }
  5085. /**
  5086. * 打开编辑用户信息窗口
  5087. * @param data
  5088. * @param type 1 患者详情处编辑 2 快速接诊处编辑 3 就诊详情预览
  5089. */
  5090. function editUserModal(patientId, type) {
  5091. if (type == 3) {
  5092. $("#editUserModalTitle").html("患者档案【预览】");
  5093. $("#saveEditUser").removeClass("in").addClass("hide");
  5094. } else {
  5095. $("#editUserModalTitle").html("患者档案【修改】");
  5096. $("#saveEditUser").removeClass("hide").addClass("in");
  5097. }
  5098. $("#openSource").val(type);
  5099. if (patientId == null) {
  5100. //医生工作台发起
  5101. patientId = $("#patientId").text();
  5102. }
  5103. // else {
  5104. // //快速接诊界面发起
  5105. // clearRapidAccepts();
  5106. // }
  5107. if (patientId == null || patientId == "null" || patientId == "") {
  5108. errorMesageSimaple("请输入需要编辑的患者信息");
  5109. return;
  5110. }
  5111. $("#rapidAcceptsModal").modal("hide");
  5112. $("#visitingDetailModal").modal("hide");
  5113. $("#editUserModal").modal();
  5114. $.ajax({
  5115. type: "GET",
  5116. url: '/thmz/getByPatientId?patientId=' + patientId,
  5117. contentType: "application/json;charset=UTF-8",
  5118. dataType: "json",
  5119. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5120. success: function (res) {
  5121. if (res == '401' || res == 401) {
  5122. window.location.href = '/thmz/login/view'
  5123. return;
  5124. }
  5125. if (res.code == 0) {
  5126. if (res.data != null) {
  5127. //延时调用,因为当前弹框还没有加载出来,校验规则无法获取光标与模拟光标丢失事件,延时可以等弹框加载出来后模拟事件
  5128. setTimeout(function () {
  5129. fillPlusPatinet(res.data);
  5130. }, 400);
  5131. }
  5132. } else {
  5133. errorMesage(res);
  5134. $("#editUserModal").modal("hide");
  5135. }
  5136. }
  5137. });
  5138. }
  5139. /**
  5140. * 处方类型按钮切换事件
  5141. * @param object
  5142. * @param objectIndex
  5143. */
  5144. function billItemButtonChange(object, objectIndex) {
  5145. $(".nav-tabs").removeClass("in").addClass("hide");
  5146. $(".tab-content").removeClass("in").addClass("hide");
  5147. $(".nav-tabs:eq(" + objectIndex + ")").removeClass("hide").addClass("in");
  5148. $(".tab-content:eq(" + objectIndex + ")").removeClass("hide").addClass("in");
  5149. $("#bill_item_group").find("button").each(function (index, element) {
  5150. if ($(element).hasClass("btn-primary")) {
  5151. $(element).removeClass("btn-primary").addClass("btn-default");
  5152. }
  5153. $("#rp_form" + index).removeClass("show").addClass("hide");
  5154. });
  5155. $("#rp_form" + objectIndex).removeClass("hide").addClass("show");
  5156. $(object).removeClass("btn-default").addClass("btn-primary");
  5157. $("#western_medicine_name").webuiPopover('hide');
  5158. $("#chinese_medicine_name").webuiPopover('hide');
  5159. $("#jcJyItem").webuiPopover('hide');
  5160. $("#zlItem").webuiPopover('hide');
  5161. if (objectIndex == 0) {
  5162. $("#western_medicine_name").focus();
  5163. //有时候调用药品多了以后,会导致一个药品处方名对应多个content显现
  5164. var paneId = $("#xyTab li.active").find("a").attr("href");
  5165. if (paneId != null) {
  5166. //去除第一个字符 #
  5167. paneId = paneId.slice(1);
  5168. xyTableOnClick(paneId)
  5169. }
  5170. } else if (objectIndex == 1) {
  5171. $("#chinese_medicine_name").focus();
  5172. } else if (objectIndex == 2) {
  5173. $("#jcJyItem").focus();
  5174. } else if (objectIndex == 3) {
  5175. $("#zlItem").focus();
  5176. } else if (objectIndex == 4) {
  5177. // $("#inpatientWardBeHospitalized").next().click();
  5178. prevEleId = "zy_req_button";
  5179. }
  5180. }
  5181. /**
  5182. * 打开快速接诊窗口
  5183. * @param data
  5184. */
  5185. function rapidAcceptsModal() {
  5186. $("#rapidAcceptsModal").modal();
  5187. //延迟触发 默认光标在卡号输入框
  5188. setTimeout('$("#rapidAcceptsUserCardNo").focus();', 500);
  5189. }
  5190. /**
  5191. * checkBox样式
  5192. */
  5193. function formatCheck() {
  5194. if ($("input.flat")[0]) {
  5195. $(document).ready(function () {
  5196. $('input.flat').iCheck({
  5197. checkboxClass: 'icheckbox_flat-blue',
  5198. radioClass: 'iradio_flat-blue'
  5199. });
  5200. });
  5201. }
  5202. }
  5203. /**
  5204. * 卡号有变化后查询病人信息
  5205. */
  5206. function queryUserInfoByCardNo() {
  5207. //当反写的id不存在,说明不是查询后的改变事件,触发查询
  5208. var rapidAcceptsUserCardNo = $("#rapidAcceptsUserCardNo").val();
  5209. var index = rapidAcceptsUserCardNo.indexOf("-");
  5210. if (($("#patientIdDb").val() == null || $("#patientIdDb").val() == "") && ((index > 0 && index == rapidAcceptsUserCardNo.length - 2) || rapidAcceptsUserCardNo.length == 8)) {
  5211. $("#cardNo").attr("title", rapidAcceptsUserCardNo);
  5212. $.ajax({
  5213. type: "GET",
  5214. url: '/thmz/getByIcCardNo?icCardNo=' + rapidAcceptsUserCardNo,
  5215. contentType: "application/json;charset=UTF-8",
  5216. dataType: "json",
  5217. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5218. success: function (res) {
  5219. if (res == '401' || res == 401) {
  5220. window.location.href = '/thmz/login/view'
  5221. return;
  5222. }
  5223. if (res.code == 0) {
  5224. if (res.data != null) {
  5225. $("#rapidAcceptsUserName").val(res.data.name);
  5226. $("#rapidAcceptsUserCode").val(res.data.patientId);
  5227. $("#patientIdDb").val(res.data.patientId);
  5228. $("#rapidAcceptsUserCardNo").val(res.data.icCardNo);
  5229. $("#rapidAcceptsUserGender").selectpicker('val', res.data.sex);
  5230. $("#rapidAcceptsUserGender").selectpicker('refresh');
  5231. $("#rapidAcceptsUserPhoneNum").val(res.data.phoneNo);
  5232. $("#rapidAcceptsUserIdCard").val(res.data.socialNo);
  5233. $('#rapidAcceptsUserCertificateType').selectpicker('val', '01');
  5234. $('#rapidAcceptsUserCertificateType').selectpicker('refresh');
  5235. $("#rapidAcceptsUserIdCard").attr("title", res.data.socialNo);
  5236. $("#rapidAcceptsUserPhoneNum").attr("title", res.data.phoneNo);
  5237. $('#rapidAcceptsProvinceCode').selectpicker('val', res.data.provinceCode);
  5238. $('#rapidAcceptsProvinceCode').selectpicker('refresh');
  5239. initCity(3, res.data.cityCode);
  5240. initDistrict(3, res.data.cityCode, res.data.districtCode);
  5241. $("#rapidAcceptsDetail").val(res.data.detail);
  5242. $("#rapidAcceptsUserAddress").attr("title", res.data.address);
  5243. $("#rapidAcceptsUserAddress").val(res.data.address);
  5244. $("#rapidAcceptsUserContact").val(res.data.relName);
  5245. $("#rapidAcceptsUserContactPhone").val(res.data.contractName);
  5246. //查询分诊号
  5247. $.ajax({
  5248. type: "POST",
  5249. url: '/thmz/getUnClinicWithPage',
  5250. contentType: "application/json;charset=UTF-8",
  5251. dataType: "json",
  5252. data: JSON.stringify({"patientId": res.data.patientId}),
  5253. headers: {
  5254. 'Accept': 'application/json',
  5255. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  5256. },
  5257. success: function (resFz) {
  5258. if (resFz == '401' || resFz == 401) {
  5259. window.location.href = '/thmz/login/view'
  5260. return;
  5261. }
  5262. if (resFz.code == 0) {
  5263. if (resFz.data == null || resFz.data.length == 0) {
  5264. errorMesageSimaple("没有查询到符合条件的分诊记录!");
  5265. clearRapidAcceptsModal();
  5266. return;
  5267. }
  5268. $("#mzfzSerialNo").val(resFz.data[0].serialNo);
  5269. }
  5270. }
  5271. });
  5272. } else {
  5273. errorMesageSimaple("病人信息不存在!");
  5274. }
  5275. } else {
  5276. errorMesage(res);
  5277. }
  5278. }
  5279. });
  5280. }
  5281. }
  5282. /**
  5283. * 清空快速接诊查询框
  5284. */
  5285. function clearRapidAccepts() {
  5286. $("#rapidAcceptsUserName").val(null);
  5287. $("#rapidAcceptsUserCode").val(null);
  5288. $("#patientIdDb").val(null);
  5289. $("#rapidAcceptsUserCardNo").val(null);
  5290. $("#rapidAcceptsUserGender").selectpicker('val', 0);
  5291. $("#rapidAcceptsUserGender").selectpicker('refresh');
  5292. $("#rapidAcceptsUserPhoneNum").val(null);
  5293. $("#rapidAcceptsUserIdCard").val(null);
  5294. $("#rapidAcceptsUserIdCard").attr("title", null);
  5295. $("#rapidAcceptsUserPhoneNum").attr("title", null);
  5296. $("#rapidAcceptsUserAddress").attr("title", null);
  5297. $("#mzfzSerialNo").val(null);
  5298. $("#rapidAcceptsUserCardNo").focus();
  5299. $("#rapidAcceptsUserAddress").val(null);
  5300. $("#rapidAcceptsUserContact").val(null);
  5301. $("#rapidAcceptsUserContactPhone").val(null);
  5302. }
  5303. /**
  5304. * 根据病人姓名输入框内容动态加载病人列表
  5305. */
  5306. function initUserList() {
  5307. //var width=$("#userName").css("width");
  5308. var settings = {
  5309. trigger: 'click',
  5310. content: '',
  5311. width: 170,
  5312. multi: true,
  5313. closeable: false,
  5314. style: '',
  5315. delay: 300,
  5316. padding: true,
  5317. height: 300,
  5318. };
  5319. var webuiPopover = $('#rapidAcceptsUserName').webuiPopover('destroy').webuiPopover(settings);
  5320. //用户姓名选中事件
  5321. $("#rapidAcceptsUserName").on("click", function (t) {
  5322. if ($(webuiPopover).css("display") == "block") {
  5323. refeshPatinetList(true);
  5324. }
  5325. });
  5326. }
  5327. /**
  5328. * 刷新候诊病人列表
  5329. */
  5330. function refeshPatinetList(flag) {
  5331. //如果是重新加载病人列表,需要重置下标
  5332. if (flag) {
  5333. //重置下标
  5334. pageIndex = 0;
  5335. msg_list_loading = true;
  5336. }
  5337. var userName = $('#rapidAcceptsUserName').val();
  5338. if (!(userName == null || userName == "" || isChinese(userName))) {
  5339. return;
  5340. }
  5341. $.ajax({
  5342. type: "POST",
  5343. url: '/thmz/getUnClinicWithPage',
  5344. contentType: "application/json;charset=UTF-8",
  5345. dataType: "json",
  5346. data: JSON.stringify({"name": userName, "pageIndex": pageIndex}),
  5347. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5348. success: function (res) {
  5349. if (res == '401' || res == 401) {
  5350. window.location.href = '/thmz/login/view'
  5351. return;
  5352. }
  5353. if (res.code == 0) {
  5354. if (res.data != null && res.data.length > 0) {
  5355. $("#webuiPopover0").css("display", "block");
  5356. $("#webuiPopover0 .webui-popover-content").css("max-height", "300px").css("height", "auto");
  5357. var html = '<div class="list-group">';
  5358. for (var i = 0; i < res.data.length; i++) {
  5359. var mzPatientMi = res.data[i];
  5360. html += '<a href="#" class="list-group-item list-group-item-action" onclick="fillUnClinicPatinet(\'' + mzPatientMi.patientId + '\')">';
  5361. if (mzPatientMi.gender == "男") {
  5362. html += '<img src="/thmz/images/boy.png"/>'
  5363. } else if (mzPatientMi.gender == "女") {
  5364. html += '<img src="/thmz/images/girl.png"/>'
  5365. } else if (mzPatientMi.gender == "未知" || mzPatientMi.gender == null) {
  5366. html += '<img src="/thmz/images/girl_or_boy.png"/>'
  5367. }
  5368. html += '<div>' + mzPatientMi.name + '&nbsp;' + mzPatientMi.gender + '&nbsp;';
  5369. html += mzPatientMi.ageString;
  5370. if (mzPatientMi.phoneNo != null && mzPatientMi.phoneNo != "") {
  5371. html += '<span>' + mzPatientMi.phoneNo + '</span>';
  5372. }
  5373. html += '</div></a>';
  5374. }
  5375. html += '</div>';
  5376. if (flag) {
  5377. $("#webuiPopover0 div.webui-popover-content").html("");
  5378. }
  5379. $("#webuiPopover0 div.webui-popover-content").append(html);
  5380. $("#webuiPopover0 div.arrow").css("left", "23px");
  5381. refeshPatinetListScrollEvent();
  5382. } else {
  5383. $("#webuiPopover0").css("display", "none");
  5384. }
  5385. }
  5386. //查询完成,设置加载完成
  5387. msg_list_loading = false;
  5388. }
  5389. });
  5390. }
  5391. /**
  5392. * 病人下拉列表滚动条滚动到底部时继续加载新纪录
  5393. */
  5394. function refeshPatinetListScrollEvent() {
  5395. $('.webui-popover-content').scroll(function (event) {
  5396. var top = $(this).scrollTop();
  5397. var height = $(this).height();
  5398. var scrollHeight = $(this).get(0).scrollHeight;
  5399. if (scrollHeight <= top + height) {
  5400. if (!msg_list_loading) {
  5401. msg_list_loading = true;
  5402. pageIndex = pageIndex + 1;
  5403. refeshPatinetList(false);
  5404. }
  5405. }
  5406. });
  5407. }
  5408. /**
  5409. * 按照病人id查询病人信息
  5410. * @param patientId
  5411. */
  5412. function fillUnClinicPatinet(patientId) {
  5413. $("#rapidAcceptsUserCardNo").val(patientId);
  5414. $("#webuiPopover0").css("display", "none");
  5415. queryUserInfoByCardNo();
  5416. }
  5417. /**
  5418. * 加载主诉,体格检查,诊断窗口
  5419. */
  5420. function initRecommendList() {
  5421. var width = $("#symptom").parent().css("width");
  5422. var settings = {
  5423. placement: 'bottom-right',//值: auto,top,right,bottom,left,top-right,top-left,bottom-right,bottom-left 要显示的位置
  5424. trigger: 'click', //值:click,hover 触发方式 manual 手动
  5425. content: '',//内容,内容可以是函数
  5426. width: width,
  5427. //arrow:false,//是否显示箭头
  5428. multi: true,//在页面允许其他弹出层
  5429. closeable: true,//显示关闭按钮
  5430. style: '', //值:'',inverse
  5431. delay: 300,//延迟时间, 悬浮属性才执行
  5432. padding: true,//内容填充
  5433. height: 320,
  5434. //offsetTop:10,
  5435. cache: true,//如果缓存设置为false,则popover将销毁并重新创建
  5436. };
  5437. //主诉弹窗
  5438. var symptomWebuiPopover = $('#symptom').webuiPopover('destroy').webuiPopover(settings);
  5439. //体格检查弹窗
  5440. settings.height = 260;
  5441. $('#weight').webuiPopover('destroy').webuiPopover(settings);
  5442. //诊断弹窗
  5443. settings.height = 320;
  5444. var diagnoseWebuiPopover = $('#diagnose').webuiPopover('destroy').webuiPopover(settings);
  5445. //西药弹窗
  5446. settings.width = 680;
  5447. settings.closeable = false;
  5448. settings.arrow = false;//显示箭头或不显示箭头
  5449. settings.content = '<div id="westernMedicinePopoverContent"><table id="tb_table_western_medicine"></table></div>';
  5450. //手动触发
  5451. settings.trigger = 'manual';
  5452. var westernMedicineWebuiPopover = $('#western_medicine_name').webuiPopover('destroy').webuiPopover(settings);
  5453. //中药弹窗
  5454. settings.trigger = 'click';
  5455. settings.content = '<div id="chineseMedicinePopoverContent"><table id="tb_table_chinese_medicine"></table></div>';
  5456. //手动触发
  5457. settings.trigger = 'manual';
  5458. var chineseMedicineWebuiPopover = $('#chinese_medicine_name').webuiPopover('destroy').webuiPopover(settings);
  5459. //辅助检查、检验弹窗
  5460. settings.trigger = 'manual';
  5461. settings.content = '<div id="jcJyItemPopoverContent"><table id="tb_table_jc_jy_item"></table></div>';
  5462. var jcJyItemWebuiPopover = $('#jcJyItem').webuiPopover('destroy').webuiPopover(settings);
  5463. //诊疗弹窗
  5464. settings.trigger = 'manual';
  5465. settings.content = '<div id="zlItemPopoverContent"><table id="tb_table_zl_item"></table></div>';
  5466. var zlItemWebuiPopover = $('#zlItem').webuiPopover('destroy').webuiPopover(settings);
  5467. //主诉选中事件
  5468. $("#symptom").on("click", function (t) {
  5469. if ($(symptomWebuiPopover).css("display") == "block") {
  5470. $("#webuiPopover1 div.arrow").css("left", "23px");
  5471. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">主诉</span>';
  5472. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='contentHtml'>";
  5473. html += "</div>";
  5474. html += '<div style="height: 60px; line-height: 60px; font-size: 14px;">' +
  5475. '<div style="float: left">' +
  5476. '<span style="margin-left: 20px;">内容:</span> ' +
  5477. '</div>' +
  5478. '<div style="float: left;">' +
  5479. '<select class="form-control selectpicker show-tick" id="paramsType" dropupAuto="true">' +
  5480. '<option label="常用症状" value="0">常用症状</option>' +
  5481. '<option label="常用时间" value="1">常用时间</option>' +
  5482. '<option label="常用标点" value="2">常用标点</option>' +
  5483. '<option label="常用词" value="3">常用词</option>' +
  5484. '</select> ' +
  5485. '</div>' +
  5486. '<div style="width: 200px;float: left;margin-left: 10px;">' +
  5487. '<input id="paramsNameInput" class="form-control" type="text" style="position: relative;top: 13px;height: 34px;">' +
  5488. '</div>' +
  5489. '<div style="float: left;margin-left: 10px;">' +
  5490. ' <button type="button" class="btn" onclick="saveParams();"' +
  5491. ' style="height: 30px;line-height: 15px;border-color: #2e69eb!important;color: #2e69eb;background-color: white;">' +
  5492. ' <svg class="bi" width="1em" height="1em" fill="currentColor" style="vertical-align: -.15em;margin-right: 10px!important;color: #2e69eb;">' +
  5493. ' <use xlink:href="/thmz/css/bootstrap/bootstrap-icons-1.5.0/bootstrap-icons.svg#plus-circle"></use>' +
  5494. ' </svg>' +
  5495. '新增' +
  5496. ' </button>' +
  5497. ' </div>' +
  5498. '</div>';
  5499. $("#webuiPopover1 div.webui-popover-content").html(html);
  5500. $('#paramsType').selectpicker('refresh');
  5501. $("#paramsType").parent().css("width", "140px").css("height", "34px");
  5502. $("#webuiPopover1").css("z-index", "10");
  5503. if ($("#webuiPopover1").hasClass("in")) {
  5504. loadSymptom();
  5505. }
  5506. }
  5507. //加载智能接诊模块的主诉推荐
  5508. fitSymptomData();
  5509. });
  5510. //体格检查各输入框选中事件
  5511. $("#weight,#temperature,#sphygmus,#breathe,#pressure_high,#pressure_floor,#pressure_high_left,#pressure_floor_left").on("click", function (t) {
  5512. if ($("#webuiPopover2").css("display") == "block") {
  5513. $("#webuiPopover2").css("left", $("#webuiPopover1").css("left"));
  5514. if ($("#healthCheckupContentHtml").html() == null || $("#healthCheckupContentHtml").html() == "") {
  5515. $("#webuiPopover2 div.arrow").css("left", "23px");
  5516. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">体格检查</span>';
  5517. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='healthCheckupContentHtml'>";
  5518. html += "</div>";
  5519. $("#webuiPopover2 div.webui-popover-content").html(html);
  5520. $("#webuiPopover2").css("z-index", "10");
  5521. if ($("#webuiPopover2").hasClass("in")) {
  5522. loadHealthCheckup();
  5523. }
  5524. }
  5525. //loadSymptom();
  5526. } else {
  5527. $('#weight').webuiPopover('show');
  5528. $("#webuiPopover2").css("left", $("#webuiPopover1").css("left"));
  5529. if ($("#healthCheckupContentHtml").html() == null || $("#healthCheckupContentHtml").html() != "") {
  5530. $("#webuiPopover2 div.arrow").css("left", "23px");
  5531. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">体格检查</span>';
  5532. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='healthCheckupContentHtml'>";
  5533. html += "</div>";
  5534. $("#webuiPopover2 div.webui-popover-content").html(html);
  5535. $("#webuiPopover2").css("z-index", "10");
  5536. if ($("#webuiPopover2").hasClass("in")) {
  5537. loadHealthCheckup();
  5538. }
  5539. }
  5540. }
  5541. return false;
  5542. });
  5543. //诊断选中事件
  5544. $("#diagnose").on("click", function (t) {
  5545. if ($(diagnoseWebuiPopover).css("display") == "block") {
  5546. $("#webuiPopover3 div.arrow").css("left", "23px");
  5547. $("#webuiPopover3 a.close").css("margin-top", "15px");
  5548. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">诊断</span>';
  5549. html += '<div class="form-group has-feedback" style="float: right;width: 300px;margin-right: 20px;margin-top: 10px;">' +
  5550. ' <input type="text" class="form-control has-feedback-left" ' +
  5551. ' placeholder="搜索" style="padding-left: 10px;" onkeyup="debounce(loadDiagnose(this.value),100,true)" id="paramsDiagnose">' +
  5552. ' <span class="fa fa-search form-control-feedback right" aria-hidden="true" style="right: 0px;"></span>' +
  5553. ' </div>';
  5554. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='diagnoseContentHtml'>";
  5555. html += "</div>";
  5556. $("#webuiPopover3 div.webui-popover-content").html(html);
  5557. $("#webuiPopover3").css("z-index", "10");
  5558. //$("#paramsDiagnose").on('input propertychange', loadDiagnose($("#paramsDiagnose").val()));
  5559. //中文会导致查询混乱
  5560. $("#paramsDiagnose").on('compositionstart', function () {
  5561. $("#paramsDiagnose").attr("isNeedPrevent", true);
  5562. });
  5563. $("#paramsDiagnose").on('compositionend', function () {
  5564. $("#paramsDiagnose").attr("isNeedPrevent", false);
  5565. });
  5566. loadDiagnose("");
  5567. }
  5568. //加载智能接诊模块的诊断推荐推荐
  5569. fitDiagnoseData();
  5570. });
  5571. //现病史选中事件
  5572. $("#emrHpi").on("click", function (t) {
  5573. //加载智能接诊模块的现病史推荐推荐
  5574. fitEmrHpiData();
  5575. });
  5576. //既往史选中事件
  5577. $("#emrPs").on("click", function (t) {
  5578. //加载智能接诊模块的既往史推荐推荐
  5579. fitEmrPsData();
  5580. });
  5581. // //西药选中事件
  5582. // $("#western_medicine_name").on("click", function (t) {
  5583. // if ($(westernMedicineWebuiPopover).css("display") == "block") {
  5584. // $("#westernMedicinePopoverContent").parent().parent().prev().css("left", "23px");
  5585. // loadYpList(0);
  5586. // }
  5587. // });
  5588. // //中药选中事件
  5589. // $("#chinese_medicine_name").on("click", function (t) {
  5590. // if ($(chineseMedicineWebuiPopover).css("display") == "block") {
  5591. // $("#chineseMedicinePopoverContent").parent().parent().prev().css("left", "23px");
  5592. // loadYpList(1);
  5593. // }
  5594. // });
  5595. // //诊疗与医技弹窗选中事件
  5596. // $("#jcJyItem").on("click", function (t) {
  5597. // if ($(jcJyItemWebuiPopover).css("display") == "block") {
  5598. // $("#jcJyItemPopoverContent").parent().parent().prev().css("left", "23px");
  5599. // loadjcJyItemList();
  5600. // }
  5601. // });
  5602. //帮助字典弹窗
  5603. settings.width = 450;
  5604. settings.height = 500;
  5605. settings.placement = 'right';//值: auto,top,right,bottom,left,top-right,top-left,bottom-right,bottom-left 要显示的位置
  5606. settings.content = '<div id="treePopoverContent"><div><ul id="treeDemo" class="ztree"></ul></div></div>';
  5607. settings.trigger = 'click';
  5608. var treeWebuiPopover = $('#treeButton').webuiPopover('destroy').webuiPopover(settings);
  5609. $("#treeButton").on("click", function (t) {
  5610. // $("#treePopoverContent").parent().parent().prev().css("left", "23px");
  5611. //初始化药品,检查检验菜单树
  5612. initzTree();
  5613. });
  5614. }
  5615. /**
  5616. * 新增通用参数
  5617. */
  5618. function saveParams() {
  5619. $.ajax({
  5620. type: "POST",
  5621. url: '/thmz/saveTCommonParams',
  5622. contentType: "application/json;charset=UTF-8",
  5623. dataType: "json",
  5624. data: JSON.stringify({
  5625. "paramsType": $("#paramsType").val(),
  5626. "paramsName": $("#paramsNameInput").val()
  5627. }),
  5628. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5629. success: function (res) {
  5630. if (res == '401' || res == 401) {
  5631. window.location.href = '/thmz/login/view'
  5632. return;
  5633. }
  5634. if (res.code == 0) {
  5635. successMesage(res);
  5636. loadSymptom();
  5637. $("#paramsNameInput").val(null);
  5638. // $("#paramsType").selectpicker('val', 0);
  5639. // $("#paramsType").selectpicker('refresh');
  5640. } else {
  5641. errorMesage(res);
  5642. }
  5643. }
  5644. });
  5645. }
  5646. /**
  5647. * 加载主诉参数列表
  5648. */
  5649. function loadSymptom() {
  5650. $.ajax({
  5651. type: "GET",
  5652. url: '/thmz/loadSymptom',
  5653. contentType: "application/json;charset=UTF-8",
  5654. dataType: "json",
  5655. async: false,
  5656. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5657. success: function (res) {
  5658. if (res == '401' || res == 401) {
  5659. window.location.href = '/thmz/login/view'
  5660. return;
  5661. }
  5662. var html = '';
  5663. if (res.code == 0) {
  5664. if (res.featureList != null && res.featureList.length > 0) {
  5665. html += '<div id="feature">';
  5666. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用症状:</div>';
  5667. html += '<div style="width: calc(100% - 80px); float: left;">';
  5668. for (var i = 0; i < res.featureList.length; i++) {
  5669. 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;">';
  5670. html += res.featureList[i].paramsName;
  5671. html += '</span></button>';
  5672. }
  5673. html += '</div><div style="clear:both"></div></div>';
  5674. }
  5675. if (res.timeList != null && res.timeList.length > 0) {
  5676. html += '<div id="time">';
  5677. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用时间:</div>';
  5678. html += '<div style="width: calc(100% - 80px); float: left;">';
  5679. for (var i = 0; i < res.timeList.length; i++) {
  5680. 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;">';
  5681. html += res.timeList[i].paramsName;
  5682. html += '</span></button>';
  5683. }
  5684. html += '</div><div style="clear:both"></div></div>';
  5685. }
  5686. if (res.characterList != null && res.characterList.length > 0) {
  5687. html += '<div id="character">';
  5688. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用标点:</div>';
  5689. html += '<div style="width: calc(100% - 80px); float: left;">';
  5690. for (var i = 0; i < res.characterList.length; i++) {
  5691. 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;">';
  5692. html += res.characterList[i].paramsName;
  5693. html += '</span></button>';
  5694. }
  5695. html += '</div><div style="clear:both"></div></div>';
  5696. }
  5697. if (res.wordsList != null && res.wordsList.length > 0) {
  5698. html += '<div id="words">';
  5699. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用词:</div>';
  5700. html += '<div style="width: calc(100% - 80px); float: left;">';
  5701. for (var i = 0; i < res.wordsList.length; i++) {
  5702. 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;">';
  5703. html += res.wordsList[i].paramsName;
  5704. html += '</span></button>';
  5705. }
  5706. html += '</div><div style="clear:both"></div></div>';
  5707. }
  5708. } else {
  5709. errorMesage(res);
  5710. }
  5711. $("#contentHtml").html(html);
  5712. }
  5713. });
  5714. }
  5715. /**
  5716. * 加载体格检查参数列表
  5717. */
  5718. function loadHealthCheckup() {
  5719. $.ajax({
  5720. type: "GET",
  5721. url: '/thmz/loadHealthCheckup',
  5722. contentType: "application/json;charset=UTF-8",
  5723. dataType: "json",
  5724. async: false,
  5725. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5726. success: function (res) {
  5727. if (res == '401' || res == 401) {
  5728. window.location.href = '/thmz/login/view'
  5729. return;
  5730. }
  5731. var html = '';
  5732. if (res.code == 0) {
  5733. if (res.weightList != null && res.weightList.length > 0) {
  5734. html += '<div id="weightDiv">';
  5735. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">体重:</div>';
  5736. html += '<div style="width: calc(100% - 80px); float: left;">';
  5737. for (var i = 0; i < res.weightList.length; i++) {
  5738. 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;">';
  5739. html += res.weightList[i].paramsName;
  5740. html += '</span></button>';
  5741. }
  5742. html += '</div><div style="clear:both"></div></div>';
  5743. }
  5744. if (res.temperatureList != null && res.temperatureList.length > 0) {
  5745. html += '<div id="temperatureDiv">';
  5746. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">体温:</div>';
  5747. html += '<div style="width: calc(100% - 80px); float: left;">';
  5748. for (var i = 0; i < res.temperatureList.length; i++) {
  5749. 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;">';
  5750. html += res.temperatureList[i].paramsName;
  5751. html += '</span></button>';
  5752. }
  5753. html += '</div><div style="clear:both"></div></div>';
  5754. }
  5755. if (res.sphygmusList != null && res.sphygmusList.length > 0) {
  5756. html += '<div id="sphygmusDiv">';
  5757. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">脉搏:</div>';
  5758. html += '<div style="width: calc(100% - 80px); float: left;">';
  5759. for (var i = 0; i < res.sphygmusList.length; i++) {
  5760. 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;">';
  5761. html += res.sphygmusList[i].paramsName;
  5762. html += '</span></button>';
  5763. }
  5764. html += '</div><div style="clear:both"></div></div>';
  5765. }
  5766. if (res.breatheList != null && res.breatheList.length > 0) {
  5767. html += '<div id="breatheDiv">';
  5768. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">呼吸:</div>';
  5769. html += '<div style="width: calc(100% - 80px); float: left;">';
  5770. for (var i = 0; i < res.breatheList.length; i++) {
  5771. 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;">';
  5772. html += res.breatheList[i].paramsName;
  5773. html += '</span></button>';
  5774. }
  5775. html += '</div><div style="clear:both"></div></div>';
  5776. }
  5777. if (res.pressureList != null && res.pressureList.length > 0) {
  5778. html += '<div id="pressureDiv">';
  5779. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">血压:</div>';
  5780. html += '<div style="width: calc(100% - 80px); float: left;">';
  5781. for (var i = 0; i < res.pressureList.length; i++) {
  5782. 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;">';
  5783. html += res.pressureList[i].paramsName;
  5784. html += '</span></button>';
  5785. }
  5786. html += '</div><div style="clear:both"></div></div>';
  5787. }
  5788. } else {
  5789. errorMesage(res);
  5790. }
  5791. $("#healthCheckupContentHtml").html(html);
  5792. }
  5793. });
  5794. }
  5795. /**
  5796. * 加载诊断参数列表
  5797. * @param value
  5798. */
  5799. function loadDiagnose(value) {
  5800. if (!$("#webuiPopover3").hasClass("in")) {
  5801. return;
  5802. }
  5803. var isNeedPrevent = $("#paramsDiagnose").attr("isNeedPrevent");
  5804. if (isNeedPrevent == "true") {
  5805. return;
  5806. }
  5807. $.ajax({
  5808. type: "GET",
  5809. url: '/thmz/getIcdCodeByParams?commonParams=' + value,
  5810. contentType: "application/json;charset=UTF-8",
  5811. dataType: "json",
  5812. async: false,
  5813. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5814. success: function (res) {
  5815. if (res == '401' || res == 401) {
  5816. window.location.href = '/thmz/login/view'
  5817. return;
  5818. }
  5819. var html = '';
  5820. if (res.code == 0) {
  5821. if (res.data != null && res.data.length > 0) {
  5822. html += '<div>';
  5823. for (var i = 0; i < res.data.length; i++) {
  5824. html += '<button type="button" class="button_color" style="background-color: rgb(255, 255, 255);border: none;" onclick="fitDiagnoseValue(\'' + res.data[i].name + '\',\'' + res.data[i].code + '\')"><span style="padding: 0px 5px;font-size: 20px;">';
  5825. html += res.data[i].name;
  5826. html += '<small>&nbsp;&nbsp;(' + res.data[i].code + ')</small>';
  5827. html += '</span></button>';
  5828. }
  5829. html += '</div>';
  5830. }
  5831. } else {
  5832. errorMesage(res);
  5833. }
  5834. $("#diagnoseContentHtml").html(html);
  5835. }
  5836. });
  5837. }
  5838. /**
  5839. * 填充诊断
  5840. * @param value
  5841. * @param code
  5842. */
  5843. function fitDiagnoseValue(value, code) {
  5844. if (code === null || code === "") {
  5845. return;
  5846. }
  5847. var html = '';
  5848. var childrenNum = $("#diagnoseTags").children().length;
  5849. if (childrenNum == 6) {
  5850. errorMesageSimaple("最多填写六个诊断!");
  5851. return;
  5852. }
  5853. var diagnoseValue = $("#diagnoseValue").val();
  5854. if (diagnoseValue == null || diagnoseValue == "") {
  5855. diagnoseValue = code;
  5856. } else {
  5857. if (diagnoseValue.indexOf(code) != -1) {
  5858. errorMesageSimaple("诊断已存在,请勿重复添加!");
  5859. return;
  5860. }
  5861. diagnoseValue += "," + code;
  5862. }
  5863. $("#diagnoseValue").val(diagnoseValue);
  5864. if (childrenNum == 0) {
  5865. html += '<span class="el-tag--mainDiagnosis" ';
  5866. } else {
  5867. html += '<span class="el-tag--secondaryDiagnosis" ';
  5868. }
  5869. 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>';
  5870. $("#diagnoseTags").append(html);
  5871. $("#diagnoseTags").parent().parent().css("height", $("#diagnoseTags").height());
  5872. }
  5873. /**
  5874. * 移除诊断
  5875. * @param code
  5876. */
  5877. function removeDiagnoseValue(code) {
  5878. var childrenIndex = 0;
  5879. var children = $("#diagnoseTags").children();
  5880. for (var i = 0; i < children.length; i++) {
  5881. if ($(children[i]).attr("id") == code) {
  5882. childrenIndex = i;
  5883. break;
  5884. }
  5885. }
  5886. $($("#diagnoseTags").children("span")[childrenIndex]).remove();
  5887. if (childrenIndex == 0) {
  5888. $($("#diagnoseTags").children("span")[childrenIndex]).removeClass("el-tag--secondaryDiagnosis").addClass("el-tag--mainDiagnosis");
  5889. }
  5890. var diagnoseValue = $("#diagnoseValue").val();
  5891. $("#diagnoseValue").val(diagnoseValue.replace(code, ""));
  5892. $("#diagnoseTags").parent().parent().css("height", $("#diagnoseTags").height());
  5893. }
  5894. /**
  5895. * 点击通用参数属性值时设置值到对应的区域
  5896. * @param value
  5897. * @param id
  5898. */
  5899. function fitValue(value, id) {
  5900. //当选择的是血压时
  5901. if (id == "pressure_") {
  5902. var arr = value.split("/");
  5903. $("#pressure_high").val(arr[0]);
  5904. $("#pressure_floor").val(arr[1]);
  5905. if ($("#pressureLeftFlag").hasClass("in")) {
  5906. $("#pressure_high_left").val(arr[0]);
  5907. $("#pressure_floor_left").val(arr[1]);
  5908. }
  5909. //当选的是体重,体温,脉搏和呼吸时
  5910. } else if (id == "weight" || id == "temperature" || id == "sphygmus" || id == "breathe") {
  5911. $("#" + id).val(value);
  5912. } else {
  5913. //主诉拼写时
  5914. var valueExist = $("#" + id).val();
  5915. if (valueExist != null && valueExist != "") {
  5916. value = valueExist + value;
  5917. }
  5918. $("#" + id).val(value);
  5919. }
  5920. }
  5921. /**
  5922. * 加载药品列表数列表
  5923. * @param index
  5924. */
  5925. function loadYpList(index, event) {
  5926. if (event != null) {
  5927. if (event.keyCode == 38 || event.keyCode == 40 || event.keyCode == 13) {
  5928. //上下键不刷新表格
  5929. return;
  5930. }
  5931. }
  5932. var medicinePopoverContent = null;
  5933. var tableMedicine = null;
  5934. var MedicineName = null;
  5935. //var groupNo=null;
  5936. if (index == 0) {
  5937. medicinePopoverContent = "westernMedicinePopoverContent";
  5938. tableMedicine = "tb_table_western_medicine";
  5939. MedicineName = "western_medicine_name";
  5940. // groupNo=71;
  5941. }
  5942. if (index == 1) {
  5943. medicinePopoverContent = "chineseMedicinePopoverContent";
  5944. tableMedicine = "tb_table_chinese_medicine";
  5945. MedicineName = "chinese_medicine_name";
  5946. // groupNo=$("#zyClassType").val();
  5947. }
  5948. // if (!$("#" + medicinePopoverContent).parent().parent().parent().hasClass("in")) {
  5949. // return;
  5950. // }
  5951. $('#' + MedicineName).webuiPopover('show');
  5952. $('#' + tableMedicine).bootstrapTable('refresh');
  5953. $('#' + tableMedicine).bootstrapTable({
  5954. url: '/thmz/getYpListByCommonParams', //请求后台的URL(*)
  5955. method: 'GET', //请求方式(*)
  5956. toolbar: '#toolbar', //工具按钮用哪个容器
  5957. striped: true, //是否显示行间隔色
  5958. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  5959. pagination: false, //是否显示分页(*)
  5960. sortable: true, //是否启用排序
  5961. sortOrder: "asc", //排序方式
  5962. queryParams: function (params) {
  5963. var groupNo = null;
  5964. if (index == 0) {
  5965. groupNo = 71;
  5966. }
  5967. if (index == 1) {
  5968. groupNo = $("#zyClassType").val();
  5969. }
  5970. var temp = {
  5971. groupNo: groupNo,
  5972. commonParams: $("#" + MedicineName).val()
  5973. };
  5974. return temp;
  5975. }, //传递参数(*)
  5976. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  5977. pageNumber: 1, //初始化加载第一页,默认第一页
  5978. pageSize: 5, //每页的记录行数(*)
  5979. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  5980. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  5981. strictSearch: true,
  5982. showColumns: false, //是否显示所有的列
  5983. showRefresh: false, //是否显示刷新按钮
  5984. minimumCountColumns: 2, //最少允许的列数
  5985. clickToSelect: true, //是否启用点击选中行
  5986. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  5987. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  5988. cardView: false, //是否显示详细视图
  5989. detailView: false,
  5990. //rowStyle:rowStyle,//通过自定义函数设置行样式
  5991. ajaxOptions: {
  5992. headers: {
  5993. 'Accept': 'application/json',
  5994. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  5995. }
  5996. },
  5997. columns: [
  5998. {
  5999. field: 'code',
  6000. title: '编码',
  6001. align: "center",
  6002. valign: 'middle',
  6003. // sortable: true
  6004. }, {
  6005. field: 'name',
  6006. title: '药品名称',
  6007. align: "center",
  6008. valign: 'middle',
  6009. // sortable: true
  6010. }
  6011. , {
  6012. field: 'specification',
  6013. title: '规格',
  6014. align: "center",
  6015. valign: 'middle',
  6016. // sortable: true
  6017. }, {
  6018. field: 'manufactory',
  6019. title: '生产厂家',
  6020. align: "center",
  6021. valign: 'middle',
  6022. // sortable: true
  6023. }, {
  6024. field: 'miniUnitName',
  6025. title: '单位',
  6026. align: "center",
  6027. valign: 'middle',
  6028. // sortable: true
  6029. }, {
  6030. field: 'chargeAmount',
  6031. title: '零售价',
  6032. align: "center",
  6033. valign: 'middle',
  6034. // sortable: true
  6035. formatter: function (value, row, index) {
  6036. if (value == null) {
  6037. return '0.0元';
  6038. }
  6039. return value.toFixed(2) + "元";
  6040. }
  6041. }, {
  6042. field: 'drugWinDesc',
  6043. title: '剂量',
  6044. align: "center",
  6045. valign: 'middle',
  6046. // sortable: true
  6047. }, {
  6048. field: 'stockAmountVirtual',
  6049. title: '库存数量',
  6050. align: "center",
  6051. valign: 'middle',
  6052. // sortable: true
  6053. }
  6054. ],
  6055. responseHandler: function (res) {
  6056. if (res == '401' || res == 401) {
  6057. window.location.href = '/thmz/login/view'
  6058. return;
  6059. }
  6060. var ress = eval(res);
  6061. if (ress.code == -1) {
  6062. errorMesage(res);
  6063. return {
  6064. "total": 0,//总页数
  6065. "rows": {} //数据
  6066. };
  6067. }
  6068. $("#" + medicinePopoverContent).parent().css("background", "#EBEBE4");
  6069. return {
  6070. "total": ress.data.length,//总页数
  6071. "rows": ress.data //数据
  6072. };
  6073. },
  6074. onClickRow: function (row, $element) {
  6075. $('#' + MedicineName).webuiPopover('hide');
  6076. if (index == 0) {
  6077. clearWesternMedicine(false);
  6078. checkYpInfo(row.code, row.serial, row.ypType, true, null);
  6079. }
  6080. if (index == 1) {
  6081. checkZyInfo(row.code, row.serial, true);
  6082. }
  6083. }
  6084. });
  6085. }
  6086. /**
  6087. * 按照药品的编码 和药品拆零规格查询药品信息 西药
  6088. * @param code
  6089. * @param serial
  6090. * @param groupNo
  6091. * @param needNotice 是否需要提示 当用户操作的时候 true 需要提示, 范文和处方回写的时候false不需要提示
  6092. * @param orderNo 处方号,回写的时候需要用,因为有的处方没有满5个
  6093. */
  6094. function checkYpInfo(code, serial, groupNo, needNotice, orderNo) {
  6095. //判断是否有重复的项目 返回true 说明有重复的
  6096. if (verifyRepeat(code, serial, null, 0)) {
  6097. return;
  6098. }
  6099. $("#current_groupNo").val(groupNo);
  6100. //不需要每次都关闭这个帮助字典
  6101. //$("#treeButton").webuiPopover('hide');
  6102. $.ajax({
  6103. type: "GET",
  6104. url: '/thmz/getYpZdDictByCodeAndSerial?code=' + code + "&serial=" + serial + "&deptNo=" + localStorage.getItem("currentDeptNo"),
  6105. contentType: "application/json;charset=UTF-8",
  6106. dataType: "json",
  6107. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6108. async: needNotice,//当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  6109. success: function (res) {
  6110. if (res == '401' || res == 401) {
  6111. window.location.href = '/thmz/login/view'
  6112. return;
  6113. }
  6114. if (res.code == 0) {
  6115. if (res.data != null) {
  6116. //如果
  6117. if ($("#xyTab").find("li") == null || $("#xyTab").find("li").length == 0) {
  6118. initNavTabs(0, groupNo, orderNo);
  6119. }
  6120. var cfdesc = '普药';
  6121. if (groupNo == '91') {
  6122. cfdesc = '医材';
  6123. } else if (groupNo == '111') {
  6124. cfdesc = '麻、精一';
  6125. } else if (groupNo == '131') {
  6126. cfdesc = '精二';
  6127. }
  6128. // else if(groupNo=='151'){
  6129. // cfdesc='诊疗';
  6130. // }
  6131. //每个处方不能超过5个药品
  6132. var tableId = $("#xyTab li.active").find("a").attr("href");
  6133. var childrens = $(tableId).find("div:eq(0)").children().length;
  6134. var currentGroupNo = $(tableId).find("input.current_groupNo").val();
  6135. var flag = childrens === 5;
  6136. if (!needNotice) {
  6137. flag = childrens === 5 && $(tableId).is(':last-child');
  6138. }
  6139. if (currentGroupNo != null && currentGroupNo != '' && groupNo != currentGroupNo) {
  6140. //当前编辑的处方与选中的品类非同一处方能保存的
  6141. var currentGroupNos = $("#xyTabContent").find("input.current_groupNo");
  6142. //是否需要新增处方页,以保存医材处方
  6143. var needAddTable = true;
  6144. for (var i = 0; i < currentGroupNos.length; i++) {
  6145. if ($(currentGroupNos[i]).val() == groupNo) {
  6146. var next = $(currentGroupNos[i]).next();
  6147. if (needAddTable && $(next).children().length < 5) {
  6148. var parentId = $(currentGroupNos[i]).parent().attr("id");
  6149. //切换处方
  6150. $("#xyTab").find("a[href='#" + parentId + "']").off("click").tab('show');
  6151. //$("#xyTab").find("a[href='#" + tableId + "']").off("click").click();
  6152. //因为存在没有满5个的处方页,直接保存到该页
  6153. needAddTable = false;
  6154. fitWesternMedicine(res, groupNo);
  6155. }
  6156. }
  6157. }
  6158. if (needAddTable) {
  6159. //91 医材
  6160. var message = "医材需要单独处方,是否需要新增医材处方?";
  6161. if (groupNo == '71') {
  6162. message = "普通西成药需要单独处方,是否需要新增处方?"
  6163. } else if (groupNo == '111') {
  6164. message = "麻、精一药物需要单独处方,是否需要新增处方?"
  6165. } else if (groupNo == '131') {
  6166. message = "精二药物需要单独处方,是否需要新增处方?"
  6167. }
  6168. if (needNotice) {
  6169. $("#messageModal").modal();
  6170. $("#messageContent").html(message);
  6171. $("#messageButton").off("click").on("click", function (t) {
  6172. $("#messageModal").modal("hide");
  6173. refreshNavTabs(0, groupNo, orderNo);
  6174. fitWesternMedicine(res, groupNo);
  6175. // //选中药品后,光标默认到用法
  6176. // $("#supplyType").next().click();
  6177. });
  6178. $("#cancelButton").off("click");
  6179. } else {
  6180. refreshNavTabs(0, groupNo, orderNo);
  6181. fitWesternMedicine(res, groupNo);
  6182. }
  6183. }
  6184. //当前编辑的处方非普通西药处方
  6185. } else if (flag) {
  6186. if (needNotice) {
  6187. $("#messageModal").modal();
  6188. $("#messageContent").html("单张处方最多只能开具5个药品,是否需要新增处方?");
  6189. $("#messageButton").off("click").on("click", function (t) {
  6190. $("#messageModal").modal("hide");
  6191. refreshNavTabs(0, groupNo, orderNo);
  6192. fitWesternMedicine(res, groupNo);
  6193. });
  6194. $("#cancelButton").off("click");
  6195. } else {
  6196. refreshNavTabs(0, groupNo, orderNo);
  6197. fitWesternMedicine(res, groupNo);
  6198. }
  6199. } else {
  6200. //修改药品
  6201. if (orderNo != null) {
  6202. //西药处方数量
  6203. // var xyTabLiLength = $("#xyTab li").length;
  6204. // if (xyTabLiLength < orderNo) {
  6205. //
  6206. // } else {
  6207. // $("#xyTab li.active").find("a").find("small.cfdesc").text("(" + cfdesc + ")");
  6208. // }
  6209. var tableId = orderNoAndTableIdMap.get(orderNo);
  6210. if (tableId != null && tableId != "") {
  6211. //切换处方
  6212. $("#xyTab").find("a[href='#" + tableId + "']").off("click").tab('show');
  6213. //$("#xyTab").find("a[href='#" + tableId + "']").off("click").click();
  6214. $("#xyTab li.active").find("a").find("small.cfdesc").text("(" + cfdesc + ")");
  6215. } else {
  6216. refreshNavTabs(0, groupNo, orderNo);
  6217. }
  6218. fitWesternMedicine(res, groupNo);
  6219. } else {
  6220. $("#xyTab li.active").find("a").find("small.cfdesc").text("(" + cfdesc + ")");
  6221. fitWesternMedicine(res, groupNo);
  6222. }
  6223. }
  6224. }
  6225. } else {
  6226. errorMesage(res);
  6227. }
  6228. }
  6229. });
  6230. }
  6231. /**
  6232. * 药品与项目自费信息提示
  6233. * @param res
  6234. * @param projectDesc
  6235. */
  6236. function hintProjectSelfPayInfo(selfpayProp, projectDesc) {
  6237. var zgmztczf = $("#zgmztczf").val();
  6238. if ((zgmztczf == 1 || zgmztczf == "1") && selfpayProp != null) {
  6239. selfpayProp = Number(selfpayProp);
  6240. if (selfpayProp > 0) {
  6241. var titile = "当前项目含自费" + projectDesc + ",请与患者提前确认是否继续使用,并签署自费承诺书!";
  6242. if (selfpayProp < 1) {
  6243. titile = "当前项目含部分自费" + projectDesc + ",请与患者提前确认是否继续使用,并签署自费承诺书!";
  6244. }
  6245. warningMesageSimaple(titile);
  6246. }
  6247. }
  6248. }
  6249. /**
  6250. * 按照药品的编码 和药品拆零规格查询药品信息 中药
  6251. * @param code
  6252. * @param serial
  6253. * @param async 当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  6254. */
  6255. function checkZyInfo(code, serial, async) {
  6256. //判断是否有重复的项目 返回true 说明有重复的
  6257. if (verifyRepeat(code, serial, null, 1)) {
  6258. return;
  6259. }
  6260. $.ajax({
  6261. type: "GET",
  6262. url: '/thmz/getYpZdDictByCodeAndSerial?code=' + code + "&serial=" + serial + "&deptNo=" + localStorage.getItem("currentDeptNo"),
  6263. contentType: "application/json;charset=UTF-8",
  6264. dataType: "json",
  6265. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6266. async: async,//当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  6267. success: function (res) {
  6268. if (res == '401' || res == 401) {
  6269. window.location.href = '/thmz/login/view'
  6270. return;
  6271. }
  6272. if (res.code == 0) {
  6273. if (res.data != null) {
  6274. hintProjectSelfPayInfo(res.data.selfpayProp, "药品");
  6275. //如果
  6276. if ($("#zyTab").find("li") == null || $("#zyTab").find("li").length == 0) {
  6277. initNavTabs(1, null, null);
  6278. //$("input.zyfs").val(1);
  6279. }
  6280. $("#chinese_medicine_name").val(res.data.name);
  6281. $("#chinese_medicine_name").blur();
  6282. //$("#zy_drugWin").val(res.data.weight);
  6283. $("#zy_packRetprice").val(res.data.packRetprice);
  6284. $("#chinese_medicine_current_code").val(res.data.code);
  6285. $("#chinese_medicine_current_serial").val(res.data.serial);
  6286. if (async) {
  6287. //选中药品后,光标默认到数量输入框
  6288. $("#zy_drugWin").focus();
  6289. // prevEleId = 'zy_drugWin';
  6290. }
  6291. }
  6292. } else {
  6293. errorMesage(res);
  6294. }
  6295. }
  6296. });
  6297. }
  6298. /**
  6299. * 加载辅助检查、检验列表
  6300. * @param index
  6301. */
  6302. function loadjcJyItemList(event) {
  6303. if (event != null) {
  6304. if (event.keyCode == 38 || event.keyCode == 40 || event.keyCode == 13) {
  6305. //上下键不刷新表格
  6306. return;
  6307. }
  6308. }
  6309. // if (!$("#jcJyItemPopoverContent").parent().parent().parent().hasClass("in")) {
  6310. // return;
  6311. // }
  6312. $('#jcJyItem').webuiPopover('show');
  6313. $('#tb_table_jc_jy_item').bootstrapTable('refresh');
  6314. $('#tb_table_jc_jy_item').bootstrapTable({
  6315. url: '/thmz/getJcJyItemByCommonParams', //请求后台的URL(*)
  6316. method: 'GET', //请求方式(*)
  6317. toolbar: '#toolbar', //工具按钮用哪个容器
  6318. striped: true, //是否显示行间隔色
  6319. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  6320. pagination: false, //是否显示分页(*)
  6321. sortable: true, //是否启用排序
  6322. sortOrder: "asc", //排序方式
  6323. queryParams: function (params) {
  6324. var temp = {
  6325. commonParams: $("#jcJyItem").val()
  6326. };
  6327. return temp;
  6328. }, //传递参数(*)
  6329. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  6330. pageNumber: 1, //初始化加载第一页,默认第一页
  6331. pageSize: 5, //每页的记录行数(*)
  6332. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  6333. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  6334. strictSearch: true,
  6335. showColumns: false, //是否显示所有的列
  6336. showRefresh: false, //是否显示刷新按钮
  6337. minimumCountColumns: 2, //最少允许的列数
  6338. clickToSelect: true, //是否启用点击选中行
  6339. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  6340. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  6341. cardView: false, //是否显示详细视图
  6342. detailView: false,
  6343. //rowStyle:rowStyle,//通过自定义函数设置行样式
  6344. ajaxOptions: {
  6345. headers: {
  6346. 'Accept': 'application/json',
  6347. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  6348. }
  6349. },
  6350. columns: [
  6351. {
  6352. field: 'code',
  6353. title: '编码',
  6354. align: "center",
  6355. valign: 'middle',
  6356. // sortable: true
  6357. }, {
  6358. field: 'name',
  6359. title: '名称',
  6360. align: "center",
  6361. valign: 'middle',
  6362. // sortable: true
  6363. }
  6364. , {
  6365. field: 'execUnitName',
  6366. title: '执行科室',
  6367. align: "center",
  6368. valign: 'middle',
  6369. // sortable: true
  6370. }, {
  6371. field: 'type',
  6372. title: '项目类型',
  6373. align: "center",
  6374. valign: 'middle',
  6375. // sortable: true
  6376. formatter: function (value, row, index) {
  6377. if (value == 1 || value == "1") {
  6378. return "检验";
  6379. }
  6380. if (value == 2 || value == "2") {
  6381. return "辅助检查";
  6382. }
  6383. if (value == 3 || value == "3") {
  6384. return "诊疗";
  6385. }
  6386. return "";
  6387. }
  6388. },
  6389. ],
  6390. responseHandler: function (res) {
  6391. if (res == '401' || res == 401) {
  6392. window.location.href = '/thmz/login/view'
  6393. return;
  6394. }
  6395. var ress = eval(res);
  6396. if (ress.code == -1) {
  6397. errorMesage(res);
  6398. return {
  6399. "total": 0,//总页数
  6400. "rows": {} //数据
  6401. };
  6402. }
  6403. $("#jcJyItemPopoverContent").parent().css("background", "#EBEBE4");
  6404. return {
  6405. "total": ress.data.length,//总页数
  6406. "rows": ress.data //数据
  6407. };
  6408. },
  6409. onClickRow: function (row, $element) {
  6410. $('#jcJyItem').webuiPopover('hide');
  6411. $("#jcJyZltype").val(row.type);
  6412. $("#execUnit").selectpicker('val', row.execUnit);//默认不选中
  6413. $("#execUnit").selectpicker('refresh');
  6414. if (row.type == 1) {
  6415. //检验
  6416. $("#jyZdSampleDiv").removeClass("hide").addClass("in");
  6417. $("#yshPartDiv").removeClass("in").addClass("hide");
  6418. if (row.sampleCode != null && row.sampleCode != "") {
  6419. $("#jyZdSample").selectpicker('val', row.sampleCode);
  6420. $('#jyZdSample').selectpicker('refresh');
  6421. }
  6422. } else if (row.type == 2) {
  6423. //检查
  6424. $("#yshPartDiv").removeClass("hide").addClass("in");
  6425. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  6426. if (row.bwCode != null && row.bwCode != "") {
  6427. $("#yshPart").selectpicker('val', row.bwCode);
  6428. $('#yshPart').selectpicker('refresh');
  6429. }
  6430. }
  6431. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  6432. checkJcJyItemInfo(row.code, row.name, row.type, true);
  6433. }
  6434. });
  6435. }
  6436. /**
  6437. * 加载诊疗列表
  6438. * @param index
  6439. */
  6440. function loadZlItemList(event) {
  6441. if (event != null) {
  6442. if (event.keyCode == 38 || event.keyCode == 40 || event.keyCode == 13) {
  6443. //上下键不刷新表格
  6444. return;
  6445. }
  6446. }
  6447. $('#zlItem').webuiPopover('show');
  6448. $('#tb_table_zl_item').bootstrapTable('refresh');
  6449. $('#tb_table_zl_item').bootstrapTable({
  6450. url: '/thmz/getZlItemByCommonParams', //请求后台的URL(*)
  6451. method: 'GET', //请求方式(*)
  6452. toolbar: '#toolbar', //工具按钮用哪个容器
  6453. striped: true, //是否显示行间隔色
  6454. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  6455. pagination: false, //是否显示分页(*)
  6456. sortable: true, //是否启用排序
  6457. sortOrder: "asc", //排序方式
  6458. queryParams: function (params) {
  6459. var temp = {
  6460. commonParams: $("#zlItem").val()
  6461. };
  6462. return temp;
  6463. }, //传递参数(*)
  6464. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  6465. pageNumber: 1, //初始化加载第一页,默认第一页
  6466. pageSize: 5, //每页的记录行数(*)
  6467. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  6468. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  6469. strictSearch: true,
  6470. showColumns: false, //是否显示所有的列
  6471. showRefresh: false, //是否显示刷新按钮
  6472. minimumCountColumns: 2, //最少允许的列数
  6473. clickToSelect: true, //是否启用点击选中行
  6474. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  6475. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  6476. cardView: false, //是否显示详细视图
  6477. detailView: false,
  6478. //rowStyle:rowStyle,//通过自定义函数设置行样式
  6479. ajaxOptions: {
  6480. headers: {
  6481. 'Accept': 'application/json',
  6482. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  6483. }
  6484. },
  6485. columns: [
  6486. {
  6487. field: 'code',
  6488. title: '编码',
  6489. align: "center",
  6490. valign: 'middle',
  6491. // sortable: true
  6492. }, {
  6493. field: 'name',
  6494. title: '名称',
  6495. align: "center",
  6496. valign: 'middle',
  6497. // sortable: true
  6498. }
  6499. , {
  6500. field: 'execUnitName',
  6501. title: '执行科室',
  6502. align: "center",
  6503. valign: 'middle',
  6504. // sortable: true
  6505. }
  6506. , {
  6507. field: 'chargeAmount',
  6508. title: '价格',
  6509. align: "center",
  6510. valign: 'middle',
  6511. // sortable: true
  6512. formatter: function (value, row, index) {
  6513. if (value == null) {
  6514. return "0.00元";
  6515. }
  6516. return value.toFixed(2) + "元";
  6517. }
  6518. }, {
  6519. field: 'descriptions',
  6520. title: '规格',
  6521. align: "center",
  6522. valign: 'middle',
  6523. // sortable: true
  6524. }
  6525. ],
  6526. responseHandler: function (res) {
  6527. if (res == '401' || res == 401) {
  6528. window.location.href = '/thmz/login/view'
  6529. return;
  6530. }
  6531. var ress = eval(res);
  6532. if (ress.code == -1) {
  6533. errorMesage(res);
  6534. return {
  6535. "total": 0,//总页数
  6536. "rows": {} //数据
  6537. };
  6538. }
  6539. $("#zlItemPopoverContent").parent().css("background", "#EBEBE4");
  6540. return {
  6541. "total": ress.data.length,//总页数
  6542. "rows": ress.data //数据
  6543. };
  6544. },
  6545. onClickRow: function (row, $element) {
  6546. hintProjectSelfPayInfo(row.selfpayProp, "诊疗");
  6547. $('#zlItem').webuiPopover('hide');
  6548. $("#zlExecUnit").selectpicker('val', row.execUnit);//默认不选中
  6549. $("#zlExecUnit").selectpicker('refresh');
  6550. //诊疗
  6551. if ($("#zlTab").find("li") == null || $("#zlTab").find("li").length == 0) {
  6552. initNavTabs(3, null, null);
  6553. }
  6554. $("#zlItem").val(row.name);
  6555. $("#zlItem").blur();
  6556. $("#zlItemPrice").val(row.chargeAmount);
  6557. $("#chargeUnit").val(row.specification);
  6558. $("#zl_current_code").val(row.code);
  6559. $("#itemQuantity").val(1);
  6560. $("#descriptions").val(row.descriptions);
  6561. $("#descriptions").attr('title', row.descriptions);
  6562. $("#dayZlNum").selectpicker('val', 1);//默认不选中
  6563. $("#dayZlNum").selectpicker('refresh');
  6564. $("#orderFrequencyZl").selectpicker('val', 'ONCE');//默认不选中
  6565. $("#orderFrequencyZl").selectpicker('refresh');
  6566. calculateZl(false);
  6567. $("#chargeUnit").focus();
  6568. return;
  6569. }
  6570. });
  6571. }
  6572. /**
  6573. * 诊疗与医技选中
  6574. * @param code
  6575. * @param name 回写的时候可以设置null
  6576. * @param type 1 检验 2 检查
  6577. * @param async 当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  6578. */
  6579. //function checkJcJyItemInfo(code, name, type) {
  6580. function checkJcJyItemInfo(code, name, type, async) {
  6581. // //判断是否有重复的项目 返回true 说明有重复的
  6582. // if (verifyRepeat(code, null, 2)) {
  6583. // return;
  6584. // }
  6585. //不需要每次都关闭帮助树
  6586. //$("#treeButton").webuiPopover('hide');
  6587. $.ajax({
  6588. type: "GET",
  6589. url: '/thmz/getJcJyItemChargeByCode?code=' + code + '&jcJyZltype=' + type,
  6590. contentType: "application/json;charset=UTF-8",
  6591. dataType: "json",
  6592. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6593. async: async,//当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  6594. success: function (res) {
  6595. if (res == '401' || res == 401) {
  6596. window.location.href = '/thmz/login/view'
  6597. return;
  6598. }
  6599. if (res.code == 0) {
  6600. if (res.data != null) {
  6601. hintProjectSelfPayInfo(res.selfpayProp, type == 1 ? "检验" : "辅助检查");
  6602. //如果
  6603. if ($("#jcjyTab").find("li") == null || $("#jcjyTab").find("li").length == 0) {
  6604. initNavTabs(2, null, null);
  6605. }
  6606. if (name == null) {
  6607. name = res.name;
  6608. }
  6609. $("#jcJyItem").val(name);
  6610. $("#jcJyItem").blur();
  6611. $("#jcjyItemPrice").val(res.totalAmount);
  6612. $("#jcjy_current_code").val(code);
  6613. $("#execUnit").selectpicker('val', res.execUnit);//默认不选中
  6614. $("#execUnit").selectpicker('refresh');
  6615. // if (async) {
  6616. // if (type == 1) {
  6617. // //选中项目后,光标默认到数量输入框
  6618. // $("#jyZdSample").next().click();
  6619. // // prevEleId = 'jyZdSample';
  6620. // } else if (type == 2) {
  6621. // $("#yshPart").next().click();
  6622. // // prevEleId = 'yshPart';
  6623. // }
  6624. // }
  6625. }
  6626. } else {
  6627. errorMesage(res);
  6628. }
  6629. }
  6630. });
  6631. }
  6632. /**
  6633. * 查询辅助检查、检验项目明细
  6634. * @param code 编码
  6635. * @param jcJyZltype 1 检验 2 检查
  6636. */
  6637. function getJcJyItemChargeByCode(code, jcJyZltype) {
  6638. if (code != null) {
  6639. $("#itemCodeSearch").val(code);
  6640. $("#jcJyZltypeSearch").val(jcJyZltype);
  6641. } else if ($("#jcjy_current_code").val() == null || $("#jcjy_current_code").val() == '') {
  6642. errorMesageSimaple("未选中任何项目!");
  6643. return;
  6644. }
  6645. $("#jcJyItemModal").modal("show");
  6646. $('#jcJyItemTable').bootstrapTable('refresh');
  6647. $('#jcJyItemTable').bootstrapTable({
  6648. url: '/thmz/getJcJyItemChargeByCode', //请求后台的URL(*)
  6649. method: 'GET', //请求方式(*)
  6650. toolbar: '#toolbar', //工具按钮用哪个容器
  6651. striped: true, //是否显示行间隔色
  6652. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  6653. pagination: false, //是否显示分页(*)
  6654. sortable: true, //是否启用排序
  6655. sortOrder: "asc", //排序方式
  6656. queryParams: function (params) {
  6657. var itemCodeSearch = $("#itemCodeSearch").val();
  6658. var jcJyZltypeSearch = $("#jcJyZltypeSearch").val();
  6659. if (itemCodeSearch == null || itemCodeSearch == "") {
  6660. itemCodeSearch = $("#jcjy_current_code").val();
  6661. jcJyZltypeSearch = $("#jcJyZltype").val();
  6662. }
  6663. var temp = {
  6664. code: itemCodeSearch,
  6665. jcJyZltype: jcJyZltypeSearch
  6666. };
  6667. return temp;
  6668. }, //传递参数(*)
  6669. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  6670. pageNumber: 1, //初始化加载第一页,默认第一页
  6671. pageSize: 5, //每页的记录行数(*)
  6672. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  6673. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  6674. strictSearch: true,
  6675. showColumns: false, //是否显示所有的列
  6676. showRefresh: false, //是否显示刷新按钮
  6677. minimumCountColumns: 2, //最少允许的列数
  6678. clickToSelect: true, //是否启用点击选中行
  6679. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  6680. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  6681. cardView: false, //是否显示详细视图
  6682. detailView: false,
  6683. //rowStyle:rowStyle,//通过自定义函数设置行样式
  6684. ajaxOptions: {
  6685. headers: {
  6686. 'Accept': 'application/json',
  6687. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  6688. }
  6689. },
  6690. columns: [
  6691. {
  6692. field: 'tcCode',
  6693. title: '项目编码',
  6694. align: "center",
  6695. valign: 'middle',
  6696. // sortable: true
  6697. }, {
  6698. field: 'code',
  6699. title: '收费编码',
  6700. align: "center",
  6701. valign: 'middle',
  6702. // sortable: true
  6703. }
  6704. , {
  6705. field: 'name',
  6706. title: '收费名称',
  6707. align: "center",
  6708. valign: 'middle',
  6709. // sortable: true
  6710. }, {
  6711. field: 'num',
  6712. title: '数量',
  6713. align: "center",
  6714. valign: 'middle',
  6715. // sortable: true
  6716. }, {
  6717. field: 'chargeAmount',
  6718. title: '单价',
  6719. align: "center",
  6720. valign: 'middle',
  6721. // sortable: true
  6722. formatter: function (value, row, index) {
  6723. if (value == null || value == "") {
  6724. return 0;
  6725. }
  6726. return value.toFixed(2);
  6727. }
  6728. }, {
  6729. field: 'totalAmount',
  6730. title: '总金额',
  6731. align: "center",
  6732. valign: 'middle',
  6733. // sortable: true
  6734. formatter: function (value, row, index) {
  6735. if (value == null || value == "") {
  6736. return 0;
  6737. }
  6738. return value.toFixed(2);
  6739. }
  6740. }
  6741. ],
  6742. responseHandler: function (res) {
  6743. if (res == '401' || res == 401) {
  6744. window.location.href = '/thmz/login/view'
  6745. return;
  6746. }
  6747. $("#itemCodeSearch").val(null);
  6748. var ress = eval(res);
  6749. if (ress.code == -1) {
  6750. errorMesage(res);
  6751. return {
  6752. "total": 0,//总页数
  6753. "rows": {} //数据
  6754. };
  6755. }
  6756. return {
  6757. "total": ress.data.length,//总页数
  6758. "rows": ress.data //数据
  6759. };
  6760. }
  6761. });
  6762. }
  6763. /**
  6764. * 判断是否有重复的项目 返回true 说明有重复的
  6765. * @param code 编码
  6766. * @param serial 药品规格 null 时是非药品
  6767. * @param chargeUnitCode 检查部位或者检验物 null 时是 诊疗
  6768. * @param index
  6769. */
  6770. function verifyRepeat(code, serial, chargeUnitCode, index) {
  6771. //是新增药品还是编辑 true 修改 默认false
  6772. var updateFlag = null;
  6773. if (index == 0) {
  6774. updateFlag = $("#western_medicine_update_flag").val();
  6775. } else if (index == 1) {
  6776. updateFlag = $("#chinese_medicine_update_flag").val();
  6777. } else if (index == 2) {
  6778. updateFlag = $("#jcjy_update_flag").val();
  6779. } else if (index == 3) {
  6780. updateFlag = $("#zl_update_flag").val();
  6781. }
  6782. if (updateFlag == undefined || updateFlag == null) {
  6783. updateFlag = false;
  6784. }
  6785. if (updateFlag == "true" || updateFlag == true) {
  6786. return false;
  6787. }
  6788. var tabId = null;
  6789. //西药
  6790. if (index == 0) {
  6791. tabId = "xyTab";
  6792. } else if (index == 1) {
  6793. //中成药
  6794. tabId = "zyTab";
  6795. } else if (index == 2) {
  6796. //辅助检查、检验
  6797. tabId = "jcjyTab";
  6798. } else if (index == 3) {
  6799. //诊疗
  6800. tabId = "zlTab";
  6801. } else if (index == 4) {
  6802. //入院
  6803. tabId = "zyReqTab";
  6804. }
  6805. var tableId = $("#" + tabId + " li.active").find("a").attr("href");
  6806. var items = $(tableId).find("div:eq(0)").find("div.form-group");
  6807. var groupId = null;
  6808. if (index == 0) {
  6809. groupId = $("#groupId").val();
  6810. }
  6811. if (items != null && items.length > 0) {
  6812. for (var i = 0; i < items.length; i++) {
  6813. if (serial == null) {
  6814. var temporary_items_code = $(items[i]).find("input.temporary_items_code").val();
  6815. var temporary_items_desc_value = $(items[i]).find("input.temporary_items_desc_value").val();
  6816. if (chargeUnitCode == null && code === temporary_items_code) {
  6817. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  6818. return true;
  6819. }
  6820. if (code === temporary_items_code && chargeUnitCode === temporary_items_desc_value) {
  6821. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  6822. return true;
  6823. }
  6824. } else {
  6825. if (index == 0) {
  6826. //西药需要判断组号,因为可能会有不同组的皮试用药,需要相同的药品
  6827. var temporary_items_groupId = $(items[i]).find("input.temporary_items_groupId").val();
  6828. var temporary_items_code = $(items[i]).find("input.temporary_items_code").val();
  6829. var temporary_items_serial = $(items[i]).find("input.temporary_items_serial").val();
  6830. if (code === temporary_items_code && serial === temporary_items_serial && groupId === temporary_items_groupId) {
  6831. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  6832. return true;
  6833. }
  6834. } else {
  6835. var temporary_items_code = $(items[i]).find("input.temporary_items_code").val();
  6836. var temporary_items_serial = $(items[i]).find("input.temporary_items_serial").val();
  6837. if (code === temporary_items_code && serial === temporary_items_serial) {
  6838. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  6839. return true;
  6840. }
  6841. }
  6842. }
  6843. }
  6844. }
  6845. return false;
  6846. }
  6847. /**
  6848. * 初始化处方分页
  6849. * @param index 0 西药 1 中药 2 诊疗 3 入院
  6850. * @param groupNo 初始化时候的药房分类
  6851. * @param orderNo 初始化时候的处方组号
  6852. */
  6853. function initNavTabs(index, groupNo, orderNo) {
  6854. var tabId = null;
  6855. var tabContentId = null;
  6856. var paneId = null;
  6857. var cfdesc = '普药';
  6858. //西药
  6859. if (index == 0) {
  6860. tabId = "xyTab";
  6861. tabContentId = "xyTabContent";
  6862. paneId = "xycf_" + getUID();
  6863. } else if (index == 1) {
  6864. //中草药
  6865. tabId = "zyTab";
  6866. tabContentId = "zyTabContent";
  6867. paneId = "zycf_" + getUID();
  6868. cfdesc = '中草药';
  6869. } else if (index == 2) {
  6870. //医技
  6871. tabId = "jcjyTab";
  6872. tabContentId = "jcjyTabContent";
  6873. paneId = "jcjycf_" + getUID();
  6874. cfdesc = '辅助检查、检验';
  6875. } else if (index == 3) {
  6876. //诊疗
  6877. tabId = "zlTab";
  6878. tabContentId = "zlTabContent";
  6879. paneId = "zlcf_" + getUID();
  6880. cfdesc = '诊疗';
  6881. } else if (index == 4) {
  6882. //住院
  6883. tabId = "zyReqTab";
  6884. tabContentId = "zyReqTabContent";
  6885. paneId = "zyReqcf_" + getUID();
  6886. cfdesc = '入院';
  6887. }
  6888. var tabHtml = '<li class="active"><a href="#' + paneId + '" role="tab" data-toggle="tab" ';
  6889. if (index == 0) {
  6890. tabHtml += ' onclick=xyTableOnClick("' + paneId + '")';
  6891. }
  6892. tabHtml += '>处方 <small class="cfdesc">(' + cfdesc + ')</small></a></li>';
  6893. $("#" + tabId).html(tabHtml);
  6894. var html = '<div class="tab-pane fade in active" id="' + paneId + '" style="height: 100%;min-height: 285px;position: relative;">';
  6895. html += '<img src="/thmz/images/prescription.png" style="margin-top: 5px;"/>';
  6896. html += '<input class="current_groupNo" type="hidden"/>';
  6897. html += ' <div class="cf_content rb_item" style="height: 230px;padding-top: 5px;overflow-y: auto;"></div>' +
  6898. ' <div style="height: 30px;border-top: 1px solid #ddd;width: 100%;position: absolute;bottom:0;padding-top: 10px;">';
  6899. html += '<div style="width: 460px;">'
  6900. if (index == 1) {
  6901. html += '<div style="width: 130px;float: left;line-height: 34px;">' +
  6902. ' <label class="my_label_2">复煎:</label>' +
  6903. ' <div style="width: 69px;float: left;">' +
  6904. ' <input type="number" class="form-control " id="cyFj" placeholder="请输入" value="1"/>' +
  6905. ' </div>次' +
  6906. ' </div>';
  6907. html += '<div style="width: 130px;float: left;line-height: 34px;">' +
  6908. ' <label class="my_label_2">分服:</label>' +
  6909. ' <div style="width: 69px;float: left;">' +
  6910. ' <input type="number" class="form-control " id="cyFfcs" placeholder="请输入" value="2"/>' +
  6911. ' </div>次' +
  6912. ' </div>';
  6913. html += '<div style="width: 180px;float: left;">' +
  6914. ' <label class="my_label_2">用法:</label>' +
  6915. ' <div style="width: 135px;float: left;">' +
  6916. ' <select class="form-control selectpicker show-tick useType"' +
  6917. ' title="请选择" id="useType_1">' +
  6918. ' </select>' +
  6919. ' </div>' +
  6920. ' </div>';
  6921. html += '</div><div style="width: 460px;">'
  6922. html += '<input id="singleAmount" type="hidden"/>';
  6923. }
  6924. html += '<div style="width: 130px;float: left;padding-left: 7px;padding-top: 8px;">金额:<span class="cf_amount">0.0</span><span>元</span></div>';
  6925. if (index == 0) {
  6926. html += '<div style="width: 310px;float: left;color: red;padding-top: 8px;">说明:此费用包含药品给药方式所产生的费用!</div>';
  6927. }
  6928. // else if (index == 1) {
  6929. // html += '<div style="width: 310px;float: left;color: red;padding-top: 8px;">说明:此费用包含药品代煎所产生的费用!</div>';
  6930. // }
  6931. html += '</div></div></div>';
  6932. $("#" + tabContentId).html(html);
  6933. if (index == 1) {
  6934. var water = '<option value="加凉水">加凉水</option><option value="加温水">加温水</option><option value="加开水">加开水</option><option value="加冰水">加冰水</option><option value="加糖水">加糖水</option>';
  6935. $('#cyJssm').html(water);
  6936. $('#cyJssm').selectpicker('refresh');
  6937. $("#cyJssm").selectpicker('val', "加凉水");
  6938. $('#cyJssm').selectpicker('refresh');
  6939. initAllMzYshZdFysm();
  6940. //initZyOrderFrequencys("zy_orderFrequency_1", false);
  6941. initZySupplyTypes("zy_supplyType_1", false);
  6942. }
  6943. if (groupNo != null && groupNo != "") {
  6944. //设置当前药品的品类
  6945. $("#" + paneId).find("input.current_groupNo").val(groupNo);
  6946. }
  6947. if (orderNo != null && orderNo != "" && orderNoAndTableIdMap != null) {
  6948. orderNoAndTableIdMap.put(orderNo, paneId);
  6949. tableIdAndOrderNoMap.put(paneId, orderNo);
  6950. }
  6951. }
  6952. /**
  6953. * 清空处方分页
  6954. * @param index 0 西药 1 中药 2 诊疗 3 入院
  6955. */
  6956. function clearNavTabs(index) {
  6957. var tabId = null;
  6958. var tabContentId = null;
  6959. //西药
  6960. if (index == 0) {
  6961. tabId = "xyTab";
  6962. tabContentId = "xyTabContent";
  6963. } else if (index == 1) {
  6964. //中草药
  6965. tabId = "zyTab";
  6966. tabContentId = "zyTabContent";
  6967. $("#cyJsl").val(400);
  6968. $("#cyZql").val(200);
  6969. $("#cyFj").val(1);
  6970. $("#cyFfcs").val(2);
  6971. $("#cyMtjs").val(1);
  6972. $("#zyfs").val(null);
  6973. $("#cyJssm").selectpicker('val', "加凉水");
  6974. $('#cyJssm').selectpicker('refresh');
  6975. $("#zy_supplyType_1").selectpicker('val', null);
  6976. $('#zy_supplyType_1').selectpicker('refresh');
  6977. } else if (index == 2) {
  6978. //辅助检查、检验
  6979. tabId = "jcjyTab";
  6980. tabContentId = "jcjyTabContent";
  6981. } else if (index == 3) {
  6982. //医技
  6983. tabId = "zlTab";
  6984. tabContentId = "zlTabContent";
  6985. } else if (index == 4) {
  6986. //医技
  6987. tabId = "zyReqTab";
  6988. tabContentId = "zyReqTabContent";
  6989. }
  6990. $("#" + tabId).html(null);
  6991. $("#" + tabContentId).html(null);
  6992. }
  6993. /**
  6994. * 添加处方分页
  6995. * @param index 0 西药 1 中药 2 诊疗 3 入院
  6996. * @param groupNo 71 普通西药 91 医材 111 麻、精一 131 精二 151 诊疗
  6997. * @param orderNo 处方号
  6998. */
  6999. function refreshNavTabs(index, groupNo, orderNo) {
  7000. var tabId = null;
  7001. var tabContentId = null;
  7002. var paneIdPrfix = null;
  7003. var cfdesc = '普药';
  7004. //西药
  7005. if (index == 0) {
  7006. tabId = "xyTab";
  7007. tabContentId = "xyTabContent";
  7008. paneIdPrfix = "xycf_";
  7009. if (groupNo == '91') {
  7010. cfdesc = '医材';
  7011. } else if (groupNo == '111') {
  7012. cfdesc = '麻、精一';
  7013. } else if (groupNo == '131') {
  7014. cfdesc = '精二';
  7015. }
  7016. // else if(groupNo=='151'){
  7017. // cfdesc='诊疗';
  7018. // }
  7019. } else if (index == 1) {
  7020. //中草药
  7021. tabId = "zyTab";
  7022. tabContentId = "zyTabContent";
  7023. paneIdPrfix = "zycf_";
  7024. cfdesc = '中草药';
  7025. } else if (index == 2) {
  7026. //辅助检查、检验
  7027. tabId = "jcjyTab";
  7028. tabContentId = "jcjyTabContent";
  7029. paneIdPrfix = "jcjycf_";
  7030. cfdesc = '辅助检查、检验';
  7031. } else if (index == 3) {
  7032. //诊疗
  7033. tabId = "zlTab";
  7034. tabContentId = "zlTabContent";
  7035. paneIdPrfix = "zlcf_";
  7036. cfdesc = '诊疗';
  7037. } else if (index == 4) {
  7038. //入院
  7039. tabId = "zyReqTab";
  7040. tabContentId = "zyReqTabContent";
  7041. paneIdPrfix = "zyReqcf_";
  7042. cfdesc = '入院';
  7043. }
  7044. // var tableId = $("#"+tabId+" li.active").find("a").attr("href");
  7045. // var length = $(tableId).find("div:eq(0)").children().length;
  7046. // if(length==0){
  7047. // //当前处方是空白的,不需要新增处方
  7048. // return;
  7049. // }
  7050. var cfTitle = "处方" + " <small class=\"cfdesc\">(" + cfdesc + ")</small>";
  7051. var paneId = paneIdPrfix + getUID();
  7052. //清除选中的样式
  7053. $("#" + tabId).find("li.active").removeClass("active");
  7054. var tabHtml = '<li><a href="#' + paneId + '" role="tab" data-toggle="tab"';
  7055. if (index == 0) {
  7056. tabHtml += ' onclick=xyTableOnClick("' + paneId + '")';
  7057. }
  7058. tabHtml += '>' + cfTitle + '</a';
  7059. tabHtml += '</li>';
  7060. $("#" + tabId).append(tabHtml);
  7061. var html = '<div class="tab-pane fade in active" id="' + paneId + '" style="height: 100%;min-height: 285px;position: relative;">' +
  7062. '<img src="/thmz/images/prescription.png" style="margin-top: 5px;"/>' +
  7063. '<input class="current_groupNo" type="hidden"/>' +
  7064. ' <div class="cf_content rb_item" style="height: 230px;padding-top: 5px;overflow-y: auto;"></div>' +
  7065. ' <div style="height: 30px;border-top: 1px solid #ddd;width: 100%;position: absolute;bottom:0;">' +
  7066. '<div style="width: 460px;">' +
  7067. '<div style="width: 130px;float: left;padding-left: 7px;padding-top: 8px;">金额:<span class="cf_amount">0.0</span><span>元</span></div>';
  7068. if (index == 0) {
  7069. html += '<div style="width: 310px;float: left;color: red;padding-top: 8px;">说明:此费用包含药品给药方式所产生的费用!</div>';
  7070. }
  7071. html += '</div></div>';
  7072. $("#" + tabContentId).append(html);
  7073. //切换处方
  7074. $("#" + tabId).find("a[href='#" + paneId + "']").off("click").tab('show');
  7075. if (groupNo != null && groupNo != "") {
  7076. //设置当前药品的品类
  7077. $("#" + paneId).find("input.current_groupNo").val(groupNo);
  7078. }
  7079. if (orderNo != null && orderNo != "" && orderNoAndTableIdMap != null) {
  7080. orderNoAndTableIdMap.put(orderNo, paneId);
  7081. tableIdAndOrderNoMap.put(paneId, orderNo);
  7082. }
  7083. }
  7084. /**
  7085. * 判断是否需要自动增加组号
  7086. * @param res
  7087. */
  7088. function autoAddGroupId(res) {
  7089. var tableId = $("#xyTab li.active").find("a").attr("href");
  7090. var childrens = $(tableId).find("div:eq(0)").children();
  7091. var prevCategoriesFlag = null;
  7092. if (childrens != null && childrens.length > 0) {
  7093. prevCategoriesFlag = $(childrens[childrens.length - 1]).find("input.temporary_items_categoriesFlag").val();
  7094. if (prevCategoriesFlag == "" || prevCategoriesFlag == undefined) {
  7095. prevCategoriesFlag = null;
  7096. }
  7097. }
  7098. if (!(res.data.categoriesFlag == 2 || res.data.categoriesFlag == "2" || res.data.categoriesFlag == 1 || res.data.categoriesFlag == "1") ||
  7099. ((res.data.categoriesFlag == 2 || res.data.categoriesFlag == "2" || res.data.categoriesFlag == 1 || res.data.categoriesFlag == "1") && prevCategoriesFlag != null && prevCategoriesFlag != "1" && prevCategoriesFlag != 1 && prevCategoriesFlag != "2" && prevCategoriesFlag != 2)) {
  7100. //非针剂默认要切换组号 或者 是针剂,但是上一个药品不是针剂,这时候也要新换一个组号
  7101. var last = parseInt($("#groupId > option:last").val());
  7102. $("#groupId").selectpicker('val', last);
  7103. $('#groupId').selectpicker('refresh');
  7104. }
  7105. }
  7106. /**
  7107. * 填充西药选中的内容
  7108. * @param res
  7109. * @param groupNo
  7110. */
  7111. function fitWesternMedicine(res, groupNo) {
  7112. hintProjectSelfPayInfo(res.data.selfpayProp, "药品");
  7113. autoAddGroupId(res);
  7114. $("#categoriesFlag").val(res.data.categoriesFlag);
  7115. //prevCategoriesFlag = res.data.categoriesFlag;
  7116. $("#western_medicine_name").val(res.data.name);
  7117. $("#western_medicine_name").blur();
  7118. var drugWinHtml = '';
  7119. var index = null;
  7120. if (res.data.weight != null) {
  7121. $("#drugWin").val(res.data.weight);
  7122. $("#drugWinDb").val(res.data.weight);
  7123. drugWinHtml = '<option value="' + res.data.weighUnit + '" desc="' + res.data.weight + '">' + res.data.weighUnitDesc + '</option>';
  7124. index = res.data.weighUnit;
  7125. }
  7126. if (res.data.volum != null) {
  7127. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  7128. $("#drugWin").val(res.data.volum);
  7129. $("#drugWinDb").val(res.data.volum);
  7130. }
  7131. drugWinHtml += '<option value="' + res.data.volUnit + '" desc="' + res.data.volum + '">' + res.data.volUnitDesc + '</option>';
  7132. if (index == null) {
  7133. index = res.data.volUnit;
  7134. }
  7135. }
  7136. if (res.data.miniUnit != null && res.data.miniUnit != "") {
  7137. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  7138. $("#drugWin").val(1);
  7139. $("#drugWinDb").val(1);
  7140. }
  7141. drugWinHtml += '<option value="' + res.data.miniUnit + '" desc="1">' + res.data.miniUnitDesc + '</option>';
  7142. if (index == null) {
  7143. index = res.data.miniUnit;
  7144. }
  7145. }
  7146. $('#drugWinUnit').html(drugWinHtml);
  7147. $('#drugWinUnit').selectpicker('refresh');
  7148. $("#drugWinUnit").selectpicker('val', index);
  7149. $('#drugWinUnit').selectpicker('refresh');
  7150. if (res.data.packUnitDesc != null && res.data.packUnitDesc != "") {
  7151. var html = '<option value="' + res.data.packUnitDesc + '" >' + res.data.packUnitDesc + '</option>';
  7152. $('#packUnit').html(html);
  7153. $('#packUnit').selectpicker('refresh');
  7154. $("#packUnit").selectpicker('val', res.data.packUnitDesc);
  7155. $('#packUnit').selectpicker('refresh');
  7156. }
  7157. $("#packRetprice").val(res.data.packRetprice);
  7158. $("#packSize").val(res.data.packSize);
  7159. $("#western_medicine_current_code").val(res.data.code);
  7160. $("#western_medicine_current_serial").val(res.data.serial);
  7161. if ($("#dayNum").val() == null) {
  7162. //天数 同组药品天数相同
  7163. $("#dayNum").selectpicker('val', 1);
  7164. $('#dayNum').selectpicker('refresh');
  7165. }
  7166. if (($("#supplyType").val() == null || $("#supplyType").val() == "") && res.data.supplyType != null) {
  7167. // 给药方式 同组药品给药方式相同
  7168. $("#supplyType").selectpicker('val', res.data.supplyType);
  7169. $('#supplyType').selectpicker('refresh');
  7170. }
  7171. if (($("#orderFrequency").val() == null || $("#orderFrequency").val() == "") && res.data.frequency != null) {
  7172. //频次编码 同组药品频次编码相同
  7173. $("#orderFrequency").selectpicker('val', res.data.frequency);
  7174. $('#orderFrequency').selectpicker('refresh');
  7175. }
  7176. if ($("#orderFrequency").val() == null || $("#orderFrequency").val() == "") {
  7177. //频次编码 防止频次为空
  7178. $("#orderFrequency").selectpicker('val', "ONCE");
  7179. $('#orderFrequency').selectpicker('refresh');
  7180. }
  7181. $("#tryResult").parent().parent().parent().removeClass("in").addClass("hide");
  7182. if (res.data.psFlag != null && (res.data.psFlag == 1 || res.data.psFlag == "1")) {
  7183. if (res.data.categoriesFlag == 0 || res.data.categoriesFlag == "0" || res.data.categoriesFlag == 2 || res.data.categoriesFlag == "2") {
  7184. initTryResultSelect(res.data.categoriesFlag);
  7185. }
  7186. }
  7187. $("#manufactoryName").val(res.data.manufactoryName);
  7188. $("#specification").val(res.data.specification);
  7189. calculate();
  7190. $("#western_medicine_name").focus();
  7191. }
  7192. /**
  7193. * 剂量单位改变事件
  7194. */
  7195. function drugWinUnitChange() {
  7196. var desc = $('#drugWinUnit').find("option:selected").attr('desc');
  7197. $("#drugWin").val(desc);
  7198. $("#drugWinDb").val(desc);
  7199. calculate();
  7200. }
  7201. /**
  7202. * 根据选择的内容计算总的用药量
  7203. */
  7204. function calculate() {
  7205. //最小规格剂量
  7206. var drugWinDb = $("#drugWinDb").val();
  7207. //天数
  7208. var dayNum = $("#dayNum").val();
  7209. //当前使用的最小剂量
  7210. var drugWin = $("#drugWin").val();
  7211. //频率
  7212. var times = $('#orderFrequency').find("option:selected").attr('desc');
  7213. //包装规格数量
  7214. var packSize = $("#packSize").val();
  7215. //单价
  7216. var packRetprice = $("#packRetprice").val();
  7217. //当前药房编码
  7218. var currentGroupNo = $("#current_groupNo").val();
  7219. if (drugWinDb == null || drugWinDb === "") {
  7220. if (currentGroupNo == '71') {
  7221. return;
  7222. }
  7223. drugWinDb = 1;
  7224. }
  7225. if (dayNum == null || dayNum === "") {
  7226. if (currentGroupNo == '71') {
  7227. return;
  7228. }
  7229. dayNum = 1;
  7230. }
  7231. if (drugWin == null || drugWin === "") {
  7232. if (currentGroupNo == '71') {
  7233. return;
  7234. }
  7235. drugWin = 1;
  7236. }
  7237. if (times == null || times === "") {
  7238. if (currentGroupNo == '71') {
  7239. return;
  7240. }
  7241. times = 1;
  7242. }
  7243. if (packSize == null || packSize === "") {
  7244. return;
  7245. }
  7246. //拆零总量
  7247. var scatteredTotalNum = Multiply(Multiply(dayNum, drugWin), times);
  7248. //整包装的数量
  7249. var totalNum = Math.ceil(Division(scatteredTotalNum, Multiply(packSize, drugWinDb)));
  7250. $("#gross").val(totalNum);
  7251. $("#totalRetprice").val(Multiply(totalNum, packRetprice).toFixed(2));
  7252. }
  7253. /**
  7254. * 根据选择的总量计算金额 只有医材的时候需要计算
  7255. */
  7256. function calculateSimple() {
  7257. //总量
  7258. var gross = $("#gross").val();
  7259. //单价
  7260. var packRetprice = $("#packRetprice").val();
  7261. $("#totalRetprice").val(Multiply(gross, packRetprice).toFixed(2));
  7262. //当前药房编码
  7263. var currentGroupNo = $("#current_groupNo").val();
  7264. if (currentGroupNo == '91') {
  7265. //医材默认天数为1
  7266. $("#dayNum").selectpicker('val', 1);
  7267. $('#dayNum').selectpicker('refresh');
  7268. $("#orderFrequency").selectpicker('val', "ONCE");
  7269. $('#orderFrequency').selectpicker('refresh');
  7270. }
  7271. }
  7272. /**
  7273. * 根据中药付数计算金额
  7274. */
  7275. function calculateZyAmount() {
  7276. var singleAmount = $("#singleAmount").val();
  7277. var tableId = $("#zyTab li.active").find("a").attr("href");
  7278. //获取中药付数
  7279. //var zyfs = $(tableId).find("input.zyfs").val();
  7280. var zyfs = $("#zyfs").val();
  7281. var cfAmount = Multiply(zyfs, singleAmount);
  7282. $(tableId).find("span.cf_amount").html(cfAmount);
  7283. calculateTotalAmount(false);
  7284. }
  7285. /**
  7286. * 将病人信息填入患者信息修改form
  7287. * @param patinet
  7288. */
  7289. function fillPlusPatinet(patinet) {
  7290. if (patinet != null) {
  7291. $("#editUserCode").val(patinet.patientId);
  7292. $("#editUserName").val(patinet.name);
  7293. $("#editUserName").blur();
  7294. $("#editUserAge").val(patinet.age);
  7295. $("#editUserAge").blur();
  7296. $("#editUserGender").selectpicker('val', patinet.sex);
  7297. $("#editUserGender").selectpicker('refresh');
  7298. $("#editUserGender").blur();
  7299. $("#editUserBirthDay").val(patinet.birthDayStr);
  7300. $("#editUserBirthDay").blur();
  7301. $('#editUserCertificateType').selectpicker('val', patinet.certificateType);
  7302. $('#editUserCertificateType').selectpicker('refresh');
  7303. $("#editUserCardNo").val(patinet.icCardNo);
  7304. $("#editUserCardNo").attr("title", patinet.icCardNo);
  7305. $("#editUserCardNo").blur();
  7306. $("#editUserPhoneNum").val(patinet.phoneNo);
  7307. $("#editUserPhoneNum").attr("title", patinet.phoneNo);
  7308. $("#editUserPhoneNum").blur();
  7309. $("#editUserPatientsNature").selectpicker('val', patinet.responseType);//默认选中
  7310. $('#editUserPatientsNature').selectpicker('refresh');
  7311. $("#editUserPatientsNature").blur();
  7312. $("#editUserIdCard").val(patinet.socialNo);
  7313. $("#editUserIdCard").attr("title", patinet.socialNo);
  7314. $("#editUserIdCard").blur();
  7315. $('#editUserProvinceCode').selectpicker('val', patinet.provinceCode);
  7316. $('#editUserProvinceCode').selectpicker('refresh');
  7317. initCity(2, patinet.cityCode);
  7318. initDistrict(2, patinet.cityCode, patinet.districtCode);
  7319. $("#editUserDetail").val(patinet.detail);
  7320. $("#editUserDetail").blur();
  7321. $("#editUserContact").val(patinet.relName);
  7322. $("#editUserContactPhone").val(patinet.contractName);
  7323. }
  7324. }
  7325. /**
  7326. * 修改病人信息
  7327. */
  7328. function modifyPatient() {
  7329. $.ajax({
  7330. type: "POST",
  7331. url: '/thmz/modifyPatient',
  7332. contentType: "application/json;charset=UTF-8",
  7333. dataType: "json",
  7334. data: JSON.stringify({
  7335. "name": $("#editUserName").val(),
  7336. "age": $("#editUserAge").val(),
  7337. "sex": $("#editUserGender").val(),
  7338. "birthDay": $("#editUserBirthDay").val(),
  7339. "certificateType": $("#editUserCertificateType").val(),
  7340. "icCardNo": $("#editUserCardNo").val(),
  7341. "phoneNo": $("#editUserPhoneNum").val(),
  7342. "responseType": $("#editUserPatientsNature").val(),
  7343. "socialNo": $("#editUserIdCard").val(),
  7344. "provinceCode": $("#editUserProvinceCode").val(),
  7345. "cityCode": $("#editCityCode").val(),
  7346. "districtCode": $("#editUserDistrictCode").val(),
  7347. "detail": $("#editUserDetail").val(),
  7348. "patientId": $("#editUserCode").val(),
  7349. "relName": $("#editUserContact").val(),
  7350. "contractName": $("#editUserContactPhone").val()
  7351. }),
  7352. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7353. success: function (res) {
  7354. if (res == '401' || res == 401) {
  7355. window.location.href = '/thmz/login/view'
  7356. return;
  7357. }
  7358. if (res.code == 0) {
  7359. $('#editUserModal').modal('hide');
  7360. var patientId = $("#patientId").text();
  7361. if (patientId != null && patientId != 'null' && patientId != "") {
  7362. realClinicalReception(patientId, $("#mzfzSerialNoInClick").val(), $("#mzfzReqTypeNoInClick").val());
  7363. }
  7364. clearPlusPatinet();
  7365. } else {
  7366. errorMesage(res);
  7367. }
  7368. }
  7369. });
  7370. }
  7371. /**
  7372. * 将病人信息修改域置空
  7373. * @param patinet
  7374. */
  7375. function clearPlusPatinet() {
  7376. $("#editUserCode").val(null);
  7377. $("#editUserName").val(null);
  7378. $("#editUserAge").val(null);
  7379. $("#editUserGender").selectpicker('val', '1');
  7380. $("#editUserGender").selectpicker('refresh');
  7381. $("#editUserBirthDay").val(null);
  7382. $('#editUserCertificateType').selectpicker('val', '01');
  7383. $('#editUserCertificateType').selectpicker('refresh');
  7384. $("#editUserCardNo").val(null);
  7385. $("#editUserCardNo").attr("title", null);
  7386. $("#editUserPhoneNum").val(null);
  7387. $("#editUserPhoneNum").attr("title", null);
  7388. $("#editUserPatientsNature").selectpicker('val', '01');//默认选中
  7389. $('#editUserPatientsNature').selectpicker('refresh');
  7390. $("#editUserIdCard").val(null);
  7391. $("#editUserIdCard").attr("title", null);
  7392. $('#editUserProvinceCode').selectpicker('val', null);
  7393. $('#editUserProvinceCode').selectpicker('refresh');
  7394. $('#editCityCode').selectpicker('val', null);
  7395. $('#editCityCode').selectpicker('refresh');
  7396. $('#editUserDistrictCode').selectpicker('val', null);
  7397. $('#editUserDistrictCode').selectpicker('refresh');
  7398. $("#editUserDetail").val(null);
  7399. $("#editUserContact").val(null);
  7400. $("#editUserContactPhone").val(null);
  7401. var openSource = $("#openSource").val();
  7402. if (openSource == 2 || openSource == '2') {
  7403. $("#rapidAcceptsModal").modal();
  7404. } else if (openSource == 3 || openSource == '3') {
  7405. $("#visitingDetailModal").modal();
  7406. }
  7407. $("#openSource").val(null);
  7408. }
  7409. // /**
  7410. // * 保存入院证
  7411. // */
  7412. // function saveBeHospitalized() {
  7413. // $.ajax({
  7414. // type: "POST",
  7415. // url: '/thmz/saveMzZyReq',
  7416. // contentType: "application/json;charset=UTF-8",
  7417. // dataType: "json",
  7418. // data: JSON.stringify({
  7419. // "patientId": $("#patientId").text(),
  7420. // "icdCode": $("#icdCodeBeHospitalized").val(),
  7421. // "icdText": $("#icdTextBeHospitalized").val(),
  7422. // "reqDept": $("#inpatientWardBeHospitalized").val(),
  7423. // "smallDept": $("#smallWardBeHospitalized").val(),
  7424. // "admissStatus": $("#admissStatus").val()
  7425. // }),
  7426. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7427. // success: function (res) {
  7428. // if (res == '401' || res == 401) {
  7429. // window.location.href = '/thmz/login/view'
  7430. // return;
  7431. // }
  7432. // if (res.code == 0) {
  7433. // successMesage(res);
  7434. // $('#beHospitalizedModal').modal('hide');
  7435. // loadInClinicTableList();
  7436. // loadClinicTableList();
  7437. // clearWorkSpace();
  7438. // } else {
  7439. // errorMesage(res);
  7440. // }
  7441. // }
  7442. // });
  7443. // }
  7444. /**
  7445. * 获取按钮组选择的下标
  7446. * @param id
  7447. * @returns {number}
  7448. */
  7449. function getIndex(id) {
  7450. var index = 0;
  7451. var item = $("#" + id).find("button");
  7452. for (var i = 0; i <= item.length; i++) {
  7453. if ($(item[i]).hasClass("btn-primary")) {
  7454. index = i;
  7455. break;
  7456. }
  7457. }
  7458. return index;
  7459. }
  7460. /**
  7461. * 获取时间选择器的时间数组
  7462. * @returns {string[]}
  7463. */
  7464. function getRePortRangeArr() {
  7465. var rePortRange = $('#reportrange span').html();
  7466. var rePortRangeArr = rePortRange.split(" - ");
  7467. rePortRangeArr[0] = rePortRangeArr[0] + " 00:00:00"
  7468. rePortRangeArr[1] = rePortRangeArr[1] + " 23:59:59"
  7469. return rePortRangeArr;
  7470. }
  7471. /**
  7472. * 初始医生工作太配置
  7473. */
  7474. function initWorkspaceConfigForCurrent() {
  7475. $.ajax({
  7476. type: "GET",
  7477. url: '/thmz/getWorkspaceConfigForCurrent',
  7478. dataType: "json",
  7479. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7480. success: function (res) {
  7481. if (res == '401' || res == 401) {
  7482. window.location.href = '/thmz/login/view'
  7483. return;
  7484. }
  7485. if (res.code == 0) {
  7486. if (res.data.symptomFlag == 1) {
  7487. $("#symptomFlag").removeClass("in").addClass("hide");
  7488. if ($("#symptomFlagCheck").parent().hasClass("checked")) {
  7489. $("#symptomFlagCheck").parent().parent().click();//当前选中改为不选中
  7490. }
  7491. } else if (res.data.symptomFlag == 0) {
  7492. $("#symptomFlag").removeClass("hide").addClass("in");
  7493. if (!$("#symptomFlagCheck").parent().hasClass("checked")) {
  7494. $("#symptomFlagCheck").parent().parent().click();//当前不选中改为选中
  7495. }
  7496. }
  7497. if (res.data.emrHpiFlag == 1) {
  7498. $("#emrHpiFlag").removeClass("in").addClass("hide");
  7499. if ($("#emrHpiFlagCheck").parent().hasClass("checked")) {
  7500. $("#emrHpiFlagCheck").parent().parent().click();//当前选中改为不选中
  7501. }
  7502. } else if (res.data.emrHpiFlag == 0) {
  7503. $("#emrHpiFlag").removeClass("hide").addClass("in");
  7504. if (!$("#emrHpiFlagCheck").parent().hasClass("checked")) {
  7505. $("#emrHpiFlagCheck").parent().parent().click();//当前不选中改为选中
  7506. }
  7507. }
  7508. if (res.data.emrPsFlag == 1) {
  7509. $("#emrPsFlag").removeClass("in").addClass("hide");
  7510. if ($("#emrPsFlagCheck").parent().hasClass("checked")) {
  7511. $("#emrPsFlagCheck").parent().parent().click();//当前选中改为不选中
  7512. }
  7513. } else if (res.data.emrPsFlag == 0) {
  7514. $("#emrPsFlag").removeClass("hide").addClass("in");
  7515. if (!$("#emrPsFlagCheck").parent().hasClass("checked")) {
  7516. $("#emrPsFlagCheck").parent().parent().click();//当前不选中改为选中
  7517. }
  7518. }
  7519. if (res.data.personalHistoryFlag == 1) {
  7520. $("#personalHistoryFlag").removeClass("in").addClass("hide");
  7521. if ($("#personalHistoryFlagCheck").parent().hasClass("checked")) {
  7522. $("#personalHistoryFlagCheck").parent().parent().click();//当前选中改为不选中
  7523. }
  7524. } else if (res.data.personalHistoryFlag == 0) {
  7525. $("#personalHistoryFlag").removeClass("hide").addClass("in");
  7526. if (!$("#personalHistoryFlagCheck").parent().hasClass("checked")) {
  7527. $("#personalHistoryFlagCheck").parent().parent().click();//当前不选中改为选中
  7528. }
  7529. }
  7530. if (res.data.familyHistoryFlag == 1) {
  7531. $("#familyHistoryFlag").removeClass("in").addClass("hide");
  7532. if ($("#familyHistoryFlagCheck").parent().hasClass("checked")) {
  7533. $("#familyHistoryFlagCheck").parent().parent().click();//当前选中改为不选中
  7534. }
  7535. } else if (res.data.familyHistoryFlag == 0) {
  7536. $("#familyHistoryFlag").removeClass("hide").addClass("in");
  7537. if (!$("#familyHistoryFlagCheck").parent().hasClass("checked")) {
  7538. $("#familyHistoryFlagCheck").parent().parent().click();//当前不选中改为选中
  7539. }
  7540. }
  7541. if (res.data.obstericalHistoryFlag == 1) {
  7542. $("#obstericalHistoryFlag").removeClass("in").addClass("hide");
  7543. if ($("#obstericalHistoryFlagCheck").parent().hasClass("checked")) {
  7544. $("#obstericalHistoryFlagCheck").parent().parent().click();//当前选中改为不选中
  7545. }
  7546. } else if (res.data.obstericalHistoryFlag == 0) {
  7547. $("#obstericalHistoryFlag").removeClass("hide").addClass("in");
  7548. if (!$("#obstericalHistoryFlagCheck").parent().hasClass("checked")) {
  7549. $("#obstericalHistoryFlagCheck").parent().parent().click();//当前不选中改为选中
  7550. }
  7551. }
  7552. if (res.data.pressureLeftFlag == 1) {
  7553. $("#pressureLeftFlag").removeClass("in").addClass("hide");
  7554. if ($("#pressureLeftFlagCheck").parent().hasClass("checked")) {
  7555. $("#pressureLeftFlagCheck").parent().parent().click();//当前选中改为不选中
  7556. }
  7557. } else if (res.data.pressureLeftFlag == 0) {
  7558. $("#pressureLeftFlag").removeClass("hide").addClass("in");
  7559. if (!$("#pressureLeftFlagCheck").parent().hasClass("checked")) {
  7560. $("#pressureLeftFlagCheck").parent().parent().click();//当前不选中改为选中
  7561. }
  7562. }
  7563. if (res.data.tentativeDiagnosisFlag == 1) {
  7564. $("#tentativeDiagnosisFlag").removeClass("in").addClass("hide");
  7565. if ($("#tentativeDiagnosisFlagCheck").parent().hasClass("checked")) {
  7566. $("#tentativeDiagnosisFlagCheck").parent().parent().click();//当前选中改为不选中
  7567. }
  7568. } else if (res.data.tentativeDiagnosisFlag == 0) {
  7569. $("#tentativeDiagnosisFlag").removeClass("hide").addClass("in");
  7570. if (!$("#tentativeDiagnosisFlagCheck").parent().hasClass("checked")) {
  7571. $("#tentativeDiagnosisFlagCheck").parent().parent().click();//当前不选中改为选中
  7572. }
  7573. }
  7574. if (res.data.checkboxFlag == 1) {
  7575. if ($("#checkboxFlagCheck").parent().hasClass("checked")) {
  7576. $("#checkboxFlagCheck").parent().parent().click();//当前选中改为不选中
  7577. }
  7578. } else if (res.data.checkboxFlag == 0) {
  7579. if (!$("#checkboxFlagCheck").parent().hasClass("checked")) {
  7580. $("#checkboxFlagCheck").parent().parent().click();//当前不选中改为选中
  7581. }
  7582. }
  7583. if (res.data.zlPrintFlag == 1) {
  7584. if ($("#zlPrintFlagCheck").parent().hasClass("checked")) {
  7585. $("#zlPrintFlagCheck").parent().parent().click();//当前选中改为不选中
  7586. }
  7587. } else if (res.data.zlPrintFlag == 0) {
  7588. if (!$("#zlPrintFlagCheck").parent().hasClass("checked")) {
  7589. $("#zlPrintFlagCheck").parent().parent().click();//当前不选中改为选中
  7590. }
  7591. }
  7592. //设置是否默认勾选处方回调
  7593. localStorage.setItem("checkboxFlag", res.data.checkboxFlag);
  7594. } else {
  7595. errorMesage(res);
  7596. }
  7597. }
  7598. });
  7599. }
  7600. /**
  7601. * 保存医生工作台配置
  7602. */
  7603. function saveWorkspaceConfig() {
  7604. var symptomFlag = $("#symptomFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  7605. var emrHpiFlag = $("#emrHpiFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  7606. var emrPsFlag = $("#emrPsFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  7607. var personalHistoryFlag = $("#personalHistoryFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  7608. var familyHistoryFlag = $("#familyHistoryFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  7609. var obstericalHistoryFlag = $("#obstericalHistoryFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  7610. var pressureLeftFlag = $("#pressureLeftFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  7611. var tentativeDiagnosisFlag = $("#tentativeDiagnosisFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  7612. var checkboxFlag = $("#checkboxFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  7613. var zlPrintFlag = $("#zlPrintFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  7614. $.ajax({
  7615. type: "POST",
  7616. url: '/thmz/saveWorkspaceConfig',
  7617. contentType: "application/json;charset=UTF-8",
  7618. dataType: "json",
  7619. data: JSON.stringify({
  7620. "symptomFlag": symptomFlag,
  7621. "emrHpiFlag": emrHpiFlag,
  7622. "emrPsFlag": emrPsFlag,
  7623. "personalHistoryFlag": personalHistoryFlag,
  7624. "familyHistoryFlag": familyHistoryFlag,
  7625. "obstericalHistoryFlag": obstericalHistoryFlag,
  7626. "pressureLeftFlag": pressureLeftFlag,
  7627. "tentativeDiagnosisFlag": tentativeDiagnosisFlag,
  7628. "checkboxFlag": checkboxFlag,
  7629. "zlPrintFlag": zlPrintFlag
  7630. }),
  7631. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7632. success: function (res) {
  7633. if (res == '401' || res == 401) {
  7634. window.location.href = '/thmz/login/view'
  7635. return;
  7636. }
  7637. if (res.code == 0) {
  7638. successMesage(res);
  7639. initWorkspaceConfigForCurrent();
  7640. $("#configWorkspaceModal").modal("hide");
  7641. } else {
  7642. errorMesage(res);
  7643. }
  7644. }
  7645. });
  7646. }
  7647. /**
  7648. * 初始化药品,检查检验菜单树
  7649. */
  7650. function initzTree() {
  7651. var index = getIndex("bill_item_group");
  7652. if (index == 0) {
  7653. $("#western_medicine_name").webuiPopover('hide');
  7654. $.ajax({
  7655. type: "GET",
  7656. url: '/thmz/getYpZdClasses',
  7657. contentType: "application/json;charset=UTF-8",
  7658. dataType: "json",
  7659. async: false,
  7660. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7661. success: function (res) {
  7662. if (res == '401' || res == 401) {
  7663. window.location.href = '/thmz/login/view'
  7664. return;
  7665. }
  7666. if (res.code == 0) {
  7667. // zTree 的参数配置,深入使用请参考 API 文档(setting 配置详解)
  7668. var setting = {
  7669. callback: {
  7670. onClick: zTreeOnClick
  7671. }
  7672. };
  7673. $.fn.zTree.init($("#treeDemo"), setting, res.data);
  7674. var webuiId = $("#treeButton").attr("data-target");
  7675. var top = $("#" + webuiId).css("top");
  7676. if (top.indexOf("-") == 0) {
  7677. $("#" + webuiId).css("top", '0px');
  7678. }
  7679. } else {
  7680. errorMesage(res);
  7681. }
  7682. }
  7683. });
  7684. } else if (index == 2) {
  7685. $("#jcJyItem").webuiPopover('hide');
  7686. $.ajax({
  7687. type: "GET",
  7688. url: '/thmz/getJyJcZdClasses',
  7689. contentType: "application/json;charset=UTF-8",
  7690. dataType: "json",
  7691. async: false,
  7692. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7693. success: function (res) {
  7694. if (res == '401' || res == 401) {
  7695. window.location.href = '/thmz/login/view'
  7696. return;
  7697. }
  7698. if (res.code == 0) {
  7699. // zTree 的参数配置,深入使用请参考 API 文档(setting 配置详解)
  7700. var setting = {
  7701. callback: {
  7702. onClick: zTreeOnClick
  7703. }
  7704. };
  7705. $.fn.zTree.init($("#treeDemo"), setting, res.data);
  7706. var webuiId = $("#treeButton").attr("data-target");
  7707. var top = $("#" + webuiId).css("top");
  7708. if (top.indexOf("-") == 0) {
  7709. $("#" + webuiId).css("top", '0px');
  7710. }
  7711. } else {
  7712. errorMesage(res);
  7713. }
  7714. }
  7715. });
  7716. } else if (index == 1) {
  7717. $("#treeButton").webuiPopover('hide');
  7718. warningMesageSimaple("中药暂无帮助字典");
  7719. } else if (index == 3) {
  7720. $("#treeButton").webuiPopover('hide');
  7721. warningMesageSimaple("诊疗暂无帮助字典");
  7722. } else {
  7723. $("#treeButton").webuiPopover('hide');
  7724. warningMesageSimaple("入院暂无帮助字典");
  7725. }
  7726. }
  7727. /**
  7728. * 节点点击事件
  7729. * @param event
  7730. * @param treeId
  7731. * @param treeNode
  7732. */
  7733. function zTreeOnClick(event, treeId, treeNode) {
  7734. var index = getIndex("bill_item_group");
  7735. if (index == 0) {
  7736. $("#western_medicine_name").val(treeNode.id);
  7737. $('#western_medicine_name').webuiPopover('show');
  7738. loadYpList(0, null);
  7739. } else if (index == 2) {
  7740. $("#jcJyItem").val(treeNode.id);
  7741. $('#jcJyItem').webuiPopover('show');
  7742. loadjcJyItemList(null);
  7743. }
  7744. }
  7745. /**
  7746. * 构建处方参数
  7747. * @param type 1 保存处方 2 保存模板 3 计算金额
  7748. * @returns {any}
  7749. */
  7750. function getParamsForpPrescription(type) {
  7751. var codes = $("#diagnoseValue").val();
  7752. var icdCode = null;
  7753. if (codes != null && codes.length > 0) {
  7754. var arr = codes.split(",");
  7755. if (arr != null) {
  7756. for (i = 0; i < arr.length; i++) {
  7757. if (arr[i] != "") {
  7758. if (icdCode == null) {
  7759. icdCode = arr[i];
  7760. } else {
  7761. icdCode += "," + arr[i];
  7762. }
  7763. }
  7764. }
  7765. }
  7766. }
  7767. var jsonData = JSON.parse('' +
  7768. '{"patientId": "",' +
  7769. '"firstOrNot":"",' +
  7770. '"icdCode": "",' +
  7771. '"icdText": null,' +
  7772. '"jzFlag": "0",' +
  7773. '"serialNo":"",' +
  7774. '"mzBlRecord": ' +
  7775. '{"firstOrNot": "",' +
  7776. '"emrChiefComplaint": "",' +
  7777. '"emrHpi": "",' +
  7778. '"emrPs": "",' +
  7779. '"emrPe": "",' +
  7780. '"emrFzjc": null,' +
  7781. '"emrProcess": null,' +
  7782. '"emrXyy": "无",' +
  7783. '"emrYypg": "无",' +
  7784. '"emrGnpg": "无",' +
  7785. '"emrJkjy": "",' +
  7786. '"personalHistory": "",' +
  7787. '"familyHistory": "",' +
  7788. '"obstericalHistory": "",' +
  7789. '"weight": "",' +
  7790. '"temperature": "",' +
  7791. '"sphygmus": "",' +
  7792. '"breathe": "",' +
  7793. '"pressureHigh": "",' +
  7794. '"pressureFloor": "",' +
  7795. '"pressureHighLeft": "",' +
  7796. '"pressureFloorLeft": "",' +
  7797. '"tentativeDiagnosis":"",' +
  7798. '"prescriptionDetail":""},' +
  7799. '"mzChargeDetailList": [],' +
  7800. '"mzYjReqList": [],' +
  7801. '"mzZyReq": {"reqDept": "","smallDept": "","admissStatus": ""},' +
  7802. '"zgmztczf":"",' +
  7803. '"grzhzf":"",' +
  7804. '"readCardResult":"",' +
  7805. '"readCardType":"01"}');
  7806. jsonData.patientId = $("#patientId").text();
  7807. jsonData.firstOrNot = $("input[name='firstOrNot']:checked").val();
  7808. jsonData.icdCode = icdCode;
  7809. jsonData.serialNo = $("#mzfzSerialNoInClick").val();
  7810. if (type == 1) {
  7811. jsonData.turnToConsultationId = $("#turnToConsultationIdInClick").val();
  7812. }
  7813. jsonData.mzBlRecord.firstOrNot = jsonData.firstOrNot;
  7814. jsonData.mzBlRecord.emrChiefComplaint = $("#symptom").val();
  7815. jsonData.mzBlRecord.emrHpi = $("#emrHpi").val();
  7816. jsonData.mzBlRecord.emrPs = $("#emrPs").val();
  7817. jsonData.mzBlRecord.emrPe = $("#otherCheck").val();
  7818. jsonData.mzBlRecord.emrJkjy = $("#healthEducation").val();
  7819. jsonData.mzBlRecord.personalHistory = $("#personalHistory").val();
  7820. jsonData.mzBlRecord.familyHistory = $("#familyHistory").val();
  7821. jsonData.mzBlRecord.obstericalHistory = $("#obstericalHistory").val();
  7822. jsonData.mzBlRecord.weight = $("#weight").val();
  7823. jsonData.mzBlRecord.temperature = $("#temperature").val();
  7824. jsonData.mzBlRecord.sphygmus = $("#sphygmus").val();
  7825. jsonData.mzBlRecord.breathe = $("#breathe").val();
  7826. jsonData.mzBlRecord.pressureHigh = $("#pressure_high").val();
  7827. jsonData.mzBlRecord.pressureFloor = $("#pressure_floor").val();
  7828. jsonData.mzBlRecord.pressureHighLeft = $("#pressure_high_left").val();
  7829. jsonData.mzBlRecord.pressureFloorLeft = $("#pressure_floor_left").val();
  7830. jsonData.mzBlRecord.tentativeDiagnosis = $("#tentativeDiagnosis").val();
  7831. //职工统筹部分参数
  7832. jsonData.zgmztczf = $("#zgmztczf").val();
  7833. jsonData.grzhzf = $("#grzhzf").val();
  7834. jsonData.readCardResult = $("#readCardResult").val();
  7835. //设置处方详情
  7836. var emrFzjc = null;
  7837. var xyTabContents = $("#xyTabContent").find("div.tab-pane");
  7838. //处方号
  7839. var orderNo = 0;
  7840. var arrs = $("span.cf_amount");
  7841. //西药设置
  7842. if (xyTabContents != null && xyTabContents.length > 0) {
  7843. for (var i = 0; i < xyTabContents.length; i++) {
  7844. //当前药品类型
  7845. var currentGroupNo = $(xyTabContents[i]).find("input.current_groupNo").val();
  7846. var formGroups = $(xyTabContents[i]).find("div.form-group");
  7847. if (formGroups != null && formGroups.length > 0) {
  7848. for (var j = 0; j < formGroups.length; j++) {
  7849. var tempJson = JSON.parse('{"chargeItemCode": "","serial": "","quantity": "","drugQuan": "","drugUnit": "","frequency": "","orderDays": "","paySelf": "0","drugWin": "1","instructionCode":"",' +
  7850. '"instructionText":"","orderNo":"","groupOrder":"","supplyCode":"","tryFlag":"0","tryResult":"0","groupNo":"","cyJssm":"","cyDj":"","cyFysm":"","cyJsl":"","cyZql":"","cyFj":"","cyFfcs":"","cyMtjs":""}');
  7851. tempJson.chargeItemCode = $(formGroups[j]).find("input.temporary_items_code").val();
  7852. tempJson.serial = $(formGroups[j]).find("input.temporary_items_serial").val();
  7853. tempJson.quantity = $(formGroups[j]).find("input.temporary_items_gross").val();
  7854. tempJson.drugQuan = $(formGroups[j]).find("input.temporary_items_drugWin").val();
  7855. tempJson.drugUnit = $(formGroups[j]).find("input.temporary_items_drugWinUnit").val();
  7856. tempJson.frequency = $(formGroups[j]).find("input.temporary_items_orderFrequency").val();
  7857. tempJson.orderDays = $(formGroups[j]).find("input.temporary_items_dayNum").val();
  7858. tempJson.instructionCode = $(formGroups[j]).find("input.temporary_items_medicalAdvice").val();
  7859. tempJson.instructionText = $(formGroups[j]).find("input.temporary_items_medicalAdviceText").val();
  7860. tempJson.supplyCode = $(formGroups[j]).find("input.temporary_items_supplyType").val();
  7861. orderNo = i + 1;
  7862. tempJson.orderNo = orderNo;
  7863. tempJson.groupOrder = $(formGroups[j]).find("input.temporary_items_groupId").val();
  7864. tempJson.groupNo = currentGroupNo;
  7865. var tryResult = $(formGroups[j]).find("input.temporary_items_tryResult").val();
  7866. if (tryResult != undefined || tryResult != null || tryResult != "") {
  7867. if (tryResult == 100 || tryResult == "100") {
  7868. tempJson.tryFlag = 1;
  7869. } else {
  7870. tempJson.tryResult = tryResult;
  7871. }
  7872. }
  7873. jsonData.mzChargeDetailList[jsonData.mzChargeDetailList.length] = tempJson;
  7874. }
  7875. }
  7876. }
  7877. }
  7878. //中草药
  7879. var zyTabContents = $("#zyTabContent").find("div.form-group");
  7880. if (zyTabContents != null && zyTabContents.length > 0) {
  7881. orderNo++;
  7882. var zyfs = $("#zyfs").val();
  7883. if (zyfs == null || zyfs == "") {
  7884. if (type == 3) {
  7885. zyfs = 1;
  7886. } else {
  7887. errorMesageSimaple("中药付数为空,请设置!");
  7888. $("#messageButton").attr("disabled", false);
  7889. throw new Error('中药付数为空,请设置!');
  7890. }
  7891. }
  7892. //中药的类型
  7893. var currentZyClassType = $("#current_zyClassType").val();
  7894. for (var i = 0; i < zyTabContents.length; i++) {
  7895. var tempJson = JSON.parse('{"chargeItemCode": "","serial": "","quantity": "","drugQuan": "","drugUnit": "g","frequency": "","orderDays": "1","paySelf": "0","drugWin": "","instructionCode":"",' +
  7896. '"instructionText":"","orderNo":"1","groupOrder":"1","supplyCode":"","tryFlag":"0","tryResult":"0","groupNo":"","cyJssm":"","cyDj":"","cyFysm":"","cyJsl":"","cyZql":"","cyFj":"","cyFfcs":"","cyMtjs":""}');
  7897. tempJson.chargeItemCode = $(zyTabContents[i]).find("input.temporary_items_code").val();
  7898. tempJson.serial = $(zyTabContents[i]).find("input.temporary_items_serial").val();
  7899. tempJson.quantity = $(zyTabContents[i]).find("input.temporary_items_drugWin").val();
  7900. tempJson.drugQuan = $(zyTabContents[i]).find("input.temporary_items_drugWin").val();
  7901. tempJson.drugWin = zyfs;
  7902. //tempJson.frequency = $("#zy_orderFrequency_1").val();
  7903. tempJson.instructionCode = $(zyTabContents[i]).find("input.temporary_items_zyInstruction").val();
  7904. tempJson.instructionText = $(zyTabContents[i]).find("input.temporary_items_zyInstructionText").val();
  7905. tempJson.cyFysm = $("#useType_1").val();
  7906. tempJson.cyJssm = $("#cyJssm").val();
  7907. tempJson.cyDj = $("#zy_supplyType_1").val();
  7908. tempJson.cyJsl = $("#cyJsl").val();
  7909. tempJson.cyZql = $("#cyZql").val();
  7910. tempJson.cyFj = $("#cyFj").val();
  7911. tempJson.cyFfcs = $("#cyFfcs").val();
  7912. tempJson.cyMtjs = $("#cyMtjs").val();
  7913. tempJson.orderNo = orderNo;
  7914. tempJson.groupNo = currentZyClassType;
  7915. jsonData.mzChargeDetailList[jsonData.mzChargeDetailList.length] = tempJson;
  7916. }
  7917. }
  7918. //辅助检查、检验
  7919. var jcjyTabContents = $("#jcjyTabContent").find("div.form-group");
  7920. if (jcjyTabContents != null && jcjyTabContents.length > 0) {
  7921. orderNo++;
  7922. for (var i = 0; i < jcjyTabContents.length; i++) {
  7923. if (emrFzjc == null) {
  7924. emrFzjc = $(jcjyTabContents[i]).text();
  7925. } else {
  7926. emrFzjc += "," + $(jcjyTabContents[i]).text();
  7927. }
  7928. var tempJson = null;
  7929. //项目类型
  7930. var itemsType = $(jcjyTabContents[i]).find("input.temporary_items_type").val();
  7931. //执行科室
  7932. var execUnit = $(jcjyTabContents[i]).find("input.temporary_items_execUnit").val();
  7933. tempJson = JSON.parse('{"orderCode":"","inspectPart":"","inspectStuff":"","jyRemark":"","orderNo":"1","execDept":""}');
  7934. tempJson.orderCode = $(jcjyTabContents[i]).find("input.temporary_items_code").val();
  7935. if (itemsType == "1" || itemsType == 1) {
  7936. //检验
  7937. tempJson.inspectStuff = $(jcjyTabContents[i]).find("input.temporary_items_desc_value").val();
  7938. } else if (itemsType == "2" || itemsType == 2) {
  7939. //检查
  7940. tempJson.inspectPart = $(jcjyTabContents[i]).find("input.temporary_items_desc_value").val();
  7941. }
  7942. tempJson.jyRemark = $(jcjyTabContents[i]).find("input.temporary_items_remark").val();
  7943. tempJson.orderNo = orderNo;
  7944. tempJson.execDept = execUnit;
  7945. jsonData.mzYjReqList[jsonData.mzYjReqList.length] = tempJson;
  7946. }
  7947. }
  7948. //诊疗
  7949. var zlTabContents = $("#zlTabContent").find("div.form-group");
  7950. if (zlTabContents != null && zlTabContents.length > 0) {
  7951. orderNo++;
  7952. for (var i = 0; i < zlTabContents.length; i++) {
  7953. var tempJson = null;
  7954. //执行科室
  7955. var execUnit = $(zlTabContents[i]).find("input.temporary_items_execUnit").val();
  7956. //诊疗,放入药品类型中入库,因为诊疗是与药品一样直接入明细库,但是是与医技在同一处方开立页面开立
  7957. 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":""}');
  7958. tempJson.chargeItemCode = $(zlTabContents[i]).find("input.temporary_items_code").val();
  7959. tempJson.instructionText = $(zlTabContents[i]).find("input.temporary_items_remark").val();
  7960. tempJson.quantity = $(zlTabContents[i]).find("input.temporary_items_totalNumZl").val();
  7961. tempJson.drugQuan = $(zlTabContents[i]).find("input.temporary_items_itemQuantity").val();
  7962. //因为收费表里的单位长度限制,无法存入库
  7963. //tempJson.drugUnit = $(zlTabContents[i]).find("input.temporary_items_desc_value").val();
  7964. tempJson.frequency = $(zlTabContents[i]).find("input.temporary_items_orderFrequencyZl").val();
  7965. tempJson.orderDays = $(zlTabContents[i]).find("input.temporary_items_dayZlNum").val();
  7966. tempJson.orderNo = orderNo;
  7967. tempJson.execDept = execUnit;
  7968. jsonData.mzChargeDetailList[jsonData.mzChargeDetailList.length] = tempJson;
  7969. }
  7970. }
  7971. //入院
  7972. var zyReqTabContents = $("#zyReqTabContent").find("div.form-group");
  7973. if (zyReqTabContents != null && zyReqTabContents.length > 0) {
  7974. jsonData.mzZyReq.reqDept = $(zyReqTabContents[0]).find("input.temporary_inpatient_ward").val();
  7975. jsonData.mzZyReq.smallDept = $(zyReqTabContents[0]).find("input.temporary_items_small_ward").val();
  7976. jsonData.mzZyReq.admissStatus = $(zyReqTabContents[0]).find("input.temporary_items_admiss_status").val();
  7977. }
  7978. //设置诊断名称
  7979. var icdText = null;
  7980. var tagsTexts = $("span.el-select__tags-text");
  7981. if (tagsTexts != null && tagsTexts.length > 0) {
  7982. for (var i = 0; i < tagsTexts.length; i++) {
  7983. if (icdText == null) {
  7984. icdText = $(tagsTexts[i]).text();
  7985. } else {
  7986. icdText += "," + $(tagsTexts[i]).text();
  7987. }
  7988. }
  7989. }
  7990. jsonData.icdText = icdText;
  7991. jsonData.mzBlRecord.emrFzjc = emrFzjc;
  7992. return jsonData;
  7993. }
  7994. /**
  7995. * 保存处方
  7996. */
  7997. function savePrescription() {
  7998. if (!verifyInsuranceInfo()) {
  7999. return;
  8000. }
  8001. //关闭帮助框
  8002. $("#treeButton").webuiPopover('hide');
  8003. $("#western_medicine_name").webuiPopover('hide');
  8004. $("#chinese_medicine_name").webuiPopover('hide');
  8005. $("#jcJyItem").webuiPopover('hide');
  8006. $("#zlItem").webuiPopover('hide');
  8007. var zgmztczf = $("#zgmztczf").val();
  8008. var readCardResult = $("#readCardResult").val();
  8009. if ((zgmztczf == 1 || zgmztczf == "1") && (readCardResult == null || readCardResult == "")) {
  8010. $("#messageModal").modal();
  8011. $("#messageContent").html("门诊统筹处方必须读卡,是否立即读卡?");
  8012. $("#messageButton").off("click").bind("click", function (t) {
  8013. mztczfSiReadCard(true);
  8014. realSavePrescription(false);
  8015. });
  8016. $("#cancelButton").off("click").bind("click", function (t) {
  8017. t.stopPropagation();
  8018. t.preventDefault();
  8019. realSavePrescription(false);
  8020. });
  8021. } else {
  8022. realSavePrescription(true);
  8023. }
  8024. }
  8025. /**
  8026. * 最终保存处方方法
  8027. * @param openModel 是否需要打开提示弹层 true 需要 false 不需要
  8028. */
  8029. function realSavePrescription(openModel) {
  8030. if (openModel) {
  8031. $("#messageModal").modal();
  8032. }
  8033. $("#messageContent").html("确认保存处方吗?");
  8034. $("#messageButton").off("click").bind("click", function (t) {
  8035. if (mztczfSiReadCardStatus) {
  8036. $("#messageContent").html("门诊统筹正在读卡中,次操作需与医保中心交互,耗时较长,请耐心等待...");
  8037. return;
  8038. }
  8039. $("#messageButton").attr("disabled", true);
  8040. var jsonData = getParamsForpPrescription(1);
  8041. $.ajax({
  8042. type: "POST",
  8043. url: '/thmz/savePrescription',
  8044. contentType: "application/json;charset=UTF-8",
  8045. dataType: "json",
  8046. data: JSON.stringify(jsonData),
  8047. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8048. success: function (res) {
  8049. if (res == '401' || res == 401) {
  8050. window.location.href = '/thmz/login/view'
  8051. return;
  8052. }
  8053. $("#messageButton").attr("disabled", false);
  8054. if (res.code == 0) {
  8055. successMesage(res);
  8056. clearWorkSpace();
  8057. loadInClinicTableList();
  8058. loadClinicTableList();
  8059. //$("#messageModal").modal();
  8060. $("#messageContent").html("门诊处方保存成功,是否打印处方和门诊指引单?");
  8061. $("#messageButton").off("click").on("click", function (t) {
  8062. $("#messageModal").modal("hide");
  8063. printPrescription(res.data.patientId, res.data.times, res.data.id, 5, 1);
  8064. });
  8065. $("#cancelButton").off("click");
  8066. } else {
  8067. $("#messageModal").modal("hide");
  8068. errorMesage(res);
  8069. }
  8070. }
  8071. });
  8072. });
  8073. $("#cancelButton").off("click");
  8074. }
  8075. /**
  8076. * 保存医疗范文
  8077. */
  8078. function saveapidAccepts() {
  8079. var templateName = $("#templateName").val();
  8080. if (templateName == null || templateName == "") {
  8081. errorMesageSimaple("范文名称不能为空!");
  8082. return;
  8083. }
  8084. var templateKindType = $("#templateKindType").val();
  8085. if (templateKindType == null || templateKindType == "") {
  8086. errorMesageSimaple("范文类型不能为空!");
  8087. return;
  8088. }
  8089. var templateType = $("#templateType").val();
  8090. if (templateType == null || templateType == "") {
  8091. errorMesageSimaple("范文范围不能为空!");
  8092. return;
  8093. }
  8094. var templateStatus = $("#templateStatus").val();
  8095. if (templateStatus == null || templateStatus == "") {
  8096. errorMesageSimaple("范文状态不能为空!");
  8097. return;
  8098. }
  8099. $("#saveapidAcceptsModal").modal("hide");
  8100. $("#messageModal").modal();
  8101. $("#messageContent").html("确认保存医疗范文吗?");
  8102. $("#messageButton").off("click").on("click", function (t) {
  8103. $("#messageModal").modal("hide");
  8104. var jsonData = getParamsForpPrescription(2);
  8105. var operationType = $("#operationType").val();
  8106. var templateId = $("#templateId").val();
  8107. if (operationType == 0 || operationType == '0') {
  8108. templateId = null;
  8109. }
  8110. $.ajax({
  8111. type: "POST",
  8112. url: '/thmz/saveTemplate',
  8113. contentType: "application/json;charset=UTF-8",
  8114. dataType: "json",
  8115. data: JSON.stringify({
  8116. "id": templateId,
  8117. "name": templateName,
  8118. "icdText": jsonData.icdText != null ? jsonData.icdText : jsonData.mzBlRecord.tentativeDiagnosis,
  8119. "templateKindType": templateKindType,
  8120. "templateType": templateType,
  8121. "templateStatus": templateStatus,
  8122. "templateData": JSON.stringify(jsonData),
  8123. "emrChiefComplaint": $("#symptom").val(),
  8124. "emrHpi": $("#emrHpi").val(),
  8125. "emrPs": $("#emrPs").val(),
  8126. "icdCode": $("#diagnoseValue").val()
  8127. }),
  8128. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8129. success: function (res) {
  8130. if (res == '401' || res == 401) {
  8131. window.location.href = '/thmz/login/view'
  8132. return;
  8133. }
  8134. if (res.code == 0) {
  8135. successMesage(res);
  8136. //范本保存完不清空
  8137. //clearWorkSpace();
  8138. } else {
  8139. $("#saveapidAcceptsModal").modal();
  8140. errorMesage(res);
  8141. }
  8142. }
  8143. });
  8144. });
  8145. $("#cancelButton").off("click");
  8146. }
  8147. /**
  8148. * 停用医疗范文
  8149. */
  8150. function removeTemplate() {
  8151. $("#messageModal").modal();
  8152. $("#messageContent").html("确认停用医疗范文吗?");
  8153. $("#messageButton").off("click").on("click", function (t) {
  8154. $("#messageModal").modal("hide");
  8155. $.ajax({
  8156. type: "POST",
  8157. url: '/thmz/removeTemplate',
  8158. contentType: "application/json;charset=UTF-8",
  8159. dataType: "json",
  8160. data: JSON.stringify({
  8161. "id": $("#idTemplate").val()
  8162. }),
  8163. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8164. success: function (res) {
  8165. if (res == '401' || res == 401) {
  8166. window.location.href = '/thmz/login/view'
  8167. return;
  8168. }
  8169. if (res.code == 0) {
  8170. successMesage(res);
  8171. $("#medicalModelModal").modal("hide");
  8172. fitTemplateData();
  8173. } else {
  8174. errorMesage(res);
  8175. }
  8176. }
  8177. });
  8178. });
  8179. $("#cancelButton").off("click");
  8180. }
  8181. /**
  8182. * 清空医疗范文模块内容
  8183. */
  8184. function clearApidAcceptsModal() {
  8185. $("#templateId").val(null);
  8186. $("#templateName").val(null);
  8187. $("#templateKindType").selectpicker('val', 0);
  8188. $("#templateKindType").selectpicker('refresh');
  8189. $("#templateType").selectpicker('val', 0);
  8190. $("#templateType").selectpicker('refresh');
  8191. $("#templateStatus").selectpicker('val', 0);
  8192. $("#templateStatus").selectpicker('refresh');
  8193. $('#operationType').selectpicker('val', 0);
  8194. $('#operationType').selectpicker('refresh');
  8195. $("#operationTypeDiv").removeClass("in").addClass("hide");
  8196. }
  8197. /**
  8198. * 查询病人未缴费处方信息 加载到处方修改
  8199. * @param patientId
  8200. * @param times
  8201. * @param clnicId 就诊记录id
  8202. */
  8203. function getMzPrescriptionVoUnPaid(patientId, times, clnicId) {
  8204. var currentPatientId = $("#patientId").text();
  8205. //当前接诊的用户和操作接诊的是同一个人,不做任何操作
  8206. if (currentPatientId == patientId) {
  8207. warningMesageSimaple("当前病人正在接诊中,请勿重复操作!");
  8208. return;
  8209. }
  8210. if (currentPatientId == null || currentPatientId == "") {
  8211. //当前没有人接诊,直接接诊
  8212. getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId);
  8213. } else {
  8214. //当前有人在接诊,提示是否需要切换和保存
  8215. $("#messagePrescriptionModal").modal();
  8216. $("#confirmPrescriptionButton").off("click").on("click", function (t) {
  8217. $("#messagePrescriptionModal").modal("hide");
  8218. //先保存目前接诊信息,再切换就诊人
  8219. var jsonData = getParamsForpPrescription(1);
  8220. $.ajax({
  8221. type: "POST",
  8222. url: '/thmz/savePrescription',
  8223. contentType: "application/json;charset=UTF-8",
  8224. dataType: "json",
  8225. data: JSON.stringify(jsonData),
  8226. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8227. success: function (res) {
  8228. if (res == '401' || res == 401) {
  8229. window.location.href = '/thmz/login/view'
  8230. return;
  8231. }
  8232. if (res.code == 0) {
  8233. loadInClinicTableList();
  8234. loadClinicTableList();
  8235. getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId);
  8236. } else {
  8237. errorMesage(res);
  8238. }
  8239. }
  8240. });
  8241. });
  8242. $("#cancelPrescriptionButton").off("click").on("click", function (t) {
  8243. $("#messagePrescriptionModal").modal("hide");
  8244. getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId);
  8245. });
  8246. }
  8247. }
  8248. /**
  8249. * 查询病人未缴费处方信息 加载到处方修改 通用方法
  8250. * @param patientId
  8251. * @param times
  8252. * @param clnicId 就诊记录id
  8253. */
  8254. function getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId) {
  8255. $.ajax({
  8256. type: "GET",
  8257. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + "&times=" + times + "&MzBlRecordFlag=false&payMark=5&clnicId=null",
  8258. contentType: "application/json;charset=UTF-8",
  8259. dataType: "json",
  8260. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8261. success: function (res) {
  8262. if (res == '401' || res == 401) {
  8263. window.location.href = '/thmz/login/view'
  8264. return;
  8265. }
  8266. if (res.code == 0) {
  8267. clearWorkSpace();
  8268. setMzPatientInfo(res.mzPatientMi);
  8269. editPrescription(res.data, 0)
  8270. //修改患者的时候,将原纪录的就诊记录id带上,并借用分诊流水号字段传参
  8271. $("#mzfzSerialNoInClick").val("clnicId_" + clnicId);
  8272. //查询患者的门诊统筹信息
  8273. queryInsuinfo(patientId);
  8274. } else {
  8275. errorMesage(res);
  8276. }
  8277. }
  8278. });
  8279. }
  8280. /**
  8281. * 查询病人已缴费处方信息 调用处方
  8282. * @param patientId
  8283. * @param times
  8284. * @param clnicId 就诊记录id
  8285. */
  8286. function getMzPrescriptionVoPaid(patientId, times, clnicId) {
  8287. $("#visitingDetailModal").modal("hide");
  8288. $("#messageModal").modal();
  8289. $("#messageContent").html("确认调用选中处方吗?将会覆盖当前处方。");
  8290. $("#messageButton").off("click").on("click", function (t) {
  8291. $("#messageModal").modal("hide");
  8292. $.ajax({
  8293. type: "GET",
  8294. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + "&times=" + times + "&MzBlRecordFlag=false&payMark=0&clnicId=null",
  8295. contentType: "application/json;charset=UTF-8",
  8296. dataType: "json",
  8297. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8298. success: function (res) {
  8299. if (res == '401' || res == 401) {
  8300. window.location.href = '/thmz/login/view'
  8301. return;
  8302. }
  8303. if (res.code == 0) {
  8304. var mzfzSerialNoInClick = $("#mzfzSerialNoInClick").val();
  8305. var mzfzReqTypeNoInClick = $("#mzfzReqTypeNoInClick").val();
  8306. clearUser(false);
  8307. clearWorkSpaceExcludeUser(3);
  8308. setMzPatientInfo(res.mzPatientMi);
  8309. editPrescription(res.data, 2)
  8310. $("#mzfzSerialNoInClick").val(mzfzSerialNoInClick);
  8311. $("#mzfzReqTypeNoInClick").val(mzfzReqTypeNoInClick);
  8312. } else {
  8313. errorMesage(res);
  8314. }
  8315. }
  8316. });
  8317. });
  8318. $("#cancelButton").off("click");
  8319. }
  8320. /**
  8321. * 重复接诊
  8322. * @param patientId
  8323. * @param times
  8324. * @param clnicId
  8325. * @param deptCode 就诊科室编码
  8326. */
  8327. function repeatAccepts(patientId, times, clnicId, deptCode) {
  8328. $.ajax({
  8329. type: "GET",
  8330. url: '/thmz/validMzyReqrec?patientId=' + patientId + "&deptCode=" + deptCode,
  8331. contentType: "application/json;charset=UTF-8",
  8332. dataType: "json",
  8333. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8334. success: function (res) {
  8335. if (res == '401' || res == 401) {
  8336. window.location.href = '/thmz/login/view'
  8337. return;
  8338. }
  8339. if (res.code == 0) {
  8340. if (res.data == 0) {
  8341. $("#messageModal").modal();
  8342. $("#messageContent").html("挂号失效,确定继续就诊?");
  8343. $("#messageButton").off("click").on("click", function (t) {
  8344. $("#messageModal").modal("hide");
  8345. repeatAcceptsConfirm(patientId, times, clnicId);
  8346. });
  8347. $("#cancelButton").off("click");
  8348. return;
  8349. }
  8350. repeatAcceptsConfirm(patientId, times, clnicId);
  8351. } else {
  8352. errorMesage(res);
  8353. }
  8354. }
  8355. });
  8356. }
  8357. /**
  8358. * 重复接诊提示方法
  8359. * @param patientId
  8360. * @param times
  8361. * @param clnicId
  8362. */
  8363. function repeatAcceptsConfirm(patientId, times, clnicId) {
  8364. var currentPatientId = $("#patientId").text();
  8365. //当前接诊的用户和操作接诊的是同一个人,不做任何操作
  8366. if (currentPatientId == patientId) {
  8367. return;
  8368. }
  8369. if (currentPatientId == null || currentPatientId == "") {
  8370. //当前没有人接诊,直接接诊
  8371. repeatAcceptsCommon(patientId, times, clnicId);
  8372. } else {
  8373. //当前有人在接诊,提示是否需要切换和保存
  8374. $("#messagePrescriptionModal").modal();
  8375. $("#confirmPrescriptionButton").off("click").on("click", function (t) {
  8376. $("#messagePrescriptionModal").modal("hide");
  8377. //先保存目前接诊信息,再切换就诊人
  8378. var jsonData = getParamsForpPrescription(1);
  8379. $.ajax({
  8380. type: "POST",
  8381. url: '/thmz/savePrescription',
  8382. contentType: "application/json;charset=UTF-8",
  8383. dataType: "json",
  8384. data: JSON.stringify(jsonData),
  8385. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8386. success: function (res) {
  8387. if (res == '401' || res == 401) {
  8388. window.location.href = '/thmz/login/view'
  8389. return;
  8390. }
  8391. if (res.code == 0) {
  8392. repeatAcceptsCommon(patientId, times, clnicId);
  8393. //加载已接诊患者列表
  8394. loadClinicTableList();
  8395. } else {
  8396. errorMesage(res);
  8397. }
  8398. }
  8399. });
  8400. });
  8401. $("#cancelPrescriptionButton").off("click").on("click", function (t) {
  8402. $("#messagePrescriptionModal").modal("hide");
  8403. repeatAcceptsCommon(patientId, times, clnicId);
  8404. });
  8405. }
  8406. }
  8407. /**
  8408. * 重复接诊通用方法
  8409. * @param patientId
  8410. * @param times
  8411. * @param clnicId
  8412. */
  8413. function repeatAcceptsCommon(patientId, times, clnicId) {
  8414. $.ajax({
  8415. type: "GET",
  8416. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + "&times=" + times + "&MzBlRecordFlag=true&payMark=null&clnicId=null",
  8417. contentType: "application/json;charset=UTF-8",
  8418. dataType: "json",
  8419. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8420. success: function (res) {
  8421. if (res == '401' || res == 401) {
  8422. window.location.href = '/thmz/login/view'
  8423. return;
  8424. }
  8425. if (res.code == 0) {
  8426. clearWorkSpace();
  8427. setMzPatientInfo(res.mzPatientMi);
  8428. editPrescription(res.data, 0)
  8429. //修改患者的时候,将原纪录的就诊记录id带上,并借用分诊流水号字段传参
  8430. $("#mzfzSerialNoInClick").val("clnicId_" + clnicId);
  8431. //查询患者的门诊统筹信息
  8432. queryInsuinfo(patientId);
  8433. } else {
  8434. errorMesage(res);
  8435. }
  8436. }
  8437. });
  8438. }
  8439. /**
  8440. * 就诊详情 已诊患者列表发起
  8441. * @param patientId
  8442. * @param times
  8443. * @param clnicId
  8444. * @param payMark
  8445. */
  8446. function prescriptionDetail(patientId, times, clnicId, payMark) {
  8447. prescriptionDetailCommon(patientId, times, clnicId, payMark, 0);
  8448. }
  8449. /**
  8450. * 就诊详情 历史轨迹发起
  8451. * @param patientId
  8452. * @param times
  8453. * @param clnicId
  8454. * @param clinicStatus
  8455. */
  8456. function visitingDetailModal(patientId, times, clnicId, clinicStatus) {
  8457. closeObjectWebui(false);
  8458. var payMark = null;
  8459. if (clinicStatus == 5) {
  8460. payMark = 5;
  8461. } else {
  8462. payMark = 0;
  8463. }
  8464. prescriptionDetailCommon(patientId, times, clnicId, payMark, 1);
  8465. }
  8466. /**
  8467. * 就诊详情通用方法
  8468. * @param patientId
  8469. * @param times
  8470. * @param clnicId
  8471. * @param payMark
  8472. * @param type 0 已诊患者列表发起 1 历史轨迹发起
  8473. */
  8474. function prescriptionDetailCommon(patientId, times, clnicId, payMark, type) {
  8475. $('#baseMzBlTimes').val(null);
  8476. var oriPayMark = payMark;
  8477. if (payMark == 1) {
  8478. //退费时,查看的明细还是处方开立的情况
  8479. payMark = 0;
  8480. }
  8481. //是否默认勾选处方回调
  8482. var checkboxFlag = localStorage.getItem("checkboxFlag");
  8483. if (checkboxFlag != null && (checkboxFlag == "0" || checkboxFlag == 0)) {
  8484. $("#conciseRecordsJzxq").prop("checked", true);
  8485. $("#prescriptionSubsidiaryJzxq").prop("checked", true);
  8486. } else {
  8487. $("#conciseRecordsJzxq").prop("checked", false);
  8488. $("#prescriptionSubsidiaryJzxq").prop("checked", false);
  8489. }
  8490. $.ajax({
  8491. type: "GET",
  8492. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + '&times=' + times + '&MzBlRecordFlag=false&payMark=' + payMark + '&clnicId=' + clnicId,
  8493. contentType: "application/json;charset=UTF-8",
  8494. dataType: "json",
  8495. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8496. success: function (res) {
  8497. if (res == '401' || res == 401) {
  8498. window.location.href = '/thmz/login/view'
  8499. return;
  8500. }
  8501. if (res.code == 0) {
  8502. $("#visitingDetailModal").modal();
  8503. var jsonData = res.data;
  8504. var mzPatientMi = res.mzPatientMi;
  8505. $("#visitingDetailPatientName").html('<a onclick="editUserModal(\'' + mzPatientMi.patientId + '\',3)" style=\'cursor: pointer;\'>' + mzPatientMi.name + '</a>');
  8506. $("#visitingDetailPatientAge").text(mzPatientMi.ageString);
  8507. $("#visitingDetailPatientGender").val(mzPatientMi.gender);
  8508. $("#prescriptionDetail_zd").html("");
  8509. $("#prescriptionDetail_xyzlContent").html("");
  8510. $("#prescriptionDetail_zyzlContent").html("");
  8511. $("#prescriptionDetail_zlyjContent").html("");
  8512. if (res.opDate != null) {
  8513. $("#visitingDetailDate").text(res.opDate);
  8514. }
  8515. if (res.deptName != null) {
  8516. $("#visitingDetailDept").text(res.deptName);
  8517. }
  8518. if (res.doctorName != null) {
  8519. $("#visitingDetailDoctor").text(res.doctorName);
  8520. }
  8521. var firstOrNot = jsonData.mzBlRecord.firstOrNot;
  8522. if (firstOrNot == 0) {
  8523. $("#visitFlag").html("初诊");
  8524. $("#first").next().click();
  8525. } else if (firstOrNot == 1) {
  8526. $("#visitFlag").html("复诊");
  8527. $("#not").next().click();
  8528. }
  8529. if (oriPayMark == 0) {
  8530. $("#chargeImage").attr("src", "/thmz/images/charge.png");
  8531. } else if (oriPayMark == 1) {
  8532. $("#chargeImage").attr("src", "/thmz/images/refund.png");
  8533. } else if (oriPayMark == 5) {
  8534. $("#chargeImage").attr("src", "/thmz/images/nocharge.png");
  8535. }
  8536. $("#prescriptionDetail_zs").html(jsonData.mzBlRecord.emrChiefComplaint);
  8537. $("#prescriptionDetail_xbs").html(jsonData.mzBlRecord.emrHpi);
  8538. $("#prescriptionDetail_tgjc").html(jsonData.mzBlRecord.emrPe);
  8539. $("#prescriptionDetail_jkjy").html(jsonData.mzBlRecord.emrJkjy);
  8540. var icdText = jsonData.icdText;
  8541. if (icdText != null) {
  8542. var arr = icdText.split(",");
  8543. var html = "";
  8544. for (var i = 0; i < arr.length; i++) {
  8545. if (i == 0) {
  8546. html += ' <div class="tagZdy tagZdy-back">';
  8547. } else {
  8548. html += ' <div class="tagZdy tagZdy-back-green">';
  8549. }
  8550. html += arr[i];
  8551. html += '</div>';
  8552. }
  8553. $("#prescriptionDetail_zd").html(html);
  8554. } else {
  8555. $("#prescriptionDetail_zd").html(jsonData.mzBlRecord.tentativeDiagnosis);
  8556. }
  8557. var prescriptionDetail = jsonData.mzBlRecord.prescriptionDetail;
  8558. if (prescriptionDetail != null) {
  8559. var checkBox = type == 1;
  8560. prescriptionDetail = JSON.parse(prescriptionDetail);
  8561. var xyPrescription = prescriptionDetail.xyPrescription;
  8562. if (xyPrescription != null) {
  8563. fitxyContent(xyPrescription.pyPrescription, "prescriptionDetail_xypyContent", "prescriptionDetail_xypyTitle", checkBox);
  8564. fitxyContent(xyPrescription.mjPrescription, "prescriptionDetail_xymjContent", "prescriptionDetail_xymjTitle", checkBox);
  8565. fitxyContent(xyPrescription.jePrescription, "prescriptionDetail_xyjeContent", "prescriptionDetail_xyjeTitle", checkBox);
  8566. fitxyContent(xyPrescription.ycPrescription, "prescriptionDetail_yczlContent", "prescriptionDetail_yczlTitle", checkBox);
  8567. } else {
  8568. $("#prescriptionDetail_xypyTitle").removeClass("in").addClass("hide");
  8569. $("#prescriptionDetail_xypyContent").html("");
  8570. $("#prescriptionDetail_xymjTitle").removeClass("in").addClass("hide");
  8571. $("#prescriptionDetail_xymjContent").html("");
  8572. $("#prescriptionDetail_xyjeTitle").removeClass("in").addClass("hide");
  8573. $("#prescriptionDetail_xyjeContent").html("");
  8574. $("#prescriptionDetail_yczlTitle").removeClass("in").addClass("hide");
  8575. $("#prescriptionDetail_yczlContent").html("");
  8576. }
  8577. var zyPrescription = prescriptionDetail.zyPrescription;
  8578. if (zyPrescription != null) {
  8579. fitzyContent(zyPrescription, "prescriptionDetail_zyzlContent", "prescriptionDetail_zyzlTitle", checkBox);
  8580. } else {
  8581. $("#prescriptionDetail_zyzlTitle").removeClass("in").addClass("hide");
  8582. $("#prescriptionDetail_zyzlContent").html("");
  8583. }
  8584. var jcjyPrescription = prescriptionDetail.jcjyPrescription;
  8585. if (jcjyPrescription != null) {
  8586. fitJcjyContent(jcjyPrescription, "prescriptionDetail_jcjyContent", "prescriptionDetail_jcjyTitle", checkBox);
  8587. } else {
  8588. ("#prescriptionDetail_jcjyTitle").removeClass("in").addClass("hide");
  8589. $("#prescriptionDetail_jcjyContent").html("");
  8590. }
  8591. var zlPrescription = prescriptionDetail.zlPrescription;
  8592. if (zlPrescription != null) {
  8593. fitJcjyContent(zlPrescription, "prescriptionDetail_zlContent", "prescriptionDetail_zlTitle", checkBox);
  8594. } else {
  8595. $("#prescriptionDetail_zlTitle").removeClass("in").addClass("hide");
  8596. $("#prescriptionDetail_zlContent").html("");
  8597. }
  8598. var zyReqPrescription = prescriptionDetail.zyReqPrescription;
  8599. if (zyReqPrescription != null) {
  8600. fitZyReqContent(zyReqPrescription, "prescriptionDetail_zyReqContent", "prescriptionDetail_zyReqTitle", true);
  8601. } else {
  8602. $("#prescriptionDetail_zyReqTitle").removeClass("in").addClass("hide");
  8603. $("#prescriptionDetail_zyReqContent").html("");
  8604. }
  8605. } else {
  8606. $("#prescriptionDetail_xypyTitle").removeClass("in").addClass("hide");
  8607. $("#prescriptionDetail_xypyContent").html("");
  8608. $("#prescriptionDetail_xymjTitle").removeClass("in").addClass("hide");
  8609. $("#prescriptionDetail_xymjContent").html("");
  8610. $("#prescriptionDetail_xyjeTitle").removeClass("in").addClass("hide");
  8611. $("#prescriptionDetail_xyjeContent").html("");
  8612. $("#prescriptionDetail_yczlTitle").removeClass("in").addClass("hide");
  8613. $("#prescriptionDetail_yczlContent").html("");
  8614. $("#prescriptionDetail_zyzlTitle").removeClass("in").addClass("hide");
  8615. $("#prescriptionDetail_zyzlContent").html("");
  8616. $("#prescriptionDetail_jcjyTitle").removeClass("in").addClass("hide");
  8617. $("#prescriptionDetail_jcjyContent").html("");
  8618. $("#prescriptionDetail_zlTitle").removeClass("in").addClass("hide");
  8619. $("#prescriptionDetail_zlContent").html("");
  8620. $("#prescriptionDetail_zyReqTitle").removeClass("in").addClass("hide");
  8621. $("#prescriptionDetail_zyReqContent").html("");
  8622. }
  8623. $("#printJcReq").removeClass("in").addClass("hide");
  8624. $("#printJcReq").off("click");
  8625. $("#printJyReq").removeClass("in").addClass("hide");
  8626. $("#printJyReq").off("click");
  8627. $("#printJcReqSetup").removeClass("in").addClass("hide");
  8628. $("#printJcReqSetup").off("click");
  8629. $("#printJyReqSetup").removeClass("in").addClass("hide");
  8630. $("#printJyReqSetup").off("click");
  8631. $("#previewYjReq").removeClass("in").addClass("hide");
  8632. $("#previewYjReq").off("click");
  8633. $("#previewYjReqAll").removeClass("in").addClass("hide");
  8634. $("#previewYjReqAll").off("click");
  8635. $("#deletePrescription").removeClass("in").addClass("hide");
  8636. $("#deletePrescription").off("click");
  8637. $("#consultationCliniced").removeClass("in").addClass("hide");
  8638. $("#consultationCliniced").off("click");
  8639. if (jsonData.mzYjReqList != null && jsonData.mzYjReqList.length > 0) {
  8640. $("#previewYjReq").removeClass("hide").addClass("in");
  8641. $("#previewYjReq").off("click").on("click", function (t) {
  8642. previewYjReq(patientId, times);
  8643. });
  8644. }
  8645. if (res.yjReqCount != null && res.yjReqCount > 0) {
  8646. $("#previewYjReqAll").removeClass("hide").addClass("in");
  8647. $("#previewYjReqAll").off("click").on("click", function (t) {
  8648. previewYjReqAll(patientId);
  8649. });
  8650. }
  8651. if (type == 0) {
  8652. $("#callPrescription").removeClass("in").addClass("hide");
  8653. if ((jsonData.mzChargeDetailList == null || jsonData.mzChargeDetailList.length == 0) && (jsonData.mzYjReqList == null || jsonData.mzYjReqList.length == 0)) {
  8654. $("#printPrescription").removeClass("in").addClass("hide");
  8655. $("#printPrescriptionSetup").removeClass("in").addClass("hide");
  8656. } else {
  8657. $("#printPrescription").removeClass("hide").addClass("in");
  8658. $("#printPrescription").off("click").on("click", function (t) {
  8659. printPrescription(patientId, times, clnicId, payMark, 1);
  8660. });
  8661. $("#printPrescriptionSetup").removeClass("hide").addClass("in");
  8662. $("#printPrescriptionSetup").off("click").on("click", function (t) {
  8663. printPrescription(patientId, times, clnicId, payMark, 2);
  8664. });
  8665. }
  8666. if (jsonData.mzYjReqList != null && jsonData.mzYjReqList.length > 0) {
  8667. var hadJc = false;
  8668. var hadJy = false;
  8669. for (var i = 0; i < jsonData.mzYjReqList.length; i++) {
  8670. var mzYjReq = jsonData.mzYjReqList[i];
  8671. if (mzYjReq.reqType == 2) {
  8672. hadJy = true;
  8673. } else if (mzYjReq.reqType == 3) {
  8674. hadJc = true;
  8675. }
  8676. }
  8677. if (hadJc) {
  8678. $("#printJcReq").removeClass("hide").addClass("in");
  8679. $("#printJcReq").off("click").on("click", function (t) {
  8680. printYjReq(patientId, times, 3, 1);
  8681. });
  8682. $("#printJcReqSetup").removeClass("hide").addClass("in");
  8683. $("#printJcReqSetup").off("click").on("click", function (t) {
  8684. printYjReq(patientId, times, 3, 2);
  8685. });
  8686. }
  8687. if (hadJy) {
  8688. $("#printJyReq").removeClass("hide").addClass("in");
  8689. $("#printJyReq").off("click").on("click", function (t) {
  8690. printYjReq(patientId, times, 2, 1);
  8691. });
  8692. $("#printJyReqSetup").removeClass("hide").addClass("in");
  8693. $("#printJyReqSetup").off("click").on("click", function (t) {
  8694. printYjReq(patientId, times, 2, 2);
  8695. });
  8696. }
  8697. }
  8698. if (jsonData.mzZyReq == null || jsonData.mzZyReq.reqDept == null || jsonData.mzZyReq.reqDept == "") {
  8699. $("#printZyReq").removeClass("in").addClass("hide");
  8700. $("#printZyReq").off("click");
  8701. $("#printZyReqSetup").removeClass("in").addClass("hide");
  8702. $("#printZyReqSetup").off("click");
  8703. } else {
  8704. $("#printZyReq").removeClass("hide").addClass("in");
  8705. $("#printZyReq").off("click").on("click", function (t) {
  8706. printZyReq(patientId, 1);
  8707. });
  8708. $("#printZyReqSetup").removeClass("hide").addClass("in");
  8709. $("#printZyReqSetup").off("click").on("click", function (t) {
  8710. printZyReq(patientId, 2);
  8711. });
  8712. }
  8713. //未缴费状态的时候可以删除处方
  8714. if (oriPayMark == 5 || oriPayMark == "5") {
  8715. $("#deletePrescription").removeClass("hide").addClass("in");
  8716. $("#deletePrescription").off("click").on("click", function (t) {
  8717. deletePrescription(clnicId);
  8718. });
  8719. }
  8720. //已诊列表发起会诊
  8721. $("#consultationCliniced").removeClass("hide").addClass("in");
  8722. $("#consultationCliniced").off("click").on("click", function (t) {
  8723. consultationCliniced(patientId);
  8724. });
  8725. } else {
  8726. $("#printPrescription").removeClass("in").addClass("hide");
  8727. $("#printZyReq").removeClass("in").addClass("hide");
  8728. $("#printBlRecord").removeClass("in").addClass("hide");
  8729. $("#printJcReq").removeClass("in").addClass("hide");
  8730. $("#printJyReq").removeClass("in").addClass("hide");
  8731. $("#callPrescription").removeClass("hide").addClass("in");
  8732. $("#callPrescription").off("click").on("click", function (t) {
  8733. getMzPrescriptionVoPaid(patientId, times, clnicId);
  8734. });
  8735. }
  8736. if (oriPayMark == 1) {
  8737. $("#printPrescription").removeClass("in").addClass("hide");
  8738. $("#printPrescriptionSetup").removeClass("in").addClass("hide");
  8739. } else {
  8740. if ((jsonData.mzChargeDetailList == null || jsonData.mzChargeDetailList.length == 0) && (jsonData.mzYjReqList == null || jsonData.mzYjReqList.length == 0)) {
  8741. $("#printPrescription").removeClass("in").addClass("hide");
  8742. $("#printPrescriptionSetup").removeClass("in").addClass("hide");
  8743. } else {
  8744. $("#printPrescription").removeClass("hide").addClass("in");
  8745. $("#printPrescription").off("click").on("click", function (t) {
  8746. printPrescription(patientId, times, clnicId, payMark, 1);
  8747. });
  8748. $("#printPrescriptionSetup").removeClass("hide").addClass("in");
  8749. $("#printPrescriptionSetup").off("click").on("click", function (t) {
  8750. printPrescription(patientId, times, clnicId, payMark, 2);
  8751. });
  8752. }
  8753. }
  8754. $("#printBlRecord").removeClass("hide").addClass("in");
  8755. $("#printBlRecord").off("click").on("click", function (t) {
  8756. printBlRecord(patientId, times, 1);
  8757. });
  8758. $("#printBlRecordSetup").removeClass("hide").addClass("in");
  8759. $("#printBlRecordSetup").off("click").on("click", function (t) {
  8760. printBlRecord(patientId, times, 2);
  8761. });
  8762. $("#showMzBlRecordModal").removeClass("hide").addClass("in");
  8763. $("#showMzBlRecordModal").off("click").on("click", function (t) {
  8764. showMzBlRecordModal(patientId, times, 1);
  8765. });
  8766. if ($("#setupId").hasClass("fa-chevron-up")) {
  8767. //默认不展开打印设置
  8768. $("#setupId").parent().click();
  8769. }
  8770. // setTimeout(function () {
  8771. // if ($("#setupId").hasClass("fa-chevron-up")) {
  8772. // //默认不展开打印设置
  8773. // $("#setupId").parent().click();
  8774. // }
  8775. // }, 400);
  8776. //就诊详情的时候,隐藏复选框
  8777. if (type == 0) {
  8778. $("#visitingDetailModal").find("input[type=checkbox]").each(function (index, obj) {
  8779. $(obj).css("display", "none");
  8780. });
  8781. } else {
  8782. //历史处方显示复选框
  8783. $("#visitingDetailModal").find("input[type=checkbox]").each(function (index, obj) {
  8784. $(obj).css("display", "inline-block");
  8785. });
  8786. }
  8787. } else {
  8788. errorMesage(res);
  8789. }
  8790. }
  8791. });
  8792. $("#selfAmountView").html(0.00);
  8793. $("#fundPayView").html(0.00);
  8794. $("#acctPayView").html(0.00);
  8795. $("#totalAmountView").html(0.00);
  8796. $.ajax({
  8797. type: "GET",
  8798. url: '/thmz/getChargeDetailFee?patientId=&times=&receiptNo=&clnicId=' + clnicId,
  8799. contentType: "application/json;charset=UTF-8",
  8800. dataType: "json",
  8801. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8802. async: false,
  8803. success: function (res) {
  8804. if (res == '401' || res == 401) {
  8805. window.location.href = '/thmz/login/view'
  8806. return;
  8807. }
  8808. if (res.code == 0) {
  8809. if (res.fundPay != undefined && res.fundPay != null) {
  8810. $("#fundPayView").text("¥" + res.fundPay);
  8811. }
  8812. if (res.acctPay != undefined && res.acctPay != null) {
  8813. $("#acctPayView").text("¥" + res.acctPay);
  8814. }
  8815. $("#selfAmountView").text("¥" + res.selfAmount);
  8816. $("#totalAmountView").text("¥" + res.totalAmount);
  8817. } else {
  8818. printIndex = -1;
  8819. }
  8820. }
  8821. });
  8822. }
  8823. /**
  8824. * 查询默认打印机
  8825. */
  8826. function setPrint() {
  8827. if (printIndex >= 0) {
  8828. return;
  8829. }
  8830. $.ajax({
  8831. type: "GET",
  8832. url: '/thmz/getLastWindowsByCurrentUser',
  8833. contentType: "application/json;charset=UTF-8",
  8834. dataType: "json",
  8835. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8836. async: false,
  8837. success: function (res) {
  8838. if (res == '401' || res == 401) {
  8839. window.location.href = '/thmz/login/view'
  8840. return;
  8841. }
  8842. if (res.code == 0) {
  8843. printIndex = res.data.cgPrintIndex;
  8844. } else {
  8845. printIndex = -1;
  8846. }
  8847. }
  8848. });
  8849. }
  8850. function setTableHtml(prescriptionDetail) {
  8851. //设置成组处方符号
  8852. if (prescriptionDetail.length > 1) {
  8853. var map = new Map();
  8854. var groupOrderlist = [];
  8855. for (var j = 0; j < prescriptionDetail.length; j++) {
  8856. var detail = prescriptionDetail[j];
  8857. var list = map.get(detail.groupOrder);
  8858. if (list == null) {
  8859. list = [];
  8860. map.put(detail.groupOrder, list);
  8861. groupOrderlist[groupOrderlist.length] = detail.groupOrder;
  8862. }
  8863. list[list.length] = detail;
  8864. }
  8865. for (var j = 0; j < groupOrderlist.length; j++) {
  8866. var list = map.get(groupOrderlist[j]);
  8867. if (list.length == 1) {
  8868. continue;
  8869. }
  8870. list[0].groupFlag = "┒";
  8871. list[list.length - 1].groupFlag = "┛";
  8872. if (list.length > 2) {
  8873. for (var t = 1; t < list.length - 1; t++) {
  8874. list[t].groupFlag = "┃";
  8875. }
  8876. }
  8877. }
  8878. }
  8879. var html = "";
  8880. for (var j = 0; j < prescriptionDetail.length; j++) {
  8881. var detail = prescriptionDetail[j];
  8882. html += "<tr><td>" + detail.groupOrder + "</td>";
  8883. html += "<td colspan='2'>";
  8884. html += detail.name + "(" + detail.specification + ")";
  8885. html += "</td>";
  8886. html += "<td colspan='2'></td>";
  8887. html += "<td>X</td>";
  8888. html += "<td rowspan='2' style='height: 100%;line-height: 100%;font-size: 40px;'>";
  8889. if (detail.groupFlag != undefined && detail.groupFlag != null) {
  8890. html += detail.groupFlag;
  8891. }
  8892. html += "</td><td>" + detail.quantity + detail.packUnit + "</td>";
  8893. html += "</tr>";
  8894. html += "<tr><td></td>";
  8895. if (detail.tryResult != undefined && detail.tryResult != null && detail.tryResult != "null" && detail.tryResult != "") {
  8896. html += "<td>" + detail.tryResult + "</td>";
  8897. } else if (detail.tryFlag != undefined && detail.tryFlag != null && detail.tryFlag != "null" && detail.tryFlag != "") {
  8898. html += "<td>" + detail.tryFlag + "</td>";
  8899. } else {
  8900. html += "<td></td>";
  8901. }
  8902. html += "<td style='font-weight: bold;text-align: right;'>用法:</td>";
  8903. html += "<td>" + detail.drugQuan + detail.unitDesc + "/次</td>";
  8904. html += "<td>" + detail.frequency + "</td>";
  8905. html += "<td>" + detail.orderDays + "天</td>";
  8906. html += "<td>" + detail.supplyName + "</td>";
  8907. html += "</tr>";
  8908. }
  8909. html += "<tr><td colspan='7'>&nbsp;&nbsp;&nbsp;&nbsp;------(以下空白)------</td></tr>";
  8910. return {html: html, j: j};
  8911. }
  8912. // /**
  8913. // * 打印门诊指引单
  8914. // * @param patientId
  8915. // * @param times
  8916. // */
  8917. // function printGuideCard(patientId, times) {
  8918. //
  8919. // }
  8920. /**
  8921. * 打印门诊处方
  8922. * @param patientId
  8923. * @param times
  8924. * @param clnicId
  8925. * @param payMark
  8926. * @param printType 打印模式 1 预览打印 2 打印设置
  8927. */
  8928. function printPrescription(patientId, times, clnicId, payMark, printType) {
  8929. $.ajax({
  8930. type: "GET",
  8931. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + '&times=' + times + '&MzBlRecordFlag=false&payMark=' + payMark + '&clnicId=' + clnicId,
  8932. contentType: "application/json;charset=UTF-8",
  8933. dataType: "json",
  8934. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8935. success: function (res) {
  8936. if (res == '401' || res == 401) {
  8937. window.location.href = '/thmz/login/view'
  8938. return;
  8939. }
  8940. if (res.code == 0) {
  8941. var prescriptionDetail = res.data.mzBlRecord.prescriptionDetail;
  8942. if (prescriptionDetail != null && prescriptionDetail != "") {
  8943. var prescriptionDetailJson = JSON.parse(prescriptionDetail);
  8944. //当前处方只开了住院证则只打印住院证
  8945. if (prescriptionDetailJson.xyPrescription.jePrescription.length == 0 && prescriptionDetailJson.xyPrescription.mjPrescription.length == 0 && prescriptionDetailJson.xyPrescription.pyPrescription.length == 0 && prescriptionDetailJson.xyPrescription.ycPrescription.length == 0 && prescriptionDetailJson.zlPrescription.length == 0 && prescriptionDetailJson.jcjyPrescription.length == 0 && prescriptionDetailJson.zyPrescription.length == 0 && prescriptionDetailJson.zyReqPrescription != null && prescriptionDetailJson.zyReqPrescription.length > 0) {
  8946. printZyReq(patientId, 1);
  8947. return;
  8948. }
  8949. var index = 0;
  8950. setPrint();
  8951. LODOP = getLodop();
  8952. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院处方笺");
  8953. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  8954. //设置默认打印机
  8955. LODOP.SET_PRINTER_INDEX(printIndex);
  8956. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  8957. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  8958. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  8959. //LODOP.SET_SHOW_MODE("SETUP_ENABLESS",getCheckSS());
  8960. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊处方笺");//对新建的纸张重命名
  8961. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  8962. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  8963. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  8964. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  8965. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  8966. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  8967. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  8968. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  8969. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  8970. var mzPatientMi = res.mzPatientMi;
  8971. var deptName = res.deptName;
  8972. $("#patientNamePrescription").text(mzPatientMi.name);
  8973. $("#patientGenderPrescription").text(mzPatientMi.gender);
  8974. $("#patientAgePrescription").text(mzPatientMi.ageString);
  8975. $("#patientIdPrescription").text(mzPatientMi.patientId);
  8976. $("#deptPrescription").text(deptName);
  8977. $("#doctorPrescription").text(res.doctorName);
  8978. $("#cfTime").text(res.opDate);
  8979. $("#socialNo").text(mzPatientMi.socialNo);
  8980. $("#zdPrescription").text(res.data.icdText);
  8981. $("#patientIdGuideCard").text(mzPatientMi.patientId);
  8982. $("#patientNameGuideCard").text(mzPatientMi.name);
  8983. $("#patientDateGuideCard").text(format(new Date(), "yyyy-MM-dd"));
  8984. //普药处方
  8985. var pyPrescription = prescriptionDetailJson.xyPrescription.pyPrescription;
  8986. if (pyPrescription != null && pyPrescription.length > 0) {
  8987. for (var i = 0; i < pyPrescription.length; i++) {
  8988. if (index > 0) {
  8989. LODOP.NewPageA();
  8990. }
  8991. var prescriptionDetail = pyPrescription[i].detail;
  8992. var __ret = setTableHtml(prescriptionDetail);
  8993. var html = __ret.html;
  8994. var j = __ret.j;
  8995. if (res.deptName != undefined && res.deptName != null) {
  8996. if (res.deptName.indexOf("儿") > 0) {
  8997. $("#typePrescription").text("儿科");
  8998. $("#cfTitle").text("儿科");
  8999. } else if (res.deptName.indexOf("急诊科") > 0) {
  9000. $("#typePrescription").text("急诊");
  9001. $("#cfTitle").text("急诊");
  9002. } else {
  9003. $("#typePrescription").text("普通处方");
  9004. $("#cfTitle").text("普通");
  9005. }
  9006. }
  9007. $("#prescriptionDetail").html(html);
  9008. $("#cfAmountPrint").text(pyPrescription[i].amount + "元 (不含注射费)");
  9009. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  9010. index++;
  9011. }
  9012. }
  9013. //医材处方
  9014. var ycPrescription = prescriptionDetailJson.xyPrescription.ycPrescription;
  9015. if (ycPrescription != null && ycPrescription.length > 0) {
  9016. for (var i = 0; i < ycPrescription.length; i++) {
  9017. if (index > 0) {
  9018. LODOP.NewPageA();
  9019. }
  9020. var prescriptionDetail = ycPrescription[i].detail;
  9021. var __ret = setTableHtml(prescriptionDetail);
  9022. var html = __ret.html;
  9023. var j = __ret.j;
  9024. if (res.deptName != undefined && res.deptName != null) {
  9025. if (res.deptName.indexOf("儿") > 0) {
  9026. $("#typePrescription").text("儿科");
  9027. $("#cfTitle").text("儿科");
  9028. } else if (res.deptName.indexOf("急诊科") > 0) {
  9029. $("#typePrescription").text("急诊");
  9030. $("#cfTitle").text("急诊");
  9031. } else {
  9032. $("#typePrescription").text("医材处方");
  9033. $("#cfTitle").text("普通");
  9034. }
  9035. }
  9036. $("#prescriptionDetail").html(html);
  9037. $("#cfAmountPrint").text(ycPrescription[i].amount + "元 ");
  9038. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  9039. index++;
  9040. }
  9041. }
  9042. //麻精处方
  9043. var mjPrescription = prescriptionDetailJson.xyPrescription.mjPrescription;
  9044. if (mjPrescription != null && mjPrescription.length > 0) {
  9045. for (var i = 0; i < mjPrescription.length; i++) {
  9046. if (index > 0) {
  9047. LODOP.NewPageA();
  9048. }
  9049. var prescriptionDetail = mjPrescription[i].detail;
  9050. var __ret = setTableHtml(prescriptionDetail);
  9051. var html = __ret.html;
  9052. var j = __ret.j;
  9053. $("#typePrescription").text("麻、精一处方");
  9054. $("#cfTitle").text("麻、精一");
  9055. $("#prescriptionDetail").html(html);
  9056. $("#cfAmountPrint").text(mjPrescription[i].amount + "元 (不含注射费)");
  9057. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  9058. index++;
  9059. }
  9060. }
  9061. //精二处方
  9062. var jePrescription = prescriptionDetailJson.xyPrescription.jePrescription;
  9063. if (jePrescription != null && jePrescription.length > 0) {
  9064. for (var i = 0; i < jePrescription.length; i++) {
  9065. if (index > 0) {
  9066. LODOP.NewPageA();
  9067. }
  9068. var prescriptionDetail = jePrescription[i].detail;
  9069. var __ret = setTableHtml(prescriptionDetail);
  9070. var html = __ret.html;
  9071. var j = __ret.j;
  9072. $("#typePrescription").text("精二处方");
  9073. $("#cfTitle").text("精二");
  9074. $("#prescriptionDetail").html(html);
  9075. $("#cfAmountPrint").text(jePrescription[i].amount + "元 (不含注射费)");
  9076. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  9077. index++;
  9078. }
  9079. }
  9080. //中药处方
  9081. if (prescriptionDetailJson.zyPrescription != null && prescriptionDetailJson.zyPrescription.length > 0) {
  9082. var zyPrescription = prescriptionDetailJson.zyPrescription[0].detail;
  9083. if (zyPrescription != null && zyPrescription.length > 0) {
  9084. var html = "";
  9085. for (var i = 0; i < zyPrescription.length; i++) {
  9086. if (i % 3 == 0) {
  9087. html += "<tr>";
  9088. }
  9089. html += "<td>";
  9090. html += zyPrescription[i].name;
  9091. html += zyPrescription[i].quantity + "g";
  9092. if (zyPrescription[i].instructionText != null) {
  9093. html += "[" + zyPrescription[i].instructionText + "]";
  9094. }
  9095. if (i % 3 == 2) {
  9096. html += "</td></tr>";
  9097. } else {
  9098. html += "</td>";
  9099. }
  9100. }
  9101. if (zyPrescription.length % 3 != 0) {
  9102. html += "</tr>";
  9103. }
  9104. html += "<tr><td></td><td></td><td>X " + prescriptionDetailJson.zyPrescription[0].zyfs + "付</td></tr>";
  9105. var cyMtjs = prescriptionDetailJson.zyPrescription[0].cyMtjs;
  9106. if (cyMtjs == null || cyMtjs == "null") {
  9107. cyMtjs = "";
  9108. }
  9109. var cyJssm = prescriptionDetailJson.zyPrescription[0].cyJssm;
  9110. if (cyJssm == null || cyJssm == "null") {
  9111. cyJssm = "";
  9112. }
  9113. var cyJsl = prescriptionDetailJson.zyPrescription[0].cyJsl;
  9114. if (cyJsl == null || cyJsl == "null") {
  9115. cyJsl = "";
  9116. }
  9117. var cyZql = prescriptionDetailJson.zyPrescription[0].cyZql;
  9118. if (cyZql == null || cyZql == "null") {
  9119. cyZql = "";
  9120. }
  9121. var cyFj = prescriptionDetailJson.zyPrescription[0].cyFj;
  9122. if (cyFj == null || cyFj == "null") {
  9123. cyFj = "";
  9124. }
  9125. var cyFfcs = prescriptionDetailJson.zyPrescription[0].cyFfcs;
  9126. if (cyFfcs == null || cyFfcs == "null") {
  9127. cyFfcs = "";
  9128. }
  9129. var cyFysm = prescriptionDetailJson.zyPrescription[0].cyFysm;
  9130. if (cyFysm == null || cyFysm == "null") {
  9131. cyFysm = "";
  9132. }
  9133. var cyDj = prescriptionDetailJson.zyPrescription[0].cyDj;
  9134. if (cyDj == null || cyDj == "null") {
  9135. cyDj = "";
  9136. } else {
  9137. cyDj = "(" + cyDj + ")";
  9138. }
  9139. html += "<tr><td colspan='3'>每天" + cyMtjs + "剂," + cyJssm + cyJsl + "ml,煮取量" + cyZql + "ml,复煎" + cyFj + "次。分" + cyFfcs + "次" + cyFysm + " " + cyDj + "。</td></tr>";
  9140. html += "<tr><td colspan='3'>&nbsp;&nbsp;&nbsp;&nbsp;------(以下空白)------</td></tr>";
  9141. if (index > 0) {
  9142. LODOP.NewPageA();
  9143. }
  9144. if (res.deptName != undefined && res.deptName != null) {
  9145. if (res.deptName.indexOf("儿") > 0) {
  9146. $("#typePrescription").text("儿科");
  9147. $("#cfTitle").text("儿科");
  9148. } else if (res.deptName.indexOf("急诊科") > 0) {
  9149. $("#typePrescription").text("急诊");
  9150. $("#cfTitle").text("急诊");
  9151. } else {
  9152. $("#typePrescription").text("中药处方");
  9153. $("#cfTitle").text("普通");
  9154. }
  9155. }
  9156. $("#prescriptionDetail").html(html);
  9157. $("#cfAmountPrint").text(prescriptionDetailJson.zyPrescription[0].amount + "元 (不含代煎费)");
  9158. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  9159. index++;
  9160. }
  9161. }
  9162. var printZlPrescription = $("#zlPrintFlagCheck").parent().hasClass("checked") == true ? true : false;
  9163. if (printZlPrescription) {
  9164. if (prescriptionDetailJson.zlPrescription != null && prescriptionDetailJson.zlPrescription.length > 0) {
  9165. //诊疗处方
  9166. var zlPrescription = prescriptionDetailJson.zlPrescription[0].detail;
  9167. if (zlPrescription != null && zlPrescription.length > 0) {
  9168. var html = "";
  9169. for (var i = 0; i < zlPrescription.length; i++) {
  9170. var zlPrescriptionTemp=zlPrescription[i];
  9171. html += "<tr>";
  9172. html += "<td colspan='2'>"+zlPrescriptionTemp.index+"."+zlPrescriptionTemp.name+"</td>";
  9173. html += "<td style='text-align: right;padding-right: 15px;'>X</td>";
  9174. html += "<td>总量:"+zlPrescriptionTemp.quantity+"</td>";
  9175. html += "</tr>";
  9176. html += "<tr>";
  9177. html += "<td width='40%'></td>";
  9178. html += "<td width='20%'>单量:"+zlPrescriptionTemp.drugQuan+"</td>";
  9179. html += "<td width='20%'>频率:"+zlPrescriptionTemp.frequency+"</td>";
  9180. html += "<td width='20%'>天数:"+zlPrescriptionTemp.orderDays+"天</td>";
  9181. html += "</tr>";
  9182. }
  9183. if (index > 0) {
  9184. LODOP.NewPageA();
  9185. }
  9186. if (res.deptName != undefined && res.deptName != null) {
  9187. if (res.deptName.indexOf("儿") > 0) {
  9188. $("#typePrescription").text("儿科");
  9189. $("#cfTitle").text("儿科");
  9190. } else if (res.deptName.indexOf("急诊科") > 0) {
  9191. $("#typePrescription").text("急诊");
  9192. $("#cfTitle").text("急诊");
  9193. } else {
  9194. $("#typePrescription").text("诊疗处方");
  9195. $("#cfTitle").text("普通");
  9196. }
  9197. }
  9198. $("#prescriptionDetail").html(html);
  9199. $("#cfAmountPrint").text(prescriptionDetailJson.zlPrescription[0].amount + "元 ");
  9200. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  9201. index++;
  9202. }
  9203. }
  9204. }
  9205. //检查申请单打印
  9206. var mzYjReqList = res.data.mzYjReqList;
  9207. if (mzYjReqList != null && mzYjReqList.length > 0) {
  9208. $("#patientIdJcReq").text(mzPatientMi.patientId);
  9209. $("#patientNameJcReq").text(mzPatientMi.name);
  9210. $("#patientGenderJcReq").text(mzPatientMi.gender);
  9211. $("#patientAgeJcReq").text(mzPatientMi.ageString);
  9212. $("#responseTypeJcReq").text(mzPatientMi.responseTypeName);
  9213. $("#patientCardNoJcReq").text(mzPatientMi.icCardNo);
  9214. $("#icdTextJcReq").text(res.data.icdText);
  9215. var mzBlRecord = res.data.mzBlRecord;
  9216. $("#jcReqEmrChiefComplaint").text(mzBlRecord.emrChiefComplaint);
  9217. $("#jcReqHis").text(mzBlRecord.emrHpi);
  9218. var tz = getTz(mzBlRecord);
  9219. $("#jcReqTz").text(tz);
  9220. $("#jcReqReqDept").text(res.deptName);
  9221. $("#jcReqReqDoctor").text(res.doctorName);
  9222. for (var i = 0; i < mzYjReqList.length; i++) {
  9223. var mzYjReq = mzYjReqList[i];
  9224. if (i == 0) {
  9225. var dateStr = format(mzYjReq.reqDate, "yyyy-MM-dd");
  9226. $("#jcReqReqDate").text(dateStr);
  9227. }
  9228. if (mzYjReq == null || mzYjReq.reqType == 2) {
  9229. continue;
  9230. }
  9231. if ((i == 0 && index > 0) || i > 0) {
  9232. LODOP.NewPageA();
  9233. }
  9234. $("#reqNoJcReq").text(mzYjReq.reqNo);
  9235. $("#jcReqItem").text(mzYjReq.groupName);
  9236. $("#jcReqRemark").text(mzYjReq.jyRemark);
  9237. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("jc_card_table").innerHTML);
  9238. index++;
  9239. }
  9240. }
  9241. //住院证打印
  9242. var mzZyReq = res.data.mzZyReq;
  9243. if (mzZyReq != null) {
  9244. $("#patientIdZyReq").text(mzPatientMi.patientId);
  9245. $("#patientNameZyReq").text(mzPatientMi.name);
  9246. $("#patientGenderZyReq").text(mzPatientMi.gender);
  9247. $("#patientAgeZyReq").text(mzPatientMi.ageString);
  9248. $("#sfzZyReq").text(mzPatientMi.socialNo);
  9249. $("#birthDateZyReq").text(format(mzPatientMi.birthDay, "yyyy-MM-dd"));
  9250. $("#phoneZyReq").text(mzPatientMi.phoneNo);
  9251. $("#responseTypeZyReq").text(mzPatientMi.responseTypeName);
  9252. $("#addressZyReq").text(mzPatientMi.address);
  9253. if (mzZyReq.icdCode == null || mzZyReq.icdCode == "" || mzZyReq.icdCode.length == 0) {
  9254. $("#icsCodeZyReq").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
  9255. $("#icsTextZyReq").text(mzZyReq.icdText);
  9256. } else {
  9257. $("#icsCodeZyReq").text(mzZyReq.icdCode);
  9258. $("#icsTextZyReq").text(mzZyReq.icdText);
  9259. }
  9260. $("#reqDeptZyReq").text(mzZyReq.reqWardName);
  9261. $("#smallDeptZyReq").text(mzZyReq.smallDeptName);
  9262. //$("#admissStatusZyReq").text(mzZyReq.admissStatus);
  9263. $("input:checkbox[value='" + mzZyReq.admissStatus + "']").attr('checked', 'true');
  9264. $("#visitDateZyReq").text(format(mzZyReq.visitDate, "yyyy-MM-dd HH:mm:ss"));
  9265. $("#deptCodeZyReq").text(mzZyReq.deptName);
  9266. $("#doctorCodeZyReq").text(mzZyReq.doctorName);
  9267. if (index > 0) {
  9268. LODOP.NewPageA();
  9269. }
  9270. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("mz_zy_req_table").innerHTML);
  9271. index++;
  9272. }
  9273. $("#selfAmountGuideCard").html(0.00);
  9274. $("#fundPayGuideCard").html(0.00);
  9275. $("#acctPayGuideCard").html(0.00);
  9276. $("#payQrcodeGuideCard").empty();
  9277. $("#selfPayDetail").empty();
  9278. $.ajax({
  9279. type: "GET",
  9280. url: '/thmz/getChargeDetailForGuideCard?patientId=' + patientId + '&times=' + times,
  9281. contentType: "application/json;charset=UTF-8",
  9282. dataType: "json",
  9283. headers: {
  9284. 'Accept': 'application/json',
  9285. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  9286. },
  9287. success: function (res) {
  9288. if (res == '401' || res == 401) {
  9289. window.location.href = '/thmz/login/view'
  9290. return;
  9291. }
  9292. if (res.code == 0) {
  9293. var selfPayList = res.selfPayList;
  9294. if (selfPayList != null && selfPayList.length > 0) {
  9295. $("#patientNameSelfPay").text(mzPatientMi.name);
  9296. $("#patientGenderSelfPay").text(mzPatientMi.gender);
  9297. $("#patientAgeSelfPay").text(mzPatientMi.ageString);
  9298. $("#patientIdSelfPay").text(mzPatientMi.patientId);
  9299. $("#deptSelfPay").text(deptName);
  9300. $("#zdSelfPay").text(res.icdText);
  9301. var selfPayListHtml = "";
  9302. for (var i = 1; i <= selfPayList.length; i++) {
  9303. selfPayListHtml += "<tr><td>";
  9304. selfPayListHtml += i + "." + selfPayList[i - 1];
  9305. selfPayListHtml += "</td></tr>";
  9306. }
  9307. $("#selfPayDetail").html(selfPayListHtml);
  9308. if (index > 0) {
  9309. LODOP.NewPageA();
  9310. }
  9311. //view-source:http://www.c-lodop.com/demolist/PrintSample43.html 分页看这里
  9312. LODOP.ADD_PRINT_TABLE(158, "5%", "90%", 400, strStyle + document.getElementById("self_pay_table_body").innerHTML);
  9313. LODOP.SET_PRINT_STYLEA(0, "Vorient", 3);
  9314. LODOP.ADD_PRINT_HTM(26, "5%", "90%", 119, document.getElementById("self_pay_table_header").innerHTML);
  9315. LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
  9316. LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1);
  9317. LODOP.ADD_PRINT_HTM(560, "5%", "90%", 200, document.getElementById("self_pay_table_foot").innerHTML);
  9318. LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
  9319. LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1);
  9320. // LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("self_pay_table").innerHTML);
  9321. index++;
  9322. }
  9323. if (res.data != null && res.data.length > 0) {
  9324. var html = "";
  9325. for (var i = 0; i < res.data.length; i++) {
  9326. html += "<tr><td>" + res.data[i].itemType + "</td><td>" + Division(res.data[i].itemTotalFee, 1).toFixed(1) + "</td><td>" + res.data[i].execDeptName + "</td><td>" + res.data[i].execDeptAddress + "</td></tr>"
  9327. }
  9328. $("#guideCardDetail").html(html);
  9329. }
  9330. if (res.payQrcode != null && res.payQrcode != "") {
  9331. new QRCode(document.getElementById("payQrcodeGuideCard"), res.payQrcode); // 设置要生成二维码的链接
  9332. $("canvas").attr("id", "erw");
  9333. var canvas = document.getElementById('erw');
  9334. var src = canvas.toDataURL("image/png");
  9335. //var strDataURI =canvas.toDataURL("image/png");
  9336. $("#payQrcodeGuideCard").html("<img src='" + src + "' style='width:100px;height:100px;'/><div style='width: 100px;margin-top: 10px;text-align: center;'>微信支付</div>");
  9337. }
  9338. if (res.fundPay != undefined && res.fundPay != null) {
  9339. $("#fundPayGuideCard").text("¥" + res.fundPay);
  9340. }
  9341. if (res.acctPay != undefined && res.acctPay != null) {
  9342. $("#acctPayGuideCard").text("¥" + res.acctPay);
  9343. }
  9344. $("#selfAmountGuideCard").text("¥" + res.selfAmount);
  9345. $("#totalAmountGuideCard").text("¥" + res.totalAmount);
  9346. // $("#imgcode").JsBarcode(patientId);
  9347. console.log(patientId);
  9348. JsBarcode('#imgcode', patientId, {
  9349. lineColor: '#333', //线条颜色
  9350. width: 2, //线宽
  9351. height: 60, //条码高度
  9352. displayValue: false, //是否显示文字信息
  9353. });
  9354. if (index > 0) {
  9355. LODOP.NewPageA();
  9356. }
  9357. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("guide_card_table").innerHTML);
  9358. //LODOP.PRINT();
  9359. if (printType == 1) {
  9360. LODOP.PREVIEW();
  9361. } else if (printType == 2) {
  9362. LODOP.PRINT_SETUP();
  9363. }
  9364. } else if (res.code == -2) {
  9365. if (printType == 1) {
  9366. LODOP.PREVIEW();
  9367. } else if (printType == 2) {
  9368. LODOP.PRINT_SETUP();
  9369. }
  9370. } else {
  9371. errorMesage(res);
  9372. }
  9373. }
  9374. });
  9375. // printGuideCard(patientId, times);
  9376. }
  9377. } else {
  9378. errorMesage(res);
  9379. }
  9380. }
  9381. });
  9382. }
  9383. /**
  9384. * 构建体征描述
  9385. * @param mzBlRecord
  9386. * @returns {*}
  9387. */
  9388. function getTz(mzBlRecord) {
  9389. var tz = null;
  9390. if (mzBlRecord.weight != null && mzBlRecord.weight != 0) {
  9391. var temp = "体重:" + mzBlRecord.weight + "kg ";
  9392. if (tz == null) {
  9393. tz = temp;
  9394. } else {
  9395. tz += " " + temp;
  9396. }
  9397. }
  9398. if (mzBlRecord.temperature != null && mzBlRecord.temperature != 0) {
  9399. var temp = "体温:" + mzBlRecord.temperature + "℃ ";
  9400. if (tz == null) {
  9401. tz = temp;
  9402. } else {
  9403. tz += " " + temp;
  9404. }
  9405. }
  9406. if (mzBlRecord.sphygmus != null && mzBlRecord.sphygmus != 0) {
  9407. var temp = "脉搏:" + mzBlRecord.sphygmus + "次/分 ";
  9408. if (tz == null) {
  9409. tz = temp;
  9410. } else {
  9411. tz += " " + temp;
  9412. }
  9413. }
  9414. if (mzBlRecord.breathe != null && mzBlRecord.breathe != 0) {
  9415. var temp = "呼吸:" + mzBlRecord.breathe + "次/分 ";
  9416. if (tz == null) {
  9417. tz = temp;
  9418. } else {
  9419. tz += " " + temp;
  9420. }
  9421. }
  9422. if (mzBlRecord.pressureHigh != null && mzBlRecord.pressureFloor != null && mzBlRecord.pressureHigh != 0 && mzBlRecord.pressureFloor != 0) {
  9423. var temp = "血压:" + mzBlRecord.pressureHigh + "/" + mzBlRecord.pressureFloor;
  9424. if (tz == null) {
  9425. tz = temp;
  9426. } else {
  9427. tz += " " + temp;
  9428. }
  9429. }
  9430. if (mzBlRecord.pressureHighLeft != null && mzBlRecord.pressureFloorLeft != null && mzBlRecord.pressureHighLeft != 0 && mzBlRecord.pressureFloorLeft != 0) {
  9431. var temp = "左血压:" + mzBlRecord.pressureHighLeft + "/" + mzBlRecord.pressureFloorLeft;
  9432. if (tz == null) {
  9433. tz = temp;
  9434. } else {
  9435. tz += " " + temp;
  9436. }
  9437. }
  9438. if (mzBlRecord.emrPe != null && mzBlRecord.emrPe != "") {
  9439. if (tz == null) {
  9440. tz = mzBlRecord.emrPe;
  9441. } else {
  9442. tz += "," + mzBlRecord.emrPe;
  9443. }
  9444. }
  9445. return tz;
  9446. }
  9447. /**
  9448. * 打印医技申请单
  9449. * @param patientId
  9450. * @param times
  9451. * @param type 申请单类型:2:检验;3:检查
  9452. * @param printType 打印模式 1 预览打印 2 打印设置
  9453. */
  9454. function printYjReq(patientId, times, type, printType) {
  9455. $.ajax({
  9456. type: "GET",
  9457. url: '/thmz/printYjReq?patientId=' + patientId + '&times=' + times + "&reqType=" + type,
  9458. contentType: "application/json;charset=UTF-8",
  9459. dataType: "json",
  9460. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9461. success: function (res) {
  9462. if (res == '401' || res == 401) {
  9463. window.location.href = '/thmz/login/view'
  9464. return;
  9465. }
  9466. if (res.code == 0) {
  9467. if (res.data == null || res.data.mzYjReqList == null || res.data.mzYjReqList.length == 0) {
  9468. errorMesageSimaple("没有医技申请单可以打印");
  9469. return;
  9470. }
  9471. setPrint();
  9472. LODOP = getLodop();
  9473. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院检查申请单");
  9474. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  9475. //设置默认打印机
  9476. LODOP.SET_PRINTER_INDEX(printIndex);
  9477. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  9478. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  9479. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  9480. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "检查申请单");//对新建的纸张重命名
  9481. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  9482. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  9483. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  9484. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  9485. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  9486. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  9487. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  9488. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  9489. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  9490. var mzPatientMi = res.data.mzPatientMi;
  9491. $("#patientIdJcReq").text(mzPatientMi.patientId);
  9492. $("#patientNameJcReq").text(mzPatientMi.name);
  9493. $("#patientGenderJcReq").text(mzPatientMi.gender);
  9494. $("#patientAgeJcReq").text(mzPatientMi.ageString);
  9495. $("#responseTypeJcReq").text(mzPatientMi.responseTypeName);
  9496. $("#patientCardNoJcReq").text(mzPatientMi.icCardNo);
  9497. $("#icdTextJcReq").text(res.data.icdText);
  9498. $("#patientIdJyReq").text(mzPatientMi.patientId);
  9499. $("#patientNameJyReq").text(mzPatientMi.name);
  9500. $("#patientGenderJyReq").text(mzPatientMi.gender);
  9501. $("#patientAgeJyReq").text(mzPatientMi.ageString);
  9502. $("#responseTypeJyReq").text(mzPatientMi.responseTypeName);
  9503. $("#patientCardNoJyReq").text(mzPatientMi.icCardNo);
  9504. $("#icdTextJyReq").text(res.data.icdText);
  9505. var mzBlRecord = res.data.mzBlRecord;
  9506. $("#jcReqEmrChiefComplaint").text(mzBlRecord.emrChiefComplaint);
  9507. $("#jcReqHis").text(mzBlRecord.emrHpi);
  9508. $("#jyReqEmrChiefComplaint").text(mzBlRecord.emrChiefComplaint);
  9509. $("#jyReqHis").text(mzBlRecord.emrHpi);
  9510. var tz = getTz(mzBlRecord);
  9511. $("#jcReqTz").text(tz);
  9512. $("#jcReqReqDept").text(res.data.deptName);
  9513. $("#jcReqReqDoctor").text(res.data.doctorName);
  9514. $("#jyReqTz").text(tz);
  9515. $("#jyReqReqDept").text(res.data.deptName);
  9516. $("#jyReqReqDoctor").text(res.data.doctorName);
  9517. //检验报告列表名
  9518. 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>';
  9519. var jyContent = "";
  9520. var needNewPageA = false;
  9521. for (var i = 0; i < res.data.mzYjReqList.length; i++) {
  9522. var obj = res.data.mzYjReqList[i];
  9523. if (i == 0) {
  9524. var dateStr = format(obj.reqDate, "yyyy-MM-dd");
  9525. $("#jcReqReqDate").text(dateStr);
  9526. $("#jyReqReqDate").text(dateStr);
  9527. }
  9528. if (obj.reqType == "3") {
  9529. if (i > 0) {
  9530. LODOP.NewPageA();
  9531. }
  9532. $("#reqNoJcReq").text(obj.reqNo);
  9533. $("#jcReqItem").text(obj.groupName);
  9534. $("#jcReqRemark").text(obj.jyRemark);
  9535. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("jc_card_table").innerHTML);
  9536. needNewPageA = true;
  9537. } else if (obj.reqType == "2") {
  9538. var inspectStuff = (obj.inspectStuff == null || obj.inspectStuff == "null") ? "" : obj.inspectStuff;
  9539. jyContent += '<tr><td style="min-height: 30px;">' + obj.groupName + '</td><td>' + inspectStuff + '</td><td>' + obj.reqNo + '</td></tr>';
  9540. }
  9541. }
  9542. if (jyContent != null && jyContent != "" && jyContent.length > 0) {
  9543. if (needNewPageA) {
  9544. LODOP.NewPageA();
  9545. }
  9546. jyContent = jyTitle + jyContent;
  9547. $("#jyContent").html(jyContent);
  9548. //检验
  9549. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("jy_card_table").innerHTML);
  9550. }
  9551. if (printType == 1) {
  9552. LODOP.PREVIEW();
  9553. } else if (printType == 2) {
  9554. LODOP.PRINT_SETUP();
  9555. }
  9556. } else {
  9557. errorMesage(res);
  9558. }
  9559. }
  9560. });
  9561. }
  9562. /**
  9563. * 打印门诊病历
  9564. * @param patientId
  9565. * @param times
  9566. * @param clnicId
  9567. * @param payMark
  9568. * @param printType 打印模式 1 预览打印 2 打印设置
  9569. */
  9570. function printBlRecord(patientId, times, printType) {
  9571. $.ajax({
  9572. type: "GET",
  9573. url: '/thmz/getMzBlrecord?patientId=' + patientId + '&times=' + times,
  9574. contentType: "application/json;charset=UTF-8",
  9575. dataType: "json",
  9576. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9577. success: function (res) {
  9578. if (res == '401' || res == 401) {
  9579. window.location.href = '/thmz/login/view'
  9580. return;
  9581. }
  9582. if (res.code == 0) {
  9583. setPrint();
  9584. LODOP = getLodop();
  9585. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院门诊病历");
  9586. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  9587. //设置默认打印机
  9588. LODOP.SET_PRINTER_INDEX(printIndex);
  9589. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  9590. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  9591. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  9592. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊病历");//对新建的纸张重命名
  9593. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  9594. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  9595. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  9596. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  9597. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  9598. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  9599. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  9600. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  9601. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  9602. var mzPatientMi = res.mzPatientMi;
  9603. $("#patientIdBlrecord").text(mzPatientMi.patientId);
  9604. $("#patientNameBlrecord").text(mzPatientMi.name);
  9605. $("#patientGenderBlrecord").text(mzPatientMi.gender);
  9606. $("#patientAgeBlrecord").text(mzPatientMi.ageString);
  9607. var mzBlRecord = res.mzBlRecord;
  9608. if (mzBlRecord.firstOrNot == "1") {
  9609. $("#firstOrNotTitle").text("复诊");
  9610. } else {
  9611. $("#firstOrNotTitle").text("初诊");
  9612. }
  9613. if (mzBlRecord.emrChiefComplaint != null && mzBlRecord.emrChiefComplaint != "") {
  9614. $("#emrChiefComplaintBlrecord").text(mzBlRecord.emrChiefComplaint);
  9615. $("#emrChiefComplaintBlrecord").parent().css("display", "block");
  9616. } else {
  9617. $("#emrChiefComplaintBlrecord").parent().css("display", "none");
  9618. }
  9619. if (mzBlRecord.emrHpi != null && mzBlRecord.emrHpi != "") {
  9620. $("#emrHpiBlrecord").text(mzBlRecord.emrHpi);
  9621. $("#emrHpiBlrecord").parent().css("display", "block");
  9622. } else {
  9623. $("#emrHpiBlrecord").parent().css("display", "none");
  9624. }
  9625. if (mzBlRecord.emrPs != null && mzBlRecord.emrPs != "") {
  9626. $("#emrPsBlrecord").text(mzBlRecord.emrPs);
  9627. $("#emrPsBlrecord").parent().css("display", "block");
  9628. } else {
  9629. $("#emrPsBlrecord").parent().css("display", "none");
  9630. }
  9631. if (mzBlRecord.personalHistory != null && mzBlRecord.personalHistory != "") {
  9632. $("#personalHistoryBlrecord").text(mzBlRecord.personalHistory);
  9633. $("#personalHistoryBlrecord").parent().css("display", "block");
  9634. } else {
  9635. $("#personalHistoryBlrecord").parent().css("display", "none");
  9636. }
  9637. if (mzBlRecord.familyHistory != null && mzBlRecord.familyHistory != "") {
  9638. $("#familyHistoryBlrecord").text(mzBlRecord.familyHistory);
  9639. $("#familyHistoryBlrecord").parent().css("display", "block");
  9640. } else {
  9641. $("#familyHistoryBlrecord").parent().css("display", "none");
  9642. }
  9643. if (mzBlRecord.obstericalHistory != null && mzBlRecord.obstericalHistory != "") {
  9644. $("#obstericalHistoryBlrecord").text(mzBlRecord.obstericalHistory);
  9645. $("#obstericalHistoryBlrecord").parent().css("display", "block");
  9646. } else {
  9647. $("#obstericalHistoryBlrecord").parent().css("display", "none");
  9648. }
  9649. var tz = getTz(mzBlRecord);
  9650. if (tz != null && tz != "") {
  9651. $("#emrPeBlrecord").text(tz);
  9652. $("#emrPeBlrecord").parent().css("display", "block");
  9653. } else {
  9654. $("#emrPeBlrecord").parent().css("display", "none");
  9655. }
  9656. // if (mzBlRecord.emrPe != null && mzBlRecord.emrPe != "") {
  9657. // $("#emrPeBlrecord").text(mzBlRecord.emrPe);
  9658. // $("#emrPeBlrecord").parent().css("display", "block");
  9659. // } else {
  9660. // $("#emrPeBlrecord").parent().css("display", "none");
  9661. // }
  9662. if (res.icdText != null && res.icdText != "") {
  9663. $("#icdTextBlrecord").text(res.icdText);
  9664. $("#icdTextBlrecord").parent().css("display", "block");
  9665. } else {
  9666. $("#icdTextBlrecord").parent().css("display", "none");
  9667. }
  9668. if (mzBlRecord.emrProcess != null && mzBlRecord.emrProcess != "") {
  9669. $("#emrProcessBlrecord").html(mzBlRecord.emrProcess);
  9670. $("#emrProcessBlrecord").parent().css("display", "block");
  9671. } else {
  9672. $("#emrProcessBlrecord").parent().css("display", "none");
  9673. }
  9674. if (mzBlRecord.emrJkjy != null && mzBlRecord.emrJkjy != "") {
  9675. $("#emrJkjyBlrecord").text(mzBlRecord.emrJkjy);
  9676. $("#emrJkjyBlrecord").parent().css("display", "block");
  9677. } else {
  9678. $("#emrJkjyBlrecord").parent().css("display", "none");
  9679. }
  9680. $("#visitDeptBlrecord").text(res.deptName);
  9681. $("#visitDoctorBlrecord").text(res.doctorName);
  9682. $("#visitDateBlrecord").text(res.visitDate);
  9683. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("mz_blrecord_card_table").innerHTML);
  9684. if (printType == 1) {
  9685. LODOP.PREVIEW();
  9686. } else if (printType == 2) {
  9687. LODOP.PRINT_SETUP();
  9688. }
  9689. } else {
  9690. errorMesage(res);
  9691. }
  9692. }
  9693. });
  9694. }
  9695. /**
  9696. * 打印入院通知单
  9697. * @param patientId
  9698. * @param times
  9699. * @param clnicId
  9700. * @param payMark
  9701. * @param printType 打印模式 1 预览打印 2 打印设置
  9702. */
  9703. function printZyReq(patientId, printType) {
  9704. $.ajax({
  9705. type: "GET",
  9706. url: '/thmz/printZyReq?patientId=' + patientId,
  9707. contentType: "application/json;charset=UTF-8",
  9708. dataType: "json",
  9709. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9710. success: function (res) {
  9711. if (res == '401' || res == 401) {
  9712. window.location.href = '/thmz/login/view'
  9713. return;
  9714. }
  9715. if (res.code == 0) {
  9716. setPrint();
  9717. LODOP = getLodop();
  9718. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院入院通知单");
  9719. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  9720. //设置默认打印机
  9721. LODOP.SET_PRINTER_INDEX(printIndex);
  9722. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  9723. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  9724. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  9725. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "入院通知单");//对新建的纸张重命名
  9726. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  9727. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  9728. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  9729. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  9730. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  9731. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  9732. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  9733. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  9734. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  9735. var mzPatientMi = res.mzPatientMi;
  9736. var mzZyReq = res.mzZyReq;
  9737. $("#patientIdZyReq").text(mzPatientMi.patientId);
  9738. $("#patientNameZyReq").text(mzPatientMi.name);
  9739. $("#patientGenderZyReq").text(mzPatientMi.gender);
  9740. $("#patientAgeZyReq").text(mzPatientMi.ageString);
  9741. $("#sfzZyReq").text(mzPatientMi.socialNo);
  9742. $("#birthDateZyReq").text(format(mzPatientMi.birthDay, "yyyy-MM-dd"));
  9743. $("#phoneZyReq").text(mzPatientMi.phoneNo);
  9744. $("#responseTypeZyReq").text(mzPatientMi.responseTypeName);
  9745. $("#addressZyReq").text(mzPatientMi.address);
  9746. if (mzZyReq.icdCode == null || mzZyReq.icdCode == "" || mzZyReq.icdCode.length == 0) {
  9747. $("#icsCodeZyReq").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
  9748. $("#icsTextZyReq").text(mzZyReq.icdText);
  9749. } else {
  9750. $("#icsCodeZyReq").text(mzZyReq.icdCode);
  9751. $("#icsTextZyReq").text(mzZyReq.icdText);
  9752. }
  9753. $("#reqDeptZyReq").text(mzZyReq.reqWardName);
  9754. $("#smallDeptZyReq").text(mzZyReq.smallDeptName);
  9755. //$("#admissStatusZyReq").text(mzZyReq.admissStatus);
  9756. $("input:checkbox[value='" + mzZyReq.admissStatus + "']").attr('checked', 'true');
  9757. $("#visitDateZyReq").text(format(mzZyReq.visitDate, "yyyy-MM-dd HH:mm:ss"));
  9758. $("#deptCodeZyReq").text(mzZyReq.deptName);
  9759. $("#doctorCodeZyReq").text(mzZyReq.doctorName);
  9760. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("mz_zy_req_table").innerHTML);
  9761. if (printType == 1) {
  9762. LODOP.PREVIEW();
  9763. } else if (printType == 2) {
  9764. LODOP.PRINT_SETUP();
  9765. }
  9766. } else {
  9767. errorMesage(res);
  9768. }
  9769. }
  9770. });
  9771. }
  9772. /**
  9773. * 打开查看检查检验报告窗口(含往期)
  9774. * @param patientId
  9775. */
  9776. function previewYjReqAll(patientId) {
  9777. $("#visitingDetailModal").modal("hide");
  9778. $("#previewYjReqModal").modal();
  9779. $("#previewYjReqModalPatientId").val(patientId);
  9780. $("#previewYjReqModalTimes").val(null);
  9781. //重置参数
  9782. retryCount = 0;
  9783. initJcJyTable();
  9784. }
  9785. /**
  9786. * 打开查看检查检验报告窗口
  9787. * @param patientId 门诊病人ID
  9788. * @param times 就诊次数
  9789. */
  9790. function previewYjReq(patientId, times) {
  9791. $("#visitingDetailModal").modal("hide");
  9792. $("#previewYjReqModal").modal();
  9793. $("#previewYjReqModalPatientId").val(patientId);
  9794. $("#previewYjReqModalTimes").val(times);
  9795. //重置参数
  9796. retryCount = 0;
  9797. initJcJyTable();
  9798. }
  9799. /**
  9800. * 删除本次处方
  9801. * @param clnicId 就诊记录id
  9802. */
  9803. function deletePrescription(clnicId) {
  9804. $("#visitingDetailModal").modal("hide");
  9805. $("#messageModal").modal();
  9806. $("#messageContent").html("确认要删除本次处方信息吗?");
  9807. $("#messageButton").off("click").on("click", function (t) {
  9808. $("#messageModal").modal("hide");
  9809. $.ajax({
  9810. type: "GET",
  9811. url: '/thmz/deletePrescription?clnicId=' + clnicId,
  9812. contentType: "application/json;charset=UTF-8",
  9813. dataType: "json",
  9814. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9815. success: function (res) {
  9816. if (res == '401' || res == 401) {
  9817. window.location.href = '/thmz/login/view'
  9818. return;
  9819. }
  9820. if (res.code == 0) {
  9821. successMesage(res);
  9822. $("#tb_table_clinic").bootstrapTable('refresh');
  9823. } else {
  9824. errorMesage(res);
  9825. }
  9826. }
  9827. });
  9828. });
  9829. $("#cancelButton").off("click").on("click", function (t) {
  9830. $("#visitingDetailModal").modal();
  9831. });
  9832. ;
  9833. }
  9834. /**
  9835. * 检查检验列表类型按钮切换事件
  9836. * @param object
  9837. */
  9838. function jcjyButtonChange(object) {
  9839. $("#jcjy_group").find("button").each(function (index, element) {
  9840. if ($(element).hasClass("btn-primary")) {
  9841. $(element).removeClass("btn-primary").addClass("btn-default");
  9842. }
  9843. });
  9844. $(object).removeClass("btn-default").addClass("btn-primary");
  9845. initJcJyTable();
  9846. }
  9847. /**
  9848. * 初始化检查检验报告列表
  9849. */
  9850. function initJcJyTable() {
  9851. clearInspectionDetail();
  9852. clearJcDetail();
  9853. var typeIndex = getIndex("jcjy_group");
  9854. if (typeIndex == 0) {
  9855. //检查
  9856. $('#tb_jy_pName_table_list').bootstrapTable("destroy");
  9857. $('#tb_jy_table_list').bootstrapTable("destroy");
  9858. initJcListTable();
  9859. $("#jy_detail").removeClass("in").addClass("hide");
  9860. $("#jc_detail").removeClass("hide").addClass("in");
  9861. } else {
  9862. $('#tb_table_list').bootstrapTable("destroy");
  9863. initJyListTable();
  9864. $("#jc_detail").removeClass("in").addClass("hide");
  9865. $("#jy_detail").removeClass("hide").addClass("in");
  9866. }
  9867. }
  9868. /**
  9869. * 初始化检查报告列表
  9870. */
  9871. function initJcListTable() {
  9872. $('#tb_table_list').bootstrapTable("destroy");
  9873. $('#tb_table_list').bootstrapTable({
  9874. url: '/thmz/getJcJyList', //请求后台的URL(*)
  9875. method: 'post', //请求方式(*)
  9876. toolbar: '#toolbar', //工具按钮用哪个容器
  9877. striped: true, //是否显示行间隔色
  9878. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  9879. pagination: true, //是否显示分页(*)
  9880. sortable: true, //是否启用排序
  9881. sortOrder: "asc", //排序方式
  9882. queryParams: queryParams, //传递参数(*)
  9883. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  9884. pageNumber: 1, //初始化加载第一页,默认第一页
  9885. pageSize: 5, //每页的记录行数(*)
  9886. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  9887. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  9888. strictSearch: true,
  9889. showColumns: false, //是否显示所有的列
  9890. showRefresh: false, //是否显示刷新按钮
  9891. minimumCountColumns: 2, //最少允许的列数
  9892. clickToSelect: true, //是否启用点击选中行
  9893. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  9894. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  9895. cardView: false, //是否显示详细视图
  9896. detailView: false,
  9897. //rowStyle:rowStyle,//通过自定义函数设置行样式
  9898. ajaxOptions: {
  9899. headers: {
  9900. 'Accept': 'application/json',
  9901. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  9902. }
  9903. },
  9904. columns: [
  9905. {
  9906. field: 'groupName',
  9907. title: '项目名称',
  9908. align: "center",
  9909. valign: 'middle',
  9910. }, {
  9911. field: 'reqDate',
  9912. title: '申请时间',
  9913. align: "center",
  9914. valign: 'middle',
  9915. formatter: function (value, row, index) {
  9916. if (value == null || value == "") {
  9917. return "";
  9918. }
  9919. return format(value, "yyyy-MM-dd HH:mm:ss");
  9920. }
  9921. }
  9922. ],
  9923. onClickRow: function (row) {
  9924. clearJcDetail();
  9925. $("#patientId_t").text(row.patientId);
  9926. $("#name_t").text(row.patientName);
  9927. $("#date_t").text(format(row.reqDate, "yyyy-MM-dd HH:mm:ss"));
  9928. fitJcDetail(row.reqNo, row.patientId);
  9929. },
  9930. responseHandler: function (res) {
  9931. if (res == '401' || res == 401) {
  9932. window.location.href = '/thmz/login/view'
  9933. return;
  9934. }
  9935. var ress = eval(res);
  9936. if (ress.code == -1) {
  9937. if (ress.message != null && ress.message != '') {
  9938. errorMesage(ress);
  9939. }
  9940. if (retryCount == 0) {
  9941. retryCount++;
  9942. $("#jyButton").click();
  9943. return;
  9944. }
  9945. return {
  9946. "total": 0,//总页数
  9947. "rows": {} //数据
  9948. };
  9949. }
  9950. if (ress.count <= 0 && retryCount == 0) {
  9951. retryCount++;
  9952. $("#jyButton").click();
  9953. return;
  9954. }
  9955. //有数据的时候,计数也需要加1,防止这时医生自己候点击检验没数据又跳回检查
  9956. retryCount++;
  9957. return {
  9958. "total": ress.count,//总页数
  9959. "rows": ress.data //数据
  9960. };
  9961. },
  9962. onLoadSuccess: function (data) {
  9963. $(".pagination-detail").css("display", "none");
  9964. }
  9965. });
  9966. }
  9967. /**
  9968. * 构建列表查询参数
  9969. * @param params
  9970. * @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}}
  9971. */
  9972. function queryParams(params) {
  9973. var patientId = $("#previewYjReqModalPatientId").val();
  9974. var times = $("#previewYjReqModalTimes").val();
  9975. return {
  9976. reqType: "3",
  9977. patientId: patientId,
  9978. times: times,
  9979. pageSize: params.limit, //页面大小
  9980. pageIndex: params.offset / params.limit //页码
  9981. };
  9982. };
  9983. /**
  9984. * 加载检查明细
  9985. * @param reqNo
  9986. */
  9987. function fitJcDetail(reqNo, patientId) {
  9988. $.ajax({
  9989. type: "GET",
  9990. url: '/thmz/getYjJcRecordReport?hisReqNo=' + reqNo + "&patientId=" + patientId,
  9991. contentType: "application/json;charset=UTF-8",
  9992. dataType: "json",
  9993. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9994. success: function (res) {
  9995. if (res == '401' || res == 401) {
  9996. window.location.href = '/thmz/login/view'
  9997. return;
  9998. }
  9999. if (res.code == 0) {
  10000. canBePrintJc = true;
  10001. $("#jy_detail").removeClass("in").addClass("hide");
  10002. $("#jc_detail").removeClass("hide").addClass("in");
  10003. var mzPatientMi = res.data.mzPatientMi;
  10004. $("#gender_jc").text(mzPatientMi.gender);
  10005. $("#age_jc").text(mzPatientMi.ageString);
  10006. var yjJcRecordReport = res.data.yjJcRecordReport;
  10007. $("#groupName").text(res.data.groupName);
  10008. $("#textJc").text(yjJcRecordReport.textJc);
  10009. $("#textZd").text(yjJcRecordReport.textZd);
  10010. var jcRecord = res.data.jcRecord;
  10011. $("#report_no").text(jcRecord.reportNo);
  10012. $("#reportId").text(jcRecord.reportId);
  10013. if (jcRecord.reportDate == null || jcRecord.reportDate == "") {
  10014. $("#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;");
  10015. } else {
  10016. $("#reportDate").text(format(jcRecord.reportDate, "yyyy-MM-dd HH:mm:ss"));
  10017. }
  10018. $("#confirmId").text(jcRecord.confirmId);
  10019. if (jcRecord.confirmDate == null || jcRecord.confirmDate == "") {
  10020. $("#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;");
  10021. } else {
  10022. $("#confirmDate").text(format(jcRecord.confirmDate, "yyyy-MM-dd HH:mm:ss"));
  10023. }
  10024. } else {
  10025. errorMesage(res);
  10026. }
  10027. }
  10028. });
  10029. }
  10030. /**
  10031. * 清空检查明细
  10032. * @param reqNo
  10033. */
  10034. function clearJcDetail() {
  10035. canBePrintJc = false;
  10036. $("#patientId_t").text("");
  10037. $("#name_t").text("");
  10038. $("#date_t").text("");
  10039. $("#gender_jc").text("");
  10040. $("#age_jc").text("");
  10041. $("#groupName").text("");
  10042. $("#textJc").text("");
  10043. $("#textZd").text("");
  10044. $("#report_no").text("");
  10045. $("#reportId").text("");
  10046. $("#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;");
  10047. $("#confirmId").text("");
  10048. $("#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;");
  10049. }
  10050. /**
  10051. * 初始化检验报告列表
  10052. */
  10053. function initJyListTable() {
  10054. var patientId = $("#previewYjReqModalPatientId").val();
  10055. var times = $("#previewYjReqModalTimes").val();
  10056. $('#tb_table_list').bootstrapTable("destroy");
  10057. $('#tb_table_list').bootstrapTable({
  10058. url: '/thmz/getJyListByPatientIdAndTimes?patientId=' + patientId + "&times=" + times, //请求后台的URL(*)
  10059. method: 'get', //请求方式(*)
  10060. toolbar: '#toolbar', //工具按钮用哪个容器
  10061. striped: true, //是否显示行间隔色
  10062. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  10063. pagination: true, //是否显示分页(*)
  10064. sortable: true, //是否启用排序
  10065. sortOrder: "asc", //排序方式
  10066. //queryParams: queryJyPNameParams, //传递参数(*)
  10067. sidePagination: "client", //分页方式:client客户端分页,server服务端分页(*)
  10068. pageNumber: 1, //初始化加载第一页,默认第一页
  10069. pageSize: 5, //每页的记录行数(*)
  10070. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  10071. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  10072. strictSearch: true,
  10073. showColumns: false, //是否显示所有的列
  10074. showRefresh: false, //是否显示刷新按钮
  10075. minimumCountColumns: 2, //最少允许的列数
  10076. clickToSelect: true, //是否启用点击选中行
  10077. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  10078. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  10079. cardView: false, //是否显示详细视图
  10080. detailView: false,
  10081. //rowStyle:rowStyle,//通过自定义函数设置行样式
  10082. ajaxOptions: {
  10083. headers: {
  10084. 'Accept': 'application/json',
  10085. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  10086. }
  10087. },
  10088. columns: [
  10089. {
  10090. field: 'aply_CTNT',
  10091. title: '检验名称',
  10092. align: "center",
  10093. valign: 'middle',
  10094. }, {
  10095. field: 'ordr_CREATE_DATE',
  10096. title: '检验时间',
  10097. align: "center",
  10098. valign: 'middle',
  10099. formatter: function (value, row, index) {
  10100. if (value == null || value == "") {
  10101. return "";
  10102. }
  10103. return format(value, "yyyy-MM-dd HH:mm:ss");
  10104. }
  10105. }
  10106. ],
  10107. onClickRow: function (row) {
  10108. queryInspectionDetail(row.ordr_ID);
  10109. },
  10110. responseHandler: function (res) {
  10111. if (res == '401' || res == 401) {
  10112. window.location.href = '/thmz/login/view'
  10113. return;
  10114. }
  10115. var ress = eval(res);
  10116. if (ress.code == -1) {
  10117. if (retryCount == 0) {
  10118. retryCount++;
  10119. $("#jcButton").click();
  10120. return;
  10121. }
  10122. if (ress.message != null && ress.message != '') {
  10123. errorMesage(ress);
  10124. }
  10125. return {
  10126. "total": ress.data.length,//总页数
  10127. "rows": ress.data //数据
  10128. };
  10129. }
  10130. if (ress.data.length <= 0 && retryCount == 0) {
  10131. retryCount++;
  10132. $("#jcButton").click();
  10133. return;
  10134. }
  10135. //有数据的时候,计数也需要加1,防止这时医生自己候点击检查没数据又跳回检验
  10136. retryCount++;
  10137. return {
  10138. "total": ress.data.length,//总页数
  10139. "rows": ress.data //数据
  10140. };
  10141. },
  10142. onLoadSuccess: function (data) {
  10143. $("#jy_table_table_div").find(".pagination-detail").css("display", "none");
  10144. }
  10145. });
  10146. }
  10147. /**
  10148. * 清空检验明细
  10149. * @param orderId
  10150. */
  10151. function clearInspectionDetail() {
  10152. canBePrintJy = false;
  10153. $("#patientId_t_jy").text("");
  10154. $("#name_t_jy").text("");
  10155. $("#gender_jy").text("");
  10156. $("#age_jy").text("");
  10157. $("#reqDept_t_jy").text("");
  10158. $("#bed_no_jy").text("");
  10159. $("#smpl_jy").text("");
  10160. $("#item_jy").text("");
  10161. $("#applyDate").text("");
  10162. $("#orderCreateDate").text("");
  10163. $("#auditTime").text("");
  10164. $("#orderUsrName").text("");
  10165. $("#testUsrName").text("");
  10166. $("#auditUsrName").text("");
  10167. $("#jyBody").html("");
  10168. }
  10169. /**
  10170. * 加载检验明细
  10171. * @param orderId
  10172. */
  10173. function queryInspectionDetail(orderId) {
  10174. clearInspectionDetail();
  10175. $.ajax({
  10176. type: "GET",
  10177. url: '/thmz/getInspectionDetail?orderId=' + orderId,
  10178. contentType: "application/json;charset=UTF-8",
  10179. dataType: "json",
  10180. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10181. success: function (res) {
  10182. if (res == '401' || res == 401) {
  10183. window.location.href = '/thmz/login/view'
  10184. return;
  10185. }
  10186. if (res.code == 0) {
  10187. canBePrintJy = true;
  10188. $("#jc_detail").removeClass("in").addClass("hide");
  10189. $("#jy_detail").removeClass("hide").addClass("in");
  10190. var mzPatientMi = res.mzPatientMi;
  10191. $("#patientId_t_jy").text(mzPatientMi.patientId);
  10192. $("#name_t_jy").text(mzPatientMi.name);
  10193. $("#gender_jy").text(mzPatientMi.gender);
  10194. $("#age_jy").text(mzPatientMi.ageString);
  10195. var html = "";
  10196. if (res.data != null) {
  10197. var inspectionHeader = res.data.inspectionHeader;
  10198. $("#reqDept_t_jy").text(inspectionHeader.dept_NAME);
  10199. $("#bed_no_jy").text(inspectionHeader.ptnt_BED_NO);
  10200. $("#smpl_jy").text(inspectionHeader.smpl_NAME);
  10201. $("#item_jy").text(inspectionHeader.aply_CNTN);
  10202. $("#applyDate").text(format(inspectionHeader.aply_DATE, "yyyy-MM-dd HH:mm:ss"));
  10203. $("#orderCreateDate").text(format(inspectionHeader.ordr_CREATE_DATE, "yyyy-MM-dd HH:mm:ss"));
  10204. $("#auditTime").text(format(inspectionHeader.audt_TIME, "yyyy-MM-dd HH:mm:ss"));
  10205. $("#orderUsrName").text(inspectionHeader.doc_NAME);
  10206. $("#testUsrName").text(inspectionHeader.test_USR_NAME);
  10207. $("#auditUsrName").text(inspectionHeader.audt_USR_NAME);
  10208. var inspectionItems = res.data.inspectionItems;
  10209. if (inspectionItems != null && inspectionItems.length > 0) {
  10210. for (var i = 0; i < inspectionItems.length; i++) {
  10211. html += "<tr>";
  10212. var obj = inspectionItems[i];
  10213. var itm_VALUE = obj.itm_VALUE;
  10214. if (itm_VALUE == null || itm_VALUE == "null") {
  10215. itm_VALUE = "";
  10216. }
  10217. itm_VALUE += (obj.itm_STR_VALUE == null || obj.itm_STR_VALUE == "null") ? "" : obj.itm_STR_VALUE;
  10218. var range = obj.range;
  10219. if (range == null || range == "null") {
  10220. range = "";
  10221. }
  10222. range += (obj.range_STR == null || obj.range_STR == "null") ? "" : obj.range_STR;
  10223. html += "<td width='25%'>" + obj.itm_NAME + "</td>";
  10224. html += "<td width='16.66%'>" + itm_VALUE + "</td>";
  10225. html += "<td width='16.66%'>" + obj.itm_UNIT + "</td>";
  10226. if (obj.itm_ALERT == null || obj.itm_ALERT == "") {
  10227. html += "<td width='16.66%'><span style=\"color:#67C23A;font-weight:bold\"></span></td>";
  10228. } else if (obj.itm_ALERT == "H") {
  10229. html += "<td width='16.66%'><span style=\"color:#F56C6C;font-weight:bold\">↑</span></td>";
  10230. } else if (obj.itm_ALERT == "L") {
  10231. html += "<td width='16.66%'><span style=\"color:#F56C6C;font-weight:bold\">↓</span></td>";
  10232. }
  10233. html += "<td width='25%'>" + range + "</td>";
  10234. html += "</tr>";
  10235. var bacteriaResults = obj.bacteriaResults;
  10236. if (bacteriaResults == null || bacteriaResults.length == 0) {
  10237. continue;
  10238. }
  10239. var bacteriaResult = bacteriaResults[0];
  10240. if (bacteriaResult == null || bacteriaResult.length == 0) {
  10241. continue;
  10242. }
  10243. var antibioticResults = bacteriaResult.antibioticResults;
  10244. if (antibioticResults == null || antibioticResults.length == 0) {
  10245. continue;
  10246. }
  10247. html += '<tr><th width="35%;" style="text-align: left;padding-left: 2%;" >抗菌药物</th><th width="20%;" style="text-align: left;">药物编码</th><th width="30%;" style="text-align: left;">MIC值</th><th width="15%;" style="text-align: left;padding-right: 2%;">敏感性</th></tr>';
  10248. for (var j = 0; j < antibioticResults.length; j++) {
  10249. var antibioticResultsObj = antibioticResults[j];
  10250. html += "<tr>";
  10251. html += "<td width='35%' style='padding-left: 2%;";
  10252. if (j == 0) {
  10253. html += "border-top: 1px solid black;";
  10254. }
  10255. html += "'>" + antibioticResultsObj.anti_NAME_CN + "</td>";
  10256. html += "<td width='20%' ";
  10257. if (j == 0) {
  10258. html += "style='border-top: 1px solid black;'";
  10259. }
  10260. html += ">" + antibioticResultsObj.anti_ABB + "</td>";
  10261. html += "<td width='25%' ";
  10262. if (j == 0) {
  10263. html += "style='border-top: 1px solid black;'";
  10264. }
  10265. html += ">" + antibioticResultsObj.anti_MIC + "</td>";
  10266. html += "<td width='20%' style='padding-right: 2%;";
  10267. if (j == 0) {
  10268. html += "border-top: 1px solid black;";
  10269. }
  10270. html += "'>" + antibioticResultsObj.anti_VALUE + "</td>";
  10271. html += "</tr>";
  10272. }
  10273. }
  10274. }
  10275. }
  10276. $("#jyBody").html(html);
  10277. } else {
  10278. errorMesage(res);
  10279. }
  10280. }
  10281. });
  10282. }
  10283. /**
  10284. * 打印检查检验报告单
  10285. * @param printType 打印模式 1 预览打印 2 打印设置
  10286. */
  10287. function printJyJcReport(printType) {
  10288. var typeIndex = getIndex("jcjy_group");
  10289. var title = "检查报告单";
  10290. if (typeIndex == 1) {
  10291. title = "检验报告单"
  10292. if (!canBePrintJy) {
  10293. warningMesageSimaple("没有任何【" + title + "】可供打印!");
  10294. return;
  10295. }
  10296. } else {
  10297. if (!canBePrintJc) {
  10298. warningMesageSimaple("没有任何【" + title + "】可供打印!");
  10299. return;
  10300. }
  10301. }
  10302. setPrint();
  10303. LODOP = getLodop();
  10304. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院" + title);
  10305. LODOP.SET_PRINT_STYLE("FontSize", 7); //字体大小
  10306. //设置默认打印机
  10307. LODOP.SET_PRINTER_INDEX(printIndex);
  10308. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  10309. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  10310. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  10311. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", title);//对新建的纸张重命名
  10312. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  10313. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  10314. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  10315. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  10316. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  10317. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  10318. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  10319. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  10320. var strStyle = "<style>table{width: 96%;} #jy_detail_content thead {border-bottom: 1px solid black;border-collapse: collapse;}</style>";
  10321. if (typeIndex == 0) {
  10322. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("jc_detail").innerHTML);
  10323. }
  10324. if (typeIndex == 1) {
  10325. LODOP.ADD_PRINT_TABLE("37mm", "5mm", "130mm", "138mm", strStyle + document.getElementById("jy_detail_content").innerHTML);
  10326. LODOP.SET_PRINT_STYLEA(0, "Vorient", 3);
  10327. LODOP.ADD_PRINT_HTM("0mm", "5mm", "130mm", "200mm", strStyle + document.getElementById("jy_detail_title").innerHTML);
  10328. LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
  10329. LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
  10330. LODOP.ADD_PRINT_HTM("177mm", "5mm", "130mm", "200mm", strStyle + document.getElementById("jy_detail_foot").innerHTML);
  10331. LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
  10332. LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
  10333. }
  10334. if (printType == 1) {
  10335. LODOP.PREVIEW();
  10336. } else if (printType == 2) {
  10337. LODOP.PRINT_SETUP();
  10338. }
  10339. }
  10340. /**
  10341. * 初始化科室下拉选
  10342. */
  10343. function initExecUnit() {
  10344. //父科室列表
  10345. $.ajax({
  10346. type: "GET",
  10347. url: '/thmz/allUnitCode',
  10348. dataType: "json",
  10349. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10350. success: function (data) {
  10351. if (data == '401' || data == 401) {
  10352. window.location.href = '/thmz/login/view'
  10353. return;
  10354. }
  10355. $('#execUnit').empty(); //清空resText里面的所有内容
  10356. $('#zlExecUnit').empty(); //清空resText里面的所有内容
  10357. var html = '';
  10358. $.each(data.data, function (commentIndex, comment) {
  10359. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + '-' + comment.code + ')</option>';
  10360. });
  10361. $('#execUnit').html(html);
  10362. $('#execUnit').selectpicker('refresh');
  10363. $('#zlExecUnit').html(html);
  10364. $('#zlExecUnit').selectpicker('refresh');
  10365. }
  10366. });
  10367. }
  10368. /**
  10369. * 初始化证件类型下拉选
  10370. */
  10371. function initCertificateTypeSelect() {
  10372. $.ajax({
  10373. type: "GET",
  10374. url: '/thmz/listCertificateType',
  10375. contentType: "application/json;charset=UTF-8",
  10376. dataType: "json",
  10377. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10378. success: function (res) {
  10379. if (res == '401' || res == 401) {
  10380. window.location.href = '/thmz/login/view'
  10381. return;
  10382. }
  10383. if (res.code == 0) {
  10384. res.data.forEach(function (item, index) {
  10385. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  10386. $('#rapidAcceptsUserCertificateType').append(html);
  10387. $('#editUserCertificateType').append(html);
  10388. });
  10389. $('#rapidAcceptsUserCertificateType').selectpicker('refresh');
  10390. $('#editUserCertificateType').selectpicker('refresh');
  10391. } else {
  10392. errorMesage(res);
  10393. }
  10394. }
  10395. });
  10396. }
  10397. /**
  10398. * 加载病历信息编辑预览
  10399. * @param patientId
  10400. * @param times
  10401. * @param type 1 编辑 2 预览
  10402. */
  10403. function showMzBlRecordModal(patientId, times, type) {
  10404. $.ajax({
  10405. type: "GET",
  10406. url: '/thmz/getMzBlrecord?patientId=' + patientId + '&times=' + times,
  10407. contentType: "application/json;charset=UTF-8",
  10408. dataType: "json",
  10409. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10410. success: function (res) {
  10411. if (res == '401' || res == 401) {
  10412. window.location.href = '/thmz/login/view'
  10413. return;
  10414. }
  10415. if (res.code == 0) {
  10416. var mzPatientMi = res.mzPatientMi;
  10417. $("#editPatientId").text(mzPatientMi.patientId);
  10418. $("#editPatientName").text(mzPatientMi.name);
  10419. $("#editPatientGender").text(mzPatientMi.gender);
  10420. $("#editPatientAge").text(mzPatientMi.ageString);
  10421. var mzBlRecord = res.mzBlRecord;
  10422. $("#editEmrChiefComplaint").val(mzBlRecord.emrChiefComplaint == null ? "" : mzBlRecord.emrChiefComplaint);
  10423. $("#editEmrHpi").val(mzBlRecord.emrHpi == null ? "" : mzBlRecord.emrHpi);
  10424. $("#editEmrPs").val(mzBlRecord.emrPs == null ? "" : mzBlRecord.emrPs);
  10425. $("#editPersonalHistory").val(mzBlRecord.personalHistory == null ? "" : mzBlRecord.personalHistory);
  10426. $("#editFamilyHistory").val(mzBlRecord.familyHistory == null ? "" : mzBlRecord.familyHistory);
  10427. $("#editObstericalHistory").val(mzBlRecord.obstericalHistory == null ? "" : mzBlRecord.obstericalHistory);
  10428. $("#editQtjc").val(mzBlRecord.emrPe == null ? "" : mzBlRecord.emrPe);
  10429. setSelectedAttr("editZd", mzBlRecord.icdCode, mzBlRecord.icdText);
  10430. var tentativeDiagnosis=mzBlRecord.tentativeDiagnosis == null ? "" : mzBlRecord.tentativeDiagnosis;
  10431. if((mzBlRecord.icdCode==null || mzBlRecord.icdCode=="") && mzBlRecord.icdText!=null && mzBlRecord.icdText!=""){
  10432. if(tentativeDiagnosis==null || tentativeDiagnosis==""){
  10433. tentativeDiagnosis=mzBlRecord.icdText;
  10434. }else {
  10435. tentativeDiagnosis=mzBlRecord.icdText+" "+tentativeDiagnosis;
  10436. }
  10437. }
  10438. $("#edittentativeDiagnosis").val(tentativeDiagnosis);
  10439. $("#editEmrJkjy").val(mzBlRecord.emrJkjy == null ? "" : mzBlRecord.emrJkjy);
  10440. $("#bl_weight").val(mzBlRecord.weight == 0 ? null : mzBlRecord.weight);
  10441. $("#bl_temperature").val(mzBlRecord.temperature == 0 ? null : mzBlRecord.temperature);
  10442. $("#bl_sphygmus").val(mzBlRecord.sphygmus == 0 ? null : mzBlRecord.sphygmus);
  10443. $("#bl_breathe").val(mzBlRecord.breathe == 0 ? null : mzBlRecord.breathe);
  10444. $("#bl_pressure_high").val(mzBlRecord.pressureHigh == 0 ? null : mzBlRecord.pressureHigh);
  10445. $("#bl_pressure_floor").val(mzBlRecord.pressureFloor == 0 ? null : mzBlRecord.pressureFloor);
  10446. $("#bl_pressure_high_left").val(mzBlRecord.pressureHighLeft == 0 ? null : mzBlRecord.pressureHighLeft);
  10447. $("#bl_pressure_floor_left").val(mzBlRecord.pressureFloorLeft == 0 ? null : mzBlRecord.pressureFloorLeft);
  10448. if (mzBlRecord.emrProcess != null && mzBlRecord.emrProcess != "") {
  10449. var reg = new RegExp("</br>", "g");//g,表示全部替换。
  10450. var editEmrProcess = mzBlRecord.emrProcess.replace(reg, "\n");
  10451. reg = new RegExp("&nbsp;", "g");//g,表示全部替换。
  10452. editEmrProcess = editEmrProcess.replace(reg, "");
  10453. $("#editEmrProcess").val(editEmrProcess);
  10454. } else {
  10455. $("#editEmrProcess").val("");
  10456. }
  10457. if (type == 1) {
  10458. $("#mzBlRecorTitle").html("门诊病历【编辑】");
  10459. $("#setOtherEmrProcess").removeClass("in").addClass("hide");
  10460. $("#openBlRecordModel").removeClass("hide").addClass("in");
  10461. $("#setEmrProcess").removeClass("hide").addClass("in");
  10462. $("#visitingDetailModal").modal("hide");
  10463. } else if (type == 2) {
  10464. $("#mzBlRecorTitle").html("门诊病历【预览】");
  10465. $("#setOtherEmrProcess").removeClass("hide").addClass("in");
  10466. $("#openBlRecordModel").removeClass("in").addClass("hide");
  10467. $("#setEmrProcess").removeClass("in").addClass("hide");
  10468. //因为预览的时候,关闭预览框没有清空数据,且 此时基础数据的病历次数被清空
  10469. if ($("#mzBlTimes").val() != null && $("#mzBlTimes").val() != "" && ($("#baseMzBlTimes").val() == null || $("#baseMzBlTimes").val() == "")) {
  10470. $("#baseMzBlTimes").val($("#mzBlTimes").val());
  10471. }
  10472. $("#otherBlRecordModal").modal("hide");
  10473. }
  10474. $("#mzBlTimes").val(mzBlRecord.times);
  10475. $("#editMzBlRecordModal").modal();
  10476. } else {
  10477. errorMesage(res);
  10478. }
  10479. }
  10480. });
  10481. }
  10482. /**
  10483. * 清空区域
  10484. */
  10485. function clearInput() {
  10486. //编辑病历的时候,没有基础病历的就诊次数,如果是预览病历的时候,有基础病历的次数
  10487. var baseMzBlTimes = $("#baseMzBlTimes").val();
  10488. $("#editPatientId").text(null);
  10489. $("#editPatientName").text(null);
  10490. $("#editPatientGender").text(null);
  10491. $("#editPatientAge").text(null);
  10492. $("#editEmrChiefComplaint").val(null);
  10493. $("#editEmrHpi").val(null);
  10494. $("#editEmrPs").val(null);
  10495. $("#editPersonalHistory").val(null);
  10496. $("#editFamilyHistory").val(null);
  10497. $("#editObstericalHistory").val(null);
  10498. $("#bl_weight").val(null);
  10499. $("#bl_sphygmus").val(null);
  10500. $("#bl_breathe").val(null);
  10501. $("#bl_pressure_high").val(null);
  10502. $("#bl_pressure_floor").val(null);
  10503. $("#bl_pressure_high_left").val(null);
  10504. $("#bl_pressure_floor_left").val(null);
  10505. $("#editQtjc").val(null);
  10506. $("#editZd").selectpicker('val', null);
  10507. $("#editZd").selectpicker('refresh');
  10508. $("#edittentativeDiagnosis").val(null);
  10509. $("#editEmrProcess").val(null);
  10510. $("#editEmrJkjy").val(null);
  10511. $("#mzBlTimes").val(null);
  10512. if (baseMzBlTimes != null && baseMzBlTimes != "") {
  10513. $("#otherBlRecordModal").modal();
  10514. }
  10515. }
  10516. /**
  10517. * 保存门诊病历
  10518. */
  10519. function setEmrProcess() {
  10520. $("#editMzBlRecordModal").modal("hide");
  10521. $("#messageModal").modal();
  10522. $("#messageContent").html("确认修改当前门诊病历吗?");
  10523. $("#messageButton").off("click").on("click", function (t) {
  10524. $("#messageModal").modal("hide");
  10525. sendEmrProcess();
  10526. });
  10527. $("#cancelButton").off("click").on("click", function (t) {
  10528. $("#editMzBlRecordModal").modal();
  10529. });
  10530. }
  10531. /**
  10532. * 提交保存门诊病历
  10533. */
  10534. function sendEmrProcess() {
  10535. //修改告警人员
  10536. var icdCodes = $("#editZd").val();
  10537. var icdCodeStr = null;
  10538. if (icdCodes != null && icdCodes.length > 0) {
  10539. for (var i = 0; i < icdCodes.length; i++) {
  10540. if (icdCodeStr == null) {
  10541. icdCodeStr = icdCodes[i];
  10542. } else {
  10543. icdCodeStr += "," + icdCodes[i];
  10544. }
  10545. }
  10546. }
  10547. $.ajax({
  10548. type: "POST",
  10549. url: '/thmz/setEmrProcess',
  10550. contentType: "application/json;charset=UTF-8",
  10551. dataType: "json",
  10552. data: JSON.stringify({
  10553. "patientId": $("#editPatientId").text(),
  10554. "times": $("#mzBlTimes").val(),
  10555. "emrChiefComplaint": $("#editEmrChiefComplaint").val(),
  10556. "emrHpi": $("#editEmrHpi").val(),
  10557. "emrPs": $("#editEmrPs").val(),
  10558. "personalHistory": $("#editPersonalHistory").val(),
  10559. "familyHistory": $("#editFamilyHistory").val(),
  10560. "obstericalHistory": $("#editObstericalHistory").val(),
  10561. "emrPe": $("#editQtjc").val(),
  10562. "weight": $("#bl_weight").val(),
  10563. "temperature": $("#bl_temperature").val(),
  10564. "sphygmus": $("#bl_sphygmus").val(),
  10565. "breathe": $("#bl_breathe").val(),
  10566. "pressureHigh": $("#bl_pressure_high").val(),
  10567. "pressureFloor": $("#bl_pressure_floor").val(),
  10568. "pressureHighLeft": $("#bl_pressure_high_left").val(),
  10569. "pressureFloorLeft": $("#bl_pressure_floor_left").val(),
  10570. "icdCode": icdCodeStr,
  10571. "icdText": $('#editZd').next().attr("title"),
  10572. "tentativeDiagnosis": $("#edittentativeDiagnosis").val(),
  10573. "emrJkjy": $("#editEmrJkjy").val(),
  10574. "emrProcess": $("#editEmrProcess").val()
  10575. }),
  10576. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10577. success: function (res) {
  10578. if (res == '401' || res == 401) {
  10579. window.location.href = '/thmz/login/view'
  10580. return;
  10581. }
  10582. if (res.code == 0) {
  10583. clearInput();
  10584. successMesage(res);
  10585. $("#editMzBlRecordModal").modal("hide");
  10586. } else {
  10587. errorMesage(res);
  10588. }
  10589. }
  10590. });
  10591. }
  10592. /**
  10593. * 打开待合并病历列表弹框
  10594. */
  10595. function openBlRecordModel() {
  10596. $("#editMzBlRecordModal").modal("hide");
  10597. $("#otherBlRecordModal").modal();
  10598. initOtherMzBlRecordList();
  10599. }
  10600. /**
  10601. * 关闭待合并病历列表
  10602. */
  10603. function closeBlRecordModel() {
  10604. $('#baseMzBlTimes').val(null);
  10605. $("#visitingDetailModal").modal();
  10606. }
  10607. /**
  10608. * 病历列表
  10609. */
  10610. function initOtherMzBlRecordList() {
  10611. $('#other_bl_record_table').bootstrapTable("destroy");
  10612. $('#other_bl_record_table').bootstrapTable({
  10613. url: '/thmz/getMzBlRecordList', //请求后台的URL(*)
  10614. method: 'post', //请求方式(*)
  10615. toolbar: '#toolbar', //工具按钮用哪个容器
  10616. striped: true, //是否显示行间隔色
  10617. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  10618. pagination: true, //是否显示分页(*)
  10619. sortable: true, //是否启用排序
  10620. sortOrder: "desc", //排序方式
  10621. queryParams: queryOtherParams, //传递参数(*)
  10622. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  10623. pageNumber: 1, //初始化加载第一页,默认第一页
  10624. pageSize: 5, //每页的记录行数(*)
  10625. pageList: [10, 15, 25, 50, 100], //可供选择的每页的行数(*)
  10626. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  10627. strictSearch: true,
  10628. showColumns: false, //是否显示所有的列
  10629. showRefresh: false, //是否显示刷新按钮
  10630. minimumCountColumns: 2, //最少允许的列数
  10631. clickToSelect: true, //是否启用点击选中行
  10632. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  10633. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  10634. cardView: false, //是否显示详细视图
  10635. detailView: false,
  10636. //rowStyle:rowStyle,//通过自定义函数设置行样式
  10637. ajaxOptions: {
  10638. headers: {
  10639. 'Accept': 'application/json',
  10640. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  10641. }
  10642. },
  10643. columns: [
  10644. {
  10645. title: '操作',
  10646. field: 'op',
  10647. align: "center",
  10648. valign: 'middle',
  10649. formatter: function (value, row, index) {
  10650. 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>';
  10651. return [str].join('');
  10652. }
  10653. },
  10654. {
  10655. field: 'patientId',
  10656. title: '门诊ID',
  10657. align: "center",
  10658. valign: 'middle'
  10659. }, {
  10660. field: 'patientName',
  10661. title: '患者姓名',
  10662. align: "center",
  10663. valign: 'middle'
  10664. }, {
  10665. field: 'deptCode',
  10666. title: '就诊科室',
  10667. align: "center",
  10668. valign: 'middle'
  10669. }, {
  10670. field: 'doctorCode',
  10671. title: '接诊医师',
  10672. align: "center",
  10673. valign: 'middle'
  10674. }, {
  10675. field: 'firstOrNot',
  10676. title: '初/复诊',
  10677. align: "center",
  10678. valign: 'middle',
  10679. formatter: function (value, row, index) {
  10680. if (value == '1') {
  10681. return "复诊";
  10682. }
  10683. return "初诊";
  10684. }
  10685. }
  10686. , {
  10687. field: 'visitDate',
  10688. title: '就诊时间',
  10689. align: "center",
  10690. valign: 'middle',
  10691. formatter: function (value, row, index) {
  10692. if (value == null || value == "") {
  10693. return "";
  10694. }
  10695. return format(value, "yyyy-MM-dd HH:mm:ss");
  10696. }
  10697. }
  10698. ],
  10699. responseHandler: function (res) {
  10700. if (res == '401' || res == 401) {
  10701. window.location.href = '/thmz/login/view'
  10702. return;
  10703. }
  10704. var ress = eval(res);
  10705. if (ress.code == -1) {
  10706. if (ress.message != null && ress.message != '') {
  10707. errorMesage(ress);
  10708. }
  10709. return {
  10710. "total": 0,//总页数
  10711. "rows": {} //数据
  10712. };
  10713. }
  10714. return {
  10715. "total": ress.total,//总页数
  10716. "rows": ress.data //数据
  10717. };
  10718. },
  10719. });
  10720. }
  10721. /**
  10722. * 构建列表查询参数
  10723. * @param params
  10724. * @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}}
  10725. */
  10726. function queryOtherParams(params) {
  10727. var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
  10728. patientId: $("#editPatientId").text(),
  10729. exceptTimes: $("#mzBlTimes").val(),
  10730. pageSize: params.limit, //页面大小
  10731. pageIndex: params.offset / params.limit, //页码
  10732. };
  10733. return temp;
  10734. }
  10735. /**
  10736. * 提取处理意见保存
  10737. */
  10738. function setOtherEmrProcess() {
  10739. $("#editMzBlRecordModal").modal("hide");
  10740. $("#messageModal").modal();
  10741. $("#messageContent").html("确定要执行此次提取处理意见操作吗?");
  10742. $("#messageButton").off("click").on("click", function (t) {
  10743. $("#messageModal").modal("hide");
  10744. $.ajax({
  10745. type: "GET",
  10746. url: '/thmz/extractEmrProcess?patientId=' + $("#editPatientId").html() + '&baseTimes=' + $("#baseMzBlTimes").val() + '&times=' + $("#mzBlTimes").val(),
  10747. contentType: "application/json;charset=UTF-8",
  10748. dataType: "json",
  10749. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10750. success: function (res) {
  10751. if (res == '401' || res == 401) {
  10752. window.location.href = '/thmz/login/view'
  10753. return;
  10754. }
  10755. if (res.code == 0) {
  10756. successMesage(res);
  10757. $("#editMzBlRecordModal").modal("hide");
  10758. } else {
  10759. errorMesage(res);
  10760. }
  10761. }
  10762. });
  10763. });
  10764. $("#cancelButton").off("click").on("click", function (t) {
  10765. $("#editMzBlRecordModal").modal();
  10766. });
  10767. }
  10768. /**
  10769. * 医保电子凭证读卡
  10770. */
  10771. function siReadCard() {
  10772. $.ajax({
  10773. type: "GET",
  10774. url: 'http://localhost:8321/readcard/entry?param=qrcode_01101',
  10775. contentType: "application/json;charset=UTF-8",
  10776. dataType: "json",
  10777. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10778. success: function (res) {
  10779. if (res == '401' || res == 401) {
  10780. window.location.href = '/thmz/login/view'
  10781. return;
  10782. }
  10783. //console.log(res);
  10784. if (res.code == 200) {
  10785. var data = JSON.parse(res.data);
  10786. queryUserInfoBySocialNoNotFillPatient('rapidAcceptsUserCardNo', "" + data.data.idNo + "", queryUserInfoByCardNo, 'rapidAcceptsModal');
  10787. } else {
  10788. errorMesage(res);
  10789. }
  10790. }
  10791. });
  10792. // window.open('ReadCard://'+prm, '_self')
  10793. }
  10794. /**
  10795. * 西药品类按钮点击事件 因为原插件有点未解决bug,点击title的时候,加载的列表非对应的,
  10796. * @param paneId
  10797. */
  10798. function xyTableOnClick(paneId) {
  10799. setTimeout(function () {
  10800. $("#xyTabContent div.tab-pane").each(function (index, obj) {
  10801. var targetId = $(obj).attr("id");
  10802. //如果处方内容是空的,就删除没有处方
  10803. if ($(obj).find("div.cf_content").children().length == 0) {
  10804. $(obj).remove();
  10805. $("[href='#" + targetId + "']").parent().remove();
  10806. } else if (targetId == paneId) {
  10807. $(obj).addClass("active").addClass("in");
  10808. } else {
  10809. $(obj).removeClass("active").removeClass("in");
  10810. }
  10811. });
  10812. }, 400);
  10813. }
  10814. /**
  10815. * 打开转诊弹层
  10816. */
  10817. function transferTreatment() {
  10818. $("#turnDept").selectpicker({
  10819. size: 5
  10820. });
  10821. $("#turnToConsultationTitle").html("转诊");
  10822. $("#opType").val(1);
  10823. $("#turnToConsultationDoctorDiv").removeClass("hide").addClass("in");
  10824. $("#turnDeptDiv").removeClass("hide").addClass("in");
  10825. $("#consultationDeptDiv").removeClass("in").addClass("hide");
  10826. //科室列表
  10827. $.ajax({
  10828. type: "GET",
  10829. url: '/thmz/getUnitCodeByRequestDay?ampm=',
  10830. dataType: "json",
  10831. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10832. success: function (data) {
  10833. if (data == '401' || data == 401) {
  10834. window.location.href = '/thmz/login/view'
  10835. return;
  10836. }
  10837. var html = '';
  10838. $.each(data.data, function (commentIndex, comment) {
  10839. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';
  10840. });
  10841. $('#turnDept').empty();
  10842. $('#turnDept').html(html);
  10843. $('#turnDept').selectpicker('refresh');
  10844. }
  10845. });
  10846. $("#turnToConsultationModal").modal();
  10847. }
  10848. /**
  10849. * 打开会诊弹层
  10850. */
  10851. function consultation() {
  10852. $("#consultationDept").selectpicker({
  10853. size: 5
  10854. });
  10855. $("#turnToConsultationTitle").html("发起会诊");
  10856. $("#opType").val(2);
  10857. $("#turnToConsultationDoctorDiv").removeClass("in").addClass("hide");
  10858. $("#consultationDeptDiv").removeClass("hide").addClass("in");
  10859. $("#turnDeptDiv").removeClass("in").addClass("hide");
  10860. //科室列表
  10861. $.ajax({
  10862. type: "GET",
  10863. url: '/thmz/allMzUnitCode',
  10864. dataType: "json",
  10865. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10866. success: function (res) {
  10867. if (res == '401' || res == 401) {
  10868. window.location.href = '/thmz/login/view'
  10869. return;
  10870. }
  10871. var html = '';
  10872. $.each(res.data, function (commentIndex, comment) {
  10873. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';
  10874. });
  10875. $('#consultationDept').empty();
  10876. $('#consultationDept').html(html);
  10877. $('#consultationDept').selectpicker('refresh');
  10878. $.ajax({
  10879. type: "GET",
  10880. url: '/thmz/getUnConsultation?serialNo=' + $("#mzfzSerialNoInClick").val(),
  10881. dataType: "json",
  10882. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10883. success: function (res) {
  10884. if (res == '401' || res == 401) {
  10885. window.location.href = '/thmz/login/view'
  10886. return;
  10887. }
  10888. var data = res.data;
  10889. if (data != null && data.length > 0) {
  10890. $('#consultationDept').selectpicker('val', data);
  10891. $('#consultationDept').selectpicker('refresh');
  10892. }
  10893. }
  10894. });
  10895. }
  10896. });
  10897. $("#turnToConsultationModal").modal();
  10898. }
  10899. /**
  10900. * 清空转诊和发起会诊区域
  10901. */
  10902. function clearTurnToConsultationInput() {
  10903. $("#turnDept").selectpicker('val', null);
  10904. $("#turnDept").selectpicker('refresh');
  10905. $("#consultationDept").selectpicker('val', null);
  10906. $("#consultationDept").selectpicker('refresh');
  10907. $("#turnToConsultationDoctor").selectpicker('val', null);
  10908. $("#turnToConsultationDoctor").selectpicker('refresh');
  10909. $("#turnToConsultationId").val(null);
  10910. $("#opType").val(null);
  10911. $("#turnToConsultationDoctorDiv").removeClass("in").addClass("hide");
  10912. $("#turnDeptDiv").removeClass("in").addClass("hide");
  10913. $("#consultationDeptDiv").removeClass("in").addClass("hide");
  10914. }
  10915. /**
  10916. * 清空门诊统筹支付参数区域
  10917. */
  10918. function clearZgtczfInput() {
  10919. $("#zgmztczfDiv").removeClass("in").addClass("hide");
  10920. $("#mztczfSiReadCard").removeClass("in").addClass("hide");
  10921. $("#grzhzfDiv").removeClass("in").addClass("hide");
  10922. $("#zgmztczf").selectpicker('val', null);
  10923. $("#zgmztczf").selectpicker('refresh');
  10924. $("#grzhzf").selectpicker('val', null);
  10925. $("#grzhzf").selectpicker('refresh');
  10926. $("#readCardResult").val(null);
  10927. }
  10928. /**
  10929. * 保存转诊/会诊
  10930. */
  10931. function setTurnToConsultation() {
  10932. $("#turnToConsultationModal").modal("hide");
  10933. $("#messageModal").modal();
  10934. var opType = $("#opType").val();
  10935. var targetDeptNo = $("#turnDept").val();
  10936. var title = "确认提交转诊操作吗,提交后您将无法继续接诊该患者?";
  10937. if (opType == 2 || opType == "2") {
  10938. title = "确认提交本次会诊操作吗?";
  10939. var consultationDept = $("#consultationDept").val();
  10940. if (consultationDept != null && consultationDept.length > 0) {
  10941. targetDeptNo = null;
  10942. for (var i = 0; i < consultationDept.length; i++) {
  10943. if (targetDeptNo == null) {
  10944. targetDeptNo = consultationDept[i];
  10945. } else {
  10946. targetDeptNo += "," + consultationDept[i];
  10947. }
  10948. }
  10949. }
  10950. }
  10951. $("#messageContent").html(title);
  10952. $("#messageButton").off("click").on("click", function (t) {
  10953. $("#messageModal").modal("hide");
  10954. $.ajax({
  10955. type: "POST",
  10956. url: '/thmz/saveTurnToConsultation',
  10957. contentType: "application/json;charset=UTF-8",
  10958. dataType: "json",
  10959. data: JSON.stringify({
  10960. "id": $("#turnToConsultationId").val(),
  10961. "opType": opType,
  10962. "targetDeptNo": targetDeptNo,
  10963. "targetDoctorNo": $("#turnToConsultationDoctor").val(),
  10964. "serialNo": $("#mzfzSerialNoInClick").val(),
  10965. "remark": $("#turnToConsultationRemark").val(),
  10966. }),
  10967. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10968. success: function (res) {
  10969. if (res == '401' || res == 401) {
  10970. window.location.href = '/thmz/login/view'
  10971. return;
  10972. }
  10973. if (res.code == 0) {
  10974. successMesage(res);
  10975. clearTurnToConsultationInput();
  10976. if (opType == 1 || opType == "1") {
  10977. //加载候诊患者列表
  10978. loadUnClinicTableList();
  10979. //加载接诊中患者列表
  10980. loadInClinicTableList();
  10981. clearWorkSpace();
  10982. }
  10983. } else {
  10984. $("#turnToConsultationModal").modal();
  10985. errorMesage(res);
  10986. }
  10987. }
  10988. });
  10989. });
  10990. $("#cancelButton").off("click");
  10991. }
  10992. /**
  10993. * 初始医生下拉选
  10994. * @param ampm 时间段区间
  10995. */
  10996. function initEmployee() {
  10997. var opType = $("#opType").val();
  10998. if (opType == 2) {
  10999. return;
  11000. }
  11001. $("#turnToConsultationDoctor").selectpicker({
  11002. size: 5
  11003. });
  11004. //医生列表
  11005. $.ajax({
  11006. type: "GET",
  11007. url: '/thmz/getDoctorCodeByRequestDay?unitCode=' + $('#turnDept').val() + "&ampm=&chargeType=",
  11008. dataType: "json",
  11009. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11010. success: function (res) {
  11011. if (res == '401' || res == 401) {
  11012. window.location.href = '/thmz/login/view'
  11013. return;
  11014. }
  11015. var html = '';
  11016. var defaultCode = null;
  11017. $.each(res.data, function (commentIndex, comment) {
  11018. var employeeName = comment.employee.employeeName;
  11019. if (comment.leftNum != null) {
  11020. employeeName = employeeName + " 余号(" + comment.leftNum + ")"
  11021. }
  11022. html += '<option value="' + comment.employee.employeeCode + '" data-chargeType="' + comment.chargeType + '" data-checkFee="' + comment.checkFee + '" data-mzyRequestId="' + comment.mzyRequestId + '">' + employeeName + '</option>';
  11023. if (res.data.length == 1) {
  11024. //如果只有一个号别,默认选中
  11025. defaultCode = comment.employee.employeeCode;
  11026. }
  11027. });
  11028. $('#turnToConsultationDoctor').empty();
  11029. $('#turnToConsultationDoctor').html(html);
  11030. $('#turnToConsultationDoctor').selectpicker('refresh');
  11031. if (defaultCode != null) {
  11032. //如果有无需选择医生的选项,默认选择
  11033. $('#turnToConsultationDoctor').selectpicker('val', defaultCode);
  11034. $('#turnToConsultationDoctor').selectpicker('refresh');
  11035. }
  11036. }
  11037. });
  11038. }
  11039. /**
  11040. * 选择门诊统筹支付时校验门诊诊断是否是标准诊断,校验医生是否具有医保编码
  11041. */
  11042. function verifyInsuranceInfo() {
  11043. var zgmztczf = $("#zgmztczf").val();
  11044. if (zgmztczf != null && (zgmztczf == 1 || zgmztczf == "1")) {
  11045. var diagnoseValue = $("#diagnoseValue").val();
  11046. if (diagnoseValue == null || diagnoseValue == "" || diagnoseValue.length == 0) {
  11047. errorMesageSimaple("门诊统筹就诊必须使用标准的医保诊断,请修改诊断或者消门诊统筹选项");
  11048. // $("#zgmztczf").selectpicker('val', null);
  11049. // $("#zgmztczf").selectpicker('refresh');
  11050. return false;
  11051. }
  11052. diagnoseValue = diagnoseValue.replace(/,/g, "");
  11053. if (diagnoseValue == null || diagnoseValue == "" || diagnoseValue.length == 0) {
  11054. errorMesageSimaple("门诊统筹就诊必须使用标准的医保诊断,请修改诊断或者消门诊统筹选项");
  11055. // $("#zgmztczf").selectpicker('val', null);
  11056. // $("#zgmztczf").selectpicker('refresh');
  11057. return false;
  11058. }
  11059. var ybCode = localStorage.getItem("ybCode");
  11060. if (ybCode == null || ybCode == "" || ybCode.length == 0) {
  11061. errorMesageSimaple("您还没有医保赋码,无法进行门诊统筹接诊,请取消门诊统筹选项");
  11062. // $("#zgmztczf").selectpicker('val', null);
  11063. // $("#zgmztczf").selectpicker('refresh');
  11064. return false;
  11065. }
  11066. }
  11067. return true;
  11068. }
  11069. /**
  11070. * 已诊列表发起会诊
  11071. * @param patientId
  11072. */
  11073. function consultationCliniced(patientId) {
  11074. $.ajax({
  11075. type: "GET",
  11076. url: '/thmz/getLastClinicedFzOrder?patientId=' + patientId,
  11077. dataType: "json",
  11078. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11079. success: function (res) {
  11080. if (res == '401' || res == 401) {
  11081. window.location.href = '/thmz/login/view'
  11082. return;
  11083. }
  11084. if (res.code == 0) {
  11085. $("#visitingDetailModal").modal("hide");
  11086. $("#mzfzSerialNoInClick").val(res.data.serialNo);
  11087. consultation();
  11088. } else {
  11089. errorMesage(res);
  11090. }
  11091. }
  11092. });
  11093. }
  11094. /**
  11095. * 计算诊疗金额
  11096. * @param flag true ,直接计算总价, false 还要计算总量
  11097. */
  11098. function calculateZl(flag) {
  11099. if (!flag) {
  11100. var itemQuantity = $("#itemQuantity").val();
  11101. if (itemQuantity == null) {
  11102. return;
  11103. }
  11104. var dayZlNum = $("#dayZlNum").val();
  11105. if (dayZlNum == null) {
  11106. return;
  11107. }
  11108. //频率
  11109. var times = $('#orderFrequencyZl').find("option:selected").attr('desc');
  11110. if (times == null) {
  11111. return;
  11112. }
  11113. var totalNumZl = Multiply(Multiply(itemQuantity, dayZlNum), times);
  11114. $("#totalNumZl").val(totalNumZl);
  11115. }
  11116. //总量
  11117. var totalNumZl = $("#totalNumZl").val();
  11118. if (totalNumZl == null) {
  11119. return;
  11120. }
  11121. //单价
  11122. var zlItemPrice = $("#zlItemPrice").val();
  11123. if (zlItemPrice == null) {
  11124. return;
  11125. }
  11126. $("#totalAmountZl").val(Multiply(totalNumZl, zlItemPrice).toFixed(2));
  11127. }
  11128. /**
  11129. *打印外伤无第三方责任承诺书
  11130. */
  11131. function printNoThirdParty() {
  11132. printNoThirdPartyCommon(1);
  11133. }
  11134. /**
  11135. * 打印外伤无第三方责任承诺书
  11136. * @param printType 打印模式 1 预览打印 2 打印设置
  11137. */
  11138. function printNoThirdPartyCommon(printType) {
  11139. warningMesageSimaple("请提醒患者至医保窗口审核,审核通过方能报销!");
  11140. var title = "外伤无第三方责任承诺书";
  11141. setPrint();
  11142. LODOP = getLodop();
  11143. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院" + title);
  11144. LODOP.SET_PRINT_STYLE("FontSize", 7); //字体大小
  11145. //设置默认打印机
  11146. LODOP.SET_PRINTER_INDEX(printIndex);
  11147. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  11148. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  11149. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  11150. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", title);//对新建的纸张重命名
  11151. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  11152. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  11153. // var strStyle = "<style>table{width: 96%;}</style>";
  11154. var strStyle = "<style>table{width: 96%;margin-top: 20px;margin-bottom: 10px;} table,th {border-width: 1px;border-style: solid;border-collapse: collapse}</style>";
  11155. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("print_no_third_party_table").innerHTML);
  11156. if (printType == 1) {
  11157. LODOP.PREVIEW();
  11158. } else if (printType == 2) {
  11159. LODOP.PRINT_SETUP();
  11160. }
  11161. }
  11162. /**
  11163. * 打印自费承诺书
  11164. */
  11165. function printSelfPay() {
  11166. printSelfPayCommon(1);
  11167. }
  11168. /**
  11169. * 打印自费承诺书
  11170. * @param printType 打印模式 1 预览打印 2 打印设置
  11171. */
  11172. function printSelfPayCommon(printType) {
  11173. var title = "参保人员门诊统筹医保支付告知审核表";
  11174. setPrint();
  11175. LODOP = getLodop();
  11176. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院" + title);
  11177. LODOP.SET_PRINT_STYLE("FontSize", 7); //字体大小
  11178. //设置默认打印机
  11179. LODOP.SET_PRINTER_INDEX(printIndex);
  11180. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  11181. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  11182. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  11183. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", title);//对新建的纸张重命名
  11184. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  11185. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  11186. // var strStyle = "<style>table{width: 96%;}</style>";
  11187. //table,th {border-width: 1px;border-style: solid;border-collapse: collapse}
  11188. var strStyle = "<style>table{width: 96%;margin-top: 20px;margin-bottom: 10px;} </style>";
  11189. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("self_pay_table").innerHTML);
  11190. if (printType == 1) {
  11191. LODOP.PREVIEW();
  11192. } else if (printType == 2) {
  11193. LODOP.PRINT_SETUP();
  11194. }
  11195. }