clinic.js 679 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774
  1. //@ sourceURL=clinic.js
  2. //判断病人列表是否在加载中,防止重复加载
  3. var msg_list_loading = false;
  4. //挂号卡片列表页面下标
  5. var pageIndex = 0;
  6. //药品使用方法,天数和频次的集合
  7. var groupIdMap = null;
  8. var LODOP; //声明为全局变量
  9. //默认打印机下标
  10. var printIndex = -1;
  11. // //上一個光标点击的元素ID
  12. var prevEleId = null;
  13. //打开检查检验报告的时候不知道哪个有报告,如果检查没有就自动打开检验,但是为了防止死循环,次数加到1就不在进行重试
  14. var retryCount = 0;
  15. //是否在读卡中
  16. var mztczfSiReadCardStatus = false;
  17. //药品组号与处方号关系
  18. var gropuIdAndOrderNoMap = null;
  19. //上一个药品大类
  20. //var prevCategoriesFlag = null;
  21. //处方回调和修改的时候处方号与处方tab的关系
  22. var orderNoAndTableIdMap = null;
  23. //处方回调和修改的时候处方tab与处方号的关系
  24. var tableIdAndOrderNoMap = null;
  25. //合理用药查询审核结果url
  26. var getResultUrl = null;
  27. //定时器
  28. var timer;
  29. var ksjzType = null;
  30. var hospitalName='沭阳铭和医院'
  31. var wpyHide = 0;
  32. var currentPatientId = '';
  33. //就诊病人信息
  34. var currentPatientInfo = {} ;
  35. //就诊病人列表
  36. var patientList = [];
  37. //就诊病人过敏源
  38. var allergens = [];
  39. $(function () {
  40. getAjaxRequst("/thmz/queryWpyOrderHide",{},true,function (res) {
  41. wpyHide = res.data
  42. if(res.data === 1){
  43. $('#wp_order_button').removeClass('in').addClass('hide');
  44. $('#healthEducationDiv').removeClass('in').addClass('hide');
  45. $('#ypHealthEducationDiv').removeClass('in').addClass('hide');
  46. }
  47. })
  48. getAjaxRequst("/thmz/queryHospitalName",{},true,function (res) {
  49. hospitalName = res.data
  50. $('.hospitalName').text(hospitalName)
  51. })
  52. initCopy();
  53. initMzOrderTypeSelect();
  54. initGenderSelect();
  55. iniAdmissStatus();
  56. initListDeptSelect();
  57. initRelationSelect();
  58. //initTryResultSelect();
  59. initResponceTypeSelect();
  60. initTemplateTypeSelect("templateType");
  61. initTemplateKindTypeSelect('templateKindType');
  62. initZyClassTypeSelect();
  63. initInstructionSelect();
  64. initSelectWithParams();
  65. initCertificateTypeSelect();
  66. initMztcSelect();
  67. initMzssSelect();
  68. //setSelectSize();
  69. $('#editUserBirthDayGroup').datetimepicker({
  70. format: 'yyyy-mm-dd',
  71. language: 'zh-CN',
  72. minView: "month",
  73. });
  74. initDaterangepickerWithId('reportrange', "right");
  75. formatCheck();
  76. //数据校验
  77. init_validator();
  78. //初始频次下拉选
  79. initOrderFrequencys("orderFrequency", true);
  80. //初始频次下拉选
  81. initOrderFrequencys("orderFrequencyZl", true);
  82. //初始用药方式下拉选
  83. initSupplyTypes();
  84. //初始化外配药品用法
  85. initZdRxAll('rx_used_way','medcWayCodg');
  86. //初始化外配药品频次
  87. initZdRxAll('rx_used_frqu','usedFrquCodg');
  88. //初始外配药化剂型
  89. initDrugDosform();
  90. initAdvmPro('visitAdvmPro');
  91. //加载候诊患者列表
  92. loadUnClinicTableList();
  93. //加载接诊中患者列表
  94. loadInClinicTableList();
  95. //加载已接诊患者列表
  96. loadClinicTableList();
  97. //每隔一分钟秒读加载候诊患者列表
  98. refreshList();
  99. // setInterval(function () {
  100. // //加载候诊患者列表
  101. // loadUnClinicTableList();
  102. // //加载已接诊患者列表 病人会缴费,需要刷新状态
  103. // loadClinicTableList();
  104. // }, 60000);
  105. //初始化快速接诊病人姓名栏事件
  106. initUserList();
  107. //初始化主诉弹出层
  108. initRecommendList();
  109. //卡号输入改变事件
  110. cardNoChange();
  111. //初始化省份
  112. initProvince(3);
  113. //初始化省份
  114. initProvince(5);
  115. /**
  116. * 患者信息修改
  117. */
  118. $("#saveEditUser").on("click", function (t) {
  119. modifyPatient();
  120. });
  121. // /**
  122. // * 保存入院证
  123. // */
  124. // $("#saveBeHospitalized").on("click", function (t) {
  125. // saveBeHospitalized();
  126. // });
  127. /**
  128. * 打印入院证
  129. */
  130. $("#printBeHospitalized").on("click", function (t) {
  131. modifyPatient();
  132. });
  133. //折叠按钮初始化
  134. $('.collapse-link').on('click', function () {
  135. var $BOX_PANEL = $(this).closest('.x_panel_mine'),
  136. $ICON = $(this).find('i'),
  137. $BOX_CONTENT = $BOX_PANEL.find('.x_content');
  138. // fix for some div with hardcoded fix class
  139. if ($BOX_PANEL.attr('style')) {
  140. $BOX_CONTENT.slideToggle(200, function () {
  141. $BOX_PANEL.removeAttr('style');
  142. });
  143. } else {
  144. $BOX_CONTENT.slideToggle(200);
  145. $BOX_PANEL.css('height', 'auto');
  146. }
  147. $ICON.toggleClass('fa-chevron-up fa-chevron-down');
  148. });
  149. /**
  150. * 接诊
  151. */
  152. $("#clinicalReception").on("click", function (t) {
  153. var patientIdDb = $("#patientIdDb").val();
  154. if (patientIdDb == null || patientIdDb == "") {
  155. errorMesageSimaple("当前未选择病人,无法接诊");
  156. return;
  157. }
  158. $.ajax({
  159. type: "GET",
  160. url: '/thmz/getMzfzPatientOrderByPatientId?patientId=' + patientIdDb,
  161. contentType: "application/json;charset=UTF-8",
  162. dataType: "json",
  163. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  164. success: function (res) {
  165. if (res == '401' || res == 401) {
  166. window.location.href = '/thmz/login/view'
  167. return;
  168. }
  169. if (res.code == 0) {
  170. if (res.data != null && res.data.length > 0) {
  171. if (res.data.length == 1) {
  172. $("#turnToConsultationIdInClick").val(res.data[0].turnToConsultationId);
  173. clinicalReception(patientIdDb, res.data[0].serialNo, res.data[0].reqType);
  174. } else {
  175. $("#mzfzPatientOrderModal").modal();
  176. $("#mzfzPatientOrderTable").html(null);
  177. for (var i = 0; i < res.data.length; i++) {
  178. var roomCode = res.data[i].roomCode;
  179. if (roomCode == null || roomCode == "null") {
  180. roomCode = "";
  181. }
  182. var doctorCode = (res.data[i].doctorCode == null || res.data[i].doctorCode == 'null') ? '' : res.data[i].doctorCode;
  183. $("<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 () {
  184. $("#mzfzPatientOrderModal").modal("hide");
  185. $("#turnToConsultationIdInClick").val($(this).attr("data-target-turnToConsultationId"));
  186. clinicalReception(patientIdDb, $(this).attr("data-target"), $(this).attr("data-target-reqType"));
  187. });
  188. }
  189. }
  190. clearRapidAcceptsModal();
  191. $("#rapidAcceptsModal").modal("hide");
  192. } else {
  193. errorMesageSimaple("当前病人没有分诊信息");
  194. }
  195. } else if (res.code == 200) {
  196. clearRapidAcceptsModal();
  197. $("#rapidAcceptsModal").modal("hide");
  198. clinicalReception(patientIdDb, null, null);
  199. } else {
  200. errorMesage(res);
  201. }
  202. }
  203. });
  204. });
  205. /**
  206. * 存为范本
  207. */
  208. $("#saveapidAccepts").on("click", function (t) {
  209. //关闭帮助框
  210. $("#treeButton").webuiPopover('hide');
  211. $("#western_medicine_name").webuiPopover('hide');
  212. $("#chinese_medicine_name").webuiPopover('hide');
  213. $("#jcJyItem").webuiPopover('hide');
  214. $("#zlItem").webuiPopover('hide');
  215. $("#saveapidAcceptsModal").modal("show");
  216. });
  217. /**
  218. * 实例化智能问诊弹窗
  219. */
  220. // $("[data-toggle='popover']").popover();
  221. $("#box-arrow-left").popover({
  222. html: 'true',
  223. content: '<div id="smartAssistPopoverContent"></div>'
  224. });
  225. //初始化药品分组下拉选
  226. initGroupOrder();
  227. // 初始化用药天数下拉选
  228. initDayNum();
  229. //页面加载完成初始化西药处方
  230. //initNavTabs(0);
  231. //页面加载完成初始化住院处方
  232. //initNavTabs(3);
  233. //初始医生工作太配置
  234. initWorkspaceConfigForCurrent();
  235. initExecUnit();
  236. $("#rapidAcceptsUserName").blur(function (e) {
  237. queryUserInfoByName();
  238. });
  239. $("#rapidAcceptsUserName").on('keydown', function (event) {
  240. if (event.key === "Enter") {
  241. event.preventDefault(); // 阻止默认行为(如表单提交)
  242. queryUserInfoByName();
  243. }
  244. });
  245. /**
  246. * 西药点击事件
  247. */
  248. $("#western_medicine_name").on("click", function (t) {
  249. var obj = $("#westernMedicinePopoverContent").parent().parent().parent();
  250. if ($(obj).hasClass("in") || $(obj).css("display") == "block") {
  251. $('#western_medicine_name').webuiPopover('hide');
  252. $("#treeButton").webuiPopover('hide');
  253. return;
  254. }
  255. $('#western_medicine_name').webuiPopover('show');
  256. loadYpList(0, null);
  257. });
  258. /**
  259. * 中药点击事件
  260. */
  261. $("#chinese_medicine_name").on("click", function (t) {
  262. var obj = $("#chineseMedicinePopoverContent").parent().parent().parent();
  263. if ($(obj).hasClass("in") || $(obj).css("display") == "block") {
  264. $('#chinese_medicine_name').webuiPopover('hide');
  265. $("#treeButton").webuiPopover('hide');
  266. return;
  267. }
  268. $('#chinese_medicine_name').webuiPopover('show');
  269. loadYpList(1, null);
  270. });
  271. /**
  272. * 辅助检查、检验点击事件
  273. */
  274. $("#jcJyItem").on("click", function (t) {
  275. var obj = $("#jcJyItemPopoverContent").parent().parent().parent();
  276. if ($(obj).hasClass("in") || $(obj).css("display") == "block") {
  277. $('#jcJyItem').webuiPopover('hide');
  278. $("#treeButton").webuiPopover('hide');
  279. return;
  280. }
  281. $('#jcJyItem').webuiPopover('show');
  282. loadjcJyItemList(null);
  283. });
  284. /**
  285. * 诊疗点击事件
  286. */
  287. $("#zlItem").on("click", function (t) {
  288. var obj = $("#zlItemPopoverContent").parent().parent().parent();
  289. if ($(obj).hasClass("in") || $(obj).css("display") == "block") {
  290. $('#zlItem').webuiPopover('hide');
  291. $("#treeButton").webuiPopover('hide');
  292. return;
  293. }
  294. $('#zlItem').webuiPopover('show');
  295. loadZlItemList(null);
  296. });
  297. //外配药点击事件
  298. $("#wp_medicine_name").on("click", function (t) {
  299. var obj = $("#wpMedicinePopoverContent").parent().parent().parent();
  300. if ($(obj).hasClass("in") || $(obj).css("display") == "block") {
  301. $('#wp_medicine_name').webuiPopover('hide');
  302. $("#treeButton").webuiPopover('hide');
  303. return;
  304. }
  305. $('#wp_medicine_name').webuiPopover('show');
  306. loadWpMedicineList(null);
  307. });
  308. initYshPart();
  309. initJyZdSample();
  310. initClinicDeptNo();
  311. setTimeout(function () {
  312. getLodop();
  313. }, 800);
  314. //键盘监听回车键
  315. $(document).unbind("keyup").keyup(function (event) {
  316. var index = getIndex("bill_item_group");
  317. if (event.keyCode == 13) { //是否是回车
  318. var el = event.srcElement || event.target;
  319. var id = el.getAttribute("id");
  320. var current_code = null;
  321. if (index == 0) {
  322. current_code = $("#western_medicine_current_code").val();
  323. } else if (index == 1) {
  324. current_code = $("#chinese_medicine_current_code").val();
  325. } else if (index == 2) {
  326. current_code = $("#jcjy_current_code").val();
  327. } else if (index == 3) {
  328. current_code = $("#zl_current_code").val();
  329. }else if (index == 6) {
  330. current_code = $("#wp_medicine_current_code").val();
  331. }
  332. if (id == null || id == "") {
  333. id = el.getAttribute("data-id");
  334. }
  335. if (id == null || id == "") {
  336. var search = el.getAttribute("aria-label");
  337. if (search == "Search") {
  338. id = $(el).parent().parent().prev().attr("data-id");
  339. }
  340. }
  341. if (id != null && id != "") {
  342. //将当前点击的id记录下
  343. //prevEleId = id;
  344. } else if (prevEleId != null) {
  345. id = prevEleId;
  346. }
  347. //回车时,光标不在任何区域判断是不是在药品和诊疗开立区域
  348. if (id == null || id == "") {
  349. var index = getIndex("bill_item_group");
  350. if (index == 0) {
  351. if (current_code != null && current_code != "") {
  352. //当前页面是西药保存页面,且有药品选中
  353. $("#supplyType").next().click();
  354. }
  355. } else if (index == 1) {
  356. //当前页面是中草药保存页面,且有药品选中
  357. } else if (index == 2) {
  358. if (current_code != null && current_code != "") {
  359. //当前页面是医技保存页面,且有选中
  360. if ($("#jyZdSampleDiv").hasClass('in')) {
  361. //此时是检验
  362. $("#jyZdSample").next().click();
  363. } else if ($("#yshPartDiv").hasClass('in')) {
  364. //说明现在是检查
  365. $("#yshPart").next().click();
  366. }
  367. }
  368. } else if (index == 3) {
  369. //诊疗
  370. $("#yshPart").next().click();
  371. return;
  372. } else if (index == 4) {
  373. //当前页面是住院保存页面
  374. $("#inpatientWardBeHospitalized").next().click();
  375. return;
  376. }
  377. }
  378. var customization = $("div.customization").not(".hide");
  379. // //回车时,光标不在任何区域,默认点击主诉
  380. // if (id == null || id == "") {
  381. // var eleId = $(customization[0]).attr("target-id");
  382. // $("#" + eleId).focus();
  383. // if (eleId == 'symptom') {
  384. // $("#" + eleId).click();
  385. // }
  386. // console.log("eleId=" + eleId);
  387. // } else
  388. if (id == 'symptom' || id == 'emrHpi' || id == 'emrPs' || id == 'personalHistory' || id == 'familyHistory' || id == 'obstericalHistory' || id == 'otherCheck' || id == 'diagnose' || id == 'tentativeDiagnosis' || id == 'fzZl' || id == 'crbHistory' ) {
  389. console.log("1id=" + id);
  390. if (id != $(customization[customization.length - 1]).attr("target-id")) {
  391. var next = $("#" + id + "Flag").next();
  392. while ($(next).hasClass("foreclose") || $(next).hasClass("hide")) {
  393. next = $(next).next();
  394. }
  395. var eleId = $(next).attr("target-id");
  396. $("#" + eleId).focus();
  397. if (eleId == 'diagnose' || id == 'diagnose' || id == 'symptom') {
  398. $("#" + eleId).click();
  399. }
  400. console.log("1eleId=" + eleId);
  401. } else {
  402. var data_target = $("#symptom").attr("data-target");
  403. $("#" + data_target).find("a.close").click();
  404. data_target = $("#diagnose").attr("data-target");
  405. $("#" + data_target).find("a.close").click();
  406. if (index == 0) {
  407. $("#western_medicine_name").focus();
  408. } else if (index == 1) {
  409. $("#chinese_medicine_name").focus();
  410. } else if (index == 2) {
  411. $("#jcJyItem").focus();
  412. } else if (index == 3) {
  413. $("#zlItem").focus();
  414. } else if (index == 4) {
  415. $("#inpatientWardBeHospitalized").next().click();
  416. } else if (index == 5) {
  417. $("#opName").next().click();
  418. }else if (index == 6) {
  419. $("#wp_medicine_name").focus();
  420. }
  421. }
  422. } else if (id == 'zy_drugWin') {
  423. $("#zyInstruction").next().click();
  424. } else if (id == 'zyInstruction') {
  425. var ariaExpanded = $("#zyInstruction").next().attr("aria-expanded");
  426. if (ariaExpanded == true || ariaExpanded == "true") {
  427. $("#zyInstruction").next().click();
  428. }
  429. $("#saveChineseMedicine").click();
  430. $("#chinese_medicine_name").focus();
  431. $("#chinese_medicine_name").click();
  432. } else if (id == 'cyJssm') {
  433. $("#cyJsl").focus();
  434. } else if (id == 'cyJsl') {
  435. $("#cyZql").focus();
  436. } else if (id == 'cyZql') {
  437. $("#cyFj").focus();
  438. } else if (id == 'cyFj') {
  439. $("#cyFfcs").focus();
  440. } else if (id == 'cyFj') {
  441. $("#cyFfcs").focus();
  442. } else if (id == 'cyFfcs') {
  443. $("#useType_1").next().click();
  444. } else if (id == 'useType_1') {
  445. $("#cyMtjs").focus();
  446. } else if (id == 'cyMtjs') {
  447. $("#zyfs").focus();
  448. } else if (id == 'zyfs') {
  449. $("#zy_supplyType_1").next().click();
  450. } else if (id == 'supplyType') {
  451. $("#drugWinUnit").next().click();
  452. } else if (id == 'drugWinUnit') {
  453. $("#drugWin").focus();
  454. } else if (id == 'drugWin') {
  455. $("#dayNum").next().click();
  456. } else if (id == 'dayNum') {
  457. $("#orderFrequency").next().click();
  458. } else if (id == 'orderFrequency') {
  459. $("#gross").focus();
  460. } else if (id == 'gross') {
  461. $("#packUnit").next().click();
  462. } else if (id == 'packUnit') {
  463. $("#medicalAdvice").next().click();
  464. } else if (id == 'medicalAdvice') {
  465. var ariaExpanded = $("#medicalAdvice").next().attr("aria-expanded");
  466. if (ariaExpanded == true || ariaExpanded == "true") {
  467. $("#medicalAdvice").next().click();
  468. }
  469. saveMedicine(0);
  470. $("#western_medicine_name").focus();
  471. } else if (id == 'saveWesternMedicine') {
  472. $("#western_medicine_name").focus();
  473. $("#western_medicine_name").click();
  474. } else if (id == 'yshPart' || id == 'jyQuantity') {
  475. $("#execUnit").next().click();
  476. } else if (id == 'jyZdSample') {
  477. $("#jyQuantity").focus();
  478. } else if (id == 'execUnit') {
  479. var ariaExpanded = $("#execUnit").next().attr("aria-expanded");
  480. if (ariaExpanded == true || ariaExpanded == "true") {
  481. $("#execUnit").next().click();
  482. }
  483. $("#remark").focus();
  484. } else if (id == 'remark') {
  485. saveJyJcItem(true);
  486. $("#jcJyItem").focus();
  487. } else if (id == 'chargeUnit') {
  488. $("#itemQuantity").focus();
  489. } else if (id == 'itemQuantity') {
  490. $("#dayZlNum").next().click();
  491. } else if (id == 'dayZlNum') {
  492. var ariaExpanded = $("#dayZlNum").next().attr("aria-expanded");
  493. if (ariaExpanded == true || ariaExpanded == "true") {
  494. $("#dayZlNum").next().click();
  495. }
  496. $("#orderFrequencyZl").next().click();
  497. } else if (id == 'orderFrequencyZl') {
  498. var ariaExpanded = $("#orderFrequencyZl").next().attr("aria-expanded");
  499. if (ariaExpanded == true || ariaExpanded == "true") {
  500. $("#orderFrequencyZl").next().click();
  501. }
  502. $("#totalNumZl").focus();
  503. } else if (id == 'totalNumZl') {
  504. $("#zlExecUnit").next().click();
  505. } else if (id == 'zlExecUnit') {
  506. var ariaExpanded = $("#zlExecUnit").next().attr("aria-expanded");
  507. if (ariaExpanded == true || ariaExpanded == "true") {
  508. $("#zlExecUnit").next().click();
  509. }
  510. $("#zlRemark").focus();
  511. } else if (id == 'zlRemark') {
  512. saveZlItem(true);
  513. $("#zlItem").focus();
  514. } else if (id == 'inpatientWardBeHospitalized') {
  515. $("#smallWardBeHospitalized").next().click();
  516. } else if (id == 'smallWardBeHospitalized') {
  517. $("#conditionCode").next().click();
  518. } else if (id == 'conditionCode') {
  519. $("#routeOfAdmission").next().click();
  520. } else if (id == 'routeOfAdmission') {
  521. $("#admissStatus").next().click();
  522. } else if (id == 'admissStatus') {
  523. saveZyReq(true);
  524. $("#zy_req_button").focus();
  525. } else if (id == 'western_medicine_name') {
  526. var webuiID = $("#western_medicine_name").attr("data-target");
  527. if (webuiID == null || webuiID == "null" || webuiID == "") {
  528. //药品查询框是空白的,打开查询框
  529. $("#western_medicine_name").click();
  530. return;
  531. }
  532. //选择框打开
  533. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  534. var arr = $("#tb_table_western_medicine").find("tbody").find("tr.trhover");
  535. if (arr != undefined && arr != null && arr.length > 0) {
  536. var dataIndex = $(arr).attr("data-index");
  537. var tableData = $("#tb_table_western_medicine").bootstrapTable('getData');
  538. if (tableData != null && tableData.length > 0 && dataIndex != null) {
  539. var trData = tableData[dataIndex];
  540. checkYpInfo(trData.code, trData.serial, trData.ypType, true, null, 3);
  541. $("#western_medicine_name").click();
  542. }
  543. } else {
  544. //药品查询框是空白的,打开查询框
  545. $("#western_medicine_name").click();
  546. }
  547. } else {
  548. if (current_code != null && current_code != "") {
  549. //已经选中药品,跳到用法
  550. $("#supplyType").next().click();
  551. } else {
  552. //药品查询框是空白的,打开查询框
  553. $("#western_medicine_name").click();
  554. }
  555. }
  556. } else if (id == 'chinese_medicine_name') {
  557. var webuiID = $("#chinese_medicine_name").attr("data-target");
  558. if (webuiID == null || webuiID == "null" || webuiID == "") {
  559. $("#chinese_medicine_name").click();
  560. return;
  561. }
  562. //选择框打开
  563. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  564. var arr = $("#tb_table_chinese_medicine").find("tbody").find("tr.trhover");
  565. if (arr != undefined && arr != null && arr.length > 0) {
  566. var dataIndex = $(arr).attr("data-index");
  567. var tableData = $("#tb_table_chinese_medicine").bootstrapTable('getData');
  568. if (tableData != null && tableData.length > 0 && dataIndex != null) {
  569. var trData = tableData[dataIndex];
  570. checkZyInfo(trData.code, trData.serial, $("#zyClassType").val(), true);
  571. $("#chinese_medicine_name").click();
  572. }
  573. } else {
  574. //药品查询框是空白的,打开查询框
  575. $("#chinese_medicine_name").click();
  576. }
  577. } else {
  578. if (current_code != null && current_code != "") {
  579. //已经选中药品,跳到剂量
  580. $("#zy_drugWin").next().click();
  581. } else {
  582. //药品查询框是空白的,打开查询框
  583. $("#chinese_medicine_name").click();
  584. }
  585. }
  586. } else if (id == 'jcJyItem') {
  587. var webuiID = $("#jcJyItem").attr("data-target");
  588. if (webuiID == null || webuiID == "null" || webuiID == "") {
  589. $("#jcJyItem").click();
  590. return;
  591. }
  592. //选择框打开
  593. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  594. var arr = $("#tb_table_jc_jy_item").find("tbody").find("tr.trhover");
  595. if (arr != undefined && arr != null && arr.length > 0) {
  596. var dataIndex = $(arr).attr("data-index");
  597. var tableData = $("#tb_table_jc_jy_item").bootstrapTable('getData');
  598. if (tableData != null && tableData.length > 0 && dataIndex != null) {
  599. var trData = tableData[dataIndex];
  600. $('#jcJyItem').webuiPopover('hide');
  601. $("#jcJyZltype").val(trData.type);
  602. $("#execUnit").selectpicker('val', trData.execUnit);//默认不选中
  603. $("#execUnit").selectpicker('refresh');
  604. if (trData.type == 1) {
  605. //检验
  606. $("#jyZdSampleDiv").removeClass("hide").addClass("in");
  607. $("#jyQuantityDiv").removeClass("hide").addClass("in");
  608. $("#chargeUnitDiv").removeClass("in").addClass("hide");
  609. $("#yshPartDiv").removeClass("in").addClass("hide");
  610. if (trData.sampleCode != null && trData.sampleCode != "") {
  611. $("#jyZdSample").selectpicker('val', trData.sampleCode);
  612. $('#jyZdSample').selectpicker('refresh');
  613. }
  614. } else if (trData.type == 2) {
  615. //检查
  616. $("#yshPartDiv").removeClass("hide").addClass("in");
  617. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  618. $("#jyQuantityDiv").removeClass("in").addClass("hide");
  619. $("#chargeUnitDiv").removeClass("in").addClass("hide");
  620. if (trData.bwCode != null && trData.bwCode != "") {
  621. $("#yshPart").selectpicker('val', trData.bwCode);
  622. $('#yshPart').selectpicker('refresh');
  623. }
  624. }
  625. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  626. checkJcJyItemInfo(trData.code, trData.name, trData.type, true);
  627. }
  628. } else {
  629. //药品查询框是空白的,打开查询框
  630. $("#jcJyItem").click();
  631. }
  632. } else {
  633. if (current_code != null && current_code != "") {
  634. //如果是保存失败的,重新打开输入框查询
  635. if (prevEleId == 'remark') {
  636. $("#jcJyItem").click();
  637. } else {
  638. //当前页面是医技保存页面,且有选中
  639. if ($("#jyZdSampleDiv").hasClass('in')) {
  640. //此时是检验
  641. $("#jyZdSample").next().click();
  642. } else if ($("#yshPartDiv").hasClass('in')) {
  643. //说明现在是检查
  644. $("#yshPart").next().click();
  645. }
  646. }
  647. } else {
  648. //药品查询框是空白的,打开查询框
  649. $("#jcJyItem").click();
  650. }
  651. }
  652. } else if (id == 'zlItem') {
  653. var webuiID = $("#zlItem").attr("data-target");
  654. if (webuiID == null || webuiID == "null" || webuiID == "") {
  655. $("#zlItem").click();
  656. return;
  657. }
  658. //选择框打开
  659. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  660. var arr = $("#tb_table_zl_item").find("tbody").find("tr.trhover");
  661. if (arr != undefined && arr != null && arr.length > 0) {
  662. var dataIndex = $(arr).attr("data-index");
  663. var tableData = $("#tb_table_zl_item").bootstrapTable('getData');
  664. if (tableData != null && tableData.length > 0 && dataIndex != null) {
  665. var trData = tableData[dataIndex];
  666. $('#zlItem').webuiPopover('hide');
  667. $("#zlExecUnit").selectpicker('val', trData.execUnit);//默认不选中
  668. $("#zlExecUnit").selectpicker('refresh');
  669. //诊疗
  670. if ($("#zlTab").find("li") == null || $("#zlTab").find("li").length == 0) {
  671. initNavTabs(3, null, null);
  672. }
  673. $("#zlItem").val(trData.name);
  674. $("#zlItem").blur();
  675. $("#zlItemPrice").val(trData.chargeAmount);
  676. $("#chargeUnit").val(trData.specification);
  677. $("#zl_current_code").val(trData.code);
  678. $("#itemQuantity").val(1);
  679. $("#chargeUnit").focus();
  680. }
  681. } else {
  682. //药品查询框是空白的,打开查询框
  683. $("#zlItem").click();
  684. }
  685. } else {
  686. if (current_code != null && current_code != "") {
  687. //如果是保存失败的,重新打开输入框查询
  688. if (prevEleId == 'zlRemark') {
  689. $("#zlItem").click();
  690. } else {
  691. $("#chargeUnit").focus();
  692. }
  693. } else {
  694. //药品查询框是空白的,打开查询框
  695. $("#zlItem").click();
  696. }
  697. }
  698. }else if (id == 'wp_medicine_name') {
  699. var webuiID = $("#wp_medicine_name").attr("data-target");
  700. if (webuiID == null || webuiID == "null" || webuiID == "") {
  701. $("#wp_medicine_name").click();
  702. return;
  703. }
  704. //选择框打开
  705. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  706. var arr = $("#tb_table_wp_medicine").find("tbody").find("tr.trhover");
  707. if (arr != undefined && arr != null && arr.length > 0) {
  708. var dataIndex = $(arr).attr("data-index");
  709. var tableData = $("#tb_table_wp_medicine").bootstrapTable('getData');
  710. if (tableData != null && tableData.length > 0 && dataIndex != null) {
  711. var trData = tableData[dataIndex];
  712. $('#wp_medicine_name').webuiPopover('hide');
  713. //外配药
  714. if ($("#wpMedicineTab").find("li") == null || $("#wpMedicineTab").find("li").length == 0) {
  715. initNavTabs(6, null, null);
  716. }
  717. $("#wp_medicine_name").val(trData.genname);
  718. $("#wp_medicine_name").blur();
  719. $("#sinDosunt").val(trData.minPrepunt);
  720. $("#sinDoscnt").val('1');
  721. setSelectDefaultVal('usedFrquCodg','13')
  722. setSelectDefaultVal('drugDosform',trData.dosformName)
  723. $("#prdrName").val(trData.prdrName);
  724. $("#drugDosunt").val(trData.minPacunt);
  725. $("#drugSpec").val(trData.specName);
  726. $("#wp_medicine_current_code").val(trData.medListCodg);
  727. $("#sinDoscnt").focus();
  728. }
  729. } else {
  730. //药品查询框是空白的,打开查询框
  731. $("#wp_medicine_name").click();
  732. }
  733. } else {
  734. if (current_code != null && current_code != "") {
  735. //如果是保存失败的,重新打开输入框查询
  736. $("#medcWayCodg").next().click();
  737. } else {
  738. //药品查询框是空白的,打开查询框
  739. $("#wp_medicine_name").click();
  740. }
  741. }
  742. }
  743. else if (id == 'zy_req_button') {
  744. //当前页面是住院保存页面,此时光标在入院按钮上
  745. console.log("入院按钮")
  746. $("#inpatientWardBeHospitalized").next().click();
  747. } else if (id == 'op_record_button') {
  748. //当前页面是手术保存页面,此时光标在入院按钮上
  749. console.log("手术按钮")
  750. $("#opName").next().click();
  751. } else if (id == 'opName') {
  752. $("#opTime").click();
  753. var opTime = $("#opTime").val();
  754. if (opTime == null || opTime == "") {
  755. $("#opTime").datetimepicker('show');
  756. } else {
  757. $("#opTime").datetimepicker('hide');
  758. $("#urgentClinicFlag").next().click();
  759. }
  760. } else if (id == 'opTime') {
  761. $("#opTime").datetimepicker('hide');
  762. $("#urgentClinicFlag").next().click();
  763. } else if (id == 'urgentClinicFlag') {
  764. $("#ssbc").next().click();
  765. } else if (id == 'ssbc') {
  766. $("#partCode").next().click();
  767. } else if (id == 'partCode') {
  768. $("#opScale").next().click();
  769. } else if (id == 'opScale') {
  770. $("#hocusCode").next().click();
  771. } else if (id == 'hocusCode') {
  772. $("#doctorZd").next().click();
  773. } else if (id == 'doctorZd') {
  774. $("#opRecordRemark").click();
  775. } else if (id == 'opRecordRemark') {
  776. saveOpRecord(true);
  777. }
  778. if (id != null && id != "") {
  779. //将当前点击的id记录下
  780. prevEleId = id;
  781. }
  782. } else if (event.keyCode == 37) {
  783. // //左键事件
  784. // if(index==0){
  785. // return;
  786. // }
  787. // var prevObject=$("#bill_item_group").find("button")[index-1];
  788. // $(prevObject).click();
  789. } else if (event.keyCode == 38) {
  790. //上键事件
  791. var tableId = null;
  792. var inputId = null;
  793. var contentId = null;
  794. if (index == 0) {
  795. tableId = "tb_table_western_medicine";
  796. inputId = "western_medicine_name";
  797. contentId = "westernMedicinePopoverContent";
  798. } else if (index == 1) {
  799. tableId = "tb_table_chinese_medicine";
  800. inputId = "chinese_medicine_name";
  801. contentId = "chineseMedicinePopoverContent";
  802. } else if (index == 2) {
  803. tableId = "tb_table_jc_jy_item";
  804. inputId = "jcJyItem";
  805. contentId = "jcJyItemPopoverContent";
  806. } else if (index == 3) {
  807. tableId = "tb_table_zl_item";
  808. inputId = "zlItem";
  809. contentId = "zlItemPopoverContent";
  810. }else if (index == 6) {
  811. tableId = "tb_table_wp_medicine";
  812. inputId = "wp_medicine_name";
  813. contentId = "wpMedicinePopoverContent";
  814. }
  815. if (inputId == null) {
  816. return;
  817. }
  818. var webuiID = $("#" + inputId).attr("data-target");
  819. if (webuiID == null || webuiID == "null" || webuiID == "") {
  820. return;
  821. }
  822. //选择框打开
  823. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  824. var arr = $("#" + tableId).find("tbody").find("tr.trhover");
  825. var prev = $(arr).prev();
  826. if (arr != undefined && arr != null && arr.length > 0) {
  827. if (prev != undefined && prev != null && prev.length > 0) {
  828. $(arr).removeClass("trhover");
  829. $(prev).addClass("trhover");
  830. var height = $(arr).css("height");
  831. $("#" + contentId).parent().animate({scrollTop: "-=" + height}, 100);
  832. }
  833. } else {
  834. var arrs = $("#" + tableId).find("tbody").find("tr");
  835. $(arrs[0]).addClass("trhover");
  836. var height = $(arrs[0]).css("height");
  837. $("#" + contentId).parent().animate({scrollTop: "+=" + height}, 100);
  838. }
  839. }
  840. } else if (event.keyCode == 39) {
  841. // //右键事件
  842. // if(index==4){
  843. // return;
  844. // }
  845. // var nextObject=$("#bill_item_group").find("button")[index+1];
  846. // $(nextObject).click();
  847. } else if (event.keyCode == 40) {
  848. //下键事件
  849. var tableId = null;
  850. var inputId = null;
  851. var contentId = null;
  852. if (index == 0) {
  853. tableId = "tb_table_western_medicine";
  854. inputId = "western_medicine_name";
  855. contentId = "westernMedicinePopoverContent";
  856. } else if (index == 1) {
  857. tableId = "tb_table_chinese_medicine";
  858. inputId = "chinese_medicine_name";
  859. contentId = "chineseMedicinePopoverContent";
  860. } else if (index == 2) {
  861. tableId = "tb_table_jc_jy_item";
  862. inputId = "jcJyItem";
  863. contentId = "jcJyItemPopoverContent";
  864. } else if (index == 3) {
  865. tableId = "tb_table_zl_item";
  866. inputId = "zlItem";
  867. contentId = "zlItemPopoverContent";
  868. }else if (index == 6) {
  869. tableId = "tb_table_wp_medicine";
  870. inputId = "wp_medicine_name";
  871. contentId = "wpMedicinePopoverContent";
  872. }
  873. if (inputId == null) {
  874. return;
  875. }
  876. var webuiID = $("#" + inputId).attr("data-target");
  877. if (webuiID == null || webuiID == "null" || webuiID == "") {
  878. return;
  879. }
  880. //选择框打开
  881. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  882. var arr = $("#" + tableId).find("tbody").find("tr.trhover");
  883. var next = $(arr).next();
  884. if (arr != undefined && arr != null && arr.length > 0) {
  885. if (next != undefined && next != null && next.length > 0) {
  886. $(arr).removeClass("trhover");
  887. $(next).addClass("trhover");
  888. var height = $(arr).css("height");
  889. $("#" + contentId).parent().animate({scrollTop: "+=" + height}, 100);
  890. }
  891. } else {
  892. var arrs = $("#" + tableId).find("tbody").find("tr");
  893. $(arrs[0]).addClass("trhover");
  894. var height = $(arrs[0]).css("height");
  895. $("#" + contentId).parent().animate({scrollTop: "+=" + height}, 100);
  896. }
  897. }
  898. }
  899. });
  900. //打印检查检验报告单
  901. $('#btn_print').click(function () {
  902. printJyJcReport(1);
  903. });
  904. //打印设置检查检验报告单
  905. $('#btn_print_setup').click(function () {
  906. printJyJcReport(2);
  907. });
  908. /**
  909. * 医保电子凭证读卡
  910. */
  911. $("#siReadCard").on("click", function (t) {
  912. // siReadCard("qrcode_01101");
  913. siReadCard("jiangsu_qrcode_01101");
  914. });
  915. /**
  916. * 医保刷脸
  917. */
  918. $("#siReadCardFace").on("click", function (t) {
  919. // siReadCard("face_01101");
  920. siReadCard("jiangsu_face_01101");
  921. });
  922. /**
  923. * 门诊统筹支付医额外内容弹窗
  924. */
  925. $("#expContentRequired").on("click", function (t) {
  926. expContentRequiredModal();
  927. });
  928. /**
  929. * 门诊统筹支付医保电子凭证读卡
  930. */
  931. // $("#mztczfSiReadCard").on("click", function (t) {
  932. // mztczfSiReadCard(true, "qrcode_01101");
  933. // mztczfSiReadCard(true, "jiangsu_qrcode_01101");
  934. // });
  935. /**
  936. * 门诊统筹支付医保刷脸
  937. */
  938. // $("#mztczfSiReadCardFace").on("click", function (t) {
  939. // mztczfSiReadCard(true, "face_01101");
  940. // mztczfSiReadCard(true, "jiangsu_face_01101");
  941. // });
  942. /**
  943. * 快速接诊页面 -未挂号患者信息查询处编辑患者信息
  944. */
  945. $("#rapidAcceptsEditUser").on("click", function (t) {
  946. editUserModal($("#rapidAcceptsUserCode").val(), 2);
  947. ksjzType = 2 ;
  948. });
  949. //监听滚动停止处理逻辑开始
  950. let t1 = 0;
  951. let t2 = 0;
  952. let timer = null; // 定时器
  953. $("#scroll-wrap").on("scroll", function () {
  954. // 滚动
  955. clearTimeout(timer)
  956. timer = setTimeout(isScrollEnd, 100)
  957. t1 = $("#scroll-wrap").scrollTop();
  958. })
  959. function isScrollEnd() {
  960. t2 = $("#scroll-wrap").scrollTop();
  961. if (t2 == t1) {
  962. clearTimeout(timer)
  963. closeObjectWebui(true);
  964. console.log("滚动停止", t2) // 这里处理
  965. }
  966. }
  967. //监听滚动停止处理逻辑结束
  968. //合理用药预警系统(医药学知识查询助手)
  969. $("#hlyyButton").on("click", function (t) {
  970. $("#hlyyTitle").html("合理用药预警系统(医药学知识查询助手)");
  971. showHlyyModel('hlyysmsDiv', 'hlyysmsLoading', 'hlyysmsModal', "http://172.16.32.121:9097/index.html#");
  972. });
  973. //预约挂号日期控件注册
  974. $('#registrationTime').datetimepicker({
  975. language: 'zh-CN',
  976. //format: 'yyyy-mm-dd hh:ii:ss'
  977. format: 'yyyy-mm-dd',
  978. // showHour:false,
  979. // showMinute:false,
  980. // showSecond:false,
  981. // timeText:"",
  982. // timeFormat:"",
  983. minView: "month",
  984. autoclose: true,//选中自动关闭
  985. });
  986. //初始化号段下拉选
  987. initMzWorkTime();
  988. //挂号日期控件注册
  989. $('#opTime').datetimepicker({
  990. language: 'zh-CN',
  991. format: 'yyyy-mm-dd hh:ii:ss',
  992. showHour: true,
  993. showMinute: true,
  994. showSecond: true,
  995. minView: "1", // 1 小时 2 日视图 3 月视图 4 年视图
  996. autoclose: true,//选中自动关闭
  997. });
  998. //出生日期控件注册
  999. $('#crbMainCardBirthDay').datetimepicker({
  1000. language: 'zh-CN',
  1001. format: 'yyyy-mm-dd',
  1002. minView: "month",
  1003. autoclose: true,//选中自动关闭
  1004. });
  1005. //发病日期控件注册
  1006. $('#illStartDate').datetimepicker({
  1007. language: 'zh-CN',
  1008. format: 'yyyy-mm-dd',
  1009. minView: "month",
  1010. autoclose: true,//选中自动关闭
  1011. });
  1012. //诊断日期控件注册
  1013. $('#illFirstDate').datetimepicker({
  1014. language: 'zh-CN',
  1015. format: 'yyyy-mm-dd',
  1016. minView: "month",
  1017. autoclose: true,//选中自动关闭
  1018. });
  1019. //死亡日期控件注册
  1020. $('#deathDate').datetimepicker({
  1021. language: 'zh-CN',
  1022. format: 'yyyy-mm-dd',
  1023. minView: "month",
  1024. autoclose: true,//选中自动关闭
  1025. });
  1026. });
  1027. /**
  1028. * 刷新列表,解决越来越快的问题
  1029. */
  1030. function refreshList() {
  1031. //clearInterval要放在方法开始,不然的话,下面的代码还没运行到clearInterval,又开始了循环了。
  1032. clearInterval(timer);
  1033. //加载候诊患者列表
  1034. loadUnClinicTableList();
  1035. //加载已接诊患者列表 病人会缴费,需要刷新状态
  1036. // loadClinicTableList();
  1037. timer = setInterval(() => {
  1038. refreshList()
  1039. }, 60000);
  1040. }
  1041. /**
  1042. * 门诊统筹额外内容
  1043. */
  1044. function expContentRequiredModal() {
  1045. $("#expContentRequiredModal").modal("show");
  1046. }
  1047. /**
  1048. * 打开科室选择页面
  1049. */
  1050. function selectDeptModal() {
  1051. $("#selectDeptModal").modal("show");
  1052. }
  1053. /**
  1054. * 打开配置页面
  1055. */
  1056. function configWorkspaceModal() {
  1057. initWorkspaceConfigForCurrent();
  1058. $("#configWorkspaceModal").modal("show");
  1059. }
  1060. /**
  1061. * 打开配置页面
  1062. */
  1063. function jumpToFy() {
  1064. //console.log("val()",$("#clinicDeptNo").val())
  1065. if (currentPatientInfo.patientId) {
  1066. let data = {
  1067. "healthNo":"",
  1068. "patientNo":currentPatientInfo.patientId,
  1069. "hospitalNo":"",
  1070. "outpatientNo":"",
  1071. "name":currentPatientInfo.name,
  1072. "cardType":"01",
  1073. "cardNo":currentPatientInfo.socialNo?currentPatientInfo.socialNo:"",
  1074. "birthday":"",
  1075. "age":"",
  1076. "tel":currentPatientInfo.phoneNo?currentPatientInfo.phoneNo:"",
  1077. "workOrgan":"",
  1078. "lmp":""
  1079. }
  1080. const utf8Bytes = encodeURIComponent(JSON.stringify(data)).replace(/%([0-9A-F]{2})/g, (_, hex) => {
  1081. return String.fromCharCode(parseInt(hex, 16));
  1082. });
  1083. let url = "http://192.168.100.140:18080/mchis-web/?token=321322199206140414&module=M102&data=" + btoa(utf8Bytes);
  1084. window.open(url, "_blank");
  1085. }
  1086. }
  1087. /**
  1088. * 初始化用药天数下拉选
  1089. */
  1090. function initDayNum() {
  1091. var html = '';
  1092. for (var i = 1; i <= 112; i++) {
  1093. html += '<option value="' + i + '">' + i + '</option>';
  1094. }
  1095. $('#dayNum').html(html);
  1096. $('#dayNum').selectpicker('refresh');
  1097. $('#dayZlNum').html(html);
  1098. $('#dayZlNum').selectpicker('refresh');
  1099. $('#medcDays').html(html);
  1100. $('#medcDays').selectpicker('refresh');
  1101. setSelectDefaultVal('medcDays',1)
  1102. }
  1103. /**
  1104. * 根据病人姓名查询病人信息
  1105. */
  1106. function queryUserInfoByName() {
  1107. var userName = $('#rapidAcceptsUserName').val();
  1108. // var cardNo=$("#cardNo").val();
  1109. if (userName == null || userName == "") {
  1110. return;
  1111. }
  1112. if (userName.length > 0) {
  1113. clearRapidAcceptsModal();
  1114. $.ajax({
  1115. type: "GET",
  1116. url: '/thmz/getPatientMiByName?name=' + userName,
  1117. contentType: "application/json;charset=UTF-8",
  1118. dataType: "json",
  1119. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1120. success: function (res) {
  1121. if (res == '401' || res == 401) {
  1122. window.location.href = '/thmz/login/view'
  1123. return;
  1124. }
  1125. if (res.code == 0) {
  1126. fitPatient(res,"icCardNo");
  1127. }
  1128. }
  1129. });
  1130. }
  1131. }
  1132. /**
  1133. * 按照病人id查询病人信息
  1134. * @param patientId
  1135. */
  1136. function fillPatinet(value) {
  1137. $("#rapidAcceptsUserCardNo").val(value);
  1138. queryUserInfoByCardNo()
  1139. }
  1140. /**
  1141. * 下拉框设置默认值
  1142. * @param id
  1143. * @param val
  1144. */
  1145. function setSelectDefaultVal(id,val) {
  1146. $('#'+id).val(val)
  1147. $('#'+id).selectpicker('refresh');
  1148. }
  1149. /**
  1150. * 处方回调
  1151. */
  1152. function resetGroupIdSelect() {
  1153. var groupIds = $("#groupId option");
  1154. var usedGroupIdInputs = $("#xyTabContent").find("input.temporary_items_groupId");
  1155. if (usedGroupIdInputs != null && usedGroupIdInputs.length > 0) {
  1156. let lastGroupId = 0;
  1157. for (var i = 0; i < usedGroupIdInputs.length; i++) {
  1158. var groupId = Number($(usedGroupIdInputs[i]).val());
  1159. if (groupId > lastGroupId) {
  1160. lastGroupId = groupId;
  1161. }
  1162. }
  1163. if (groupIds != null && groupIds.length > 1) {
  1164. for (var i = 0; i < groupIds.length; i++) {
  1165. var groupId = $(groupIds[i]).val();
  1166. if (groupId <= lastGroupId) {
  1167. continue;
  1168. }
  1169. $(groupIds[i]).remove();
  1170. //删除给药方式与其他属性的缓存
  1171. groupIdMap.remove(groupId);
  1172. }
  1173. appendGroupOrder();
  1174. }
  1175. } else if (groupIds != null && groupIds.length > 1) {
  1176. initGroupOrder();
  1177. }
  1178. }
  1179. /**
  1180. * 初始化药品分组下拉选
  1181. */
  1182. function initGroupOrder() {
  1183. var html = '<option value="1">1</option>';
  1184. $('#groupId').html(html);
  1185. $('#groupId').selectpicker('refresh');
  1186. $("#groupId").selectpicker('val', 1);
  1187. $('#groupId').selectpicker('refresh');
  1188. groupIdMap = new MyMap();
  1189. }
  1190. /**
  1191. * 追加分组
  1192. */
  1193. function appendGroupOrder() {
  1194. var last = parseInt($("#groupId > option:last").val());
  1195. last++;
  1196. var html = '<option value="' + last + '">' + last + '</option>';
  1197. $('#groupId').append(html);
  1198. $('#groupId').selectpicker('refresh');
  1199. }
  1200. /**
  1201. * 组号改变事件
  1202. */
  1203. function groupIdChange() {
  1204. //var last = parseInt($("#groupId > option:last").val());
  1205. var groupId = $("#groupId").val();
  1206. var keys = groupIdMap.keySet();
  1207. if (keys.indexOf(groupId) < 0) {
  1208. //是新增药品清空药品输入区域
  1209. var updateFlag = $("#western_medicine_update_flag").val();
  1210. var currentCode = $("#western_medicine_current_code").val();
  1211. //当前时新增药品,而且没有选择药品的时候,组号变更,清空区域
  1212. if ((updateFlag == undefined || updateFlag == null || updateFlag == "false" || updateFlag == false) && (currentCode == null || currentCode == "")) {
  1213. clearWesternMedicine(true);
  1214. }
  1215. } else {
  1216. var map = groupIdMap.get(groupId);
  1217. if (map != null) {
  1218. var supplyType = map.get("supplyType");
  1219. var orderFrequency = map.get("orderFrequency");
  1220. var dayNum = map.get("dayNum");
  1221. //用法编码
  1222. $("#supplyType").selectpicker('val', supplyType);
  1223. $('#supplyType').selectpicker('refresh');
  1224. //$("#supplyType").attr("disabled", "disabled");
  1225. //天数
  1226. $("#dayNum").selectpicker('val', dayNum);
  1227. $('#dayNum').selectpicker('refresh');
  1228. // $("#dayNum").attr("disabled", "disabled");
  1229. //频次编码
  1230. $("#orderFrequency").selectpicker('val', orderFrequency);
  1231. $('#orderFrequency').selectpicker('refresh');
  1232. // $("#orderFrequency").attr("disabled", "disabled");
  1233. }
  1234. }
  1235. }
  1236. /**
  1237. * 关闭智能问诊弹框
  1238. */
  1239. function closePopover() {
  1240. //$(".popover").popover('hide');
  1241. $("#box-arrow-left").click();
  1242. }
  1243. /**
  1244. * 关闭项目选择框
  1245. * ReOpen 是否重新打开 true 打开 false 不打开
  1246. */
  1247. function closeObjectWebui(ReOpen) {
  1248. var index = getIndex("bill_item_group");
  1249. var currentCode = "western_medicine_name";
  1250. if (index == 1) {
  1251. currentCode = "chinese_medicine_name";
  1252. } else if (index == 2) {
  1253. currentCode = "jcJyItem";
  1254. } else if (index == 3) {
  1255. currentCode = "zlItem";
  1256. }
  1257. var webuiID = $("#" + currentCode).attr("data-target");
  1258. if (webuiID != null && webuiID != "null" && webuiID != "") {
  1259. //选择框打开
  1260. if ($("#" + webuiID).hasClass("in") || $("#" + webuiID).css("display") == "block") {
  1261. $("#" + currentCode).click();
  1262. if (ReOpen) {
  1263. $("#" + currentCode).click();
  1264. }
  1265. }
  1266. }
  1267. var symptomID = $("#symptom").attr("data-target");
  1268. if (symptomID != null && symptomID != "null" && symptomID != "") {
  1269. //选择框打开
  1270. if ($("#" + symptomID).hasClass("in") || $("#" + symptomID).css("display") == "block") {
  1271. $("#symptom").click();
  1272. if (ReOpen) {
  1273. $("#symptom").click();
  1274. }
  1275. }
  1276. }
  1277. var weightID = $("#weight").attr("data-target");
  1278. if (weightID != null && weightID != "null" && weightID != "") {
  1279. //选择框打开
  1280. if ($("#" + weightID).hasClass("in") || $("#" + weightID).css("display") == "block") {
  1281. $("#weight").click();
  1282. if (ReOpen) {
  1283. $("#weight").click();
  1284. }
  1285. }
  1286. }
  1287. var diagnoseID = $("#diagnose").attr("data-target");
  1288. if (diagnoseID != null && diagnoseID != "null" && diagnoseID != "") {
  1289. //选择框打开
  1290. if ($("#" + diagnoseID).hasClass("in") || $("#" + diagnoseID).css("display") == "block") {
  1291. $("#diagnose").click();
  1292. if (ReOpen) {
  1293. $("#diagnose").click();
  1294. }
  1295. }
  1296. }
  1297. }
  1298. /**
  1299. * 加载智能问诊弹框内容
  1300. */
  1301. function contentMethod() {
  1302. setTimeout(function () {
  1303. closeObjectWebui(false);
  1304. $(".popover div.arrow").css("display", "none");
  1305. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  1306. if (popoverId == undefined) {
  1307. return;
  1308. }
  1309. var left = $("#" + popoverId).css("left");
  1310. left = left.replace("px", "");
  1311. left = parseInt(left);
  1312. left = left + 55;
  1313. $("#" + popoverId).css("height", "100%").css("top", "0px").css("left", left + "px").css("border-radius", "0px").css("z-index", "11");
  1314. $("#" + popoverId + " .popover-content").css("height", "100%");
  1315. $("#smartAssistPopoverContent").css("height", "100%");
  1316. var html = ' <div style="height: 24%;padding-left: 15px;width: 100%;">' +
  1317. ' <button type="button" style="cursor: default;margin-bottom: 0px;margin-right: 0px; font-size: 12px;"' +
  1318. ' class="btn btn-primary">' +
  1319. ' <span id="patientHisData"></span>就医轨迹' +
  1320. ' </button>' +
  1321. ' <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true" onclick="closePopover()">×</span>' +
  1322. ' </button>' +
  1323. ' <div style="height: calc(100% - 39px);border: 1px solid #DDDDDD;margin-top: 5px;width: 100%;">' +
  1324. ' <form class="form-horizontal form-label-left mz-fixed-form" novalidate autocomplete="off"' +
  1325. ' style="height: 100%;overflow-y: auto;width: 100%;text-align: -webkit-center;position: relative;" id="patientHisDataForm">' +
  1326. ' </form>' +
  1327. ' </div>' +
  1328. ' </div>' +
  1329. ' <div style="height: 23%;padding-left: 15px;width: 100%;">' +
  1330. ' <button type="button" style="cursor: default;margin-bottom: 0px;margin-right: 0px;margin-top: 5px;"' +
  1331. ' class="btn btn-primary">' +
  1332. ' <span id="recommendType"></span>推荐' +
  1333. ' </button>' +
  1334. ' <div style="height: calc(100% - 44px);border: 1px solid #DDDDDD;overflow-y: auto;margin-top: 5px;width: 100%;">' +
  1335. ' <form class="form-horizontal form-label-left mz-fixed-form" novalidate autocomplete="off"' +
  1336. ' style="height: 100%;overflow-y: auto;width: 100%;text-align: -webkit-center;position: relative;" id="recommendForm">' +
  1337. ' <img src="/thmz/images/no-recommend.png" style="height: 120px;position: absolute;top: 50%;transform: translateY(-50%);margin-left: -30px;">' +
  1338. ' </form>' +
  1339. ' </div>' +
  1340. ' </div>' +
  1341. ' <div style="height: 53%;padding-left: 15px;width: 100%;">' +
  1342. ' <button type="button"' +
  1343. ' style="cursor: default;margin-bottom: 0px;margin-right: 0px;margin-top: 5px; font-size: 12px;"' +
  1344. ' class="btn btn-primary">' +
  1345. ' 医疗范本' +
  1346. ' </button>' +
  1347. ' <div class="item" style="width: 230px;height: 35px;float: right;line-height: 35px;margin-right: 40px;">' +
  1348. ' <div class="col-md-6 col-sm-6 col-xs-12">' +
  1349. ' <select class="form-control selectpicker show-tick" title="范文范围" onchange="fitTemplateData()"' +
  1350. ' id="templateTypeForm">' +
  1351. ' </select>' +
  1352. ' </div>' +
  1353. ' <div class="col-md-6 col-sm-6 col-xs-12">' +
  1354. ' <select class="form-control selectpicker show-tick" title="范文类型" onchange="fitTemplateData()"' +
  1355. ' id="templateKindTypeForm">' +
  1356. ' </select>' +
  1357. ' </div>' +
  1358. ' </div>' +
  1359. ' <div style="height: calc(100% - 44px);border: 1px solid #DDDDDD;overflow-y: auto;margin-top: 5px;width: 100%;position: relative;">' +
  1360. ' <form class="form-horizontal form-label-left mz-fixed-form" novalidate autocomplete="off"' +
  1361. ' style="height: 100%;overflow-y: auto;width: 100%;" id="TemplateData">' +
  1362. ' </form>' +
  1363. ' </div>' +
  1364. ' </div>';
  1365. $("#smartAssistPopoverContent").html(html);
  1366. initTemplateTypeSelect("templateTypeForm");
  1367. initTemplateKindTypeSelect('templateKindTypeForm');
  1368. fitPatientHisData();
  1369. fitSymptomData();
  1370. fitEmrHpiData();
  1371. fitEmrPsData();
  1372. fitDiagnoseData();
  1373. fitTemplateData();
  1374. }, 100);
  1375. // setTimeout(function () {
  1376. // $("#patientHisDataForm").html("aadsasfasdfasdfasdfasdfsdfasdfasdfasdfdfafda");
  1377. // },1000);
  1378. }
  1379. /**
  1380. * 设置患者的就诊轨迹
  1381. */
  1382. function fitPatientHisData() {
  1383. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  1384. if (!$("#" + popoverId).hasClass("in")) {
  1385. return;
  1386. }
  1387. var emptyHtml = '<img src="/thmz/images/locus.png" style="height: 120px;position: absolute;top: 50%;transform: translateY(-50%);margin-left: -30px;">';
  1388. if (($("#patientId").text() == null || $("#patientId").text() == "") && ($("#userName").val() == null || $("#userName").val() == "")) {
  1389. $("#patientHisDataForm").html(emptyHtml);
  1390. return;
  1391. }
  1392. var patientId = $("#patientId").text();
  1393. if (patientId == null || patientId == "") {
  1394. patientId = $("#userName").val();
  1395. }
  1396. $.ajax({
  1397. type: "POST",
  1398. url: '/thmz/getClinicWithPage',
  1399. contentType: "application/json;charset=UTF-8",
  1400. dataType: "json",
  1401. data: JSON.stringify({
  1402. "commonParams": patientId,
  1403. //"clinicStatuses": [5, 6],
  1404. "clinicStatuses": [6],
  1405. "pageSize": 10000,
  1406. "offset": 0,
  1407. "beginDate": "2012-02-01 00:00:00",
  1408. "endDate": "",
  1409. "doctorCode": "-1"
  1410. }),
  1411. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1412. success: function (res) {
  1413. if (res == '401' || res == 401) {
  1414. window.location.href = '/thmz/login/view'
  1415. return;
  1416. }
  1417. if (res.code == 0) {
  1418. var html = '';
  1419. var data = res.data;
  1420. if (data == null || data.length == 0) {
  1421. html += emptyHtml;
  1422. } else {
  1423. for (var i = 0; i < data.length; i++) {
  1424. var icdText = data[i].icdText;
  1425. if (icdText == null) {
  1426. // continue;
  1427. icdText = "空白诊断";
  1428. }
  1429. icdText = icdText.trim();
  1430. html += ' <div class="item form-group thmz_alert" style="width: 100%;">';
  1431. html += ' <div style="float: left;width: 172px;">';
  1432. html += ' <img src="/thmz/css/bootstrap/bootstrap-icons-1.5.0/stopwatch.svg"';
  1433. html += ' style="margin-left: 10px!important;vertical-align: -.15em;margin-right: 10px!important;"/>';
  1434. html += ' <span style="width: 120px;margin-right: 20px!important;">' + format(data[i].opDay, "yyyy-MM-dd HH:mm") + '</span>';
  1435. html += ' </div>';
  1436. html += ' <div style="text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 172px);"';
  1437. html += ' title="' + icdText + '">诊断:<a style="cursor: pointer; color: #2e69eb;"';
  1438. html += ' onclick="visitingDetailModal(\'' + data[i].patientId + '\',' + data[i].times + ',' + data[i].id + ',' + data[i].clinicStatus + ')">' + icdText + '</a>';
  1439. html += ' </div>';
  1440. html += ' </div>';
  1441. }
  1442. }
  1443. var patientName = $("#patientName").text();
  1444. if (patientName == null || patientName == "") {
  1445. if (res.mzPatientMi != null) {
  1446. patientName = res.mzPatientMi.name;
  1447. } else {
  1448. patientName = patientId;
  1449. }
  1450. }
  1451. $("#patientHisData").text(patientName + "的");
  1452. if (($("#patientId").text() == null || $("#patientId").text() == "") && ($("#userName").val() == null || $("#userName").val() == "")) {
  1453. $("#patientHisDataForm").html(emptyHtml);
  1454. } else {
  1455. $("#patientHisDataForm").html(html);
  1456. }
  1457. } else {
  1458. errorMesage(res);
  1459. }
  1460. }
  1461. });
  1462. }
  1463. /**
  1464. * 设置主诉推荐
  1465. */
  1466. function fitSymptomData() {
  1467. fitRecommendData(12);
  1468. }
  1469. /**
  1470. * 设置现病史推荐
  1471. */
  1472. function fitEmrHpiData() {
  1473. fitRecommendData(5);
  1474. }
  1475. /**
  1476. * 设置既往史推荐
  1477. */
  1478. function fitEmrPsData() {
  1479. fitRecommendData(6);
  1480. }
  1481. /**
  1482. * 设置诊断推荐
  1483. */
  1484. function fitDiagnoseData() {
  1485. fitRecommendData(13);
  1486. }
  1487. /**
  1488. * 设置推荐通用方法
  1489. */
  1490. function fitRecommendData(paramsType) {
  1491. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  1492. if (!$("#" + popoverId).hasClass("in")) {
  1493. return;
  1494. }
  1495. var inputId = "symptom";
  1496. var text = "主诉";
  1497. if (paramsType == 5) {
  1498. inputId = "emrHpi";
  1499. text = "现病史";
  1500. } else if (paramsType == 6) {
  1501. inputId = "emrPs";
  1502. text = "既往史";
  1503. } else if (paramsType == 13) {
  1504. inputId = "diagnose";
  1505. text = "诊断";
  1506. }
  1507. //光标不在现病史上
  1508. if (document.activeElement.id != inputId) {
  1509. return;
  1510. }
  1511. $("#recommendType").html(text);
  1512. var emptyHtml = '<img src="/thmz/images/no-recommend.png" style="height: 120px;position: absolute;top: 50%;transform: translateY(-50%);margin-left: -30px;">';
  1513. $.ajax({
  1514. type: "GET",
  1515. url: '/thmz/getTCommonParamsByParamsType?paramsType=' + paramsType + '&commonParams=&pageSize=10',
  1516. contentType: "application/json;charset=UTF-8",
  1517. dataType: "json",
  1518. async: false,
  1519. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1520. success: function (res) {
  1521. if (res == '401' || res == 401) {
  1522. window.location.href = '/thmz/login/view'
  1523. return;
  1524. }
  1525. if (res.code == 0) {
  1526. var html = '';
  1527. var data = res.data;
  1528. if (data == null || data.length == 0) {
  1529. html += emptyHtml;
  1530. } else {
  1531. for (var i = 0; i < data.length; i++) {
  1532. var paramsContent = data[i].paramsContent;
  1533. html += ' <div class="item form-group thmz_alert" style="width: 100%;">';
  1534. html += ' <div style="margin-left: 10px;float: left;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 60px);" title="' + paramsContent + '">';
  1535. html += paramsContent;
  1536. html += ' </div>';
  1537. html += ' <div style="float: left;width: 36px;cursor: pointer;"';
  1538. html += ' onclick="fitAppeal(\'' + paramsContent + '\',' + paramsType + ',' + data[i].id + ')">';
  1539. html += ' <img';
  1540. html += ' src="/thmz/css/bootstrap/bootstrap-icons-1.5.0/cursor-fill.svg"';
  1541. html += ' style="margin-left: 10px!important;vertical-align: -.15em;margin-right: 10px!important;"/>';
  1542. html += ' </div>';
  1543. html += ' </div>';
  1544. }
  1545. }
  1546. $("#recommendForm").html(html);
  1547. } else {
  1548. errorMesage(res);
  1549. }
  1550. }
  1551. });
  1552. }
  1553. /**
  1554. * 设置医疗范文方法
  1555. */
  1556. function fitTemplateData() {
  1557. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  1558. if (!$("#" + popoverId).hasClass("in")) {
  1559. return;
  1560. }
  1561. 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;">';
  1562. $.ajax({
  1563. type: "GET",
  1564. url: '/thmz/getTemplate?templateKindType=' + $("#templateKindTypeForm").val() + '&templateType=' + $("#templateTypeForm").val(),
  1565. contentType: "application/json;charset=UTF-8",
  1566. dataType: "json",
  1567. async: false,
  1568. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1569. success: function (res) {
  1570. if (res == '401' || res == 401) {
  1571. window.location.href = '/thmz/login/view'
  1572. return;
  1573. }
  1574. if (res.code == 0) {
  1575. var html = '';
  1576. var data = res.data;
  1577. if (data == null || data.length == 0) {
  1578. html += emptyHtml;
  1579. } else {
  1580. for (var i = 0; i < data.length; i++) {
  1581. var template = data[i];
  1582. var icdText = (template.icdText == null || template.icdText == "") ? "无" : template.icdText;
  1583. html += ' <div class="item form-group thmz_alert" style="width: 100%;">';
  1584. html += ' <div title="' + template.name + '"';
  1585. html += ' style="margin-left: 10px!important;float: left;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: 100px;">';
  1586. html += template.name;
  1587. html += ' </div>';
  1588. html += ' <div style="float: left;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 160px);"';
  1589. html += ' title="' + template.icdText + '">诊断:<a';
  1590. html += ' style="cursor: pointer; color: #2e69eb;"';
  1591. html += ' onclick="medicalModelModal(' + template.id + ')">' + icdText + '</a>';
  1592. html += ' </div>';
  1593. html += ' <div style="float: left;width: 36px;cursor: pointer;" onclick="medicalModelModal(' + template.id + ')"><img';
  1594. html += ' src="/thmz/css/bootstrap/bootstrap-icons-1.5.0/cursor-fill.svg"';
  1595. html += ' style="margin-left: 10px!important;vertical-align: -.15em;margin-right: 10px!important;"/>';
  1596. html += ' </div>';
  1597. html += ' </div>';
  1598. }
  1599. }
  1600. $("#TemplateData").html(html);
  1601. } else {
  1602. errorMesage(res);
  1603. }
  1604. }
  1605. });
  1606. }
  1607. /**
  1608. * 清空快速接诊弹窗
  1609. */
  1610. function clearRapidAcceptsModal() {
  1611. $("#rapidAcceptsUserName").val(null);
  1612. $("#rapidAcceptsUserCode").val(null);
  1613. $("#patientIdDb").val(null);
  1614. $("#rapidAcceptsUserCardNo").val(null);
  1615. $("#rapidAcceptsUserGender").selectpicker('val', 0);
  1616. $("#rapidAcceptsUserGender").selectpicker('refresh');
  1617. $("#rapidAcceptsUserPhoneNum").val(null);
  1618. $('#rapidAcceptsUserCertificateType').selectpicker('val', '01');
  1619. $('#rapidAcceptsUserCertificateType').selectpicker('refresh');
  1620. $("#rapidAcceptsUserIdCard").val(null);
  1621. $("#rapidAcceptsUserIdCard").attr("title", null);
  1622. $("#rapidAcceptsUserPhoneNum").attr("title", null);
  1623. $('#rapidAcceptsProvinceCode').selectpicker('val', null);
  1624. $('#rapidAcceptsProvinceCode').selectpicker('refresh');
  1625. $('#rapidAcceptsCityCode').selectpicker('val', null);
  1626. $('#rapidAcceptsCityCode').selectpicker('refresh');
  1627. $('#rapidAcceptsDistrictCode').selectpicker('val', null);
  1628. $('#rapidAcceptsDistrictCode').selectpicker('refresh');
  1629. $("#rapidAcceptsDetail").val(null);
  1630. $("#rapidAcceptsDetail").attr("title", null);
  1631. $("#rapidAcceptsUserContact").val(null);
  1632. $("#rapidAcceptsUserContactPhone").val(null);
  1633. }
  1634. /**
  1635. * 清空接诊台用户信息
  1636. * @param flag 是否清空分诊流水哈 true 清空
  1637. */
  1638. function clearUser(flag) {
  1639. $("#patientName").html("");
  1640. $("#patientAge").html("");
  1641. $("#patientGender").html("");
  1642. $("#patientId").text(null);
  1643. $("#visitTimes").val(null);
  1644. $("#crbMainCard").css("display", "none");
  1645. $("#editUser").css("display", "none");
  1646. $("#clearUser").css("display", "none");
  1647. $("#discountLvCard").css("display", "none");
  1648. $("#mallTcCard").css("display", "none");
  1649. // $("#fetchSpcSlwinfo").css("display", "none");
  1650. $("#patientPhone").html("");
  1651. $("#patientPhoneLabel").hide();
  1652. $("#patientResponseType").html("");
  1653. $("#first").next().click();
  1654. $("#patientHisData").text("");
  1655. initGhFeeSelect()
  1656. $('#mzOrderTypeSelect').val('1');
  1657. $('#mzOrderTypeSelect').selectpicker('refresh');
  1658. $("#mzReqTypeName").text(null);
  1659. $("#mzReqType").val(null);
  1660. if (flag) {
  1661. $("#transferTreatment").css("display", "none");
  1662. $("#consultation").css("display", "none");
  1663. $("#mzfzSerialNoInClick").val(null);
  1664. $("#mzfzReqTypeNoInClick").val(null);
  1665. $("#turnToConsultationIdInClick").val(null);
  1666. }
  1667. }
  1668. /**
  1669. * 卡号输入改变事件
  1670. */
  1671. function cardNoChange() {
  1672. // if (window.ActiveXObject || "ActiveXObject" in window) {
  1673. // $("#rapidAcceptsUserCardNo").on('input propertychange', function () {
  1674. // queryUserInfoByCardNo();
  1675. // });
  1676. // } else {
  1677. // $("#rapidAcceptsUserCardNo").on('input οninput', function () {
  1678. // queryUserInfoByCardNo();
  1679. // });
  1680. // }
  1681. $("#rapidAcceptsUserCardNo").on('keydown', function (event) {
  1682. if (event.key === "Enter") {
  1683. event.preventDefault(); // 阻止默认行为(如表单提交)
  1684. queryUserInfoByCardNo();
  1685. }
  1686. });
  1687. // $("#rapidAcceptsUserCardNo").on('blur', function (event) {
  1688. // queryUserInfoByCardNo();
  1689. // });
  1690. $("#rapidAcceptsUserCardNoBtn").on('click', function (event) {
  1691. queryUserInfoByCardNo();
  1692. });
  1693. }
  1694. /**
  1695. * 刷新就诊列表
  1696. */
  1697. function refreshClinic() {
  1698. loadInClinicTableList();
  1699. loadClinicTableList();
  1700. fitPatientHisData();
  1701. }
  1702. /**
  1703. * 加载已接诊患者列表
  1704. */
  1705. function loadClinicTableList() {
  1706. //loadCommonClinicTableList("tb_table_clinic","/thmz/getClinicWithPage");
  1707. loadCommonClinicTableList("tb_table_clinic", queryParamsClinic);
  1708. }
  1709. /**
  1710. * 加载患者列表通用方法
  1711. * @param id
  1712. * @param queryParams
  1713. */
  1714. function loadCommonClinicTableList(id, queryParams) {
  1715. $('#' + id).bootstrapTable('refresh');
  1716. $('#' + id).bootstrapTable({
  1717. url: "/thmz/getClinicWithPage", //请求后台的URL(*)
  1718. method: 'post', //请求方式(*)
  1719. toolbar: '#toolbar', //工具按钮用哪个容器
  1720. striped: true, //是否显示行间隔色
  1721. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  1722. pagination: true, //是否显示分页(*)
  1723. sortable: true, //是否启用排序
  1724. sortOrder: "asc", //排序方式
  1725. queryParams: queryParams, //传递参数(*)
  1726. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  1727. pageNumber: 1, //初始化加载第一页,默认第一页
  1728. pageSize: 5, //每页的记录行数(*)
  1729. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  1730. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  1731. strictSearch: true,
  1732. showColumns: false, //是否显示所有的列
  1733. showRefresh: false, //是否显示刷新按钮
  1734. minimumCountColumns: 2, //最少允许的列数
  1735. clickToSelect: true, //是否启用点击选中行
  1736. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  1737. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  1738. cardView: false, //是否显示详细视图
  1739. detailView: false,
  1740. //rowStyle:rowStyle,//通过自定义函数设置行样式
  1741. ajaxOptions: {
  1742. headers: {
  1743. 'Accept': 'application/json',
  1744. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  1745. }
  1746. },
  1747. columns: [
  1748. {
  1749. field: 'patientName',
  1750. title: '姓名/性别/年龄',
  1751. align: "center",
  1752. valign: 'middle',
  1753. // sortable: true
  1754. formatter: function (value, row, index) {
  1755. var age = row.age;
  1756. if (age == null || age == "null") {
  1757. age = "";
  1758. }
  1759. let tfName = ''
  1760. if(row.clinicStatus == 7){
  1761. tfName = '/退'
  1762. }
  1763. return value + "/" + row.gender + "/" + age+ tfName;
  1764. }
  1765. }, {
  1766. field: 'opDay',
  1767. title: '接诊时间',
  1768. align: "center",
  1769. valign: 'middle',
  1770. // sortable: true
  1771. formatter: function (value, row, index) {
  1772. return format(value, "MM/dd HH:mm");
  1773. }
  1774. }
  1775. , {
  1776. title: '操作',
  1777. align: "center",
  1778. valign: 'middle',
  1779. // sortable: true,
  1780. formatter: function (value, row, index) {
  1781. if (row.clinicStatus == 5) {
  1782. 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>';
  1783. // 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>';
  1784. } else if (row.clinicStatus == 6) {
  1785. 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>';
  1786. } else if (row.clinicStatus == 7) {
  1787. 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>';
  1788. }
  1789. }
  1790. }
  1791. ],
  1792. responseHandler: function (res) {
  1793. if (res == '401' || res == 401) {
  1794. window.location.href = '/thmz/login/view'
  1795. return;
  1796. }
  1797. var ress = eval(res);
  1798. if (ress.code == -1) {
  1799. new PNotify({
  1800. title: '错误提示',
  1801. text: ress.message,
  1802. type: 'error',
  1803. hide: false,
  1804. styling: 'bootstrap3'
  1805. });
  1806. return {
  1807. "total": 0,//总页数
  1808. "rows": {} //数据
  1809. };
  1810. }
  1811. return {
  1812. "total": ress.total,//总页数
  1813. "rows": ress.data //数据
  1814. };
  1815. },
  1816. onLoadSuccess: function (data) {
  1817. patientList = data.rows
  1818. $(".pagination-detail").css("display", "none");
  1819. if (id == "tb_table_clinic") {
  1820. $("#ClinicNum").html(data.total);
  1821. } else {
  1822. $("#inClinicNum").html(data.total);
  1823. }
  1824. }
  1825. });
  1826. }
  1827. /**
  1828. * 得到查询的参数 接诊中
  1829. * @param params
  1830. * @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}}
  1831. */
  1832. function queryParamsInClinic(params) {
  1833. var temp = {
  1834. pageSize: params.limit,
  1835. pageIndex: params.offset / params.limit, //页码
  1836. statusFlagList: [8]
  1837. };
  1838. return temp;
  1839. };
  1840. /**
  1841. * 得到查询的参数
  1842. * @param params
  1843. * @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}}
  1844. */
  1845. function queryParamsClinic(params) {
  1846. var rePortRangeArr = getRePortRangeArr();
  1847. var commonParams = $("#userName").val();
  1848. var needDateParams = commonParams == null || commonParams == "null" || commonParams == "";
  1849. var temp = {
  1850. beginDate: needDateParams ? rePortRangeArr[0] : "2012-02-01 00:00:00" ,
  1851. endDate: needDateParams ? rePortRangeArr[1]: format(new Date(),"yyyy-MM-dd HH:mm:ss"),
  1852. commonParams: commonParams,
  1853. clinicStatuses: [5, 6, 7],
  1854. pageSize: params.limit,
  1855. offset: params.offset
  1856. };
  1857. return temp;
  1858. };
  1859. /**
  1860. * 加载待诊患者列表方法
  1861. */
  1862. function loadUnClinicTableList() {
  1863. loadCanClinicTableList("tb_table_un_clinic", queryParamsUnClinic);
  1864. }
  1865. /**
  1866. * 加载接诊中患者列表方法
  1867. */
  1868. function loadInClinicTableList() {
  1869. loadCanClinicTableList("tb_table_in_clinic", queryParamsInClinic);
  1870. }
  1871. /**
  1872. * 加载待诊和接诊中患者列表通用方法方法
  1873. */
  1874. function loadCanClinicTableList(id, queryParams) {
  1875. $('#' + id).bootstrapTable('refresh');
  1876. $('#' + id).bootstrapTable({
  1877. url: "/thmz/getUnClinicWithPage", //请求后台的URL(*)
  1878. method: 'post', //请求方式(*)
  1879. toolbar: '#toolbar', //工具按钮用哪个容器
  1880. striped: true, //是否显示行间隔色
  1881. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  1882. pagination: true, //是否显示分页(*)
  1883. sortable: true, //是否启用排序
  1884. sortOrder: "asc", //排序方式
  1885. queryParams: queryParams, //传递参数(*)
  1886. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  1887. pageNumber: 1, //初始化加载第一页,默认第一页
  1888. pageSize: 5, //每页的记录行数(*)
  1889. pageList: [2, 5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  1890. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  1891. strictSearch: true,
  1892. showColumns: false, //是否显示所有的列
  1893. showRefresh: false, //是否显示刷新按钮
  1894. minimumCountColumns: 2, //最少允许的列数
  1895. clickToSelect: true, //是否启用点击选中行
  1896. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  1897. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  1898. cardView: false, //是否显示详细视图
  1899. detailView: false,
  1900. //rowStyle:rowStyle,//通过自定义函数设置行样式
  1901. ajaxOptions: {
  1902. headers: {
  1903. 'Accept': 'application/json',
  1904. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  1905. }
  1906. },
  1907. columns: [
  1908. {
  1909. field: 'name',
  1910. title: '姓名/性别/年龄',
  1911. align: "center",
  1912. valign: 'middle',
  1913. // sortable: true
  1914. formatter: function (value, row, index) {
  1915. return value + "/" + row.gender + "/" + row.age;
  1916. }
  1917. }, {
  1918. field: 'visitDate',
  1919. title: '分诊时间',
  1920. align: "center",
  1921. valign: 'middle',
  1922. // sortable: true
  1923. formatter: function (value, row, index) {
  1924. return format(value, "MM/dd HH:mm");
  1925. }
  1926. }
  1927. , {
  1928. title: '操作',
  1929. align: "center",
  1930. valign: 'middle',
  1931. // sortable: true,
  1932. formatter: function (value, row, index) {
  1933. if (row.statusFlag == 0) {
  1934. return '<a title="接诊" onclick="clinicalReception(\'' + row.patientId + '\',\'' + row.serialNo + '\',' + row.reqType + ')" style="cursor: pointer">接诊</a>';
  1935. } else if (row.statusFlag == 8) {
  1936. //TODO 继续接诊需要新方法
  1937. 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>';
  1938. } else if (row.statusFlag == 1 || row.statusFlag == 2 || row.statusFlag == 3) {
  1939. var userIdCode = localStorage.getItem("userIdCode");
  1940. if (userIdCode === row.doctorCode) {
  1941. 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>';
  1942. }
  1943. return '<a title="接诊" onclick="clinicalReception(\'' + row.patientId + '\',\'' + row.serialNo + '\',' + row.reqType + ')" style="cursor: pointer">接诊</a>';
  1944. }
  1945. }
  1946. }
  1947. ],
  1948. responseHandler: function (res) {
  1949. if (res == '401' || res == 401) {
  1950. window.location.href = '/thmz/login/view'
  1951. return;
  1952. }
  1953. var ress = eval(res);
  1954. if (ress.code == -1) {
  1955. new PNotify({
  1956. title: '错误提示',
  1957. text: ress.message,
  1958. type: 'error',
  1959. hide: false,
  1960. styling: 'bootstrap3'
  1961. });
  1962. return {
  1963. "total": 0,//总页数
  1964. "rows": {} //数据
  1965. };
  1966. }
  1967. return {
  1968. "total": ress.total,//总页数
  1969. "rows": ress.data //数据
  1970. };
  1971. },
  1972. onLoadSuccess: function (data) {
  1973. $(".pagination-detail").css("display", "none");
  1974. $("#unClinicNum").html(data.total);
  1975. }
  1976. });
  1977. }
  1978. /**
  1979. * 得到查询的参数
  1980. * @param params
  1981. * @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}}
  1982. */
  1983. function queryParamsUnClinic(params) {
  1984. var temp = {
  1985. pageSize: params.limit,
  1986. pageIndex: params.offset / params.limit, //页码
  1987. statusFlagList: [0, 1, 2, 3]
  1988. };
  1989. return temp;
  1990. };
  1991. /**
  1992. * 通知叫号
  1993. * @param serialNo
  1994. */
  1995. function clinicCallNumber(serialNo) {
  1996. $.ajax({
  1997. type: "GET",
  1998. url: '/thmz/clinicCallNumber?serialNo=' + serialNo,
  1999. contentType: "application/json;charset=UTF-8",
  2000. dataType: "json",
  2001. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2002. success: function (res) {
  2003. if (res == '401' || res == 401) {
  2004. window.location.href = '/thmz/login/view'
  2005. return;
  2006. }
  2007. if (res.code == 0) {
  2008. successMesage(res);
  2009. } else {
  2010. errorMesage(res);
  2011. }
  2012. }
  2013. });
  2014. }
  2015. /**
  2016. * 接诊方法
  2017. * @param patientId 门诊id
  2018. * @param serialNo 分诊流水号
  2019. * @param reqType 号表类别
  2020. */
  2021. function clinicalReception(patientId, serialNo, reqType) {
  2022. var existPatientId = $("#patientId").text();
  2023. if (existPatientId != null && existPatientId != "" && existPatientId != patientId) {
  2024. $("#messageModal").modal();
  2025. $("#messageContent").html("当前有病人正在接诊,是否切换?");
  2026. $("#messageButton").off("click").on("click", function (t) {
  2027. $("#messageModal").modal("hide");
  2028. //当前有人在接诊,提示是否需要切换和保存
  2029. $("#messagePrescriptionModal").modal();
  2030. $("#confirmPrescriptionButton").off("click").on("click", function (t) {
  2031. $("#messagePrescriptionModal").modal("hide");
  2032. //先保存目前接诊信息,再切换就诊人
  2033. var jsonData = getParamsForpPrescription(1);
  2034. $.ajax({
  2035. type: "POST",
  2036. url: '/thmz/savePrescription',
  2037. contentType: "application/json;charset=UTF-8",
  2038. dataType: "json",
  2039. data: JSON.stringify(jsonData),
  2040. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2041. success: function (res) {
  2042. if (res == '401' || res == 401) {
  2043. window.location.href = '/thmz/login/view'
  2044. return;
  2045. }
  2046. if (res.code == 0) {
  2047. clearWorkSpace();
  2048. realClinicalReception(patientId, serialNo, reqType);
  2049. //加载已接诊患者列表
  2050. loadClinicTableList();
  2051. } else {
  2052. errorMesage(res);
  2053. }
  2054. }
  2055. });
  2056. });
  2057. $("#cancelPrescriptionButton").off("click").on("click", function (t) {
  2058. $("#messagePrescriptionModal").modal("hide");
  2059. clearWorkSpace();
  2060. realClinicalReception(patientId, serialNo, reqType);
  2061. });
  2062. });
  2063. $("#cancelButton").off("click");
  2064. } else {
  2065. realClinicalReception(patientId, serialNo, reqType);
  2066. }
  2067. }
  2068. /**
  2069. * 取消接诊
  2070. * @param patientId
  2071. */
  2072. function cancelClinic(patientId, times) {
  2073. $("#messageModal").modal();
  2074. $("#messageContent").html("确认取消当前病人的接诊记录吗?");
  2075. $("#messageButton").off("click").on("click", function (t) {
  2076. $("#messageModal").modal("hide");
  2077. $.ajax({
  2078. type: "GET",
  2079. url: '/thmz/cancelClinic?patientId=' + patientId + "&times=" + times,
  2080. contentType: "application/json;charset=UTF-8",
  2081. dataType: "json",
  2082. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2083. success: function (res) {
  2084. if (res == '401' || res == 401) {
  2085. window.location.href = '/thmz/login/view'
  2086. return;
  2087. }
  2088. if (res.code == 0) {
  2089. if (res.data == null || res.data.length == 0) {
  2090. return;
  2091. }
  2092. successMesage(res);
  2093. if (times > 0) {
  2094. loadUnClinicTableList();
  2095. loadInClinicTableList();
  2096. clearWorkSpace();
  2097. }
  2098. } else if (res.code == -1) {
  2099. errorMesage(res);
  2100. }
  2101. }
  2102. });
  2103. });
  2104. $("#cancelButton").off("click");
  2105. };
  2106. /**
  2107. * 设置当前接诊病人信息
  2108. * @param mzPatientMi
  2109. */
  2110. function setMzPatientInfo(mzPatientMi) {
  2111. postAjaxJsonHttpRequst("/thmz/getSqGhfFlag",{patientId:mzPatientMi.patientId},true,function (res) {
  2112. $("#ghFeeSelect").val(res.data)
  2113. $('#ghFeeSelect').selectpicker('refresh');
  2114. })
  2115. $.ajax({
  2116. type: "GET",
  2117. url: '/thmz/getDeptNoByCurrentPatientId?patientId=' + mzPatientMi.patientId,
  2118. contentType: "application/json;charset=UTF-8",
  2119. dataType: "json",
  2120. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2121. success: function (res) {
  2122. if (res == '401' || res == 401) {
  2123. window.location.href = '/thmz/login/view'
  2124. return;
  2125. }
  2126. if (res.code == 0) {
  2127. //当前患者就诊科室编码
  2128. localStorage.setItem("currentDeptNo", res.data);
  2129. } else if (res.code == -1) {
  2130. errorMesage(res);
  2131. }
  2132. }
  2133. });
  2134. currentPatientInfo = mzPatientMi
  2135. $("#patientName").html(mzPatientMi.name);
  2136. //var age = getAge(mzPatientMi);
  2137. $("#patientAge").html(mzPatientMi.ageString);
  2138. setVisitTypeName(mzPatientMi.patientId);
  2139. $("#visitTimes").val(mzPatientMi.times);
  2140. $("#patientGender").html(mzPatientMi.gender);
  2141. $("#patientId").text(mzPatientMi.patientId);
  2142. $("#crbMainCard").css("display", "inline-block");
  2143. $("#editUser").css("display", "inline-block");
  2144. $("#clearUser").css("display", "inline-block");
  2145. if (mzPatientMi.phoneNo != null && mzPatientMi.phoneNo != '') {
  2146. $("#patientPhone").html(mzPatientMi.phoneNo);
  2147. $("#patientPhoneLabel").show();
  2148. } else {
  2149. $("#patientPhoneLabel").hide();
  2150. }
  2151. $("#patientResponseType").html(mzPatientMi.responseTypeName);
  2152. if (mzPatientMi.times == 1) {
  2153. $("#first").next().click();
  2154. } else {
  2155. $("#not").next().click();
  2156. }
  2157. $("#patientHisData").text(mzPatientMi.name);
  2158. fitPatientHisData();
  2159. // setTmResponseType(mzPatientMi.patientId);
  2160. }
  2161. //设置病人身份
  2162. function setVisitTypeName(patientId) {
  2163. if(stringIsBlank(patientId)){
  2164. return
  2165. }
  2166. postAjaxJsonHttpRequst("/thmz/queryVisitTypeName",{patientId:patientId},true,function (res) {
  2167. if(res.code ==0){
  2168. $("#patientVisitType").text(res.data);
  2169. if(!stringIsBlank(res.data)){
  2170. $("#discountLvCard").css("display", "inline-block");
  2171. }
  2172. }
  2173. $("#crmType").text(res.crmTypeName);
  2174. })
  2175. postAjaxJsonHttpRequst("/thmz/queryWxmallPackagePurchasedItem",{patNo:patientId},true,function (res) {
  2176. if(res.code == 0 && res.data != null && res.data.length > 0){
  2177. $("#mallTcCard").css("display", "inline-block");
  2178. }
  2179. })
  2180. }
  2181. function closeMallTcDetailModal() {
  2182. $("#mallTcDetailModal").modal("hide");
  2183. }
  2184. //保存商城套餐处方
  2185. function saveMallTcOrder() {
  2186. let allSelecteds = $('#mall_tc_detail_table').bootstrapTable('getAllSelections');
  2187. if(allSelecteds == null && allSelecteds.length == 0){
  2188. errorMesageSimaple('请选择需要开具的商城项目!')
  2189. return
  2190. }
  2191. realSavePrescription(false,true);
  2192. }
  2193. //商城套餐
  2194. function openMallTc() {
  2195. $("#mallTcDetailModal").modal();
  2196. initMallTcDetailTable();
  2197. }
  2198. //初始化
  2199. function initMallTcDetailTable() {
  2200. let patNo = $("#patientId").text();
  2201. if(stringIsBlank(patNo)){
  2202. errorMesageSimaple("请先就诊!")
  2203. return
  2204. }
  2205. $('#mall_tc_detail_table').bootstrapTable("destroy");
  2206. $('#mall_tc_detail_table').bootstrapTable({
  2207. url: '/thmz/queryWxmallPackagePurchasedItem', //请求后台的URL(*)
  2208. method: 'post', //请求方式(*)
  2209. toolbar: '#toolbar', //工具按钮用哪个容器
  2210. striped: true, //是否显示行间隔色
  2211. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  2212. pagination: false, //是否显示分页(*)
  2213. sortable: true, //是否启用排序
  2214. sortOrder: "asc", //排序方式
  2215. // sortName: 'orderNo', //排序字段
  2216. queryParams: function () {
  2217. return {
  2218. patNo:patNo
  2219. }
  2220. }, //传递参数(*)
  2221. sidePagination: "client", //分页方式:client客户端分页,server服务端分页(*)
  2222. pageNumber: 1, //初始化加载第一页,默认第一页
  2223. pageSize: 25, //每页的记录行数(*)
  2224. pageList: [25, 50, 75, 100], //可供选择的每页的行数(*)
  2225. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  2226. strictSearch: true,
  2227. showColumns: false, //是否显示所有的列
  2228. showRefresh: false, //是否显示刷新按钮
  2229. minimumCountColumns: 2, //最少允许的列数
  2230. clickToSelect: true, //是否启用点击选中行
  2231. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  2232. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  2233. cardView: false, //是否显示详细视图
  2234. detailView: false,
  2235. //rowStyle:rowStyle,//通过自定义函数设置行样式
  2236. ajaxOptions: {
  2237. headers: {
  2238. 'Accept': 'application/json',
  2239. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  2240. }
  2241. },
  2242. columns: [
  2243. {
  2244. checkbox: true,
  2245. },
  2246. {
  2247. field: 'hisCode',
  2248. title: '项目编码',
  2249. align: "center",
  2250. valign: 'middle'
  2251. }, {
  2252. field: 'hisName',
  2253. title: '项目名称',
  2254. align: "center",
  2255. valign: 'middle',
  2256. }, {
  2257. field: 'quantity',
  2258. title: '购买的数量',
  2259. align: "center",
  2260. valign: 'middle',
  2261. },
  2262. {
  2263. field: 'usableQuantity',
  2264. title: '可使用数量',
  2265. align: "center",
  2266. valign: 'middle',
  2267. },{
  2268. field: 'originPrice',
  2269. title: '原价(元)',
  2270. align: "center",
  2271. valign: 'middle',
  2272. }, {
  2273. field: 'price',
  2274. title: '优惠单价(元)',
  2275. align: "center",
  2276. valign: 'middle',
  2277. },
  2278. {
  2279. field: 'costAmt',
  2280. title: '总价',
  2281. align: "center",
  2282. valign: 'middle'
  2283. }, {
  2284. field: 'type',
  2285. title: '项目类型',
  2286. align: "center",
  2287. valign: 'middle',
  2288. formatter: function (value, row, index) {
  2289. if (value == 'JY') {
  2290. return '检验';
  2291. }else if(value == 'JC'){
  2292. return '检查';
  2293. }
  2294. else if(value == 'ZL'){
  2295. return '诊疗';
  2296. }
  2297. return "";
  2298. }
  2299. }
  2300. , {
  2301. field: 'lastUseTime',
  2302. title: '最后使用时间',
  2303. align: "center",
  2304. valign: 'middle',
  2305. formatter: function (value, row, index) {
  2306. if (value != null && value != "") {
  2307. return format(value, "yyyy-MM-dd HH:mm:ss");
  2308. }
  2309. return "";
  2310. }
  2311. }
  2312. ],
  2313. responseHandler: function (res) {
  2314. if (res == '401' || res == 401) {
  2315. window.location.href = '/thmz/login/view'
  2316. return;
  2317. }
  2318. var ress = eval(res);
  2319. if (ress.code == -1) {
  2320. new PNotify({
  2321. title: '错误提示',
  2322. text: ress.message,
  2323. type: 'error',
  2324. hide: true,
  2325. styling: 'bootstrap3'
  2326. });
  2327. return {
  2328. "total": 0,//总页数
  2329. "rows": {} //数据
  2330. };
  2331. }
  2332. return {
  2333. //"total": ress.pageViewVo.total,//总页数
  2334. "rows": ress.data //数据
  2335. };
  2336. },
  2337. });
  2338. }
  2339. /**
  2340. * 判断是否是特门病人
  2341. * @param patientId
  2342. */
  2343. function setTmResponseType(patientId) {
  2344. postAjaxJsonHttpRequst("/thmz/fetchSpcSlwinfo",{"patientId":patientId,"admdvs":"","readCardResult":""},true,function (res) {
  2345. if (res == '401' || res == 401) {
  2346. window.location.href = '/thmz/login/view'
  2347. return;
  2348. }
  2349. if (res.code == 0) {
  2350. if (res.data != null && res.data.length > 0) {
  2351. $("#patientResponseType").html("特殊门诊");
  2352. $("#fetchSpcSlwinfo").css("display", "inline-block");
  2353. }
  2354. }
  2355. })
  2356. }
  2357. //删除股东卡身份
  2358. // function deleteShareholderCard() {
  2359. // let patientId = $("#patientId").text();
  2360. // if(stringIsBlank(patientId)){
  2361. // errorMesageSimaple("请先选择就诊病人")
  2362. // return
  2363. // }
  2364. // postAjaxJsonHttpRequst("/thmz/deleteShareholderCard",{patientId:patientId},true,function (res) {
  2365. // if(res.code ==0){
  2366. // $("#patientVisitType").text("");
  2367. // successMesageSimaple(res.message)
  2368. // }else {
  2369. // errorMesage(res)
  2370. // }
  2371. // })
  2372. // }
  2373. //慢病建档
  2374. function cmrCreate() {
  2375. $.ajax({
  2376. type: "GET",
  2377. url: '/thmz/getMzjsdHost',
  2378. dataType: "json",
  2379. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2380. success: function (res) {
  2381. if (res == '401' || res == 401) {
  2382. window.location.href = '/thmz/login/view'
  2383. return;
  2384. }
  2385. if (res.code == 0) {
  2386. let patientId = $("#patientId").text();
  2387. if(stringIsBlank(patientId)){
  2388. return errorMesageSimaple('门诊号不能为空,请先接诊')
  2389. }
  2390. getAjaxRequst("/thmz/getByPatientId",{patientId:patientId},true,function (ress) {
  2391. if(ress.code ==0){
  2392. let cmrType ;
  2393. let userIdCode = localStorage.getItem("userIdCode");
  2394. if(stringIsBlank($("#crmType").text())){
  2395. cmrType = '2'
  2396. }else {
  2397. cmrType = '1'
  2398. }
  2399. window.open(`${res.data}/outpatient/chronicDisease/chronicDiseaseRegister?socialNo=${ress.data.socialNo}&type=${cmrType}&userCode=${userIdCode}`, '_blank');
  2400. }
  2401. })
  2402. }
  2403. }
  2404. });
  2405. }
  2406. var curOpspDiseCode =null;
  2407. var curOpspDiseName =null;
  2408. function openFetchSpcSlwinfoModal() {
  2409. $("#fetchSpcSlwinfoModal").modal();
  2410. $("#fetchSpcSlwinfoTable").html(null);
  2411. clearOpspDiseData();
  2412. }
  2413. /**
  2414. * 清除特门数据
  2415. */
  2416. function clearOpspDiseData() {
  2417. curOpspDiseCode =null;
  2418. curOpspDiseName =null;
  2419. visitMtCardResult = null;
  2420. }
  2421. /**
  2422. * 关闭门特窗口
  2423. */
  2424. function closeFetchSpcSlwinfoModal() {
  2425. $("#fetchSpcSlwinfoModal").modal("hide");
  2426. clearOpspDiseData();
  2427. }
  2428. /**
  2429. * 特门详情
  2430. * @param patientId
  2431. */
  2432. function fetchSpcSlwinfo() {
  2433. let patientId = $("#patientId").text();
  2434. let visitAdvmCity = $("#visitAdvmCity").val();
  2435. postAjaxJsonHttpRequst("/thmz/fetchSpcSlwinfo",{"patientId":patientId,"admdvs":visitAdvmCity,"readCardResult":visitMtCardResult},true,function (res) {
  2436. if (res == '401' || res == 401) {
  2437. window.location.href = '/thmz/login/view'
  2438. return;
  2439. }
  2440. if (res.code == 0) {
  2441. if (res.data == null || res.data.length == 0 ){
  2442. errorMesageSimaple("该患者没有特门信息");
  2443. }
  2444. if (res.data != null && res.data.length > 0) {
  2445. for (var i = 0; i < res.data.length; i++) {
  2446. var begndate = res.data[i].begndate;
  2447. if (begndate == null || begndate == "null") {
  2448. begndate = "";
  2449. }
  2450. var enddate = res.data[i].enddate;
  2451. if (enddate == null || enddate == "null") {
  2452. enddate = "";
  2453. }
  2454. var opspDiseName = res.data[i].opspDiseName;
  2455. if (opspDiseName == null || opspDiseName == "null") {
  2456. opspDiseName = "";
  2457. }
  2458. var opspDiseCode = res.data[i].opspDiseCode;
  2459. if (opspDiseCode == null || opspDiseCode == "null") {
  2460. opspDiseCode = "";
  2461. }
  2462. var ideFixmedinsName = res.data[i].ideFixmedinsName;
  2463. if (ideFixmedinsName == null || ideFixmedinsName == "null") {
  2464. ideFixmedinsName = "";
  2465. }
  2466. $("<tr data-target-opspDiseCode='" + opspDiseCode + "' data-target-opspDiseName='" + opspDiseName + "' data-target-ideFixmedinsName='" + ideFixmedinsName + "'><td>" + begndate + "</td><td>" + enddate + "</td><td>" + opspDiseCode + "</td><td>" + opspDiseName + "</td><td>" + ideFixmedinsName + "</td></tr>").appendTo("#fetchSpcSlwinfoTable").bind('click',function () {
  2467. $("#fetchSpcSlwinfoModal").modal("hide");
  2468. curOpspDiseCode = $(this).attr("data-target-opspDiseCode");
  2469. curOpspDiseName = $(this).attr("data-target-opspDiseName");
  2470. //设置特殊门诊值
  2471. $("#mzOrderTypeSelect").val('3')
  2472. $('#mzOrderTypeSelect').selectpicker('refresh');
  2473. });
  2474. }
  2475. } else {
  2476. errorMesage(res);
  2477. }
  2478. } else {
  2479. errorMesage(res);
  2480. }
  2481. })
  2482. }
  2483. function initAdvmPro(proId) {
  2484. getAjaxRequst("/thmz/queryProvinceCodes",{},true,function (res) {
  2485. if(res.code == 0 && res.data !=null && res.data.length > 0){
  2486. let selectHtml = '';
  2487. for (let i=0 ; i <res.data.length; i++ ){
  2488. selectHtml+= `<option value="${res.data[i].code}">${res.data[i].code} ${res.data[i].name}</option>`
  2489. }
  2490. $('#'+proId).html(selectHtml);
  2491. $('#'+proId).selectpicker('refresh');
  2492. $('#'+proId).val(430000);
  2493. $('#'+proId).selectpicker('refresh');
  2494. cityChange('visitAdvmPro','visitAdvmCity',430100)
  2495. }
  2496. })
  2497. }
  2498. function cityChange(proId,cityId,defalultVal) {
  2499. let code = $('#'+proId).val()
  2500. postAjaxJsonHttpRequst("/thmz/queryCityCodes",{code:code},true,function (res) {
  2501. if(res.code == 0 && res.data !=null && res.data.length > 0){
  2502. let selectHtml = '';
  2503. for (let i=0 ; i <res.data.length; i++ ){
  2504. selectHtml+= `<option value="${res.data[i].code}">${res.data[i].code} ${res.data[i].name}</option>`
  2505. }
  2506. $('#'+cityId).html(selectHtml);
  2507. $('#'+cityId).selectpicker('refresh');
  2508. if(!stringIsBlank(defalultVal)){
  2509. $('#'+cityId).val(defalultVal);
  2510. $('#'+cityId).selectpicker('refresh');
  2511. }
  2512. }
  2513. })
  2514. }
  2515. var visitMtCardResult = null;
  2516. function readVisitPatientCard() {
  2517. $.ajax({
  2518. type: "GET",
  2519. // url: 'http://localhost:8321/readcard/entry?param=qrcode_01101',
  2520. url: 'http://localhost:8321/api/entry?param=jiangsu_qrcode_01101',
  2521. contentType: "application/json;charset=UTF-8",
  2522. dataType: "json",
  2523. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2524. success: function (res) {
  2525. if (res == '401' || res == 401) {
  2526. window.location.href = '/thmz/login/view'
  2527. return;
  2528. }
  2529. if (res.code == 200) {
  2530. visitMtCardResult = res.data
  2531. fetchSpcSlwinfo()
  2532. } else {
  2533. errorMesage(res);
  2534. }
  2535. }
  2536. });
  2537. }
  2538. /**
  2539. * 初诊的时候设置患者生命体征
  2540. * @param res
  2541. */
  2542. function setMzSmtz(res) {
  2543. var mzYshTzxx = res.mzYshTzxx;
  2544. if (mzYshTzxx != null) {
  2545. if (mzYshTzxx.valueTz != null) {
  2546. $("#weight").val(mzYshTzxx.valueTz);
  2547. }
  2548. if (mzYshTzxx.valueTw != null) {
  2549. $("#temperature").val(mzYshTzxx.valueTw);
  2550. }
  2551. if (mzYshTzxx.valueMb != null) {
  2552. $("#sphygmus").val(mzYshTzxx.valueMb);
  2553. }
  2554. if (mzYshTzxx.valueHx != null) {
  2555. $("#breathe").val(mzYshTzxx.valueHx);
  2556. }
  2557. if (mzYshTzxx.valueSsy != null) {
  2558. $("#pressure_high").val(mzYshTzxx.valueSsy);
  2559. }
  2560. if (mzYshTzxx.valueSzy != null) {
  2561. $("#pressure_floor").val(mzYshTzxx.valueSzy);
  2562. }
  2563. }
  2564. }
  2565. /**
  2566. * 真实的接诊方法
  2567. * @param patientId
  2568. * @param serialNo 分诊流水号
  2569. * @param reqType 号表类别
  2570. */
  2571. function realClinicalReception(patientId, serialNo, reqType) {
  2572. var turnToConsultationIdInClick = $("#turnToConsultationIdInClick").val();
  2573. if (turnToConsultationIdInClick == null || turnToConsultationIdInClick == "null") {
  2574. turnToConsultationIdInClick = 0;
  2575. }
  2576. var userIdCode = localStorage.getItem("userIdCode");
  2577. var deptNo = localStorage.getItem(userIdCode);
  2578. if (deptNo == null) {
  2579. deptNo = "";
  2580. }
  2581. $.ajax({
  2582. type: "GET",
  2583. url: '/thmz/saveClinic?patientId=' + patientId + "&serialNo=" + serialNo + "&turnToConsultationId=" + turnToConsultationIdInClick + "&deptNo=" + deptNo,
  2584. contentType: "application/json;charset=UTF-8",
  2585. dataType: "json",
  2586. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2587. success: function (res) {
  2588. if (res == '401' || res == 401) {
  2589. window.location.href = '/thmz/login/view'
  2590. return;
  2591. }
  2592. if (res.code == 0) {
  2593. if (res.data != null) {
  2594. setMzReqType(null,null,reqType);
  2595. var mzPatientMi = res.data;
  2596. setMzPatientInfo(mzPatientMi);
  2597. setMzSmtz(res);
  2598. $("#mzfzSerialNoInClick").val(serialNo);
  2599. $("#mzfzReqTypeNoInClick").val(reqType);
  2600. //有分诊流水号 且 不是简易门诊 或 会诊目标科室接诊
  2601. if (serialNo != null && serialNo != "null") {
  2602. if (!(reqType == "16" || reqType == 16 || reqType == -200)) {
  2603. $("#transferTreatment").css("display", "inline-block");
  2604. }
  2605. $("#consultation").css("display", "inline-block");
  2606. }
  2607. //加载候诊患者列表
  2608. loadUnClinicTableList();
  2609. //加载接诊中患者列表
  2610. loadInClinicTableList();
  2611. //查询患者的门诊统筹信息
  2612. queryInsuinfo(patientId);
  2613. }
  2614. } else {
  2615. errorMesage(res);
  2616. }
  2617. }
  2618. });
  2619. }
  2620. /**
  2621. * 查询患者的门诊统筹信息
  2622. * @param patientId
  2623. */
  2624. function queryInsuinfo(patientId) {
  2625. getAjaxRequst("/thmz/queryInsuinfo",{patientId: patientId},true,function (insurRes) {
  2626. if(insurRes.code == 0){
  2627. var ybCode = localStorage.getItem("ybCode");
  2628. if(ybCode !=null && ybCode !="" && ybCode.length > 0){
  2629. $("#zgmztczf").selectpicker('val',1);
  2630. $("#zgmztczf").selectpicker('refresh');
  2631. if($("#mzOrderTypeSelect").val() !='4'){
  2632. $("#mzOrderTypeSelect").selectpicker('val','2');
  2633. $("#mzOrderTypeSelect").selectpicker('refresh');
  2634. }else {
  2635. $("#zgmztczf").selectpicker('val',0);
  2636. $("#zgmztczf").selectpicker('refresh');
  2637. }
  2638. postAjaxJsonHttpRequst("/thmz/queryVisitTypeName",{patientId:patientId},true,function (res) {
  2639. if(res.code ==0){
  2640. if(!stringIsBlank(res.data)){
  2641. warningMesageSimaple("该患者为股东卡用户,选择医保门诊统筹将不能享受股东卡优惠,请告知患者,请悉知!")
  2642. }
  2643. }
  2644. })
  2645. }else {
  2646. $("#zgmztczf").selectpicker('val',0);
  2647. $("#zgmztczf").selectpicker('refresh');
  2648. }
  2649. }else if(insurRes.code == -1){
  2650. errorMesageSimaple(insurRes.message);
  2651. }else if(insurRes.code == -2){
  2652. warningMesageSimaple(insurRes.message);
  2653. }
  2654. })
  2655. }
  2656. /**
  2657. * 读医保电子凭证
  2658. * @param asyncFlag true 异步 false 同步
  2659. * @param params
  2660. */
  2661. function mztczfSiReadCard(asyncFlag, params) {
  2662. mztczfSiReadCardStatus = true;
  2663. $.ajax({
  2664. type: "GET",
  2665. url: params && params.startsWith('jiangsu_qrcode') ? 'http://localhost:8321/api/entry?param=' + params : 'http://localhost:8321/readcard/entry?param=' + params,
  2666. contentType: "application/json;charset=UTF-8",
  2667. dataType: "json",
  2668. async: asyncFlag,
  2669. headers: {
  2670. 'Accept': 'application/json',
  2671. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  2672. },
  2673. success: function (res) {
  2674. mztczfSiReadCardStatus = false;
  2675. if (res == '401' || res == 401) {
  2676. window.location.href = '/thmz/login/view'
  2677. return;
  2678. }
  2679. //console.log(res);
  2680. if (res.code == 200) {
  2681. var data = JSON.parse(res.data);
  2682. $("#readCardResult").val(JSON.stringify(data.data));
  2683. $("#messageContent").html("读卡成功,是否保存处方?");
  2684. } else {
  2685. $("#messageContent").html("读卡失败,是否保存处方(不享受门诊统筹)?");
  2686. errorMesage(res);
  2687. }
  2688. },
  2689. error: function (XMLHttpRequest, textStatus, errorThrown) {
  2690. mztczfSiReadCardStatus = false;
  2691. $("#messageContent").html("读卡异常,是否保存处方(不享受门诊统筹)?");
  2692. }
  2693. });
  2694. }
  2695. /**
  2696. * 实际读医保电子凭证
  2697. * @param asyncFlag true 异步 false 同步
  2698. */
  2699. function realMztczfSiReadCard(asyncFlag) {
  2700. }
  2701. /**
  2702. * 清空工作台
  2703. */
  2704. function clearWorkSpace() {
  2705. clearUser(true);
  2706. clearWorkSpaceExcludeUser(1);
  2707. }
  2708. /**
  2709. * 清空工作台除了用户信息
  2710. * @param source 1 清空工作台 2 调用模板 3 调用历史处方
  2711. */
  2712. function clearWorkSpaceExcludeUser(source) {
  2713. var conciseRecordsFlag = false;
  2714. if (source == 2) {
  2715. conciseRecordsFlag = $("#conciseRecordsYlfw").prop("checked");
  2716. } else if (source == 3) {
  2717. conciseRecordsFlag = $("#conciseRecordsJzxq").prop("checked");
  2718. }
  2719. if (source == 1 || conciseRecordsFlag) {
  2720. $("#symptom").val(null);
  2721. $("#emrHpi").val(null);
  2722. $("#emrPs").val(null);
  2723. $("#personalHistory").val(null);
  2724. $("#familyHistory").val(null);
  2725. $("#fzZl").val(null);
  2726. $("#crbHistory").val(null);
  2727. $("#obstericalHistory").val(null);
  2728. $("#weight").val(null);
  2729. $("#temperature").val(null);
  2730. $("#sphygmus").val(null);
  2731. $("#breathe").val(null);
  2732. $("#pressure_high").val(null);
  2733. $("#pressure_floor").val(null);
  2734. $("#pressure_high_left").val(null);
  2735. $("#pressure_floor_left").val(null);
  2736. $("#tentativeDiagnosis").val(null);
  2737. $("#otherCheck").val(null);
  2738. $("#diagnoseValue").val(null);
  2739. $("#diagnoseTags").html(null);
  2740. $("#tcmDiagnoseValue").val(null);
  2741. $("#tcmDiagnoseTags").html(null);
  2742. $("#healthEducation").val(null);
  2743. $("#zdAllergen").selectpicker('val', null);
  2744. $("#zdAllergen").selectpicker('refresh');
  2745. $("#ypDitList").selectpicker('val', null);
  2746. $("#ypDitList").selectpicker('refresh');
  2747. }
  2748. //清空工作台的时候需要调用
  2749. if (source == 1) {
  2750. clearWesternMedicine(true);
  2751. clearChineseMedicine();
  2752. clearJyJcItem();
  2753. clearZlItem();
  2754. clearZyReq();
  2755. //initNavTabs(0);
  2756. clearNavTabs(0);
  2757. clearNavTabs(1);
  2758. clearNavTabs(2);
  2759. clearNavTabs(3);
  2760. clearNavTabs(4);
  2761. clearNavTabs(5);
  2762. clearNavTabs(6);
  2763. clearApidAcceptsModal();
  2764. clearTurnToConsultationInput();
  2765. clearZgtczfInput();
  2766. clearOpspDiseData();
  2767. clearExpContentRequired();
  2768. gropuIdAndOrderNoMap = null;
  2769. //prevCategoriesFlag = null;
  2770. initGroupOrder();
  2771. localStorage.removeItem("currentDeptNo");
  2772. getResultUrl = null;
  2773. }
  2774. $("#totalAmount").text(0);
  2775. }
  2776. /**
  2777. * 构造西药处方详情和模板预览方法
  2778. * @param pyPrescription
  2779. * @param contentId 内容ID
  2780. * @param titleId 标题ID
  2781. * @param checkBox 是否需要增加ckeckBox
  2782. */
  2783. function fitxyContent(pyPrescription, contentId, titleId, checkBox) {
  2784. if (pyPrescription != null && pyPrescription.length > 0) {
  2785. var xypyHtml = "";
  2786. for (var i = 0; i < pyPrescription.length; i++) {
  2787. var py = pyPrescription[i];
  2788. if (py == null || py.length == 0) {
  2789. continue;
  2790. }
  2791. var detail = py.detail;
  2792. if (detail == null || detail.length == 0) {
  2793. continue;
  2794. }
  2795. for (var j = 0; j < detail.length; j++) {
  2796. var pyDetail = detail[j];
  2797. if (checkBox) {
  2798. xypyHtml += "<div style='cursor: pointer;' data-id='" + pyDetail.orderCode + "'>";
  2799. xypyHtml += "<input type='checkbox'/>";
  2800. xypyHtml += "<span onclick='rowDataClick(this)'>";
  2801. } else {
  2802. xypyHtml += "<div>";
  2803. }
  2804. xypyHtml += "<span style='color: red;'>" + pyDetail.groupOrder + "." + "</span>";
  2805. xypyHtml += pyDetail.name;
  2806. xypyHtml += " ";
  2807. xypyHtml += pyDetail.specification;
  2808. xypyHtml += " X ";
  2809. xypyHtml += pyDetail.quantity;
  2810. xypyHtml += pyDetail.packUnit;
  2811. xypyHtml += " 用法: ";
  2812. xypyHtml += pyDetail.supplyName;
  2813. xypyHtml += " ";
  2814. xypyHtml += pyDetail.drugQuan;
  2815. xypyHtml += pyDetail.unitDesc;
  2816. xypyHtml += " ";
  2817. xypyHtml += pyDetail.frequency;
  2818. xypyHtml += " ";
  2819. xypyHtml += pyDetail.orderDays;
  2820. xypyHtml += "天 ";
  2821. if (pyDetail.tryFlag != undefined && pyDetail.tryFlag != null && pyDetail.tryFlag != "null" && pyDetail.tryFlag != "") {
  2822. xypyHtml += pyDetail.tryFlag;
  2823. } else if (pyDetail.tryResult != undefined && pyDetail.tryResult != null && pyDetail.tryResult != "null" && pyDetail.tryResult != "") {
  2824. xypyHtml += pyDetail.tryResult;
  2825. }
  2826. if (checkBox) {
  2827. xypyHtml += "</span>";
  2828. }
  2829. xypyHtml += "</div>";
  2830. }
  2831. }
  2832. afterFitContent(contentId, xypyHtml, titleId);
  2833. } else {
  2834. $("#" + titleId).removeClass("in").addClass("hide");
  2835. $("#" + contentId).html("");
  2836. }
  2837. }
  2838. /**
  2839. * 构造中药处方详情和模板预览方法
  2840. * @param zyPrescription
  2841. * @param contentId 内容ID
  2842. * @param titleId 标题ID
  2843. * @param checkBox 是否需要增加ckeckBox
  2844. */
  2845. function fitzyContent(zyPrescription, contentId, titleId, checkBox) {
  2846. if (zyPrescription == null || zyPrescription.length == 0) {
  2847. $("#" + titleId).removeClass("in").addClass("hide");
  2848. $("#" + contentId).html("");
  2849. return;
  2850. }
  2851. var zyDetail = zyPrescription[0];
  2852. if (zyDetail == null || zyDetail.length == 0) {
  2853. $("#" + titleId).removeClass("in").addClass("hide");
  2854. $("#" + contentId).html("");
  2855. return;
  2856. }
  2857. var detail = zyDetail.detail;
  2858. if (detail == null || detail.length == 0) {
  2859. $("#" + titleId).removeClass("in").addClass("hide");
  2860. $("#" + contentId).html("");
  2861. return;
  2862. }
  2863. var zypyHtml = "";
  2864. for (var i = 0; i < detail.length; i++) {
  2865. //zypyHtml += '<div class="item form-group" style="margin-bottom: -5px;">';
  2866. var zy = detail[i];
  2867. if (zy == null || zy.length == 0) {
  2868. continue;
  2869. }
  2870. if (checkBox) {
  2871. zypyHtml += "<div class=\"col-md-3 col-sm-3 col-xs-12\" style='cursor: pointer;' data-id='" + zy.orderCode + "'>";
  2872. zypyHtml += "<input type='checkbox'/>";
  2873. zypyHtml += "<span onclick='rowDataClick(this)'>";
  2874. } else {
  2875. zypyHtml += "<div class=\"col-md-3 col-sm-3 col-xs-12\">";
  2876. }
  2877. zypyHtml += zy.name;
  2878. if(zy.spec){
  2879. zypyHtml += "("+zy.spec+")";
  2880. }
  2881. var instructionText = zy.instructionText;
  2882. if (instructionText != null && instructionText != "") {
  2883. zypyHtml += "[";
  2884. zypyHtml += instructionText;
  2885. zypyHtml += "]";
  2886. }
  2887. zypyHtml += zy.quantity;
  2888. if(zyDetail.groupNo =='83'){
  2889. zypyHtml += "袋";
  2890. }else {
  2891. zypyHtml += "g";
  2892. }
  2893. if (checkBox) {
  2894. zypyHtml += "</span>";
  2895. }
  2896. zypyHtml += "</div>";
  2897. // if (i % 4 == 0) {
  2898. // zypyHtml += '</div>';
  2899. // }
  2900. }
  2901. // if(detail.length%4!=0){
  2902. // for(var i=0;i<4-(detail.length%4);i++){
  2903. // zypyHtml += "<div class=\"col-md-3 col-sm-3 col-xs-12\"></div>";
  2904. // }
  2905. // }
  2906. var zyfs = zyDetail.zyfs;
  2907. if (zyfs != null && zyfs != "") {
  2908. zypyHtml += " <div class=\"col-md-12 col-sm-12 col-xs-12\">";
  2909. zypyHtml += ' <div style="text-indent: 2em;">';
  2910. zypyHtml += ' <div>';
  2911. zypyHtml += 'x<span>';
  2912. zypyHtml += zyfs;
  2913. zypyHtml += '</span> 付</div>';
  2914. }
  2915. afterFitContent(contentId, zypyHtml, titleId);
  2916. }
  2917. /**
  2918. * 构造辅助检查、检验处方详情和模板预览方法
  2919. * @param jcjyPrescription
  2920. * @param contentId 内容ID
  2921. * @param titleId 标题ID
  2922. * @param checkBox 是否需要增加ckeckBox
  2923. */
  2924. function fitJcjyContent(jcjyPrescription, contentId, titleId, checkBox) {
  2925. if (jcjyPrescription == null || jcjyPrescription.length == 0) {
  2926. $("#" + titleId).removeClass("in").addClass("hide");
  2927. $("#" + contentId).html("");
  2928. return;
  2929. }
  2930. var jcjyDetail = jcjyPrescription[0];
  2931. if (jcjyDetail == null || jcjyDetail.length == 0) {
  2932. $("#" + titleId).removeClass("in").addClass("hide");
  2933. $("#" + contentId).html("");
  2934. return;
  2935. }
  2936. var detail = jcjyDetail.detail;
  2937. if (detail == null || detail.length == 0) {
  2938. $("#" + titleId).removeClass("in").addClass("hide");
  2939. $("#" + contentId).html("");
  2940. return;
  2941. }
  2942. var jcjyHtml = "";
  2943. for (var i = 0; i < detail.length; i++) {
  2944. var jcjy = detail[i];
  2945. if (jcjy == null || jcjy.length == 0) {
  2946. continue;
  2947. }
  2948. if (checkBox) {
  2949. jcjyHtml += "<div style='cursor: pointer;' data-id='" + jcjy.orderCode + "'>";
  2950. jcjyHtml += "<input type='checkbox'/>";
  2951. jcjyHtml += "<span onclick='rowDataClick(this)'>";
  2952. } else {
  2953. jcjyHtml += "<div>";
  2954. }
  2955. jcjyHtml += jcjy.index + ".";
  2956. jcjyHtml += jcjy.name;
  2957. var drugUnit = jcjy.drugUnit;
  2958. if (drugUnit == undefined || drugUnit == null || drugUnit == "") {
  2959. drugUnit = "";
  2960. }
  2961. var drugQuan = jcjy.drugQuan;
  2962. if (drugQuan != undefined && drugQuan != null && drugQuan != "") {
  2963. jcjyHtml += " 单量:" + drugQuan + drugUnit;
  2964. }
  2965. var orderDays = jcjy.orderDays;
  2966. if (orderDays != undefined && orderDays != null && orderDays != "") {
  2967. jcjyHtml += " 天数:" + orderDays + "天";
  2968. }
  2969. var frequency = jcjy.frequency;
  2970. if (frequency != undefined && frequency != null && frequency != "") {
  2971. jcjyHtml += " 频次:" + frequency;
  2972. }
  2973. var quantity = jcjy.quantity;
  2974. if (quantity != undefined && quantity != null && quantity != "") {
  2975. jcjyHtml += " 总量:" + quantity + drugUnit;
  2976. }
  2977. if (checkBox) {
  2978. jcjyHtml += "</span>";
  2979. }
  2980. jcjyHtml += "</div>";
  2981. }
  2982. afterFitContent(contentId, jcjyHtml, titleId);
  2983. }
  2984. /**
  2985. * 构造入院处方详情和模板预览方法
  2986. * @param jcjyPrescription
  2987. * @param contentId 内容ID
  2988. * @param titleId 标题ID
  2989. * @param checkBox 是否需要增加ckeckBox
  2990. */
  2991. function fitZyReqContent(zyReqPrescription, contentId, titleId, checkBox) {
  2992. if (zyReqPrescription == null || zyReqPrescription.length == 0) {
  2993. $("#" + titleId).removeClass("in").addClass("hide");
  2994. $("#" + contentId).html("");
  2995. return;
  2996. }
  2997. var zyReqHtml = "";
  2998. if (checkBox) {
  2999. zyReqHtml += "<div style='cursor: pointer;'>";
  3000. zyReqHtml += "<input type='checkbox'/>";
  3001. zyReqHtml += "<span onclick='rowDataClick(this)'>";
  3002. } else {
  3003. zyReqHtml += "<div>";
  3004. }
  3005. zyReqHtml += "收住院 [";
  3006. zyReqHtml += zyReqPrescription.reqDept;
  3007. if (zyReqPrescription.smallDept != null && zyReqPrescription.smallDept != "") {
  3008. zyReqHtml += "(" + zyReqPrescription.smallDept + ")";
  3009. }
  3010. zyReqHtml += "]";
  3011. if (zyReqPrescription.admissStatus != null && zyReqPrescription.admissStatus != "") {
  3012. zyReqHtml += zyReqPrescription.admissStatus;
  3013. }
  3014. if (zyReqPrescription.conditionCode != null && zyReqPrescription.conditionCode != "") {
  3015. zyReqHtml += " " + zyReqPrescription.conditionCode;
  3016. }
  3017. if (zyReqPrescription.routeOfAdmission != null && zyReqPrescription.routeOfAdmission != "") {
  3018. zyReqHtml += " " + zyReqPrescription.routeOfAdmission;
  3019. }
  3020. zyReqHtml += " 侯床";
  3021. if (checkBox) {
  3022. zyReqHtml += "</span>";
  3023. }
  3024. zyReqHtml += "</div>";
  3025. afterFitContent(contentId, zyReqHtml, titleId);
  3026. }
  3027. /**
  3028. * 构造门诊外配药处方详情和模板预览方法
  3029. * @param wpMedicinePrescription
  3030. * @param contentId 内容ID
  3031. * @param titleId 标题ID
  3032. * @param checkBox 是否需要增加ckeckBox
  3033. */
  3034. function fitWpMedicineContent(wpMedicinePrescription, contentId, titleId, checkBox) {
  3035. if (wpMedicinePrescription == null || wpMedicinePrescription.length == 0) {
  3036. $("#" + titleId).removeClass("in").addClass("hide");
  3037. $("#" + contentId).html("");
  3038. return;
  3039. }
  3040. var wpMedicineHtml = "";
  3041. for (var i = 0; i < wpMedicinePrescription.length; i++) {
  3042. var wpMedicine = wpMedicinePrescription[i];
  3043. if (wpMedicine == null || wpMedicine.length == 0) {
  3044. continue;
  3045. }
  3046. if (checkBox) {
  3047. wpMedicineHtml += "<div style='cursor: pointer;' data-id='" + wpMedicine.code + "'>";
  3048. wpMedicineHtml += "<input type='checkbox'/>";
  3049. wpMedicineHtml += "<span onclick='rowDataClick(this)'>";
  3050. } else {
  3051. wpMedicineHtml += "<div>";
  3052. }
  3053. wpMedicineHtml += "<span style='color: red;'>" + (i+1) + "." + "</span>";
  3054. wpMedicineHtml += wpMedicine.name;
  3055. wpMedicineHtml += " ";
  3056. wpMedicineHtml += wpMedicine.drugSpec;
  3057. wpMedicineHtml += " X ";
  3058. wpMedicineHtml += wpMedicine.drugCnt;
  3059. wpMedicineHtml += wpMedicine.drugDosunt;
  3060. wpMedicineHtml += " 用法 ";
  3061. wpMedicineHtml += wpMedicine.medcWayDscr;
  3062. wpMedicineHtml += " ";
  3063. wpMedicineHtml += wpMedicine.sinDoscnt;
  3064. wpMedicineHtml += wpMedicine.sinDosunt;
  3065. wpMedicineHtml += " ";
  3066. wpMedicineHtml += wpMedicine.usedFrquName;
  3067. wpMedicineHtml += " ";
  3068. wpMedicineHtml += wpMedicine.medcDays;
  3069. wpMedicineHtml += "天";
  3070. if (checkBox) {
  3071. wpMedicineHtml += "</span>";
  3072. }
  3073. wpMedicineHtml += "</div>";
  3074. }
  3075. afterFitContent(contentId, wpMedicineHtml, titleId);
  3076. }
  3077. /**
  3078. * 构造门诊手术处方详情和模板预览方法
  3079. * @param jcjyPrescription
  3080. * @param contentId 内容ID
  3081. * @param titleId 标题ID
  3082. * @param checkBox 是否需要增加ckeckBox
  3083. */
  3084. function fitOpRecordContent(opRecordPrescription, contentId, titleId, checkBox) {
  3085. if (opRecordPrescription == null || opRecordPrescription.length == 0) {
  3086. $("#" + titleId).removeClass("in").addClass("hide");
  3087. $("#" + contentId).html("");
  3088. return;
  3089. }
  3090. var opHtml = "";
  3091. for (var i = 0; i < opRecordPrescription.length; i++) {
  3092. var opRecord = opRecordPrescription[i];
  3093. if (opRecord == null || opRecord.length == 0) {
  3094. continue;
  3095. }
  3096. if (checkBox) {
  3097. opHtml += "<div style='cursor: pointer;' data-id='" + opRecord.opCode + "'>";
  3098. opHtml += "<input type='checkbox'/>";
  3099. opHtml += "<span onclick='rowDataClick(this)'>";
  3100. } else {
  3101. opHtml += "<div>";
  3102. }
  3103. opHtml += opRecord.opName;
  3104. var urgentClinicFlag = opRecord.urgentClinicFlag;
  3105. if (urgentClinicFlag != undefined && urgentClinicFlag != null && urgentClinicFlag != "") {
  3106. opHtml += " 急诊标志:" + urgentClinicFlag;
  3107. }
  3108. var ssbc = opRecord.ssbc;
  3109. if (ssbc != undefined && ssbc != null && ssbc != "") {
  3110. opHtml += " 班次:" + ssbc;
  3111. }
  3112. var partName = opRecord.partName;
  3113. if (partName != undefined && partName != null && partName != "") {
  3114. opHtml += " 手术部位:" + partName;
  3115. }
  3116. var opScale = opRecord.opScale;
  3117. if (opScale != undefined && opScale != null && opScale != "") {
  3118. opHtml += " 手术等级:" + opScale;
  3119. }
  3120. var hocusCode = opRecord.hocusCode;
  3121. if (hocusCode != undefined && hocusCode != null && hocusCode != "") {
  3122. opHtml += " 麻醉方式:" + hocusCode;
  3123. }
  3124. var doctorZd = opRecord.doctorZd;
  3125. if (doctorZd != undefined && doctorZd != null && doctorZd != "") {
  3126. opHtml += " 主刀医生:" + doctorZd;
  3127. }
  3128. if (checkBox) {
  3129. opHtml += "</span>";
  3130. }
  3131. opHtml += "</div>";
  3132. }
  3133. afterFitContent(contentId, opHtml, titleId);
  3134. }
  3135. /**
  3136. * 处方详情构造方法后续事件,如所有的复选框默认勾选
  3137. * @param contentId
  3138. * @param zyReqHtml
  3139. * @param titleId
  3140. */
  3141. function afterFitContent(contentId, zyReqHtml, titleId) {
  3142. $("#" + contentId).html(zyReqHtml);
  3143. $("#" + titleId).removeClass("hide").addClass("in");
  3144. //是否默认勾选处方回调
  3145. var checkboxFlag = localStorage.getItem("checkboxFlag");
  3146. if (checkboxFlag != null && (checkboxFlag == "0" || checkboxFlag == 0)) {
  3147. $("#" + titleId).find("input[type='checkbox']").prop("checked", true);
  3148. $("#" + contentId).find("input[type='checkbox']").each(function (index, obj) {
  3149. $(obj).prop("checked", true);
  3150. });
  3151. } else {
  3152. $("#" + titleId).find("input[type='checkbox']").prop("checked", false);
  3153. }
  3154. }
  3155. /**
  3156. * 模板、详情页行数据点击事件
  3157. * @param obj
  3158. */
  3159. function rowDataClick(obj) {
  3160. $(obj).prev().click();
  3161. }
  3162. /**
  3163. * 模板、详情页治疗分类标题点击事件
  3164. * @param obj
  3165. * @param source 0 是标题的行点击事件 1 标题的checkbox本身触发
  3166. */
  3167. function titleClick(obj, source) {
  3168. var contentObj = $(obj).parent().next();
  3169. var check = $(obj).prop("checked");
  3170. if (source == 0) {
  3171. var prev = $(obj).prev();
  3172. check = !$(prev).prop("checked");
  3173. $(prev).prop("checked", check)
  3174. }
  3175. if (contentObj != null) {
  3176. $(contentObj).children().each(function (index, object) {
  3177. //以下两个方法,单独调用一个可能不行
  3178. $(object).find("input[type='checkbox']").prop("checked", check) //如果鼠标点击选中了,执行后可以取消选中
  3179. });
  3180. }
  3181. }
  3182. /**
  3183. * 处方明细复选框点击事件
  3184. * @param obj
  3185. * @param source 0 是标题的行点击事件 1 标题的checkbox本身触发
  3186. */
  3187. function prescriptionCfmxChosice(obj, source) {
  3188. var check = $(obj).prop("checked");
  3189. if (source == 0) {
  3190. var prev = $(obj).prev();
  3191. check = !$(prev).prop("checked");
  3192. //以下两个方法,单独调用一个可能不行
  3193. $(prev).prop("checked", check) //如果鼠标点击选中了,执行后可以取消选中
  3194. }
  3195. var conents = $(obj).parent().parent().nextAll();
  3196. if (conents == null || conents.length == 0) {
  3197. return;
  3198. }
  3199. $(conents).each(function (index, object) {
  3200. //以下两个方法,单独调用一个可能不行
  3201. $(object).find("div:eq(0)").find("input[type='checkbox']").prop("checked", check) //如果鼠标点击选中了,执行后可以取消选中
  3202. var contentObj = $(object).find("div:eq(1)");
  3203. if (contentObj != null) {
  3204. $(contentObj).children().each(function (contentIndex, contentObject) {
  3205. $(contentObject).find("input[type='checkbox']").prop("checked", check) //如果鼠标点击选中了,执行后可以取消选中
  3206. });
  3207. }
  3208. });
  3209. }
  3210. /**
  3211. * 简明病历标题点击事件
  3212. * @param obj
  3213. */
  3214. function prescriptionJmblChosice(obj) {
  3215. var prev = $(obj).prev();
  3216. var check = !$(prev).prop("checked");
  3217. $(prev).prop("checked", check); //如果鼠标点击选中了,执行后可以取消选中
  3218. }
  3219. /**
  3220. * 医疗范文详情预览
  3221. * @param id
  3222. */
  3223. function medicalModelModal(id) {
  3224. closeObjectWebui(false);
  3225. //是否默认勾选处方回调
  3226. var checkboxFlag = localStorage.getItem("checkboxFlag");
  3227. if (checkboxFlag != null && (checkboxFlag == "0" || checkboxFlag == 0)) {
  3228. $("#conciseRecordsYlfw").prop("checked", true);
  3229. $("#prescriptionSubsidiaryYlfw").prop("checked", true);
  3230. } else {
  3231. $("#conciseRecordsYlfw").prop("checked", false);
  3232. $("#prescriptionSubsidiaryYlfw").prop("checked", false);
  3233. }
  3234. $.ajax({
  3235. type: "GET",
  3236. url: '/thmz/getTemplateById?id=' + id,
  3237. contentType: "application/json;charset=UTF-8",
  3238. dataType: "json",
  3239. async: false,
  3240. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3241. success: function (res) {
  3242. if (res == '401' || res == 401) {
  3243. window.location.href = '/thmz/login/view'
  3244. return;
  3245. }
  3246. if (res.code == 0) {
  3247. var jsonData = JSON.parse(res.data.templateData);
  3248. $("#vmedicalModelName").text(res.data.name);
  3249. $("#idTemplate").val(res.data.id);
  3250. $("#zsTemplate").html(jsonData.mzBlRecord.emrChiefComplaint);
  3251. $("#xbsTemplate").html(jsonData.mzBlRecord.emrHpi);
  3252. $("#tgjcTemplate").html(jsonData.mzBlRecord.emrPe);
  3253. $("#jkjyTemplate").html(jsonData.mzBlRecord.emrJkjy);
  3254. var icdText = res.data.icdText;
  3255. $("#zdTemplate").html("");
  3256. $("#xypyContent").html("");
  3257. $("#xymjContent").html("");
  3258. $("#xyjeContent").html("");
  3259. $("#yczlContent").html("");
  3260. $("#zyzlContent").html("");
  3261. $("#zlyjContent").html("");
  3262. if (icdText != null) {
  3263. var arr = icdText.split(",");
  3264. var html = "";
  3265. for (var i = 0; i < arr.length; i++) {
  3266. if (i == 0) {
  3267. html += ' <div class="tagZdy tagZdy-back">';
  3268. } else {
  3269. html += ' <div class="tagZdy tagZdy-back-green">';
  3270. }
  3271. html += arr[i];
  3272. html += '</div>';
  3273. }
  3274. $("#zdTemplate").html(html);
  3275. }
  3276. var prescriptionDetail = jsonData.mzBlRecord.prescriptionDetail;
  3277. if (prescriptionDetail != null && prescriptionDetail != "") {
  3278. prescriptionDetail = JSON.parse(prescriptionDetail);
  3279. var xyPrescription = prescriptionDetail.xyPrescription;
  3280. if (xyPrescription != null) {
  3281. fitxyContent(xyPrescription.pyPrescription, "xypyContent", "xypyTitle", true);
  3282. fitxyContent(xyPrescription.mjPrescription, "xymjContent", "xymjTitle", true);
  3283. fitxyContent(xyPrescription.jePrescription, "xyjeContent", "xyjeTitle", true);
  3284. fitxyContent(xyPrescription.ycPrescription, "yczlContent", "yczlTitle", true);
  3285. } else {
  3286. $("#xypyTitle").removeClass("in").addClass("hide");
  3287. $("#xypyContent").html("");
  3288. $("#xymjTitle").removeClass("in").addClass("hide");
  3289. $("#xymjContent").html("");
  3290. $("#xyjeTitle").removeClass("in").addClass("hide");
  3291. $("#xyjeContent").html("");
  3292. $("#yczlTitle").removeClass("in").addClass("hide");
  3293. $("#yczlContent").html("");
  3294. }
  3295. var zyPrescription = prescriptionDetail.zyPrescription;
  3296. if (zyPrescription != null) {
  3297. fitzyContent(zyPrescription, "zyzlContent", "zyzlTitle", true);
  3298. } else {
  3299. $("#zyzlTitle").removeClass("in").addClass("hide");
  3300. $("#zyzlContent").html("");
  3301. }
  3302. var jcjyPrescription = prescriptionDetail.jcjyPrescription;
  3303. if (jcjyPrescription != null) {
  3304. fitJcjyContent(jcjyPrescription, "jcjyContent", "jcjyTitle", true);
  3305. } else {
  3306. $("#jcjyTitle").removeClass("in").addClass("hide");
  3307. $("#jcjyContent").html("");
  3308. }
  3309. var zlPrescription = prescriptionDetail.zlPrescription;
  3310. if (zlPrescription != null) {
  3311. fitJcjyContent(zlPrescription, "zlContent", "zlTitle", true);
  3312. } else {
  3313. $("#zlTitle").removeClass("in").addClass("hide");
  3314. $("#zlContent").html("");
  3315. }
  3316. var zyReqPrescription = prescriptionDetail.zyReqPrescription;
  3317. if (zyReqPrescription != null) {
  3318. fitZyReqContent(zyReqPrescription, "zyReqContent", "zyReqTitle", true);
  3319. } else {
  3320. $("#zyReqTitle").removeClass("in").addClass("hide");
  3321. $("#zyReqContent").html("");
  3322. }
  3323. var opRecordPrescription = prescriptionDetail.opRecordPrescription;
  3324. if (opRecordPrescription != null) {
  3325. fitOpRecordContent(opRecordPrescription, "opRecordContent", "opRecordTitle", true);
  3326. } else {
  3327. $("#opRecordTitle").removeClass("in").addClass("hide");
  3328. $("#opRecordContent").html("");
  3329. }
  3330. } else {
  3331. $("#xypyTitle").removeClass("in").addClass("hide");
  3332. $("#xypyContent").html("");
  3333. $("#xymjTitle").removeClass("in").addClass("hide");
  3334. $("#xymjContent").html("");
  3335. $("#xyjeTitle").removeClass("in").addClass("hide");
  3336. $("#xyjeContent").html("");
  3337. $("#yczlTitle").removeClass("in").addClass("hide");
  3338. $("#yczlContent").html("");
  3339. $("#zyzlTitle").removeClass("in").addClass("hide");
  3340. $("#zyzlContent").html("");
  3341. $("#jcjyTitle").removeClass("in").addClass("hide");
  3342. $("#jcjyContent").html("");
  3343. $("#zlTitle").removeClass("in").addClass("hide");
  3344. $("#zlContent").html("");
  3345. $("#zyReqTitle").removeClass("in").addClass("hide");
  3346. $("#zyReqContent").html("");
  3347. }
  3348. } else {
  3349. errorMesage(res);
  3350. }
  3351. }
  3352. });
  3353. $("#medicalModelModal").modal();
  3354. }
  3355. /**
  3356. * 诊疗项目回写
  3357. * @param code
  3358. * @param mzChargeDetail
  3359. */
  3360. function callBackZlDetail(code, mzChargeDetail) {
  3361. //诊疗项目
  3362. $.ajax({
  3363. type: "GET",
  3364. url: '/thmz/getZdChargeItemByCode?code=' + code,
  3365. contentType: "application/json;charset=UTF-8",
  3366. dataType: "json",
  3367. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3368. async: false,
  3369. success: function (res) {
  3370. if (res == '401' || res == 401) {
  3371. window.location.href = '/thmz/login/view'
  3372. return;
  3373. }
  3374. if (res.code == 0) {
  3375. //如果
  3376. if ($("#zlTab").find("li") == null || $("#zlTab").find("li").length == 0) {
  3377. initNavTabs(3, null, null);
  3378. }
  3379. $("#zlItem").val(res.data.name);
  3380. $("#zlItem").blur();
  3381. $("#descriptions").val(res.data.descriptions);
  3382. $("#zlItemPrice").val(res.data.chargeAmount);
  3383. $("#chargeUnit").val(res.data.chargeUnit);
  3384. $("#zl_current_code").val(res.data.code);
  3385. $("#zlRemark").val(mzChargeDetail.instructionText);
  3386. $("#dayZlNum").selectpicker('val', mzChargeDetail.orderDays);
  3387. $('#dayZlNum').selectpicker('refresh');
  3388. if(!stringIsBlank(mzChargeDetail.hospApprFlag)){
  3389. $("#zlHospApprFlag").selectpicker('val', mzChargeDetail.hospApprFlag);
  3390. $('#zlHospApprFlag').selectpicker('refresh');
  3391. }
  3392. $("#orderFrequencyZl").selectpicker('val', mzChargeDetail.frequency);
  3393. $('#orderFrequencyZl').selectpicker('refresh');
  3394. if (mzChargeDetail.execDept != null && mzChargeDetail.execDept != "") {
  3395. $("#zlExecUnit").selectpicker('val', mzChargeDetail.execDept);
  3396. $('#zlExecUnit').selectpicker('refresh');
  3397. }
  3398. $("#itemQuantity").val(mzChargeDetail.drugQuan);
  3399. $("#totalNumZl").val(mzChargeDetail.quantity);
  3400. saveZlItem(false);
  3401. } else {
  3402. errorMesage(res);
  3403. }
  3404. }
  3405. });
  3406. }
  3407. /**
  3408. * 处方模板回调和历史处方调用自动重置组号
  3409. * @param type
  3410. */
  3411. function resetNewGroupId(type) {
  3412. if (type == 1 || type == 2) {
  3413. var xyTabContents = $("#xyTabContent").find("div.tab-pane");
  3414. //西药设置
  3415. if (xyTabContents != null && xyTabContents.length > 0) {
  3416. groupIdMap = new MyMap();
  3417. gropuIdAndOrderNoMap = new MyMap();
  3418. var newGroupId = 1;
  3419. gropuIdAndOrderNoMap.put(1, 0);
  3420. var prevGroupId = null;
  3421. for (var i = 0; i < xyTabContents.length; i++) {
  3422. var formGroups = $(xyTabContents[i]).find("div.form-group");
  3423. if (formGroups != null && formGroups.length > 0) {
  3424. for (var j = 0; j < formGroups.length; j++) {
  3425. var tempGroupId = $(formGroups[j]).find("input.temporary_items_groupId").val();
  3426. if (prevGroupId != null && tempGroupId != prevGroupId) {
  3427. newGroupId++;
  3428. gropuIdAndOrderNoMap.put(newGroupId, i);
  3429. }
  3430. $(formGroups[j]).find("span.groupId").text(newGroupId);
  3431. $(formGroups[j]).find("input.temporary_items_groupId").val(newGroupId);
  3432. var map = groupIdMap.get(newGroupId + '');
  3433. if (map == null) {
  3434. map = new MyMap();
  3435. map.put("supplyType", $(formGroups[j]).find("input.temporary_items_supplyType").val());
  3436. map.put("orderFrequency", $(formGroups[j]).find("input.temporary_items_orderFrequency").val());
  3437. map.put("dayNum", $(formGroups[j]).find("input.temporary_items_dayNum").val());
  3438. groupIdMap.put(newGroupId + '', map);
  3439. }
  3440. if (prevGroupId == null || tempGroupId != prevGroupId) {
  3441. prevGroupId = tempGroupId;
  3442. }
  3443. }
  3444. }
  3445. }
  3446. resetGroupIdSelect();
  3447. }
  3448. }
  3449. }
  3450. /**
  3451. * 处方回写
  3452. * @param jsonData 处方数据
  3453. * @param type 回写类型 0 全部回写 1 医疗范文 2 就诊详情
  3454. */
  3455. function editPrescription(jsonData, type) {
  3456. orderNoAndTableIdMap = new MyMap();
  3457. tableIdAndOrderNoMap = new MyMap();
  3458. var firstOrNot = jsonData.firstOrNot;
  3459. var conciseRecordsFlag = false;
  3460. if (type == 1) {
  3461. conciseRecordsFlag = $("#conciseRecordsYlfw").prop("checked");
  3462. } else if (type == 2) {
  3463. conciseRecordsFlag = $("#conciseRecordsJzxq").prop("checked");
  3464. }
  3465. if (firstOrNot == 0) {
  3466. $("#first").next().click();
  3467. } else if (firstOrNot == 1) {
  3468. $("#not").next().click();
  3469. }
  3470. if (type == 0 || conciseRecordsFlag) {
  3471. $("#symptom").val(jsonData.mzBlRecord.emrChiefComplaint);
  3472. $("#emrHpi").val(jsonData.mzBlRecord.emrHpi);
  3473. $("#emrPs").val(jsonData.mzBlRecord.emrPs);
  3474. $("#personalHistory").val(jsonData.mzBlRecord.personalHistory);
  3475. $("#familyHistory").val(jsonData.mzBlRecord.familyHistory);
  3476. $("#fzZl").val(jsonData.mzBlRecord.fzZl);
  3477. $("#crbHistory").val(jsonData.mzBlRecord.crbHistory);
  3478. $("#obstericalHistory").val(jsonData.mzBlRecord.obstericalHistory);
  3479. if (jsonData.mzBlRecord.weight != null && jsonData.mzBlRecord.weight != 0) {
  3480. $("#weight").val(jsonData.mzBlRecord.weight);
  3481. } else {
  3482. $("#weight").val("");
  3483. }
  3484. if (jsonData.mzBlRecord.temperature != null && jsonData.mzBlRecord.temperature != 0) {
  3485. $("#temperature").val(jsonData.mzBlRecord.temperature);
  3486. } else {
  3487. $("#temperature").val("");
  3488. }
  3489. if (jsonData.mzBlRecord.sphygmus != null && jsonData.mzBlRecord.sphygmus != 0) {
  3490. $("#sphygmus").val(jsonData.mzBlRecord.sphygmus);
  3491. } else {
  3492. $("#sphygmus").val("");
  3493. }
  3494. if (jsonData.mzBlRecord.breathe != null && jsonData.mzBlRecord.breathe != 0) {
  3495. $("#breathe").val(jsonData.mzBlRecord.breathe);
  3496. } else {
  3497. $("#breathe").val("");
  3498. }
  3499. if (jsonData.mzBlRecord.pressureHigh != null && jsonData.mzBlRecord.pressureHigh != 0) {
  3500. $("#pressure_high").val(jsonData.mzBlRecord.pressureHigh);
  3501. } else {
  3502. $("#pressure_high").val("");
  3503. }
  3504. if (jsonData.mzBlRecord.pressureFloor != null && jsonData.mzBlRecord.pressureFloor != 0) {
  3505. $("#pressure_floor").val(jsonData.mzBlRecord.pressureFloor);
  3506. } else {
  3507. $("#pressure_floor").val("");
  3508. }
  3509. if (jsonData.mzBlRecord.pressureHighLeft != null && jsonData.mzBlRecord.pressureHighLeft != 0) {
  3510. $("#pressure_high_left").val(jsonData.mzBlRecord.pressureHighLeft);
  3511. } else {
  3512. $("#pressure_high_left").val("");
  3513. }
  3514. if (jsonData.mzBlRecord.pressureFloorLeft != null && jsonData.mzBlRecord.pressureFloorLeft != 0) {
  3515. $("#pressure_floor_left").val(jsonData.mzBlRecord.pressureFloorLeft);
  3516. } else {
  3517. $("#pressure_floor_left").val("");
  3518. }
  3519. $("#tentativeDiagnosis").val(jsonData.mzBlRecord.tentativeDiagnosis);
  3520. $("#otherCheck").val(jsonData.mzBlRecord.emrPe);
  3521. var icdCode = jsonData.icdCode;
  3522. if (icdCode != null && icdCode != "" && icdCode.length > 0) {
  3523. $.ajax({
  3524. type: "POST",
  3525. url: '/thmz/getZdIcdByCodes',
  3526. contentType: "application/json;charset=UTF-8",
  3527. dataType: "json",
  3528. async: false,
  3529. data: JSON.stringify({
  3530. "icdCode": icdCode
  3531. }),
  3532. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3533. success: function (res) {
  3534. if (res == '401' || res == 401) {
  3535. window.location.href = '/thmz/login/view'
  3536. return;
  3537. }
  3538. if (res.code == 0) {
  3539. if (res.data != null && res.data.length > 0) {
  3540. for (var i = 0; i < res.data.length; i++) {
  3541. fitDiagnoseValue(res.data[i].name, res.data[i].code);
  3542. }
  3543. }
  3544. } else {
  3545. errorMesage(res);
  3546. }
  3547. }
  3548. });
  3549. }
  3550. $("#healthEducation").val(jsonData.mzBlRecord.emrJkjy);
  3551. if(!stringIsBlank(jsonData.tcmIcdCode)){
  3552. let tcmIcdCodes = jsonData.tcmIcdCode.split(",");
  3553. let tcmIcdTexts = jsonData.tcmIcdText.split(",");
  3554. for (let i = 0; i < tcmIcdCodes.length; i++) {
  3555. fitTcmDiagnoseValue(tcmIcdTexts[i],tcmIcdCodes[i])
  3556. }
  3557. }
  3558. }
  3559. if(jsonData.ghFeeFlag === '1'){
  3560. $("#ghFeeSelect").val('1')
  3561. $('#ghFeeSelect').selectpicker('refresh');
  3562. }
  3563. var patientAllergenInfoList = jsonData.patientAllergenInfoList;
  3564. if (patientAllergenInfoList != null && patientAllergenInfoList.length > 0) {
  3565. var zdAllergen = [];
  3566. var ypDitList = [];
  3567. var zdAllergenHtml = '';
  3568. var ypDitListHtml = '';
  3569. var zdAllergeCodes = null;
  3570. var zdAllergeTexts = null;
  3571. var ypDitListodes = null;
  3572. var ypDitListTexts = null;
  3573. for (var i = 0; i < patientAllergenInfoList.length; i++) {
  3574. var patientAllergenInfo = patientAllergenInfoList[i];
  3575. if (patientAllergenInfo.type == 0 || patientAllergenInfo.type == '0') {
  3576. zdAllergen[zdAllergen.length] = patientAllergenInfo.allergenCode;
  3577. zdAllergenHtml += '<option value="' + patientAllergenInfo.allergenCode + '">' + patientAllergenInfo.allergenName + '</option>';
  3578. if (zdAllergeCodes == null) {
  3579. zdAllergeCodes = patientAllergenInfo.allergenCode;
  3580. zdAllergeTexts = patientAllergenInfo.allergenName;
  3581. } else {
  3582. zdAllergeCodes += "," + patientAllergenInfo.allergenCode;
  3583. zdAllergeTexts += "," + patientAllergenInfo.allergenName;
  3584. }
  3585. } else if (patientAllergenInfo.type == 1 || patientAllergenInfo.type == '1') {
  3586. ypDitList[ypDitList.length] = patientAllergenInfo.allergenCode;
  3587. ypDitListHtml += '<option value="' + patientAllergenInfo.allergenCode + '">' + patientAllergenInfo.allergenName + '</option>';
  3588. if (zdAllergeCodes == null) {
  3589. ypDitListodes = patientAllergenInfo.allergenCode;
  3590. ypDitListTexts = patientAllergenInfo.allergenName;
  3591. } else {
  3592. ypDitListodes += "," + patientAllergenInfo.allergenCode;
  3593. ypDitListTexts += "," + patientAllergenInfo.allergenName;
  3594. }
  3595. }
  3596. }
  3597. $("#zdAllergen").empty();
  3598. $('#zdAllergen').append(zdAllergenHtml);
  3599. $('#zdAllergen').selectpicker('refresh');
  3600. $("#ypDitList").empty();
  3601. $('#ypDitList').append(ypDitListHtml);
  3602. $('#ypDitList').selectpicker('refresh');
  3603. $("#zdAllergen").selectpicker('val', zdAllergen);
  3604. $("#zdAllergen").selectpicker('refresh');
  3605. $("#ypDitList").selectpicker('val', ypDitList);
  3606. $("#ypDitList").selectpicker('refresh');
  3607. $("#zdAllergen").attr("selectedCodes", zdAllergeCodes);
  3608. $("#zdAllergen").attr("selectedTexts", zdAllergeTexts);
  3609. $("#ypDitList").attr("selectedCodes", ypDitListodes);
  3610. $("#ypDitList").attr("selectedTexts", ypDitListTexts);
  3611. }
  3612. //西药选中的数据组
  3613. var xyArrays = [];
  3614. //中药选中的数据组
  3615. var zyArrays = [];
  3616. //辅助检查、检验选中的数据组
  3617. var jcjyArrays = [];
  3618. //诊疗选中的数据组
  3619. var zlArrays = [];
  3620. //住院选中的数据组
  3621. var zyReqArrays = [];
  3622. //门诊手术选中的数据组
  3623. var opRecordArrays = [];
  3624. //外配药选中的数据组
  3625. var wpMedicinedArrays = [];
  3626. //组号与同组药数量的map
  3627. var groupOrderAndLengthMap = new MyMap();
  3628. //处方号与同处方号药数量的map
  3629. var orderNoAndLengthMap = new MyMap();
  3630. //住院回写
  3631. var zyReqCallBack = false;
  3632. if (type == 1) {
  3633. setCallBackArrays("xypyContent", xyArrays, groupOrderAndLengthMap, orderNoAndLengthMap);
  3634. setCallBackArrays("xymjContent", xyArrays, groupOrderAndLengthMap, orderNoAndLengthMap);
  3635. setCallBackArrays("xyjeContent", xyArrays, groupOrderAndLengthMap, orderNoAndLengthMap);
  3636. setCallBackArrays("yczlContent", xyArrays, groupOrderAndLengthMap, orderNoAndLengthMap);
  3637. setCallBackArrays("zyzlContent", zyArrays, null, null);
  3638. setCallBackArrays("jcjyContent", jcjyArrays, null, null);
  3639. setCallBackArrays("zlContent", zlArrays, null, null);
  3640. zyReqCallBack = $("#zyReqContent").find("input").prop("checked");
  3641. setCallBackArrays("opRecordContent", opRecordArrays, null, null);
  3642. setCallBackArrays("wpMedicineContent", wpMedicinedArrays, null, null);
  3643. } else if (type == 2) {
  3644. setCallBackArrays("prescriptionDetail_xypyContent", xyArrays, groupOrderAndLengthMap, orderNoAndLengthMap);
  3645. setCallBackArrays("prescriptionDetail_xymjContent", xyArrays, groupOrderAndLengthMap, orderNoAndLengthMap);
  3646. setCallBackArrays("prescriptionDetail_xyjeContent", xyArrays, groupOrderAndLengthMap, orderNoAndLengthMap);
  3647. setCallBackArrays("prescriptionDetail_yczlContent", xyArrays, groupOrderAndLengthMap, orderNoAndLengthMap);
  3648. setCallBackArrays("prescriptionDetail_zyzlContent", zyArrays, null, null);
  3649. setCallBackArrays("prescriptionDetail_jcjyContent", jcjyArrays, null, null);
  3650. setCallBackArrays("prescriptionDetail_zlContent", zlArrays, null, null);
  3651. zyReqCallBack = $("#prescriptionDetail_zyReqContent").find("input").prop("checked");
  3652. setCallBackArrays("prescriptionDetail_opRecordContent", opRecordArrays, null, null);
  3653. setCallBackArrays("prescriptionDetail_wpMedicineContent", wpMedicinedArrays, null, null);
  3654. } else if (type == 0) {
  3655. zyReqCallBack = true;
  3656. }
  3657. var mzChargeDetailList = jsonData.mzChargeDetailList;
  3658. var mzZyReq = jsonData.mzZyReq;
  3659. //中药的公共参数是否已经设置了
  3660. var hadSetZyFullParams = false;
  3661. //西药,成药,医材,麻精,中药,诊疗
  3662. if (mzChargeDetailList != null && mzChargeDetailList.length > 0) {
  3663. //当前实际回写的组号
  3664. var currentOrderNo = null;
  3665. //处方号与药品类型关系
  3666. var orderAndGroupNoMap = new MyMap();
  3667. // mzChargeDetailList.sort(function (a, b) {
  3668. // return a.groupNo - b.groupNo
  3669. // });
  3670. for (var i = 0; i < mzChargeDetailList.length; i++) {
  3671. var mzChargeDetail = mzChargeDetailList[i];
  3672. var groupNo = mzChargeDetail.groupNo;
  3673. var code = mzChargeDetail.chargeItemCode;
  3674. var serial = mzChargeDetail.serial;
  3675. if (groupNo == "00") {
  3676. if (type != 0 && !isInArray(code, zlArrays)) {
  3677. continue;
  3678. }
  3679. callBackZlDetail(code, mzChargeDetail);
  3680. } else if (groupNo == "71" || groupNo == "91" || groupNo == "111" || groupNo == "131") {
  3681. // 71 西成药 91 医材 111 精一 131 精二
  3682. var groupOrder = mzChargeDetail.groupOrder;
  3683. if (groupOrder == null || groupOrder == 'null' || groupOrder == "") {
  3684. groupOrder = 1;
  3685. }
  3686. var orderNo = mzChargeDetail.orderNo;
  3687. orderAndGroupNoMap.put(orderNo, groupNo);
  3688. if (type != 0 && !isInArray(code + "_" + serial + "_" + groupOrder + "_" + orderNo, xyArrays)) {
  3689. continue;
  3690. }
  3691. var lastGroupOrder = parseInt($("#groupId > option:last").val());
  3692. while (lastGroupOrder < groupOrder) {
  3693. appendGroupOrder();
  3694. lastGroupOrder = parseInt($("#groupId > option:last").val());
  3695. }
  3696. //appendGroupOrder()
  3697. $("#groupId").selectpicker('val', groupOrder);
  3698. $('#groupId').selectpicker('refresh');
  3699. if (type == 1 || type == 2) {
  3700. //模板和历史轨迹回调的时候,如果前一个处方不满5个,就将后面的处方的药品添加到上一个处方中,但如果同一组药不能全部添加到上一个处方,就不会追加到该处方中
  3701. var orderNoLength = orderNoAndLengthMap.get(orderNo);
  3702. if (currentOrderNo == null) {
  3703. currentOrderNo = orderNo;
  3704. } else if (orderAndGroupNoMap.get(currentOrderNo) != orderAndGroupNoMap.get(orderNo)) {
  3705. var currentGroupNos = $("#xyTabContent").find("input.current_groupNo");
  3706. //查询还没有满5个的处方页
  3707. var tempOrderNo = null;
  3708. for (var k = 0; k < currentGroupNos.length; k++) {
  3709. if ($(currentGroupNos[k]).val() == groupNo) {
  3710. var next = $(currentGroupNos[k]).next();
  3711. if ($(next).children().length < 4) {
  3712. var parentId = $(currentGroupNos[k]).parent().attr("id");
  3713. tempOrderNo = tableIdAndOrderNoMap.get(parentId);
  3714. }
  3715. }
  3716. }
  3717. currentOrderNo = tempOrderNo;
  3718. } else if (currentOrderNo != orderNo && orderNoLength < 5) {
  3719. var currentOrderNoLength = orderNoAndLengthMap.get(currentOrderNo);
  3720. var groupOrderLength = groupOrderAndLengthMap.get(groupOrder);
  3721. if (groupOrderLength + currentOrderNoLength <= 5) {
  3722. currentOrderNoLength = currentOrderNoLength + 1;
  3723. orderNoLength = orderNoLength - 1;
  3724. groupOrderLength = groupOrderLength - 1;
  3725. orderNoAndLengthMap.put(currentOrderNo, currentOrderNoLength);
  3726. orderNoAndLengthMap.put(orderNo, orderNoLength);
  3727. groupOrderAndLengthMap.put(groupOrder, groupOrderLength);
  3728. orderNo = currentOrderNo;
  3729. if (currentOrderNoLength == 5) {
  3730. var currentGroupNos = $("#xyTabContent").find("input.current_groupNo");
  3731. //查询还没有满5个的处方页,
  3732. var tempOrderNo = null;
  3733. for (var k = 0; k < currentGroupNos.length; k++) {
  3734. if ($(currentGroupNos[k]).val() == groupNo) {
  3735. var next = $(currentGroupNos[k]).next();
  3736. //这里判断是4,是因为已经把组号设置了,所以要减去1
  3737. if ($(next).children().length < 4) {
  3738. var parentId = $(currentGroupNos[k]).parent().attr("id");
  3739. tempOrderNo = tableIdAndOrderNoMap.get(parentId);
  3740. }
  3741. }
  3742. }
  3743. currentOrderNo = tempOrderNo;
  3744. }
  3745. } else {
  3746. currentOrderNo = orderNo;
  3747. }
  3748. }
  3749. }
  3750. checkYpInfo(code, serial, groupNo, false, orderNo, type);
  3751. // 给药方式 同组药品给药方式相同
  3752. $("#supplyType").selectpicker('val', mzChargeDetail.supplyCode);
  3753. $('#supplyType').selectpicker('refresh');
  3754. $("#drugWin").val(mzChargeDetail.drugQuan);
  3755. $("#drugWinUnit").selectpicker('val', mzChargeDetail.drugUnit);
  3756. $('#drugWinUnit').selectpicker('refresh');
  3757. //天数 同组药品天数相同
  3758. $("#dayNum").selectpicker('val', mzChargeDetail.orderDays);
  3759. $('#dayNum').selectpicker('refresh');
  3760. //频次编码 同组药品频次编码相同
  3761. $("#orderFrequency").selectpicker('val', mzChargeDetail.frequency);
  3762. $('#orderFrequency').selectpicker('refresh');
  3763. if (mzChargeDetail.tryFlag == 1 || mzChargeDetail.tryFlag == "1") {
  3764. $("#tryResult").selectpicker('val', 100);
  3765. $('#tryResult').selectpicker('refresh');
  3766. } else if (mzChargeDetail.tryResult != null && mzChargeDetail.tryResult != "null" && mzChargeDetail.tryResult != "") {
  3767. $("#tryResult").selectpicker('val', mzChargeDetail.tryResult);
  3768. $('#tryResult').selectpicker('refresh');
  3769. }
  3770. $("#gross").val(mzChargeDetail.quantity);
  3771. $("#totalRetprice").val(Multiply(mzChargeDetail.quantity, $("#packRetprice").val()));
  3772. $("#medicalAdvice").selectpicker('val', mzChargeDetail.instructionCode);
  3773. $('#medicalAdvice').selectpicker('refresh');
  3774. if(!stringIsBlank(mzChargeDetail.hospApprFlag)){
  3775. $("#xyHospApprFlag").selectpicker('val', mzChargeDetail.hospApprFlag);
  3776. $('#xyHospApprFlag').selectpicker('refresh');
  3777. }
  3778. saveWesternMedicineWithCheck(false, orderNo);
  3779. $("#western_medicine_button").click();
  3780. $("#xyTab").find("li:eq(0) a").off("click").click();
  3781. } else {
  3782. if (type != 0 && !isInArray(code + "_" + serial, zyArrays)) {
  3783. continue;
  3784. }
  3785. //中药与颗粒剂
  3786. checkZyInfo(code, serial, groupNo, false);
  3787. //类型
  3788. $("#zyClassType").selectpicker('val', groupNo);
  3789. $('#zyClassType').selectpicker('refresh');
  3790. $("#zy_drugWin").val(mzChargeDetail.quantity);
  3791. $("#zyInstruction").selectpicker('val', mzChargeDetail.instructionCode);
  3792. $('#zyInstruction').selectpicker('refresh');
  3793. if(!stringIsBlank(mzChargeDetail.hospApprFlag)){
  3794. $("#zyHospApprFlag").selectpicker('val', mzChargeDetail.hospApprFlag);
  3795. $('#zyHospApprFlag').selectpicker('refresh');
  3796. }
  3797. saveChineseMedicine(false);
  3798. if (!hadSetZyFullParams) {
  3799. hadSetZyFullParams = true;
  3800. $("input.zyfs").val(mzChargeDetail.drugWin);
  3801. // $("#zy_orderFrequency_1").selectpicker('val', mzChargeDetail.frequency);
  3802. // $('#zy_orderFrequency_1').selectpicker('refresh');
  3803. $("#useType_1").selectpicker('val', mzChargeDetail.cyFysm);
  3804. $('#useType_1').selectpicker('refresh');
  3805. $("#cyJssm").selectpicker('val', mzChargeDetail.cyJssm);
  3806. $('#cyJssm').selectpicker('refresh');
  3807. $("#cyJsl").val(mzChargeDetail.cyJsl);
  3808. $("#cyZql").val(mzChargeDetail.cyZql);
  3809. $("#cyFj").val(mzChargeDetail.cyFj);
  3810. $("#cyFfcs").val(mzChargeDetail.cyFfcs);
  3811. $("#cyMtjs").val(mzChargeDetail.cyMtjs);
  3812. $("#zy_supplyType_1").selectpicker('val', mzChargeDetail.cyDj);
  3813. $('#zy_supplyType_1').selectpicker('refresh');
  3814. }
  3815. $("#chinese_medicine_button").click();
  3816. }
  3817. }
  3818. }
  3819. //检验与检查
  3820. var mzYjReqList = jsonData.mzYjReqList;
  3821. if (mzYjReqList != null && mzYjReqList.length > 0) {
  3822. for (var i = 0; i < mzYjReqList.length; i++) {
  3823. var mzYjReq = mzYjReqList[i];
  3824. var code = mzYjReq.orderCode;
  3825. if (type != 0 && !isInArray(code, jcjyArrays)) {
  3826. continue;
  3827. }
  3828. var jcJyZltype = null;
  3829. if (mzYjReq.reqType == 2) {
  3830. jcJyZltype = 1;
  3831. $("#jyZdSample").selectpicker('val', mzYjReq.inspectStuff);
  3832. $('#jyZdSample').selectpicker('refresh');
  3833. } else if (mzYjReq.reqType == 3) {
  3834. jcJyZltype = 2;
  3835. $("#yshPart").selectpicker('val', mzYjReq.inspectPart);
  3836. $('#yshPart').selectpicker('refresh');
  3837. }
  3838. $("#jcJyZltype").val(jcJyZltype);
  3839. checkJcJyItemInfo(code, null, jcJyZltype, false);
  3840. $("#remark").val(mzYjReq.jyRemark);
  3841. if (mzYjReq.execDept != null && mzYjReq.execDept != "") {
  3842. $("#execUnit").selectpicker('val', mzYjReq.execDept);
  3843. $('#execUnit').selectpicker('refresh');
  3844. }
  3845. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  3846. saveJyJcItem(false);
  3847. $("#jcJyItemChargeDetail").removeClass("in").addClass("hide");
  3848. }
  3849. $("#yj_req_button").click();
  3850. }
  3851. //入院证
  3852. if (zyReqCallBack && mzZyReq != null && mzZyReq.reqDept != null && mzZyReq.reqDept != "") {
  3853. $("#inpatientWardBeHospitalized").selectpicker('val', mzZyReq.reqDept);
  3854. $('#inpatientWardBeHospitalized').selectpicker('refresh');
  3855. initSmallDeptByDept();
  3856. $("#admissStatus").selectpicker('val', mzZyReq.admissStatus);
  3857. $('#admissStatus').selectpicker('refresh');
  3858. $("#conditionCode").selectpicker('val', mzZyReq.conditionCode);
  3859. $('#conditionCode').selectpicker('refresh');
  3860. $("#routeOfAdmission").selectpicker('val', mzZyReq.routeOfAdmission);
  3861. $('#routeOfAdmission').selectpicker('refresh');
  3862. $("#contacterName").val(mzZyReq.contacterName);
  3863. $("#contacterRelationship").selectpicker('val', mzZyReq.contacterRelationship);
  3864. $('#contacterRelationship').selectpicker('refresh');
  3865. $("#contacterPhone").val(mzZyReq.contacterPhone);
  3866. $("#contacterAddress").val(mzZyReq.contacterAddress);
  3867. $("#deposit").val(mzZyReq.deposit);
  3868. setTimeout(function () {
  3869. $("#smallWardBeHospitalized").selectpicker('val', mzZyReq.smallDept);
  3870. $('#smallWardBeHospitalized').selectpicker('refresh');
  3871. saveZyReq(false);
  3872. }, 500);
  3873. $("#zy_req_button").click();
  3874. }
  3875. //门诊手术
  3876. var opRecordList = jsonData.opRecordList;
  3877. if (opRecordList != null && opRecordList.length > 0) {
  3878. for (var i = 0; i < opRecordList.length; i++) {
  3879. var opRecord = opRecordList[i];
  3880. var opCode = opRecord.opCode;
  3881. if (type != 0 && !isInArray(opCode, opRecordArrays)) {
  3882. continue;
  3883. }
  3884. var opNameHtml = '<option value="' + opRecord.opCode + '">' + opRecord.opName + '</option>';
  3885. $('#opName').html(opNameHtml);
  3886. $('#opName').selectpicker('refresh');
  3887. $('#opName').selectpicker('val', opRecord.opCode);
  3888. $('#opName').selectpicker('refresh');
  3889. $("#opTime").val(opRecord.opDatetimeStr);
  3890. $('#urgentClinicFlag').selectpicker('val', opRecord.urgentClinicFlag);
  3891. $('#urgentClinicFlag').selectpicker('refresh');
  3892. $('#ssbc').selectpicker('val', opRecord.ssbc);
  3893. $('#ssbc').selectpicker('refresh');
  3894. $('#partCode').selectpicker('val', opRecord.partCode);
  3895. $('#partCode').selectpicker('refresh');
  3896. $('#opScale').selectpicker('val', opRecord.opScale);
  3897. $('#opScale').selectpicker('refresh');
  3898. $('#hocusCode').selectpicker('val', opRecord.hocusCode);
  3899. $('#hocusCode').selectpicker('refresh');
  3900. $('#doctorZd').selectpicker('val', opRecord.doctorZd);
  3901. $('#doctorZd').selectpicker('refresh');
  3902. $("#opRecordRemark").val(opRecord.remark);
  3903. saveOpRecord(false);
  3904. }
  3905. $("#op_record_button").click();
  3906. }
  3907. //外配药
  3908. let rxDruginfoList = jsonData.rxDruginfoList;
  3909. if(rxDruginfoList != null && rxDruginfoList.length > 0){
  3910. for (let i = 0; i < rxDruginfoList.length; i++) {
  3911. let rxDruginfo = rxDruginfoList[i];
  3912. let medListCodg = rxDruginfo.medListCodg;
  3913. if (type != 0 && !isInArray(medListCodg, wpMedicinedArrays)) {
  3914. continue;
  3915. }
  3916. $("#wp_medicine_name").val(rxDruginfo.drugGenname)
  3917. $("#wp_medicine_current_code").val(rxDruginfo.medListCodg)
  3918. setSelectDefaultVal('rxItemTypeCode',rxDruginfo.rxItemTypeCode)
  3919. setSelectDefaultVal('medcWayCodg',rxDruginfo.medcWayCodg)
  3920. $("#medcDays").val(rxDruginfo.medcDays)
  3921. $("#sinDosunt").val(rxDruginfo.sinDosunt)
  3922. $("#sinDoscnt").val(rxDruginfo.sinDoscnt)
  3923. $("#drugDosform").val(rxDruginfo.drugDosform)
  3924. setSelectDefaultVal('usedFrquCodg',rxDruginfo.usedFrquCodg)
  3925. $("#drugDosunt").val(rxDruginfo.drugDosunt)
  3926. $("#drugCnt").val(rxDruginfo.drugCnt)
  3927. $("#drugSpec").val(rxDruginfo.drugSpec)
  3928. $("#wpHospApprFlag").val(rxDruginfo.hospApprFlag)
  3929. saveWpOrder(false)
  3930. }
  3931. $("#wp_order_button").click();
  3932. }
  3933. setTimeout(function () {
  3934. //设置总金额 计算金额的时候,可能处方还没有回写完
  3935. calculateTotalAmount(false);
  3936. }, 1000);
  3937. //清空映射map
  3938. orderNoAndTableIdMap = null;
  3939. tableIdAndOrderNoMap = null;
  3940. resetNewGroupId(type);
  3941. }
  3942. /**
  3943. * 根据勾选内容设置选中集合
  3944. * @param id 区域id
  3945. * @param arrays 集合
  3946. * @param groupOrderAndLengthMap 组号与同组药数量的map
  3947. * @param orderNoAndLengthMap 处方号与同处方号药数量的map
  3948. */
  3949. function setCallBackArrays(id, arrays, groupOrderAndLengthMap, orderNoAndLengthMap) {
  3950. var contents = $("#" + id).children();
  3951. if (contents == null || contents.length == 0) {
  3952. return;
  3953. }
  3954. $(contents).each(function (index, obj) {
  3955. var checked = $(obj).find("input").prop("checked");
  3956. var data_id = $(obj).attr("data-id");
  3957. if (checked && data_id != undefined && data_id != null && data_id != "null" && data_id != "") {
  3958. arrays[arrays.length] = data_id;
  3959. var dataArr = null;
  3960. //设置组号与同组药品数量关系
  3961. if (groupOrderAndLengthMap != null) {
  3962. dataArr = data_id.split("_");
  3963. if (dataArr != null && dataArr.length >= 3) {
  3964. var groupOrder = Number(dataArr[2]);
  3965. var length = groupOrderAndLengthMap.get(groupOrder);
  3966. if (length == null || length == "") {
  3967. length = 0;
  3968. }
  3969. length++;
  3970. groupOrderAndLengthMap.put(groupOrder, length);
  3971. }
  3972. }
  3973. //设置处方号与同处方号药品数量关系
  3974. if (orderNoAndLengthMap != null) {
  3975. if (dataArr == null) {
  3976. dataArr = data_id.split("_");
  3977. }
  3978. if (dataArr != null && dataArr.length >= 4) {
  3979. var orderNo = Number(dataArr[3]);
  3980. var length = orderNoAndLengthMap.get(orderNo);
  3981. if (length == null || length == "") {
  3982. length = 0;
  3983. }
  3984. length++;
  3985. orderNoAndLengthMap.put(orderNo, length);
  3986. }
  3987. }
  3988. }
  3989. });
  3990. }
  3991. /**
  3992. * 调用医疗范文
  3993. */
  3994. function callTemplate() {
  3995. clearWorkSpaceExcludeUser(2);
  3996. $.ajax({
  3997. type: "GET",
  3998. url: '/thmz/increaseNumber?id=' + $("#idTemplate").val(),
  3999. contentType: "application/json;charset=UTF-8",
  4000. dataType: "json",
  4001. async: false,
  4002. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4003. success: function (res) {
  4004. if (res == '401' || res == 401) {
  4005. window.location.href = '/thmz/login/view'
  4006. return;
  4007. }
  4008. if (res.code == 0) {
  4009. var jsonData = JSON.parse(res.data.templateData);
  4010. editPrescription(jsonData, 1);
  4011. $("#templateId").val(res.data.id);
  4012. $("#templateName").val(res.data.name);
  4013. $("#templateKindType").selectpicker('val', res.data.templateKindType);
  4014. $("#templateKindType").selectpicker('refresh');
  4015. $("#templateType").selectpicker('val', res.data.templateType);
  4016. $("#templateType").selectpicker('refresh');
  4017. $('#operationType').selectpicker('val', 1);
  4018. $('#operationType').selectpicker('refresh');
  4019. $("#operationTypeDiv").removeClass("hide").addClass("in");
  4020. $("#medicalModelModal").modal("hide");
  4021. closePopover();
  4022. } else {
  4023. errorMesage(res);
  4024. }
  4025. }
  4026. });
  4027. }
  4028. /**
  4029. * 底层填充推荐方法
  4030. * @param paramsType
  4031. * @param appeal
  4032. * @param inputId
  4033. */
  4034. function extracted(paramsType, appeal, inputId) {
  4035. if (paramsType == 13) {
  4036. var contentArr = appeal.split(",");
  4037. if (contentArr != null && contentArr.length > 0) {
  4038. for (var i = 0; i < contentArr.length; i++) {
  4039. var content = contentArr[i].replace(")", "").replace("(", "-");
  4040. var diagnoseArr = content.split("-");
  4041. if (diagnoseArr == null || diagnoseArr.length == 0) {
  4042. continue;
  4043. }
  4044. fitDiagnoseValue(diagnoseArr[0], diagnoseArr[1]);
  4045. }
  4046. }
  4047. } else {
  4048. $("#" + inputId).val(appeal);
  4049. }
  4050. }
  4051. /**
  4052. * 填充推荐
  4053. * @param appeal
  4054. * @param paramsType
  4055. * @param id
  4056. */
  4057. function fitAppeal(appeal, paramsType, id) {
  4058. var inputId = "symptom";
  4059. var text = "主诉项已经录入,是否覆盖?";
  4060. if (paramsType == 5) {
  4061. inputId = "emrHpi";
  4062. text = "现病史项已经录入,是否覆盖?";
  4063. } else if (paramsType == 6) {
  4064. inputId = "emrPs";
  4065. text = "既往史项已经录入,是否覆盖?";
  4066. } else if (paramsType == 13) {
  4067. inputId = "diagnoseValue";
  4068. text = "诊断项已经录入,是否覆盖?";
  4069. }
  4070. var symptom = $("#" + inputId).val();
  4071. if (paramsType == 13 && (symptom == ",," || symptom == ",")) {
  4072. symptom = null;
  4073. }
  4074. if (symptom != null && symptom != "") {
  4075. $("#messageModal").modal();
  4076. $("#messageContent").html(text);
  4077. $("#messageButton").off("click").on("click", function (t) {
  4078. $("#messageModal").modal("hide");
  4079. if (paramsType == 13) {
  4080. $("#" + inputId).val(null);
  4081. $("#diagnoseTags").html(null);
  4082. }
  4083. extracted(paramsType, appeal, inputId);
  4084. });
  4085. $("#cancelButton").off("click");
  4086. } else {
  4087. extracted(paramsType, appeal, inputId);
  4088. }
  4089. $.ajax({
  4090. type: "GET",
  4091. url: '/thmz/increaseTcCommonParamsNumber?id=' + id,
  4092. contentType: "application/json;charset=UTF-8",
  4093. dataType: "json",
  4094. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4095. success: function (res) {
  4096. }
  4097. });
  4098. }
  4099. /**
  4100. * 初始嘱托下拉选
  4101. */
  4102. function initInstructionSelect() {
  4103. //西药医嘱
  4104. $.ajax({
  4105. type: "GET",
  4106. url: '/thmz/getMzZdInstructionByType?instructionType=0',
  4107. contentType: "application/json;charset=UTF-8",
  4108. dataType: "json",
  4109. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4110. success: function (res) {
  4111. if (res == '401' || res == 401) {
  4112. window.location.href = '/thmz/login/view'
  4113. return;
  4114. }
  4115. if (res.code == 0) {
  4116. res.data.forEach(function (item, index) {
  4117. var html = '<option value="' + item.code + '">' + item.instructionText + '</option>';
  4118. $('#medicalAdvice').append(html);
  4119. });
  4120. $('#medicalAdvice').selectpicker('refresh');
  4121. } else {
  4122. errorMesage(res);
  4123. }
  4124. }
  4125. });
  4126. //中药医嘱
  4127. $.ajax({
  4128. type: "GET",
  4129. url: '/thmz/getMzZdInstructionByType?instructionType=1',
  4130. contentType: "application/json;charset=UTF-8",
  4131. dataType: "json",
  4132. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4133. success: function (res) {
  4134. if (res == '401' || res == 401) {
  4135. window.location.href = '/thmz/login/view'
  4136. return;
  4137. }
  4138. if (res.code == 0) {
  4139. res.data.forEach(function (item, index) {
  4140. var html = '<option value="' + item.code + '">' + item.instructionText.trim() + '</option>';
  4141. $('#zyInstruction').append(html);
  4142. });
  4143. $('#zyInstruction').selectpicker('refresh');
  4144. } else {
  4145. errorMesage(res);
  4146. }
  4147. }
  4148. });
  4149. }
  4150. // /**
  4151. // * 设置下拉选的尺寸
  4152. // */
  4153. // function setSelectSize() {
  4154. // $(".selectpicker").selectpicker({
  4155. // dropuAuto: false,
  4156. // size: 10
  4157. // });
  4158. // }
  4159. /**
  4160. * 初始化下拉选
  4161. */
  4162. function initSelectWithParams() {
  4163. $(".selectpicker").selectpicker({
  4164. dropuAuto: false,
  4165. size: 10
  4166. });
  4167. //select 从后台加载数据,并保留之前选择的内容
  4168. dynamicSelectWithOri("editZd", '/thmz/getAllZdIcdCommonParams?commonParams=', false);
  4169. //中医诊断
  4170. dynamicSelectWithOri("editTcmZd", '/thmz/getAllTcmIcdCodeByParams?name=',false);
  4171. //手术名称下拉选实现
  4172. dynamicSelect("opName", '/thmz/getZdIcd9Cm3ListByCode?code=', false);
  4173. //手术部位
  4174. dynamicSelect("partCode", '/thmz/getAllOpZdPartNewByCode?code=', true);
  4175. //手术等级
  4176. dynamicSelect("opScale", '/thmz/getAllOpZdScaleByCode?code=', true);
  4177. //麻醉方式
  4178. dynamicSelect("hocusCode", '/thmz/getAllZdAnaesthesiaByCode?code=', true);
  4179. //主刀医生
  4180. dynamicSelect("doctorZd", '/thmz/getEmployeeByCommon?code=', true);
  4181. //过敏源
  4182. dynamicSelectWithOri("zdAllergen", '/thmz/getZdAllergenListByCode?code=', false);
  4183. //过敏源
  4184. dynamicSelectWithOri("editZdAllergen", '/thmz/getZdAllergenListByCode?code=', false);
  4185. //药品列表
  4186. dynamicSelectWithOri("ypDitList", '/thmz/getYpZdDictListByCode?code=', false);
  4187. //药品列表
  4188. dynamicSelectWithOri("editYpDitList", '/thmz/getYpZdDictListByCode?code=', false);
  4189. }
  4190. /**
  4191. * 初始化性别下拉选
  4192. */
  4193. function initGenderSelect() {
  4194. var gender = '<option value="1">男</option><option value="2">女</option><option value="0">未知</option>';
  4195. $('#rapidAcceptsUserGender').html(gender);
  4196. $('#rapidAcceptsUserGender').selectpicker('refresh');
  4197. $('#editUserGender').html(gender);
  4198. $('#editUserGender').selectpicker('refresh');
  4199. $('#crbMainCardGender').html(gender);
  4200. $('#crbMainCardGender').selectpicker('refresh');
  4201. //医疗范文状态
  4202. var templateStatus = '<option value="0">启用</option><option value="1">停用</option>';
  4203. $('#templateStatus').html(templateStatus);
  4204. $('#templateStatus').selectpicker('refresh');
  4205. //医疗范文操作类型
  4206. var operationType = '<option value="0">新增</option><option value="1">修改</option>';
  4207. $('#operationType').html(operationType);
  4208. $('#operationType').selectpicker('refresh');
  4209. //入院病情
  4210. var conditionCode = '<option value="1">有</option><option value="2">临床未确定</option><option value="3">情况不明</option><option value="4">无</option>';
  4211. $('#conditionCode').html(conditionCode);
  4212. $('#conditionCode').selectpicker('refresh');
  4213. //入院途径
  4214. initRouteOfAdmission()
  4215. // 初始化收取挂号费默认值
  4216. initGhFeeSelect()
  4217. //就诊人群类型
  4218. var mdtrtGrpType = '<option value="-1">无</option><option value="1">新冠肺炎确诊患者</option><option value="2">其他国家突发公共事件</option><option value="3">新冠肺炎疑似患者</option><option value="4">无症状感染者</option>';
  4219. $('#mdtrtGrpType').html(mdtrtGrpType);
  4220. $('#mdtrtGrpType').selectpicker('refresh');
  4221. //外伤标志
  4222. var trumFlag = '<option value="0">否</option><option value="1">是</option>';
  4223. $('#trumFlag').html(trumFlag);
  4224. $('#trumFlag').selectpicker('refresh');
  4225. //涉及第三方标志
  4226. var relTtpFlag = '<option value="0">否</option><option value="1">是</option>';
  4227. $('#relTtpFlag').html(relTtpFlag);
  4228. $('#relTtpFlag').selectpicker('refresh');
  4229. //门诊急诊转诊标志
  4230. var otpErReflFlag = '<option value="-1">无</option><option value="1">急诊</option><option value="2">转诊</option><option value="3">转诊合并急诊</option>';
  4231. $('#otpErReflFlag').html(otpErReflFlag);
  4232. $('#otpErReflFlag').selectpicker('refresh');
  4233. }
  4234. /**
  4235. * 初始化中药类型下拉选
  4236. */
  4237. function initZyClassTypeSelect() {
  4238. // let html = '<option selected="selected" value="81">普通</option><option value="83">颗粒剂</option>';
  4239. // $('#zyClassType').html(html);
  4240. // $('#zyClassType').selectpicker('refresh');
  4241. getAjaxRequst("/thmz/selectYfAllByTime",{},true,function (res) {
  4242. let html = '';
  4243. $.each(res.data, function (commentIndex, comment) {
  4244. if(comment.mzFlag ==='1' && (comment.zcyFlag==='1' || comment.klFlag==='1')){
  4245. html += '<option value="' + comment.groupNo + '">' + comment.groupName + '</option>';
  4246. }
  4247. });
  4248. $('#zyClassType').html(html);
  4249. $('#zyClassType').selectpicker('refresh');
  4250. })
  4251. }
  4252. /**
  4253. * 初始化皮试结果下拉选
  4254. * @param categoriesFlag 0 口服 2 注射针剂
  4255. */
  4256. function initTryResultSelect(categoriesFlag) {
  4257. var tryResult = '';
  4258. if (categoriesFlag == 2 || categoriesFlag == "2") {
  4259. tryResult += '<option value="100">皮试</option>';
  4260. }
  4261. tryResult += '<option value="0">阴性</option><option value="3">免试</option>';
  4262. //var tryResult = '<option value="100">皮试</option><option value="0">阴性</option><option value="3">免试</option>';
  4263. $('#tryResult').html(tryResult);
  4264. $('#tryResult').selectpicker('refresh');
  4265. //口服药选择皮试结果
  4266. $("#tryResult").parent().parent().parent().removeClass("hide").addClass("in");
  4267. }
  4268. /**
  4269. * 初始化病人身份类别下拉选
  4270. */
  4271. function initResponceTypeSelect() {
  4272. $.ajax({
  4273. type: "GET",
  4274. url: '/thmz/getMzResponceType',
  4275. contentType: "application/json;charset=UTF-8",
  4276. dataType: "json",
  4277. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4278. success: function (res) {
  4279. if (res == '401' || res == 401) {
  4280. window.location.href = '/thmz/login/view'
  4281. return;
  4282. }
  4283. if (res.code == 0) {
  4284. res.data.forEach(function (item, index) {
  4285. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  4286. $('#patientsNature').append(html);
  4287. $('#editUserPatientsNature').append(html);
  4288. $('#crbMainCardPatientsNature').append(html);
  4289. // $('#responeTypeBeHospitalized').append(html);
  4290. });
  4291. $('#patientsNature').selectpicker('refresh');
  4292. $('#editUserPatientsNature').selectpicker('refresh');
  4293. $('#crbMainCardPatientsNature').selectpicker('refresh');
  4294. } else {
  4295. errorMesage(res);
  4296. }
  4297. }
  4298. });
  4299. }
  4300. /**
  4301. * 所有的入院状态
  4302. */
  4303. function iniAdmissStatus() {
  4304. $.ajax({
  4305. type: "GET",
  4306. url: '/thmz/getAdmissStatus',
  4307. dataType: "json",
  4308. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4309. success: function (res) {
  4310. if (res == '401' || res == 401) {
  4311. window.location.href = '/thmz/login/view'
  4312. return;
  4313. }
  4314. var html = '';
  4315. $.each(res.data, function (commentIndex, comment) {
  4316. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  4317. });
  4318. $('#admissStatus').empty();
  4319. $('#admissStatus').html(html);
  4320. $('#admissStatus').selectpicker('destroy').selectpicker('refresh');
  4321. }
  4322. });
  4323. }
  4324. /**
  4325. * 初始化收取挂号费
  4326. */
  4327. function initGhFeeSelect() {
  4328. getAjaxRequst("/thmz/getGhFeeValue",{},true,function (res) {
  4329. $("#ghFeeSelect").val(res.data)
  4330. $('#ghFeeSelect').selectpicker('refresh');
  4331. })
  4332. }
  4333. /**
  4334. * 初始化入院途径
  4335. */
  4336. function initRouteOfAdmission() {
  4337. getAjaxRequst("/thmz/queryRouteOfAdmission",{},true,function (res) {
  4338. if (res == '401' || res == 401) {
  4339. window.location.href = '/thmz/login/view'
  4340. return;
  4341. }
  4342. var html = '';
  4343. $.each(res.data, function (commentIndex, comment) {
  4344. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  4345. });
  4346. $('#routeOfAdmission').empty();
  4347. $('#routeOfAdmission').html(html);
  4348. $('#routeOfAdmission').selectpicker('destroy').selectpicker('refresh');
  4349. })
  4350. }
  4351. /**
  4352. * 入院登记的病区列表
  4353. */
  4354. function initListDeptSelect() {
  4355. //科室列表
  4356. $.ajax({
  4357. type: "GET",
  4358. url: '/thmz/allInpatientWard',
  4359. dataType: "json",
  4360. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4361. success: function (data) {
  4362. if (data == '401' || data == 401) {
  4363. window.location.href = '/thmz/login/view'
  4364. return;
  4365. }
  4366. var html = '';
  4367. $.each(data.data, function (commentIndex, comment) {
  4368. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';
  4369. });
  4370. $('#inpatientWardBeHospitalized').empty();
  4371. $('#inpatientWardBeHospitalized').html(html);
  4372. $('#inpatientWardBeHospitalized').selectpicker('refresh');
  4373. initSmallDeptByDept();
  4374. }
  4375. });
  4376. }
  4377. /**
  4378. * 关系列表初始化
  4379. */
  4380. function initRelationSelect() {
  4381. //医生列表
  4382. $.ajax({
  4383. type: "GET",
  4384. url: '/thmz/getRelation',
  4385. dataType: "json",
  4386. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4387. success: function (res) {
  4388. if (res == '401' || res == 401) {
  4389. window.location.href = '/thmz/login/view'
  4390. return;
  4391. }
  4392. var html = '';
  4393. $.each(res.data, function (commentIndex, comment) {
  4394. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  4395. });
  4396. $('#contacterRelationship').empty();
  4397. $('#contacterRelationship').html(html);
  4398. $('#contacterRelationship').selectpicker('destroy').selectpicker('refresh');
  4399. }
  4400. });
  4401. }
  4402. /**
  4403. * 小科室列表
  4404. */
  4405. function initSmallDeptByDept() {
  4406. let code = escape($('#inpatientWardBeHospitalized').val()).replace(/\+/g, '%2B');
  4407. //小科室列表
  4408. $.ajax({
  4409. type: "GET",
  4410. url: '/thmz/getSmallDeptByDept?code=' + code,
  4411. dataType: "json",
  4412. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4413. success: function (res) {
  4414. if (res == '401' || res == 401) {
  4415. window.location.href = '/thmz/login/view'
  4416. return;
  4417. }
  4418. var html = '';
  4419. $.each(res.data, function (commentIndex, comment) {
  4420. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  4421. });
  4422. $('#smallWardBeHospitalized').empty();
  4423. $('#smallWardBeHospitalized').html(html);
  4424. $('#smallWardBeHospitalized').selectpicker('destroy').selectpicker('refresh');
  4425. }
  4426. });
  4427. //病床数
  4428. $.ajax({
  4429. type: "GET",
  4430. url: '/thmz/getBedStatusNumByDept?code=' + code,
  4431. dataType: "json",
  4432. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4433. success: function (res) {
  4434. if (res == '401' || res == 401) {
  4435. window.location.href = '/thmz/login/view'
  4436. return;
  4437. }
  4438. if (res.code == 0) {
  4439. var data = res.data;
  4440. if (data == null) {
  4441. $("#totalBedNum").val(0);
  4442. $("#freeBedNum").val(0);
  4443. $("#occupationBedNum").val(0);
  4444. } else {
  4445. $("#totalBedNum").val(data.total);
  4446. $("#freeBedNum").val(data.free);
  4447. $("#occupationBedNum").val(data.occupation);
  4448. }
  4449. } else {
  4450. errorMesage(res);
  4451. }
  4452. }
  4453. });
  4454. }
  4455. /**
  4456. * 初始化门诊统筹下拉选
  4457. */
  4458. function initMztcSelect() {
  4459. var selectHtml = '<option value="0">否</option><option value="1">是</option>';
  4460. $('#zgmztczf').html(selectHtml);
  4461. $('#zgmztczf').selectpicker('refresh');
  4462. var gzZfSelectHtml = '<option value="0">否</option><option value="1">使用个账</option><option value="2">使用共济账户</option>';
  4463. $('#grzhzf').html(gzZfSelectHtml);
  4464. $('#grzhzf').selectpicker('refresh');
  4465. }
  4466. /**
  4467. * 初始化手术下拉选
  4468. */
  4469. function initMzssSelect() {
  4470. var selectHtml = '<option value="0">否</option><option value="1">是</option>';
  4471. $('#urgentClinicFlag').html(selectHtml);
  4472. $('#urgentClinicFlag').selectpicker('refresh');
  4473. $('#urgentClinicFlag').selectpicker('val', "0");
  4474. $('#urgentClinicFlag').selectpicker('refresh');
  4475. var bcHtml = '<option value="1">正常</option><option value="2">加班</option>';
  4476. $('#ssbc').html(bcHtml);
  4477. $('#ssbc').selectpicker('refresh');
  4478. $('#ssbc').selectpicker('val', "1");
  4479. $('#ssbc').selectpicker('refresh');
  4480. }
  4481. /**
  4482. * 初始化医疗范文范围下拉选
  4483. * @param templateTypeId
  4484. */
  4485. function initTemplateTypeSelect(templateTypeId) {
  4486. $.ajax({
  4487. type: "GET",
  4488. url: '/thmz/getTemplateTypes',
  4489. contentType: "application/json;charset=UTF-8",
  4490. dataType: "json",
  4491. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4492. success: function (res) {
  4493. if (res == '401' || res == 401) {
  4494. window.location.href = '/thmz/login/view'
  4495. return;
  4496. }
  4497. if (res.code == 0) {
  4498. res.data.forEach(function (item) {
  4499. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  4500. $('#' + templateTypeId).append(html);
  4501. });
  4502. $('#' + templateTypeId).selectpicker('refresh');
  4503. if(templateTypeId =='templateTypeForm'){
  4504. $('#'+templateTypeId).selectpicker('val', "0");
  4505. $('#'+templateTypeId).selectpicker('refresh');
  4506. fitTemplateData()
  4507. }
  4508. } else {
  4509. errorMesage(res);
  4510. }
  4511. }
  4512. });
  4513. }
  4514. /**
  4515. * 初始化医疗范文类型下拉选
  4516. * @param templateKindTypeId
  4517. */
  4518. function initTemplateKindTypeSelect(templateKindTypeId) {
  4519. $.ajax({
  4520. type: "GET",
  4521. url: '/thmz/getTemplateKindTypes',
  4522. contentType: "application/json;charset=UTF-8",
  4523. dataType: "json",
  4524. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4525. success: function (res) {
  4526. if (res == '401' || res == 401) {
  4527. window.location.href = '/thmz/login/view'
  4528. return;
  4529. }
  4530. if (res.code == 0) {
  4531. res.data.forEach(function (item) {
  4532. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  4533. $('#' + templateKindTypeId).append(html);
  4534. });
  4535. $('#' + templateKindTypeId).selectpicker('refresh');
  4536. $('#' + templateKindTypeId).selectpicker({
  4537. dropuAuto: false,
  4538. size: 5
  4539. });
  4540. } else {
  4541. errorMesage(res);
  4542. }
  4543. }
  4544. });
  4545. }
  4546. /**
  4547. * 初始频次下拉选
  4548. * @param id
  4549. * @param async 是否是异步 true 异步 false 同步
  4550. */
  4551. function initOrderFrequencys(id, async) {
  4552. $.ajax({
  4553. type: "GET",
  4554. url: '/thmz/getXyOrderFrequencys',
  4555. dataType: "json",
  4556. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4557. async: async,
  4558. success: function (res) {
  4559. if (res == '401' || res == 401) {
  4560. window.location.href = '/thmz/login/view'
  4561. return;
  4562. }
  4563. var html = '';
  4564. $.each(res.data, function (commentIndex, comment) {
  4565. html += '<option value="' + comment.code + '" desc="' + comment.times + '">' + comment.name + '(' + comment.code + ')' + '</option>';
  4566. });
  4567. $('#' + id).empty();
  4568. $('#' + id).html(html);
  4569. $('#' + id).selectpicker('refresh');
  4570. }
  4571. });
  4572. }
  4573. /**
  4574. * 初始中药频次下拉选
  4575. * @param id
  4576. * @param async 是否是异步 true 异步 false 同步
  4577. */
  4578. function initZyOrderFrequencys(id, async) {
  4579. $.ajax({
  4580. type: "GET",
  4581. url: '/thmz/getZyOrderFrequencys',
  4582. dataType: "json",
  4583. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4584. async: async,
  4585. success: function (res) {
  4586. if (res == '401' || res == 401) {
  4587. window.location.href = '/thmz/login/view'
  4588. return;
  4589. }
  4590. var html = '';
  4591. $.each(res.data, function (commentIndex, comment) {
  4592. html += '<option value="' + comment.code + '" desc="' + comment.times + '">' + comment.name + '(' + comment.code + ')' + '</option>';
  4593. });
  4594. $('#' + id).empty();
  4595. $('#' + id).html(html);
  4596. $('#' + id).selectpicker('refresh');
  4597. }
  4598. });
  4599. }
  4600. /**
  4601. * 初始中药服用说明
  4602. */
  4603. function initAllMzYshZdFysm() {
  4604. $.ajax({
  4605. type: "GET",
  4606. url: '/thmz/getAllMzYshZdFysm',
  4607. dataType: "json",
  4608. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4609. async: false,
  4610. success: function (res) {
  4611. if (res == '401' || res == 401) {
  4612. window.location.href = '/thmz/login/view'
  4613. return;
  4614. }
  4615. var html = '';
  4616. $.each(res.data, function (commentIndex, comment) {
  4617. if (comment.name.indexOf(",") < 0) {
  4618. //过滤组合的用法
  4619. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  4620. }
  4621. });
  4622. $('.useType').empty();
  4623. $('.useType').html(html);
  4624. $('.useType').selectpicker('refresh');
  4625. $('.useType').selectpicker('val', "2");
  4626. $('.useType').selectpicker('refresh');
  4627. }
  4628. });
  4629. }
  4630. /**
  4631. * 初始用药方式下拉选
  4632. */
  4633. function initSupplyTypes() {
  4634. $.ajax({
  4635. type: "GET",
  4636. url: '/thmz/getSupplyTypes',
  4637. dataType: "json",
  4638. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4639. success: function (res) {
  4640. if (res == '401' || res == 401) {
  4641. window.location.href = '/thmz/login/view'
  4642. return;
  4643. }
  4644. var html = '';
  4645. $.each(res.data, function (commentIndex, comment) {
  4646. if (comment.supplyOcc === "71") {
  4647. html += '<option value="' + comment.supplyCode + '">' + comment.supplyName + '[' + comment.pyCode + ']' + '</option>';
  4648. }
  4649. });
  4650. $('#supplyType').empty();
  4651. $('#supplyType').html(html);
  4652. $('#supplyType').selectpicker('refresh');
  4653. }
  4654. });
  4655. }
  4656. /**
  4657. * 初始化外配药剂型
  4658. */
  4659. function initDrugDosform() {
  4660. getAjaxRequst("/thmz/wpMzPrescription/queryYpZdDosage",{},true ,function (res) {
  4661. var html = '';
  4662. $.each(res.data, function (commentIndex, comment) {
  4663. html += '<option value="' + comment.name + '">' + comment.name + '</option>';
  4664. });
  4665. $('#drugDosform').html(html);
  4666. $('#drugDosform').selectpicker('refresh');
  4667. })
  4668. }
  4669. /**
  4670. * 初始化外配处方字典
  4671. */
  4672. function initZdRxAll(label,id) {
  4673. getAjaxRequst("/thmz/wpMzPrescription/queryZdRxAllByLabel",{label:label},true ,function (res) {
  4674. var html = '';
  4675. $.each(res.data, function (commentIndex, comment) {
  4676. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  4677. });
  4678. $('#'+id).html(html);
  4679. $('#'+id).selectpicker('refresh');
  4680. })
  4681. }
  4682. /**
  4683. * 初始煎药方式下拉选
  4684. * @param async 是否是异步 true 异步 false 同步
  4685. */
  4686. function initZySupplyTypes(id, async) {
  4687. $.ajax({
  4688. type: "GET",
  4689. url: '/thmz/getSupplyTypes',
  4690. dataType: "json",
  4691. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4692. async: async,
  4693. success: function (res) {
  4694. if (res == '401' || res == 401) {
  4695. window.location.href = '/thmz/login/view'
  4696. return;
  4697. }
  4698. var html = '';
  4699. $.each(res.data, function (commentIndex, comment) {
  4700. if (comment.supplyOcc === "81") {
  4701. // html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  4702. html += '<option value="' + comment.supplyCode + '">' + comment.supplyName + '[' + comment.pyCode + ']' + '</option>';
  4703. }
  4704. });
  4705. $('#' + id).empty();
  4706. $('#' + id).html(html);
  4707. $('#' + id).selectpicker('refresh');
  4708. $('#' + id).selectpicker({
  4709. dropuAuto: false,
  4710. size: 10
  4711. });
  4712. }
  4713. });
  4714. }
  4715. /**
  4716. * 初始查检查部位
  4717. */
  4718. function initYshPart() {
  4719. $.ajax({
  4720. type: "GET",
  4721. url: '/thmz/getYshPart',
  4722. dataType: "json",
  4723. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4724. success: function (res) {
  4725. if (res == '401' || res == 401) {
  4726. window.location.href = '/thmz/login/view'
  4727. return;
  4728. }
  4729. var html = '';
  4730. $.each(res.data, function (commentIndex, comment) {
  4731. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')' + '</option>';
  4732. });
  4733. $('#yshPart').empty();
  4734. $('#yshPart').html(html);
  4735. $('#yshPart').selectpicker('refresh');
  4736. $('#yshPart').selectpicker({
  4737. dropuAuto: false,
  4738. size: 10
  4739. });
  4740. }
  4741. });
  4742. }
  4743. /**
  4744. * 初始化验物下拉选
  4745. */
  4746. function initJyZdSample() {
  4747. $.ajax({
  4748. type: "GET",
  4749. url: '/thmz/getJyZdSample',
  4750. dataType: "json",
  4751. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4752. success: function (res) {
  4753. if (res == '401' || res == 401) {
  4754. window.location.href = '/thmz/login/view'
  4755. return;
  4756. }
  4757. var html = '';
  4758. $.each(res.data, function (commentIndex, comment) {
  4759. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')' + '</option>';
  4760. });
  4761. $('#jyZdSample').empty();
  4762. $('#jyZdSample').html(html);
  4763. $('#jyZdSample').selectpicker('refresh');
  4764. $('#jyZdSample').selectpicker({
  4765. dropuAuto: false,
  4766. size: 10
  4767. });
  4768. }
  4769. });
  4770. }
  4771. /**
  4772. * 初始化当前医生说书科室
  4773. */
  4774. function initClinicDeptNo() {
  4775. $.ajax({
  4776. type: "GET",
  4777. url: '/thmz/getUnitCodeByCurrentUser',
  4778. dataType: "json",
  4779. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4780. success: function (res) {
  4781. if (res == '401' || res == 401) {
  4782. window.location.href = '/thmz/login/view'
  4783. return;
  4784. }
  4785. var html = '';
  4786. $.each(res.data, function (commentIndex, comment) {
  4787. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  4788. });
  4789. $('#clinicDeptNo').empty();
  4790. $('#clinicDeptNo').html(html);
  4791. $('#clinicDeptNo').selectpicker('refresh');
  4792. var userIdCode = localStorage.getItem("userIdCode");
  4793. var deptNo = localStorage.getItem(userIdCode);
  4794. if (deptNo != null && deptNo != "") {
  4795. $('#clinicDeptNo').selectpicker('val', deptNo);
  4796. $('#clinicDeptNo').selectpicker('refresh');
  4797. }
  4798. }
  4799. });
  4800. }
  4801. /**
  4802. * 保存当前药品到右边处方区域
  4803. * @param index 0 西药 1中药 2 诊疗和社备
  4804. */
  4805. function saveMedicine(index) {
  4806. if (index == 0) {
  4807. saveWesternMedicineWithCheck(true, null);
  4808. } else if (index == 1) {
  4809. saveChineseMedicine(true);
  4810. }
  4811. }
  4812. /**
  4813. * 保存当前药品到右边处方区域 西药
  4814. * calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  4815. * orderNoParmams
  4816. */
  4817. function saveWesternMedicineWithCheck(calculateTotalAmountFlag, orderNoParmams) {
  4818. //是新增药品还是编辑 true 修改 默认false
  4819. var updateFlag = $("#western_medicine_update_flag").val();
  4820. if (updateFlag == "true" || updateFlag == true) {
  4821. saveWesternMedicine(calculateTotalAmountFlag);
  4822. } else {
  4823. //当前药房编码
  4824. var currentGroupNo = $("#current_groupNo").val();
  4825. if (currentGroupNo == "") {
  4826. errorMesageSimaple("您未选择任何药品");
  4827. return;
  4828. }
  4829. if ($("#xyTab").find("li") == null || $("#xyTab").find("li").length == 0) {
  4830. initNavTabs(0, currentGroupNo, orderNoParmams);
  4831. }
  4832. var tableId = $("#xyTab li.active").find("a").attr("href");
  4833. var childrens = $(tableId).find("div:eq(0)").children().length;
  4834. var thisGroupNo = $(tableId).find("input.current_groupNo").val();
  4835. var flag = childrens === 5;
  4836. if (!calculateTotalAmountFlag) {
  4837. flag = childrens === 5 && $(tableId).is(':last-child');
  4838. }
  4839. if (thisGroupNo != null && thisGroupNo != '' && currentGroupNo != thisGroupNo) {
  4840. //当前编辑的处方与选中的品类非同一处方能保存的
  4841. var currentGroupNos = $("#xyTabContent").find("input.current_groupNo");
  4842. //是否需要新增处方页,以保存医材处方
  4843. var needAddTable = true;
  4844. for (var i = 0; i < currentGroupNos.length; i++) {
  4845. if ($(currentGroupNos[i]).val() == currentGroupNo) {
  4846. var next = $(currentGroupNos[i]).next();
  4847. if (needAddTable && $(next).children().length < 5) {
  4848. var parentId = $(currentGroupNos[i]).parent().attr("id");
  4849. //切换处方
  4850. $("#xyTab").find("a[href='#" + parentId + "']").off("click").tab('show');
  4851. //$("#xyTab").find("a[href='#" + tableId + "']").off("click").click();
  4852. //因为存在没有满5个的处方页,直接保存到该页
  4853. needAddTable = false;
  4854. }
  4855. }
  4856. }
  4857. if (needAddTable) {
  4858. //91 医材
  4859. var message = "医材需要单独处方,是否需要新增医材处方?";
  4860. if (currentGroupNo == '71') {
  4861. message = "普通西成药需要单独处方,是否需要新增处方?"
  4862. } else if (currentGroupNo == '111') {
  4863. message = "麻、精一药物需要单独处方,是否需要新增处方?"
  4864. } else if (currentGroupNo == '131') {
  4865. message = "精二药物需要单独处方,是否需要新增处方?"
  4866. }
  4867. if (calculateTotalAmountFlag) {
  4868. $("#messageModal").modal();
  4869. $("#messageContent").html(message);
  4870. $("#messageButton").off("click").on("click", function (t) {
  4871. $("#messageModal").modal("hide");
  4872. refreshNavTabs(0, currentGroupNo, orderNoParmams);
  4873. saveWesternMedicine(calculateTotalAmountFlag);
  4874. });
  4875. $("#cancelButton").off("click").on("click", function (t) {
  4876. return;
  4877. });
  4878. }
  4879. }
  4880. } else if (flag) {
  4881. if (calculateTotalAmountFlag) {
  4882. $("#messageModal").modal();
  4883. $("#messageContent").html("单张处方最多只能开具5个药品,是否需要新增处方?");
  4884. $("#messageButton").off("click").on("click", function (t) {
  4885. $("#messageModal").modal("hide");
  4886. refreshNavTabs(0, currentGroupNo, orderNoParmams);
  4887. saveWesternMedicine(calculateTotalAmountFlag);
  4888. });
  4889. $("#cancelButton").off("click").on("click", function (t) {
  4890. return;
  4891. });
  4892. }
  4893. } else {
  4894. saveWesternMedicine(calculateTotalAmountFlag);
  4895. }
  4896. }
  4897. }
  4898. /**
  4899. * 保存当前药品到右边处方区域 西药
  4900. * calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  4901. */
  4902. function saveWesternMedicine(calculateTotalAmountFlag) {
  4903. //当前药房编码
  4904. var currentGroupNo = $("#current_groupNo").val();
  4905. //药品名称
  4906. var westernMedicineNamme = $("#western_medicine_name").val();
  4907. var tableId = $("#xyTab li.active").find("a").attr("href");
  4908. if (tableId == undefined) {
  4909. refreshNavTabs(0, currentGroupNo, null);
  4910. tableId = $("#xyTab li.active").find("a").attr("href");
  4911. }
  4912. var thisGroupNo = $(tableId).find("input.current_groupNo").val();
  4913. if (currentGroupNo != thisGroupNo) {
  4914. //91 医材
  4915. var type = "医材";
  4916. if (currentGroupNo == '71') {
  4917. type = "普通西成药"
  4918. } else if (currentGroupNo == '111') {
  4919. type = "麻、精一药物"
  4920. } else if (currentGroupNo == '131') {
  4921. type = "精二药物"
  4922. }
  4923. errorMesageSimaple("【" + westernMedicineNamme + "】是" + type + ",无法保存到当前处方,请切换或者新增相应的处方进行保存。");
  4924. return;
  4925. }
  4926. //当前处方选项卡下标
  4927. var xyTabIndex = $("#xyTab li.active").index();
  4928. //组号
  4929. var groupId = $("#groupId").val();
  4930. if (groupId == null || groupId == '') {
  4931. errorMesageSimaple("组号为空,请选择组号!");
  4932. return;
  4933. }
  4934. groupId = parseInt(groupId);
  4935. if (groupId == null || isNaN(groupId)) {
  4936. errorMesageSimaple("组号为空,请选择组号!");
  4937. return;
  4938. }
  4939. if (gropuIdAndOrderNoMap == null) {
  4940. gropuIdAndOrderNoMap = new MyMap();
  4941. }
  4942. var exitIndex = gropuIdAndOrderNoMap.get(groupId);
  4943. if (exitIndex == null) {
  4944. exitIndex = xyTabIndex;
  4945. gropuIdAndOrderNoMap.put(groupId, xyTabIndex);
  4946. }
  4947. if (xyTabIndex != exitIndex) {
  4948. var westernMedicineUpdateFlag = $("#western_medicine_update_flag").val();
  4949. var westernMedicineOriGroupId = $("#western_medicine_ori_group_id").val();
  4950. //非修改组号的情况下就需要切换组号
  4951. if (!((westernMedicineUpdateFlag == true || westernMedicineUpdateFlag == "true") && westernMedicineOriGroupId != groupId)) {
  4952. groupId = parseInt($("#groupId > option:last").val());
  4953. $("#groupId").selectpicker('val', groupId);
  4954. $('#groupId').selectpicker('refresh');
  4955. gropuIdAndOrderNoMap.put(groupId, xyTabIndex);
  4956. appendGroupOrder();
  4957. }
  4958. warningMesageSimaple("同一组药必须出现在同一个处方中,当前组号已经被其他处方使用,系统已自动为您重新分配组号!");
  4959. //return;
  4960. }
  4961. //当前药品编码
  4962. var currentCode = $("#western_medicine_current_code").val();
  4963. //当前药品规格
  4964. var currentSerial = $("#western_medicine_current_serial").val();
  4965. //用法编码
  4966. var supplyType = $("#supplyType").val();
  4967. //用法描述
  4968. var supplyTypeText = $('#supplyType option:selected').text();
  4969. supplyTypeText = supplyTypeText.substring(0, supplyTypeText.indexOf("["));
  4970. //药品默认单次使用剂量
  4971. var drugWinDb = $("#drugWinDb").val();
  4972. //处方实际单次使用剂量
  4973. var drugWin = $("#drugWin").val();
  4974. //剂量单位
  4975. var drugWinUnit = $('#drugWinUnit option:selected').text();
  4976. //drugWinUnit = drugWinUnit.substring(0, drugWinUnit.indexOf("("));
  4977. //天数
  4978. var dayNum = $("#dayNum").val();
  4979. //频次编码
  4980. var orderFrequency = $("#orderFrequency").val();
  4981. //频次描述
  4982. var orderFrequencyText = $('#orderFrequency option:selected').text();
  4983. orderFrequencyText = orderFrequencyText.substring(0, orderFrequencyText.indexOf("("));
  4984. //总量
  4985. var gross = $("#gross").val();
  4986. //包装单位
  4987. var packUnit = $("#packUnit").val();
  4988. if (packUnit == null) {
  4989. packUnit = "";
  4990. }
  4991. //医嘱码
  4992. var medicalAdvice = $("#medicalAdvice").val();
  4993. //医嘱内容
  4994. var medicalAdviceText = $('#medicalAdvice option:selected').text();
  4995. let tmpMedicalAdviceText = medicalAdviceText.substring(0, medicalAdviceText.indexOf("("));
  4996. //金额
  4997. var totalRetprice = parseFloat($("#totalRetprice").val());
  4998. //单价
  4999. var packRetprice = $("#packRetprice").val();
  5000. //皮试结果
  5001. var tryResult = $("#tryResult").val();
  5002. //药品大类标志
  5003. var categoriesFlag = $("#categoriesFlag").val();
  5004. //报销自费标识
  5005. var xyHospApprFlag = $("#xyHospApprFlag").val();
  5006. if (currentCode == null || currentCode == '') {
  5007. if (calculateTotalAmountFlag) {
  5008. errorMesageSimaple("未选择任何药品!");
  5009. }
  5010. return;
  5011. }
  5012. if (currentGroupNo != '91') {
  5013. if (supplyType == null || supplyType == "") {
  5014. errorMesageSimaple("用法为空!");
  5015. return;
  5016. }
  5017. if (drugWin == null || drugWin == "") {
  5018. errorMesageSimaple("剂量为空!");
  5019. return;
  5020. }
  5021. if (dayNum == null || dayNum == "") {
  5022. errorMesageSimaple("天数为空!");
  5023. return;
  5024. }
  5025. if (orderFrequency == null || orderFrequency == "") {
  5026. errorMesageSimaple("频次为空!");
  5027. return;
  5028. }
  5029. }
  5030. if (gross == null || gross == "") {
  5031. errorMesageSimaple("总量为空!");
  5032. return;
  5033. }
  5034. var manufactoryName = $("#manufactoryName").val();
  5035. var html = '<div class="form-group">';
  5036. html += '<span class="groupId">' + groupId + '</span>' + '.<span style="margin-left: 5px"></span>';
  5037. html += westernMedicineNamme;
  5038. if (manufactoryName != null && manufactoryName != 'null' && manufactoryName != "") {
  5039. html += "(" + manufactoryName + ")"
  5040. }
  5041. html += '&nbsp;&nbsp;&nbsp;&nbsp;';
  5042. html += $("#specification").val();
  5043. html += '&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;';
  5044. //html += drugWinDb + drugWinUnit + ' 共';
  5045. html += gross + packUnit + " " + '<br/><span style="margin-left: 15px"></span>';
  5046. html += '用法:' + supplyTypeText + ' ';
  5047. html += drugWin + drugWinUnit + ' ';
  5048. html += '频次:' + orderFrequencyText + ' ';
  5049. html += dayNum + '天 ';
  5050. if (tryResult != null && tryResult != 'null' && tryResult != "") {
  5051. if (tryResult == "100" || tryResult == 100) {
  5052. html += '皮试 ';
  5053. } else {
  5054. html += '皮试结果: ' + $('#tryResult option:selected').text();
  5055. }
  5056. }
  5057. if (medicalAdvice != null && medicalAdvice != '') {
  5058. html += '医嘱:' + tmpMedicalAdviceText;
  5059. }
  5060. 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>';
  5061. 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>';
  5062. 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>';
  5063. 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>';
  5064. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  5065. html += '<input type="hidden" class="temporary_items_serial" value="' + currentSerial + '"/>';
  5066. html += '<input type="hidden" class="temporary_items_amount" value="' + totalRetprice + '"/>';
  5067. html += '<input type="hidden" class="temporary_items_groupId" value="' + groupId + '"/>';
  5068. html += '<input type="hidden" class="temporary_items_westernMedicineNamme" value="' + westernMedicineNamme + '"/>';
  5069. html += '<input type="hidden" class="temporary_items_supplyTypeText" value="' + supplyTypeText + '"/>';
  5070. html += '<input type="hidden" class="temporary_items_drugWinDb" value="' + drugWinDb + '"/>';
  5071. html += '<input type="hidden" class="temporary_items_drugWin" value="' + drugWin + '"/>';
  5072. html += '<input type="hidden" class="temporary_items_drugWinUnit" value="' + $("#drugWinUnit").val() + '"/>';
  5073. html += '<input type="hidden" class="temporary_items_drugWinUnitText" value="' + drugWinUnit+ '"/>';
  5074. html += '<input type="hidden" class="temporary_items_gross" value="' + gross + '"/>';
  5075. html += '<input type="hidden" class="temporary_items_packUnit" value="' + packUnit + '"/>';
  5076. html += '<input type="hidden" class="temporary_items_supplyType" value="' + supplyType + '"/>';
  5077. html += '<input type="hidden" class="temporary_items_orderFrequency" value="' + orderFrequency + '"/>';
  5078. html += '<input type="hidden" class="temporary_items_dayNum" value="' + dayNum + '"/>';
  5079. html += '<input type="hidden" class="temporary_items_medicalAdvice" value="' + medicalAdvice + '"/>';
  5080. html += '<input type="hidden" class="temporary_items_medicalAdviceText" value="' + medicalAdviceText + '"/>';
  5081. html += '<input type="hidden" class="temporary_items_packRetprice" value="' + packRetprice + '"/>';
  5082. html += '<input type="hidden" class="temporary_items_tryResult" value="' + tryResult + '"/>';
  5083. html += '<input type="hidden" class="temporary_items_currentGroupNo" value="' + currentGroupNo + '"/>';
  5084. html += '<input type="hidden" class="temporary_items_categoriesFlag" value="' + categoriesFlag + '"/>';
  5085. html += '<input type="hidden" class="temporary_items_xyHospApprFlag" value="' + xyHospApprFlag + '"/>';
  5086. html += '</div>';
  5087. var tableId = $("#xyTab li.active").find("a").attr("href");
  5088. //是新增药品还是编辑 true 修改 默认false
  5089. var updateFlag = $("#western_medicine_update_flag").val();
  5090. if (updateFlag == undefined || updateFlag == null) {
  5091. updateFlag = false;
  5092. }
  5093. // //原药品金额 如果是修改则需要设置
  5094. // var temporaryItemsAmount = 0;
  5095. //当前需要被移除元素的下个兄弟节点
  5096. var nextObj = null;
  5097. //当前修改的药品是不是最后一个
  5098. var isLast = false;
  5099. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  5100. if (formGroups != null && formGroups.length > 0) {
  5101. //如果是修改,需要减去原来的费用
  5102. if (updateFlag == "true" || updateFlag == true) {
  5103. //药品有可能会修改,所以,判断的时候要用原药品编码
  5104. var updateOriCode = $("#update_ori_code").val();
  5105. //规格有可能会修改,所以,判断的时候要用原规格
  5106. var updateOriSerial = $("#update_ori_serial").val();
  5107. //组号有可能会修改,所以,判断的时候要用原组号
  5108. var westernMedicineOriGroupId = $("#western_medicine_ori_group_id").val();
  5109. for (var i = 0; i < formGroups.length; i++) {
  5110. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  5111. var temporaryItemsSerial = $(formGroups[i]).find("input.temporary_items_serial").val();
  5112. var temporaryItemsGroupId = $(formGroups[i]).find("input.temporary_items_groupId").val();
  5113. if (temporaryItemsCode === updateOriCode && temporaryItemsSerial === updateOriSerial && temporaryItemsGroupId == westernMedicineOriGroupId) {
  5114. //temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  5115. if (formGroups.length > 1) {
  5116. nextObj = $(formGroups[i]).next();
  5117. }
  5118. isLast = (i + 1) === formGroups.length;
  5119. $(formGroups[i]).remove();
  5120. break;
  5121. }
  5122. }
  5123. } else {
  5124. //因为药品可以换组号,要保证相同组号的在一起
  5125. for (var i = 0; i < formGroups.length; i++) {
  5126. var temporaryItemsGroupId = parseInt($(formGroups[i]).find("input.temporary_items_groupId").val());
  5127. //如果当前的组号小与遍历到的组号,说明是原组号的下一个兄弟节点,新的药品插入到兄弟节点前就可以了
  5128. if (temporaryItemsGroupId > groupId) {
  5129. nextObj = $(formGroups[i]);
  5130. break;
  5131. }
  5132. }
  5133. }
  5134. }
  5135. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  5136. if (nextObj == null || isLast) {
  5137. $(tableId).find("div:eq(0)").append(html);
  5138. } else {
  5139. $(nextObj).before(html);
  5140. }
  5141. //设置当前处方金额
  5142. //calculateCfAmount(tableId, totalRetprice, temporaryItemsAmount, 0, 0);
  5143. if (calculateTotalAmountFlag) {
  5144. //设置总金额
  5145. calculateTotalAmount(true);
  5146. resetGroupIdSelect();
  5147. }
  5148. //判断当前组号是不是最后一个,是最后一个组号,就需要新增组号
  5149. var groupIdLast = $("#groupId option:last-child").text();
  5150. if (groupId === groupIdLast) {
  5151. appendGroupOrder();
  5152. }
  5153. //设置药品的用法,频次,天数
  5154. var map = groupIdMap.get(groupId);
  5155. if (map == null) {
  5156. map = new MyMap();
  5157. map.put("supplyType", supplyType);
  5158. map.put("orderFrequency", orderFrequency);
  5159. map.put("dayNum", dayNum);
  5160. groupIdMap.put(groupId, map);
  5161. }
  5162. //设置当前药品的品类
  5163. $(tableId).find("input.current_groupNo").val($("#current_groupNo").val());
  5164. $("#supplyType").selectpicker('val', null);
  5165. $('#supplyType').selectpicker('refresh');
  5166. clearWesternMedicine(false);
  5167. resetGroupIdMap();
  5168. }
  5169. /**
  5170. * 上移
  5171. * @param obj
  5172. */
  5173. function arrowUp(obj) {
  5174. var parentObject = $(obj).parent();
  5175. if ($(parentObject).prev() == null) {
  5176. return;
  5177. }
  5178. //当前元素的序号
  5179. var thisJcjyItemGroupId = null;
  5180. //前一个兄弟节点的序号
  5181. var prevJcjyItemGroupId = null;
  5182. //当是项目时有序号,进行序号调整
  5183. if ($(parentObject).find("span.jcjyItemGroupId") != null) {
  5184. thisJcjyItemGroupId = $(parentObject).find("span.jcjyItemGroupId").html();
  5185. prevJcjyItemGroupId = $(parentObject).prev().find("span.jcjyItemGroupId").html();
  5186. $(parentObject).find("span.jcjyItemGroupId").html(prevJcjyItemGroupId);
  5187. $(parentObject).prev().find("span.jcjyItemGroupId").html(thisJcjyItemGroupId);
  5188. }
  5189. $(parentObject).prev().before($(parentObject));
  5190. }
  5191. /**
  5192. * 下移
  5193. * @param obj
  5194. */
  5195. function arrowDown(obj) {
  5196. var parentObject = $(obj).parent();
  5197. if ($(parentObject).next() == null) {
  5198. return;
  5199. }
  5200. //当前元素的序号
  5201. var thisJcjyItemGroupId = null;
  5202. //后一个兄弟节点的序号
  5203. var afterJcjyItemGroupId = null;
  5204. //当是项目时有序号,进行序号调整
  5205. if ($(parentObject).find("span.jcjyItemGroupId") != null) {
  5206. thisJcjyItemGroupId = $(parentObject).find("span.jcjyItemGroupId").html();
  5207. afterJcjyItemGroupId = $(parentObject).after().find("span.jcjyItemGroupId").html();
  5208. $(parentObject).find("span.jcjyItemGroupId").html(afterJcjyItemGroupId);
  5209. $(parentObject).after().find("span.jcjyItemGroupId").html(thisJcjyItemGroupId);
  5210. }
  5211. $(parentObject).next().after($(parentObject));
  5212. }
  5213. /**
  5214. * 修改西药
  5215. * @param obj
  5216. */
  5217. function editWesternMedicine(obj) {
  5218. clearWesternMedicine(true);
  5219. //是新增药品还是编辑 true 修改 默认false
  5220. $("#western_medicine_update_flag").val(true);
  5221. var parentObject = $(obj).parent();
  5222. //组号
  5223. $("#groupId").val($(parentObject).find("input.temporary_items_groupId").val());
  5224. //组号有可能会修改,所以,判断的时候要用原组号
  5225. $("#western_medicine_ori_group_id").val($(parentObject).find("input.temporary_items_groupId").val());
  5226. $('#groupId').selectpicker('refresh');
  5227. //药品名称
  5228. $("#western_medicine_name").val($(parentObject).find("input.temporary_items_westernMedicineNamme").val());
  5229. var code = $(parentObject).find("input.temporary_items_code").val();
  5230. var serial = $(parentObject).find("input.temporary_items_serial").val();
  5231. //当前药品编码
  5232. $("#western_medicine_current_code").val(code);
  5233. //当前药品规格
  5234. $("#western_medicine_current_serial").val(serial);
  5235. //当前修改药品原始编码
  5236. $("#update_ori_code").val(code);
  5237. //当前修改的药品原始规格
  5238. $("#update_ori_serial").val(serial);
  5239. //用法编码
  5240. $("#supplyType").val($(parentObject).find("input.temporary_items_supplyType").val());
  5241. $('#supplyType').selectpicker('refresh');
  5242. $("#xyHospApprFlag").val($(parentObject).find("input.temporary_items_xyHospApprFlag").val());
  5243. $('#xyHospApprFlag').selectpicker('refresh');
  5244. //药品默认单次使用剂量
  5245. $("#drugWinDb").val($(parentObject).find("input.temporary_items_drugWinDb").val());
  5246. //处方实际单次使用剂量
  5247. $("#drugWin").val($(parentObject).find("input.temporary_items_drugWin").val());
  5248. //天数
  5249. $("#dayNum").val($(parentObject).find("input.temporary_items_dayNum").val());
  5250. $('#dayNum').selectpicker('refresh');
  5251. //频次编码
  5252. $("#orderFrequency").val($(parentObject).find("input.temporary_items_orderFrequency").val());
  5253. $('#orderFrequency').selectpicker('refresh');
  5254. //总量
  5255. $("#gross").val($(parentObject).find("input.temporary_items_gross").val());
  5256. //医嘱
  5257. $("#medicalAdvice").val($(parentObject).find("input.temporary_items_medicalAdvice").val());
  5258. $('#medicalAdvice').selectpicker('refresh');
  5259. //金额
  5260. $("#totalRetprice").val($(parentObject).find("input.temporary_items_amount").val());
  5261. //单价
  5262. $("#packRetprice").val($(parentObject).find("input.temporary_items_packRetprice").val());
  5263. //皮试结果
  5264. var tryResult = $(parentObject).find("input.temporary_items_tryResult").val();
  5265. //设置当前药品类型
  5266. $("#current_groupNo").val($(parentObject).find("input.temporary_items_currentGroupNo").val());
  5267. //设置当前药品大类
  5268. $("#categoriesFlag").val($(parentObject).find("input.temporary_items_categoriesFlag").val());
  5269. $.ajax({
  5270. type: "GET",
  5271. url: '/thmz/getYpZdDictByCodeAndSerial?code=' + code + "&serial=" + serial + "&deptNo=" + localStorage.getItem("currentDeptNo") + "&groupNo=71",
  5272. contentType: "application/json;charset=UTF-8",
  5273. dataType: "json",
  5274. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5275. success: function (res) {
  5276. if (res == '401' || res == 401) {
  5277. window.location.href = '/thmz/login/view'
  5278. return;
  5279. }
  5280. if (res.code == 0) {
  5281. if (res.data != null) {
  5282. var drugWinHtml = '';
  5283. if (res.data.weight != null) {
  5284. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  5285. $("#drugWin").val(res.data.weight);
  5286. $("#drugWinDb").val(res.data.weight);
  5287. }
  5288. drugWinHtml = '<option value="' + res.data.weighUnit + '" desc="' + res.data.weight + '">' + res.data.weighUnitDesc + '</option>';
  5289. }
  5290. if (res.data.volum != null) {
  5291. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  5292. $("#drugWin").val(res.data.volum);
  5293. $("#drugWinDb").val(res.data.volum);
  5294. }
  5295. drugWinHtml += '<option value="' + res.data.volUnit + '" desc="' + res.data.volum + '">' + res.data.volUnitDesc + '</option>';
  5296. }
  5297. if (res.data.miniUnit != null && res.data.miniUnit != "") {
  5298. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  5299. $("#drugWin").val(1);
  5300. $("#drugWinDb").val(1);
  5301. }
  5302. drugWinHtml += '<option value="' + res.data.miniUnit + '" desc="1">' + res.data.miniUnitDesc + '</option>';
  5303. }
  5304. $('#drugWinUnit').html(drugWinHtml);
  5305. $('#drugWinUnit').selectpicker('refresh');
  5306. //剂量单位
  5307. $("#drugWinUnit").val($(parentObject).find("input.temporary_items_drugWinUnit").val());
  5308. $('#drugWinUnit').selectpicker('refresh');
  5309. if (res.data.packUnitDesc != null && res.data.packUnitDesc != "") {
  5310. var html = '<option value="' + res.data.packUnitDesc + '" >' + res.data.packUnitDesc + '</option>';
  5311. $('#packUnit').html(html);
  5312. $('#packUnit').selectpicker('refresh');
  5313. //包装单位
  5314. $("#packUnit").val($(parentObject).find("input.temporary_items_packUnit").val());
  5315. $('#packUnit').selectpicker('refresh');
  5316. }
  5317. if (res.data.psFlag != null && (res.data.psFlag == 1 || res.data.psFlag == "1")) {
  5318. if (res.data.categoriesFlag == 0 || res.data.categoriesFlag == "0" || res.data.categoriesFlag == 2 || res.data.categoriesFlag == "2") {
  5319. initTryResultSelect(res.data.categoriesFlag);
  5320. $("#tryResult").val(tryResult);
  5321. $('#tryResult').selectpicker('refresh');
  5322. }
  5323. }
  5324. $("#packSize").val(res.data.packSize);
  5325. //厂家名称
  5326. $("#manufactoryName").val(res.data.manufactoryName);
  5327. //规格
  5328. $("#specification").val(res.data.specification);
  5329. }
  5330. } else {
  5331. errorMesage(res);
  5332. }
  5333. }
  5334. });
  5335. }
  5336. /**
  5337. * 修改中药
  5338. * @param obj
  5339. */
  5340. function editChineseMedicine(obj) {
  5341. //是新增药品还是编辑 true 修改 默认false
  5342. $("#chinese_medicine_update_flag").val(true);
  5343. var parentObject = $(obj).parent();
  5344. //当前药品编码
  5345. $("#chinese_medicine_current_code").val($(parentObject).find("input.temporary_items_code").val());
  5346. //当前药品规格
  5347. $("#chinese_medicine_current_serial").val($(parentObject).find("input.temporary_items_serial").val());
  5348. //当前修改药品原始编码
  5349. $("#update_ori_code").val($(parentObject).find("input.temporary_items_code").val());
  5350. //当前修改的药品原始规格
  5351. $("#update_ori_serial").val($(parentObject).find("input.temporary_items_serial").val());
  5352. //中药类型
  5353. $("#zyClassType").val($(parentObject).find("input.temporary_items_zyClassType").val());
  5354. $('#zyClassType').selectpicker('refresh');
  5355. //药品名称
  5356. $("#chinese_medicine_name").val($(parentObject).find("input.temporary_items_chineseMedicineNamme").val());
  5357. //单价
  5358. $("#zy_packRetprice").val($(parentObject).find("input.temporary_items_zyPackRetprice").val());
  5359. //处方实际单次使用剂量
  5360. $("#zy_drugWin").val($(parentObject).find("input.temporary_items_drugWin").val());
  5361. //医嘱码
  5362. $("#zyInstruction").val($(parentObject).find("input.temporary_items_zyInstruction").val());
  5363. $('#zyInstruction').selectpicker('refresh');
  5364. $("#zyHospApprFlag").val($(parentObject).find("input.temporary_items_zyHospApprFlag").val());
  5365. $('#zyHospApprFlag').selectpicker('refresh');
  5366. }
  5367. /**
  5368. * 修改辅助检查、检验项目
  5369. * @param obj
  5370. */
  5371. function editJyJcItem(obj) {
  5372. //是新增药品还是编辑 true 修改 默认false
  5373. $("#jcjy_update_flag").val(true);
  5374. var parentObject = $(obj).parent();
  5375. //当前项目编码
  5376. $("#jcjy_current_code").val($(parentObject).find("input.temporary_items_code").val());
  5377. $("#update_ori_code").val($(parentObject).find("input.temporary_items_code").val());
  5378. //项目名称
  5379. $("#jcJyItem").val($(parentObject).find("input.temporary_items_jcJyItemName").val());
  5380. //单价
  5381. $("#jcjyItemPrice").val($(parentObject).find("input.temporary_items_amount").val());
  5382. //备注
  5383. $("#remark").val($(parentObject).find("input.temporary_items_remark").val());
  5384. var chargeUnit = $(parentObject).find("input.temporary_items_desc_value").val();
  5385. var jcJyZltype = $(parentObject).find("input.temporary_items_type").val();
  5386. //执行科室
  5387. var execUnit = $(parentObject).find("input.temporary_items_execUnit").val();
  5388. $("#execUnit").selectpicker('val', execUnit);
  5389. $('#execUnit').selectpicker('refresh');
  5390. if (jcJyZltype == 1 || jcJyZltype == "1") {
  5391. $("#jyZdSample").selectpicker('val', chargeUnit);
  5392. $('#jyZdSample').selectpicker('refresh');
  5393. $("#jyZdSampleDiv").removeClass("hide").addClass("in");
  5394. $("#jyQuantityDiv").removeClass("hide").addClass("in");
  5395. $("#yshPartDiv").removeClass("in").addClass("hide");
  5396. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  5397. //数量
  5398. var jyQuantity = $(parentObject).find("input.temporary_items_jyQuantity").val();
  5399. $("#jyQuantity").val(jyQuantity);
  5400. } else if (jcJyZltype == 2 || jcJyZltype == "2") {
  5401. $("#yshPart").selectpicker('val', chargeUnit);
  5402. $('#yshPart').selectpicker('refresh');
  5403. $("#yshPartDiv").removeClass("hide").addClass("in");
  5404. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  5405. $("#jyQuantityDiv").removeClass("in").addClass("hide");
  5406. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  5407. }
  5408. $("#jcJyZltype").val(jcJyZltype);
  5409. }
  5410. /**
  5411. * 修改外配药
  5412. * @param obj
  5413. */
  5414. function editWpMedicine(obj) {
  5415. //是新增药品还是编辑 true 修改 默认false
  5416. $("#wp_medicine_update_flag").val(true);
  5417. var parentObject = $(obj).parent();
  5418. //当前编码
  5419. $("#wp_medicine_current_code").val($(parentObject).find("input.temporary_items_code").val());
  5420. //类别
  5421. $("#rxItemTypeCode").val($(parentObject).find("input.temporary_items_rxItemTypeCode").val());
  5422. $('#rxItemTypeCode').selectpicker('refresh');
  5423. //用法
  5424. $("#medcWayCodg").val($(parentObject).find("input.temporary_items_medcWayCodg").val());
  5425. $('#medcWayCodg').selectpicker('refresh');
  5426. //天数
  5427. $("#medcDays").val($(parentObject).find("input.temporary_items_medcDays").val())
  5428. $('#medcDays').selectpicker('refresh');
  5429. //药品名称
  5430. $("#wp_medicine_name").val($(parentObject).find("input.temporary_items_wpMedicineName").val())
  5431. //最小剂量单位
  5432. $("#sinDosunt").val($(parentObject).find("input.temporary_items_sinDosunt").val())
  5433. //剂型
  5434. $("#drugDosform").val($(parentObject).find("input.temporary_items_drugDosform").val())
  5435. //最小剂量
  5436. $("#sinDoscnt").val($(parentObject).find("input.temporary_items_sinDoscnt").val())
  5437. //频次
  5438. $("#usedFrquCodg").val($(parentObject).find("input.temporary_items_usedFrquCodg").val());
  5439. $('#usedFrquCodg').selectpicker('refresh');
  5440. //单位
  5441. $("#drugDosunt").val($(parentObject).find("input.temporary_items_drugDosunt").val())
  5442. //总量
  5443. $("#drugCnt").val($(parentObject).find("input.temporary_items_drugCnt").val())
  5444. //规格
  5445. $("#drugSpec").val($(parentObject).find("input.temporary_items_drugSpec").val())
  5446. //报销自费标识
  5447. $("#wpHospApprFlag").val($(parentObject).find("input.temporary_items_wpHospApprFlag").val())
  5448. $('#wpHospApprFlag').selectpicker('refresh');
  5449. //厂家
  5450. $("#prdrName").val($(parentObject).find("input.temporary_items_prdrName").val())
  5451. }
  5452. /**
  5453. * 修改诊疗项目
  5454. * @param obj
  5455. */
  5456. function editZlItem(obj) {
  5457. //是新增药品还是编辑 true 修改 默认false
  5458. $("#zl_update_flag").val(true);
  5459. var parentObject = $(obj).parent();
  5460. //当前项目编码
  5461. $("#zl_current_code").val($(parentObject).find("input.temporary_items_code").val());
  5462. $("#update_ori_code").val($(parentObject).find("input.temporary_items_code").val());
  5463. //项目名称
  5464. $("#zlItem").val($(parentObject).find("input.temporary_items_zlItemName").val());
  5465. //单价
  5466. $("#zlItemPrice").val($(parentObject).find("input.temporary_items_amount").val());
  5467. //备注
  5468. $("#zlRemark").val($(parentObject).find("input.temporary_items_remark").val());
  5469. var chargeUnit = $(parentObject).find("input.temporary_items_desc_value").val();
  5470. //数量
  5471. var itemQuantity = $(parentObject).find("input.temporary_items_itemQuantity").val();
  5472. //执行科室
  5473. var execUnit = $(parentObject).find("input.temporary_items_execUnit").val();
  5474. $("#zlHospApprFlag").val($(parentObject).find("input.temporary_items_zlHospApprFlag").val());
  5475. $('#zlHospApprFlag').selectpicker('refresh');
  5476. var descriptions = $(parentObject).find("input.temporary_items_code").val();
  5477. if (descriptions != null && descriptions != "" && descriptions != 'null') {
  5478. $("#descriptions").val(descriptions);
  5479. }
  5480. var dayZlNum = $(parentObject).find("input.temporary_items_dayZlNum").val();
  5481. if (dayZlNum != null && dayZlNum != "" && dayZlNum != 'null') {
  5482. $("#dayZlNum").selectpicker('val', dayZlNum);
  5483. $('#dayZlNum').selectpicker('refresh');
  5484. }
  5485. var orderFrequencyZl = $(parentObject).find("input.temporary_items_orderFrequencyZl").val();
  5486. if (orderFrequencyZl != null && orderFrequencyZl != "" && orderFrequencyZl != 'null') {
  5487. $("#orderFrequencyZl").selectpicker('val', orderFrequencyZl);
  5488. $('#orderFrequencyZl').selectpicker('refresh');
  5489. }
  5490. var totalNumZl = $(parentObject).find("input.temporary_items_totalNumZl").val();
  5491. if (totalNumZl != null && totalNumZl != "" && totalNumZl != 'null') {
  5492. $("#totalNumZl").val(totalNumZl);
  5493. }
  5494. $("#zlExecUnit").selectpicker('val', execUnit);
  5495. $('#zlExecUnit').selectpicker('refresh');
  5496. //描述
  5497. $("#chargeUnit").val(chargeUnit);
  5498. $("#itemQuantity").val(itemQuantity);
  5499. calculateZl(true);
  5500. }
  5501. /**
  5502. * 保存当前辅助检查、检验项目到右边处方区域 需要提示加价
  5503. * @param calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  5504. */
  5505. function saveJyJcItem(calculateTotalAmountFlag) {
  5506. //6岁内提示加价
  5507. var patientAge = $("#patientAge").text();
  5508. if (calculateTotalAmountFlag && patientAge != null && patientAge != "" && patientAge <= 6) {
  5509. $.ajax({
  5510. type: "GET",
  5511. url: '/thmz/checkAdditionally?code=' + $("#jcjy_current_code").val() + "&jcJyZltype=" + $("#jcJyZltype").val(),
  5512. contentType: "application/json;charset=UTF-8",
  5513. dataType: "json",
  5514. async: false,
  5515. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5516. success: function (res) {
  5517. if (res == '401' || res == 401) {
  5518. window.location.href = '/thmz/login/view'
  5519. return;
  5520. }
  5521. if (res.code == 0) {
  5522. if (res.data != undefined && res.data != null && res.data.co != null && res.data.co == 1 && res.data.xlCode != null && res.data.xlCode != "") {
  5523. var xlCode = res.data.xlCode;
  5524. xlCode = Multiply(100, xlCode);
  5525. $("#messageModal").modal();
  5526. $("#messageContent").html("根据【湘医保发〔2020〕51 号】价格通知,不满7周岁的儿童诊疗费上调" + xlCode + "%,是否需要继续添加该项目?");
  5527. $("#messageButton").off("click").on("click", function (t) {
  5528. $("#messageModal").modal("hide");
  5529. saveJyJcItemReal(calculateTotalAmountFlag);
  5530. });
  5531. $("#cancelButton").off("click");
  5532. } else {
  5533. //虽然是不满6岁,但是也没有需要加收的项目,直接保存
  5534. saveJyJcItemReal(calculateTotalAmountFlag);
  5535. }
  5536. } else {
  5537. errorMesage(res);
  5538. }
  5539. }
  5540. });
  5541. } else {
  5542. saveJyJcItemReal(calculateTotalAmountFlag);
  5543. }
  5544. }
  5545. /**
  5546. * 保存当前项目到右边处方区域
  5547. * @param calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  5548. */
  5549. function saveJyJcItemReal(calculateTotalAmountFlag) {
  5550. var tableId = $("#jcjyTab li.active").find("a").attr("href");
  5551. //组号
  5552. var groupId = $(tableId).find("div:eq(0)").children().length + 1;
  5553. //项目名称
  5554. var jcJyItem = $("#jcJyItem").val();
  5555. //当前项目编码
  5556. var currentCode = $("#jcjy_current_code").val();
  5557. //当前项目价格
  5558. var jcjyItemPrice = $("#jcjyItemPrice").val();
  5559. //执行科室
  5560. var execUnit = $("#execUnit").val();
  5561. //执行科室
  5562. var execUnitName = $('#execUnit option:selected').text();
  5563. execUnitName = execUnitName.substring(0, execUnitName.indexOf("("));
  5564. //描述编码
  5565. var chargeUnitCode = null;
  5566. var chargeUnitName = "";
  5567. //检验物或者检查部位
  5568. var chargeUnit = null;
  5569. //检验数量
  5570. var jyQuantity = null;
  5571. //备注
  5572. var remark = $("#remark").val();
  5573. //项目类型
  5574. var jcJyZltype = $("#jcJyZltype").val();
  5575. if (jcJyZltype == "1" || jcJyZltype == 1) {
  5576. //检验
  5577. chargeUnit = $('#jyZdSample option:selected').text();
  5578. chargeUnit = chargeUnit.substring(0, chargeUnit.indexOf("("));
  5579. chargeUnitCode = $('#jyZdSample').val();
  5580. chargeUnitName = " 检验物:";
  5581. jyQuantity = $('#jyQuantity').val();
  5582. if (calculateTotalAmountFlag == true) {
  5583. if (jyQuantity == null || jyQuantity == "") {
  5584. errorMesageSimaple("检验项目数量为空!");
  5585. return;
  5586. }
  5587. if (jyQuantity <= 0) {
  5588. errorMesageSimaple("检验项目数量不能小于1!");
  5589. return;
  5590. }
  5591. }
  5592. } else if (jcJyZltype == "2" || jcJyZltype == 2) {
  5593. //检查
  5594. chargeUnit = $('#yshPart option:selected').text();
  5595. chargeUnit = chargeUnit.substring(0, chargeUnit.indexOf("("));
  5596. chargeUnitCode = $('#yshPart').val();
  5597. chargeUnitName = " 检查部位:";
  5598. }
  5599. if (currentCode == null || currentCode == '') {
  5600. if (calculateTotalAmountFlag == true) {
  5601. errorMesageSimaple("未选择任何项目!");
  5602. }
  5603. return;
  5604. }
  5605. //判断是否有重复的项目 返回true 说明有重复的
  5606. //彩超加收一个部位的不限制多开
  5607. if ("003913" != currentCode && verifyRepeat(currentCode, null, chargeUnitCode, 2)) {
  5608. return;
  5609. }
  5610. //原药品金额 如果是修改则需要设置
  5611. var temporaryItemsAmount = 0;
  5612. //当前需要被移除元素的下个兄弟节点
  5613. var nextObj = null;
  5614. //当前修改的药品是不是最后一个
  5615. var isLast = false;
  5616. //是新增药品还是编辑 true 修改 默认false
  5617. var updateFlag = $("#jcjy_update_flag").val();
  5618. if (updateFlag == undefined || updateFlag == null) {
  5619. updateFlag = false;
  5620. }
  5621. //如果是修改,需要减去原来的费用
  5622. //原组号
  5623. var oriGroupId = null;
  5624. if (updateFlag == "true" || updateFlag == true) {
  5625. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  5626. if (formGroups != null && formGroups.length > 0) {
  5627. var updateOriCode = $("#update_ori_code").val();
  5628. for (var i = 0; i < formGroups.length; i++) {
  5629. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  5630. if (temporaryItemsCode === updateOriCode) {
  5631. temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  5632. if (formGroups.length > 1) {
  5633. nextObj = $(formGroups[i]).next();
  5634. }
  5635. isLast = (i + 1) === formGroups.length;
  5636. oriGroupId = $(formGroups[i]).find("span.jcjyItemGroupId").text();
  5637. $(formGroups[i]).remove();
  5638. break;
  5639. }
  5640. }
  5641. }
  5642. }
  5643. if (oriGroupId != null) {
  5644. groupId = oriGroupId;
  5645. }
  5646. var html = '<div class="form-group">';
  5647. html += '<span class="jcjyItemGroupId">' + groupId + '</span>.<span style="margin-left: 5px"></span>'
  5648. html += jcJyItem + ' ';
  5649. if (jcJyZltype == "3" || jcJyZltype == 3) {
  5650. html += " 数量:" + itemQuantity;
  5651. }
  5652. if (execUnit != null && execUnit != "") {
  5653. html += " 执行科室:" + execUnitName;
  5654. }
  5655. if (chargeUnit != null && chargeUnit != '') {
  5656. html += chargeUnitName + chargeUnit;
  5657. }
  5658. if (remark != null && remark != '') {
  5659. html += ' 备注:' + remark;
  5660. }
  5661. 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>';
  5662. 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>';
  5663. 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>';
  5664. 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>';
  5665. if ($("#jcJyItemChargeDetail").hasClass("in")) {
  5666. 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>';
  5667. }
  5668. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  5669. html += '<input type="hidden" class="temporary_items_jcJyItemName" value="' + jcJyItem + '"/>';
  5670. html += '<input type="hidden" class="temporary_items_amount" value="' + jcjyItemPrice + '"/>';
  5671. html += '<input type="hidden" class="temporary_items_remark" value="' + remark + '"/>';
  5672. html += '<input type="hidden" class="temporary_items_type" value="' + jcJyZltype + '"/>';
  5673. html += '<input type="hidden" class="temporary_items_desc_value" value="' + chargeUnitCode + '"/>';
  5674. html += '<input type="hidden" class="temporary_items_execUnit" value="' + execUnit + '"/>';
  5675. if (jyQuantity != null) {
  5676. html += '<input type="hidden" class="temporary_items_jyQuantity" value="' + jyQuantity + '"/>';
  5677. }
  5678. html += '</div>';
  5679. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  5680. if (nextObj == null || isLast) {
  5681. $(tableId).find("div:eq(0)").append(html);
  5682. } else {
  5683. $(nextObj).before(html);
  5684. }
  5685. //设置当前处方金额
  5686. //calculateCfAmount(tableId, jcjyItemPrice, temporaryItemsAmount, 2, 0);
  5687. if (calculateTotalAmountFlag) {
  5688. //设置总金额
  5689. calculateTotalAmount(true);
  5690. }
  5691. clearJyJcItem();
  5692. }
  5693. /**
  5694. * 保存外配处方到右方区域
  5695. */
  5696. function saveWpOrder(needCalcu) {
  5697. if ($("#wpMedicineTab").find("li") == null || $("#wpMedicineTab").find("li").length == 0) {
  5698. initNavTabs(6, null, null);
  5699. }
  5700. var tableId = $("#wpMedicineTab li.active").find("a").attr("href");
  5701. //组号
  5702. var groupId = $(tableId).find("div:eq(0)").children().length + 1;
  5703. //药品名称
  5704. var wpMedicineName = $("#wp_medicine_name").val();
  5705. //当前药品编码
  5706. var currentCode = $("#wp_medicine_current_code").val();
  5707. //药品类别
  5708. var rxItemTypeCode = $("#rxItemTypeCode").val();
  5709. //用法
  5710. var medcWayCodg = $("#medcWayCodg").val();
  5711. //天数
  5712. var medcDays = $("#medcDays").val();
  5713. //最小剂量单位
  5714. var sinDosunt = $("#sinDosunt").val();
  5715. //剂量
  5716. var sinDoscnt = $("#sinDoscnt").val();
  5717. //剂型
  5718. var drugDosform = $("#drugDosform").val();
  5719. //用法名称
  5720. var medcWayCodgName = $('#medcWayCodg option:selected').text();
  5721. //频次
  5722. var usedFrquCodg = $("#usedFrquCodg").val();
  5723. var usedFrquCodgName = $('#usedFrquCodg option:selected').text();
  5724. //单位
  5725. var drugDosunt = $("#drugDosunt").val();
  5726. //总量
  5727. var drugCnt = $("#drugCnt").val();
  5728. //规格
  5729. var drugSpec = $("#drugSpec").val();
  5730. //报销自费标识
  5731. var wpHospApprFlag = $("#wpHospApprFlag").val();
  5732. if (currentCode == null || currentCode == '') {
  5733. errorMesageSimaple("未选择任何药品!");
  5734. return;
  5735. }
  5736. if(stringIsBlank(rxItemTypeCode)){
  5737. errorMesageSimaple("未选择药品类别!");
  5738. return;
  5739. }
  5740. if(stringIsBlank(medcWayCodg)){
  5741. errorMesageSimaple("未选择用法!");
  5742. return;
  5743. }
  5744. if(stringIsBlank(usedFrquCodg)){
  5745. errorMesageSimaple("未选择频次!");
  5746. return;
  5747. }
  5748. if(stringIsBlank(medcDays)){
  5749. errorMesageSimaple("未选择天数!");
  5750. return;
  5751. }
  5752. if(stringIsBlank(sinDoscnt)){
  5753. errorMesageSimaple("未填写剂量!");
  5754. return;
  5755. }
  5756. if(stringIsBlank(drugCnt)){
  5757. errorMesageSimaple("未填写总量!");
  5758. return;
  5759. }
  5760. //判断是否有重复的项目 返回true 说明有重复的
  5761. if (verifyRepeat(currentCode, null, null, 6)) {
  5762. return;
  5763. }
  5764. //当前需要被移除元素的下个兄弟节点
  5765. var nextObj = null;
  5766. //当前修改的药品是不是最后一个
  5767. var isLast = false;
  5768. //是新增药品还是编辑 true 修改 默认false
  5769. var updateFlag = $("#wp_medicine_update_flag").val();
  5770. if (updateFlag == undefined || updateFlag == null) {
  5771. updateFlag = false;
  5772. }
  5773. if (updateFlag == "true" || updateFlag == true) {
  5774. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  5775. if (formGroups != null && formGroups.length > 0) {
  5776. var updateOriCode = $("#update_ori_code").val();
  5777. for (var i = 0; i < formGroups.length; i++) {
  5778. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  5779. if (temporaryItemsCode === updateOriCode) {
  5780. if (formGroups.length > 1) {
  5781. nextObj = $(formGroups[i]).next();
  5782. }
  5783. isLast = (i + 1) === formGroups.length;
  5784. $(formGroups[i]).remove();
  5785. break;
  5786. }
  5787. }
  5788. }
  5789. }
  5790. //厂家
  5791. var prdrName = $("#prdrName").val();
  5792. var html = '<div class="form-group">';
  5793. html += wpMedicineName;
  5794. if (prdrName != null && prdrName != 'null' && prdrName != "") {
  5795. html += "(" + prdrName + ")"
  5796. }
  5797. html += '&nbsp;&nbsp;&nbsp;&nbsp;';
  5798. html += drugSpec;
  5799. html += '&nbsp;&nbsp;&nbsp;&nbsp;X&nbsp;&nbsp;';
  5800. html += drugCnt + drugDosunt + " " + '<br/><span style="margin-left: 15px"></span>';
  5801. html += '用法:' + medcWayCodgName + ' ';
  5802. html += sinDoscnt + sinDosunt + ' ';
  5803. html += '频次:' + usedFrquCodgName + ' ';
  5804. html += medcDays + '天 ';
  5805. 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>';
  5806. 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>';
  5807. html += ' <i class="fa fa-long-arrow-left" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;" onclick="editWpMedicine(this)"></i>';
  5808. html += '<i class="fa fa-remove" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;margin-left: 10px;" onclick="removeYpOrProject(6,this)"></i>';
  5809. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  5810. html += '<input type="hidden" class="temporary_items_wpMedicineGroupId" value="' + groupId + '"/>';
  5811. html += '<input type="hidden" class="temporary_items_wpMedicineName" value="' + wpMedicineName + '"/>';
  5812. html += '<input type="hidden" class="temporary_items_rxItemTypeCode" value="' + rxItemTypeCode + '"/>';
  5813. html += '<input type="hidden" class="temporary_items_medcWayCodg" value="' + medcWayCodg + '"/>';
  5814. html += '<input type="hidden" class="temporary_items_medcDays" value="' + medcDays + '"/>';
  5815. html += '<input type="hidden" class="temporary_items_prdrName" value="' + prdrName + '"/>';
  5816. html += '<input type="hidden" class="temporary_items_sinDosunt" value="' + sinDosunt + '"/>';
  5817. html += '<input type="hidden" class="temporary_items_drugDosform" value="' + drugDosform + '"/>';
  5818. html += '<input type="hidden" class="temporary_items_sinDoscnt" value="' + sinDoscnt + '"/>';
  5819. html += '<input type="hidden" class="temporary_items_usedFrquCodg" value="' + usedFrquCodg + '"/>';
  5820. html += '<input type="hidden" class="temporary_items_drugDosunt" value="' + drugDosunt + '"/>';
  5821. html += '<input type="hidden" class="temporary_items_drugCnt" value="' + drugCnt + '"/>';
  5822. html += '<input type="hidden" class="temporary_items_drugSpec" value="' + drugSpec + '"/>';
  5823. html += '<input type="hidden" class="temporary_items_wpHospApprFlag" value="' + wpHospApprFlag + '"/>';
  5824. html += '</div>';
  5825. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  5826. if (nextObj == null || isLast) {
  5827. $(tableId).find("div:eq(0)").append(html);
  5828. } else {
  5829. $(nextObj).before(html);
  5830. }
  5831. if(needCalcu){
  5832. calculateTotalAmount(true)
  5833. }
  5834. clearWpOrder();
  5835. }
  5836. /**
  5837. * 保存当前诊疗项目到右边处方区域 需要提示加价
  5838. * @param calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  5839. */
  5840. function saveZlItem(calculateTotalAmountFlag) {
  5841. //6岁内提示加价
  5842. var patientAge = $("#patientAge").text();
  5843. if (calculateTotalAmountFlag && patientAge != null && patientAge != "" && patientAge <= 6) {
  5844. $.ajax({
  5845. type: "GET",
  5846. url: '/thmz/checkAdditionally?code=' + $("#zl_current_code").val() + "&jcJyZltype=3",
  5847. contentType: "application/json;charset=UTF-8",
  5848. dataType: "json",
  5849. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5850. async: false,
  5851. success: function (res) {
  5852. if (res == '401' || res == 401) {
  5853. window.location.href = '/thmz/login/view'
  5854. return;
  5855. }
  5856. if (res.code == 0) {
  5857. if (res.data != undefined && res.data != null && res.data.co != null && res.data.co == 1 && res.data.xlCode != null && res.data.xlCode != "") {
  5858. var xlCode = res.data.xlCode;
  5859. xlCode = Multiply(100, xlCode);
  5860. $("#messageModal").modal();
  5861. $("#messageContent").html("根据【湘医保发〔2020〕51 号】价格通知,不满7周岁的儿童诊疗费上调" + xlCode + "%,是否需要继续添加该项目?");
  5862. $("#messageButton").off("click").on("click", function (t) {
  5863. $("#messageModal").modal("hide");
  5864. saveZlItemReal(calculateTotalAmountFlag);
  5865. });
  5866. $("#cancelButton").off("click");
  5867. } else {
  5868. //虽然是不满6岁,但是也没有需要加收的项目,直接保存
  5869. saveZlItemReal(calculateTotalAmountFlag);
  5870. }
  5871. } else {
  5872. errorMesage(res);
  5873. }
  5874. }
  5875. });
  5876. } else {
  5877. saveZlItemReal(calculateTotalAmountFlag);
  5878. }
  5879. }
  5880. /**
  5881. * 保存当前项目到右边处方区域
  5882. * @param calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  5883. */
  5884. function saveZlItemReal(calculateTotalAmountFlag) {
  5885. var tableId = $("#zlTab li.active").find("a").attr("href");
  5886. //组号
  5887. var groupId = $(tableId).find("div:eq(0)").children().length + 1;
  5888. //项目名称
  5889. var zlItem = $("#zlItem").val();
  5890. //当前项目编码
  5891. var currentCode = $("#zl_current_code").val();
  5892. //当前项目价格
  5893. var zlItemPrice = $("#zlItemPrice").val();
  5894. //单位
  5895. var chargeUnit = $("#chargeUnit").val();
  5896. //执行科室
  5897. var zlExecUnit = $("#zlExecUnit").val();
  5898. //执行科室
  5899. var zlExecUnitName = $('#zlExecUnit option:selected').text();
  5900. zlExecUnitName = zlExecUnitName.substring(0, zlExecUnitName.indexOf("("));
  5901. //单量
  5902. var itemQuantity = $("#itemQuantity").val();
  5903. //规格
  5904. var descriptions = $("#descriptions").val();
  5905. //天数
  5906. var dayZlNum = $("#dayZlNum").val();
  5907. //频次
  5908. var orderFrequencyZl = $("#orderFrequencyZl").val();
  5909. //总量
  5910. var totalNumZl = $("#totalNumZl").val();
  5911. //描述编码
  5912. var chargeUnitCode = chargeUnit;
  5913. //备注
  5914. var remark = $("#zlRemark").val();
  5915. //报销自费标识
  5916. var zlHospApprFlag = $("#zlHospApprFlag").val();
  5917. if (calculateTotalAmountFlag == true) {
  5918. if (currentCode == null || currentCode == '') {
  5919. errorMesageSimaple("未选择任何项目!");
  5920. return;
  5921. }
  5922. if (totalNumZl == null || totalNumZl == "" || totalNumZl == "null") {
  5923. errorMesageSimaple("项目使用总量为空!");
  5924. return;
  5925. }
  5926. }
  5927. //判断是否有重复的项目 返回true 说明有重复的
  5928. if (verifyRepeat(currentCode, null, null, 3)) {
  5929. return;
  5930. }
  5931. //原药品金额 如果是修改则需要设置
  5932. var temporaryItemsAmount = 0;
  5933. //当前需要被移除元素的下个兄弟节点
  5934. var nextObj = null;
  5935. //当前修改的药品是不是最后一个
  5936. var isLast = false;
  5937. //是新增药品还是编辑 true 修改 默认false
  5938. var updateFlag = $("#zl_update_flag").val();
  5939. if (updateFlag == undefined || updateFlag == null) {
  5940. updateFlag = false;
  5941. }
  5942. //如果是修改,需要减去原来的费用
  5943. //原组号
  5944. var oriGroupId = null;
  5945. if (updateFlag == "true" || updateFlag == true) {
  5946. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  5947. if (formGroups != null && formGroups.length > 0) {
  5948. var updateOriCode = $("#update_ori_code").val();
  5949. for (var i = 0; i < formGroups.length; i++) {
  5950. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  5951. if (temporaryItemsCode === updateOriCode) {
  5952. temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  5953. if (formGroups.length > 1) {
  5954. nextObj = $(formGroups[i]).next();
  5955. }
  5956. isLast = (i + 1) === formGroups.length;
  5957. oriGroupId = $(formGroups[i]).find("span.zlItemGroupId").text();
  5958. $(formGroups[i]).remove();
  5959. break;
  5960. }
  5961. }
  5962. }
  5963. }
  5964. if (oriGroupId != null) {
  5965. groupId = oriGroupId;
  5966. }
  5967. var html = '<div class="form-group">';
  5968. html += '<span class="zlItemGroupId">' + groupId + '</span>.<span style="margin-left: 5px"></span>'
  5969. html += zlItem + ' ';
  5970. if (descriptions != null && descriptions != "") {
  5971. html += " 规格:" + descriptions;
  5972. }
  5973. html += " 单量:" + itemQuantity;
  5974. if (chargeUnit != null && chargeUnit != '') {
  5975. html += chargeUnit;
  5976. }
  5977. if (dayZlNum != null && dayZlNum != "") {
  5978. html += " 天数:" + dayZlNum + "天";
  5979. }
  5980. if (orderFrequencyZl != null && orderFrequencyZl != "") {
  5981. html += " 频次:" + orderFrequencyZl;
  5982. }
  5983. if (totalNumZl != null && totalNumZl != "") {
  5984. html += " 总量:" + totalNumZl;
  5985. if (chargeUnit != null && chargeUnit != '') {
  5986. html += chargeUnit;
  5987. }
  5988. }
  5989. if (zlExecUnit != null && zlExecUnit != "") {
  5990. html += " 执行科室:" + zlExecUnitName;
  5991. }
  5992. if (remark != null && remark != '') {
  5993. html += ' 备注:' + remark;
  5994. }
  5995. 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>';
  5996. 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>';
  5997. 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>';
  5998. 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>';
  5999. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  6000. html += '<input type="hidden" class="temporary_items_zlItemName" value="' + zlItem + '"/>';
  6001. html += '<input type="hidden" class="temporary_items_amount" value="' + zlItemPrice + '"/>';
  6002. html += '<input type="hidden" class="temporary_items_remark" value="' + remark + '"/>';
  6003. html += '<input type="hidden" class="temporary_items_desc_value" value="' + chargeUnitCode + '"/>';
  6004. html += '<input type="hidden" class="temporary_items_itemQuantity" value="' + itemQuantity + '"/>';
  6005. html += '<input type="hidden" class="temporary_items_execUnit" value="' + zlExecUnit + '"/>';
  6006. html += '<input type="hidden" class="temporary_items_descriptions" value="' + descriptions + '"/>';
  6007. html += '<input type="hidden" class="temporary_items_dayZlNum" value="' + dayZlNum + '"/>';
  6008. html += '<input type="hidden" class="temporary_items_orderFrequencyZl" value="' + orderFrequencyZl + '"/>';
  6009. html += '<input type="hidden" class="temporary_items_zlHospApprFlag" value="' + zlHospApprFlag + '"/>';
  6010. html += '<input type="hidden" class="temporary_items_totalNumZl" value="' + totalNumZl + '"/>';
  6011. html += '</div>';
  6012. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  6013. if (nextObj == null || isLast) {
  6014. $(tableId).find("div:eq(0)").append(html);
  6015. } else {
  6016. $(nextObj).before(html);
  6017. }
  6018. //设置当前处方金额
  6019. //calculateCfAmount(tableId, jcjyItemPrice, temporaryItemsAmount, 2, 0);
  6020. if (calculateTotalAmountFlag) {
  6021. //设置总金额
  6022. calculateTotalAmount(true);
  6023. }
  6024. clearZlItem();
  6025. }
  6026. /**
  6027. * 临时保存住院证
  6028. * @param messageFlag 是否需要提醒已经存在的入院申请 true 提示
  6029. */
  6030. function saveZyReq(messageFlag) {
  6031. //如果
  6032. if ($("#zyReqTab").find("li") == null || $("#zyReqTab").find("li").length == 0) {
  6033. initNavTabs(4, null, null);
  6034. }
  6035. var tableId = $("#zyReqTab li.active").find("a").attr("href");
  6036. //病区编码
  6037. var inpatientWardBeHospitalized = $("#inpatientWardBeHospitalized").val();
  6038. //小病室编码
  6039. var smallWardBeHospitalized = $("#smallWardBeHospitalized").val();
  6040. //入院状态编码
  6041. var admissStatus = $("#admissStatus").val();
  6042. //病区名称
  6043. var inpatientWardText = $('#inpatientWardBeHospitalized option:selected').text();
  6044. //小科室名称
  6045. var smallWardText = $('#smallWardBeHospitalized option:selected').text();
  6046. //入院状态名称
  6047. var admissStatusText = $('#admissStatus option:selected').text();
  6048. //入院病情代码
  6049. var conditionCode = $("#conditionCode").val();
  6050. //入院途径代码
  6051. var routeOfAdmission = $("#routeOfAdmission").val();
  6052. //联系人姓名
  6053. var contacterName = $("#contacterName").val();
  6054. //联系人关系
  6055. var contacterRelationship = $("#contacterRelationship").val();
  6056. //联系人电话
  6057. var contacterPhone = $("#contacterPhone").val();
  6058. //联系人地址
  6059. var contacterAddress = $("#contacterAddress").val();
  6060. //押金
  6061. var deposit = $("#deposit").val();
  6062. //入院病情代码
  6063. var conditionCodeText = $('#conditionCode option:selected').text();
  6064. //入院途径代码
  6065. var routeOfAdmissionText = $('#routeOfAdmission option:selected').text();
  6066. if (admissStatusText == null || admissStatusText == '') {
  6067. errorMesageSimaple("未选择入院状态!");
  6068. return;
  6069. }
  6070. if (conditionCode == null || conditionCode == '') {
  6071. errorMesageSimaple("未选择入院病情!");
  6072. return;
  6073. }
  6074. if (routeOfAdmission == null || routeOfAdmission == '') {
  6075. errorMesageSimaple("未选择入院途径!");
  6076. return;
  6077. }
  6078. if (inpatientWardBeHospitalized == null || inpatientWardBeHospitalized == '') {
  6079. errorMesageSimaple("未选择入院病区!");
  6080. return;
  6081. }
  6082. if (admissStatus == null || admissStatus == '') {
  6083. errorMesageSimaple("未选择入院状态!");
  6084. return;
  6085. }
  6086. if (messageFlag == "true" || messageFlag == true) {
  6087. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  6088. if (formGroups != null && formGroups.length > 0) {
  6089. $("#messageModal").modal();
  6090. $("#messageContent").html("当前病人已经有一个暂存的入院申请,是否需要替换该申请?");
  6091. $("#messageButton").off("click").on("click", function (t) {
  6092. $("#messageModal").modal("hide");
  6093. saveZyReq(false);
  6094. });
  6095. $("#cancelButton").off("click");
  6096. return;
  6097. }
  6098. }
  6099. var html = '<div class="form-group"> 收住院';
  6100. if (inpatientWardText != null) {
  6101. html += " [" + inpatientWardText;
  6102. }
  6103. if (smallWardText != null) {
  6104. html += " (" + smallWardText + ") ";
  6105. }
  6106. if (inpatientWardText != null) {
  6107. html += "]";
  6108. }
  6109. if (admissStatusText != null) {
  6110. html += " " + admissStatusText;
  6111. }
  6112. if (conditionCodeText != null) {
  6113. html += " " + conditionCodeText;
  6114. }
  6115. if (routeOfAdmissionText != null) {
  6116. html += " " + routeOfAdmissionText;
  6117. }
  6118. html += ' 侯床';
  6119. //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>';
  6120. 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>';
  6121. html += '<input type="hidden" class="temporary_inpatient_ward" value="' + inpatientWardBeHospitalized + '"/>';
  6122. html += '<input type="hidden" class="temporary_items_small_ward" value="' + smallWardBeHospitalized + '"/>';
  6123. html += '<input type="hidden" class="temporary_items_admiss_status" value="' + admissStatus + '"/>';
  6124. html += '<input type="hidden" class="temporary_items_condition_code" value="' + conditionCode + '"/>';
  6125. html += '<input type="hidden" class="temporary_items_route_of_admission" value="' + routeOfAdmission + '"/>';
  6126. html += '<input type="hidden" class="temporary_items_contacter_name" value="' + contacterName + '"/>';
  6127. html += '<input type="hidden" class="temporary_items_contacter_relationship" value="' + contacterRelationship + '"/>';
  6128. html += '<input type="hidden" class="temporary_items_contacter_phone" value="' + contacterPhone + '"/>';
  6129. html += '<input type="hidden" class="temporary_items_contacter_address" value="' + contacterAddress + '"/>';
  6130. html += '<input type="hidden" class="temporary_items_deposit" value="' + deposit + '"/>';
  6131. html += '</div>';
  6132. $(tableId).find("div:eq(0)").html(html);
  6133. clearZyReq();
  6134. }
  6135. /**
  6136. * 临时保存门诊手术
  6137. * @param messageFlag 是否需要提醒已经存在的相同诊间手术申请 true 提示
  6138. */
  6139. function saveOpRecord(messageFlag) {
  6140. //如果
  6141. if ($("#opRecordTab").find("li") == null || $("#opRecordTab").find("li").length == 0) {
  6142. initNavTabs(5, null, null);
  6143. }
  6144. var tableId = $("#opRecordTab li.active").find("a").attr("href");
  6145. //手术名称编码
  6146. var opCode = $("#opName").val();
  6147. //手术名称
  6148. var opNameText = $('#opName option:selected').text();
  6149. //手术时间
  6150. var opTime = $("#opTime").val();
  6151. //急诊标志
  6152. var urgentClinicFlag = $("#urgentClinicFlag").val();
  6153. //急诊标志名称
  6154. var urgentClinicFlagText = $('#urgentClinicFlag option:selected').text();
  6155. //班次
  6156. var ssbc = $("#ssbc").val();
  6157. //班次名称
  6158. var ssbcText = $('#ssbc option:selected').text();
  6159. //手术部位
  6160. var partCode = $("#partCode").val();
  6161. //手术部位名称
  6162. var partCodeText = $('#partCode option:selected').text();
  6163. //手术等级
  6164. var opScale = $("#opScale").val();
  6165. //手术等级名称
  6166. var opScaleText = $('#opScale option:selected').text();
  6167. //麻醉方式
  6168. var hocusCode = $("#hocusCode").val();
  6169. //麻醉方式名称
  6170. var hocusCodeText = $('#hocusCode option:selected').text();
  6171. //主刀医生
  6172. var doctorZd = $("#doctorZd").val();
  6173. //主刀医生名称
  6174. var doctorZdText = $('#doctorZd option:selected').text();
  6175. var opRecordRemark = $("#opRecordRemark").val();
  6176. if (opCode == null || opCode == '') {
  6177. errorMesageSimaple("手术名称为空!");
  6178. return;
  6179. }
  6180. if (opTime == null || opTime == '') {
  6181. errorMesageSimaple("手术时间为空!");
  6182. return;
  6183. }
  6184. if (urgentClinicFlag == null || urgentClinicFlag == '') {
  6185. errorMesageSimaple("急诊标志为空!");
  6186. return;
  6187. }
  6188. if (ssbc == null || ssbc == '') {
  6189. errorMesageSimaple("班次为空!");
  6190. return;
  6191. }
  6192. if (partCode == null || partCode == '') {
  6193. errorMesageSimaple("手术部位为空!");
  6194. return;
  6195. }
  6196. if (opScale == null || opScale == '') {
  6197. errorMesageSimaple("手术等级为空!");
  6198. return;
  6199. }
  6200. if (hocusCode == null || hocusCode == '') {
  6201. errorMesageSimaple("麻醉方式为空!");
  6202. return;
  6203. }
  6204. if (doctorZd == null || doctorZd == '') {
  6205. errorMesageSimaple("主刀医生为空!");
  6206. return;
  6207. }
  6208. //判断是否有重复的项目 返回true 说明有重复的
  6209. if (verifyRepeat(opName, null, null, 5)) {
  6210. return;
  6211. }
  6212. //当前需要被移除元素的下个兄弟节点
  6213. var nextObj = null;
  6214. //当前修改的手术是不是最后一个
  6215. var isLast = false;
  6216. //是新增药品还是编辑 true 修改 默认false
  6217. var updateFlag = $("#op_record_update_flag").val();
  6218. if (updateFlag == undefined || updateFlag == null) {
  6219. updateFlag = false;
  6220. }
  6221. //如果是修改
  6222. if (updateFlag == "true" || updateFlag == true) {
  6223. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  6224. if (formGroups != null && formGroups.length > 0) {
  6225. var updateOriCode = $("#update_ori_code").val();
  6226. for (var i = 0; i < formGroups.length; i++) {
  6227. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  6228. if (temporaryItemsCode === updateOriCode) {
  6229. if (formGroups.length > 1) {
  6230. nextObj = $(formGroups[i]).next();
  6231. }
  6232. isLast = (i + 1) === formGroups.length;
  6233. $(formGroups[i]).remove();
  6234. break;
  6235. }
  6236. }
  6237. }
  6238. }
  6239. var html = '<div class="form-group"> 手术名称:' + opNameText + ' 时间:' + opTime + ' 急诊标志:' + urgentClinicFlagText + ' 班次:' + ssbcText + ' 手术部位:' + partCodeText + ' 手术等级:' + opScaleText + ' 麻醉方式:' + hocusCodeText + ' 主刀医生:' + doctorZdText + ' 附注说明:' + opRecordRemark;
  6240. 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>';
  6241. 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>';
  6242. html += ' <i class="fa fa-long-arrow-left" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;" onclick="editOpRecord(this)"></i>';
  6243. 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>';
  6244. html += '<input type="hidden" class="temporary_items_code" value="' + opCode + '"/>';
  6245. html += '<input type="hidden" class="temporary_items_op_name" value="' + opNameText + '"/>';
  6246. html += '<input type="hidden" class="temporary_items_op_time" value="' + opTime + '"/>';
  6247. html += '<input type="hidden" class="temporary_items_urgent_clinic_flag" value="' + urgentClinicFlag + '"/>';
  6248. html += '<input type="hidden" class="temporary_items_ssbc" value="' + ssbc + '"/>';
  6249. html += '<input type="hidden" class="temporary_items_part_code" value="' + partCode + '"/>';
  6250. html += '<input type="hidden" class="temporary_items_op_scale" value="' + opScale + '"/>';
  6251. html += '<input type="hidden" class="temporary_items_hocus_code" value="' + hocusCode + '"/>';
  6252. html += '<input type="hidden" class="temporary_items_doctor_zd" value="' + doctorZd + '"/>';
  6253. html += '<input type="hidden" class="temporary_items_op_record_remark" value="' + opRecordRemark + '"/>';
  6254. html += '</div>';
  6255. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  6256. if (nextObj == null || isLast) {
  6257. $(tableId).find("div:eq(0)").append(html);
  6258. } else {
  6259. $(nextObj).before(html);
  6260. }
  6261. clearOpRecord();
  6262. }
  6263. /**
  6264. * 修改门诊手术
  6265. * @param obj
  6266. */
  6267. function editOpRecord(obj) {
  6268. //是新增药品还是编辑 true 修改 默认false
  6269. $("#op_record_update_flag").val(true);
  6270. var parentObject = $(obj).parent();
  6271. //当前项目编码
  6272. $("#opName").selectpicker('val', $(parentObject).find("input.temporary_items_code").val());
  6273. $('#opName').selectpicker('refresh');
  6274. $("#update_ori_code").val($(parentObject).find("input.temporary_items_code").val());
  6275. //手术时间
  6276. $("#opTime").val($(parentObject).find("input.temporary_items_op_time").val());
  6277. //急诊标志
  6278. $("#urgentClinicFlag").selectpicker('val', $(parentObject).find("input.temporary_items_urgent_clinic_flag").val());
  6279. $('#urgentClinicFlag').selectpicker('refresh');
  6280. //班次
  6281. $("#ssbc").selectpicker('val', $(parentObject).find("input.temporary_items_ssbc").val());
  6282. $('#ssbc').selectpicker('refresh');
  6283. //部位
  6284. $("#partCode").selectpicker('val', $(parentObject).find("input.temporary_items_part_code").val());
  6285. $('#partCode').selectpicker('refresh');
  6286. //等级
  6287. $("#opScale").selectpicker('val', $(parentObject).find("input.temporary_items_op_scale").val());
  6288. $('#opScale').selectpicker('refresh');
  6289. //麻醉方式
  6290. $("#hocusCode").selectpicker('val', $(parentObject).find("input.temporary_items_hocus_code").val());
  6291. $('#hocusCode').selectpicker('refresh');
  6292. //麻醉方式
  6293. $("#doctorZd").selectpicker('val', $(parentObject).find("input.temporary_items_doctor_zd").val());
  6294. $('#doctorZd').selectpicker('refresh');
  6295. $("#opRecordRemark").val($(parentObject).find("input.temporary_items_op_record_remark").val());
  6296. }
  6297. /**
  6298. * 删除药品或者项目
  6299. * @param index 0 西药 1 中药 2 检查检验 3诊疗 6外配药
  6300. * @param obj 当前点击的对象
  6301. */
  6302. function removeYpOrProject(index, obj) {
  6303. var tabId = null;
  6304. var className = null;
  6305. //西药
  6306. if (index == 0) {
  6307. tabId = "xyTab";
  6308. } else if (index == 1) {
  6309. //中成药
  6310. tabId = "zyTab";
  6311. } else if (index == 2) {
  6312. //辅助检查、检验
  6313. className = ".jcjyItemGroupId";
  6314. tabId = "jcjyTab";
  6315. } else if (index == 3) {
  6316. //诊疗
  6317. className = ".zlItemGroupId";
  6318. tabId = "zlTab";
  6319. }
  6320. else if (index == 4) {
  6321. //入院
  6322. tabId = "zyReqTab";
  6323. }
  6324. else if (index == 6) {
  6325. //外配药
  6326. className = ".wpMedicineGroupId";
  6327. tabId = "wpMedicineTab";
  6328. }
  6329. var tableId = $("#" + tabId + " li.active").find("a").attr("href");
  6330. //var totalRetprice = $(obj).parent().find("input.temporary_items_amount").val();
  6331. //calculateCfAmount(tableId, totalRetprice, null, index, 1);
  6332. //医技和诊疗的序号调整一下
  6333. if (index == 2 || index == 3) {
  6334. var nextAll = $(obj).parent().nextAll();
  6335. if (nextAll != null && nextAll.length > 0) {
  6336. for (var i = 0; i < nextAll.length; i++) {
  6337. var index = $(nextAll[i]).find(className).text();
  6338. $(nextAll[i]).find(className).text(index - 1);
  6339. }
  6340. }
  6341. }
  6342. var temporaryItemsGroupId = $(obj).parent().find("input.temporary_items_groupId").val();
  6343. var temporaryItemsGroupIds = $(obj).parent().parent().find("input.temporary_items_groupId");
  6344. if (temporaryItemsGroupIds != null && temporaryItemsGroupIds.length > 0) {
  6345. var count = 0;
  6346. for (var i = 0; i < temporaryItemsGroupIds.length; i++) {
  6347. if (temporaryItemsGroupId == $(temporaryItemsGroupIds[i]).val()) {
  6348. count++;
  6349. }
  6350. }
  6351. //当前删除的药品组号是最后一个的时候,清空缓存
  6352. if (count == 1) {
  6353. groupIdMap.remove(temporaryItemsGroupId);
  6354. gropuIdAndOrderNoMap.remove(temporaryItemsGroupId);
  6355. }
  6356. }
  6357. $(obj).parent().remove();
  6358. if (index != 4) {
  6359. calculateTotalAmount(false);
  6360. }
  6361. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  6362. if (formGroups == null || formGroups.length == 0) {
  6363. if (index == 0) {
  6364. //西药被清空后,重置药房类型编码
  6365. $(tableId).find("input.current_groupNo").val(null);
  6366. //当本处方内容都被删除完后,也删除处方table
  6367. $("#" + tabId).find("a[href=\"" + tableId + "\"]").parent().remove();
  6368. $(tableId).remove();
  6369. //切换处方 最后一个被选中
  6370. $("#" + tabId).find("li:last > a").off("click").tab('show');
  6371. } else if (index == 1) {
  6372. //当中药处方被清空完后,重置当前中药类型为空
  6373. $("#current_zyClassType").val(null);
  6374. }
  6375. }
  6376. if (index == 0) {
  6377. resetGroupIdMap();
  6378. }
  6379. }
  6380. /**
  6381. * 重置组号与用法、频率天数缓存关系
  6382. */
  6383. function resetGroupIdMap() {
  6384. var temporaryItemsGroupIds = $("#xyTabContent").find("input.temporary_items_groupId");
  6385. if (temporaryItemsGroupIds != null && temporaryItemsGroupIds.length > 0) {
  6386. var list = [];
  6387. for (var i = 0; i < temporaryItemsGroupIds.length; i++) {
  6388. var groupId = $(temporaryItemsGroupIds[i]).val();
  6389. if (list.indexOf(groupId) < 0) {
  6390. list.push(groupId);
  6391. }
  6392. }
  6393. var keys = groupIdMap.keySet();
  6394. for (var i = 0; i < keys.length; i++) {
  6395. var key = keys[i];
  6396. if (list.indexOf(key) < 0) {
  6397. groupIdMap.remove(key);
  6398. }
  6399. }
  6400. }
  6401. }
  6402. /**
  6403. * 清空西药
  6404. * @param flag 是否全部清空 因为 西药有分组,同一组的药品用药方式和频率以及天数一样,不能改变。所以不换组是不能改变 并且设置成不可编辑
  6405. */
  6406. function clearWesternMedicine(flag) {
  6407. $("#addPDiv").css("margin-left", "125px");
  6408. $("#hlyyypsms").removeClass("in").addClass("hide");
  6409. $("#western_medicine_update_flag").val(false);
  6410. $("#western_medicine_ori_group_id").val(null);
  6411. $("#update_ori_code").val(null);
  6412. $("#update_ori_serial").val(null);
  6413. //药品名称
  6414. $("#western_medicine_name").val(null);
  6415. //当前药品编码
  6416. $("#western_medicine_current_code").val(null);
  6417. //当前药品规格
  6418. $("#western_medicine_current_serial").val(null);
  6419. //当前药房编码
  6420. $("#current_groupNo").val(null);
  6421. if (flag) {
  6422. //用法编码
  6423. $("#supplyType").selectpicker('val', null);
  6424. $('#supplyType').selectpicker('refresh');
  6425. //$("#supplyType").removeAttr("disabled");
  6426. //天数
  6427. $("#dayNum").selectpicker('val', null);
  6428. $('#dayNum').selectpicker('refresh');
  6429. // $("#dayNum").removeAttr("disabled");
  6430. //频次编码
  6431. $("#orderFrequency").selectpicker('val', null);
  6432. $('#orderFrequency').selectpicker('refresh');
  6433. // $("#orderFrequency").removeAttr("disabled");
  6434. }
  6435. //药品默认单次使用剂量
  6436. $("#drugWinDb").val(null);
  6437. //处方实际单次使用剂量
  6438. $("#drugWin").val(null);
  6439. //剂量单位
  6440. $("#drugWinUnit").selectpicker('val', null);
  6441. $('#drugWinUnit').selectpicker('refresh');
  6442. //总量
  6443. $("#gross").val(null);
  6444. //包装单位
  6445. $("#packUnit").selectpicker('val', null);
  6446. $('#packUnit').selectpicker('refresh');
  6447. //单价
  6448. $("#packRetprice").val(null);
  6449. //金额
  6450. $("#totalRetprice").val(null);
  6451. //医嘱
  6452. $("#medicalAdvice").selectpicker('val', null);
  6453. $('#medicalAdvice').selectpicker('refresh');
  6454. $("#xyHospApprFlag").selectpicker('val', '0');
  6455. $('#xyHospApprFlag').selectpicker('refresh');
  6456. $("#tryResult").parent().parent().parent().removeClass("in").addClass("hide");
  6457. //皮试结果
  6458. $("#tryResult").selectpicker('val', null);
  6459. $('#tryResult').selectpicker('refresh');
  6460. //$("#gross").attr("readonly", "readonly");
  6461. $("#manufactoryName").val(null);
  6462. $("#specification").val(null);
  6463. $("#categoriesFlag").val(null);
  6464. }
  6465. /**
  6466. * 保存当前药品到右边处方区域 中药
  6467. * calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  6468. */
  6469. function saveChineseMedicine(calculateTotalAmountFlag) {
  6470. //药品名称
  6471. var chineseMedicineNamme = $("#chinese_medicine_name").val();
  6472. //当前药品编码
  6473. var currentCode = $("#chinese_medicine_current_code").val();
  6474. //当前药品规格
  6475. var currentSerial = $("#chinese_medicine_current_serial").val();
  6476. //处方实际单次使用剂量
  6477. var drugWin = $("#zy_drugWin").val();
  6478. //医嘱码
  6479. var zyInstruction = $("#zyInstruction").val();
  6480. //医嘱
  6481. var zyInstructionText = $('#zyInstruction option:selected').text();
  6482. //单价
  6483. var zyPackRetprice = parseFloat($("#zy_packRetprice").val());
  6484. //当前中药的总价
  6485. var totalRetprice = Multiply(drugWin, zyPackRetprice);
  6486. //中药类型
  6487. var zyClassType = $("#zyClassType").val();
  6488. //
  6489. var zyHospApprFlag = $("#zyHospApprFlag").val();
  6490. //已经选中的药品类型, 中药不允许一个处方里有普通中药和颗粒剂
  6491. var currentYyClassType = $("#current_zyClassType").val();
  6492. if (currentYyClassType == null || currentYyClassType == "") {
  6493. //中药此时是第一次选择药品,不控制类型
  6494. $("#current_zyClassType").val(zyClassType);
  6495. } else if (currentYyClassType != zyClassType) {
  6496. errorMesageSimaple("同一个中药处方不允许同时出现普通中药和颗粒剂中药!");
  6497. return;
  6498. }
  6499. if (currentCode == null || currentCode == '') {
  6500. errorMesageSimaple("未选择任何药品!");
  6501. return;
  6502. }
  6503. //颗粒 剂量只能为整数
  6504. if(zyClassType == '83' && !(/(^[1-9]\d*$)/.test(drugWin))){
  6505. errorMesageSimaple("颗粒剂处方剂量只能为大于等于1的正整数!");
  6506. return;
  6507. }
  6508. var html = '<div class="form-group" style="float: left;">';
  6509. html += chineseMedicineNamme;
  6510. if (zyInstruction != null && zyInstruction != '') {
  6511. html += '[' + zyInstructionText + ']';
  6512. }
  6513. html += '<span style="margin-left: 5px"></span>';
  6514. html += drugWin + $("#zyUnit").text();
  6515. 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>';
  6516. 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>';
  6517. 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>';
  6518. 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>';
  6519. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  6520. html += '<input type="hidden" class="temporary_items_serial" value="' + currentSerial + '"/>';
  6521. html += '<input type="hidden" class="temporary_items_amount" value="' + totalRetprice + '"/>';
  6522. html += '<input type="hidden" class="temporary_items_zyClassType" value="' + zyClassType + '"/>';
  6523. html += '<input type="hidden" class="temporary_items_chineseMedicineNamme" value="' + chineseMedicineNamme + '"/>';
  6524. html += '<input type="hidden" class="temporary_items_zyPackRetprice" value="' + zyPackRetprice + '"/>';
  6525. html += '<input type="hidden" class="temporary_items_drugWin" value="' + drugWin + '"/>';
  6526. html += '<input type="hidden" class="temporary_items_drugUnit" value="' + $("#zyUnit").text() + '"/>';
  6527. html += '<input type="hidden" class="temporary_items_zyInstruction" value="' + zyInstruction + '"/>';
  6528. html += '<input type="hidden" class="temporary_items_zyInstructionText" value="' + zyInstructionText + '"/>';
  6529. html += '<input type="hidden" class="temporary_items_zyHospApprFlag" value="' + zyHospApprFlag + '"/>';
  6530. html += '</div>';
  6531. var tableId = $("#zyTab li.active").find("a").attr("href");
  6532. //原药品金额 如果是修改则需要设置
  6533. var temporaryItemsAmount = 0;
  6534. //当前需要被移除元素的下个兄弟节点
  6535. var nextObj = null;
  6536. //当前修改的药品是不是最后一个
  6537. var isLast = false;
  6538. //是新增药品还是编辑 true 修改 默认false
  6539. var updateFlag = $("#chinese_medicine_update_flag").val();
  6540. if (updateFlag == undefined || updateFlag == null) {
  6541. updateFlag = false;
  6542. }
  6543. //如果是修改,需要减去原来的费用
  6544. if (updateFlag == "true" || updateFlag == true) {
  6545. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  6546. if (formGroups != null && formGroups.length > 0) {
  6547. //药品有可能会修改,所以,判断的时候要用原药品编码
  6548. var updateOriCode = $("#update_ori_code").val();
  6549. //规格有可能会修改,所以,判断的时候要用原规格
  6550. var updateOriSerial = $("#update_ori_serial").val();
  6551. for (var i = 0; i < formGroups.length; i++) {
  6552. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  6553. var temporaryItemsSerial = $(formGroups[i]).find("input.temporary_items_serial").val();
  6554. if (temporaryItemsCode === updateOriCode && temporaryItemsSerial === updateOriSerial) {
  6555. temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  6556. if (formGroups.length > 1) {
  6557. nextObj = $(formGroups[i]).next();
  6558. }
  6559. isLast = (i + 1) === formGroups.length;
  6560. $(formGroups[i]).remove();
  6561. break;
  6562. }
  6563. }
  6564. }
  6565. }
  6566. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  6567. if (nextObj == null || isLast) {
  6568. $(tableId).find("div:eq(0)").append(html);
  6569. } else {
  6570. $(nextObj).before(html);
  6571. }
  6572. //设置当前处方金额
  6573. // calculateCfAmount(tableId, totalRetprice, temporaryItemsAmount, 1, 0);
  6574. if (calculateTotalAmountFlag) {
  6575. //设置总金额
  6576. calculateTotalAmount(true);
  6577. }
  6578. clearChineseMedicine();
  6579. }
  6580. /**
  6581. * 清空中药
  6582. */
  6583. function clearChineseMedicine() {
  6584. $("#chinese_medicine_update_flag").val(false);
  6585. $("#update_ori_code").val(null);
  6586. $("#update_ori_serial").val(null);
  6587. //药品名称
  6588. $("#chinese_medicine_name").val(null);
  6589. //当前药品编码
  6590. $("#chinese_medicine_current_code").val(null);
  6591. //当前药品规格
  6592. $("#chinese_medicine_current_serial").val(null);
  6593. //医嘱
  6594. $("#zyInstruction").selectpicker('val', null);
  6595. $('#zyInstruction').selectpicker('refresh');
  6596. $("#zyHospApprFlag").selectpicker('val', '0');
  6597. $('#zyHospApprFlag').selectpicker('refresh');
  6598. //剂量
  6599. $("#zy_drugWin").val(null);
  6600. //单价
  6601. $("#zy_packRetprice").val(null);
  6602. zyUnitChange()
  6603. }
  6604. //中药单位改变
  6605. function zyUnitChange() {
  6606. var zyClassTypeTemp = $("#zyClassType").val()
  6607. if(zyClassTypeTemp == '83'){
  6608. $("#zyUnit").text('袋')
  6609. //煮取 剪法 隐藏
  6610. $("#cyZqlDiv").removeClass("in").addClass("hide");
  6611. $("#ZySupplyTypeDiv").removeClass("in").addClass("hide");
  6612. if($("#cyFjDiv")){
  6613. $("#cyFjDiv").removeClass("in").addClass("hide");
  6614. }
  6615. }else {
  6616. $("#zyUnit").text('g')
  6617. $("#cyZqlDiv").removeClass("hide").addClass("in");
  6618. $("#ZySupplyTypeDiv").removeClass("hide").addClass("in");
  6619. if($("#cyFjDiv")){
  6620. $("#cyFjDiv").removeClass("hide").addClass("in");
  6621. }
  6622. }
  6623. }
  6624. /**
  6625. * 清空辅助检查、检验项目
  6626. */
  6627. function clearJyJcItem() {
  6628. $("#update_ori_code").val(null);
  6629. $("#jcjy_update_flag").val(false);
  6630. //项目名称
  6631. $("#jcJyItem").val(null);
  6632. //当前项目编码
  6633. $("#jcjy_current_code").val(null);
  6634. //单价
  6635. $("#jcjyItemPrice").val(null);
  6636. //备注
  6637. $("#remark").val(null);
  6638. $("#jcJyZltype").val(null);
  6639. $("#jyZdSample").selectpicker('val', null);
  6640. $('#jyZdSample').selectpicker('refresh');
  6641. $("#yshPart").selectpicker('val', null);
  6642. $('#yshPart').selectpicker('refresh');
  6643. $("#execUnit").selectpicker('val', null);
  6644. $('#execUnit').selectpicker('refresh');
  6645. $("#jcJyItemChargeDetail").removeClass("in").addClass("hide");
  6646. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  6647. $("#jyQuantityDiv").removeClass("in").addClass("hide");
  6648. $("#yshPartDiv").removeClass("in").addClass("hide");
  6649. $("#jyQuantity").val(null);
  6650. }
  6651. /**
  6652. * 清空外配处方
  6653. */
  6654. function clearWpOrder() {
  6655. $("#wp_medicine_name").val(null);
  6656. $("#wp_medicine_update_flag").val(false);
  6657. $("#rxItemTypeCode").selectpicker('val', '11');
  6658. $('#rxItemTypeCode').selectpicker('refresh');
  6659. $('#medcWayCodg').val(null)
  6660. $('#medcWayCodg').selectpicker('refresh');
  6661. setSelectDefaultVal('medcDays',1)
  6662. $('#usedFrquCodg').val(null)
  6663. $('#usedFrquCodg').selectpicker('refresh');
  6664. $('#sinDosunt').val(null)
  6665. $('#prdrName').val(null)
  6666. $('#sinDoscnt').val('1')
  6667. setSelectDefaultVal('usedFrquCodg','13')
  6668. $('#drugDosunt').val(null)
  6669. $('#drugSpec').val(null)
  6670. $('#drugCnt').val(null)
  6671. $('#drugDosform').val(null)
  6672. $('#drugDosform').selectpicker('refresh');
  6673. $('#wpHospApprFlag').val('1')
  6674. $('#wpHospApprFlag').selectpicker('refresh');
  6675. }
  6676. /**
  6677. * 清空诊疗项目
  6678. */
  6679. function clearZlItem() {
  6680. $("#update_ori_code").val(null);
  6681. $("#zl_update_flag").val(false);
  6682. //项目名称
  6683. $("#zlItem").val(null);
  6684. //当前项目编码
  6685. $("#zl_current_code").val(null);
  6686. //单价
  6687. $("#zlItemPrice").val(null);
  6688. //备注
  6689. $("#zlRemark").val(null);
  6690. //描述
  6691. $("#chargeUnit").val(null);
  6692. $("#itemQuantity").val(1);
  6693. $("#descriptions").val(null);
  6694. $("#dayZlNum").selectpicker('val', 1);
  6695. $('#dayZlNum').selectpicker('refresh');
  6696. $("#zlHospApprFlag").selectpicker('val', '0');
  6697. $('#zlHospApprFlag').selectpicker('refresh');
  6698. $("#orderFrequencyZl").selectpicker('val', 'ONCE');
  6699. $('#orderFrequencyZl').selectpicker('refresh');
  6700. $("#totalNumZl").val(null);
  6701. $("#totalAmountZl").val(null);
  6702. $("#zlExecUnit").selectpicker('val', null);
  6703. $('#zlExecUnit').selectpicker('refresh');
  6704. }
  6705. /**
  6706. * 清空入院证输入框
  6707. */
  6708. function clearZyReq() {
  6709. $("#inpatientWardBeHospitalized").selectpicker('val', null);
  6710. $('#inpatientWardBeHospitalized').selectpicker('refresh');
  6711. $("#smallWardBeHospitalized").selectpicker('val', null);
  6712. $('#smallWardBeHospitalized').selectpicker('refresh');
  6713. $("#admissStatus").selectpicker('val', null);
  6714. $('#admissStatus').selectpicker('refresh');
  6715. $("#conditionCode").selectpicker('val', null);
  6716. $('#conditionCode').selectpicker('refresh');
  6717. $("#routeOfAdmission").selectpicker('val', null);
  6718. $('#routeOfAdmission').selectpicker('refresh');
  6719. $("#totalBedNum").val(null);
  6720. $("#freeBedNum").val(null);
  6721. $("#occupationBedNum").val(null);
  6722. $("#contacterName").val(null);
  6723. $("#contacterRelationship").selectpicker('val', null);
  6724. $('#contacterRelationship').selectpicker('refresh');
  6725. $("#contacterPhone").val(null);
  6726. $("#contacterAddress").val(null);
  6727. $("#deposit").val(null);
  6728. initSmallDeptByDept();
  6729. }
  6730. /**
  6731. * 清空门诊手术输入框
  6732. */
  6733. function clearOpRecord() {
  6734. $("#op_record_update_flag").val(false);
  6735. $("#opName").selectpicker('val', null);
  6736. $('#opName').selectpicker('refresh');
  6737. $("#urgentClinicFlag").selectpicker('val', null);
  6738. $('#urgentClinicFlag').selectpicker('refresh');
  6739. $("#ssbc").selectpicker('val', null);
  6740. $('#ssbc').selectpicker('refresh');
  6741. $("#partCode").selectpicker('val', null);
  6742. $('#partCode').selectpicker('refresh');
  6743. $("#opScale").selectpicker('val', null);
  6744. $('#opScale').selectpicker('refresh');
  6745. $("#opTime").val(null);
  6746. $("#hocusCode").selectpicker('val', null);
  6747. $('#hocusCode').selectpicker('refresh');
  6748. $("#doctorZd").selectpicker('val', null);
  6749. $('#doctorZd').selectpicker('refresh');
  6750. $("#opRecordRemark").val(null);
  6751. }
  6752. /**
  6753. * 计算总金额
  6754. * @param needRemoveLastObject 是否需要删除最后一次加进来的项目
  6755. */
  6756. function calculateTotalAmount(needRemoveLastObject) {
  6757. //调用后去除所有的验证提示
  6758. $("div.alert ").each(function (index, obj) {
  6759. $(obj).remove();
  6760. });
  6761. var jsonData = getParamsForpPrescription(3);
  6762. if(stringIsBlank(jsonData.visitDeptCode)){
  6763. jsonData.visitDeptCode = localStorage.getItem("currentDeptNo")
  6764. }
  6765. $.ajax({
  6766. type: "POST",
  6767. url: '/thmz/getAmountForTempPrescription',
  6768. contentType: "application/json;charset=UTF-8",
  6769. dataType: "json",
  6770. data: JSON.stringify(jsonData),
  6771. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6772. success: function (res) {
  6773. if (res == '401' || res == 401) {
  6774. window.location.href = '/thmz/login/view'
  6775. return;
  6776. }
  6777. if (res.code == 0) {
  6778. if(!stringIsBlank(res.discountWarningMessage)){
  6779. warningMesageSimaple(res.discountWarningMessage)
  6780. }
  6781. if(!stringIsBlank(res.ypHealthEducation)){
  6782. $("#ypHealthEducation").val(res.ypHealthEducation)
  6783. }else {
  6784. $("#ypHealthEducation").val(null)
  6785. }
  6786. $("#totalAmount").html(res.data.amount.toFixed(2));
  6787. var arrs = $("span.cf_amount");
  6788. for (var i = 0; i < arrs.length; i++) {
  6789. if (res.data.amountList[i] != undefined && res.data.amountList[i] != null) {
  6790. $(arrs[i]).html(res.data.amountList[i].toFixed(2));
  6791. }
  6792. }
  6793. } else {
  6794. if (needRemoveLastObject) {
  6795. var index = getIndex("bill_item_group");
  6796. var tabId = null;
  6797. //西药
  6798. if (index == 0) {
  6799. tabId = "xyTab";
  6800. } else if (index == 1) {
  6801. //中成药
  6802. tabId = "zyTab";
  6803. } else if (index == 2) {
  6804. //辅助检查、检验
  6805. tabId = "jcjyTab";
  6806. } else if (index == 3) {
  6807. //诊疗
  6808. tabId = "zlTab";
  6809. } else if (index == 4) {
  6810. //入院
  6811. tabId = "zyReqTab";
  6812. } else if (index == 5) {
  6813. //手术
  6814. tabId = "opRecordTab";
  6815. }else if (index == 6) {
  6816. //手术
  6817. tabId = "wpMedicineTab";
  6818. }
  6819. var tableId = $("#" + tabId + " li.active").find("a").attr("href");
  6820. var last = $(tableId).find("div:eq(0)").find("div:last");
  6821. if (last != null) {
  6822. $(last).find("i:eq(2)").click();
  6823. $(last).find("i:eq(3)").click();
  6824. }
  6825. }
  6826. errorMesage(res);
  6827. }
  6828. }
  6829. });
  6830. }
  6831. // /**
  6832. // * 打开住院处理窗口
  6833. // * @param data
  6834. // */
  6835. // function beHospitalized() {
  6836. // $("#beHospitalizedModal").modal();
  6837. // //根据病人门诊id查询病人的入院申请
  6838. // $.ajax({
  6839. // type: "GET",
  6840. // url: '/thmz/getMzZyReqByPatientId?patientId=' + $("#patientId").text(),
  6841. // contentType: "application/json;charset=UTF-8",
  6842. // dataType: "json",
  6843. // headers: {
  6844. // 'Accept': 'application/json',
  6845. // 'Authorization': 'Bearer ' + localStorage.getItem("token")
  6846. // },
  6847. // success: function (resZyz) {
  6848. // if (resZyz == '401' || resZyz == 401) {
  6849. // window.location.href = '/thmz/login/view'
  6850. // return;
  6851. // }
  6852. // if (resZyz.code == 0) {
  6853. // $("#icdCodeInputBeHospitalized").val(resZyz.data.icdCode);
  6854. // $("#icdTextBeHospitalized").val(resZyz.data.icdText);
  6855. // $("#icdTextBeHospitalized").attr("title", resZyz.data.icdText);
  6856. // $("#inpatientWardBeHospitalized").selectpicker('val', resZyz.data.reqDept);
  6857. // $("#inpatientWardBeHospitalized").selectpicker('refresh');
  6858. // initSmallDeptByDept();
  6859. // $("#smallWardBeHospitalized").selectpicker('val', resZyz.data.smallDept);
  6860. // $("#smallWardBeHospitalized").selectpicker('refresh');
  6861. // $("#admissStatus").selectpicker('val', resZyz.data.admissStatus);
  6862. // $("#admissStatus").selectpicker('refresh');
  6863. // $("#zyReqVisitDate").val(format(resZyz.data.visitDate, "yyyy-MM-dd HH:mm:ss"));
  6864. // }
  6865. // }
  6866. // });
  6867. // }
  6868. /**
  6869. * 打开编辑用户信息窗口
  6870. * @param data
  6871. * @param type 1 患者详情处编辑 2 快速接诊处编辑 3 就诊详情预览
  6872. */
  6873. function editUserModal(patientId, type) {
  6874. if (type == 3) {
  6875. $("#editUserModalTitle").html("患者档案【预览】");
  6876. $("#saveEditUser").removeClass("in").addClass("hide");
  6877. } else {
  6878. $("#editUserModalTitle").html("患者档案【修改】");
  6879. $("#saveEditUser").removeClass("hide").addClass("in");
  6880. }
  6881. $("#openSource").val(type);
  6882. if (patientId == null) {
  6883. //医生工作台发起
  6884. patientId = $("#patientId").text();
  6885. }
  6886. // else {
  6887. // //快速接诊界面发起
  6888. // clearRapidAccepts();
  6889. // }
  6890. if (patientId == null || patientId == "null" || patientId == "") {
  6891. errorMesageSimaple("请输入需要编辑的患者信息");
  6892. return;
  6893. }
  6894. $("#rapidAcceptsModal").modal("hide");
  6895. $("#visitingDetailModal").modal("hide");
  6896. $("#editUserModal").modal();
  6897. $.ajax({
  6898. type: "GET",
  6899. url: '/thmz/getByPatientId?patientId=' + patientId,
  6900. contentType: "application/json;charset=UTF-8",
  6901. dataType: "json",
  6902. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  6903. success: function (res) {
  6904. if (res == '401' || res == 401) {
  6905. window.location.href = '/thmz/login/view'
  6906. return;
  6907. }
  6908. if (res.code == 0) {
  6909. if (res.data != null) {
  6910. //延时调用,因为当前弹框还没有加载出来,校验规则无法获取光标与模拟光标丢失事件,延时可以等弹框加载出来后模拟事件
  6911. setTimeout(function () {
  6912. fillPlusPatinet(res.data);
  6913. }, 400);
  6914. }
  6915. } else {
  6916. errorMesage(res);
  6917. $("#editUserModal").modal("hide");
  6918. }
  6919. }
  6920. });
  6921. }
  6922. /**
  6923. * 处方类型按钮切换事件
  6924. * @param object
  6925. * @param objectIndex
  6926. */
  6927. function billItemButtonChange(object, objectIndex) {
  6928. $(".nav-tabs").removeClass("in").addClass("hide");
  6929. $(".tab-content").removeClass("in").addClass("hide");
  6930. $(".nav-tabs:eq(" + objectIndex + ")").removeClass("hide").addClass("in");
  6931. $(".tab-content:eq(" + objectIndex + ")").removeClass("hide").addClass("in");
  6932. $("#bill_item_group").find("button").each(function (index, element) {
  6933. if ($(element).hasClass("btn-primary")) {
  6934. $(element).removeClass("btn-primary").addClass("btn-default");
  6935. }
  6936. $("#rp_form" + index).removeClass("show").addClass("hide");
  6937. });
  6938. $("#rp_form" + objectIndex).removeClass("hide").addClass("show");
  6939. $(object).removeClass("btn-default").addClass("btn-primary");
  6940. $("#western_medicine_name").webuiPopover('hide');
  6941. $("#chinese_medicine_name").webuiPopover('hide');
  6942. $("#jcJyItem").webuiPopover('hide');
  6943. $("#zlItem").webuiPopover('hide');
  6944. if (objectIndex == 0) {
  6945. $("#western_medicine_name").focus();
  6946. //有时候调用药品多了以后,会导致一个药品处方名对应多个content显现
  6947. var paneId = $("#xyTab li.active").find("a").attr("href");
  6948. if (paneId != null) {
  6949. //去除第一个字符 #
  6950. paneId = paneId.slice(1);
  6951. xyTableOnClick(paneId)
  6952. }
  6953. } else if (objectIndex == 1) {
  6954. $("#chinese_medicine_name").focus();
  6955. } else if (objectIndex == 2) {
  6956. $("#jcJyItem").focus();
  6957. } else if (objectIndex == 3) {
  6958. $("#zlItem").focus();
  6959. } else if (objectIndex == 4) {
  6960. // $("#inpatientWardBeHospitalized").next().click();
  6961. prevEleId = "zy_req_button";
  6962. } else if (objectIndex == 5) {
  6963. prevEleId = "op_record_button";
  6964. }else if (objectIndex == 6) {
  6965. $("#wp_medicine_name").focus();
  6966. }
  6967. }
  6968. /**
  6969. * 打开快速接诊窗口
  6970. * @param data
  6971. */
  6972. function rapidAcceptsModal() {
  6973. $("#rapidAcceptsModal").modal();
  6974. //延迟触发 默认光标在卡号输入框
  6975. setTimeout('$("#rapidAcceptsUserCardNo").focus();', 500);
  6976. }
  6977. /**
  6978. * checkBox样式
  6979. */
  6980. function formatCheck() {
  6981. if ($("input.flat")[0]) {
  6982. $(document).ready(function () {
  6983. $('input.flat').iCheck({
  6984. checkboxClass: 'icheckbox_flat-blue',
  6985. radioClass: 'iradio_flat-blue'
  6986. });
  6987. });
  6988. }
  6989. }
  6990. /**
  6991. * 卡号有变化后查询病人信息
  6992. */
  6993. function queryUserInfoByCardNo() {
  6994. //当反写的id不存在,说明不是查询后的改变事件,触发查询
  6995. var rapidAcceptsUserCardNo = $("#rapidAcceptsUserCardNo").val();
  6996. clearRapidAcceptsModal();
  6997. // console.log("queryUserInfoByCardNo",rapidAcceptsUserCardNo)
  6998. if (rapidAcceptsUserCardNo == null || rapidAcceptsUserCardNo == "") {
  6999. return;
  7000. }
  7001. // var index = rapidAcceptsUserCardNo.indexOf("-");
  7002. // if (($("#patientIdDb").val() == null || $("#patientIdDb").val() == "")) {
  7003. $("#cardNo").attr("title", rapidAcceptsUserCardNo);
  7004. $.ajax({
  7005. type: "GET",
  7006. url: '/thmz/getByIcCardNo?icCardNo=' + rapidAcceptsUserCardNo,
  7007. contentType: "application/json;charset=UTF-8",
  7008. dataType: "json",
  7009. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7010. success: function (res) {
  7011. console.log("rapidAcceptsUserCardNo",res)
  7012. if (res == '401' || res == 401) {
  7013. window.location.href = '/thmz/login/view'
  7014. return;
  7015. }
  7016. if (res.code == 0) {
  7017. if (res.data != null) {
  7018. $("#rapidAcceptsUserName").val(res.data.name);
  7019. $("#rapidAcceptsUserCode").val(res.data.patientId);
  7020. $("#patientIdDb").val(res.data.patientId);
  7021. $("#rapidAcceptsUserCardNo").val(res.data.icCardNo);
  7022. $("#rapidAcceptsUserGender").selectpicker('val', res.data.sex);
  7023. $("#rapidAcceptsUserGender").selectpicker('refresh');
  7024. $("#rapidAcceptsUserPhoneNum").val(res.data.phoneNo);
  7025. $("#rapidAcceptsUserIdCard").val(res.data.socialNo);
  7026. $('#rapidAcceptsUserCertificateType').selectpicker('val', '01');
  7027. $('#rapidAcceptsUserCertificateType').selectpicker('refresh');
  7028. $("#rapidAcceptsUserIdCard").attr("title", res.data.socialNo);
  7029. $("#rapidAcceptsUserPhoneNum").attr("title", res.data.phoneNo);
  7030. $('#rapidAcceptsProvinceCode').selectpicker('val', res.data.provinceCode);
  7031. $('#rapidAcceptsProvinceCode').selectpicker('refresh');
  7032. initCity(3, res.data.cityCode);
  7033. initDistrict(3, res.data.cityCode, res.data.districtCode);
  7034. $("#rapidAcceptsDetail").val(res.data.detail);
  7035. $("#rapidAcceptsUserAddress").attr("title", res.data.address);
  7036. $("#rapidAcceptsUserAddress").val(res.data.address);
  7037. $("#rapidAcceptsUserContact").val(res.data.relName);
  7038. $("#rapidAcceptsUserContactPhone").val(res.data.contractName);
  7039. //查询分诊号
  7040. $.ajax({
  7041. type: "POST",
  7042. url: '/thmz/getUnClinicWithPage',
  7043. contentType: "application/json;charset=UTF-8",
  7044. dataType: "json",
  7045. data: JSON.stringify({"patientId": res.data.patientId}),
  7046. headers: {
  7047. 'Accept': 'application/json',
  7048. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  7049. },
  7050. success: function (resFz) {
  7051. if (resFz == '401' || resFz == 401) {
  7052. window.location.href = '/thmz/login/view'
  7053. return;
  7054. }
  7055. if (resFz.code == 0) {
  7056. if (resFz.data == null || resFz.data.length == 0) {
  7057. errorMesageSimaple("没有查询到符合条件的分诊记录!");
  7058. clearRapidAcceptsModal();
  7059. return;
  7060. }
  7061. $("#mzfzSerialNo").val(resFz.data[0].serialNo);
  7062. }
  7063. }
  7064. });
  7065. } else {
  7066. errorMesageSimaple("病人信息不存在!");
  7067. }
  7068. } else {
  7069. errorMesage(res);
  7070. }
  7071. }
  7072. });
  7073. // }
  7074. }
  7075. /**
  7076. * 清空快速接诊查询框
  7077. */
  7078. function clearRapidAccepts() {
  7079. $("#rapidAcceptsUserName").val(null);
  7080. $("#rapidAcceptsUserCode").val(null);
  7081. $("#patientIdDb").val(null);
  7082. $("#rapidAcceptsUserCardNo").val(null);
  7083. $("#rapidAcceptsUserGender").selectpicker('val', 0);
  7084. $("#rapidAcceptsUserGender").selectpicker('refresh');
  7085. $("#rapidAcceptsUserPhoneNum").val(null);
  7086. $("#rapidAcceptsUserIdCard").val(null);
  7087. $("#rapidAcceptsUserIdCard").attr("title", null);
  7088. $("#rapidAcceptsUserPhoneNum").attr("title", null);
  7089. $("#rapidAcceptsUserAddress").attr("title", null);
  7090. $("#mzfzSerialNo").val(null);
  7091. $("#rapidAcceptsUserCardNo").focus();
  7092. $("#rapidAcceptsUserAddress").val(null);
  7093. $("#rapidAcceptsUserContact").val(null);
  7094. $("#rapidAcceptsUserContactPhone").val(null);
  7095. }
  7096. /**
  7097. * 根据病人姓名输入框内容动态加载病人列表
  7098. */
  7099. function initUserList() {
  7100. //var width=$("#userName").css("width");
  7101. var settings = {
  7102. trigger: 'click',
  7103. content: '',
  7104. width: 170,
  7105. multi: true,
  7106. closeable: false,
  7107. style: '',
  7108. delay: 300,
  7109. padding: true,
  7110. height: 300,
  7111. };
  7112. var webuiPopover = $('#symptomFlagCheck').webuiPopover('destroy').webuiPopover(settings);
  7113. //用户姓名选中事件
  7114. // $("#rapidAcceptsUserName").on("click", function (t) {
  7115. // if ($(webuiPopover).css("display") == "block") {
  7116. // refeshPatinetList(true);
  7117. // }
  7118. // });
  7119. }
  7120. /**
  7121. * 刷新候诊病人列表
  7122. */
  7123. function refeshPatinetList(flag) {
  7124. //如果是重新加载病人列表,需要重置下标
  7125. if (flag) {
  7126. //重置下标
  7127. pageIndex = 0;
  7128. msg_list_loading = true;
  7129. }
  7130. var userName = $('#rapidAcceptsUserName').val();
  7131. if (!(userName == null || userName == "" || isChinese(userName))) {
  7132. return;
  7133. }
  7134. $.ajax({
  7135. type: "POST",
  7136. url: '/thmz/getUnClinicWithPage',
  7137. contentType: "application/json;charset=UTF-8",
  7138. dataType: "json",
  7139. data: JSON.stringify({"name": userName, "pageIndex": pageIndex}),
  7140. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7141. success: function (res) {
  7142. if (res == '401' || res == 401) {
  7143. window.location.href = '/thmz/login/view'
  7144. return;
  7145. }
  7146. if (res.code == 0) {
  7147. if (res.data != null && res.data.length > 0) {
  7148. // $("#webuiPopover0").css("display", "block");
  7149. // $("#webuiPopover0 .webui-popover-content").css("max-height", "300px").css("height", "auto");
  7150. var html = '<div class="list-group">';
  7151. for (var i = 0; i < res.data.length; i++) {
  7152. var mzPatientMi = res.data[i];
  7153. html += '<a href="#" class="list-group-item list-group-item-action" onclick="fillUnClinicPatinet(\'' + mzPatientMi.patientId + '\')">';
  7154. if (mzPatientMi.gender == "男") {
  7155. html += '<img src="/thmz/images/boy.png"/>'
  7156. } else if (mzPatientMi.gender == "女") {
  7157. html += '<img src="/thmz/images/girl.png"/>'
  7158. } else if (mzPatientMi.gender == "未知" || mzPatientMi.gender == null) {
  7159. html += '<img src="/thmz/images/girl_or_boy.png"/>'
  7160. }
  7161. html += '<div>' + mzPatientMi.name + '&nbsp;' + mzPatientMi.gender + '&nbsp;';
  7162. html += mzPatientMi.ageString;
  7163. if (mzPatientMi.phoneNo != null && mzPatientMi.phoneNo != "") {
  7164. html += '<span>' + mzPatientMi.phoneNo + '</span>';
  7165. }
  7166. html += '</div></a>';
  7167. }
  7168. html += '</div>';
  7169. // if (flag) {
  7170. // $("#webuiPopover0 div.webui-popover-content").html("");
  7171. // }
  7172. // $("#webuiPopover0 div.webui-popover-content").append(html);
  7173. // $("#webuiPopover0 div.arrow").css("left", "23px");
  7174. refeshPatinetListScrollEvent();
  7175. } else {
  7176. // $("#webuiPopover0").css("display", "none");
  7177. }
  7178. }
  7179. //查询完成,设置加载完成
  7180. msg_list_loading = false;
  7181. }
  7182. });
  7183. }
  7184. /**
  7185. * 病人下拉列表滚动条滚动到底部时继续加载新纪录
  7186. */
  7187. function refeshPatinetListScrollEvent() {
  7188. // $('.webui-popover-content').scroll(function (event) {
  7189. // var top = $(this).scrollTop();
  7190. // var height = $(this).height();
  7191. // var scrollHeight = $(this).get(0).scrollHeight;
  7192. // if (scrollHeight <= top + height) {
  7193. // if (!msg_list_loading) {
  7194. // msg_list_loading = true;
  7195. // pageIndex = pageIndex + 1;
  7196. // refeshPatinetList(false);
  7197. // }
  7198. // }
  7199. // });
  7200. }
  7201. /**
  7202. * 按照病人id查询病人信息
  7203. * @param patientId
  7204. */
  7205. function fillUnClinicPatinet(patientId) {
  7206. $("#rapidAcceptsUserCardNo").val(patientId);
  7207. // $("#webuiPopover0").css("display", "none");
  7208. queryUserInfoByCardNo();
  7209. }
  7210. /**
  7211. * 加载主诉,体格检查,诊断窗口
  7212. */
  7213. function initRecommendList() {
  7214. var width = $("#symptom").parent().css("width");
  7215. var settings = {
  7216. placement: 'bottom-right',//值: auto,top,right,bottom,left,top-right,top-left,bottom-right,bottom-left 要显示的位置
  7217. trigger: 'click', //值:click,hover 触发方式 manual 手动
  7218. content: '',//内容,内容可以是函数
  7219. width: width,
  7220. //arrow:false,//是否显示箭头
  7221. multi: true,//在页面允许其他弹出层
  7222. closeable: true,//显示关闭按钮
  7223. style: '', //值:'',inverse
  7224. delay: 300,//延迟时间, 悬浮属性才执行
  7225. padding: true,//内容填充
  7226. height: 320,
  7227. //offsetTop:10,
  7228. cache: true,//如果缓存设置为false,则popover将销毁并重新创建
  7229. };
  7230. //主诉弹窗
  7231. var symptomWebuiPopover = $('#symptom').webuiPopover('destroy').webuiPopover(settings);
  7232. //体格检查弹窗
  7233. settings.height = 260;
  7234. $('#weight').webuiPopover('destroy').webuiPopover(settings);
  7235. //诊断弹窗
  7236. settings.height = 320;
  7237. var diagnoseWebuiPopover = $('#diagnose').webuiPopover('destroy').webuiPopover(settings);
  7238. //中医诊断弹窗
  7239. var tcmDiagnoseWebuiPopover = $('#tcmDiagnose').webuiPopover('destroy').webuiPopover(settings);
  7240. //西药弹窗
  7241. settings.width = 680;
  7242. settings.closeable = false;
  7243. settings.arrow = false;//显示箭头或不显示箭头
  7244. settings.content = '<div id="westernMedicinePopoverContent"><table id="tb_table_western_medicine"></table></div>';
  7245. //手动触发
  7246. settings.trigger = 'manual';
  7247. var westernMedicineWebuiPopover = $('#western_medicine_name').webuiPopover('destroy').webuiPopover(settings);
  7248. //中药弹窗
  7249. settings.trigger = 'click';
  7250. settings.content = '<div id="chineseMedicinePopoverContent"><table id="tb_table_chinese_medicine"></table></div>';
  7251. //手动触发
  7252. settings.trigger = 'manual';
  7253. var chineseMedicineWebuiPopover = $('#chinese_medicine_name').webuiPopover('destroy').webuiPopover(settings);
  7254. //辅助检查、检验弹窗
  7255. settings.trigger = 'manual';
  7256. settings.content = '<div id="jcJyItemPopoverContent"><table id="tb_table_jc_jy_item"></table></div>';
  7257. var jcJyItemWebuiPopover = $('#jcJyItem').webuiPopover('destroy').webuiPopover(settings);
  7258. //诊疗弹窗
  7259. settings.trigger = 'manual';
  7260. settings.content = '<div id="zlItemPopoverContent"><table id="tb_table_zl_item"></table></div>';
  7261. var zlItemWebuiPopover = $('#zlItem').webuiPopover('destroy').webuiPopover(settings);
  7262. //外配药弹窗
  7263. settings.trigger = 'manual';
  7264. settings.content = '<div id="wpMedicinePopoverContent"><table id="tb_table_wp_medicine"></table></div>';
  7265. var zlItemWebuiPopover = $('#wp_medicine_name').webuiPopover('destroy').webuiPopover(settings);
  7266. //主诉选中事件
  7267. $("#symptom").on("click", function (t) {
  7268. if ($(symptomWebuiPopover).css("display") == "block") {
  7269. $("#webuiPopover1 div.arrow").css("left", "23px");
  7270. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">主诉</span>';
  7271. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='contentHtml'>";
  7272. html += "</div>";
  7273. html += '<div style="height: 60px; line-height: 60px; font-size: 14px;">' +
  7274. '<div style="float: left">' +
  7275. '<span style="margin-left: 20px;">内容:</span> ' +
  7276. '</div>' +
  7277. '<div style="float: left;">' +
  7278. '<select class="form-control selectpicker show-tick" id="paramsType" dropupAuto="true">' +
  7279. '<option label="常用症状" value="0">常用症状</option>' +
  7280. '<option label="常用时间" value="1">常用时间</option>' +
  7281. '<option label="常用标点" value="2">常用标点</option>' +
  7282. '<option label="常用词" value="3">常用词</option>' +
  7283. '</select> ' +
  7284. '</div>' +
  7285. '<div style="width: 200px;float: left;margin-left: 10px;">' +
  7286. '<input id="paramsNameInput" class="form-control" type="text" style="position: relative;top: 13px;height: 34px;">' +
  7287. '</div>' +
  7288. '<div style="float: left;margin-left: 10px;">' +
  7289. ' <button type="button" class="btn" onclick="saveParams();"' +
  7290. ' style="height: 30px;line-height: 15px;border-color: #2e69eb!important;color: #2e69eb;background-color: white;">' +
  7291. ' <svg class="bi" width="1em" height="1em" fill="currentColor" style="vertical-align: -.15em;margin-right: 10px!important;color: #2e69eb;">' +
  7292. ' <use xlink:href="/thmz/css/bootstrap/bootstrap-icons-1.5.0/bootstrap-icons.svg#plus-circle"></use>' +
  7293. ' </svg>' +
  7294. '新增' +
  7295. ' </button>' +
  7296. ' </div>' +
  7297. '</div>';
  7298. $("#webuiPopover1 div.webui-popover-content").html(html);
  7299. $('#paramsType').selectpicker('refresh');
  7300. $("#paramsType").parent().css("width", "140px").css("height", "34px");
  7301. $("#webuiPopover1").css("z-index", "10");
  7302. if ($("#webuiPopover1").hasClass("in")) {
  7303. loadSymptom();
  7304. }
  7305. }
  7306. //加载智能接诊模块的主诉推荐
  7307. fitSymptomData();
  7308. });
  7309. //体格检查各输入框选中事件
  7310. $("#weight,#temperature,#sphygmus,#breathe,#pressure_high,#pressure_floor,#pressure_high_left,#pressure_floor_left").on("click", function (t) {
  7311. if ($("#webuiPopover2").css("display") == "block") {
  7312. $("#webuiPopover2").css("left", $("#webuiPopover1").css("left"));
  7313. if ($("#healthCheckupContentHtml").html() == null || $("#healthCheckupContentHtml").html() == "") {
  7314. $("#webuiPopover2 div.arrow").css("left", "23px");
  7315. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">体格检查</span>';
  7316. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='healthCheckupContentHtml'>";
  7317. html += "</div>";
  7318. $("#webuiPopover2 div.webui-popover-content").html(html);
  7319. $("#webuiPopover2").css("z-index", "10");
  7320. if ($("#webuiPopover2").hasClass("in")) {
  7321. loadHealthCheckup();
  7322. }
  7323. }
  7324. //loadSymptom();
  7325. } else {
  7326. $('#weight').webuiPopover('show');
  7327. $("#webuiPopover2").css("left", $("#webuiPopover1").css("left"));
  7328. if ($("#healthCheckupContentHtml").html() == null || $("#healthCheckupContentHtml").html() != "") {
  7329. $("#webuiPopover2 div.arrow").css("left", "23px");
  7330. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">体格检查</span>';
  7331. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='healthCheckupContentHtml'>";
  7332. html += "</div>";
  7333. $("#webuiPopover2 div.webui-popover-content").html(html);
  7334. $("#webuiPopover2").css("z-index", "10");
  7335. if ($("#webuiPopover2").hasClass("in")) {
  7336. loadHealthCheckup();
  7337. }
  7338. }
  7339. }
  7340. return false;
  7341. });
  7342. //诊断选中事件
  7343. $("#diagnose").on("click", function (t) {
  7344. $("#western_medicine_name").webuiPopover('hide');
  7345. $("#chinese_medicine_name").webuiPopover('hide');
  7346. $("#jcJyItem").webuiPopover('hide');
  7347. $("#zlItem").webuiPopover('hide');
  7348. if ($(diagnoseWebuiPopover).css("display") == "block") {
  7349. $("#webuiPopover3 div.arrow").css("left", "23px");
  7350. $("#webuiPopover3 a.close").css("margin-top", "15px");
  7351. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">诊断</span>';
  7352. html += '<div class="form-group has-feedback" style="float: right;width: 300px;margin-right: 20px;margin-top: 10px;">' +
  7353. ' <input type="text" class="form-control has-feedback-left" ' +
  7354. ' placeholder="搜索" style="padding-left: 10px;" onkeyup="debounce(loadDiagnose(this.value),100,true)" id="paramsDiagnose">' +
  7355. ' <span class="fa fa-search form-control-feedback right" aria-hidden="true" style="right: 0px;"></span>' +
  7356. ' </div>';
  7357. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='diagnoseContentHtml'>";
  7358. html += "</div>";
  7359. $("#webuiPopover3 div.webui-popover-content").html(html);
  7360. $("#webuiPopover3").css("z-index", "10");
  7361. //$("#paramsDiagnose").on('input propertychange', loadDiagnose($("#paramsDiagnose").val()));
  7362. //中文会导致查询混乱
  7363. $("#paramsDiagnose").on('compositionstart', function () {
  7364. $("#paramsDiagnose").attr("isNeedPrevent", true);
  7365. });
  7366. $("#paramsDiagnose").on('compositionend', function () {
  7367. $("#paramsDiagnose").attr("isNeedPrevent", false);
  7368. });
  7369. loadDiagnose("");
  7370. }
  7371. //加载智能接诊模块的诊断推荐推荐
  7372. fitDiagnoseData();
  7373. });
  7374. //中医诊断
  7375. $("#tcmDiagnose").on("click", function (t) {
  7376. $("#western_medicine_name").webuiPopover('hide');
  7377. $("#chinese_medicine_name").webuiPopover('hide');
  7378. $("#jcJyItem").webuiPopover('hide');
  7379. $("#zlItem").webuiPopover('hide');
  7380. if ($(tcmDiagnoseWebuiPopover).css("display") == "block") {
  7381. $("#webuiPopover4 div.arrow").css("left", "23px");
  7382. $("#webuiPopover4 a.close").css("margin-top", "15px");
  7383. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">诊断</span>';
  7384. html += '<div class="form-group has-feedback" style="float: right;width: 300px;margin-right: 20px;margin-top: 10px;">' +
  7385. ' <input type="text" class="form-control has-feedback-left" ' +
  7386. ' placeholder="搜索" style="padding-left: 10px;" onkeyup="debounce(loadtcmDiagnose(this.value),100,true)" id="paramstcmDiagnose">' +
  7387. ' <span class="fa fa-search form-control-feedback right" aria-hidden="true" style="right: 0px;"></span>' +
  7388. ' </div>';
  7389. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='tcmDiagnoseContentHtml'>";
  7390. html += "</div>";
  7391. $("#webuiPopover4 div.webui-popover-content").html(html);
  7392. $("#webuiPopover4").css("z-index", "10");
  7393. //$("#paramsDiagnose").on('input propertychange', loadDiagnose($("#paramsDiagnose").val()));
  7394. //中文会导致查询混乱
  7395. $("#paramstcmDiagnose").on('compositionstart', function () {
  7396. $("#paramstcmDiagnose").attr("isNeedPrevent", true);
  7397. });
  7398. $("#paramstcmDiagnose").on('compositionend', function () {
  7399. $("#paramstcmDiagnose").attr("isNeedPrevent", false);
  7400. });
  7401. loadtcmDiagnose("");
  7402. }
  7403. //加载智能接诊模块的诊断推荐推荐
  7404. // fitDiagnoseData();
  7405. });
  7406. //现病史选中事件
  7407. $("#emrHpi").on("click", function (t) {
  7408. //加载智能接诊模块的现病史推荐推荐
  7409. fitEmrHpiData();
  7410. });
  7411. //既往史选中事件
  7412. $("#emrPs").on("click", function (t) {
  7413. //加载智能接诊模块的既往史推荐推荐
  7414. fitEmrPsData();
  7415. });
  7416. // //西药选中事件
  7417. // $("#western_medicine_name").on("click", function (t) {
  7418. // if ($(westernMedicineWebuiPopover).css("display") == "block") {
  7419. // $("#westernMedicinePopoverContent").parent().parent().prev().css("left", "23px");
  7420. // loadYpList(0);
  7421. // }
  7422. // });
  7423. // //中药选中事件
  7424. // $("#chinese_medicine_name").on("click", function (t) {
  7425. // if ($(chineseMedicineWebuiPopover).css("display") == "block") {
  7426. // $("#chineseMedicinePopoverContent").parent().parent().prev().css("left", "23px");
  7427. // loadYpList(1);
  7428. // }
  7429. // });
  7430. // //诊疗与医技弹窗选中事件
  7431. // $("#jcJyItem").on("click", function (t) {
  7432. // if ($(jcJyItemWebuiPopover).css("display") == "block") {
  7433. // $("#jcJyItemPopoverContent").parent().parent().prev().css("left", "23px");
  7434. // loadjcJyItemList();
  7435. // }
  7436. // });
  7437. //帮助字典弹窗
  7438. settings.width = 450;
  7439. settings.height = 500;
  7440. settings.placement = 'right';//值: auto,top,right,bottom,left,top-right,top-left,bottom-right,bottom-left 要显示的位置
  7441. settings.content = '<div id="treePopoverContent"><div><ul id="treeDemo" class="ztree"></ul></div></div>';
  7442. settings.trigger = 'click';
  7443. var treeWebuiPopover = $('#treeButton').webuiPopover('destroy').webuiPopover(settings);
  7444. $("#treeButton").on("click", function (t) {
  7445. // $("#treePopoverContent").parent().parent().prev().css("left", "23px");
  7446. //初始化药品,检查检验菜单树
  7447. initzTree();
  7448. });
  7449. }
  7450. /**
  7451. * 新增通用参数
  7452. */
  7453. function saveParams() {
  7454. $.ajax({
  7455. type: "POST",
  7456. url: '/thmz/saveTCommonParams',
  7457. contentType: "application/json;charset=UTF-8",
  7458. dataType: "json",
  7459. data: JSON.stringify({
  7460. "paramsType": $("#paramsType").val(),
  7461. "paramsName": $("#paramsNameInput").val()
  7462. }),
  7463. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7464. success: function (res) {
  7465. if (res == '401' || res == 401) {
  7466. window.location.href = '/thmz/login/view'
  7467. return;
  7468. }
  7469. if (res.code == 0) {
  7470. successMesage(res);
  7471. loadSymptom();
  7472. $("#paramsNameInput").val(null);
  7473. // $("#paramsType").selectpicker('val', 0);
  7474. // $("#paramsType").selectpicker('refresh');
  7475. } else {
  7476. errorMesage(res);
  7477. }
  7478. }
  7479. });
  7480. }
  7481. /**
  7482. * 加载主诉参数列表
  7483. */
  7484. function loadSymptom() {
  7485. $.ajax({
  7486. type: "GET",
  7487. url: '/thmz/loadSymptom',
  7488. contentType: "application/json;charset=UTF-8",
  7489. dataType: "json",
  7490. async: false,
  7491. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7492. success: function (res) {
  7493. if (res == '401' || res == 401) {
  7494. window.location.href = '/thmz/login/view'
  7495. return;
  7496. }
  7497. var html = '';
  7498. if (res.code == 0) {
  7499. if (res.featureList != null && res.featureList.length > 0) {
  7500. html += '<div id="feature">';
  7501. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用症状:</div>';
  7502. html += '<div style="width: calc(100% - 80px); float: left;">';
  7503. for (var i = 0; i < res.featureList.length; i++) {
  7504. 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;">';
  7505. html += res.featureList[i].paramsName;
  7506. html += '</span></button>';
  7507. }
  7508. html += '</div><div style="clear:both"></div></div>';
  7509. }
  7510. if (res.timeList != null && res.timeList.length > 0) {
  7511. html += '<div id="time">';
  7512. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用时间:</div>';
  7513. html += '<div style="width: calc(100% - 80px); float: left;">';
  7514. for (var i = 0; i < res.timeList.length; i++) {
  7515. 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;">';
  7516. html += res.timeList[i].paramsName;
  7517. html += '</span></button>';
  7518. }
  7519. html += '</div><div style="clear:both"></div></div>';
  7520. }
  7521. if (res.characterList != null && res.characterList.length > 0) {
  7522. html += '<div id="character">';
  7523. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用标点:</div>';
  7524. html += '<div style="width: calc(100% - 80px); float: left;">';
  7525. for (var i = 0; i < res.characterList.length; i++) {
  7526. 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;">';
  7527. html += res.characterList[i].paramsName;
  7528. html += '</span></button>';
  7529. }
  7530. html += '</div><div style="clear:both"></div></div>';
  7531. }
  7532. if (res.wordsList != null && res.wordsList.length > 0) {
  7533. html += '<div id="words">';
  7534. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用词:</div>';
  7535. html += '<div style="width: calc(100% - 80px); float: left;">';
  7536. for (var i = 0; i < res.wordsList.length; i++) {
  7537. 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;">';
  7538. html += res.wordsList[i].paramsName;
  7539. html += '</span></button>';
  7540. }
  7541. html += '</div><div style="clear:both"></div></div>';
  7542. }
  7543. } else {
  7544. errorMesage(res);
  7545. }
  7546. $("#contentHtml").html(html);
  7547. }
  7548. });
  7549. }
  7550. /**
  7551. * 加载体格检查参数列表
  7552. */
  7553. function loadHealthCheckup() {
  7554. $.ajax({
  7555. type: "GET",
  7556. url: '/thmz/loadHealthCheckup',
  7557. contentType: "application/json;charset=UTF-8",
  7558. dataType: "json",
  7559. async: false,
  7560. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7561. success: function (res) {
  7562. if (res == '401' || res == 401) {
  7563. window.location.href = '/thmz/login/view'
  7564. return;
  7565. }
  7566. var html = '';
  7567. if (res.code == 0) {
  7568. if (res.weightList != null && res.weightList.length > 0) {
  7569. html += '<div id="weightDiv">';
  7570. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">体重:</div>';
  7571. html += '<div style="width: calc(100% - 80px); float: left;">';
  7572. for (var i = 0; i < res.weightList.length; i++) {
  7573. 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;">';
  7574. html += res.weightList[i].paramsName;
  7575. html += '</span></button>';
  7576. }
  7577. html += '</div><div style="clear:both"></div></div>';
  7578. }
  7579. if (res.temperatureList != null && res.temperatureList.length > 0) {
  7580. html += '<div id="temperatureDiv">';
  7581. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">体温:</div>';
  7582. html += '<div style="width: calc(100% - 80px); float: left;">';
  7583. for (var i = 0; i < res.temperatureList.length; i++) {
  7584. 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;">';
  7585. html += res.temperatureList[i].paramsName;
  7586. html += '</span></button>';
  7587. }
  7588. html += '</div><div style="clear:both"></div></div>';
  7589. }
  7590. if (res.sphygmusList != null && res.sphygmusList.length > 0) {
  7591. html += '<div id="sphygmusDiv">';
  7592. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">脉搏:</div>';
  7593. html += '<div style="width: calc(100% - 80px); float: left;">';
  7594. for (var i = 0; i < res.sphygmusList.length; i++) {
  7595. 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;">';
  7596. html += res.sphygmusList[i].paramsName;
  7597. html += '</span></button>';
  7598. }
  7599. html += '</div><div style="clear:both"></div></div>';
  7600. }
  7601. if (res.breatheList != null && res.breatheList.length > 0) {
  7602. html += '<div id="breatheDiv">';
  7603. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">呼吸:</div>';
  7604. html += '<div style="width: calc(100% - 80px); float: left;">';
  7605. for (var i = 0; i < res.breatheList.length; i++) {
  7606. 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;">';
  7607. html += res.breatheList[i].paramsName;
  7608. html += '</span></button>';
  7609. }
  7610. html += '</div><div style="clear:both"></div></div>';
  7611. }
  7612. if (res.pressureList != null && res.pressureList.length > 0) {
  7613. html += '<div id="pressureDiv">';
  7614. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">血压:</div>';
  7615. html += '<div style="width: calc(100% - 80px); float: left;">';
  7616. for (var i = 0; i < res.pressureList.length; i++) {
  7617. 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;">';
  7618. html += res.pressureList[i].paramsName;
  7619. html += '</span></button>';
  7620. }
  7621. html += '</div><div style="clear:both"></div></div>';
  7622. }
  7623. } else {
  7624. errorMesage(res);
  7625. }
  7626. $("#healthCheckupContentHtml").html(html);
  7627. }
  7628. });
  7629. }
  7630. /**
  7631. * 加载中医诊断参数列表
  7632. */
  7633. function loadtcmDiagnose(value) {
  7634. if (!$("#webuiPopover4").hasClass("in")) {
  7635. return;
  7636. }
  7637. let isNeedPrevent = $("#paramstcmDiagnose").attr("isNeedPrevent");
  7638. if (isNeedPrevent == "true") {
  7639. return;
  7640. }
  7641. postAjaxJsonHttpRequst("/thmz/getTcmIcdCodeByParams",{name:value},true,function (res) {
  7642. var html = '';
  7643. if (res.code == 0) {
  7644. if (res.data != null && res.data.length > 0) {
  7645. html += '<div>';
  7646. for (var i = 0; i < res.data.length; i++) {
  7647. html += '<button type="button" class="button_color" style="background-color: rgb(255, 255, 255);border: none;" onclick="fitTcmDiagnoseValue(\'' + res.data[i].name + '\',\'' + res.data[i].code + '\')"><span style="padding: 0px 5px;font-size: 20px;">';
  7648. html += res.data[i].name;
  7649. html += '<small>&nbsp;&nbsp;(' + res.data[i].code + ')</small>';
  7650. html += '</span></button>';
  7651. }
  7652. html += '</div>';
  7653. }
  7654. } else {
  7655. errorMesage(res);
  7656. }
  7657. $("#tcmDiagnoseContentHtml").html(html);
  7658. })
  7659. }
  7660. /**
  7661. * 加载诊断参数列表
  7662. * @param value
  7663. */
  7664. function loadDiagnose(value) {
  7665. if (!$("#webuiPopover3").hasClass("in")) {
  7666. return;
  7667. }
  7668. var isNeedPrevent = $("#paramsDiagnose").attr("isNeedPrevent");
  7669. if (isNeedPrevent == "true") {
  7670. return;
  7671. }
  7672. $.ajax({
  7673. type: "GET",
  7674. url: '/thmz/getIcdCodeByParams?commonParams=' + value,
  7675. contentType: "application/json;charset=UTF-8",
  7676. dataType: "json",
  7677. async: false,
  7678. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  7679. success: function (res) {
  7680. if (res == '401' || res == 401) {
  7681. window.location.href = '/thmz/login/view'
  7682. return;
  7683. }
  7684. var html = '';
  7685. if (res.code == 0) {
  7686. let crbFlag = '1'
  7687. if (res.data != null && res.data.length > 0) {
  7688. html += '<div>';
  7689. for (var i = 0; i < res.data.length; i++) {
  7690. html += '<button type="button" class="button_color" style="background-color: rgb(255, 255, 255);border: none;" onclick="fitDiagnoseValue(\'' + res.data[i].name + '\',\'' + res.data[i].code + '\',\'' + crbFlag + '\',\'' + res.data[i].infectiousdiseasesFlag + '\')"><span style="padding: 0px 5px;font-size: 20px;">';
  7691. html += res.data[i].name;
  7692. html += '<small>&nbsp;&nbsp;(' + res.data[i].code + ')</small>';
  7693. html += '</span></button>';
  7694. }
  7695. html += '</div>';
  7696. }
  7697. } else {
  7698. errorMesage(res);
  7699. }
  7700. $("#diagnoseContentHtml").html(html);
  7701. }
  7702. });
  7703. }
  7704. /**
  7705. * 填充中医诊断
  7706. */
  7707. function fitTcmDiagnoseValue(name, code) {
  7708. if (code === null || code === "") {
  7709. return;
  7710. }
  7711. let html = '';
  7712. let childrenNum = $("#tcmDiagnoseTags").children().length;
  7713. if (childrenNum == 6) {
  7714. errorMesageSimaple("最多填写六个诊断!");
  7715. return;
  7716. }
  7717. let diagnoseValue = $("#tcmDiagnoseValue").val();
  7718. if (diagnoseValue == null || diagnoseValue == "") {
  7719. diagnoseValue = code;
  7720. } else {
  7721. if (diagnoseValue.indexOf(code) != -1) {
  7722. errorMesageSimaple("诊断已存在,请勿重复添加!");
  7723. return;
  7724. }
  7725. diagnoseValue += "," + code;
  7726. }
  7727. $("#tcmDiagnoseValue").val(diagnoseValue);
  7728. if (childrenNum == 0) {
  7729. html += '<span class="el-tag--mainDiagnosis" ';
  7730. } else {
  7731. html += '<span class="el-tag--secondaryDiagnosis" ';
  7732. }
  7733. html += ' title="' + name + '(' + code + ')" id="' + code + '"><span class="el-select__tcmtags-text">' + name + '</span><i class="fa fa-remove .el-icon-close" style="margin-left: 10px;height: 16px;width: 16px;cursor: pointer;" onclick="removetcmDiagnoseValue(\'' + code + '\')"></i><span style="clear: both"></span></span>';
  7734. $("#tcmDiagnoseTags").append(html);
  7735. $("#tcmDiagnoseTags").parent().parent().css("height", $("#tcmDiagnoseTags").height());
  7736. }
  7737. /**
  7738. * 填充诊断
  7739. * @param value
  7740. * @param code
  7741. */
  7742. function fitDiagnoseValue(value, code,crbFlag,infectiousdiseasesFlag) {
  7743. if (code === null || code === "") {
  7744. return;
  7745. }
  7746. var html = '';
  7747. var childrenNum = $("#diagnoseTags").children().length;
  7748. if (childrenNum == 6) {
  7749. errorMesageSimaple("最多填写六个诊断!");
  7750. return;
  7751. }
  7752. var diagnoseValue = $("#diagnoseValue").val();
  7753. if (diagnoseValue == null || diagnoseValue == "") {
  7754. diagnoseValue = code;
  7755. } else {
  7756. if (diagnoseValue.indexOf(code) != -1) {
  7757. errorMesageSimaple("诊断已存在,请勿重复添加!");
  7758. return;
  7759. }
  7760. diagnoseValue += "," + code;
  7761. }
  7762. $("#diagnoseValue").val(diagnoseValue);
  7763. if (childrenNum == 0) {
  7764. html += '<span class="el-tag--mainDiagnosis" ';
  7765. } else {
  7766. html += '<span class="el-tag--secondaryDiagnosis" ';
  7767. }
  7768. 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>';
  7769. $("#diagnoseTags").append(html);
  7770. $("#diagnoseTags").parent().parent().css("height", $("#diagnoseTags").height());
  7771. if(stringNotBlank($("#patientId").text()) && crbFlag =='1' && infectiousdiseasesFlag == 1){
  7772. crbMainCard()
  7773. }
  7774. }
  7775. /**
  7776. * 删除中医诊断
  7777. */
  7778. function removetcmDiagnoseValue(code) {
  7779. var childrenIndex = 0;
  7780. var children = $("#tcmDiagnoseTags").children();
  7781. for (var i = 0; i < children.length; i++) {
  7782. if ($(children[i]).attr("id") == code) {
  7783. childrenIndex = i;
  7784. break;
  7785. }
  7786. }
  7787. $($("#tcmDiagnoseTags").children("span")[childrenIndex]).remove();
  7788. if (childrenIndex == 0) {
  7789. $($("#tcmDiagnoseTags").children("span")[childrenIndex]).removeClass("el-tag--secondaryDiagnosis").addClass("el-tag--mainDiagnosis");
  7790. }
  7791. let tcmDiagnoseValue = $("#tcmDiagnoseValue").val();
  7792. $("#tcmDiagnoseValue").val(tcmDiagnoseValue.replace(code, ""));
  7793. $("#tcmDiagnoseTags").parent().parent().css("height", $("#tcmDiagnoseTags").height());
  7794. }
  7795. /**
  7796. * 移除诊断
  7797. * @param code
  7798. */
  7799. function removeDiagnoseValue(code) {
  7800. var childrenIndex = 0;
  7801. var children = $("#diagnoseTags").children();
  7802. for (var i = 0; i < children.length; i++) {
  7803. if ($(children[i]).attr("id") == code) {
  7804. childrenIndex = i;
  7805. break;
  7806. }
  7807. }
  7808. $($("#diagnoseTags").children("span")[childrenIndex]).remove();
  7809. if (childrenIndex == 0) {
  7810. $($("#diagnoseTags").children("span")[childrenIndex]).removeClass("el-tag--secondaryDiagnosis").addClass("el-tag--mainDiagnosis");
  7811. }
  7812. var diagnoseValue = $("#diagnoseValue").val();
  7813. $("#diagnoseValue").val(diagnoseValue.replace(code, ""));
  7814. $("#diagnoseTags").parent().parent().css("height", $("#diagnoseTags").height());
  7815. }
  7816. /**
  7817. * 点击通用参数属性值时设置值到对应的区域
  7818. * @param value
  7819. * @param id
  7820. */
  7821. function fitValue(value, id) {
  7822. //当选择的是血压时
  7823. if (id == "pressure_") {
  7824. var arr = value.split("/");
  7825. $("#pressure_high").val(arr[0]);
  7826. $("#pressure_floor").val(arr[1]);
  7827. if ($("#pressureLeftFlag").hasClass("in")) {
  7828. $("#pressure_high_left").val(arr[0]);
  7829. $("#pressure_floor_left").val(arr[1]);
  7830. }
  7831. //当选的是体重,体温,脉搏和呼吸时
  7832. } else if (id == "weight" || id == "temperature" || id == "sphygmus" || id == "breathe") {
  7833. $("#" + id).val(value);
  7834. } else {
  7835. //主诉拼写时
  7836. var valueExist = $("#" + id).val();
  7837. if (valueExist != null && valueExist != "") {
  7838. value = valueExist + value;
  7839. }
  7840. $("#" + id).val(value);
  7841. }
  7842. }
  7843. /**
  7844. * 加载药品列表数列表
  7845. * @param index
  7846. */
  7847. function loadYpList(index, event) {
  7848. if (event != null) {
  7849. if (event.keyCode == 38 || event.keyCode == 40 || event.keyCode == 13) {
  7850. //上下键不刷新表格
  7851. return;
  7852. }
  7853. }
  7854. var medicinePopoverContent = null;
  7855. var tableMedicine = null;
  7856. var MedicineName = null;
  7857. //var groupNo=null;
  7858. if (index == 0) {
  7859. medicinePopoverContent = "westernMedicinePopoverContent";
  7860. tableMedicine = "tb_table_western_medicine";
  7861. MedicineName = "western_medicine_name";
  7862. // groupNo=71;
  7863. }
  7864. if (index == 1) {
  7865. medicinePopoverContent = "chineseMedicinePopoverContent";
  7866. tableMedicine = "tb_table_chinese_medicine";
  7867. MedicineName = "chinese_medicine_name";
  7868. // groupNo=$("#zyClassType").val();
  7869. }
  7870. // if (!$("#" + medicinePopoverContent).parent().parent().parent().hasClass("in")) {
  7871. // return;
  7872. // }
  7873. $('#' + MedicineName).webuiPopover('show');
  7874. $('#' + tableMedicine).bootstrapTable('refresh');
  7875. $('#' + tableMedicine).bootstrapTable({
  7876. url: '/thmz/getYpListByCommonParams', //请求后台的URL(*)
  7877. method: 'GET', //请求方式(*)
  7878. toolbar: '#toolbar', //工具按钮用哪个容器
  7879. striped: true, //是否显示行间隔色
  7880. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  7881. pagination: false, //是否显示分页(*)
  7882. sortable: true, //是否启用排序
  7883. sortOrder: "asc", //排序方式
  7884. queryParams: function (params) {
  7885. var groupNo = null;
  7886. if (index == 0) {
  7887. groupNo = 71;
  7888. }
  7889. if (index == 1) {
  7890. groupNo = $("#zyClassType").val();
  7891. }
  7892. var temp = {
  7893. groupNo: groupNo,
  7894. commonParams: $("#" + MedicineName).val()
  7895. };
  7896. return temp;
  7897. }, //传递参数(*)
  7898. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  7899. pageNumber: 1, //初始化加载第一页,默认第一页
  7900. pageSize: 5, //每页的记录行数(*)
  7901. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  7902. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  7903. strictSearch: true,
  7904. showColumns: false, //是否显示所有的列
  7905. showRefresh: false, //是否显示刷新按钮
  7906. minimumCountColumns: 2, //最少允许的列数
  7907. clickToSelect: true, //是否启用点击选中行
  7908. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  7909. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  7910. cardView: false, //是否显示详细视图
  7911. detailView: false,
  7912. //rowStyle:rowStyle,//通过自定义函数设置行样式
  7913. ajaxOptions: {
  7914. headers: {
  7915. 'Accept': 'application/json',
  7916. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  7917. }
  7918. },
  7919. columns: [
  7920. // {
  7921. // title: '药品说明书',
  7922. // field: 'op',
  7923. // align: "center",
  7924. // valign: 'middle',
  7925. // formatter: function (value, row, index) {
  7926. // var str = '<button type="button" class="btn btn-primary btn-sm" onclick="hlyyypsms(\'' + row.code + '\',\'' + row.serial + '\')">说明书</button>';
  7927. // return [str].join('');
  7928. // }
  7929. // },
  7930. {
  7931. field: 'code',
  7932. title: '编码',
  7933. align: "center",
  7934. valign: 'middle',
  7935. // sortable: true
  7936. }, {
  7937. field: 'name',
  7938. title: '药品名称',
  7939. align: "center",
  7940. valign: 'middle',
  7941. // sortable: true
  7942. }
  7943. , {
  7944. field: 'specification',
  7945. title: '规格',
  7946. align: "center",
  7947. valign: 'middle',
  7948. // sortable: true
  7949. }, {
  7950. field: 'manufactory',
  7951. title: '生产厂家',
  7952. align: "center",
  7953. valign: 'middle',
  7954. // sortable: true
  7955. }, {
  7956. field: 'miniUnitName',
  7957. title: '单位',
  7958. align: "center",
  7959. valign: 'middle',
  7960. // sortable: true
  7961. }, {
  7962. field: 'chargeAmount',
  7963. title: '零售价',
  7964. align: "center",
  7965. valign: 'middle',
  7966. // sortable: true
  7967. formatter: function (value, row, index) {
  7968. if (value == null) {
  7969. return '0.0元';
  7970. }
  7971. return value.toFixed(2) + "元";
  7972. }
  7973. }, {
  7974. field: 'drugWinDesc',
  7975. title: '剂量',
  7976. align: "center",
  7977. valign: 'middle',
  7978. // sortable: true
  7979. }, {
  7980. field: 'stockAmountVirtual',
  7981. title: '库存数量',
  7982. align: "center",
  7983. valign: 'middle',
  7984. // sortable: true
  7985. }, {
  7986. field: 'ybBlNew',
  7987. title: '医保报销比例',
  7988. align: "center",
  7989. valign: 'middle',
  7990. // sortable: true
  7991. // formatter: function (value, row, index) {
  7992. // if (value != null) {
  7993. // return value + '%';
  7994. // }
  7995. // }
  7996. }, {
  7997. field: 'ybComment',
  7998. title: '医保说明',
  7999. align: "center",
  8000. valign: 'middle',
  8001. // sortable: true
  8002. }, {
  8003. field: 'nationalCode',
  8004. title: '医保编码',
  8005. align: "left",
  8006. valign: 'middle',
  8007. // sortable: true
  8008. }
  8009. ],
  8010. responseHandler: function (res) {
  8011. if (res == '401' || res == 401) {
  8012. window.location.href = '/thmz/login/view'
  8013. return;
  8014. }
  8015. var ress = eval(res);
  8016. if (ress.code == -1) {
  8017. errorMesage(res);
  8018. return {
  8019. "total": 0,//总页数
  8020. "rows": {} //数据
  8021. };
  8022. }
  8023. $("#" + medicinePopoverContent).parent().css("background", "#EBEBE4");
  8024. return {
  8025. "total": ress.data.length,//总页数
  8026. "rows": ress.data //数据
  8027. };
  8028. },
  8029. onClickRow: function (row, $element) {
  8030. postAjaxJsonHttpRequst("/thmz/checkKssByUserCode",{code:row.code,ypName:row.name,serial:row.serial,patientId:$("#patientId").text(),ypType:row.ypType},true,function (cres) {
  8031. if(cres.code == 0){
  8032. $('#' + MedicineName).webuiPopover('hide');
  8033. console.log("row",row)
  8034. console.log("index",index)
  8035. if (index == 0) {
  8036. clearWesternMedicine(false);
  8037. checkYpInfo(row.code, row.serial, row. groupNo, true, null, 3);
  8038. }
  8039. if (index == 1) {
  8040. checkZyInfo(row.code, row.serial, $("#zyClassType").val(), true);
  8041. }
  8042. }else if(cres.code == -2) {
  8043. errorMesageSimaple(`没有${row.code}/${row.name}的抗生素使用级别权限,不能开具此药品`)
  8044. }else if(cres.code == -3) {
  8045. errorMesageSimaple(cres.message)
  8046. } else {
  8047. errorMesage(cres)
  8048. }
  8049. })
  8050. }
  8051. });
  8052. }
  8053. /**
  8054. * 按照药品的编码 和药品拆零规格查询药品信息 西药
  8055. * @param code
  8056. * @param serial
  8057. * @param groupNo
  8058. * @param needNotice 是否需要提示 当用户操作的时候 true 需要提示, 范文和处方回写的时候false不需要提示
  8059. * @param orderNo 处方号,回写的时候需要用,因为有的处方没有满5个
  8060. * @param type 操作类型 0 修改 1 医疗范文 2 就诊详情 3 处方开立
  8061. */
  8062. function checkYpInfo(code, serial, groupNo, needNotice, orderNo, type) {
  8063. //判断是否有重复的项目 返回true 说明有重复的
  8064. if (verifyRepeat(code, serial, null, 0)) {
  8065. return;
  8066. }
  8067. $("#current_groupNo").val(groupNo);
  8068. //不需要每次都关闭这个帮助字典
  8069. //$("#treeButton").webuiPopover('hide');
  8070. $.ajax({
  8071. type: "GET",
  8072. url: '/thmz/getYpZdDictByCodeAndSerial?code=' + code + "&serial=" + serial + "&deptNo=" + localStorage.getItem("currentDeptNo") + "&groupNo=" + groupNo,
  8073. contentType: "application/json;charset=UTF-8",
  8074. dataType: "json",
  8075. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8076. async: needNotice,//当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  8077. success: function (res) {
  8078. if (res == '401' || res == 401) {
  8079. window.location.href = '/thmz/login/view'
  8080. return;
  8081. }
  8082. if (res.code == 0) {
  8083. if (res.data != null) {
  8084. //如果
  8085. if ($("#xyTab").find("li") == null || $("#xyTab").find("li").length == 0) {
  8086. initNavTabs(0, groupNo, orderNo);
  8087. }
  8088. var cfdesc = '普药';
  8089. if (groupNo == '91') {
  8090. cfdesc = '医材';
  8091. } else if (groupNo == '111') {
  8092. cfdesc = '麻、精一';
  8093. } else if (groupNo == '131') {
  8094. cfdesc = '精二';
  8095. }
  8096. // else if(groupNo=='151'){
  8097. // cfdesc='诊疗';
  8098. // }
  8099. //每个处方不能超过5个药品
  8100. var tableId = $("#xyTab li.active").find("a").attr("href");
  8101. var childrens = $(tableId).find("div:eq(0)").children().length;
  8102. var currentGroupNo = $(tableId).find("input.current_groupNo").val();
  8103. var flag = childrens === 5;
  8104. if (!needNotice) {
  8105. flag = childrens === 5 && $(tableId).is(':last-child');
  8106. }
  8107. if (currentGroupNo != null && currentGroupNo != '' && groupNo != currentGroupNo) {
  8108. //当前编辑的处方与选中的品类非同一处方能保存的
  8109. var currentGroupNos = $("#xyTabContent").find("input.current_groupNo");
  8110. //是否需要新增处方页,以保存医材处方
  8111. var needAddTable = true;
  8112. for (var i = 0; i < currentGroupNos.length; i++) {
  8113. if ($(currentGroupNos[i]).val() == groupNo) {
  8114. var next = $(currentGroupNos[i]).next();
  8115. if (needAddTable && $(next).children().length < 5) {
  8116. var parentId = $(currentGroupNos[i]).parent().attr("id");
  8117. //切换处方
  8118. $("#xyTab").find("a[href='#" + parentId + "']").off("click").tab('show');
  8119. //$("#xyTab").find("a[href='#" + tableId + "']").off("click").click();
  8120. //因为存在没有满5个的处方页,直接保存到该页
  8121. needAddTable = false;
  8122. fitWesternMedicine(res, groupNo, type);
  8123. }
  8124. }
  8125. }
  8126. if (needAddTable) {
  8127. //91 医材
  8128. var message = "医材需要单独处方,是否需要新增医材处方?";
  8129. if (groupNo == '71') {
  8130. message = "普通西成药需要单独处方,是否需要新增处方?"
  8131. } else if (groupNo == '111') {
  8132. message = "麻、精一药物需要单独处方,是否需要新增处方?"
  8133. } else if (groupNo == '131') {
  8134. message = "精二药物需要单独处方,是否需要新增处方?"
  8135. }
  8136. if (needNotice) {
  8137. $("#messageModal").modal();
  8138. $("#messageContent").html(message);
  8139. $("#messageButton").off("click").on("click", function (t) {
  8140. $("#messageModal").modal("hide");
  8141. refreshNavTabs(0, groupNo, orderNo);
  8142. fitWesternMedicine(res, groupNo, type);
  8143. // //选中药品后,光标默认到用法
  8144. // $("#supplyType").next().click();
  8145. });
  8146. $("#cancelButton").off("click");
  8147. } else {
  8148. refreshNavTabs(0, groupNo, orderNo);
  8149. fitWesternMedicine(res, groupNo, type);
  8150. }
  8151. }
  8152. //当前编辑的处方非普通西药处方
  8153. } else if (flag) {
  8154. if (needNotice) {
  8155. $("#messageModal").modal();
  8156. $("#messageContent").html("单张处方最多只能开具5个药品,是否需要新增处方?");
  8157. $("#messageButton").off("click").on("click", function (t) {
  8158. $("#messageModal").modal("hide");
  8159. refreshNavTabs(0, groupNo, orderNo);
  8160. fitWesternMedicine(res, groupNo, type);
  8161. });
  8162. $("#cancelButton").off("click");
  8163. } else {
  8164. refreshNavTabs(0, groupNo, orderNo);
  8165. fitWesternMedicine(res, groupNo, type);
  8166. }
  8167. } else {
  8168. //修改药品
  8169. if (orderNo != null) {
  8170. //西药处方数量
  8171. // var xyTabLiLength = $("#xyTab li").length;
  8172. // if (xyTabLiLength < orderNo) {
  8173. //
  8174. // } else {
  8175. // $("#xyTab li.active").find("a").find("small.cfdesc").text("(" + cfdesc + ")");
  8176. // }
  8177. var tableId = orderNoAndTableIdMap.get(orderNo);
  8178. if (tableId != null && tableId != "") {
  8179. //切换处方
  8180. $("#xyTab").find("a[href='#" + tableId + "']").off("click").tab('show');
  8181. //$("#xyTab").find("a[href='#" + tableId + "']").off("click").click();
  8182. $("#xyTab li.active").find("a").find("small.cfdesc").text("(" + cfdesc + ")");
  8183. } else {
  8184. refreshNavTabs(0, groupNo, orderNo);
  8185. }
  8186. fitWesternMedicine(res, groupNo, type);
  8187. } else {
  8188. $("#xyTab li.active").find("a").find("small.cfdesc").text("(" + cfdesc + ")");
  8189. fitWesternMedicine(res, groupNo, type);
  8190. }
  8191. }
  8192. }
  8193. } else {
  8194. errorMesage(res);
  8195. }
  8196. }
  8197. });
  8198. }
  8199. /**
  8200. * 项目限制提示
  8201. * @param res
  8202. * @param projectDesc
  8203. */
  8204. function checkProjectSelfInfo(row) {
  8205. // console.log("checkProjectSelfInfo",row,ele)
  8206. var code = 0;
  8207. var age = currentPatientInfo.age;
  8208. var sex = currentPatientInfo.sex;
  8209. console.log("currentPatientInfo",currentPatientInfo)
  8210. if (row.genderRestriction && row.genderRestriction != 0 && sex != row.genderRestriction) {
  8211. warningMesageSimaple('项目'+row.name+'要求性别为'+row.genderRestriction == '1'?'男':'女'+'请重新选择!');
  8212. code = 1;
  8213. }
  8214. if (row.maxAgeRestriction && age > row.maxAgeRestriction) {
  8215. warningMesageSimaple('项目'+row.name+'要求年龄小于或等于'+row.maxAgeRestriction+'岁,请重新选择!');
  8216. code = 1;
  8217. }
  8218. if (row.minAgeRestriction && age < row.minAgeRestriction) {
  8219. warningMesageSimaple('项目'+row.name+'要求年龄大于或等于'+row.minAgeRestriction+'岁,请重新选择!');
  8220. code = 1;
  8221. }
  8222. return code;
  8223. }
  8224. /**
  8225. * 药品与项目自费信息提示
  8226. * @param res
  8227. * @param projectDesc
  8228. */
  8229. function hintProjectSelfPayInfo(selfpayProp, projectDesc) {
  8230. var zgmztczf = $("#zgmztczf").val();
  8231. if ((zgmztczf == 1 || zgmztczf == "1") && selfpayProp != null) {
  8232. selfpayProp = Number(selfpayProp);
  8233. if (selfpayProp > 0) {
  8234. var titile = "当前项目含自费" + projectDesc + ",请与患者提前确认是否继续使用,并签署自费承诺书!";
  8235. if (selfpayProp < 1) {
  8236. titile = "当前项目含部分自费" + projectDesc + ",请与患者提前确认是否继续使用,并签署自费承诺书!";
  8237. }
  8238. warningMesageSimaple(titile);
  8239. }
  8240. }
  8241. }
  8242. /**
  8243. * 按照药品的编码 和药品拆零规格查询药品信息 中药
  8244. * @param code
  8245. * @param serial
  8246. * @param groupNo 药房信息
  8247. * @param async 当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  8248. */
  8249. function checkZyInfo(code, serial, groupNo, async) {
  8250. //判断是否有重复的项目 返回true 说明有重复的
  8251. if (verifyRepeat(code, serial, null, 1)) {
  8252. return;
  8253. }
  8254. let tcmDiagnoseValue = $("#tcmDiagnoseValue").val()
  8255. if(stringIsBlank(tcmDiagnoseValue)){
  8256. errorMesageSimaple('开中药必须要写中医诊断')
  8257. return;
  8258. }
  8259. $.ajax({
  8260. type: "GET",
  8261. url: '/thmz/getYpZdDictByCodeAndSerial?code=' + code + "&serial=" + serial + "&deptNo=" + localStorage.getItem("currentDeptNo") + "&groupNo=" + groupNo,
  8262. contentType: "application/json;charset=UTF-8",
  8263. dataType: "json",
  8264. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8265. async: async,//当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  8266. success: function (res) {
  8267. if (res == '401' || res == 401) {
  8268. window.location.href = '/thmz/login/view'
  8269. return;
  8270. }
  8271. if (res.code == 0) {
  8272. if (res.data != null) {
  8273. hintProjectSelfPayInfo(res.data.selfpayProp, "药品");
  8274. //如果
  8275. if ($("#zyTab").find("li") == null || $("#zyTab").find("li").length == 0) {
  8276. initNavTabs(1, null, null);
  8277. //$("input.zyfs").val(1);
  8278. }
  8279. $("#chinese_medicine_name").val(res.data.name);
  8280. $("#chinese_medicine_name").blur();
  8281. //$("#zy_drugWin").val(res.data.weight);
  8282. $("#zy_packRetprice").val(res.data.packRetprice);
  8283. $("#chinese_medicine_current_code").val(res.data.code);
  8284. $("#chinese_medicine_current_serial").val(res.data.serial);
  8285. if (async) {
  8286. //选中药品后,光标默认到数量输入框
  8287. $("#zy_drugWin").focus();
  8288. // prevEleId = 'zy_drugWin';
  8289. }
  8290. }
  8291. } else {
  8292. errorMesage(res);
  8293. }
  8294. }
  8295. });
  8296. }
  8297. /**
  8298. * 加载辅助检查、检验列表
  8299. * @param index
  8300. */
  8301. function loadjcJyItemList(event) {
  8302. if (event != null) {
  8303. if (event.keyCode == 38 || event.keyCode == 40 || event.keyCode == 13) {
  8304. //上下键不刷新表格
  8305. return;
  8306. }
  8307. }
  8308. // if (!$("#jcJyItemPopoverContent").parent().parent().parent().hasClass("in")) {
  8309. // return;
  8310. // }
  8311. $('#jcJyItem').webuiPopover('show');
  8312. $('#tb_table_jc_jy_item').bootstrapTable('refresh');
  8313. $('#tb_table_jc_jy_item').bootstrapTable({
  8314. url: '/thmz/getJcJyItemByCommonParams', //请求后台的URL(*)
  8315. method: 'GET', //请求方式(*)
  8316. toolbar: '#toolbar', //工具按钮用哪个容器
  8317. striped: true, //是否显示行间隔色
  8318. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  8319. pagination: false, //是否显示分页(*)
  8320. sortable: true, //是否启用排序
  8321. sortOrder: "asc", //排序方式
  8322. queryParams: function (params) {
  8323. var temp = {
  8324. commonParams: $("#jcJyItem").val()
  8325. };
  8326. return temp;
  8327. }, //传递参数(*)
  8328. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  8329. pageNumber: 1, //初始化加载第一页,默认第一页
  8330. pageSize: 5, //每页的记录行数(*)
  8331. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  8332. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  8333. strictSearch: true,
  8334. showColumns: false, //是否显示所有的列
  8335. showRefresh: false, //是否显示刷新按钮
  8336. minimumCountColumns: 2, //最少允许的列数
  8337. clickToSelect: true, //是否启用点击选中行
  8338. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  8339. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  8340. cardView: false, //是否显示详细视图
  8341. detailView: false,
  8342. //rowStyle:rowStyle,//通过自定义函数设置行样式
  8343. ajaxOptions: {
  8344. headers: {
  8345. 'Accept': 'application/json',
  8346. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  8347. }
  8348. },
  8349. columns: [
  8350. {
  8351. field: 'code',
  8352. title: '编码',
  8353. align: "center",
  8354. valign: 'middle',
  8355. // sortable: true
  8356. }, {
  8357. field: 'name',
  8358. title: '名称',
  8359. align: "center",
  8360. valign: 'middle',
  8361. // sortable: true
  8362. }
  8363. , {
  8364. field: 'execUnitName',
  8365. title: '执行科室',
  8366. align: "center",
  8367. valign: 'middle',
  8368. // sortable: true
  8369. }, {
  8370. field: 'type',
  8371. title: '项目类型',
  8372. align: "center",
  8373. valign: 'middle',
  8374. // sortable: true
  8375. formatter: function (value, row, index) {
  8376. if (value == 1 || value == "1") {
  8377. return "检验";
  8378. }
  8379. if (value == 2 || value == "2") {
  8380. return "辅助检查";
  8381. }
  8382. if (value == 3 || value == "3") {
  8383. return "诊疗";
  8384. }
  8385. return "";
  8386. }
  8387. },
  8388. ],
  8389. responseHandler: function (res) {
  8390. if (res == '401' || res == 401) {
  8391. window.location.href = '/thmz/login/view'
  8392. return;
  8393. }
  8394. var ress = eval(res);
  8395. if (ress.code == -1) {
  8396. errorMesage(res);
  8397. return {
  8398. "total": 0,//总页数
  8399. "rows": {} //数据
  8400. };
  8401. }
  8402. $("#jcJyItemPopoverContent").parent().css("background", "#EBEBE4");
  8403. return {
  8404. "total": ress.data.length,//总页数
  8405. "rows": ress.data //数据
  8406. };
  8407. },
  8408. onClickRow: function (row, $element) {
  8409. postAjaxJsonHttpRequst("/thmz/checkJyJcGenderAndAge",{
  8410. patientId: $("#patientId").text(),
  8411. type:row.type,
  8412. code:row.code
  8413. },true,function (resJyJc) {
  8414. if(resJyJc.code == 0){
  8415. $('#jcJyItem').webuiPopover('hide');
  8416. $("#jcJyZltype").val(row.type);
  8417. $("#execUnit").selectpicker('val', row.execUnit);//默认不选中
  8418. $("#execUnit").selectpicker('refresh');
  8419. if (row.type == 1) {
  8420. //检验
  8421. $("#jyZdSampleDiv").removeClass("hide").addClass("in");
  8422. $("#jyQuantityDiv").removeClass("hide").addClass("in");
  8423. $("#yshPartDiv").removeClass("in").addClass("hide");
  8424. if (row.sampleCode != null && row.sampleCode != "") {
  8425. $("#jyZdSample").selectpicker('val', row.sampleCode);
  8426. $('#jyZdSample').selectpicker('refresh');
  8427. }
  8428. } else if (row.type == 2) {
  8429. //检查
  8430. $("#yshPartDiv").removeClass("hide").addClass("in");
  8431. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  8432. $("#jyQuantityDiv").removeClass("in").addClass("hide");
  8433. if (row.bwCode != null && row.bwCode != "") {
  8434. $("#yshPart").selectpicker('val', row.bwCode);
  8435. $('#yshPart').selectpicker('refresh');
  8436. }
  8437. }
  8438. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  8439. checkJcJyItemInfo(row.code, row.name, row.type, true);
  8440. }else {
  8441. errorMesage(resJyJc)
  8442. }
  8443. })
  8444. }
  8445. });
  8446. }
  8447. /**
  8448. * 加载外配药品
  8449. * @param event
  8450. */
  8451. function loadWpMedicineList(event) {
  8452. if (event != null) {
  8453. if (event.keyCode == 38 || event.keyCode == 40 || event.keyCode == 13) {
  8454. //上下键不刷新表格
  8455. return;
  8456. }
  8457. }
  8458. $('#wp_medicine_name').webuiPopover('show');
  8459. $('#tb_table_wp_medicine').bootstrapTable('refresh');
  8460. $('#tb_table_wp_medicine').bootstrapTable({
  8461. url: '/thmz/wpMzPrescription/queryRxMedicine', //请求后台的URL(*)
  8462. method: 'post', //请求方式(*)
  8463. toolbar: '#toolbar', //工具按钮用哪个容器
  8464. striped: true, //是否显示行间隔色
  8465. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  8466. pagination: false, //是否显示分页(*)
  8467. sortable: true, //是否启用排序
  8468. sortOrder: "asc", //排序方式
  8469. queryParams: function (params) {
  8470. var temp = {
  8471. keyWard: $("#wp_medicine_name").val()
  8472. };
  8473. return temp;
  8474. }, //传递参数(*)
  8475. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  8476. pageNumber: 1, //初始化加载第一页,默认第一页
  8477. pageSize: 5, //每页的记录行数(*)
  8478. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  8479. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  8480. strictSearch: true,
  8481. showColumns: false, //是否显示所有的列
  8482. showRefresh: false, //是否显示刷新按钮
  8483. minimumCountColumns: 2, //最少允许的列数
  8484. clickToSelect: true, //是否启用点击选中行
  8485. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  8486. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  8487. cardView: false, //是否显示详细视图
  8488. detailView: false,
  8489. //rowStyle:rowStyle,//通过自定义函数设置行样式
  8490. ajaxOptions: {
  8491. headers: {
  8492. 'Accept': 'application/json',
  8493. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  8494. }
  8495. },
  8496. columns: [
  8497. {
  8498. field: 'medListCodg',
  8499. title: '医保码',
  8500. align: "center",
  8501. valign: 'middle',
  8502. width: 250,
  8503. // sortable: true
  8504. },
  8505. {
  8506. field: 'genname',
  8507. title: '药品名称',
  8508. align: "center",
  8509. valign: 'middle',
  8510. width: 150,
  8511. // sortable: true
  8512. }
  8513. , {
  8514. field: 'specName',
  8515. title: '规格',
  8516. align: "center",
  8517. valign: 'middle',
  8518. // sortable: true
  8519. }, {
  8520. field: 'prdrName',
  8521. title: '生产厂家',
  8522. align: "center",
  8523. valign: 'middle',
  8524. // sortable: true
  8525. }, {
  8526. field: 'aprvno',
  8527. title: '批准文号',
  8528. align: "center",
  8529. valign: 'middle',
  8530. // sortable: true
  8531. }, {
  8532. field: 'dualchnlFlag',
  8533. title: '是否双通道标志',
  8534. align: "center",
  8535. valign: 'middle',
  8536. formatter: function (value, row, index) {
  8537. if(value == 1 || value == "1"){
  8538. return "是";
  8539. }
  8540. return "否";
  8541. }
  8542. // sortable: true
  8543. }, {
  8544. field: 'minPrepunt',
  8545. title: '最小制剂单位',
  8546. align: "center",
  8547. valign: 'middle',
  8548. // sortable: true
  8549. }
  8550. , {
  8551. field: 'minPacunt',
  8552. title: '最小包装单位',
  8553. align: "center",
  8554. valign: 'middle',
  8555. // sortable: true
  8556. }
  8557. ],
  8558. responseHandler: function (res) {
  8559. if (res == '401' || res == 401) {
  8560. window.location.href = '/thmz/login/view'
  8561. return;
  8562. }
  8563. var ress = eval(res);
  8564. if (ress.code == -1) {
  8565. errorMesage(res);
  8566. return {
  8567. "total": 0,//总页数
  8568. "rows": {} //数据
  8569. };
  8570. }
  8571. $("#wpMedicinePopoverContent").parent().css("background", "#EBEBE4");
  8572. return {
  8573. "total": ress.data.length,//总页数
  8574. "rows": ress.data //数据
  8575. };
  8576. },
  8577. onClickRow: function (row, $element) {
  8578. $('#wp_medicine_name').webuiPopover('hide');
  8579. //诊疗
  8580. if ($("#wpMedicineTab").find("li") == null || $("#wpMedicineTab").find("li").length == 0) {
  8581. initNavTabs(6, null, null);
  8582. }
  8583. $("#wp_medicine_name").val(row.genname);
  8584. $("#wp_medicine_name").blur();
  8585. $("#sinDosunt").val(row.minPrepunt);
  8586. $("#sinDoscnt").val('1');
  8587. setSelectDefaultVal('usedFrquCodg','13')
  8588. setSelectDefaultVal('drugDosform',row.dosformName)
  8589. $("#prdrName").val(row.prdrName);
  8590. $("#drugDosunt").val(row.minPacunt);
  8591. $("#drugSpec").val(row.specName);
  8592. $("#wp_medicine_current_code").val(row.medListCodg);
  8593. $("#sinDoscnt").focus();
  8594. return;
  8595. }
  8596. });
  8597. }
  8598. /**
  8599. * 加载诊疗列表
  8600. * @param index
  8601. */
  8602. function loadZlItemList(event) {
  8603. if (event != null) {
  8604. if (event.keyCode == 38 || event.keyCode == 40 || event.keyCode == 13) {
  8605. //上下键不刷新表格
  8606. return;
  8607. }
  8608. }
  8609. $('#zlItem').webuiPopover('show');
  8610. $('#tb_table_zl_item').bootstrapTable('refresh');
  8611. $('#tb_table_zl_item').bootstrapTable({
  8612. url: '/thmz/getZlItemByCommonParams', //请求后台的URL(*)
  8613. method: 'GET', //请求方式(*)
  8614. toolbar: '#toolbar', //工具按钮用哪个容器
  8615. striped: true, //是否显示行间隔色
  8616. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  8617. pagination: false, //是否显示分页(*)
  8618. sortable: true, //是否启用排序
  8619. sortOrder: "asc", //排序方式
  8620. queryParams: function (params) {
  8621. var temp = {
  8622. commonParams: $("#zlItem").val()
  8623. };
  8624. return temp;
  8625. }, //传递参数(*)
  8626. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  8627. pageNumber: 1, //初始化加载第一页,默认第一页
  8628. pageSize: 5, //每页的记录行数(*)
  8629. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  8630. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  8631. strictSearch: true,
  8632. showColumns: false, //是否显示所有的列
  8633. showRefresh: false, //是否显示刷新按钮
  8634. minimumCountColumns: 2, //最少允许的列数
  8635. clickToSelect: true, //是否启用点击选中行
  8636. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  8637. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  8638. cardView: false, //是否显示详细视图
  8639. detailView: false,
  8640. //rowStyle:rowStyle,//通过自定义函数设置行样式
  8641. ajaxOptions: {
  8642. headers: {
  8643. 'Accept': 'application/json',
  8644. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  8645. }
  8646. },
  8647. columns: [
  8648. {
  8649. field: 'code',
  8650. title: '编码',
  8651. align: "center",
  8652. valign: 'middle',
  8653. // sortable: true
  8654. }, {
  8655. field: 'name',
  8656. title: '名称',
  8657. align: "center",
  8658. valign: 'middle',
  8659. // sortable: true
  8660. }
  8661. , {
  8662. field: 'execUnitName',
  8663. title: '执行科室',
  8664. align: "center",
  8665. valign: 'middle',
  8666. // sortable: true
  8667. }
  8668. , {
  8669. field: 'chargeAmount',
  8670. title: '价格',
  8671. align: "center",
  8672. valign: 'middle',
  8673. // sortable: true
  8674. formatter: function (value, row, index) {
  8675. if (value == null) {
  8676. return "0.00元";
  8677. }
  8678. return value.toFixed(2) + "元";
  8679. }
  8680. }, {
  8681. field: 'descriptions',
  8682. title: '规格',
  8683. align: "center",
  8684. valign: 'middle',
  8685. // sortable: true
  8686. }, {
  8687. field: 'selfpayProp',
  8688. title: '自付比例',
  8689. align: "center",
  8690. valign: 'middle',
  8691. // sortable: true
  8692. formatter: function (value, row, index) {
  8693. if (value != null) {
  8694. return value + '%';
  8695. }
  8696. }
  8697. }, {
  8698. field: 'connotation',
  8699. title: '医保说明',
  8700. align: "center",
  8701. valign: 'middle',
  8702. // sortable: true
  8703. }, {
  8704. field: 'nationalCode',
  8705. title: '医保编码',
  8706. align: "left",
  8707. valign: 'middle',
  8708. // sortable: true
  8709. }
  8710. ],
  8711. responseHandler: function (res) {
  8712. if (res == '401' || res == 401) {
  8713. window.location.href = '/thmz/login/view'
  8714. return;
  8715. }
  8716. var ress = eval(res);
  8717. if (ress.code == -1) {
  8718. errorMesage(res);
  8719. return {
  8720. "total": 0,//总页数
  8721. "rows": {} //数据
  8722. };
  8723. }
  8724. $("#zlItemPopoverContent").parent().css("background", "#EBEBE4");
  8725. return {
  8726. "total": ress.data.length,//总页数
  8727. "rows": ress.data //数据
  8728. };
  8729. },
  8730. onClickRow: function (row, $element) {
  8731. //判断是否验证失败,0通过1失败
  8732. // console.log("checkProjectSelfInfo(row)",checkProjectSelfInfo(row))
  8733. if(checkProjectSelfInfo(row) == 1){
  8734. return;
  8735. }
  8736. hintProjectSelfPayInfo(row.selfpayProp, "诊疗");
  8737. $('#zlItem').webuiPopover('hide');
  8738. $("#zlExecUnit").selectpicker('val', row.execUnit);//默认不选中
  8739. $("#zlExecUnit").selectpicker('refresh');
  8740. //诊疗
  8741. if ($("#zlTab").find("li") == null || $("#zlTab").find("li").length == 0) {
  8742. initNavTabs(3, null, null);
  8743. }
  8744. $("#zlItem").val(row.name);
  8745. $("#zlItem").blur();
  8746. $("#zlItemPrice").val(row.chargeAmount);
  8747. zlItemPriceIsReadonly(row.chargeAmount);
  8748. $("#chargeUnit").val(row.specification);
  8749. $("#zl_current_code").val(row.code);
  8750. $("#itemQuantity").val(1);
  8751. $("#descriptions").val(row.descriptions);
  8752. $("#descriptions").attr('title', row.descriptions);
  8753. $("#dayZlNum").selectpicker('val', 1);//默认不选中
  8754. $("#dayZlNum").selectpicker('refresh');
  8755. $("#orderFrequencyZl").selectpicker('val', 'ONCE');//默认不选中
  8756. $("#orderFrequencyZl").selectpicker('refresh');
  8757. calculateZl(false);
  8758. $("#chargeUnit").focus();
  8759. return;
  8760. }
  8761. });
  8762. }
  8763. /**
  8764. * 诊疗单价输入框是否只读
  8765. */
  8766. function zlItemPriceIsReadonly(val) {
  8767. if(val !=null && Number(val) > 0 ){
  8768. $("#zlItemPrice").attr("readonly","readonly")
  8769. }else {
  8770. $("#zlItemPrice").removeAttr("readonly")
  8771. }
  8772. }
  8773. /**
  8774. * 诊疗与医技选中
  8775. * @param code
  8776. * @param name 回写的时候可以设置null
  8777. * @param type 1 检验 2 检查
  8778. * @param async 当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  8779. */
  8780. //function checkJcJyItemInfo(code, name, type) {
  8781. function checkJcJyItemInfo(code, name, type, async) {
  8782. // //判断是否有重复的项目 返回true 说明有重复的
  8783. // if (verifyRepeat(code, null, 2)) {
  8784. // return;
  8785. // }
  8786. //不需要每次都关闭帮助树
  8787. //$("#treeButton").webuiPopover('hide');
  8788. $.ajax({
  8789. type: "GET",
  8790. url: '/thmz/getJcJyItemChargeByCode?code=' + code + '&jcJyZltype=' + type,
  8791. contentType: "application/json;charset=UTF-8",
  8792. dataType: "json",
  8793. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  8794. async: async,//当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  8795. success: function (res) {
  8796. if (res == '401' || res == 401) {
  8797. window.location.href = '/thmz/login/view'
  8798. return;
  8799. }
  8800. if (res.code == 0) {
  8801. if (res.data != null) {
  8802. hintProjectSelfPayInfo(res.selfpayProp, type == 1 ? "检验" : "辅助检查");
  8803. //如果
  8804. if ($("#jcjyTab").find("li") == null || $("#jcjyTab").find("li").length == 0) {
  8805. initNavTabs(2, null, null);
  8806. }
  8807. if (name == null) {
  8808. name = res.name;
  8809. }
  8810. $("#jcJyItem").val(name);
  8811. $("#jcJyItem").blur();
  8812. $("#jcjyItemPrice").val(res.totalAmount);
  8813. $("#jcjy_current_code").val(code);
  8814. $("#jyQuantity").val(1);
  8815. $("#execUnit").selectpicker('val', res.execUnit);//默认不选中
  8816. $("#execUnit").selectpicker('refresh');
  8817. // if (async) {
  8818. // if (type == 1) {
  8819. // //选中项目后,光标默认到数量输入框
  8820. // $("#jyZdSample").next().click();
  8821. // // prevEleId = 'jyZdSample';
  8822. // } else if (type == 2) {
  8823. // $("#yshPart").next().click();
  8824. // // prevEleId = 'yshPart';
  8825. // }
  8826. // }
  8827. }
  8828. $("#jyjcNote").val(res.note)
  8829. } else {
  8830. errorMesage(res);
  8831. }
  8832. }
  8833. });
  8834. }
  8835. /**
  8836. * 查询辅助检查、检验项目明细
  8837. * @param code 编码
  8838. * @param jcJyZltype 1 检验 2 检查
  8839. */
  8840. function getJcJyItemChargeByCode(code, jcJyZltype) {
  8841. if (code != null) {
  8842. $("#itemCodeSearch").val(code);
  8843. $("#jcJyZltypeSearch").val(jcJyZltype);
  8844. } else if ($("#jcjy_current_code").val() == null || $("#jcjy_current_code").val() == '') {
  8845. errorMesageSimaple("未选中任何项目!");
  8846. return;
  8847. }
  8848. $("#jcJyItemModal").modal("show");
  8849. $('#jcJyItemTable').bootstrapTable('refresh');
  8850. $('#jcJyItemTable').bootstrapTable({
  8851. url: '/thmz/getJcJyItemChargeByCode', //请求后台的URL(*)
  8852. method: 'GET', //请求方式(*)
  8853. toolbar: '#toolbar', //工具按钮用哪个容器
  8854. striped: true, //是否显示行间隔色
  8855. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  8856. pagination: false, //是否显示分页(*)
  8857. sortable: true, //是否启用排序
  8858. sortOrder: "asc", //排序方式
  8859. queryParams: function (params) {
  8860. var itemCodeSearch = $("#itemCodeSearch").val();
  8861. var jcJyZltypeSearch = $("#jcJyZltypeSearch").val();
  8862. if (itemCodeSearch == null || itemCodeSearch == "") {
  8863. itemCodeSearch = $("#jcjy_current_code").val();
  8864. jcJyZltypeSearch = $("#jcJyZltype").val();
  8865. }
  8866. var temp = {
  8867. code: itemCodeSearch,
  8868. jcJyZltype: jcJyZltypeSearch
  8869. };
  8870. return temp;
  8871. }, //传递参数(*)
  8872. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  8873. pageNumber: 1, //初始化加载第一页,默认第一页
  8874. pageSize: 5, //每页的记录行数(*)
  8875. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  8876. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  8877. strictSearch: true,
  8878. showColumns: false, //是否显示所有的列
  8879. showRefresh: false, //是否显示刷新按钮
  8880. minimumCountColumns: 2, //最少允许的列数
  8881. clickToSelect: true, //是否启用点击选中行
  8882. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  8883. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  8884. cardView: false, //是否显示详细视图
  8885. detailView: false,
  8886. //rowStyle:rowStyle,//通过自定义函数设置行样式
  8887. ajaxOptions: {
  8888. headers: {
  8889. 'Accept': 'application/json',
  8890. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  8891. }
  8892. },
  8893. columns: [
  8894. {
  8895. field: 'tcCode',
  8896. title: '项目编码',
  8897. align: "center",
  8898. valign: 'middle',
  8899. // sortable: true
  8900. }, {
  8901. field: 'code',
  8902. title: '收费编码',
  8903. align: "center",
  8904. valign: 'middle',
  8905. // sortable: true
  8906. }
  8907. , {
  8908. field: 'name',
  8909. title: '收费名称',
  8910. align: "center",
  8911. valign: 'middle',
  8912. // sortable: true
  8913. }, {
  8914. field: 'num',
  8915. title: '数量',
  8916. align: "center",
  8917. valign: 'middle',
  8918. // sortable: true
  8919. }, {
  8920. field: 'chargeAmount',
  8921. title: '单价',
  8922. align: "center",
  8923. valign: 'middle',
  8924. // sortable: true
  8925. formatter: function (value, row, index) {
  8926. if (value == null || value == "") {
  8927. return 0;
  8928. }
  8929. return value.toFixed(2);
  8930. }
  8931. }, {
  8932. field: 'totalAmount',
  8933. title: '总金额',
  8934. align: "center",
  8935. valign: 'middle',
  8936. // sortable: true
  8937. formatter: function (value, row, index) {
  8938. if (value == null || value == "") {
  8939. return 0;
  8940. }
  8941. return value.toFixed(2);
  8942. }
  8943. }, {
  8944. field: 'selfpayProp',
  8945. title: '自付比例',
  8946. align: "center",
  8947. valign: 'middle',
  8948. // sortable: true
  8949. formatter: function (value, row, index) {
  8950. if (value != null) {
  8951. return value + '%';
  8952. }
  8953. }
  8954. }, {
  8955. field: 'connotation',
  8956. title: '医保说明',
  8957. align: "center",
  8958. valign: 'middle',
  8959. // sortable: true
  8960. }
  8961. ],
  8962. responseHandler: function (res) {
  8963. if (res == '401' || res == 401) {
  8964. window.location.href = '/thmz/login/view'
  8965. return;
  8966. }
  8967. $("#itemCodeSearch").val(null);
  8968. $("#jyjcNote").val(res.note)
  8969. var ress = eval(res);
  8970. if (ress.code == -1) {
  8971. errorMesage(res);
  8972. return {
  8973. "total": 0,//总页数
  8974. "rows": {} //数据
  8975. };
  8976. }
  8977. return {
  8978. "total": ress.data.length,//总页数
  8979. "rows": ress.data //数据
  8980. };
  8981. }
  8982. });
  8983. }
  8984. function getJyJcCodeParam() {
  8985. var itemCodeSearch = $("#itemCodeSearch").val();
  8986. var jcJyZltypeSearch = $("#jcJyZltypeSearch").val();
  8987. if (itemCodeSearch == null || itemCodeSearch == "") {
  8988. itemCodeSearch = $("#jcjy_current_code").val();
  8989. jcJyZltypeSearch = $("#jcJyZltype").val();
  8990. }
  8991. var temp = {
  8992. code: itemCodeSearch,
  8993. jcJyZltype: jcJyZltypeSearch
  8994. };
  8995. return temp;
  8996. }
  8997. /**
  8998. * 判断是否有重复的项目 返回true 说明有重复的
  8999. * @param code 编码
  9000. * @param serial 药品规格 null 时是非药品
  9001. * @param chargeUnitCode 检查部位或者检验物 null 时是 诊疗
  9002. * @param index
  9003. */
  9004. function verifyRepeat(code, serial, chargeUnitCode, index) {
  9005. //是新增药品还是编辑 true 修改 默认false
  9006. var updateFlag = null;
  9007. if (index == 0) {
  9008. updateFlag = $("#western_medicine_update_flag").val();
  9009. } else if (index == 1) {
  9010. updateFlag = $("#chinese_medicine_update_flag").val();
  9011. } else if (index == 2) {
  9012. updateFlag = $("#jcjy_update_flag").val();
  9013. } else if (index == 3) {
  9014. updateFlag = $("#zl_update_flag").val();
  9015. } else if (index == 5) {
  9016. updateFlag = $("#op_record_update_flag").val();
  9017. }else if (index == 6) {
  9018. updateFlag = $("#wp_medicine_update_flag").val();
  9019. }
  9020. if (updateFlag == undefined || updateFlag == null) {
  9021. updateFlag = false;
  9022. }
  9023. if (updateFlag == "true" || updateFlag == true) {
  9024. return false;
  9025. }
  9026. var tabId = null;
  9027. //西药
  9028. if (index == 0) {
  9029. tabId = "xyTab";
  9030. } else if (index == 1) {
  9031. //中成药
  9032. tabId = "zyTab";
  9033. } else if (index == 2) {
  9034. //辅助检查、检验
  9035. tabId = "jcjyTab";
  9036. } else if (index == 3) {
  9037. //诊疗
  9038. tabId = "zlTab";
  9039. } else if (index == 4) {
  9040. //入院
  9041. tabId = "zyReqTab";
  9042. } else if (index == 5) {
  9043. //手术
  9044. tabId = "opRecordTab";
  9045. }else if (index == 6) {
  9046. //外配药
  9047. tabId = "wpMedicineTab";
  9048. }
  9049. var tableId = $("#" + tabId + " li.active").find("a").attr("href");
  9050. var items = $(tableId).find("div:eq(0)").find("div.form-group");
  9051. var groupId = null;
  9052. if (index == 0) {
  9053. groupId = $("#groupId").val();
  9054. }
  9055. if (items != null && items.length > 0) {
  9056. for (var i = 0; i < items.length; i++) {
  9057. if (serial == null) {
  9058. var temporary_items_code = $(items[i]).find("input.temporary_items_code").val();
  9059. var temporary_items_desc_value = $(items[i]).find("input.temporary_items_desc_value").val();
  9060. if (chargeUnitCode == null && code === temporary_items_code) {
  9061. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  9062. return true;
  9063. }
  9064. if (code === temporary_items_code && chargeUnitCode === temporary_items_desc_value) {
  9065. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  9066. return true;
  9067. }
  9068. } else {
  9069. if (index == 0) {
  9070. //西药需要判断组号,因为可能会有不同组的皮试用药,需要相同的药品
  9071. var temporary_items_groupId = $(items[i]).find("input.temporary_items_groupId").val();
  9072. var temporary_items_code = $(items[i]).find("input.temporary_items_code").val();
  9073. var temporary_items_serial = $(items[i]).find("input.temporary_items_serial").val();
  9074. if (code === temporary_items_code && serial === temporary_items_serial && groupId === temporary_items_groupId) {
  9075. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  9076. return true;
  9077. }
  9078. } else {
  9079. var temporary_items_code = $(items[i]).find("input.temporary_items_code").val();
  9080. var temporary_items_serial = $(items[i]).find("input.temporary_items_serial").val();
  9081. if (code === temporary_items_code && serial === temporary_items_serial) {
  9082. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  9083. return true;
  9084. }
  9085. }
  9086. }
  9087. }
  9088. }
  9089. return false;
  9090. }
  9091. /**
  9092. * 初始化处方分页
  9093. * @param index 0 西药 1 中药 2 诊疗 3 入院
  9094. * @param groupNo 初始化时候的药房分类
  9095. * @param orderNo 初始化时候的处方组号
  9096. */
  9097. function initNavTabs(index, groupNo, orderNo) {
  9098. var tabId = null;
  9099. var tabContentId = null;
  9100. var paneId = null;
  9101. var cfdesc = '普药';
  9102. //西药
  9103. if (index == 0) {
  9104. tabId = "xyTab";
  9105. tabContentId = "xyTabContent";
  9106. paneId = "xycf_" + getUID();
  9107. } else if (index == 1) {
  9108. //中草药
  9109. tabId = "zyTab";
  9110. tabContentId = "zyTabContent";
  9111. paneId = "zycf_" + getUID();
  9112. cfdesc = '中草药';
  9113. } else if (index == 2) {
  9114. //医技
  9115. tabId = "jcjyTab";
  9116. tabContentId = "jcjyTabContent";
  9117. paneId = "jcjycf_" + getUID();
  9118. cfdesc = '辅助检查、检验';
  9119. } else if (index == 3) {
  9120. //诊疗
  9121. tabId = "zlTab";
  9122. tabContentId = "zlTabContent";
  9123. paneId = "zlcf_" + getUID();
  9124. cfdesc = '诊疗';
  9125. } else if (index == 4) {
  9126. //住院
  9127. tabId = "zyReqTab";
  9128. tabContentId = "zyReqTabContent";
  9129. paneId = "zyReqcf_" + getUID();
  9130. cfdesc = '入院';
  9131. } else if (index == 5) {
  9132. //手术
  9133. tabId = "opRecordTab";
  9134. tabContentId = "opRecordTabContent";
  9135. paneId = "opRecordcf_" + getUID();
  9136. cfdesc = '手术';
  9137. }else if (index == 6) {
  9138. //外配药
  9139. tabId = "wpMedicineTab";
  9140. tabContentId = "wpMedicineTabContent";
  9141. paneId = "wpMedicinecf_" + getUID();
  9142. cfdesc = '外配药';
  9143. }
  9144. var tabHtml = '<li class="active"><a href="#' + paneId + '" role="tab" data-toggle="tab" ';
  9145. if (index == 0) {
  9146. tabHtml += ' onclick=xyTableOnClick("' + paneId + '")';
  9147. }
  9148. tabHtml += '>处方 <small class="cfdesc">(' + cfdesc + ')</small></a></li>';
  9149. $("#" + tabId).html(tabHtml);
  9150. var html = '<div class="tab-pane fade in active" id="' + paneId + '" style="height: 100%;min-height: 285px;position: relative;">';
  9151. html += '<img src="/thmz/images/prescription.png" style="margin-top: 5px;"/>';
  9152. html += '<input class="current_groupNo" type="hidden"/>';
  9153. html += ' <div class="cf_content rb_item" style="height: 230px;padding-top: 5px;overflow-y: auto;"></div>' +
  9154. ' <div style="height: 30px;border-top: 1px solid #ddd;width: 100%;position: absolute;bottom:0;padding-top: 10px;">';
  9155. html += '<div style="width: 460px;">'
  9156. if (index == 1) {
  9157. html += '<div id="cyFjDiv" style="width: 130px;float: left;line-height: 34px;">' +
  9158. ' <label class="my_label_2">复煎:</label>' +
  9159. ' <div style="width: 69px;float: left;">' +
  9160. ' <input type="number" class="form-control " id="cyFj" placeholder="请输入" value="1"/>' +
  9161. ' </div>次' +
  9162. ' </div>';
  9163. html += '<div style="width: 130px;float: left;line-height: 34px;">' +
  9164. ' <label class="my_label_2">分服:</label>' +
  9165. ' <div style="width: 69px;float: left;">' +
  9166. ' <input type="number" class="form-control " id="cyFfcs" placeholder="请输入" value="2"/>' +
  9167. ' </div>次' +
  9168. ' </div>';
  9169. html += '<div style="width: 180px;float: left;">' +
  9170. ' <label class="my_label_2">用法:</label>' +
  9171. ' <div style="width: 135px;float: left;">' +
  9172. ' <select class="form-control selectpicker show-tick useType"' +
  9173. ' title="请选择" id="useType_1">' +
  9174. ' </select>' +
  9175. ' </div>' +
  9176. ' </div>';
  9177. html += '</div><div style="width: 460px;">'
  9178. html += '<input id="singleAmount" type="hidden"/>';
  9179. }
  9180. html += '<div style="width: 130px;float: left;padding-left: 7px;padding-top: 8px;">金额:<span class="cf_amount">0.0</span><span>元</span></div>';
  9181. if (index == 0) {
  9182. html += '<div style="width: 310px;float: left;color: red;padding-top: 8px;">说明:此费用包含药品给药方式所产生的费用!</div>';
  9183. }
  9184. // else if (index == 1) {
  9185. // html += '<div style="width: 310px;float: left;color: red;padding-top: 8px;">说明:此费用包含药品代煎所产生的费用!</div>';
  9186. // }
  9187. html += '</div></div></div>';
  9188. $("#" + tabContentId).html(html);
  9189. if (index == 1) {
  9190. var water = '<option value="加凉水">加凉水</option><option value="加温水">加温水</option><option value="加开水">加开水</option><option value="加冰水">加冰水</option><option value="加糖水">加糖水</option>';
  9191. $('#cyJssm').html(water);
  9192. $('#cyJssm').selectpicker('refresh');
  9193. $("#cyJssm").selectpicker('val', "加凉水");
  9194. $('#cyJssm').selectpicker('refresh');
  9195. if($("#zyClassType").val() =='83'){
  9196. $("#cyFjDiv").removeClass("in").addClass("hide");
  9197. }else {
  9198. $("#cyFjDiv").removeClass("hide").addClass("in");
  9199. }
  9200. initAllMzYshZdFysm();
  9201. //initZyOrderFrequencys("zy_orderFrequency_1", false);
  9202. initZySupplyTypes("zy_supplyType_1", false);
  9203. }
  9204. if (groupNo != null && groupNo != "") {
  9205. //设置当前药品的品类
  9206. $("#" + paneId).find("input.current_groupNo").val(groupNo);
  9207. }
  9208. if (orderNo != null && orderNo != "" && orderNoAndTableIdMap != null) {
  9209. orderNoAndTableIdMap.put(orderNo, paneId);
  9210. tableIdAndOrderNoMap.put(paneId, orderNo);
  9211. }
  9212. }
  9213. /**
  9214. * 清空处方分页
  9215. * @param index 0 西药 1 中药 2 诊疗 3 入院 5 手术 6外配药
  9216. */
  9217. function clearNavTabs(index) {
  9218. var tabId = null;
  9219. var tabContentId = null;
  9220. //西药
  9221. if (index == 0) {
  9222. tabId = "xyTab";
  9223. tabContentId = "xyTabContent";
  9224. } else if (index == 1) {
  9225. //中草药
  9226. tabId = "zyTab";
  9227. tabContentId = "zyTabContent";
  9228. $("#cyJsl").val(400);
  9229. $("#cyZql").val(200);
  9230. $("#cyFj").val(1);
  9231. $("#cyFfcs").val(2);
  9232. $("#cyMtjs").val(1);
  9233. $("#zyfs").val(null);
  9234. $("#cyJssm").selectpicker('val', "加凉水");
  9235. $('#cyJssm').selectpicker('refresh');
  9236. $("#zy_supplyType_1").selectpicker('val', null);
  9237. $('#zy_supplyType_1').selectpicker('refresh');
  9238. } else if (index == 2) {
  9239. //辅助检查、检验
  9240. tabId = "jcjyTab";
  9241. tabContentId = "jcjyTabContent";
  9242. } else if (index == 3) {
  9243. //医技
  9244. tabId = "zlTab";
  9245. tabContentId = "zlTabContent";
  9246. } else if (index == 4) {
  9247. //住院
  9248. tabId = "zyReqTab";
  9249. tabContentId = "zyReqTabContent";
  9250. } else if (index == 5) {
  9251. //手术
  9252. tabId = "opRecordTab";
  9253. tabContentId = "opRecordTabContent";
  9254. }else if (index == 6) {
  9255. //手术
  9256. tabId = "wpMedicineTab";
  9257. tabContentId = "wpMedicineTabContent";
  9258. }
  9259. $("#" + tabId).html(null);
  9260. $("#" + tabContentId).html(null);
  9261. }
  9262. /**
  9263. * 添加处方分页
  9264. * @param index 0 西药 1 中药 2 诊疗 3 入院
  9265. * @param groupNo 71 普通西药 91 医材 111 麻、精一 131 精二 151 诊疗
  9266. * @param orderNo 处方号
  9267. */
  9268. function refreshNavTabs(index, groupNo, orderNo) {
  9269. var tabId = null;
  9270. var tabContentId = null;
  9271. var paneIdPrfix = null;
  9272. var cfdesc = '普药';
  9273. //西药
  9274. if (index == 0) {
  9275. tabId = "xyTab";
  9276. tabContentId = "xyTabContent";
  9277. paneIdPrfix = "xycf_";
  9278. if (groupNo == '91') {
  9279. cfdesc = '医材';
  9280. } else if (groupNo == '111') {
  9281. cfdesc = '麻、精一';
  9282. } else if (groupNo == '131') {
  9283. cfdesc = '精二';
  9284. }
  9285. // else if(groupNo=='151'){
  9286. // cfdesc='诊疗';
  9287. // }
  9288. } else if (index == 1) {
  9289. //中草药
  9290. tabId = "zyTab";
  9291. tabContentId = "zyTabContent";
  9292. paneIdPrfix = "zycf_";
  9293. cfdesc = '中草药';
  9294. } else if (index == 2) {
  9295. //辅助检查、检验
  9296. tabId = "jcjyTab";
  9297. tabContentId = "jcjyTabContent";
  9298. paneIdPrfix = "jcjycf_";
  9299. cfdesc = '辅助检查、检验';
  9300. } else if (index == 3) {
  9301. //诊疗
  9302. tabId = "zlTab";
  9303. tabContentId = "zlTabContent";
  9304. paneIdPrfix = "zlcf_";
  9305. cfdesc = '诊疗';
  9306. } else if (index == 4) {
  9307. //入院
  9308. tabId = "zyReqTab";
  9309. tabContentId = "zyReqTabContent";
  9310. paneIdPrfix = "zyReqcf_";
  9311. cfdesc = '入院';
  9312. } else if (index == 5) {
  9313. //手术
  9314. tabId = "opRecordTab";
  9315. tabContentId = "opRecordTabContent";
  9316. paneIdPrfix = "opRecordcf_";
  9317. cfdesc = '手术';
  9318. }else if (index == 6) {
  9319. //手术
  9320. tabId = "wpMedicineTab";
  9321. tabContentId = "wpMedicineTabContent";
  9322. paneIdPrfix = "wpMedicinecf_";
  9323. cfdesc = '外配药';
  9324. }
  9325. // var tableId = $("#"+tabId+" li.active").find("a").attr("href");
  9326. // var length = $(tableId).find("div:eq(0)").children().length;
  9327. // if(length==0){
  9328. // //当前处方是空白的,不需要新增处方
  9329. // return;
  9330. // }
  9331. var cfTitle = "处方" + " <small class=\"cfdesc\">(" + cfdesc + ")</small>";
  9332. var paneId = paneIdPrfix + getUID();
  9333. //清除选中的样式
  9334. $("#" + tabId).find("li.active").removeClass("active");
  9335. var tabHtml = '<li><a href="#' + paneId + '" role="tab" data-toggle="tab"';
  9336. if (index == 0) {
  9337. tabHtml += ' onclick=xyTableOnClick("' + paneId + '")';
  9338. }
  9339. tabHtml += '>' + cfTitle + '</a';
  9340. tabHtml += '</li>';
  9341. $("#" + tabId).append(tabHtml);
  9342. var html = '<div class="tab-pane fade in active" id="' + paneId + '" style="height: 100%;min-height: 285px;position: relative;">' +
  9343. '<img src="/thmz/images/prescription.png" style="margin-top: 5px;"/>' +
  9344. '<input class="current_groupNo" type="hidden"/>' +
  9345. ' <div class="cf_content rb_item" style="height: 230px;padding-top: 5px;overflow-y: auto;"></div>' +
  9346. ' <div style="height: 30px;border-top: 1px solid #ddd;width: 100%;position: absolute;bottom:0;">' +
  9347. '<div style="width: 460px;">' +
  9348. '<div style="width: 130px;float: left;padding-left: 7px;padding-top: 8px;">金额:<span class="cf_amount">0.0</span><span>元</span></div>';
  9349. if (index == 0) {
  9350. html += '<div style="width: 310px;float: left;color: red;padding-top: 8px;">说明:此费用包含药品给药方式所产生的费用!</div>';
  9351. }
  9352. html += '</div></div>';
  9353. $("#" + tabContentId).append(html);
  9354. //切换处方
  9355. $("#" + tabId).find("a[href='#" + paneId + "']").off("click").tab('show');
  9356. if (groupNo != null && groupNo != "") {
  9357. //设置当前药品的品类
  9358. $("#" + paneId).find("input.current_groupNo").val(groupNo);
  9359. }
  9360. if (orderNo != null && orderNo != "" && orderNoAndTableIdMap != null) {
  9361. orderNoAndTableIdMap.put(orderNo, paneId);
  9362. tableIdAndOrderNoMap.put(paneId, orderNo);
  9363. }
  9364. }
  9365. /**
  9366. * 判断是否需要自动增加组号
  9367. * @param res
  9368. */
  9369. function autoAddGroupId(res) {
  9370. var tableId = $("#xyTab li.active").find("a").attr("href");
  9371. var childrens = $(tableId).find("div:eq(0)").children();
  9372. var prevCategoriesFlag = null;
  9373. if (childrens != null && childrens.length > 0) {
  9374. prevCategoriesFlag = $(childrens[childrens.length - 1]).find("input.temporary_items_categoriesFlag").val();
  9375. if (prevCategoriesFlag == "" || prevCategoriesFlag == undefined) {
  9376. prevCategoriesFlag = null;
  9377. }
  9378. }
  9379. if (!(res.data.categoriesFlag == 2 || res.data.categoriesFlag == "2" || res.data.categoriesFlag == 1 || res.data.categoriesFlag == "1") ||
  9380. ((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)) {
  9381. //非针剂默认要切换组号 或者 是针剂,但是上一个药品不是针剂,这时候也要新换一个组号
  9382. var last = parseInt($("#groupId > option:last").val());
  9383. $("#groupId").selectpicker('val', last);
  9384. $('#groupId').selectpicker('refresh');
  9385. }
  9386. }
  9387. /**
  9388. * 填充西药选中的内容
  9389. * @param res
  9390. * @param groupNo
  9391. * @param type 操作类型 0 修改 1 医疗范文 2 就诊详情 3 处方开立
  9392. */
  9393. function fitWesternMedicine(res, groupNo, type) {
  9394. hintProjectSelfPayInfo(res.data.selfpayProp, "药品");
  9395. if (type != 0) {
  9396. //处方修改的时候不改变组号
  9397. autoAddGroupId(res);
  9398. }
  9399. $("#categoriesFlag").val(res.data.categoriesFlag);
  9400. //prevCategoriesFlag = res.data.categoriesFlag;
  9401. $("#western_medicine_name").val(res.data.name);
  9402. $("#western_medicine_name").blur();
  9403. var drugWinHtml = '';
  9404. var index = null;
  9405. if (res.data.weight != null) {
  9406. $("#drugWin").val(res.data.weight);
  9407. $("#drugWinDb").val(res.data.weight);
  9408. drugWinHtml = '<option value="' + res.data.weighUnit + '" desc="' + res.data.weight + '">' + res.data.weighUnitDesc + '</option>';
  9409. index = res.data.weighUnit;
  9410. }
  9411. if (res.data.volum != null) {
  9412. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  9413. $("#drugWin").val(res.data.volum);
  9414. $("#drugWinDb").val(res.data.volum);
  9415. }
  9416. drugWinHtml += '<option value="' + res.data.volUnit + '" desc="' + res.data.volum + '">' + res.data.volUnitDesc + '</option>';
  9417. if (index == null) {
  9418. index = res.data.volUnit;
  9419. }
  9420. }
  9421. if (res.data.miniUnit != null && res.data.miniUnit != "") {
  9422. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  9423. $("#drugWin").val(1);
  9424. $("#drugWinDb").val(1);
  9425. }
  9426. drugWinHtml += '<option value="' + res.data.miniUnit + '" desc="1">' + res.data.miniUnitDesc + '</option>';
  9427. if (index == null) {
  9428. index = res.data.miniUnit;
  9429. }
  9430. }
  9431. $('#drugWinUnit').html(drugWinHtml);
  9432. $('#drugWinUnit').selectpicker('refresh');
  9433. $("#drugWinUnit").selectpicker('val', index);
  9434. $('#drugWinUnit').selectpicker('refresh');
  9435. if (res.data.packUnitDesc != null && res.data.packUnitDesc != "") {
  9436. var html = '<option value="' + res.data.packUnitDesc + '" >' + res.data.packUnitDesc + '</option>';
  9437. $('#packUnit').html(html);
  9438. $('#packUnit').selectpicker('refresh');
  9439. $("#packUnit").selectpicker('val', res.data.packUnitDesc);
  9440. $('#packUnit').selectpicker('refresh');
  9441. }
  9442. $("#packRetprice").val(res.data.packRetprice);
  9443. $("#packSize").val(res.data.packSize);
  9444. $("#western_medicine_current_code").val(res.data.code);
  9445. $("#western_medicine_current_serial").val(res.data.serial);
  9446. if ($("#dayNum").val() == null) {
  9447. //天数 同组药品天数相同
  9448. $("#dayNum").selectpicker('val', 1);
  9449. $('#dayNum').selectpicker('refresh');
  9450. }
  9451. if (($("#supplyType").val() == null || $("#supplyType").val() == "") && res.data.supplyType != null) {
  9452. // 给药方式 同组药品给药方式相同
  9453. $("#supplyType").selectpicker('val', res.data.supplyType);
  9454. $('#supplyType').selectpicker('refresh');
  9455. }
  9456. if (($("#orderFrequency").val() == null || $("#orderFrequency").val() == "") && res.data.frequency != null) {
  9457. //频次编码 同组药品频次编码相同
  9458. $("#orderFrequency").selectpicker('val', res.data.frequency);
  9459. $('#orderFrequency').selectpicker('refresh');
  9460. }
  9461. if ($("#orderFrequency").val() == null || $("#orderFrequency").val() == "") {
  9462. //频次编码 防止频次为空
  9463. $("#orderFrequency").selectpicker('val', "ONCE");
  9464. $('#orderFrequency').selectpicker('refresh');
  9465. }
  9466. $("#tryResult").parent().parent().parent().removeClass("in").addClass("hide");
  9467. if (res.data.psFlag != null && (res.data.psFlag == 1 || res.data.psFlag == "1")) {
  9468. if (res.data.categoriesFlag == 0 || res.data.categoriesFlag == "0" || res.data.categoriesFlag == 2 || res.data.categoriesFlag == "2") {
  9469. initTryResultSelect(res.data.categoriesFlag);
  9470. }
  9471. }
  9472. $("#manufactoryName").val(res.data.manufactoryName);
  9473. $("#specification").val(res.data.specification);
  9474. calculate();
  9475. $("#addPDiv").css("margin-left", "50px");
  9476. $("#hlyyypsms").removeClass("hide").addClass("in");
  9477. $("#western_medicine_name").focus();
  9478. }
  9479. /**
  9480. * 剂量单位改变事件
  9481. */
  9482. function drugWinUnitChange() {
  9483. var desc = $('#drugWinUnit').find("option:selected").attr('desc');
  9484. $("#drugWin").val(desc);
  9485. $("#drugWinDb").val(desc);
  9486. calculate();
  9487. }
  9488. /**
  9489. * 根据选择的内容计算总的用药量
  9490. */
  9491. function calculate() {
  9492. //最小规格剂量
  9493. var drugWinDb = $("#drugWinDb").val();
  9494. //天数
  9495. var dayNum = $("#dayNum").val();
  9496. //当前使用的最小剂量
  9497. var drugWin = $("#drugWin").val();
  9498. //频率
  9499. var times = $('#orderFrequency').find("option:selected").attr('desc');
  9500. //包装规格数量
  9501. var packSize = $("#packSize").val();
  9502. //单价
  9503. var packRetprice = $("#packRetprice").val();
  9504. //当前药房编码
  9505. var currentGroupNo = $("#current_groupNo").val();
  9506. if (drugWinDb == null || drugWinDb === "") {
  9507. if (currentGroupNo == '71') {
  9508. return;
  9509. }
  9510. drugWinDb = 1;
  9511. }
  9512. if (dayNum == null || dayNum === "") {
  9513. if (currentGroupNo == '71') {
  9514. return;
  9515. }
  9516. dayNum = 1;
  9517. }
  9518. if (drugWin == null || drugWin === "") {
  9519. if (currentGroupNo == '71') {
  9520. return;
  9521. }
  9522. drugWin = 1;
  9523. }
  9524. if (times == null || times === "") {
  9525. if (currentGroupNo == '71') {
  9526. return;
  9527. }
  9528. times = 1;
  9529. }
  9530. if (packSize == null || packSize === "") {
  9531. return;
  9532. }
  9533. //拆零总量
  9534. var scatteredTotalNum = Multiply(Multiply(dayNum, drugWin), times);
  9535. //整包装的数量
  9536. var totalNum = Math.ceil(Division(scatteredTotalNum, Multiply(packSize, drugWinDb)));
  9537. $("#gross").val(totalNum);
  9538. $("#totalRetprice").val(Multiply(totalNum, packRetprice));
  9539. }
  9540. /**
  9541. * 根据选择的总量计算金额 只有医材的时候需要计算
  9542. */
  9543. function calculateSimple() {
  9544. //总量
  9545. var gross = $("#gross").val();
  9546. //单价
  9547. var packRetprice = $("#packRetprice").val();
  9548. $("#totalRetprice").val(Multiply(gross, packRetprice));
  9549. //当前药房编码
  9550. var currentGroupNo = $("#current_groupNo").val();
  9551. if (currentGroupNo == '91') {
  9552. var dayNum = $("#dayNum").val();
  9553. if (dayNum == null || dayNum == "") {
  9554. //医材默认天数为1
  9555. $("#dayNum").selectpicker('val', 1);
  9556. $('#dayNum').selectpicker('refresh');
  9557. }
  9558. var orderFrequency = $("#orderFrequency").val();
  9559. if (orderFrequency == null || orderFrequency == "") {
  9560. $("#orderFrequency").selectpicker('val', "ONCE");
  9561. $('#orderFrequency').selectpicker('refresh');
  9562. }
  9563. }
  9564. }
  9565. /**
  9566. * 根据中药付数计算金额
  9567. */
  9568. function calculateZyAmount() {
  9569. var singleAmount = $("#singleAmount").val();
  9570. var tableId = $("#zyTab li.active").find("a").attr("href");
  9571. //获取中药付数
  9572. //var zyfs = $(tableId).find("input.zyfs").val();
  9573. var zyfs = $("#zyfs").val();
  9574. var cfAmount = Multiply(zyfs, singleAmount);
  9575. $(tableId).find("span.cf_amount").html(cfAmount);
  9576. calculateTotalAmount(false);
  9577. }
  9578. /**
  9579. * 将病人信息填入患者信息修改form
  9580. * @param patinet
  9581. */
  9582. function fillPlusPatinet(patinet) {
  9583. if (patinet != null) {
  9584. $("#editUserCode").val(patinet.patientId);
  9585. $("#editUserName").val(patinet.name);
  9586. $("#editUserName").blur();
  9587. $("#editUserAge").val(patinet.age);
  9588. $("#editUserAge").blur();
  9589. $("#editUserGender").selectpicker('val', patinet.sex);
  9590. $("#editUserGender").selectpicker('refresh');
  9591. $("#editUserGender").blur();
  9592. $("#editUserBirthDay").val(patinet.birthDayStr);
  9593. $("#editUserBirthDay").blur();
  9594. $('#editUserCertificateType').selectpicker('val', patinet.certificateType);
  9595. $('#editUserCertificateType').selectpicker('refresh');
  9596. $("#editUserCardNo").val(patinet.icCardNo);
  9597. $("#editUserCardNo").attr("title", patinet.icCardNo);
  9598. $("#editUserCardNo").blur();
  9599. $("#editUserPhoneNum").val(patinet.phoneNo);
  9600. $("#editUserPhoneNum").attr("title", patinet.phoneNo);
  9601. $("#editUserPhoneNum").blur();
  9602. $("#editUserPatientsNature").selectpicker('val', patinet.responseType);//默认选中
  9603. $('#editUserPatientsNature').selectpicker('refresh');
  9604. $("#editUserPatientsNature").blur();
  9605. $("#editUserIdCard").val(patinet.socialNo);
  9606. $("#editUserIdCard").attr("title", patinet.socialNo);
  9607. $("#editUserIdCard").blur();
  9608. $('#editUserProvinceCode').selectpicker('val', patinet.provinceCode);
  9609. $('#editUserProvinceCode').selectpicker('refresh');
  9610. initCity(2, patinet.cityCode);
  9611. initDistrict(2, patinet.cityCode, patinet.districtCode);
  9612. $("#editUserDetail").val(patinet.detail);
  9613. $("#editUserDetail").blur();
  9614. $("#editUserContact").val(patinet.relName);
  9615. $("#editUserContactPhone").val(patinet.contractName);
  9616. }
  9617. }
  9618. /**
  9619. * 修改病人信息
  9620. */
  9621. function modifyPatient() {
  9622. $.ajax({
  9623. type: "POST",
  9624. url: '/thmz/modifyPatient',
  9625. contentType: "application/json;charset=UTF-8",
  9626. dataType: "json",
  9627. data: JSON.stringify({
  9628. "name": $("#editUserName").val(),
  9629. "age": $("#editUserAge").val(),
  9630. "sex": $("#editUserGender").val(),
  9631. "birthDay": $("#editUserBirthDay").val(),
  9632. "certificateType": $("#editUserCertificateType").val(),
  9633. "icCardNo": $("#editUserCardNo").val(),
  9634. "phoneNo": $("#editUserPhoneNum").val(),
  9635. "responseType": $("#editUserPatientsNature").val(),
  9636. "socialNo": $("#editUserIdCard").val(),
  9637. "provinceCode": $("#editUserProvinceCode").val(),
  9638. "cityCode": $("#editCityCode").val(),
  9639. "districtCode": $("#editUserDistrictCode").val(),
  9640. "detail": $("#editUserDetail").val(),
  9641. "patientId": $("#editUserCode").val(),
  9642. "relName": $("#editUserContact").val(),
  9643. "contractName": $("#editUserContactPhone").val()
  9644. }),
  9645. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9646. success: function (res) {
  9647. if (res == '401' || res == 401) {
  9648. window.location.href = '/thmz/login/view'
  9649. return;
  9650. }
  9651. if (res.code == 0) {
  9652. $('#editUserModal').modal('hide');
  9653. var patientId = $("#patientId").text();
  9654. let tempMzfzSerialNo = $("#mzfzSerialNoInClick").val();
  9655. if (patientId != null && patientId != 'null' && patientId != "" && tempMzfzSerialNo.indexOf("clnicId_") < 0 ) {
  9656. realClinicalReception(patientId, $("#mzfzSerialNoInClick").val(), $("#mzfzReqTypeNoInClick").val());
  9657. } else {
  9658. if(ksjzType == 2){
  9659. let tempPatientId = $("#editUserCode").val();
  9660. clearRapidAccepts();
  9661. $("#rapidAcceptsUserCardNo").val(tempPatientId);
  9662. queryUserInfoByCardNo();
  9663. ksjzType = null;
  9664. }
  9665. }
  9666. clearPlusPatinet();
  9667. } else {
  9668. errorMesage(res);
  9669. }
  9670. }
  9671. });
  9672. }
  9673. /**
  9674. * 将病人信息修改域置空
  9675. * @param patinet
  9676. */
  9677. function clearPlusPatinet() {
  9678. ksjzType = null;
  9679. $("#editUserCode").val(null);
  9680. $("#editUserName").val(null);
  9681. $("#editUserAge").val(null);
  9682. $("#editUserGender").selectpicker('val', '1');
  9683. $("#editUserGender").selectpicker('refresh');
  9684. $("#editUserBirthDay").val(null);
  9685. $('#editUserCertificateType').selectpicker('val', '01');
  9686. $('#editUserCertificateType').selectpicker('refresh');
  9687. $("#editUserCardNo").val(null);
  9688. $("#editUserCardNo").attr("title", null);
  9689. $("#editUserPhoneNum").val(null);
  9690. $("#editUserPhoneNum").attr("title", null);
  9691. $("#editUserPatientsNature").selectpicker('val', '01');//默认选中
  9692. $('#editUserPatientsNature').selectpicker('refresh');
  9693. $("#editUserIdCard").val(null);
  9694. $("#editUserIdCard").attr("title", null);
  9695. $('#editUserProvinceCode').selectpicker('val', null);
  9696. $('#editUserProvinceCode').selectpicker('refresh');
  9697. $('#editCityCode').selectpicker('val', null);
  9698. $('#editCityCode').selectpicker('refresh');
  9699. $('#editUserDistrictCode').selectpicker('val', null);
  9700. $('#editUserDistrictCode').selectpicker('refresh');
  9701. $("#editUserDetail").val(null);
  9702. $("#editUserContact").val(null);
  9703. $("#editUserContactPhone").val(null);
  9704. var openSource = $("#openSource").val();
  9705. if (openSource == 2 || openSource == '2') {
  9706. $("#rapidAcceptsModal").modal();
  9707. } else if (openSource == 3 || openSource == '3') {
  9708. $("#visitingDetailModal").modal();
  9709. }
  9710. $("#openSource").val(null);
  9711. }
  9712. // /**
  9713. // * 保存入院证
  9714. // */
  9715. // function saveBeHospitalized() {
  9716. // $.ajax({
  9717. // type: "POST",
  9718. // url: '/thmz/saveMzZyReq',
  9719. // contentType: "application/json;charset=UTF-8",
  9720. // dataType: "json",
  9721. // data: JSON.stringify({
  9722. // "patientId": $("#patientId").text(),
  9723. // "icdCode": $("#icdCodeBeHospitalized").val(),
  9724. // "icdText": $("#icdTextBeHospitalized").val(),
  9725. // "reqDept": $("#inpatientWardBeHospitalized").val(),
  9726. // "smallDept": $("#smallWardBeHospitalized").val(),
  9727. // "admissStatus": $("#admissStatus").val()
  9728. // }),
  9729. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9730. // success: function (res) {
  9731. // if (res == '401' || res == 401) {
  9732. // window.location.href = '/thmz/login/view'
  9733. // return;
  9734. // }
  9735. // if (res.code == 0) {
  9736. // successMesage(res);
  9737. // $('#beHospitalizedModal').modal('hide');
  9738. // loadInClinicTableList();
  9739. // loadClinicTableList();
  9740. // clearWorkSpace();
  9741. // } else {
  9742. // errorMesage(res);
  9743. // }
  9744. // }
  9745. // });
  9746. // }
  9747. /**
  9748. * 获取按钮组选择的下标
  9749. * @param id
  9750. * @returns {number}
  9751. */
  9752. function getIndex(id) {
  9753. var index = 0;
  9754. var item = $("#" + id).find("button");
  9755. for (var i = 0; i <= item.length; i++) {
  9756. if ($(item[i]).hasClass("btn-primary")) {
  9757. index = i;
  9758. break;
  9759. }
  9760. }
  9761. return index;
  9762. }
  9763. /**
  9764. * 获取时间选择器的时间数组
  9765. * @returns {string[]}
  9766. */
  9767. function getRePortRangeArr() {
  9768. var rePortRange = $('#reportrange span').html();
  9769. var rePortRangeArr = rePortRange.split(" - ");
  9770. rePortRangeArr[0] = rePortRangeArr[0] + " 00:00:00"
  9771. rePortRangeArr[1] = rePortRangeArr[1] + " 23:59:59"
  9772. return rePortRangeArr;
  9773. }
  9774. /**
  9775. * 初始医生工作太配置
  9776. */
  9777. function initWorkspaceConfigForCurrent() {
  9778. $.ajax({
  9779. type: "GET",
  9780. url: '/thmz/getWorkspaceConfigForCurrent',
  9781. dataType: "json",
  9782. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9783. success: function (res) {
  9784. if (res == '401' || res == 401) {
  9785. window.location.href = '/thmz/login/view'
  9786. return;
  9787. }
  9788. if (res.code == 0) {
  9789. if (res.data.symptomFlag == 1) {
  9790. $("#symptomFlag").removeClass("in").addClass("hide");
  9791. if ($("#symptomFlagCheck").parent().hasClass("checked")) {
  9792. $("#symptomFlagCheck").parent().parent().click();//当前选中改为不选中
  9793. }
  9794. } else if (res.data.symptomFlag == 0) {
  9795. $("#symptomFlag").removeClass("hide").addClass("in");
  9796. if (!$("#symptomFlagCheck").parent().hasClass("checked")) {
  9797. $("#symptomFlagCheck").parent().parent().click();//当前不选中改为选中
  9798. }
  9799. }
  9800. if (res.data.emrHpiFlag == 1) {
  9801. $("#emrHpiFlag").removeClass("in").addClass("hide");
  9802. if ($("#emrHpiFlagCheck").parent().hasClass("checked")) {
  9803. $("#emrHpiFlagCheck").parent().parent().click();//当前选中改为不选中
  9804. }
  9805. } else if (res.data.emrHpiFlag == 0) {
  9806. $("#emrHpiFlag").removeClass("hide").addClass("in");
  9807. if (!$("#emrHpiFlagCheck").parent().hasClass("checked")) {
  9808. $("#emrHpiFlagCheck").parent().parent().click();//当前不选中改为选中
  9809. }
  9810. }
  9811. if (res.data.emrPsFlag == 1) {
  9812. $("#emrPsFlag").removeClass("in").addClass("hide");
  9813. if ($("#emrPsFlagCheck").parent().hasClass("checked")) {
  9814. $("#emrPsFlagCheck").parent().parent().click();//当前选中改为不选中
  9815. }
  9816. } else if (res.data.emrPsFlag == 0) {
  9817. $("#emrPsFlag").removeClass("hide").addClass("in");
  9818. if (!$("#emrPsFlagCheck").parent().hasClass("checked")) {
  9819. $("#emrPsFlagCheck").parent().parent().click();//当前不选中改为选中
  9820. }
  9821. }
  9822. if (res.data.personalHistoryFlag == 1) {
  9823. $("#personalHistoryFlag").removeClass("in").addClass("hide");
  9824. if ($("#personalHistoryFlagCheck").parent().hasClass("checked")) {
  9825. $("#personalHistoryFlagCheck").parent().parent().click();//当前选中改为不选中
  9826. }
  9827. } else if (res.data.personalHistoryFlag == 0) {
  9828. $("#personalHistoryFlag").removeClass("hide").addClass("in");
  9829. if (!$("#personalHistoryFlagCheck").parent().hasClass("checked")) {
  9830. $("#personalHistoryFlagCheck").parent().parent().click();//当前不选中改为选中
  9831. }
  9832. }
  9833. if (res.data.fzZlFlag == 1) {
  9834. $("#fzZlFlag").removeClass("in").addClass("hide");
  9835. if ($("#fzZlFlagCheck").parent().hasClass("checked")) {
  9836. $("#fzZlFlagCheck").parent().parent().click();//当前选中改为不选中
  9837. }
  9838. } else if (res.data.fzZlFlag == 0) {
  9839. $("#fzZlFlag").removeClass("hide").addClass("in");
  9840. if (!$("#fzZlFlagCheck").parent().hasClass("checked")) {
  9841. $("#fzZlFlagCheck").parent().parent().click();//当前不选中改为选中
  9842. }
  9843. }
  9844. if (res.data.crbHistoryFlag == 1) {
  9845. $("#crbHistoryFlag").removeClass("in").addClass("hide");
  9846. if ($("#crbHistoryFlagCheck").parent().hasClass("checked")) {
  9847. $("#crbHistoryFlagCheck").parent().parent().click();//当前选中改为不选中
  9848. }
  9849. } else if (res.data.crbHistoryFlag == 0) {
  9850. $("#crbHistoryFlag").removeClass("hide").addClass("in");
  9851. if (!$("#crbHistoryFlagCheck").parent().hasClass("checked")) {
  9852. $("#crbHistoryFlagCheck").parent().parent().click();//当前不选中改为选中
  9853. }
  9854. }
  9855. if (res.data.familyHistoryFlag == 1) {
  9856. $("#familyHistoryFlag").removeClass("in").addClass("hide");
  9857. if ($("#familyHistoryFlagCheck").parent().hasClass("checked")) {
  9858. $("#familyHistoryFlagCheck").parent().parent().click();//当前选中改为不选中
  9859. }
  9860. } else if (res.data.familyHistoryFlag == 0) {
  9861. $("#familyHistoryFlag").removeClass("hide").addClass("in");
  9862. if (!$("#familyHistoryFlagCheck").parent().hasClass("checked")) {
  9863. $("#familyHistoryFlagCheck").parent().parent().click();//当前不选中改为选中
  9864. }
  9865. }
  9866. if (res.data.obstericalHistoryFlag == 1) {
  9867. $("#obstericalHistoryFlag").removeClass("in").addClass("hide");
  9868. if ($("#obstericalHistoryFlagCheck").parent().hasClass("checked")) {
  9869. $("#obstericalHistoryFlagCheck").parent().parent().click();//当前选中改为不选中
  9870. }
  9871. } else if (res.data.obstericalHistoryFlag == 0) {
  9872. $("#obstericalHistoryFlag").removeClass("hide").addClass("in");
  9873. if (!$("#obstericalHistoryFlagCheck").parent().hasClass("checked")) {
  9874. $("#obstericalHistoryFlagCheck").parent().parent().click();//当前不选中改为选中
  9875. }
  9876. }
  9877. if (res.data.pressureLeftFlag == 1) {
  9878. $("#pressureLeftFlag").removeClass("in").addClass("hide");
  9879. if ($("#pressureLeftFlagCheck").parent().hasClass("checked")) {
  9880. $("#pressureLeftFlagCheck").parent().parent().click();//当前选中改为不选中
  9881. }
  9882. } else if (res.data.pressureLeftFlag == 0) {
  9883. $("#pressureLeftFlag").removeClass("hide").addClass("in");
  9884. if (!$("#pressureLeftFlagCheck").parent().hasClass("checked")) {
  9885. $("#pressureLeftFlagCheck").parent().parent().click();//当前不选中改为选中
  9886. }
  9887. }
  9888. if (res.data.tentativeDiagnosisFlag == 1) {
  9889. $("#tentativeDiagnosisFlag").removeClass("in").addClass("hide");
  9890. if ($("#tentativeDiagnosisFlagCheck").parent().hasClass("checked")) {
  9891. $("#tentativeDiagnosisFlagCheck").parent().parent().click();//当前选中改为不选中
  9892. }
  9893. } else if (res.data.tentativeDiagnosisFlag == 0) {
  9894. $("#tentativeDiagnosisFlag").removeClass("hide").addClass("in");
  9895. if (!$("#tentativeDiagnosisFlagCheck").parent().hasClass("checked")) {
  9896. $("#tentativeDiagnosisFlagCheck").parent().parent().click();//当前不选中改为选中
  9897. }
  9898. }
  9899. if (res.data.checkboxFlag == 1) {
  9900. if ($("#checkboxFlagCheck").parent().hasClass("checked")) {
  9901. $("#checkboxFlagCheck").parent().parent().click();//当前选中改为不选中
  9902. }
  9903. } else if (res.data.checkboxFlag == 0) {
  9904. if (!$("#checkboxFlagCheck").parent().hasClass("checked")) {
  9905. $("#checkboxFlagCheck").parent().parent().click();//当前不选中改为选中
  9906. }
  9907. }
  9908. if (res.data.zlPrintFlag == 1) {
  9909. if ($("#zlPrintFlagCheck").parent().hasClass("checked")) {
  9910. $("#zlPrintFlagCheck").parent().parent().click();//当前选中改为不选中
  9911. }
  9912. } else if (res.data.zlPrintFlag == 0) {
  9913. if (!$("#zlPrintFlagCheck").parent().hasClass("checked")) {
  9914. $("#zlPrintFlagCheck").parent().parent().click();//当前不选中改为选中
  9915. }
  9916. }
  9917. //设置是否默认勾选处方回调
  9918. localStorage.setItem("checkboxFlag", res.data.checkboxFlag);
  9919. } else {
  9920. errorMesage(res);
  9921. }
  9922. }
  9923. });
  9924. }
  9925. /**
  9926. * 保存医生工作台配置
  9927. */
  9928. function saveWorkspaceConfig() {
  9929. var symptomFlag = $("#symptomFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  9930. var emrHpiFlag = $("#emrHpiFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  9931. var emrPsFlag = $("#emrPsFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  9932. var personalHistoryFlag = $("#personalHistoryFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  9933. var familyHistoryFlag = $("#familyHistoryFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  9934. var fzZlFlag = $("#fzZlFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  9935. var crbHistoryFlag = $("#crbHistoryFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  9936. var obstericalHistoryFlag = $("#obstericalHistoryFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  9937. var pressureLeftFlag = $("#pressureLeftFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  9938. var tentativeDiagnosisFlag = $("#tentativeDiagnosisFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  9939. var checkboxFlag = $("#checkboxFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  9940. var zlPrintFlag = $("#zlPrintFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  9941. $.ajax({
  9942. type: "POST",
  9943. url: '/thmz/saveWorkspaceConfig',
  9944. contentType: "application/json;charset=UTF-8",
  9945. dataType: "json",
  9946. data: JSON.stringify({
  9947. "symptomFlag": symptomFlag,
  9948. "emrHpiFlag": emrHpiFlag,
  9949. "emrPsFlag": emrPsFlag,
  9950. "personalHistoryFlag": personalHistoryFlag,
  9951. "familyHistoryFlag": familyHistoryFlag,
  9952. "fzZlFlag": fzZlFlag,
  9953. "crbHistoryFlag": crbHistoryFlag,
  9954. "obstericalHistoryFlag": obstericalHistoryFlag,
  9955. "pressureLeftFlag": pressureLeftFlag,
  9956. "tentativeDiagnosisFlag": tentativeDiagnosisFlag,
  9957. "checkboxFlag": checkboxFlag,
  9958. "zlPrintFlag": zlPrintFlag
  9959. }),
  9960. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9961. success: function (res) {
  9962. if (res == '401' || res == 401) {
  9963. window.location.href = '/thmz/login/view'
  9964. return;
  9965. }
  9966. if (res.code == 0) {
  9967. successMesage(res);
  9968. initWorkspaceConfigForCurrent();
  9969. $("#configWorkspaceModal").modal("hide");
  9970. } else {
  9971. errorMesage(res);
  9972. }
  9973. }
  9974. });
  9975. }
  9976. /**
  9977. * 初始化药品,检查检验菜单树
  9978. */
  9979. function initzTree() {
  9980. var index = getIndex("bill_item_group");
  9981. if (index == 0) {
  9982. $("#western_medicine_name").webuiPopover('hide');
  9983. $.ajax({
  9984. type: "GET",
  9985. url: '/thmz/getYpZdClasses',
  9986. contentType: "application/json;charset=UTF-8",
  9987. dataType: "json",
  9988. async: false,
  9989. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  9990. success: function (res) {
  9991. if (res == '401' || res == 401) {
  9992. window.location.href = '/thmz/login/view'
  9993. return;
  9994. }
  9995. if (res.code == 0) {
  9996. // zTree 的参数配置,深入使用请参考 API 文档(setting 配置详解)
  9997. var setting = {
  9998. callback: {
  9999. onClick: zTreeOnClick
  10000. }
  10001. };
  10002. $.fn.zTree.init($("#treeDemo"), setting, res.data);
  10003. var webuiId = $("#treeButton").attr("data-target");
  10004. var top = $("#" + webuiId).css("top");
  10005. if (top.indexOf("-") == 0) {
  10006. $("#" + webuiId).css("top", '0px');
  10007. }
  10008. } else {
  10009. errorMesage(res);
  10010. }
  10011. }
  10012. });
  10013. } else if (index == 2) {
  10014. $("#jcJyItem").webuiPopover('hide');
  10015. $.ajax({
  10016. type: "GET",
  10017. url: '/thmz/getJyJcZdClasses',
  10018. contentType: "application/json;charset=UTF-8",
  10019. dataType: "json",
  10020. async: false,
  10021. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10022. success: function (res) {
  10023. if (res == '401' || res == 401) {
  10024. window.location.href = '/thmz/login/view'
  10025. return;
  10026. }
  10027. if (res.code == 0) {
  10028. // zTree 的参数配置,深入使用请参考 API 文档(setting 配置详解)
  10029. var setting = {
  10030. callback: {
  10031. onClick: zTreeOnClick
  10032. }
  10033. };
  10034. $.fn.zTree.init($("#treeDemo"), setting, res.data);
  10035. var webuiId = $("#treeButton").attr("data-target");
  10036. var top = $("#" + webuiId).css("top");
  10037. if (top.indexOf("-") == 0) {
  10038. $("#" + webuiId).css("top", '0px');
  10039. }
  10040. } else {
  10041. errorMesage(res);
  10042. }
  10043. }
  10044. });
  10045. } else if (index == 1) {
  10046. $("#treeButton").webuiPopover('hide');
  10047. warningMesageSimaple("中药暂无帮助字典");
  10048. } else if (index == 3) {
  10049. $("#treeButton").webuiPopover('hide');
  10050. warningMesageSimaple("诊疗暂无帮助字典");
  10051. } else {
  10052. $("#treeButton").webuiPopover('hide');
  10053. warningMesageSimaple("入院暂无帮助字典");
  10054. }
  10055. }
  10056. /**
  10057. * 节点点击事件
  10058. * @param event
  10059. * @param treeId
  10060. * @param treeNode
  10061. */
  10062. function zTreeOnClick(event, treeId, treeNode) {
  10063. var index = getIndex("bill_item_group");
  10064. if (index == 0) {
  10065. $("#western_medicine_name").val(treeNode.id);
  10066. $('#western_medicine_name').webuiPopover('show');
  10067. loadYpList(0, null);
  10068. } else if (index == 2) {
  10069. $("#jcJyItem").val(treeNode.id);
  10070. $('#jcJyItem').webuiPopover('show');
  10071. loadjcJyItemList(null);
  10072. }
  10073. }
  10074. /**
  10075. * 构建处方参数
  10076. * @param type 1 保存处方 2 保存模板 3 计算金额
  10077. * @returns {any}
  10078. */
  10079. function getParamsForpPrescription(type) {
  10080. var codes = $("#diagnoseValue").val();
  10081. var icdCode = null;
  10082. if (codes != null && codes.length > 0) {
  10083. var arr = codes.split(",");
  10084. if (arr != null) {
  10085. for (i = 0; i < arr.length; i++) {
  10086. if (arr[i] != "") {
  10087. if (icdCode == null) {
  10088. icdCode = arr[i];
  10089. } else {
  10090. icdCode += "," + arr[i];
  10091. }
  10092. }
  10093. }
  10094. }
  10095. }
  10096. let tcmCodes = $("#tcmDiagnoseValue").val();
  10097. let tcmIcdCodes = null;
  10098. if (tcmCodes != null && tcmCodes.length > 0) {
  10099. let arr = tcmCodes.split(",");
  10100. if (arr != null) {
  10101. for (i = 0; i < arr.length; i++) {
  10102. if (arr[i] != "") {
  10103. if (tcmIcdCodes == null) {
  10104. tcmIcdCodes = arr[i];
  10105. } else {
  10106. tcmIcdCodes += "," + arr[i];
  10107. }
  10108. }
  10109. }
  10110. }
  10111. }
  10112. var jsonData = JSON.parse('' +
  10113. '{"patientId": "",' +
  10114. '"visitDeptCode":"",' +
  10115. '"firstOrNot":"",' +
  10116. '"icdCode": "",' +
  10117. '"icdText": null,' +
  10118. '"tcmIcdCode": "",' +
  10119. '"tcmIcdText": null,' +
  10120. '"jzFlag": "0",' +
  10121. '"serialNo":"",' +
  10122. '"mzBlRecord": ' +
  10123. '{"firstOrNot": "",' +
  10124. '"emrChiefComplaint": "",' +
  10125. '"emrHpi": "",' +
  10126. '"emrPs": "",' +
  10127. '"emrPe": "",' +
  10128. '"emrFzjc": null,' +
  10129. '"emrProcess": null,' +
  10130. '"emrXyy": "无",' +
  10131. '"emrYypg": "无",' +
  10132. '"emrGnpg": "无",' +
  10133. '"emrJkjy": "",' +
  10134. '"personalHistory": "",' +
  10135. '"familyHistory": "",' +
  10136. '"fzZl": "",' +
  10137. '"crbHistory": "",' +
  10138. '"obstericalHistory": "",' +
  10139. '"weight": "",' +
  10140. '"temperature": "",' +
  10141. '"sphygmus": "",' +
  10142. '"breathe": "",' +
  10143. '"pressureHigh": "",' +
  10144. '"pressureFloor": "",' +
  10145. '"pressureHighLeft": "",' +
  10146. '"pressureFloorLeft": "",' +
  10147. '"tentativeDiagnosis":"",' +
  10148. '"prescriptionDetail":""},' +
  10149. '"mzChargeDetailList": [],' +
  10150. '"rxDruginfoList": [],' +
  10151. '"wxmallPackagePurchasedItemList": [],' +
  10152. '"mzYjReqList": [],' +
  10153. '"mzZyReq": {"reqDept": "","smallDept": "","admissStatus": "","conditionCode": "","routeOfAdmission": "", "contacterName":null , "contacterRelationship": "", "contacterPhone":null , "contacterAddress":null , "deposit":null },' +
  10154. '"opRecordList": [],' +
  10155. '"patientAllergenInfoList": [],' +
  10156. '"zgmztczf":"",' +
  10157. '"opspDisecode":"",' +
  10158. '"opspDiseName":"",' +
  10159. '"reqType":"",' +
  10160. '"orderType":"",' +
  10161. '"ghFeeFlag":"",' +
  10162. '"grzhzf":"",' +
  10163. '"readCardResult":"",' +
  10164. '"readCardType":"01"}');
  10165. jsonData.patientId = $("#patientId").text();
  10166. var userIdCode = localStorage.getItem("userIdCode");
  10167. var visitDeptCode = localStorage.getItem(userIdCode);
  10168. if (visitDeptCode == null) {
  10169. visitDeptCode = "";
  10170. }
  10171. jsonData.visitDeptCode = visitDeptCode;
  10172. jsonData.firstOrNot = $("input[name='firstOrNot']:checked").val();
  10173. jsonData.icdCode = icdCode;
  10174. jsonData.tcmIcdCode = tcmIcdCodes;
  10175. jsonData.serialNo = $("#mzfzSerialNoInClick").val();
  10176. if (type == 1) {
  10177. jsonData.turnToConsultationId = $("#turnToConsultationIdInClick").val();
  10178. var mdtrtGrpType = $("#mdtrtGrpType").val();
  10179. var trumFlag = $("#trumFlag").val();
  10180. var relTtpFlag = $("#relTtpFlag").val();
  10181. if (trumFlag == "1" && relTtpFlag == "") {
  10182. errorMesageSimaple("请注意【外伤标志】为【是】,【涉及第三方标志】不能为空!");
  10183. $("#messageButton").attr("disabled", false);
  10184. $("#messageModal").modal("hide");
  10185. throw new Error("请注意【外伤标志】为【是】,【涉及第三方标志】不能为空!");
  10186. }
  10187. var otpErReflFlag = $("#otpErReflFlag").val();
  10188. var expContent = JSON.parse("{}");
  10189. if (mdtrtGrpType != "" && mdtrtGrpType != "-1") {
  10190. expContent.MDTRT_GRP_TYPE = mdtrtGrpType;
  10191. }
  10192. if (trumFlag != "") {
  10193. expContent.TRUM_FLAG = trumFlag;
  10194. }
  10195. if (relTtpFlag != "") {
  10196. expContent.REL_TTP_FLAG = relTtpFlag;
  10197. }
  10198. if (otpErReflFlag != "" && otpErReflFlag != "-1") {
  10199. expContent.OTP_ER_REFL_FLAG = otpErReflFlag;
  10200. }
  10201. jsonData.expContent = JSON.stringify(expContent);
  10202. }
  10203. jsonData.mzBlRecord.firstOrNot = jsonData.firstOrNot;
  10204. jsonData.mzBlRecord.emrChiefComplaint = $("#symptom").val();
  10205. jsonData.mzBlRecord.emrHpi = $("#emrHpi").val();
  10206. jsonData.mzBlRecord.emrPs = $("#emrPs").val();
  10207. jsonData.mzBlRecord.emrPe = $("#otherCheck").val();
  10208. jsonData.mzBlRecord.emrJkjy = $("#healthEducation").val();
  10209. jsonData.mzBlRecord.personalHistory = $("#personalHistory").val();
  10210. jsonData.mzBlRecord.familyHistory = $("#familyHistory").val();
  10211. jsonData.mzBlRecord.fzZl = $("#fzZl").val();
  10212. jsonData.mzBlRecord.crbHistory = $("#crbHistory").val();
  10213. jsonData.mzBlRecord.obstericalHistory = $("#obstericalHistory").val();
  10214. jsonData.mzBlRecord.weight = $("#weight").val();
  10215. jsonData.mzBlRecord.temperature = $("#temperature").val();
  10216. jsonData.mzBlRecord.sphygmus = $("#sphygmus").val();
  10217. jsonData.mzBlRecord.breathe = $("#breathe").val();
  10218. jsonData.mzBlRecord.pressureHigh = $("#pressure_high").val();
  10219. jsonData.mzBlRecord.pressureFloor = $("#pressure_floor").val();
  10220. jsonData.mzBlRecord.pressureHighLeft = $("#pressure_high_left").val();
  10221. jsonData.mzBlRecord.pressureFloorLeft = $("#pressure_floor_left").val();
  10222. jsonData.mzBlRecord.tentativeDiagnosis = $("#tentativeDiagnosis").val();
  10223. //职工统筹部分参数
  10224. jsonData.zgmztczf = $("#zgmztczf").val();
  10225. jsonData.grzhzf = $("#grzhzf").val();
  10226. jsonData.readCardResult = $("#readCardResult").val();
  10227. jsonData.reqType = $("#mzReqType").val();
  10228. jsonData.orderType = $("#mzOrderTypeSelect").val();
  10229. jsonData.ghFeeFlag = $("#ghFeeSelect").val();
  10230. jsonData.opspDisecode = curOpspDiseCode;
  10231. jsonData.opspDiseName = curOpspDiseName;
  10232. //设置过敏源
  10233. var zdAllergen = $("#zdAllergen").val();
  10234. var ypDitList = $("#ypDitList").val();
  10235. if (zdAllergen != null && zdAllergen.length > 0) {
  10236. for (var i = 0; i < zdAllergen.length; i++) {
  10237. var tempJson = JSON.parse('{}');
  10238. tempJson.allergenCode = zdAllergen[i];
  10239. tempJson.type = 0;
  10240. jsonData.patientAllergenInfoList[jsonData.patientAllergenInfoList.length] = tempJson;
  10241. }
  10242. }
  10243. if (ypDitList != null && ypDitList.length > 0) {
  10244. for (var i = 0; i < ypDitList.length; i++) {
  10245. var tempJson = JSON.parse('{}');
  10246. tempJson.allergenCode = ypDitList[i];
  10247. tempJson.type = 1;
  10248. jsonData.patientAllergenInfoList[jsonData.patientAllergenInfoList.length] = tempJson;
  10249. }
  10250. }
  10251. //设置处方详情
  10252. var emrFzjc = null;
  10253. var xyTabContents = $("#xyTabContent").find("div.tab-pane");
  10254. //处方号
  10255. var orderNo = 0;
  10256. var arrs = $("span.cf_amount");
  10257. //西药设置
  10258. if (xyTabContents != null && xyTabContents.length > 0) {
  10259. for (var i = 0; i < xyTabContents.length; i++) {
  10260. //当前药品类型
  10261. var currentGroupNo = $(xyTabContents[i]).find("input.current_groupNo").val();
  10262. var formGroups = $(xyTabContents[i]).find("div.form-group");
  10263. if (formGroups != null && formGroups.length > 0) {
  10264. for (var j = 0; j < formGroups.length; j++) {
  10265. var tempJson = JSON.parse('{"chargeItemCode": "","serial": "","quantity": "","drugQuan": "","drugUnit": "","frequency": "","orderDays": "","paySelf": "0","drugWin": "1","instructionCode":"",' +
  10266. '"instructionText":"","orderNo":"","groupOrder":"","supplyCode":"","tryFlag":"","tryResult":"","groupNo":"","cyJssm":"","cyDj":"","cyFysm":"","cyJsl":"","cyZql":"","cyFj":"","cyFfcs":"","cyMtjs":""}');
  10267. tempJson.chargeItemCode = $(formGroups[j]).find("input.temporary_items_code").val();
  10268. tempJson.serial = $(formGroups[j]).find("input.temporary_items_serial").val();
  10269. tempJson.quantity = $(formGroups[j]).find("input.temporary_items_gross").val();
  10270. tempJson.drugQuan = $(formGroups[j]).find("input.temporary_items_drugWin").val();
  10271. tempJson.drugUnit = $(formGroups[j]).find("input.temporary_items_drugWinUnit").val();
  10272. tempJson.frequency = $(formGroups[j]).find("input.temporary_items_orderFrequency").val();
  10273. tempJson.orderDays = $(formGroups[j]).find("input.temporary_items_dayNum").val();
  10274. tempJson.instructionCode = $(formGroups[j]).find("input.temporary_items_medicalAdvice").val();
  10275. tempJson.instructionText = $(formGroups[j]).find("input.temporary_items_medicalAdviceText").val();
  10276. tempJson.supplyCode = $(formGroups[j]).find("input.temporary_items_supplyType").val();
  10277. tempJson.hospApprFlag = $(formGroups[j]).find("input.temporary_items_xyHospApprFlag").val();
  10278. orderNo = i + 1;
  10279. tempJson.orderNo = orderNo;
  10280. tempJson.groupOrder = $(formGroups[j]).find("input.temporary_items_groupId").val();
  10281. tempJson.groupNo = currentGroupNo;
  10282. var tryResult = $(formGroups[j]).find("input.temporary_items_tryResult").val();
  10283. if (tryResult != undefined || tryResult != null || tryResult != "") {
  10284. if (tryResult == 100 || tryResult == "100") {
  10285. tempJson.tryFlag = 1;
  10286. } else {
  10287. tempJson.tryResult = tryResult;
  10288. }
  10289. }
  10290. jsonData.mzChargeDetailList[jsonData.mzChargeDetailList.length] = tempJson;
  10291. }
  10292. }
  10293. }
  10294. }
  10295. //中草药
  10296. var zyTabContents = $("#zyTabContent").find("div.form-group");
  10297. if (zyTabContents != null && zyTabContents.length > 0) {
  10298. orderNo++;
  10299. var zyfs = $("#zyfs").val();
  10300. if (zyfs == null || zyfs == "") {
  10301. if (type == 3) {
  10302. zyfs = 1;
  10303. } else {
  10304. errorMesageSimaple("中药付数为空,请设置!");
  10305. $("#messageButton").attr("disabled", false);
  10306. throw new Error('中药付数为空,请设置!');
  10307. }
  10308. }
  10309. //中药的类型
  10310. var currentZyClassType = $("#current_zyClassType").val();
  10311. for (var i = 0; i < zyTabContents.length; i++) {
  10312. var tempJson = JSON.parse('{"chargeItemCode": "","serial": "","quantity": "","drugQuan": "","drugUnit": "g","frequency": "","orderDays": "1","paySelf": "0","drugWin": "","instructionCode":"",' +
  10313. '"instructionText":"","orderNo":"1","groupOrder":"1","supplyCode":"","tryFlag":"0","tryResult":"0","groupNo":"","cyJssm":"","cyDj":"","cyFysm":"","cyJsl":"","cyZql":"","cyFj":"","cyFfcs":"","cyMtjs":""}');
  10314. tempJson.chargeItemCode = $(zyTabContents[i]).find("input.temporary_items_code").val();
  10315. tempJson.serial = $(zyTabContents[i]).find("input.temporary_items_serial").val();
  10316. tempJson.quantity = $(zyTabContents[i]).find("input.temporary_items_drugWin").val();
  10317. tempJson.drugQuan = $(zyTabContents[i]).find("input.temporary_items_drugWin").val();
  10318. tempJson.drugWin = zyfs;
  10319. tempJson.drugUnit=$(zyTabContents[i]).find("input.temporary_items_drugUnit").val();
  10320. //tempJson.frequency = $("#zy_orderFrequency_1").val();
  10321. tempJson.instructionCode = $(zyTabContents[i]).find("input.temporary_items_zyInstruction").val();
  10322. tempJson.instructionText = $(zyTabContents[i]).find("input.temporary_items_zyInstructionText").val();
  10323. tempJson.hospApprFlag = $(zyTabContents[i]).find("input.temporary_items_zyHospApprFlag").val();
  10324. tempJson.cyFysm = $("#useType_1").val();
  10325. tempJson.cyJssm = $("#cyJssm").val();
  10326. tempJson.cyJsl = $("#cyJsl").val();
  10327. if(currentZyClassType !='83'){
  10328. tempJson.cyZql = $("#cyZql").val();
  10329. tempJson.cyFj = $("#cyFj").val();
  10330. tempJson.cyDj = $("#zy_supplyType_1").val();
  10331. }
  10332. tempJson.cyFfcs = $("#cyFfcs").val();
  10333. tempJson.cyMtjs = $("#cyMtjs").val();
  10334. tempJson.orderNo = orderNo;
  10335. tempJson.groupNo = currentZyClassType;
  10336. jsonData.mzChargeDetailList[jsonData.mzChargeDetailList.length] = tempJson;
  10337. }
  10338. }
  10339. //辅助检查、检验
  10340. var jcjyTabContents = $("#jcjyTabContent").find("div.form-group");
  10341. if (jcjyTabContents != null && jcjyTabContents.length > 0) {
  10342. orderNo++;
  10343. for (var i = 0; i < jcjyTabContents.length; i++) {
  10344. if (emrFzjc == null) {
  10345. emrFzjc = $(jcjyTabContents[i]).text();
  10346. } else {
  10347. emrFzjc += "," + $(jcjyTabContents[i]).text();
  10348. }
  10349. var tempJson = null;
  10350. //项目类型
  10351. var itemsType = $(jcjyTabContents[i]).find("input.temporary_items_type").val();
  10352. //执行科室
  10353. var execUnit = $(jcjyTabContents[i]).find("input.temporary_items_execUnit").val();
  10354. tempJson = JSON.parse('{"orderCode":"","inspectPart":"","inspectStuff":"","jyRemark":"","orderNo":"1","execDept":"","quantity":""}');
  10355. tempJson.orderCode = $(jcjyTabContents[i]).find("input.temporary_items_code").val();
  10356. if (itemsType == "1" || itemsType == 1) {
  10357. //检验
  10358. tempJson.inspectStuff = $(jcjyTabContents[i]).find("input.temporary_items_desc_value").val();
  10359. tempJson.quantity = $(jcjyTabContents[i]).find("input.temporary_items_jyQuantity").val();
  10360. } else if (itemsType == "2" || itemsType == 2) {
  10361. //检查
  10362. tempJson.inspectPart = $(jcjyTabContents[i]).find("input.temporary_items_desc_value").val();
  10363. }
  10364. tempJson.jyRemark = $(jcjyTabContents[i]).find("input.temporary_items_remark").val();
  10365. tempJson.orderNo = orderNo;
  10366. tempJson.execDept = execUnit;
  10367. jsonData.mzYjReqList[jsonData.mzYjReqList.length] = tempJson;
  10368. }
  10369. }
  10370. //诊疗
  10371. var zlTabContents = $("#zlTabContent").find("div.form-group");
  10372. if (zlTabContents != null && zlTabContents.length > 0) {
  10373. orderNo++;
  10374. for (var i = 0; i < zlTabContents.length; i++) {
  10375. var tempJson = null;
  10376. //执行科室
  10377. var execUnit = $(zlTabContents[i]).find("input.temporary_items_execUnit").val();
  10378. //诊疗,放入药品类型中入库,因为诊疗是与药品一样直接入明细库,但是是与医技在同一处方开立页面开立
  10379. tempJson = JSON.parse('{"unitPrice": "0","chargeItemCode": "","serial": "","quantity": "1","drugQuan": "1","drugUnit": "","frequency": "","orderDays": "1","paySelf": "0","drugWin": "1","instructionCode":"","instructionText":"","orderNo":"","groupOrder":"","supplyCode":"","cyJssm":"","cyDj":"","cyFysm":"","tryFlag":"0","groupNo":"00","execDept":""}');
  10380. tempJson.chargeItemCode = $(zlTabContents[i]).find("input.temporary_items_code").val();
  10381. tempJson.instructionText = $(zlTabContents[i]).find("input.temporary_items_remark").val();
  10382. tempJson.quantity = $(zlTabContents[i]).find("input.temporary_items_totalNumZl").val();
  10383. tempJson.drugQuan = $(zlTabContents[i]).find("input.temporary_items_itemQuantity").val();
  10384. tempJson.zlUnitPrice = $(zlTabContents[i]).find("input.temporary_items_amount").val();
  10385. //因为收费表里的单位长度限制,无法存入库
  10386. //tempJson.drugUnit = $(zlTabContents[i]).find("input.temporary_items_desc_value").val();
  10387. tempJson.frequency = $(zlTabContents[i]).find("input.temporary_items_orderFrequencyZl").val();
  10388. tempJson.hospApprFlag = $(zlTabContents[i]).find("input.temporary_items_zlHospApprFlag").val();
  10389. tempJson.orderDays = $(zlTabContents[i]).find("input.temporary_items_dayZlNum").val();
  10390. tempJson.orderNo = orderNo;
  10391. tempJson.execDept = execUnit;
  10392. jsonData.mzChargeDetailList[jsonData.mzChargeDetailList.length] = tempJson;
  10393. }
  10394. }
  10395. //外配药
  10396. var wpMedicineTabContents = $("#wpMedicineTabContent").find("div.form-group");
  10397. if (wpMedicineTabContents != null && wpMedicineTabContents.length > 0) {
  10398. for (var i = 0; i < wpMedicineTabContents.length; i++) {
  10399. var tempJson = JSON.parse('{"medListCodg": "","drugGenname": "","rxItemTypeCode": "","medcWayCodg": "","medcDays": "1","prdrName": "","sinDosunt": "","sinDoscnt": "1","usedFrquCodg": "","drugDosunt": "","drugCnt":"","drugSpec":"","hospApprFlag":"","drugDosform":""}');
  10400. tempJson.medListCodg = $(wpMedicineTabContents[i]).find("input.temporary_items_code").val();
  10401. tempJson.drugGenname = $(wpMedicineTabContents[i]).find("input.temporary_items_wpMedicineName").val();
  10402. tempJson.rxItemTypeCode = $(wpMedicineTabContents[i]).find("input.temporary_items_rxItemTypeCode").val();
  10403. tempJson.medcWayCodg = $(wpMedicineTabContents[i]).find("input.temporary_items_medcWayCodg").val();
  10404. tempJson.medcDays = $(wpMedicineTabContents[i]).find("input.temporary_items_medcDays").val();
  10405. tempJson.prdrName = $(wpMedicineTabContents[i]).find("input.temporary_items_prdrName").val();
  10406. tempJson.sinDosunt = $(wpMedicineTabContents[i]).find("input.temporary_items_sinDosunt").val();
  10407. tempJson.drugDosform = $(wpMedicineTabContents[i]).find("input.temporary_items_drugDosform").val();
  10408. tempJson.sinDoscnt = $(wpMedicineTabContents[i]).find("input.temporary_items_sinDoscnt").val();
  10409. tempJson.usedFrquCodg = $(wpMedicineTabContents[i]).find("input.temporary_items_usedFrquCodg").val();
  10410. tempJson.drugCnt = $(wpMedicineTabContents[i]).find("input.temporary_items_drugCnt").val();
  10411. tempJson.drugDosunt = $(wpMedicineTabContents[i]).find("input.temporary_items_drugDosunt").val();
  10412. tempJson.drugSpec = $(wpMedicineTabContents[i]).find("input.temporary_items_drugSpec").val();
  10413. tempJson.hospApprFlag = $(wpMedicineTabContents[i]).find("input.temporary_items_wpHospApprFlag").val();
  10414. jsonData.rxDruginfoList[jsonData.rxDruginfoList.length] = tempJson;
  10415. }
  10416. }
  10417. //入院
  10418. var zyReqTabContents = $("#zyReqTabContent").find("div.form-group");
  10419. if (zyReqTabContents != null && zyReqTabContents.length > 0) {
  10420. jsonData.mzZyReq.reqDept = $(zyReqTabContents[0]).find("input.temporary_inpatient_ward").val();
  10421. jsonData.mzZyReq.smallDept = $(zyReqTabContents[0]).find("input.temporary_items_small_ward").val();
  10422. jsonData.mzZyReq.admissStatus = $(zyReqTabContents[0]).find("input.temporary_items_admiss_status").val();
  10423. jsonData.mzZyReq.conditionCode = $(zyReqTabContents[0]).find("input.temporary_items_condition_code").val();
  10424. jsonData.mzZyReq.routeOfAdmission = $(zyReqTabContents[0]).find("input.temporary_items_route_of_admission").val();
  10425. jsonData.mzZyReq.contacterName = $(zyReqTabContents[0]).find("input.temporary_items_contacter_name").val();
  10426. jsonData.mzZyReq.contacterRelationship = $(zyReqTabContents[0]).find("input.temporary_items_contacter_relationship").val();
  10427. jsonData.mzZyReq.contacterPhone = $(zyReqTabContents[0]).find("input.temporary_items_contacter_phone").val();
  10428. jsonData.mzZyReq.contacterAddress = $(zyReqTabContents[0]).find("input.temporary_items_contacter_address").val();
  10429. jsonData.mzZyReq.deposit = $(zyReqTabContents[0]).find("input.temporary_items_deposit").val();
  10430. }
  10431. //门诊手术
  10432. var opRecordTabContents = $("#opRecordTabContent").find("div.form-group");
  10433. if (opRecordTabContents != null && opRecordTabContents.length > 0) {
  10434. for (var i = 0; i < opRecordTabContents.length; i++) {
  10435. var tempJson = null;
  10436. var execUnit = $(opRecordTabContents[i]).find("input.temporary_items_execUnit").val();
  10437. tempJson = JSON.parse('{"opCode": "","opName": "","opDatetimeStr": "","urgentClinicFlag": "","ssbc": "","partCode": "","opScale": "","hocusCode": "","doctorZd": "","remark":""}');
  10438. tempJson.opCode = $(opRecordTabContents[i]).find("input.temporary_items_code").val();
  10439. tempJson.opName = $(opRecordTabContents[i]).find("input.temporary_items_op_name").val();
  10440. tempJson.opDatetimeStr = $(opRecordTabContents[i]).find("input.temporary_items_op_time").val();
  10441. tempJson.urgentClinicFlag = $(opRecordTabContents[i]).find("input.temporary_items_urgent_clinic_flag").val();
  10442. tempJson.ssbc = $(opRecordTabContents[i]).find("input.temporary_items_ssbc").val();
  10443. tempJson.partCode = $(opRecordTabContents[i]).find("input.temporary_items_part_code").val();
  10444. tempJson.opScale = $(opRecordTabContents[i]).find("input.temporary_items_op_scale").val();
  10445. tempJson.hocusCode = $(opRecordTabContents[i]).find("input.temporary_items_hocus_code").val();
  10446. tempJson.doctorZd = $(opRecordTabContents[i]).find("input.temporary_items_doctor_zd").val();
  10447. tempJson.remark = $(opRecordTabContents[i]).find("input.temporary_items_op_record_remark").val();
  10448. jsonData.opRecordList[jsonData.opRecordList.length] = tempJson;
  10449. }
  10450. }
  10451. //设置诊断名称
  10452. var icdText = null;
  10453. var tagsTexts = $("span.el-select__tags-text");
  10454. if (tagsTexts != null && tagsTexts.length > 0) {
  10455. for (var i = 0; i < tagsTexts.length; i++) {
  10456. if (icdText == null) {
  10457. icdText = $(tagsTexts[i]).text();
  10458. } else {
  10459. icdText += "," + $(tagsTexts[i]).text();
  10460. }
  10461. }
  10462. }
  10463. jsonData.icdText = icdText;
  10464. //设置中医诊断名称
  10465. let tcmIcdText = null;
  10466. let tcmTagsTexts = $("span.el-select__tcmtags-text");
  10467. if (tcmTagsTexts != null && tcmTagsTexts.length > 0) {
  10468. for (var i = 0; i < tcmTagsTexts.length; i++) {
  10469. if (tcmIcdText == null) {
  10470. tcmIcdText = $(tcmTagsTexts[i]).text();
  10471. } else {
  10472. tcmIcdText += "," + $(tcmTagsTexts[i]).text();
  10473. }
  10474. }
  10475. }
  10476. jsonData.tcmIcdText = tcmIcdText;
  10477. jsonData.mzBlRecord.emrFzjc = emrFzjc;
  10478. return jsonData;
  10479. }
  10480. function getParamsHlyy() {
  10481. let loginUserCode = localStorage.getItem("userID")
  10482. let loginUserName = localStorage.getItem("userName")
  10483. let loginUserDept = localStorage.getItem("currentDeptNo")
  10484. // let currentPatient = patientList.find(item=> item.patientId == currentPatientId)
  10485. console.log("currentPatientId",currentPatientId)
  10486. console.log("currentPatientInfo",currentPatientInfo)
  10487. // //设置过敏源
  10488. let patientAllergenInfoList = []
  10489. let zdAllergen = $("#zdAllergen").find(":selected");
  10490. const zdAllergenValue = [];
  10491. const zdAllergenName = [];
  10492. zdAllergen.each(function() {
  10493. zdAllergenValue.push($(this).val()); // 选中的值
  10494. zdAllergenName.push($(this).text()); // 显示的文本
  10495. });
  10496. console.log("zdAllergenValue",zdAllergenValue)
  10497. console.log("zdAllergenName",zdAllergenName)
  10498. let ypDitList = $("#ypDitList").find(":selected");
  10499. const ypDitListValue = [];
  10500. const ypDitListName = [];
  10501. ypDitList.each(function() {
  10502. ypDitListValue.push($(this).val()); // 选中的值
  10503. ypDitListName.push($(this).text()); // 显示的文本
  10504. });
  10505. console.log("ypDitListValue",ypDitListValue)
  10506. console.log("ypDitListName",ypDitListName)
  10507. if (zdAllergen != null && zdAllergen.length > 0) {
  10508. for (let i = 0; i < zdAllergen.length; i++) {
  10509. let tempJson = JSON.parse('{}');
  10510. tempJson.code = zdAllergenValue[i];
  10511. tempJson.name = zdAllergenName[i];
  10512. patientAllergenInfoList[patientAllergenInfoList.length] = tempJson;
  10513. }
  10514. }
  10515. if (ypDitList != null && ypDitList.length > 0) {
  10516. for (let i = 0; i < ypDitList.length; i++) {
  10517. let tempJson = JSON.parse('{}');
  10518. tempJson.code = ypDitListValue[i];
  10519. tempJson.name = ypDitListName[i];
  10520. patientAllergenInfoList[patientAllergenInfoList.length] = tempJson;
  10521. }
  10522. }
  10523. var diagnoseChildren = $("#diagnoseTags").children();
  10524. var patientDiag = [];
  10525. for (var i = 0; i < diagnoseChildren.length; i++) {
  10526. var child = diagnoseChildren[i]; // 直接获取 DOM 元素
  10527. patientDiag.push({
  10528. code: child.id,
  10529. name: child.getAttribute("title") // 或 child.title
  10530. });
  10531. }
  10532. //设置处方详情
  10533. var orderList = [];
  10534. var emrFzjc = null;
  10535. var xyTabContents = $("#xyTabContent").find("div.tab-pane");
  10536. //西药设置
  10537. if (xyTabContents != null && xyTabContents.length > 0) {
  10538. for (var i = 0; i < xyTabContents.length; i++) {
  10539. //当前药品类型
  10540. var currentGroupNo = $(xyTabContents[i]).find("input.current_groupNo").val();
  10541. var formGroups = $(xyTabContents[i]).find("div.form-group");
  10542. if (formGroups != null && formGroups.length > 0) {
  10543. for (var j = 0; j < formGroups.length; j++) {
  10544. var tempJson = JSON.parse('{"id": "","code": "","route": "","name": "","dose": "","doseUnit": "","freq": "","amount": "","unit": "","repeat":"0",' +
  10545. '"startDateTime":"","dayCount":"","group":""}');
  10546. tempJson.id = $(formGroups[j]).find("input.temporary_items_code").val();
  10547. tempJson.code = $(formGroups[j]).find("input.temporary_items_code").val();
  10548. tempJson.route = $(formGroups[j]).find("input.temporary_items_supplyTypeText").val();
  10549. tempJson.name = $(formGroups[j]).find("input.temporary_items_westernMedicineNamme").val();
  10550. tempJson.dose = $(formGroups[j]).find("input.temporary_items_drugWin").val();
  10551. tempJson.doseUnit = $(formGroups[j]).find("input.temporary_items_drugWinUnitText").val();
  10552. tempJson.freq = $(formGroups[j]).find("input.temporary_items_orderFrequency").val();
  10553. tempJson.amount = $(formGroups[j]).find("input.temporary_items_gross").val();
  10554. tempJson.unit = $(formGroups[j]).find("input.temporary_items_packUnit").val();
  10555. const timer = new Date();
  10556. tempJson.startDateTime = timer.toLocaleString();
  10557. tempJson.dayCount = $(formGroups[j]).find("input.temporary_items_dayNum").val();
  10558. tempJson.group = $(formGroups[j]).find("input.temporary_items_groupId").val();
  10559. orderList.push(tempJson)
  10560. }
  10561. }
  10562. }
  10563. }
  10564. //外配药设置
  10565. var wpMedicineTabContents = $("#wpMedicineTabContent").find("div.form-group");
  10566. if (wpMedicineTabContents != null && wpMedicineTabContents.length > 0) {
  10567. console.log("wpMedicineTabContent",wpMedicineTabContent)
  10568. for (var i = 0; i < xyTabContents.length; i++) {
  10569. //当前药品类型
  10570. var currentGroupNo = $(xyTabContents[i]).find("input.current_groupNo").val();
  10571. var formGroups = $(xyTabContents[i]).find("div.form-group");
  10572. if (formGroups != null && formGroups.length > 0) {
  10573. for (var j = 0; j < formGroups.length; j++) {
  10574. var tempJson = JSON.parse('{"id": "","code": "","route": "","name": "","dose": "","doseUnit": "","freq": "","amount": "","unit": "","repeat":"0",' +
  10575. '"startDateTime":"","dayCount":"","group":""}');
  10576. tempJson.id = $(formGroups[j]).find("input.temporary_items_code").val();
  10577. tempJson.code = $(formGroups[j]).find("input.temporary_items_code").val();
  10578. tempJson.route = $(formGroups[j]).find("input.temporary_items_medcWayCodg").val();
  10579. tempJson.name = $(formGroups[j]).find("input.temporary_items_wpMedicineName").val();
  10580. tempJson.dose = $(formGroups[j]).find("input.temporary_items_sinDoscnt").val();
  10581. tempJson.doseUnit = $(formGroups[j]).find("input.temporary_items_sinDosunt").val();
  10582. tempJson.freq = $(formGroups[j]).find("input.temporary_items_usedFrquCodg").val();
  10583. tempJson.amount = $(formGroups[j]).find("input.temporary_items_drugCnt").val();
  10584. tempJson.unit = $(formGroups[j]).find("input.temporary_items_drugDosunt").val();
  10585. const timer = new Date();
  10586. tempJson.startDateTime = timer.toLocaleString();
  10587. tempJson.dayCount = $(formGroups[j]).find("input.temporary_items_medcDays").val();
  10588. tempJson.group = $(formGroups[j]).find("input.temporary_items_groupId").val();
  10589. orderList.push(tempJson)
  10590. }
  10591. }
  10592. }
  10593. }
  10594. let params = {
  10595. station : {
  10596. type : "2"
  10597. },
  10598. doctor : {
  10599. code : loginUserCode ,
  10600. name : loginUserName ,
  10601. deptCode : loginUserDept
  10602. },
  10603. patient : {
  10604. id: currentPatientInfo.patientId ,
  10605. code: currentPatientInfo.patientId ,
  10606. visitId:"" ,
  10607. name : currentPatientInfo.name,
  10608. chargeType : currentPatientInfo.responseTypeName,
  10609. sex : currentPatientInfo.gender,
  10610. deptCode : loginUserDept,
  10611. birthday : currentPatientInfo.birthDayStr,
  10612. height :"",
  10613. weight :"",
  10614. medconds :{
  10615. diag : patientDiag,
  10616. allergens : patientAllergenInfoList
  10617. }
  10618. },
  10619. orders : orderList,
  10620. }
  10621. return params
  10622. console.log("params",params)
  10623. }
  10624. /**
  10625. * 保存处方
  10626. */
  10627. function savePrescription() {
  10628. function getHlyyResult(res) {
  10629. console.log("res",res)
  10630. $("#messageButton").attr("disabled", false);
  10631. if(res.bSave == true) {
  10632. var jsonData = getParamsForpPrescription(1);
  10633. let wpMedicineFlag = jsonData.rxDruginfoList ==null || jsonData.rxDruginfoList.length ==0 ? false : true;
  10634. savePrescriptionForReadCard(wpMedicineFlag);
  10635. } else {
  10636. errorMesageSimaple("合理用药未通过!");
  10637. }
  10638. }
  10639. var hlyyParams = getParamsHlyy()
  10640. MLRKON_CLIENT.doCall("srv_screen", JSON.stringify(hlyyParams), { "api": false, "timeout": 10000}, getHlyyResult)
  10641. // var jsonData = getParamsForpPrescription(1);
  10642. // console.log("savePrescription",jsonData)
  10643. // let wpMedicineFlag = jsonData.rxDruginfoList ==null || jsonData.rxDruginfoList.length ==0 ? false : true;
  10644. // $.ajax({
  10645. // type: "POST",
  10646. // url: '/thmz/rationalUseOfMedicine',
  10647. // contentType: "application/json;charset=UTF-8",
  10648. // dataType: "json",
  10649. // data: JSON.stringify(jsonData),
  10650. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10651. // success: function (res) {
  10652. // if (res == '401' || res == 401) {
  10653. // window.location.href = '/thmz/login/view'
  10654. // return;
  10655. // }
  10656. // $("#messageButton").attr("disabled", false);
  10657. // if (res.code == 0) {
  10658. // var rationalUseMap = res.data;
  10659. // var result_lv = rationalUseMap.result_lv;
  10660. // if (result_lv == 0 || result_lv == "0") {
  10661. // savePrescriptionForReadCard(wpMedicineFlag);
  10662. // } else {
  10663. // var showUrl = rationalUseMap.ShowUrl;
  10664. // getResultUrl = rationalUseMap.getResultUrl;
  10665. // showHlyyModel('hlyyDiv', 'loading', 'hlyyModal', showUrl);
  10666. // }
  10667. // } else {
  10668. // savePrescriptionForReadCard(wpMedicineFlag);
  10669. // }
  10670. // }
  10671. // });
  10672. }
  10673. /**
  10674. * 合理用药结果查询
  10675. */
  10676. function getResult() {
  10677. $.ajax({
  10678. type: "POST",
  10679. url: '/thmz/auditingInterface',
  10680. contentType: "application/json;charset=UTF-8",
  10681. dataType: "json",
  10682. data: JSON.stringify({"getResultUrl": getResultUrl}),
  10683. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10684. success: function (res) {
  10685. if (res == '401' || res == 401) {
  10686. window.location.href = '/thmz/login/view'
  10687. return;
  10688. }
  10689. $("#messageButton").attr("disabled", false);
  10690. $("#hlyyModal").modal("hide");
  10691. if (res.code == 0) {
  10692. var rationalUseMap = res.data;
  10693. if (rationalUseMap.length == 0) {
  10694. savePrescriptionForReadCard(false);
  10695. } else {
  10696. var resultcode = rationalUseMap.resultcode;
  10697. var success = rationalUseMap.success;
  10698. var sh_msg = rationalUseMap.sh_msg;
  10699. if (resultcode == -1) {
  10700. //为处方不存在分析结果 直接忽略
  10701. savePrescriptionForReadCard(false);
  10702. } else if (resultcode == 0) {
  10703. //2.success:药师审核完成标志,false未审核,true已审核/无需审核
  10704. if (success == true || success == "true") {
  10705. savePrescriptionForReadCard(false);
  10706. } else {
  10707. //提示消息
  10708. $("#messageModal").modal();
  10709. $("#messageContent").html("药师未审核,请点击右上方【继续保存】提交审核!");
  10710. $("#messageButton").off("click").bind("click", function (t) {
  10711. $("#messageModal").modal("hide");
  10712. $("#hlyyModal").modal();
  10713. });
  10714. $("#cancelButton").off("click").bind("click", function (t) {
  10715. $("#hlyyModal").modal();
  10716. });
  10717. ;
  10718. }
  10719. } else if (resultcode == 1) {
  10720. //提示消息
  10721. $("#messageModal").modal();
  10722. $("#messageContent").html(sh_msg);
  10723. $("#messageButton").off("click").bind("click", function (t) {
  10724. $("#messageModal").modal("hide");
  10725. });
  10726. $("#cancelButton").off("click");
  10727. }
  10728. }
  10729. } else {
  10730. savePrescriptionForReadCard(false);
  10731. }
  10732. }
  10733. });
  10734. }
  10735. /**
  10736. * 合理用药结果弹窗
  10737. * @param hlyyDiv
  10738. * @param loading
  10739. * @param hlyyModal
  10740. * @param showUrl
  10741. */
  10742. function showHlyyModel(hlyyDiv, loading, hlyyModal, showUrl) {
  10743. const iframeEle = document.getElementById(hlyyDiv);
  10744. const loadingEle = document.getElementById(loading);
  10745. //设置ififrame透明
  10746. iframeEle.style.opacity = 0;
  10747. loadingEle.style.display = 'block';
  10748. $("#" + hlyyDiv).attr("src", showUrl);
  10749. iframeEle.addEventListener('load', function () {
  10750. // Hide the loading indicator
  10751. loadingEle.style.display = 'none';
  10752. // Bring the iframe back
  10753. iframeEle.style.opacity = 1;
  10754. });
  10755. setTimeout(function () {
  10756. // iframe 重复加载不会触发上述事件
  10757. loadingEle.style.display = 'none';
  10758. iframeEle.style.opacity = 1;
  10759. }, 1000);
  10760. $("#" + hlyyModal).modal();
  10761. }
  10762. /**
  10763. * 点击保存处方时提示是否读卡 wpMedicineFlag true 是外配处方 false 否
  10764. */
  10765. function savePrescriptionForReadCard(wpMedicineFlag) {
  10766. console.log("savePrescriptionForReadCard")
  10767. if (!verifyInsuranceInfo()) {
  10768. return;
  10769. }
  10770. //关闭帮助框
  10771. $("#treeButton").webuiPopover('hide');
  10772. $("#western_medicine_name").webuiPopover('hide');
  10773. $("#chinese_medicine_name").webuiPopover('hide');
  10774. $("#jcJyItem").webuiPopover('hide');
  10775. $("#zlItem").webuiPopover('hide');
  10776. getAjaxRequst("/thmz/zaiYuanByPatientId",{ patientId:$("#patientId").text()},true,function (response) {
  10777. if(response.code == 0){
  10778. if(response.data == "0"){
  10779. if(wpMedicineFlag){
  10780. let readCardResult = $("#readCardResult").val();
  10781. if(stringIsBlank(readCardResult)){
  10782. $("#messageModalYb").modal();
  10783. $("#messageContent").html("门诊统筹处方必须读卡,是否立即读卡?");
  10784. $("#ybdzpz").off("click").bind("click", function (t) {
  10785. // mztczfSiReadCard(true, "qrcode_01101");
  10786. mztczfSiReadCard(true, "jiangsu_qrcode_01101");
  10787. realSavePrescription(wpMedicineFlag,false);
  10788. });
  10789. $("#ybsl").off("click").bind("click", function (t) {
  10790. // mztczfSiReadCard(true, "face_01101");
  10791. mztczfSiReadCard(true, "jiangsu_face_01101");
  10792. realSavePrescription(wpMedicineFlag,false);
  10793. });
  10794. $("#cancelButtonYb").off("click").bind("click", function (t) {
  10795. t.stopPropagation();
  10796. t.preventDefault();
  10797. realSavePrescription(wpMedicineFlag,false);
  10798. });
  10799. }else {
  10800. realSavePrescription(wpMedicineFlag,false);
  10801. }
  10802. }else{
  10803. realSavePrescription(wpMedicineFlag,false);
  10804. }
  10805. }else {
  10806. realSavePrescription(wpMedicineFlag,false);
  10807. }
  10808. }else {
  10809. errorMesage(response)
  10810. }
  10811. })
  10812. }
  10813. /**
  10814. * 最终保存处方方法
  10815. */
  10816. function realSavePrescription(wpMedicineFlag,mallFlag) {
  10817. $("#messageModalYb").modal('hide');
  10818. $("#messageModal").modal();
  10819. $("#messageContent").html("确认保存处方吗?");
  10820. $("#messageButton").off("click").bind("click", function (t) {
  10821. if (mztczfSiReadCardStatus && wpMedicineFlag) {
  10822. $("#messageContent").html("门诊统筹正在读卡中,此次操作需与医保中心交互,耗时较长,请耐心等待...");
  10823. return;
  10824. }
  10825. $("#messageButton").attr("disabled", true);
  10826. var jsonData = getParamsForpPrescription(1);
  10827. //商城处方
  10828. if(mallFlag){
  10829. jsonData.orderType = 5;
  10830. jsonData.wxmallPackagePurchasedItemList = $('#mall_tc_detail_table').bootstrapTable('getAllSelections');
  10831. }
  10832. $.ajax({
  10833. type: "POST",
  10834. url: '/thmz/savePrescription',
  10835. contentType: "application/json;charset=UTF-8",
  10836. dataType: "json",
  10837. data: JSON.stringify(jsonData),
  10838. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10839. success: function (res) {
  10840. if (res == '401' || res == 401) {
  10841. window.location.href = '/thmz/login/view'
  10842. return;
  10843. }
  10844. $("#messageButton").attr("disabled", false);
  10845. if (res.code == 0) {
  10846. successMesage(res);
  10847. if(mallFlag){
  10848. $("#mallTcDetailModal").modal("hide");
  10849. }
  10850. clearWorkSpace();
  10851. loadInClinicTableList();
  10852. loadClinicTableList();
  10853. //$("#messageModal").modal();
  10854. if(wpyHide === 0){
  10855. $("#messageContent").html("门诊处方保存成功,是否打印处方和门诊指引单?");
  10856. $("#messageButton").off("click").on("click", function (t) {
  10857. $("#messageModal").modal("hide");
  10858. if(mallFlag){
  10859. printPrescription(res.data.patientId, res.data.times, res.data.id, 0, 1);
  10860. }else {
  10861. printPrescription(res.data.patientId, res.data.times, res.data.id, 5, 1);
  10862. }
  10863. });
  10864. $("#cancelButton").off("click");
  10865. }else {
  10866. successMesageSimaple('门诊处方保存成功')
  10867. $("#messageModal").modal("hide");
  10868. }
  10869. } else {
  10870. $("#messageModal").modal("hide");
  10871. errorMesage(res);
  10872. }
  10873. }
  10874. });
  10875. });
  10876. $("#cancelButton").off("click");
  10877. }
  10878. /**
  10879. * 保存医疗范文
  10880. */
  10881. function saveapidAccepts() {
  10882. var templateName = $("#templateName").val();
  10883. if (templateName == null || templateName == "") {
  10884. errorMesageSimaple("范文名称不能为空!");
  10885. return;
  10886. }
  10887. var templateKindType = $("#templateKindType").val();
  10888. if (templateKindType == null || templateKindType == "") {
  10889. errorMesageSimaple("范文类型不能为空!");
  10890. return;
  10891. }
  10892. var templateType = $("#templateType").val();
  10893. if (templateType == null || templateType == "") {
  10894. errorMesageSimaple("范文范围不能为空!");
  10895. return;
  10896. }
  10897. var templateStatus = $("#templateStatus").val();
  10898. if (templateStatus == null || templateStatus == "") {
  10899. errorMesageSimaple("范文状态不能为空!");
  10900. return;
  10901. }
  10902. $("#saveapidAcceptsModal").modal("hide");
  10903. $("#messageModal").modal();
  10904. $("#messageContent").html("确认保存医疗范文吗?");
  10905. $("#messageButton").off("click").on("click", function (t) {
  10906. $("#messageModal").modal("hide");
  10907. var jsonData = getParamsForpPrescription(2);
  10908. var operationType = $("#operationType").val();
  10909. var templateId = $("#templateId").val();
  10910. if (operationType == 0 || operationType == '0') {
  10911. templateId = null;
  10912. }
  10913. $.ajax({
  10914. type: "POST",
  10915. url: '/thmz/saveTemplate',
  10916. contentType: "application/json;charset=UTF-8",
  10917. dataType: "json",
  10918. data: JSON.stringify({
  10919. "id": templateId,
  10920. "name": templateName,
  10921. "icdText": jsonData.icdText != null ? jsonData.icdText : jsonData.mzBlRecord.tentativeDiagnosis,
  10922. "templateKindType": templateKindType,
  10923. "templateType": templateType,
  10924. "templateStatus": templateStatus,
  10925. "templateData": JSON.stringify(jsonData),
  10926. "emrChiefComplaint": $("#symptom").val(),
  10927. "emrHpi": $("#emrHpi").val(),
  10928. "emrPs": $("#emrPs").val(),
  10929. "icdCode": $("#diagnoseValue").val()
  10930. }),
  10931. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10932. success: function (res) {
  10933. if (res == '401' || res == 401) {
  10934. window.location.href = '/thmz/login/view'
  10935. return;
  10936. }
  10937. if (res.code == 0) {
  10938. successMesage(res);
  10939. //范本保存完不清空
  10940. //clearWorkSpace();
  10941. } else {
  10942. $("#saveapidAcceptsModal").modal();
  10943. errorMesage(res);
  10944. }
  10945. }
  10946. });
  10947. });
  10948. $("#cancelButton").off("click");
  10949. }
  10950. /**
  10951. * 停用医疗范文
  10952. */
  10953. function removeTemplate() {
  10954. $("#messageModal").modal();
  10955. $("#messageContent").html("确认停用医疗范文吗?");
  10956. $("#messageButton").off("click").on("click", function (t) {
  10957. $("#messageModal").modal("hide");
  10958. $.ajax({
  10959. type: "POST",
  10960. url: '/thmz/removeTemplate',
  10961. contentType: "application/json;charset=UTF-8",
  10962. dataType: "json",
  10963. data: JSON.stringify({
  10964. "id": $("#idTemplate").val()
  10965. }),
  10966. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  10967. success: function (res) {
  10968. if (res == '401' || res == 401) {
  10969. window.location.href = '/thmz/login/view'
  10970. return;
  10971. }
  10972. if (res.code == 0) {
  10973. successMesage(res);
  10974. $("#medicalModelModal").modal("hide");
  10975. fitTemplateData();
  10976. } else {
  10977. errorMesage(res);
  10978. }
  10979. }
  10980. });
  10981. });
  10982. $("#cancelButton").off("click");
  10983. }
  10984. /**
  10985. * 清空医疗范文模块内容
  10986. */
  10987. function clearApidAcceptsModal() {
  10988. $("#templateId").val(null);
  10989. $("#templateName").val(null);
  10990. $("#templateKindType").selectpicker('val', 0);
  10991. $("#templateKindType").selectpicker('refresh');
  10992. $("#templateType").selectpicker('val', 0);
  10993. $("#templateType").selectpicker('refresh');
  10994. $("#templateStatus").selectpicker('val', 0);
  10995. $("#templateStatus").selectpicker('refresh');
  10996. $('#operationType').selectpicker('val', 0);
  10997. $('#operationType').selectpicker('refresh');
  10998. $("#operationTypeDiv").removeClass("in").addClass("hide");
  10999. }
  11000. /**
  11001. * 查询病人未缴费处方信息 加载到处方修改
  11002. * @param patientId
  11003. * @param times
  11004. * @param clnicId 就诊记录id
  11005. */
  11006. function getMzPrescriptionVoUnPaid(patientId, times, clnicId) {
  11007. currentPatientId = patientId;
  11008. console.log("currentPatientId1",currentPatientId)
  11009. if (!confirm("请确认要修改处方吗?如只修改病历,请取消,点击【详情】再【修改病历】")) {
  11010. return;
  11011. }
  11012. var currentPatientId = $("#patientId").text();
  11013. //当前接诊的用户和操作接诊的是同一个人,不做任何操作
  11014. if (currentPatientId == patientId) {
  11015. warningMesageSimaple("当前病人正在接诊中,请勿重复操作!");
  11016. return;
  11017. }
  11018. //效验是否有修改处方权限
  11019. postAjaxJsonHttpRequst("/thmz/queryPrescriptionModifyPermission",{"patientId":patientId,"times":times},false,function (re) {
  11020. if (re == '401' || re == 401) {
  11021. window.location.href = '/thmz/login/view'
  11022. return;
  11023. }
  11024. if(re.code != 0){
  11025. errorMesageSimaple(re.message);
  11026. return;
  11027. }
  11028. if (currentPatientId == null || currentPatientId == "") {
  11029. //当前没有人接诊,直接接诊
  11030. getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId);
  11031. } else {
  11032. //当前有人在接诊,提示是否需要切换和保存
  11033. $("#messagePrescriptionModal").modal();
  11034. $("#confirmPrescriptionButton").off("click").on("click", function (t) {
  11035. $("#messagePrescriptionModal").modal("hide");
  11036. //先保存目前接诊信息,再切换就诊人
  11037. var jsonData = getParamsForpPrescription(1);
  11038. $.ajax({
  11039. type: "POST",
  11040. url: '/thmz/savePrescription',
  11041. contentType: "application/json;charset=UTF-8",
  11042. dataType: "json",
  11043. data: JSON.stringify(jsonData),
  11044. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11045. success: function (res) {
  11046. if (res == '401' || res == 401) {
  11047. window.location.href = '/thmz/login/view'
  11048. return;
  11049. }
  11050. if (res.code == 0) {
  11051. loadInClinicTableList();
  11052. loadClinicTableList();
  11053. getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId);
  11054. } else {
  11055. errorMesage(res);
  11056. }
  11057. }
  11058. });
  11059. });
  11060. $("#cancelPrescriptionButton").off("click").on("click", function (t) {
  11061. $("#messagePrescriptionModal").modal("hide");
  11062. getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId);
  11063. });
  11064. }
  11065. })
  11066. }
  11067. /**
  11068. * 查询病人未缴费处方信息 加载到处方修改 通用方法
  11069. * @param patientId
  11070. * @param times
  11071. * @param clnicId 就诊记录id
  11072. */
  11073. function getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId) {
  11074. $.ajax({
  11075. type: "GET",
  11076. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + "&times=" + times + "&MzBlRecordFlag=false&payMark=5&clnicId=null",
  11077. contentType: "application/json;charset=UTF-8",
  11078. dataType: "json",
  11079. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11080. success: function (res) {
  11081. if (res == '401' || res == 401) {
  11082. window.location.href = '/thmz/login/view'
  11083. return;
  11084. }
  11085. if (res.code == 0) {
  11086. clearWorkSpace();
  11087. setMzReqType(patientId,times,null)
  11088. setMzPatientInfo(res.mzPatientMi);
  11089. editPrescription(res.data, 0)
  11090. //修改患者的时候,将原纪录的就诊记录id带上,并借用分诊流水号字段传参
  11091. $("#mzfzSerialNoInClick").val("clnicId_" + clnicId);
  11092. //查询患者的门诊统筹信息
  11093. queryInsuinfo(patientId);
  11094. } else {
  11095. errorMesage(res);
  11096. }
  11097. }
  11098. });
  11099. }
  11100. /**
  11101. * 查询病人已缴费处方信息 调用处方
  11102. * @param patientId
  11103. * @param times
  11104. * @param clnicId 就诊记录id
  11105. */
  11106. function getMzPrescriptionVoPaid(patientId, times, clnicId) {
  11107. $("#visitingDetailModal").modal("hide");
  11108. $("#messageModal").modal();
  11109. $("#messageContent").html("确认调用选中处方吗?将会覆盖当前处方。");
  11110. $("#messageButton").off("click").on("click", function (t) {
  11111. $("#messageModal").modal("hide");
  11112. $.ajax({
  11113. type: "GET",
  11114. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + "&times=" + times + "&MzBlRecordFlag=false&payMark=0&clnicId=null",
  11115. contentType: "application/json;charset=UTF-8",
  11116. dataType: "json",
  11117. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11118. success: function (res) {
  11119. if (res == '401' || res == 401) {
  11120. window.location.href = '/thmz/login/view'
  11121. return;
  11122. }
  11123. if (res.code == 0) {
  11124. var mzfzSerialNoInClick = $("#mzfzSerialNoInClick").val();
  11125. var mzfzReqTypeNoInClick = $("#mzfzReqTypeNoInClick").val();
  11126. clearUser(false);
  11127. clearWorkSpaceExcludeUser(3);
  11128. setMzPatientInfo(res.mzPatientMi);
  11129. editPrescription(res.data, 2)
  11130. $("#mzfzSerialNoInClick").val(mzfzSerialNoInClick);
  11131. $("#mzfzReqTypeNoInClick").val(mzfzReqTypeNoInClick);
  11132. } else {
  11133. errorMesage(res);
  11134. }
  11135. }
  11136. });
  11137. });
  11138. $("#cancelButton").off("click");
  11139. }
  11140. /**
  11141. * 重复接诊
  11142. * @param patientId
  11143. * @param times
  11144. * @param clnicId
  11145. * @param deptCode 就诊科室编码
  11146. */
  11147. function repeatAccepts(patientId, times, clnicId, deptCode) {
  11148. $.ajax({
  11149. type: "GET",
  11150. url: '/thmz/validMzyReqrec?patientId=' + patientId + "&deptCode=" + deptCode,
  11151. contentType: "application/json;charset=UTF-8",
  11152. dataType: "json",
  11153. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11154. success: function (res) {
  11155. if (res == '401' || res == 401) {
  11156. window.location.href = '/thmz/login/view'
  11157. return;
  11158. }
  11159. if (res.code == 0) {
  11160. if (res.data == 0) {
  11161. // $("#messageModal").modal();
  11162. // $("#messageContent").html("挂号失效,确定继续就诊?");
  11163. // $("#messageButton").off("click").on("click", function (t) {
  11164. // $("#messageModal").modal("hide");
  11165. // repeatAcceptsConfirm(patientId, times, clnicId);
  11166. // });
  11167. // $("#cancelButton").off("click");
  11168. warningMesageSimaple(res.message);
  11169. return;
  11170. }
  11171. repeatAcceptsConfirm(patientId, times, clnicId);
  11172. } else {
  11173. errorMesage(res);
  11174. }
  11175. }
  11176. });
  11177. }
  11178. /**
  11179. * 重复接诊提示方法
  11180. * @param patientId
  11181. * @param times
  11182. * @param clnicId
  11183. */
  11184. function repeatAcceptsConfirm(patientId, times, clnicId) {
  11185. var currentPatientId = $("#patientId").text();
  11186. //当前接诊的用户和操作接诊的是同一个人,不做任何操作
  11187. if (currentPatientId == patientId) {
  11188. return;
  11189. }
  11190. if (currentPatientId == null || currentPatientId == "") {
  11191. //当前没有人接诊,直接接诊
  11192. repeatAcceptsCommon(patientId, times, clnicId);
  11193. } else {
  11194. //当前有人在接诊,提示是否需要切换和保存
  11195. $("#messagePrescriptionModal").modal();
  11196. $("#confirmPrescriptionButton").off("click").on("click", function (t) {
  11197. $("#messagePrescriptionModal").modal("hide");
  11198. //先保存目前接诊信息,再切换就诊人
  11199. var jsonData = getParamsForpPrescription(1);
  11200. $.ajax({
  11201. type: "POST",
  11202. url: '/thmz/savePrescription',
  11203. contentType: "application/json;charset=UTF-8",
  11204. dataType: "json",
  11205. data: JSON.stringify(jsonData),
  11206. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11207. success: function (res) {
  11208. if (res == '401' || res == 401) {
  11209. window.location.href = '/thmz/login/view'
  11210. return;
  11211. }
  11212. if (res.code == 0) {
  11213. repeatAcceptsCommon(patientId, times, clnicId);
  11214. //加载已接诊患者列表
  11215. loadClinicTableList();
  11216. } else {
  11217. errorMesage(res);
  11218. }
  11219. }
  11220. });
  11221. });
  11222. $("#cancelPrescriptionButton").off("click").on("click", function (t) {
  11223. $("#messagePrescriptionModal").modal("hide");
  11224. repeatAcceptsCommon(patientId, times, clnicId);
  11225. });
  11226. }
  11227. }
  11228. /**
  11229. * 重复接诊通用方法
  11230. * @param patientId
  11231. * @param times
  11232. * @param clnicId
  11233. */
  11234. function repeatAcceptsCommon(patientId, times, clnicId) {
  11235. $.ajax({
  11236. type: "GET",
  11237. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + "&times=" + times + "&MzBlRecordFlag=true&payMark=null&clnicId=null",
  11238. contentType: "application/json;charset=UTF-8",
  11239. dataType: "json",
  11240. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11241. success: function (res) {
  11242. if (res == '401' || res == 401) {
  11243. window.location.href = '/thmz/login/view'
  11244. return;
  11245. }
  11246. if (res.code == 0) {
  11247. clearWorkSpace();
  11248. setMzReqType(patientId,times,null);
  11249. setMzPatientInfo(res.mzPatientMi);
  11250. editPrescription(res.data, 0)
  11251. //修改患者的时候,将原纪录的就诊记录id带上,并借用分诊流水号字段传参
  11252. $("#mzfzSerialNoInClick").val("clnicId_" + clnicId);
  11253. //查询患者的门诊统筹信息
  11254. queryInsuinfo(patientId);
  11255. } else {
  11256. errorMesage(res);
  11257. }
  11258. }
  11259. });
  11260. }
  11261. /**
  11262. * 就诊详情 已诊患者列表发起
  11263. * @param patientId
  11264. * @param times
  11265. * @param clnicId
  11266. * @param payMark
  11267. */
  11268. function prescriptionDetail(patientId, times, clnicId, payMark) {
  11269. prescriptionDetailCommon(patientId, times, clnicId, payMark, 0);
  11270. }
  11271. /**
  11272. * 就诊详情 历史轨迹发起
  11273. * @param patientId
  11274. * @param times
  11275. * @param clnicId
  11276. * @param clinicStatus
  11277. */
  11278. function visitingDetailModal(patientId, times, clnicId, clinicStatus) {
  11279. closeObjectWebui(false);
  11280. var payMark = null;
  11281. if (clinicStatus == 5) {
  11282. payMark = 5;
  11283. } else {
  11284. payMark = 0;
  11285. }
  11286. prescriptionDetailCommon(patientId, times, clnicId, payMark, 1);
  11287. }
  11288. function setmzPrescriptionPrintFlag(patientId, times) {
  11289. postAjaxJsonHttpRequst("/thmz/mzPrescriptionPrint/getPrintFlag",{patientId:patientId,times:times},true,function (res) {
  11290. if(res.data !=null){
  11291. if(res.data == '1'){
  11292. $("#printImage").attr("src", "/thmz/images/yiprint.png");
  11293. }else {
  11294. $("#printImage").attr("src", "/thmz/images/no_print.png");
  11295. }
  11296. }else {
  11297. $("#printImage").attr("src", "/thmz/images/yiprint.png");
  11298. }
  11299. })
  11300. }
  11301. /**
  11302. * 就诊详情通用方法
  11303. * @param patientId
  11304. * @param times
  11305. * @param clnicId
  11306. * @param payMark
  11307. * @param type 0 已诊患者列表发起 1 历史轨迹发起
  11308. */
  11309. function prescriptionDetailCommon(patientId, times, clnicId, payMark, type) {
  11310. $('#baseMzBlTimes').val(null);
  11311. var oriPayMark = payMark;
  11312. if (payMark == 1) {
  11313. //退费时,查看的明细还是处方开立的情况
  11314. payMark = 0;
  11315. }
  11316. //是否默认勾选处方回调
  11317. var checkboxFlag = localStorage.getItem("checkboxFlag");
  11318. if (checkboxFlag != null && (checkboxFlag == "0" || checkboxFlag == 0)) {
  11319. $("#conciseRecordsJzxq").prop("checked", true);
  11320. $("#prescriptionSubsidiaryJzxq").prop("checked", true);
  11321. } else {
  11322. $("#conciseRecordsJzxq").prop("checked", false);
  11323. $("#prescriptionSubsidiaryJzxq").prop("checked", false);
  11324. }
  11325. $.ajax({
  11326. type: "GET",
  11327. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + '&times=' + times + '&MzBlRecordFlag=false&payMark=' + payMark + '&clnicId=' + clnicId,
  11328. contentType: "application/json;charset=UTF-8",
  11329. dataType: "json",
  11330. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11331. success: function (res) {
  11332. if (res == '401' || res == 401) {
  11333. window.location.href = '/thmz/login/view'
  11334. return;
  11335. }
  11336. if (res.code == 0) {
  11337. $("#visitingDetailModal").modal();
  11338. var jsonData = res.data;
  11339. var mzPatientMi = res.mzPatientMi;
  11340. $("#visitingDetailPatientName").html('<a onclick="editUserModal(\'' + mzPatientMi.patientId + '\',3)" style=\'cursor: pointer;\'>' + mzPatientMi.name + '</a>');
  11341. $("#visitingDetailPatientAge").text(mzPatientMi.ageString);
  11342. $("#visitingDetailPatientGender").val(mzPatientMi.gender);
  11343. $("#prescriptionDetail_zd").html("");
  11344. $("#prescriptionDetail_xyzlContent").html("");
  11345. $("#prescriptionDetail_zyzlContent").html("");
  11346. $("#prescriptionDetail_zlyjContent").html("");
  11347. if (res.opDate != null) {
  11348. $("#visitingDetailDate").text(res.opDate);
  11349. }
  11350. if (res.deptName != null) {
  11351. $("#visitingDetailDept").text(res.deptName);
  11352. }
  11353. if (res.doctorName != null) {
  11354. $("#visitingDetailDoctor").text(res.doctorName);
  11355. }
  11356. var firstOrNot = jsonData.mzBlRecord.firstOrNot;
  11357. if (firstOrNot == 0) {
  11358. $("#visitFlag").html("初诊");
  11359. $("#first").next().click();
  11360. } else if (firstOrNot == 1) {
  11361. $("#visitFlag").html("复诊");
  11362. $("#not").next().click();
  11363. }
  11364. if (oriPayMark == 0) {
  11365. $("#chargeImage").attr("src", "/thmz/images/charge.png");
  11366. } else if (oriPayMark == 1) {
  11367. $("#chargeImage").attr("src", "/thmz/images/refund.png");
  11368. } else if (oriPayMark == 5) {
  11369. $("#chargeImage").attr("src", "/thmz/images/nocharge.png");
  11370. }
  11371. setmzPrescriptionPrintFlag(patientId, times);
  11372. $("#prescriptionDetail_zs").html(jsonData.mzBlRecord.emrChiefComplaint);
  11373. $("#prescriptionDetail_xbs").html(jsonData.mzBlRecord.emrHpi);
  11374. $("#prescriptionDetail_tgjc").html(jsonData.mzBlRecord.emrPe);
  11375. $("#prescriptionDetail_jkjy").html(jsonData.mzBlRecord.emrJkjy);
  11376. var icdText = jsonData.icdText;
  11377. if (icdText != null) {
  11378. var arr = icdText.split(",");
  11379. var html = "";
  11380. for (var i = 0; i < arr.length; i++) {
  11381. if (i == 0) {
  11382. html += ' <div class="tagZdy tagZdy-back">';
  11383. } else {
  11384. html += ' <div class="tagZdy tagZdy-back-green">';
  11385. }
  11386. html += arr[i];
  11387. html += '</div>';
  11388. }
  11389. $("#prescriptionDetail_zd").html(html);
  11390. } else {
  11391. $("#prescriptionDetail_zd").html(jsonData.mzBlRecord.tentativeDiagnosis);
  11392. }
  11393. let tcmIcdText = jsonData.tcmIcdText
  11394. if(tcmIcdText != null){
  11395. let arr = tcmIcdText.split(",");
  11396. let html = "";
  11397. for (let i = 0; i < arr.length; i++) {
  11398. if (i == 0) {
  11399. html += ' <div class="tagZdy tagZdy-back">';
  11400. } else {
  11401. html += ' <div class="tagZdy tagZdy-back-green">';
  11402. }
  11403. html += arr[i];
  11404. html += '</div>';
  11405. }
  11406. $("#prescriptionDetail_tcmzd").html(html);
  11407. }
  11408. var prescriptionDetail = jsonData.mzBlRecord.prescriptionDetail;
  11409. if (prescriptionDetail != null) {
  11410. var checkBox = type == 1;
  11411. prescriptionDetail = JSON.parse(prescriptionDetail);
  11412. var xyPrescription = prescriptionDetail.xyPrescription;
  11413. if (xyPrescription != null) {
  11414. fitxyContent(xyPrescription.pyPrescription, "prescriptionDetail_xypyContent", "prescriptionDetail_xypyTitle", checkBox);
  11415. fitxyContent(xyPrescription.mjPrescription, "prescriptionDetail_xymjContent", "prescriptionDetail_xymjTitle", checkBox);
  11416. fitxyContent(xyPrescription.jePrescription, "prescriptionDetail_xyjeContent", "prescriptionDetail_xyjeTitle", checkBox);
  11417. fitxyContent(xyPrescription.ycPrescription, "prescriptionDetail_yczlContent", "prescriptionDetail_yczlTitle", checkBox);
  11418. } else {
  11419. $("#prescriptionDetail_xypyTitle").removeClass("in").addClass("hide");
  11420. $("#prescriptionDetail_xypyContent").html("");
  11421. $("#prescriptionDetail_xymjTitle").removeClass("in").addClass("hide");
  11422. $("#prescriptionDetail_xymjContent").html("");
  11423. $("#prescriptionDetail_xyjeTitle").removeClass("in").addClass("hide");
  11424. $("#prescriptionDetail_xyjeContent").html("");
  11425. $("#prescriptionDetail_yczlTitle").removeClass("in").addClass("hide");
  11426. $("#prescriptionDetail_yczlContent").html("");
  11427. }
  11428. var zyPrescription = prescriptionDetail.zyPrescription;
  11429. if (zyPrescription != null) {
  11430. fitzyContent(zyPrescription, "prescriptionDetail_zyzlContent", "prescriptionDetail_zyzlTitle", checkBox);
  11431. } else {
  11432. $("#prescriptionDetail_zyzlTitle").removeClass("in").addClass("hide");
  11433. $("#prescriptionDetail_zyzlContent").html("");
  11434. }
  11435. var jcjyPrescription = prescriptionDetail.jcjyPrescription;
  11436. if (jcjyPrescription != null) {
  11437. fitJcjyContent(jcjyPrescription, "prescriptionDetail_jcjyContent", "prescriptionDetail_jcjyTitle", checkBox);
  11438. } else {
  11439. ("#prescriptionDetail_jcjyTitle").removeClass("in").addClass("hide");
  11440. $("#prescriptionDetail_jcjyContent").html("");
  11441. }
  11442. var zlPrescription = prescriptionDetail.zlPrescription;
  11443. if (zlPrescription != null) {
  11444. fitJcjyContent(zlPrescription, "prescriptionDetail_zlContent", "prescriptionDetail_zlTitle", checkBox);
  11445. } else {
  11446. $("#prescriptionDetail_zlTitle").removeClass("in").addClass("hide");
  11447. $("#prescriptionDetail_zlContent").html("");
  11448. }
  11449. var zyReqPrescription = prescriptionDetail.zyReqPrescription;
  11450. if (zyReqPrescription != null) {
  11451. fitZyReqContent(zyReqPrescription, "prescriptionDetail_zyReqContent", "prescriptionDetail_zyReqTitle", true);
  11452. } else {
  11453. $("#prescriptionDetail_zyReqTitle").removeClass("in").addClass("hide");
  11454. $("#prescriptionDetail_zyReqContent").html("");
  11455. }
  11456. var opRecordPrescription = prescriptionDetail.opRecordPrescription;
  11457. if (opRecordPrescription != null) {
  11458. fitOpRecordContent(opRecordPrescription, "prescriptionDetail_opRecordContent", "prescriptionDetail_opRecordTitle", true);
  11459. } else {
  11460. $("#prescriptionDetail_opRecordTitle").removeClass("in").addClass("hide");
  11461. $("#prescriptionDetail_opRecordContent").html("");
  11462. }
  11463. let wpMedicinePrescription = prescriptionDetail.wpMedicinePrescription;
  11464. if (wpMedicinePrescription != null) {
  11465. fitWpMedicineContent(wpMedicinePrescription, "prescriptionDetail_wpMedicineContent", "prescriptionDetail_wpMedicineTitle", true);
  11466. } else {
  11467. $("#prescriptionDetail_wpMedicineTitle").removeClass("in").addClass("hide");
  11468. $("#prescriptionDetail_wpMedicineContent").html("");
  11469. }
  11470. } else {
  11471. $("#prescriptionDetail_xypyTitle").removeClass("in").addClass("hide");
  11472. $("#prescriptionDetail_xypyContent").html("");
  11473. $("#prescriptionDetail_xymjTitle").removeClass("in").addClass("hide");
  11474. $("#prescriptionDetail_xymjContent").html("");
  11475. $("#prescriptionDetail_xyjeTitle").removeClass("in").addClass("hide");
  11476. $("#prescriptionDetail_xyjeContent").html("");
  11477. $("#prescriptionDetail_yczlTitle").removeClass("in").addClass("hide");
  11478. $("#prescriptionDetail_yczlContent").html("");
  11479. $("#prescriptionDetail_zyzlTitle").removeClass("in").addClass("hide");
  11480. $("#prescriptionDetail_zyzlContent").html("");
  11481. $("#prescriptionDetail_jcjyTitle").removeClass("in").addClass("hide");
  11482. $("#prescriptionDetail_jcjyContent").html("");
  11483. $("#prescriptionDetail_zlTitle").removeClass("in").addClass("hide");
  11484. $("#prescriptionDetail_zlContent").html("");
  11485. $("#prescriptionDetail_zyReqTitle").removeClass("in").addClass("hide");
  11486. $("#prescriptionDetail_zyReqContent").html("");
  11487. $("#prescriptionDetail_wpMedicineTitle").removeClass("in").addClass("hide");
  11488. $("#prescriptionDetail_wpMedicineContent").html("");
  11489. }
  11490. $("#printJcReq").removeClass("in").addClass("hide");
  11491. $("#printJcReq").off("click");
  11492. $("#printJyReq").removeClass("in").addClass("hide");
  11493. $("#printJyReq").off("click");
  11494. $("#printJcReqSetup").removeClass("in").addClass("hide");
  11495. $("#printJcReqSetup").off("click");
  11496. $("#printJyReqSetup").removeClass("in").addClass("hide");
  11497. $("#printJyReqSetup").off("click");
  11498. $("#previewYjReq").removeClass("in").addClass("hide");
  11499. $("#previewYjReq").off("click");
  11500. $("#previewYjReqAll").removeClass("in").addClass("hide");
  11501. $("#previewYjReqAll").off("click");
  11502. $("#deletePrescription").removeClass("in").addClass("hide");
  11503. $("#deletePrescription").off("click");
  11504. $("#consultationCliniced").removeClass("in").addClass("hide");
  11505. $("#consultationCliniced").off("click");
  11506. if (jsonData.mzYjReqList != null && jsonData.mzYjReqList.length > 0) {
  11507. $("#previewYjReq").removeClass("hide").addClass("in");
  11508. $("#previewYjReq").off("click").on("click", function (t) {
  11509. previewYjReq(patientId, times);
  11510. });
  11511. }
  11512. if (res.yjReqCount != null && res.yjReqCount > 0) {
  11513. $("#previewYjReqAll").removeClass("hide").addClass("in");
  11514. $("#previewYjReqAll").off("click").on("click", function (t) {
  11515. previewYjReqAll(patientId);
  11516. });
  11517. }
  11518. if (type == 0) {
  11519. $("#callPrescription").removeClass("in").addClass("hide");
  11520. if ((jsonData.mzChargeDetailList == null || jsonData.mzChargeDetailList.length == 0) && (jsonData.mzYjReqList == null || jsonData.mzYjReqList.length == 0) && (jsonData.rxDruginfoList == null || jsonData.rxDruginfoList.length == 0)) {
  11521. $("#printPrescription").removeClass("in").addClass("hide");
  11522. $("#printPrescriptionSetup").removeClass("in").addClass("hide");
  11523. } else {
  11524. $("#printPrescription").removeClass("hide").addClass("in");
  11525. $("#printPrescription").off("click").on("click", function (t) {
  11526. printPrescription(patientId, times, clnicId, payMark, 1);
  11527. });
  11528. $("#printPrescriptionSetup").removeClass("hide").addClass("in");
  11529. $("#printPrescriptionSetup").off("click").on("click", function (t) {
  11530. printPrescription(patientId, times, clnicId, payMark, 2);
  11531. });
  11532. }
  11533. if (jsonData.mzYjReqList != null && jsonData.mzYjReqList.length > 0) {
  11534. var hadJc = false;
  11535. var hadJy = false;
  11536. for (var i = 0; i < jsonData.mzYjReqList.length; i++) {
  11537. var mzYjReq = jsonData.mzYjReqList[i];
  11538. if (mzYjReq.reqType == 2) {
  11539. hadJy = true;
  11540. } else if (mzYjReq.reqType == 3) {
  11541. hadJc = true;
  11542. }
  11543. }
  11544. if (hadJc) {
  11545. $("#printJcReq").removeClass("hide").addClass("in");
  11546. $("#printJcReq").off("click").on("click", function (t) {
  11547. printYjReq(patientId, times, 3, 1);
  11548. });
  11549. $("#printJcReqSetup").removeClass("hide").addClass("in");
  11550. $("#printJcReqSetup").off("click").on("click", function (t) {
  11551. printYjReq(patientId, times, 3, 2);
  11552. });
  11553. }
  11554. if (hadJy) {
  11555. $("#printJyReq").removeClass("hide").addClass("in");
  11556. $("#printJyReq").off("click").on("click", function (t) {
  11557. printYjReq(patientId, times, 2, 1);
  11558. });
  11559. $("#printJyReqSetup").removeClass("hide").addClass("in");
  11560. $("#printJyReqSetup").off("click").on("click", function (t) {
  11561. printYjReq(patientId, times, 2, 2);
  11562. });
  11563. }
  11564. }
  11565. if (jsonData.mzZyReq == null || jsonData.mzZyReq.reqDept == null || jsonData.mzZyReq.reqDept == "") {
  11566. $("#printZyReq").removeClass("in").addClass("hide");
  11567. $("#printZyReq").off("click");
  11568. $("#printZyReqSetup").removeClass("in").addClass("hide");
  11569. $("#printZyReqSetup").off("click");
  11570. } else {
  11571. $("#printZyReq").removeClass("hide").addClass("in");
  11572. $("#printZyReq").off("click").on("click", function (t) {
  11573. printZyReq(patientId, 1);
  11574. });
  11575. $("#printZyReqSetup").removeClass("hide").addClass("in");
  11576. $("#printZyReqSetup").off("click").on("click", function (t) {
  11577. printZyReq(patientId, 2);
  11578. });
  11579. }
  11580. //门诊手术
  11581. if (jsonData.opRecordList != null && jsonData.opRecordList.length > 0) {
  11582. $("#printOpRecord").removeClass("hide").addClass("in");
  11583. $("#printOpRecord").off("click").on("click", function (t) {
  11584. printOpRecord(patientId, times, 1);
  11585. });
  11586. $("#printOpRecordSetup").removeClass("hide").addClass("in");
  11587. $("#printOpRecordSetup").off("click").on("click", function (t) {
  11588. printOpRecord(patientId, times, 2);
  11589. });
  11590. } else {
  11591. $("#printOpRecord").removeClass("in").addClass("hide");
  11592. $("#printOpRecord").off("click");
  11593. $("#printOpRecordSetup").removeClass("in").addClass("hide");
  11594. $("#printOpRecordSetup").off("click");
  11595. }
  11596. //未缴费状态的时候可以删除处方
  11597. if (oriPayMark == 5 || oriPayMark == "5") {
  11598. $("#deletePrescription").removeClass("hide").addClass("in");
  11599. $("#deletePrescription").off("click").on("click", function (t) {
  11600. deletePrescription(clnicId);
  11601. });
  11602. }
  11603. //已诊列表发起会诊
  11604. $("#consultationCliniced").removeClass("hide").addClass("in");
  11605. $("#consultationCliniced").off("click").on("click", function (t) {
  11606. consultationCliniced(patientId);
  11607. });
  11608. //已诊列表发起预约挂号
  11609. $("#registration").off("click").on("click", function (t) {
  11610. registration(patientId);
  11611. });
  11612. } else {
  11613. $("#printPrescription").removeClass("in").addClass("hide");
  11614. $("#printZyReq").removeClass("in").addClass("hide");
  11615. $("#printBlRecord").removeClass("in").addClass("hide");
  11616. $("#printJcReq").removeClass("in").addClass("hide");
  11617. $("#printJyReq").removeClass("in").addClass("hide");
  11618. $("#registration").removeClass("in").addClass("hide");
  11619. $("#callPrescription").removeClass("hide").addClass("in");
  11620. $("#callPrescription").off("click").on("click", function (t) {
  11621. getMzPrescriptionVoPaid(patientId, times, clnicId);
  11622. });
  11623. }
  11624. if (oriPayMark == 1) {
  11625. $("#printPrescription").removeClass("in").addClass("hide");
  11626. $("#printPrescriptionSetup").removeClass("in").addClass("hide");
  11627. } else {
  11628. if ((jsonData.mzChargeDetailList == null || jsonData.mzChargeDetailList.length == 0) && (jsonData.mzYjReqList == null || jsonData.mzYjReqList.length == 0) && (jsonData.rxDruginfoList == null || jsonData.rxDruginfoList.length == 0)) {
  11629. $("#printPrescription").removeClass("in").addClass("hide");
  11630. $("#printPrescriptionSetup").removeClass("in").addClass("hide");
  11631. } else {
  11632. $("#printPrescription").removeClass("hide").addClass("in");
  11633. $("#printPrescription").off("click").on("click", function (t) {
  11634. printPrescription(patientId, times, clnicId, payMark, 1);
  11635. });
  11636. $("#printPrescriptionSetup").removeClass("hide").addClass("in");
  11637. $("#printPrescriptionSetup").off("click").on("click", function (t) {
  11638. printPrescription(patientId, times, clnicId, payMark, 2);
  11639. });
  11640. }
  11641. }
  11642. $("#previewBlbg").off("click").on("click", function (t) {
  11643. window.open("http://172.16.32.192:801/PIMSWebView.asp?mid=" + patientId);
  11644. });
  11645. $("#printBlRecord").removeClass("hide").addClass("in");
  11646. $("#printBlRecord").off("click").on("click", function (t) {
  11647. printBlRecord(patientId, times, 1);
  11648. });
  11649. $("#printBlRecordSetup").removeClass("hide").addClass("in");
  11650. $("#printBlRecordSetup").off("click").on("click", function (t) {
  11651. printBlRecord(patientId, times, 2);
  11652. });
  11653. $("#showMzBlRecordModal").removeClass("hide").addClass("in");
  11654. $("#showMzBlRecordModal").off("click").on("click", function (t) {
  11655. showMzBlRecordModal(patientId, times, 1);
  11656. });
  11657. if ($("#setupId").hasClass("fa-chevron-up")) {
  11658. //默认不展开打印设置
  11659. $("#setupId").parent().click();
  11660. }
  11661. // setTimeout(function () {
  11662. // if ($("#setupId").hasClass("fa-chevron-up")) {
  11663. // //默认不展开打印设置
  11664. // $("#setupId").parent().click();
  11665. // }
  11666. // }, 400);
  11667. //就诊详情的时候,隐藏复选框
  11668. if (type == 0) {
  11669. $("#visitingDetailModal").find("input[type=checkbox]").each(function (index, obj) {
  11670. $(obj).css("display", "none");
  11671. });
  11672. } else {
  11673. //历史处方显示复选框
  11674. $("#visitingDetailModal").find("input[type=checkbox]").each(function (index, obj) {
  11675. $(obj).css("display", "inline-block");
  11676. });
  11677. }
  11678. } else {
  11679. errorMesage(res);
  11680. }
  11681. }
  11682. });
  11683. $("#selfAmountView").html(0.00);
  11684. $("#fundPayView").html(0.00);
  11685. $("#acctPayView").html(0.00);
  11686. $("#totalAmountView").html(0.00);
  11687. $.ajax({
  11688. type: "GET",
  11689. url: '/thmz/getChargeDetailFee?patientId=&times=&receiptNo=&clnicId=' + clnicId,
  11690. contentType: "application/json;charset=UTF-8",
  11691. dataType: "json",
  11692. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11693. async: true,
  11694. success: function (res) {
  11695. if (res == '401' || res == 401) {
  11696. window.location.href = '/thmz/login/view'
  11697. return;
  11698. }
  11699. if (res.code == 0) {
  11700. if (res.fundPay != undefined && res.fundPay != null) {
  11701. $("#fundPayView").text("¥" + res.fundPay);
  11702. }
  11703. if (res.acctPay != undefined && res.acctPay != null) {
  11704. $("#acctPayView").text("¥" + res.acctPay);
  11705. }
  11706. $("#selfAmountView").text("¥" + res.selfAmount);
  11707. $("#totalAmountView").text("¥" + res.totalAmount);
  11708. } else {
  11709. printIndex = -1;
  11710. }
  11711. }
  11712. });
  11713. }
  11714. /**
  11715. * 查询默认打印机
  11716. */
  11717. function setPrint() {
  11718. if (printIndex >= 0) {
  11719. return;
  11720. }
  11721. $.ajax({
  11722. type: "GET",
  11723. url: '/thmz/getLastWindowsByCurrentUser',
  11724. contentType: "application/json;charset=UTF-8",
  11725. dataType: "json",
  11726. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11727. async: false,
  11728. success: function (res) {
  11729. if (res == '401' || res == 401) {
  11730. window.location.href = '/thmz/login/view'
  11731. return;
  11732. }
  11733. if (res.code == 0) {
  11734. printIndex = res.data.cgPrintIndex;
  11735. } else {
  11736. printIndex = -1;
  11737. }
  11738. }
  11739. });
  11740. }
  11741. //获取处方编码
  11742. function getOrderNum(patientId,times,prescriptionDetail) {
  11743. let num = '1'
  11744. if(prescriptionDetail.length > 0){
  11745. if(!stringIsBlank(prescriptionDetail[0].orderCode)){
  11746. num = prescriptionDetail[0].orderCode.split("_")[3]
  11747. }
  11748. }
  11749. return patientId + times + num;
  11750. }
  11751. //设置外配药打印页面
  11752. function setWpMedicineTableHtml(wpMedicinePrescription) {
  11753. let html = "";
  11754. for (let i = 0; i <wpMedicinePrescription.length ; i++) {
  11755. let detail = wpMedicinePrescription[i];
  11756. html += "<tr><td>" + (i+1) + "</td>";
  11757. html += "<td colspan='2'>";
  11758. html += detail.name + "(" + detail.drugSpec + ")";
  11759. html += "</td>";
  11760. html += "<td colspan='2'></td>";
  11761. html += "<td>X</td>";
  11762. html += "<td rowspan='2' style='height: 100%;line-height: 100%;font-size: 40px;'>";
  11763. html += "</td><td>" + detail.drugCnt + detail.drugDosunt + "</td>";
  11764. html += "</tr>";
  11765. html += "<tr><td></td>";
  11766. html += "<td></td>";
  11767. html += "<td style='font-weight: bold;text-align: right;'>用法:</td>";
  11768. html += "<td>" + detail.sinDoscnt + detail.sinDosunt + "/次</td>";
  11769. html += "<td>" + detail.usedFrquName + "</td>";
  11770. html += "<td>" + detail.medcDays + "天</td>";
  11771. html += "<td>" + detail.medcWayDscr + "</td>";
  11772. html += "</tr>";
  11773. }
  11774. return html;
  11775. }
  11776. function setTableHtml(prescriptionDetail) {
  11777. //设置成组处方符号
  11778. if (prescriptionDetail.length > 1) {
  11779. var map = new MyMap();
  11780. var groupOrderlist = [];
  11781. for (var j = 0; j < prescriptionDetail.length; j++) {
  11782. var detail = prescriptionDetail[j];
  11783. var list = map.get(detail.groupOrder);
  11784. if (list == null) {
  11785. list = [];
  11786. map.put(detail.groupOrder, list);
  11787. groupOrderlist[groupOrderlist.length] = detail.groupOrder;
  11788. }
  11789. list[list.length] = detail;
  11790. }
  11791. for (var j = 0; j < groupOrderlist.length; j++) {
  11792. var list = map.get(groupOrderlist[j]);
  11793. if (list.length == 1) {
  11794. continue;
  11795. }
  11796. list[0].groupFlag = "┒";
  11797. list[list.length - 1].groupFlag = "┛";
  11798. if (list.length > 2) {
  11799. for (var t = 1; t < list.length - 1; t++) {
  11800. list[t].groupFlag = "┃";
  11801. }
  11802. }
  11803. }
  11804. }
  11805. var html = "";
  11806. for (var j = 0; j < prescriptionDetail.length; j++) {
  11807. var detail = prescriptionDetail[j];
  11808. html += "<tr><td>" + (j+1) + "</td>";
  11809. html += "<td colspan='2'>";
  11810. html += detail.name + "(" + detail.specification + ")";
  11811. html += "</td>";
  11812. html += "<td colspan='2'></td>";
  11813. html += "<td>X</td>";
  11814. html += "<td rowspan='2' style='height: 100%;line-height: 100%;font-size: 40px;'>";
  11815. if (detail.groupFlag != undefined && detail.groupFlag != null) {
  11816. html += detail.groupFlag;
  11817. }
  11818. html += "</td><td>" + detail.quantity + detail.packUnit + "</td>";
  11819. html += "</tr>";
  11820. html += "<tr><td></td>";
  11821. if (detail.tryResult != undefined && detail.tryResult != null && detail.tryResult != "null" && detail.tryResult != "") {
  11822. html += "<td>" + detail.tryResult + "</td>";
  11823. } else if (detail.tryFlag != undefined && detail.tryFlag != null && detail.tryFlag != "null" && detail.tryFlag != "") {
  11824. html += "<td>" + detail.tryFlag + "</td>";
  11825. } else {
  11826. html += "<td></td>";
  11827. }
  11828. html += "<td style='font-weight: bold;text-align: right;'>用法:</td>";
  11829. html += "<td>" + detail.drugQuan + detail.unitDesc + "/次</td>";
  11830. html += "<td>" + detail.frequency + "</td>";
  11831. html += "<td>" + detail.orderDays + "天</td>";
  11832. html += "<td>" + detail.supplyName + "</td>";
  11833. html += "</tr>";
  11834. }
  11835. html += "<tr><td colspan='7'>&nbsp;&nbsp;&nbsp;&nbsp;------(以下空白)------</td></tr>";
  11836. return {html: html, j: j};
  11837. }
  11838. // /**
  11839. // * 打印门诊指引单
  11840. // * @param patientId
  11841. // * @param times
  11842. // */
  11843. // function printGuideCard(patientId, times) {
  11844. //
  11845. // }
  11846. /**
  11847. * 保存门诊处方打印记录
  11848. * @param patientId
  11849. * @param times
  11850. */
  11851. function saveMzPrescriptionPrint(patientId, times) {
  11852. postAjaxJsonHttpRequst("/thmz/mzPrescriptionPrint/saveData",{patientId:patientId,times:times},true,function (res) {
  11853. })
  11854. }
  11855. /**
  11856. * 打印门诊处方
  11857. * @param patientId
  11858. * @param times
  11859. * @param clnicId
  11860. * @param payMark
  11861. * @param printType 打印模式 1 预览打印 2 打印设置
  11862. */
  11863. function printPrescription(patientId, times, clnicId, payMark, printType) {
  11864. if(printType == 1){
  11865. saveMzPrescriptionPrint(patientId,times)
  11866. }
  11867. $.ajax({
  11868. type: "GET",
  11869. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + '&times=' + times + '&MzBlRecordFlag=false&payMark=' + payMark + '&clnicId=' + clnicId,
  11870. contentType: "application/json;charset=UTF-8",
  11871. dataType: "json",
  11872. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  11873. success: function (res) {
  11874. if (res == '401' || res == 401) {
  11875. window.location.href = '/thmz/login/view'
  11876. return;
  11877. }
  11878. if (res.code == 0) {
  11879. var prescriptionDetail = res.data.mzBlRecord.prescriptionDetail;
  11880. if (prescriptionDetail != null && prescriptionDetail != "") {
  11881. var prescriptionDetailJson = JSON.parse(prescriptionDetail);
  11882. //当前处方只开了住院证则只打印住院证
  11883. 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) {
  11884. printZyReq(patientId, 1);
  11885. return;
  11886. }
  11887. var index = 0;
  11888. setPrint();
  11889. LODOP = getLodop();
  11890. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", hospitalName+"处方笺");
  11891. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  11892. //设置默认打印机
  11893. LODOP.SET_PRINTER_INDEX(printIndex);
  11894. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  11895. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  11896. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  11897. //LODOP.SET_SHOW_MODE("SETUP_ENABLESS",getCheckSS());
  11898. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊处方笺");//对新建的纸张重命名
  11899. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  11900. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  11901. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  11902. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  11903. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  11904. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  11905. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  11906. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  11907. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  11908. var mzPatientMi = res.mzPatientMi;
  11909. var deptName = res.deptName;
  11910. $("#patientNamePrescription").text(mzPatientMi.name);
  11911. $("#patientGenderPrescription").text(mzPatientMi.gender);
  11912. $("#patientAgePrescription").text(mzPatientMi.ageString);
  11913. $("#patientIdPrescription").text(mzPatientMi.patientId);
  11914. $("#deptPrescription").text(deptName);
  11915. // $("#doctorPrescription").text(res.doctorName);
  11916. getAjaxRequst("/thmz/getDoctorSignatureImage",{doctorCode:res.doctorCode},false,function (postRes) {
  11917. if(postRes.code ==0){
  11918. $("#doctorPrescription").html("<img src='" + postRes.data + "' style='width:100px;height:23px;'/>")
  11919. }else {
  11920. $("#doctorPrescription").text(res.doctorName);
  11921. }
  11922. })
  11923. $("#cfTime").text(res.opDate);
  11924. $("#socialNo").text(mzPatientMi.socialNo);
  11925. $("#sfTypeId").text(mzPatientMi.responseTypeName);
  11926. $("#zdPrescription").text(res.data.icdText);
  11927. $("#patientIdGuideCard").text(mzPatientMi.patientId);
  11928. $("#doctorGuideCard").text(res.data.mzBlRecord.doctorName);
  11929. $("#patientNameGuideCard").text(mzPatientMi.name);
  11930. $("#patientDateGuideCard").text(format(new Date(), "yyyy/MM/dd/HH:mm"));
  11931. JsBarcode("#cfBarcode", patientId, {
  11932. lineColor: '#333', //线条颜色
  11933. width: 1, //线宽
  11934. height: 26, //条码高度
  11935. displayValue: false, //是否显示文字信息
  11936. });
  11937. //普药处方
  11938. var pyPrescription = prescriptionDetailJson.xyPrescription.pyPrescription;
  11939. if (pyPrescription != null && pyPrescription.length > 0 && res.ypCfPrint != null && res.ypCfPrint.py_print =="1") {
  11940. for (var i = 0; i < pyPrescription.length; i++) {
  11941. if (index > 0) {
  11942. LODOP.NewPageA();
  11943. }
  11944. var prescriptionDetail = pyPrescription[i].detail;
  11945. var __ret = setTableHtml(prescriptionDetail);
  11946. var html = __ret.html;
  11947. var j = __ret.j;
  11948. if (res.deptName != undefined && res.deptName != null) {
  11949. if (res.deptName.indexOf("儿") > 0) {
  11950. $("#typePrescription").text("儿科");
  11951. $("#cfTitle").text("儿科");
  11952. } else if (res.deptName.indexOf("急诊科") > 0) {
  11953. $("#typePrescription").text("急诊");
  11954. $("#cfTitle").text("急诊");
  11955. } else {
  11956. $("#typePrescription").text("普通处方");
  11957. $("#cfTitle").text("普通");
  11958. }
  11959. }
  11960. $("#prescriptionDetail").html(html);
  11961. $("#cfAmountPrint").text(pyPrescription[i].amount + "元 (不含注射费)");
  11962. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  11963. index++;
  11964. }
  11965. }
  11966. let wpMedicinePrescription = prescriptionDetailJson.wpMedicinePrescription;
  11967. if(wpMedicinePrescription !=null && wpMedicinePrescription.length > 0){
  11968. if (index > 0) {
  11969. LODOP.NewPageA();
  11970. }
  11971. let _html = setWpMedicineTableHtml(wpMedicinePrescription);
  11972. $("#typePrescription").text("院外调配处方");
  11973. $("#cfTitle").text("院外调配");
  11974. $("#prescriptionDetail").html(_html);
  11975. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  11976. }
  11977. //医材处方
  11978. var ycPrescription = prescriptionDetailJson.xyPrescription.ycPrescription;
  11979. if (ycPrescription != null && ycPrescription.length > 0 && res.ypCfPrint != null && res.ypCfPrint.yc_print =="1") {
  11980. for (var i = 0; i < ycPrescription.length; i++) {
  11981. if (index > 0) {
  11982. LODOP.NewPageA();
  11983. }
  11984. var prescriptionDetail = ycPrescription[i].detail;
  11985. var __ret = setTableHtml(prescriptionDetail);
  11986. var html = __ret.html;
  11987. var j = __ret.j;
  11988. if (res.deptName != undefined && res.deptName != null) {
  11989. if (res.deptName.indexOf("儿") > 0) {
  11990. $("#typePrescription").text("儿科");
  11991. $("#cfTitle").text("儿科");
  11992. } else if (res.deptName.indexOf("急诊科") > 0) {
  11993. $("#typePrescription").text("急诊");
  11994. $("#cfTitle").text("急诊");
  11995. } else {
  11996. $("#typePrescription").text("医材处方");
  11997. $("#cfTitle").text("普通");
  11998. }
  11999. }
  12000. $("#prescriptionDetail").html(html);
  12001. $("#cfAmountPrint").text(ycPrescription[i].amount + "元 ");
  12002. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  12003. index++;
  12004. }
  12005. }
  12006. //麻精处方
  12007. var mjPrescription = prescriptionDetailJson.xyPrescription.mjPrescription;
  12008. if (mjPrescription != null && mjPrescription.length > 0 && res.ypCfPrint != null && res.ypCfPrint.mj_print =="1") {
  12009. for (var i = 0; i < mjPrescription.length; i++) {
  12010. if (index > 0) {
  12011. LODOP.NewPageA();
  12012. }
  12013. var prescriptionDetail = mjPrescription[i].detail;
  12014. var __ret = setTableHtml(prescriptionDetail);
  12015. var html = __ret.html;
  12016. var j = __ret.j;
  12017. $("#typePrescription").text("麻、精一处方");
  12018. $("#cfTitle").text("麻、精一");
  12019. $("#cfOrderNumTitle").text(getOrderNum(patientId,times,prescriptionDetail));
  12020. $("#prescriptionDetail").html(html);
  12021. $("#cfAmountPrint").text(mjPrescription[i].amount + "元 (不含注射费)");
  12022. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  12023. index++;
  12024. }
  12025. }
  12026. //精二处方
  12027. var jePrescription = prescriptionDetailJson.xyPrescription.jePrescription;
  12028. if (jePrescription != null && jePrescription.length > 0 && res.ypCfPrint != null && res.ypCfPrint.mj_print =="1") {
  12029. for (var i = 0; i < jePrescription.length; i++) {
  12030. if (index > 0) {
  12031. LODOP.NewPageA();
  12032. }
  12033. var prescriptionDetail = jePrescription[i].detail;
  12034. var __ret = setTableHtml(prescriptionDetail);
  12035. var html = __ret.html;
  12036. var j = __ret.j;
  12037. $("#typePrescription").text("精二处方");
  12038. $("#cfTitle").text("精二");
  12039. $("#cfOrderNumTitle").text(getOrderNum(patientId,times,prescriptionDetail));
  12040. $("#prescriptionDetail").html(html);
  12041. $("#cfAmountPrint").text(jePrescription[i].amount + "元 (不含注射费)");
  12042. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  12043. index++;
  12044. }
  12045. }
  12046. $("#cfOrderNumTitle").text(null)
  12047. //中药处方
  12048. if (prescriptionDetailJson.zyPrescription != null && prescriptionDetailJson.zyPrescription.length > 0 && res.ypCfPrint != null && res.ypCfPrint.zy_print =="1") {
  12049. var zyPrescription = prescriptionDetailJson.zyPrescription[0].detail;zyPrescription
  12050. var zyGroupNo = prescriptionDetailJson.zyPrescription[0].groupNo;
  12051. if (zyPrescription != null && zyPrescription.length > 0) {
  12052. var html = "";
  12053. for (var i = 0; i < zyPrescription.length; i++) {
  12054. if (i % 2 == 0) {
  12055. html += "<tr><td></td><td></td></tr><tr>";
  12056. }
  12057. html += "<td>";
  12058. html += zyPrescription[i].name;
  12059. if(zyPrescription[i].spec){
  12060. html += "("+zyPrescription[i].spec+")";
  12061. }
  12062. if(zyGroupNo=='83'){
  12063. html += zyPrescription[i].quantity + "袋";
  12064. }else {
  12065. html += zyPrescription[i].quantity + "g";
  12066. }
  12067. if (zyPrescription[i].instructionText != null) {
  12068. html += "[" + zyPrescription[i].instructionText + "]";
  12069. }
  12070. if (i % 2 == 1) {
  12071. html += "</td></tr>";
  12072. } else {
  12073. html += "</td>";
  12074. }
  12075. }
  12076. if (zyPrescription.length % 2 != 0) {
  12077. html += "</tr>";
  12078. }
  12079. html += "<tr><td></td><td>X " + prescriptionDetailJson.zyPrescription[0].zyfs + "付</td></tr>";
  12080. var cyMtjs = prescriptionDetailJson.zyPrescription[0].cyMtjs;
  12081. if (cyMtjs == null || cyMtjs == "null") {
  12082. cyMtjs = "";
  12083. }
  12084. var cyJssm = prescriptionDetailJson.zyPrescription[0].cyJssm;
  12085. if (cyJssm == null || cyJssm == "null") {
  12086. cyJssm = "";
  12087. }
  12088. var cyJsl = prescriptionDetailJson.zyPrescription[0].cyJsl;
  12089. if (cyJsl == null || cyJsl == "null") {
  12090. cyJsl = "";
  12091. }
  12092. var cyZql = prescriptionDetailJson.zyPrescription[0].cyZql;
  12093. if (cyZql == null || cyZql == "null") {
  12094. cyZql = "";
  12095. }
  12096. var cyFj = prescriptionDetailJson.zyPrescription[0].cyFj;
  12097. if (cyFj == null || cyFj == "null") {
  12098. cyFj = "";
  12099. }
  12100. var cyFfcs = prescriptionDetailJson.zyPrescription[0].cyFfcs;
  12101. if (cyFfcs == null || cyFfcs == "null") {
  12102. cyFfcs = "";
  12103. }
  12104. var cyFysm = prescriptionDetailJson.zyPrescription[0].cyFysm;
  12105. if (cyFysm == null || cyFysm == "null") {
  12106. cyFysm = "";
  12107. }
  12108. var cyDj = prescriptionDetailJson.zyPrescription[0].cyDj;
  12109. if (cyDj == null || cyDj == "null") {
  12110. cyDj = "";
  12111. } else {
  12112. cyDj = "(" + cyDj + ")";
  12113. }
  12114. if(zyGroupNo =='83'){
  12115. html += "<tr><td colspan='2'>每天" + cyMtjs + "剂," + cyJssm + cyJsl + "ml。分" + cyFfcs + "次" + cyFysm + "。</td></tr>";
  12116. }else {
  12117. html += "<tr><td colspan='2'>每天" + cyMtjs + "剂," + cyJssm + cyJsl + "ml,煮取量" + cyZql + "ml,复煎" + cyFj + "次。分" + cyFfcs + "次" + cyFysm + " " + cyDj + "。</td></tr>";
  12118. }
  12119. html += "<tr><td colspan='2'>&nbsp;&nbsp;&nbsp;&nbsp;------(以下空白)------</td></tr>";
  12120. if (index > 0) {
  12121. LODOP.NewPageA();
  12122. }
  12123. if (res.deptName != undefined && res.deptName != null) {
  12124. if (res.deptName.indexOf("儿") > 0) {
  12125. $("#typePrescription").text("儿科");
  12126. $("#cfTitle").text("儿科");
  12127. } else if (res.deptName.indexOf("急诊科") > 0) {
  12128. $("#typePrescription").text("急诊");
  12129. $("#cfTitle").text("急诊");
  12130. } else {
  12131. $("#typePrescription").text("中药处方");
  12132. $("#cfTitle").text("普通");
  12133. }
  12134. }
  12135. $("#prescriptionDetail").html(html);
  12136. $("#cfAmountPrint").text(prescriptionDetailJson.zyPrescription[0].amount + "元 (不含代煎费)");
  12137. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  12138. index++;
  12139. }
  12140. }
  12141. var printZlPrescription = $("#zlPrintFlagCheck").parent().hasClass("checked") == true ? true : false;
  12142. if (printZlPrescription) {
  12143. if (prescriptionDetailJson.zlPrescription != null && prescriptionDetailJson.zlPrescription.length > 0) {
  12144. //诊疗处方
  12145. var zlPrescription = prescriptionDetailJson.zlPrescription[0].detail;
  12146. if (zlPrescription != null && zlPrescription.length > 0) {
  12147. var html = "";
  12148. for (var i = 0; i < zlPrescription.length; i++) {
  12149. var zlPrescriptionTemp = zlPrescription[i];
  12150. html += "<tr>";
  12151. html += "<td colspan='2'>" + zlPrescriptionTemp.index + "." + zlPrescriptionTemp.name + "</td>";
  12152. html += "<td style='text-align: right;padding-right: 15px;'>X</td>";
  12153. html += "<td>总量:" + zlPrescriptionTemp.quantity + "</td>";
  12154. html += "</tr>";
  12155. html += "<tr>";
  12156. html += "<td width='40%'></td>";
  12157. html += "<td width='20%'>单量:" + zlPrescriptionTemp.drugQuan + "</td>";
  12158. html += "<td width='20%'>频率:" + zlPrescriptionTemp.frequency + "</td>";
  12159. html += "<td width='20%'>天数:" + zlPrescriptionTemp.orderDays + "天</td>";
  12160. html += "</tr>";
  12161. }
  12162. if (index > 0) {
  12163. LODOP.NewPageA();
  12164. }
  12165. if (res.deptName != undefined && res.deptName != null) {
  12166. if (res.deptName.indexOf("儿") > 0) {
  12167. $("#typePrescription").text("儿科");
  12168. $("#cfTitle").text("儿科");
  12169. } else if (res.deptName.indexOf("急诊科") > 0) {
  12170. $("#typePrescription").text("急诊");
  12171. $("#cfTitle").text("急诊");
  12172. } else {
  12173. $("#typePrescription").text("诊疗处方");
  12174. $("#cfTitle").text("普通");
  12175. }
  12176. }
  12177. $("#prescriptionDetail").html(html);
  12178. $("#cfAmountPrint").text(prescriptionDetailJson.zlPrescription[0].amount + "元 ");
  12179. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("prescription_table").innerHTML);
  12180. index++;
  12181. }
  12182. }
  12183. }
  12184. //检查申请单打印
  12185. var mzYjReqList = res.data.mzYjReqList;
  12186. if (mzYjReqList != null && mzYjReqList.length > 0) {
  12187. $("#patientIdJcReq").text(mzPatientMi.patientId);
  12188. $("#patientNameJcReq").text(mzPatientMi.name);
  12189. $("#patientGenderJcReq").text(mzPatientMi.gender);
  12190. $("#patientAgeJcReq").text(mzPatientMi.ageString);
  12191. $("#responseTypeJcReq").text(mzPatientMi.responseTypeName);
  12192. $("#patientCardNoJcReq").text(mzPatientMi.icCardNo);
  12193. $("#icdTextJcReq").text(res.data.icdText);
  12194. var mzBlRecord = res.data.mzBlRecord;
  12195. $("#jcReqEmrChiefComplaint").text(mzBlRecord.emrChiefComplaint);
  12196. $("#jcReqHis").text(mzBlRecord.emrHpi);
  12197. var tz = getTz(mzBlRecord);
  12198. $("#jcReqTz").text(tz);
  12199. $("#jcReqReqDept").text(res.deptName);
  12200. $("#jcReqReqDoctor").text(res.doctorName);
  12201. // $("#patientIdJyReq").text(mzPatientMi.patientId);
  12202. // $("#patientNameJyReq").text(mzPatientMi.name);
  12203. // $("#patientGenderJyReq").text(mzPatientMi.gender);
  12204. // $("#patientAgeJyReq").text(mzPatientMi.ageString);
  12205. // $("#patientCardNoJyReq").text(mzPatientMi.icCardNo);
  12206. // $("#responseTypeJyReq").text(mzPatientMi.responseTypeName);
  12207. // $("#icdTextJyReq").text(res.data.icdText);
  12208. // $("#jyReqEmrChiefComplaint").text(mzBlRecord.emrChiefComplaint);
  12209. // $("#jyReqHis").text(mzBlRecord.emrHpi);
  12210. // $("#jyReqTz").text(tz);
  12211. // $("#jyReqReqDept").text(res.deptName);
  12212. // $("#jyReqReqDoctor").text(res.doctorName);
  12213. for (var i = 0; i < mzYjReqList.length; i++) {
  12214. var mzYjReq = mzYjReqList[i];
  12215. if (mzYjReq == null) {
  12216. continue;
  12217. }
  12218. if (i == 0) {
  12219. var dateStr = format(mzYjReq.reqDate, "yyyy-MM-dd");
  12220. $("#jcReqReqDate").text(dateStr);
  12221. // $("#jyReqReqDoctor").text(dateStr);
  12222. }
  12223. if (mzYjReq.reqType == 2) {
  12224. continue;
  12225. }
  12226. if ((i == 0 && index > 0) || i > 0) {
  12227. LODOP.NewPageA();
  12228. }
  12229. JsBarcode("#JcBarcode", mzYjReq.reqNo, {
  12230. lineColor: '#333', //线条颜色
  12231. width: 1, //线宽
  12232. height: 26, //条码高度
  12233. displayValue: false, //是否显示文字信息
  12234. });
  12235. $("#reqNoJcReq").text(mzYjReq.reqNo);
  12236. $("#jcReqItem").text(mzYjReq.groupName);
  12237. $("#jcReqRemark").text(mzYjReq.jyRemark);
  12238. $("#jcComment8").text(mzYjReq.comment8);
  12239. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("jc_card_table").innerHTML);
  12240. index++;
  12241. }
  12242. }
  12243. //住院证打印
  12244. var mzZyReq = res.data.mzZyReq;
  12245. if (mzZyReq != null) {
  12246. $("#patientIdZyReq").text(mzPatientMi.patientId);
  12247. $("#patientNameZyReq").text(mzPatientMi.name);
  12248. $("#patientGenderZyReq").text(mzPatientMi.gender);
  12249. $("#patientAgeZyReq").text(mzPatientMi.ageString);
  12250. $("#sfzZyReq").text(mzPatientMi.socialNo);
  12251. $("#birthDateZyReq").text(format(mzPatientMi.birthDay, "yyyy-MM-dd"));
  12252. $("#phoneZyReq").text(mzPatientMi.phoneNo);
  12253. $("#responseTypeZyReq").text(mzPatientMi.responseTypeName);
  12254. $("#addressZyReq").text(mzPatientMi.address);
  12255. if (mzZyReq.icdCode == null || mzZyReq.icdCode == "" || mzZyReq.icdCode.length == 0) {
  12256. $("#icsCodeZyReq").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
  12257. $("#icsTextZyReq").text(mzZyReq.icdText);
  12258. } else {
  12259. $("#icsCodeZyReq").text(mzZyReq.icdCode);
  12260. $("#icsTextZyReq").text(mzZyReq.icdText);
  12261. }
  12262. $("#reqDeptZyReq").text(mzZyReq.reqWardName);
  12263. $("#smallDeptZyReq").text(mzZyReq.smallDeptName);
  12264. $("#routeOfAdmissionName").text(mzZyReq.routeOfAdmissionName);
  12265. $("#depositZyReq").text(mzZyReq.deposit);
  12266. //$("#admissStatusZyReq").text(mzZyReq.admissStatus);
  12267. // $("input:checkbox[value='" + mzZyReq.admissStatus + "']").attr('checked', 'true');
  12268. $("input:checkbox[name='admissStatusZyReq']").each(function (i, e) {
  12269. $(this).removeAttr("checked");
  12270. if ($(this).val() == Number(mzZyReq.admissStatus) || $(this).val() == mzZyReq.admissStatus) {
  12271. $(this).attr("checked", true)
  12272. }
  12273. });
  12274. $("#visitDateZyReq").text(format(mzZyReq.visitDate, "yyyy-MM-dd HH:mm:ss"));
  12275. $("#deptCodeZyReq").text(mzZyReq.deptName);
  12276. getAjaxRequst("/thmz/getDoctorSignatureImage",{doctorCode:mzZyReq.doctorCode},false,function (signRes) {
  12277. if(signRes.code == 0){
  12278. $("#doctorCodeZyReq").html("<img src='" + signRes.data + "' style='width:100px;height:23px;'/>")
  12279. }else {
  12280. $("#doctorCodeZyReq").text(mzZyReq.doctorName);
  12281. }
  12282. })
  12283. if (index > 0) {
  12284. LODOP.NewPageA();
  12285. }
  12286. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("mz_zy_req_table").innerHTML);
  12287. index++;
  12288. }
  12289. //手术申请单打印
  12290. var opRecordList = res.data.opRecordList;
  12291. if (opRecordList != null && opRecordList.length > 0) {
  12292. $("#patientIdOpRecord").text(mzPatientMi.patientId);
  12293. $("#patientNameOpRecord").text(mzPatientMi.name);
  12294. $("#patientGenderOpRecord").text(mzPatientMi.gender);
  12295. $("#patientAgeOpRecord").text(mzPatientMi.ageString);
  12296. $("#responseTypeOpRecord").text(mzPatientMi.responseTypeName);
  12297. $("#patientCardNoOpRecord").text(mzPatientMi.icCardNo);
  12298. for (var i = 0; i < opRecordList.length; i++) {
  12299. var obj = opRecordList[i];
  12300. //$("#reqNoOpRecord").text(obj.recordId);
  12301. $("#icdTextOpRecord").text(obj.diagBeforeOp);
  12302. $("#opNameOpRecord").text(obj.opName);
  12303. $("#hocusCodeOpRecord").text(obj.hocusCodeName);
  12304. $("#opScaleOpRecord").text(obj.opScaleName);
  12305. var dateStr = format(obj.applyDate, "yyyy-MM-dd HH:mm:ss");
  12306. $("#applyDateOpRecord").text(dateStr);
  12307. $("#opDatetimeOpRecord").text(obj.opDatetimeStr);
  12308. $("#doctorZdOpRecord").text(obj.doctorZdName);
  12309. $("#remarkOpRecord").text(obj.remark);
  12310. if (index > 0) {
  12311. LODOP.NewPageA();
  12312. }
  12313. JsBarcode("#JcBarcode", obj.recordId, {
  12314. lineColor: '#333', //线条颜色
  12315. width: 1, //线宽
  12316. height: 26, //条码高度
  12317. displayValue: false, //是否显示文字信息
  12318. });
  12319. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("op_record_card_table").innerHTML);
  12320. index++;
  12321. }
  12322. }
  12323. // $("#selfAmountGuideCard").html(0.00);
  12324. // $("#fundPayGuideCard").html(0.00);
  12325. // $("#acctPayGuideCard").html(0.00);
  12326. $("#payQrcodeGuideCard").empty();
  12327. $("#selfPayDetail").empty();
  12328. $.ajax({
  12329. type: "GET",
  12330. url: '/thmz/getChargeDetailForGuideCard?patientId=' + patientId + '&times=' + times,
  12331. contentType: "application/json;charset=UTF-8",
  12332. dataType: "json",
  12333. headers: {
  12334. 'Accept': 'application/json',
  12335. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  12336. },
  12337. success: function (res) {
  12338. if (res == '401' || res == 401) {
  12339. window.location.href = '/thmz/login/view'
  12340. return;
  12341. }
  12342. if (res.code == 0) {
  12343. var selfPayList = res.selfPayList;
  12344. $("#zfcns_time").text("时间:" + res.zfcns_time);
  12345. if (selfPayList != null && selfPayList.length > 0) {
  12346. $("#patientNameSelfPay").text(mzPatientMi.name);
  12347. $("#patientGenderSelfPay").text(mzPatientMi.gender);
  12348. $("#patientAgeSelfPay").text(mzPatientMi.ageString);
  12349. $("#patientIdSelfPay").text(mzPatientMi.patientId);
  12350. $("#deptSelfPay").text(deptName);
  12351. $("#zdSelfPay").text(res.icdText);
  12352. var selfPayListHtml = "";
  12353. for (var i = 1; i <= selfPayList.length; i++) {
  12354. selfPayListHtml += "<tr><td>";
  12355. selfPayListHtml += i + "." + selfPayList[i - 1];
  12356. selfPayListHtml += "</td></tr>";
  12357. }
  12358. $("#selfPayDetail").html(selfPayListHtml);
  12359. if (index > 0) {
  12360. LODOP.NewPageA();
  12361. }
  12362. //view-source:http://www.c-lodop.com/demolist/PrintSample43.html 分页看这里
  12363. LODOP.ADD_PRINT_TABLE(158, "5%", "90%", 400, strStyle + document.getElementById("self_pay_table_body").innerHTML);
  12364. LODOP.SET_PRINT_STYLEA(0, "Vorient", 3);
  12365. LODOP.ADD_PRINT_HTM(26, "5%", "90%", 119, document.getElementById("self_pay_table_header").innerHTML);
  12366. LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
  12367. LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1);
  12368. LODOP.ADD_PRINT_HTM(560, "5%", "90%", 200, document.getElementById("self_pay_table_foot").innerHTML);
  12369. LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
  12370. LODOP.SET_PRINT_STYLEA(0, "LinkedItem", -1);
  12371. // LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("self_pay_table").innerHTML);
  12372. index++;
  12373. }
  12374. if (res.guideCardData != null && res.guideCardData.length > 0) {
  12375. let html = `<tr style="font-weight: 700"><td>类别</td> <td>名称/科室</td><td>地址</td></tr>`;
  12376. for (var i = 0; i < res.guideCardData.length; i++) {
  12377. html += "<tr><td>" + res.guideCardData[i].type + "</td><td>" + res.guideCardData[i].name + "</td><td>" + res.guideCardData[i].address + "</td></tr>"
  12378. }
  12379. $("#guideCardDetail").html(html);
  12380. }
  12381. if (res.payQrcode != null && res.payQrcode != "") {
  12382. new QRCode(document.getElementById("payQrcodeGuideCard"), res.payQrcode); // 设置要生成二维码的链接
  12383. $("canvas").attr("id", "erw");
  12384. let canvas = document.getElementById('erw');
  12385. let src = canvas.toDataURL("image/png");
  12386. let payQrcodeGuideCardHtml = `<img src="${src}" style="width: 100px;height: 100px"/><div style="width: 140px;margin-top: 2px;">微信支付(自费)</div>`;
  12387. $("#payQrcodeGuideCard").html(payQrcodeGuideCardHtml)
  12388. }
  12389. if(!stringIsBlank(res.healthEducationUrl)){
  12390. new QRCode(document.getElementById("healthEducationCard"), res.healthEducationUrl); // 设置要生成二维码的链接
  12391. $("canvas").attr("id", "erw");
  12392. let canvas = document.getElementById('erw');
  12393. let src = canvas.toDataURL("image/png");
  12394. let wxPayQrCardHtml =`<img src="${src}" style="width: 100px;height: 100px"/><div style="width: 120px;margin-top: 2px;">健康宣教</div>`;
  12395. $("#healthEducationCard").html(wxPayQrCardHtml);
  12396. }
  12397. if(!stringIsBlank(res.wxPayQrUrl)){
  12398. new QRCode(document.getElementById("wxPayQrCard"), res.wxPayQrUrl); // 设置要生成二维码的链接
  12399. $("canvas").attr("id", "erw");
  12400. let canvas = document.getElementById('erw');
  12401. let src = canvas.toDataURL("image/png");
  12402. let wxPayQrCardHtml =`<img src="${src}" style="width: 100px;height: 100px"/><div style="width: 140px;margin-top: 2px;">微信支付(医保统筹)</div>`;
  12403. $("#wxPayQrCard").html(wxPayQrCardHtml);
  12404. }
  12405. $("#totalAmountGuideCard").text("¥" + res.totalAmount+"元");
  12406. JsBarcode('#imgcode', patientId, {
  12407. lineColor: '#333', //线条颜色
  12408. width: 2, //线宽
  12409. height: 60, //条码高度
  12410. displayValue: false, //是否显示文字信息
  12411. });
  12412. if (index > 0) {
  12413. LODOP.NewPageA();
  12414. }
  12415. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("guide_card_table").innerHTML);
  12416. //LODOP.PRINT();
  12417. if (printType == 1) {
  12418. LODOP.PREVIEW();
  12419. } else if (printType == 2) {
  12420. LODOP.PRINT_SETUP();
  12421. }
  12422. } else if (res.code == -2) {
  12423. if (printType == 1) {
  12424. LODOP.PREVIEW();
  12425. } else if (printType == 2) {
  12426. LODOP.PRINT_SETUP();
  12427. }
  12428. } else {
  12429. errorMesage(res);
  12430. }
  12431. }
  12432. });
  12433. // printGuideCard(patientId, times);
  12434. }
  12435. } else {
  12436. errorMesage(res);
  12437. }
  12438. }
  12439. });
  12440. }
  12441. /**
  12442. * 构建体征描述
  12443. * @param mzBlRecord
  12444. * @returns {*}
  12445. */
  12446. function getTz(mzBlRecord) {
  12447. var tz = null;
  12448. if (mzBlRecord.weight != null && mzBlRecord.weight != 0) {
  12449. var temp = "体重:" + mzBlRecord.weight + "kg ";
  12450. if (tz == null) {
  12451. tz = temp;
  12452. } else {
  12453. tz += " " + temp;
  12454. }
  12455. }
  12456. if (mzBlRecord.temperature != null && mzBlRecord.temperature != 0) {
  12457. var temp = "体温:" + mzBlRecord.temperature + "℃ ";
  12458. if (tz == null) {
  12459. tz = temp;
  12460. } else {
  12461. tz += " " + temp;
  12462. }
  12463. }
  12464. if (mzBlRecord.sphygmus != null && mzBlRecord.sphygmus != 0) {
  12465. var temp = "脉搏:" + mzBlRecord.sphygmus + "次/分 ";
  12466. if (tz == null) {
  12467. tz = temp;
  12468. } else {
  12469. tz += " " + temp;
  12470. }
  12471. }
  12472. if (mzBlRecord.breathe != null && mzBlRecord.breathe != 0) {
  12473. var temp = "呼吸:" + mzBlRecord.breathe + "次/分 ";
  12474. if (tz == null) {
  12475. tz = temp;
  12476. } else {
  12477. tz += " " + temp;
  12478. }
  12479. }
  12480. if (mzBlRecord.pressureHigh != null && mzBlRecord.pressureFloor != null && mzBlRecord.pressureHigh != 0 && mzBlRecord.pressureFloor != 0) {
  12481. var temp = "血压:" + mzBlRecord.pressureHigh + "/" + mzBlRecord.pressureFloor + " mmhg";
  12482. if (tz == null) {
  12483. tz = temp;
  12484. } else {
  12485. tz += " " + temp;
  12486. }
  12487. }
  12488. if (mzBlRecord.pressureHighLeft != null && mzBlRecord.pressureFloorLeft != null && mzBlRecord.pressureHighLeft != 0 && mzBlRecord.pressureFloorLeft != 0) {
  12489. var temp = "左血压:" + mzBlRecord.pressureHighLeft + "/" + mzBlRecord.pressureFloorLeft;
  12490. if (tz == null) {
  12491. tz = temp;
  12492. } else {
  12493. tz += " " + temp;
  12494. }
  12495. }
  12496. if (mzBlRecord.emrPe != null && mzBlRecord.emrPe != "") {
  12497. if (tz == null) {
  12498. tz = mzBlRecord.emrPe;
  12499. } else {
  12500. tz += "," + mzBlRecord.emrPe;
  12501. }
  12502. }
  12503. return tz;
  12504. }
  12505. /**
  12506. * 打印医技申请单
  12507. * @param patientId
  12508. * @param times
  12509. * @param type 申请单类型:2:检验;3:检查
  12510. * @param printType 打印模式 1 预览打印 2 打印设置
  12511. */
  12512. function printYjReq(patientId, times, type, printType) {
  12513. $.ajax({
  12514. type: "GET",
  12515. url: '/thmz/printYjReq?patientId=' + patientId + '&times=' + times + "&reqType=" + type,
  12516. contentType: "application/json;charset=UTF-8",
  12517. dataType: "json",
  12518. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  12519. success: function (res) {
  12520. if (res == '401' || res == 401) {
  12521. window.location.href = '/thmz/login/view'
  12522. return;
  12523. }
  12524. if (res.code == 0) {
  12525. if (res.data == null || res.data.mzYjReqList == null || res.data.mzYjReqList.length == 0) {
  12526. errorMesageSimaple("没有医技申请单可以打印");
  12527. return;
  12528. }
  12529. setPrint();
  12530. LODOP = getLodop();
  12531. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", hospitalName+"检查申请单");
  12532. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  12533. //设置默认打印机
  12534. LODOP.SET_PRINTER_INDEX(printIndex);
  12535. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  12536. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  12537. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  12538. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "检查申请单");//对新建的纸张重命名
  12539. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  12540. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  12541. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  12542. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  12543. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  12544. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  12545. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  12546. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  12547. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  12548. var mzPatientMi = res.data.mzPatientMi;
  12549. $("#patientIdJcReq").text(mzPatientMi.patientId);
  12550. $("#patientNameJcReq").text(mzPatientMi.name);
  12551. $("#patientGenderJcReq").text(mzPatientMi.gender);
  12552. $("#patientAgeJcReq").text(mzPatientMi.ageString);
  12553. $("#responseTypeJcReq").text(mzPatientMi.responseTypeName);
  12554. $("#patientCardNoJcReq").text(mzPatientMi.icCardNo);
  12555. $("#icdTextJcReq").text(res.data.icdText);
  12556. $("#patientIdJyReq").text(mzPatientMi.patientId);
  12557. $("#patientNameJyReq").text(mzPatientMi.name);
  12558. $("#patientGenderJyReq").text(mzPatientMi.gender);
  12559. $("#patientAgeJyReq").text(mzPatientMi.ageString);
  12560. $("#responseTypeJyReq").text(mzPatientMi.responseTypeName);
  12561. $("#patientCardNoJyReq").text(mzPatientMi.icCardNo);
  12562. $("#icdTextJyReq").text(res.data.icdText);
  12563. var mzBlRecord = res.data.mzBlRecord;
  12564. $("#jcReqEmrChiefComplaint").text(mzBlRecord.emrChiefComplaint);
  12565. $("#jcReqHis").text(mzBlRecord.emrHpi);
  12566. $("#jyReqEmrChiefComplaint").text(mzBlRecord.emrChiefComplaint);
  12567. $("#jyReqHis").text(mzBlRecord.emrHpi);
  12568. var tz = getTz(mzBlRecord);
  12569. $("#jcReqTz").text(tz);
  12570. $("#jcReqReqDept").text(res.data.deptName);
  12571. $("#jcReqReqDoctor").text(res.data.doctorName);
  12572. $("#jyReqTz").text(tz);
  12573. $("#jyReqReqDept").text(res.data.deptName);
  12574. $("#jyReqReqDoctor").text(res.data.doctorName);
  12575. //检验报告列表名
  12576. var jyTitle = '<tr><th style="min-height: 30px;border-bottom: 1px solid black;">执行科室</th><th style="min-height: 30px;border-bottom: 1px solid black;">检验项目</th><th style="min-height: 30px;border-bottom: 1px solid black;">标本</th><th style="min-height: 30px;border-bottom: 1px solid black;">单号</th></tr>';
  12577. var jyContent = "";
  12578. var needNewPageA = false;
  12579. for (var i = 0; i < res.data.mzYjReqList.length; i++) {
  12580. var obj = res.data.mzYjReqList[i];
  12581. if (i == 0) {
  12582. var dateStr = format(obj.reqDate, "yyyy-MM-dd");
  12583. $("#jcReqReqDate").text(dateStr);
  12584. $("#jyReqReqDate").text(dateStr);
  12585. }
  12586. if (obj.reqType == "3") {
  12587. if (i > 0) {
  12588. LODOP.NewPageA();
  12589. }
  12590. JsBarcode("#JcBarcode", obj.reqNo, {
  12591. lineColor: '#333', //线条颜色
  12592. width: 1, //线宽
  12593. height: 26, //条码高度
  12594. displayValue: false, //是否显示文字信息
  12595. });
  12596. $("#reqNoJcReq").text(obj.reqNo);
  12597. $("#jcReqItem").text(obj.groupName);
  12598. $("#jcReqRemark").text(obj.jyRemark);
  12599. $("#jcComment8").text(obj.comment8);
  12600. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("jc_card_table").innerHTML);
  12601. needNewPageA = true;
  12602. } else if (obj.reqType == "2") {
  12603. let inspectName = (obj.inspectName == null || obj.inspectName == "null") ? "" : obj.inspectName;
  12604. jyContent += '<tr><td>' + obj.execName + '</td><td style="min-height: 30px;">' + obj.groupName + '</td><td>' + inspectName + '</td><td>' + obj.reqNo + '</td></tr>';
  12605. JsBarcode("#JyBarcode", obj.reqNo, {
  12606. lineColor: '#333', //线条颜色
  12607. width: 1, //线宽
  12608. height: 26, //条码高度
  12609. displayValue: false, //是否显示文字信息
  12610. });
  12611. }
  12612. }
  12613. if (jyContent != null && jyContent != "" && jyContent.length > 0) {
  12614. if (needNewPageA) {
  12615. LODOP.NewPageA();
  12616. }
  12617. jyContent = jyTitle + jyContent;
  12618. $("#jyContent").html(jyContent);
  12619. //检验
  12620. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("jy_card_table").innerHTML);
  12621. }
  12622. if (printType == 1) {
  12623. LODOP.PREVIEW();
  12624. } else if (printType == 2) {
  12625. LODOP.PRINT_SETUP();
  12626. }
  12627. } else {
  12628. errorMesage(res);
  12629. }
  12630. }
  12631. });
  12632. }
  12633. /**
  12634. * 打印门诊病历
  12635. * @param patientId
  12636. * @param times
  12637. * @param clnicId
  12638. * @param payMark
  12639. * @param printType 打印模式 1 预览打印 2 打印设置
  12640. */
  12641. function printBlRecord(patientId, times, printType) {
  12642. if(printType == 1){
  12643. saveMzPrescriptionPrint(patientId,times)
  12644. }
  12645. $.ajax({
  12646. type: "GET",
  12647. url: '/thmz/getMzBlrecord?patientId=' + patientId + '&times=' + times,
  12648. contentType: "application/json;charset=UTF-8",
  12649. dataType: "json",
  12650. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  12651. success: function (res) {
  12652. if (res == '401' || res == 401) {
  12653. window.location.href = '/thmz/login/view'
  12654. return;
  12655. }
  12656. if (res.code == 0) {
  12657. setPrint();
  12658. LODOP = getLodop();
  12659. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", hospitalName+"门诊病历");
  12660. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  12661. //设置默认打印机
  12662. LODOP.SET_PRINTER_INDEX(printIndex);
  12663. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  12664. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  12665. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  12666. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊病历");//对新建的纸张重命名
  12667. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  12668. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  12669. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  12670. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  12671. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  12672. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  12673. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  12674. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  12675. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  12676. var mzPatientMi = res.mzPatientMi;
  12677. $("#patientIdBlrecord").text(mzPatientMi.patientId);
  12678. $("#patientNameBlrecord").text(mzPatientMi.name);
  12679. $("#patientGenderBlrecord").text(mzPatientMi.gender);
  12680. $("#patientAgeBlrecord").text(mzPatientMi.ageString);
  12681. var mzBlRecord = res.mzBlRecord;
  12682. if (mzBlRecord.firstOrNot == "1") {
  12683. $("#firstOrNotTitle").text("复诊");
  12684. } else {
  12685. $("#firstOrNotTitle").text("初诊");
  12686. }
  12687. if (mzBlRecord.emrChiefComplaint != null && mzBlRecord.emrChiefComplaint != "") {
  12688. $("#emrChiefComplaintBlrecord").text(mzBlRecord.emrChiefComplaint);
  12689. $("#emrChiefComplaintBlrecord").parent().css("display", "block");
  12690. } else {
  12691. $("#emrChiefComplaintBlrecord").parent().css("display", "none");
  12692. }
  12693. if (mzBlRecord.emrHpi != null && mzBlRecord.emrHpi != "") {
  12694. $("#emrHpiBlrecord").text(mzBlRecord.emrHpi);
  12695. $("#emrHpiBlrecord").parent().css("display", "block");
  12696. } else {
  12697. $("#emrHpiBlrecord").parent().css("display", "none");
  12698. }
  12699. if (mzBlRecord.emrPs != null && mzBlRecord.emrPs != "") {
  12700. $("#emrPsBlrecord").text(mzBlRecord.emrPs);
  12701. $("#emrPsBlrecord").parent().css("display", "block");
  12702. } else {
  12703. $("#emrPsBlrecord").parent().css("display", "none");
  12704. }
  12705. if (mzBlRecord.personalHistory != null && mzBlRecord.personalHistory != "") {
  12706. $("#personalHistoryBlrecord").text(mzBlRecord.personalHistory);
  12707. $("#personalHistoryBlrecord").parent().css("display", "block");
  12708. } else {
  12709. $("#personalHistoryBlrecord").parent().css("display", "none");
  12710. }
  12711. if (mzBlRecord.familyHistory != null && mzBlRecord.familyHistory != "") {
  12712. $("#familyHistoryBlrecord").text(mzBlRecord.familyHistory);
  12713. $("#familyHistoryBlrecord").parent().css("display", "block");
  12714. } else {
  12715. $("#familyHistoryBlrecord").parent().css("display", "none");
  12716. }
  12717. if (mzBlRecord.fzZl != null && mzBlRecord.fzZl != "") {
  12718. $("#fzZlBlrecord").text(mzBlRecord.fzZl);
  12719. $("#fzZlBlrecord").parent().css("display", "block");
  12720. } else {
  12721. $("#fzZlBlrecord").parent().css("display", "none");
  12722. }
  12723. if (mzBlRecord.crbHistory != null && mzBlRecord.crbHistory != "") {
  12724. $("#crbHistoryBlrecord").text(mzBlRecord.crbHistory);
  12725. } else {
  12726. $("#crbHistoryBlrecord").text('无');
  12727. }
  12728. if (mzBlRecord.obstericalHistory != null && mzBlRecord.obstericalHistory != "") {
  12729. $("#obstericalHistoryBlrecord").text(mzBlRecord.obstericalHistory);
  12730. $("#obstericalHistoryBlrecord").parent().css("display", "block");
  12731. } else {
  12732. $("#obstericalHistoryBlrecord").parent().css("display", "none");
  12733. }
  12734. var patientAllergenInfoList = res.patientAllergenInfoList;
  12735. if (patientAllergenInfoList != null && patientAllergenInfoList.length > 0) {
  12736. var zdAllergen = null;
  12737. for (var i = 0; i < patientAllergenInfoList.length; i++) {
  12738. var patientAllergenInfo = patientAllergenInfoList[i];
  12739. if (zdAllergen == null) {
  12740. zdAllergen = patientAllergenInfo.allergenName;
  12741. } else {
  12742. zdAllergen += "," + patientAllergenInfo.allergenName;
  12743. }
  12744. }
  12745. $("#zdAllergenBlrecord").text(zdAllergen);
  12746. } else {
  12747. $("#zdAllergenBlrecord").text('无');
  12748. }
  12749. var tz = getTz(mzBlRecord);
  12750. if (tz != null && tz != "") {
  12751. $("#emrPeBlrecord").text(tz);
  12752. $("#emrPeBlrecord").parent().css("display", "block");
  12753. } else {
  12754. $("#emrPeBlrecord").parent().css("display", "none");
  12755. }
  12756. // if (mzBlRecord.emrPe != null && mzBlRecord.emrPe != "") {
  12757. // $("#emrPeBlrecord").text(mzBlRecord.emrPe);
  12758. // $("#emrPeBlrecord").parent().css("display", "block");
  12759. // } else {
  12760. // $("#emrPeBlrecord").parent().css("display", "none");
  12761. // }
  12762. if (res.icdText != null && res.icdText != "") {
  12763. $("#icdTextBlrecord").text(res.icdText);
  12764. $("#icdTextBlrecord").parent().css("display", "block");
  12765. } else {
  12766. $("#icdTextBlrecord").parent().css("display", "none");
  12767. }
  12768. if (mzBlRecord.tcmIcdText != null && mzBlRecord.tcmIcdText != "") {
  12769. $("#tcmIcdTextBlrecord").text(mzBlRecord.tcmIcdText);
  12770. } else {
  12771. $("#tcmIcdTextBlrecord").text("无");
  12772. }
  12773. if (mzBlRecord.emrProcess != null && mzBlRecord.emrProcess != "") {
  12774. $("#emrProcessBlrecord").html(mzBlRecord.emrProcess);
  12775. $("#emrProcessBlrecord").parent().css("display", "block");
  12776. } else {
  12777. $("#emrProcessBlrecord").parent().css("display", "none");
  12778. }
  12779. if (mzBlRecord.emrJkjy != null && mzBlRecord.emrJkjy != "") {
  12780. $("#emrJkjyBlrecord").text(mzBlRecord.emrJkjy);
  12781. $("#emrJkjyBlrecord").parent().css("display", "block");
  12782. } else {
  12783. $("#emrJkjyBlrecord").parent().css("display", "none");
  12784. }
  12785. $("#visitDeptBlrecord").text(res.deptName);
  12786. $("#visitDateBlrecord").text(res.visitDate);
  12787. getAjaxRequst("/thmz/getDoctorSignatureImage",{doctorCode:mzBlRecord.doctorCode},false,function (hostRes) {
  12788. if(hostRes.code ==0){
  12789. $("#doctorSignBlrecord").html("<img src='" + hostRes.data + "' style='width:150px;height:25px;'/>")
  12790. }
  12791. })
  12792. //LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("mz_blrecord_card_table").innerHTML);
  12793. //上边距 左边距 宽 高
  12794. LODOP.ADD_PRINT_HTM("20mm", "5mm", "130mm", "168mm", strStyle + document.getElementById("mz_bl_content").innerHTML);
  12795. LODOP.SET_PRINT_STYLEA(0, "Vorient", 3);
  12796. LODOP.ADD_PRINT_HTM("0mm", "5mm", "130mm", "20mm", strStyle + document.getElementById("mz_bl_title").innerHTML);
  12797. LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
  12798. LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
  12799. LODOP.ADD_PRINT_HTM("190mm", "5mm", "130mm", "20mm", strStyle + document.getElementById("mz_bl_foot").innerHTML);
  12800. LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
  12801. LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
  12802. if (printType == 1) {
  12803. LODOP.PREVIEW();
  12804. } else if (printType == 2) {
  12805. LODOP.PRINT_SETUP();
  12806. }
  12807. } else {
  12808. errorMesage(res);
  12809. }
  12810. }
  12811. });
  12812. }
  12813. /**
  12814. * 打印入院通知单
  12815. * @param patientId
  12816. * @param times
  12817. * @param clnicId
  12818. * @param payMark
  12819. * @param printType 打印模式 1 预览打印 2 打印设置
  12820. */
  12821. function printZyReq(patientId, printType) {
  12822. $.ajax({
  12823. type: "GET",
  12824. url: '/thmz/printZyReq?patientId=' + patientId,
  12825. contentType: "application/json;charset=UTF-8",
  12826. dataType: "json",
  12827. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  12828. success: function (res) {
  12829. if (res == '401' || res == 401) {
  12830. window.location.href = '/thmz/login/view'
  12831. return;
  12832. }
  12833. if (res.code == 0) {
  12834. setPrint();
  12835. LODOP = getLodop();
  12836. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", hospitalName+"入院通知单");
  12837. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  12838. //设置默认打印机
  12839. LODOP.SET_PRINTER_INDEX(printIndex);
  12840. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  12841. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  12842. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  12843. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "入院通知单");//对新建的纸张重命名
  12844. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  12845. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  12846. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  12847. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  12848. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  12849. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  12850. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  12851. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  12852. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  12853. var mzPatientMi = res.mzPatientMi;
  12854. var mzZyReq = res.mzZyReq;
  12855. $("#patientIdZyReq").text(mzPatientMi.patientId);
  12856. $("#patientNameZyReq").text(mzPatientMi.name);
  12857. $("#patientGenderZyReq").text(mzPatientMi.gender);
  12858. $("#patientAgeZyReq").text(mzPatientMi.ageString);
  12859. $("#sfzZyReq").text(mzPatientMi.socialNo);
  12860. $("#birthDateZyReq").text(format(mzPatientMi.birthDay, "yyyy-MM-dd"));
  12861. $("#phoneZyReq").text(mzPatientMi.phoneNo);
  12862. $("#responseTypeZyReq").text(mzPatientMi.responseTypeName);
  12863. $("#addressZyReq").text(mzPatientMi.address);
  12864. if (mzZyReq.icdCode == null || mzZyReq.icdCode == "" || mzZyReq.icdCode.length == 0) {
  12865. $("#icsCodeZyReq").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
  12866. $("#icsTextZyReq").text(mzZyReq.icdText);
  12867. } else {
  12868. $("#icsCodeZyReq").text(mzZyReq.icdCode);
  12869. $("#icsTextZyReq").text(mzZyReq.icdText);
  12870. }
  12871. $("#reqDeptZyReq").text(mzZyReq.reqWardName);
  12872. $("#depositZyReq").text(mzZyReq.deposit);
  12873. $("#smallDeptZyReq").text(mzZyReq.smallDeptName);
  12874. $("#routeOfAdmissionName").text(mzZyReq.routeOfAdmissionName);
  12875. //$("#admissStatusZyReq").text(mzZyReq.admissStatus);
  12876. // $("input:checkbox[value='" + mzZyReq.admissStatus + "']").attr('checked', 'true');
  12877. $("input:checkbox[name='admissStatusZyReq']").each(function (i, e) {
  12878. $(this).removeAttr("checked");
  12879. if ($(this).val() == Number(mzZyReq.admissStatus) || $(this).val() == mzZyReq.admissStatus) {
  12880. $(this).attr("checked", true)
  12881. }
  12882. });
  12883. $("#visitDateZyReq").text(format(mzZyReq.visitDate, "yyyy-MM-dd HH:mm:ss"));
  12884. $("#deptCodeZyReq").text(mzZyReq.deptName);
  12885. getAjaxRequst("/thmz/getDoctorSignatureImage",{doctorCode:mzZyReq.doctorCode},false,function (signRes) {
  12886. if(signRes.code == 0){
  12887. $("#doctorCodeZyReq").html("<img src='" + signRes.data + "' style='width:100px;height:23px;'/>")
  12888. }else {
  12889. $("#doctorCodeZyReq").text(mzZyReq.doctorName);
  12890. }
  12891. })
  12892. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("mz_zy_req_table").innerHTML);
  12893. if (printType == 1) {
  12894. LODOP.PREVIEW();
  12895. } else if (printType == 2) {
  12896. LODOP.PRINT_SETUP();
  12897. }
  12898. } else {
  12899. errorMesage(res);
  12900. }
  12901. }
  12902. });
  12903. }
  12904. /**
  12905. * 打印门诊手术请单
  12906. * @param patientId
  12907. * @param times
  12908. * @param printType 打印模式 1 预览打印 2 打印设置
  12909. */
  12910. function printOpRecord(patientId, times, printType) {
  12911. $.ajax({
  12912. type: "GET",
  12913. url: '/thmz/printOpRecord?patientId=' + patientId + '&times=' + times,
  12914. contentType: "application/json;charset=UTF-8",
  12915. dataType: "json",
  12916. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  12917. success: function (res) {
  12918. if (res == '401' || res == 401) {
  12919. window.location.href = '/thmz/login/view'
  12920. return;
  12921. }
  12922. if (res.code == 0) {
  12923. if (res.data == null || res.data.length == 0) {
  12924. errorMesageSimaple("没有手术申请单可以打印");
  12925. return;
  12926. }
  12927. setPrint();
  12928. LODOP = getLodop();
  12929. LODOP.PRINT_INITA(6, 0, "148mm", "210mm",hospitalName+"门诊手术申请单");
  12930. LODOP.SET_PRINT_STYLE("FontSize", 13); //字体大小
  12931. //设置默认打印机
  12932. LODOP.SET_PRINTER_INDEX(printIndex);
  12933. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  12934. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  12935. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  12936. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊手术申请单");//对新建的纸张重命名
  12937. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  12938. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  12939. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  12940. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  12941. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  12942. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  12943. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  12944. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  12945. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  12946. var mzPatientMi = res.mzPatientMi;
  12947. $("#patientIdOpRecord").text(mzPatientMi.patientId);
  12948. $("#patientNameOpRecord").text(mzPatientMi.name);
  12949. $("#patientGenderOpRecord").text(mzPatientMi.gender);
  12950. $("#patientAgeOpRecord").text(mzPatientMi.ageString);
  12951. $("#responseTypeOpRecord").text(mzPatientMi.responseTypeName);
  12952. $("#patientCardNoOpRecord").text(mzPatientMi.icCardNo);
  12953. var needNewPageA = false;
  12954. for (var i = 0; i < res.data.length; i++) {
  12955. var obj = res.data[i];
  12956. //$("#reqNoOpRecord").text(obj.recordId);
  12957. $("#icdTextOpRecord").text(obj.diagBeforeOp);
  12958. $("#opNameOpRecord").text(obj.opName);
  12959. $("#hocusCodeOpRecord").text(obj.hocusCodeName);
  12960. $("#opScaleOpRecord").text(obj.opScaleName);
  12961. var dateStr = format(obj.applyDate, "yyyy-MM-dd HH:mm:ss");
  12962. $("#applyDateOpRecord").text(dateStr);
  12963. $("#opDatetimeOpRecord").text(obj.opDatetimeStr);
  12964. $("#doctorZdOpRecord").text(obj.doctorZdName);
  12965. $("#remarkOpRecord").text(obj.remark);
  12966. if (i > 0) {
  12967. LODOP.NewPageA();
  12968. }
  12969. JsBarcode("#JcBarcode", obj.recordId, {
  12970. lineColor: '#333', //线条颜色
  12971. width: 1, //线宽
  12972. height: 26, //条码高度
  12973. displayValue: false, //是否显示文字信息
  12974. });
  12975. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("op_record_card_table").innerHTML);
  12976. needNewPageA = true;
  12977. }
  12978. if (printType == 1) {
  12979. LODOP.PREVIEW();
  12980. } else if (printType == 2) {
  12981. LODOP.PRINT_SETUP();
  12982. }
  12983. } else {
  12984. errorMesage(res);
  12985. }
  12986. }
  12987. });
  12988. }
  12989. /**
  12990. * 打开查看检查检验报告窗口(含往期)
  12991. * @param patientId
  12992. */
  12993. function previewYjReqAll(patientId) {
  12994. $("#visitingDetailModal").modal("hide");
  12995. $("#previewYjReqModal").modal();
  12996. $("#previewYjReqModalPatientId").val(patientId);
  12997. $("#previewYjReqModalTimes").val(null);
  12998. //重置参数
  12999. retryCount = 0;
  13000. initJcJyTable();
  13001. }
  13002. /**
  13003. * 打开查看检查检验报告窗口
  13004. * @param patientId 门诊病人ID
  13005. * @param times 就诊次数
  13006. */
  13007. function previewYjReq(patientId, times) {
  13008. $("#visitingDetailModal").modal("hide");
  13009. $("#previewYjReqModal").modal();
  13010. $("#previewYjReqModalPatientId").val(patientId);
  13011. $("#previewYjReqModalTimes").val(times);
  13012. //重置参数
  13013. retryCount = 0;
  13014. initJcJyTable();
  13015. }
  13016. /**
  13017. * 删除本次处方
  13018. * @param clnicId 就诊记录id
  13019. */
  13020. function deletePrescription(clnicId) {
  13021. $("#visitingDetailModal").modal("hide");
  13022. $("#messageModal").modal();
  13023. $("#messageContent").html("确认要删除本次处方信息吗?");
  13024. $("#messageButton").off("click").on("click", function (t) {
  13025. $("#messageModal").modal("hide");
  13026. $.ajax({
  13027. type: "GET",
  13028. url: '/thmz/deletePrescription?clnicId=' + clnicId,
  13029. contentType: "application/json;charset=UTF-8",
  13030. dataType: "json",
  13031. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  13032. success: function (res) {
  13033. if (res == '401' || res == 401) {
  13034. window.location.href = '/thmz/login/view'
  13035. return;
  13036. }
  13037. if (res.code == 0) {
  13038. successMesage(res);
  13039. $("#tb_table_clinic").bootstrapTable('refresh');
  13040. } else {
  13041. errorMesage(res);
  13042. }
  13043. }
  13044. });
  13045. });
  13046. $("#cancelButton").off("click").on("click", function (t) {
  13047. $("#visitingDetailModal").modal();
  13048. });
  13049. ;
  13050. }
  13051. /**
  13052. * 检查检验列表类型按钮切换事件
  13053. * @param object
  13054. */
  13055. function jcjyButtonChange(object) {
  13056. $("#jcjy_group").find("button").each(function (index, element) {
  13057. if ($(element).hasClass("btn-primary")) {
  13058. $(element).removeClass("btn-primary").addClass("btn-default");
  13059. }
  13060. });
  13061. $(object).removeClass("btn-default").addClass("btn-primary");
  13062. initJcJyTable();
  13063. }
  13064. /**
  13065. * 初始化检查检验报告列表
  13066. */
  13067. function initJcJyTable() {
  13068. clearInspectionDetail();
  13069. clearJcDetail();
  13070. var typeIndex = getIndex("jcjy_group");
  13071. if (typeIndex == 0) {
  13072. //检查
  13073. $('#tb_jy_pName_table_list').bootstrapTable("destroy");
  13074. $('#tb_jy_table_list').bootstrapTable("destroy");
  13075. initJcListTable();
  13076. $("#jy_detail").removeClass("in").addClass("hide");
  13077. $("#jc_detail").removeClass("hide").addClass("in");
  13078. } else {
  13079. $('#tb_table_list').bootstrapTable("destroy");
  13080. initJyListTable();
  13081. $("#jc_detail").removeClass("in").addClass("hide");
  13082. $("#jy_detail").removeClass("hide").addClass("in");
  13083. }
  13084. }
  13085. /**
  13086. * 初始化检查报告列表
  13087. */
  13088. function initJcListTable() {
  13089. $('#tb_table_list').bootstrapTable("destroy");
  13090. $('#tb_table_list').bootstrapTable({
  13091. url: '/thmz/getJcJyList', //请求后台的URL(*)
  13092. method: 'post', //请求方式(*)
  13093. toolbar: '#toolbar', //工具按钮用哪个容器
  13094. striped: true, //是否显示行间隔色
  13095. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  13096. pagination: true, //是否显示分页(*)
  13097. sortable: true, //是否启用排序
  13098. sortOrder: "asc", //排序方式
  13099. queryParams: queryParams, //传递参数(*)
  13100. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  13101. pageNumber: 1, //初始化加载第一页,默认第一页
  13102. pageSize: 5, //每页的记录行数(*)
  13103. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  13104. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  13105. strictSearch: true,
  13106. showColumns: false, //是否显示所有的列
  13107. showRefresh: false, //是否显示刷新按钮
  13108. minimumCountColumns: 2, //最少允许的列数
  13109. clickToSelect: true, //是否启用点击选中行
  13110. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  13111. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  13112. cardView: false, //是否显示详细视图
  13113. detailView: false,
  13114. //rowStyle:rowStyle,//通过自定义函数设置行样式
  13115. ajaxOptions: {
  13116. headers: {
  13117. 'Accept': 'application/json',
  13118. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  13119. }
  13120. },
  13121. columns: [
  13122. {
  13123. field: 'groupName',
  13124. title: '项目名称',
  13125. align: "center",
  13126. valign: 'middle',
  13127. }, {
  13128. field: 'reqDate',
  13129. title: '申请时间',
  13130. align: "center",
  13131. valign: 'middle',
  13132. formatter: function (value, row, index) {
  13133. if (value == null || value == "") {
  13134. return "";
  13135. }
  13136. return format(value, "yyyy-MM-dd HH:mm:ss");
  13137. }
  13138. }
  13139. ],
  13140. onClickRow: function (row) {
  13141. clearJcDetail();
  13142. $("#patientId_t").text(row.patientId);
  13143. $("#name_t").text(row.patientName);
  13144. $("#date_t").text(format(row.reqDate, "yyyy-MM-dd HH:mm:ss"));
  13145. fitJcDetail(row.reqNo, row.patientId);
  13146. },
  13147. responseHandler: function (res) {
  13148. if (res == '401' || res == 401) {
  13149. window.location.href = '/thmz/login/view'
  13150. return;
  13151. }
  13152. var ress = eval(res);
  13153. if (ress.code == -1) {
  13154. if (ress.message != null && ress.message != '') {
  13155. errorMesage(ress);
  13156. }
  13157. if (retryCount == 0) {
  13158. retryCount++;
  13159. $("#jyButton").click();
  13160. return;
  13161. }
  13162. return {
  13163. "total": 0,//总页数
  13164. "rows": {} //数据
  13165. };
  13166. }
  13167. if (ress.count <= 0 && retryCount == 0) {
  13168. retryCount++;
  13169. $("#jyButton").click();
  13170. return;
  13171. }
  13172. //有数据的时候,计数也需要加1,防止这时医生自己候点击检验没数据又跳回检查
  13173. retryCount++;
  13174. return {
  13175. "total": ress.count,//总页数
  13176. "rows": ress.data //数据
  13177. };
  13178. },
  13179. onLoadSuccess: function (data) {
  13180. $(".pagination-detail").css("display", "none");
  13181. }
  13182. });
  13183. }
  13184. /**
  13185. * 构建列表查询参数
  13186. * @param params
  13187. * @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}}
  13188. */
  13189. function queryParams(params) {
  13190. var patientId = $("#previewYjReqModalPatientId").val();
  13191. var times = $("#previewYjReqModalTimes").val();
  13192. return {
  13193. reqType: "3",
  13194. patientId: patientId,
  13195. times: times,
  13196. pageSize: params.limit, //页面大小
  13197. pageIndex: params.offset / params.limit //页码
  13198. };
  13199. };
  13200. /**
  13201. * 加载检查明细
  13202. * @param reqNo
  13203. */
  13204. function fitJcDetail(reqNo, patientId) {
  13205. $.ajax({
  13206. type: "GET",
  13207. url: '/thmz/getYjJcRecordReport?hisReqNo=' + reqNo + "&patientId=" + patientId,
  13208. contentType: "application/json;charset=UTF-8",
  13209. dataType: "json",
  13210. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  13211. success: function (res) {
  13212. if (res == '401' || res == 401) {
  13213. window.location.href = '/thmz/login/view'
  13214. return;
  13215. }
  13216. if (res.code == 0) {
  13217. canBePrintJc = true;
  13218. $("#jy_detail").removeClass("in").addClass("hide");
  13219. $("#jc_detail").removeClass("hide").addClass("in");
  13220. var mzPatientMi = res.data.mzPatientMi;
  13221. $("#gender_jc").text(mzPatientMi.gender);
  13222. $("#age_jc").text(mzPatientMi.ageString);
  13223. var yjJcRecordReport = res.data.yjJcRecordReport;
  13224. $("#groupName").text(res.data.groupName);
  13225. $("#textJc").text(yjJcRecordReport.textJc);
  13226. $("#textZd").text(yjJcRecordReport.textZd);
  13227. var jcRecord = res.data.jcRecord;
  13228. $("#report_no").text(jcRecord.reportNo);
  13229. $("#reportId").text(jcRecord.reportId);
  13230. if (jcRecord.reportDate == null || jcRecord.reportDate == "") {
  13231. $("#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;");
  13232. } else {
  13233. $("#reportDate").text(format(jcRecord.reportDate, "yyyy-MM-dd HH:mm:ss"));
  13234. }
  13235. $("#confirmId").text(jcRecord.confirmId);
  13236. if (jcRecord.confirmDate == null || jcRecord.confirmDate == "") {
  13237. $("#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;");
  13238. } else {
  13239. $("#confirmDate").text(format(jcRecord.confirmDate, "yyyy-MM-dd HH:mm:ss"));
  13240. }
  13241. } else {
  13242. errorMesage(res);
  13243. }
  13244. }
  13245. });
  13246. }
  13247. /**
  13248. * 清空检查明细
  13249. * @param reqNo
  13250. */
  13251. function clearJcDetail() {
  13252. canBePrintJc = false;
  13253. $("#patientId_t").text("");
  13254. $("#name_t").text("");
  13255. $("#date_t").text("");
  13256. $("#gender_jc").text("");
  13257. $("#age_jc").text("");
  13258. $("#groupName").text("");
  13259. $("#textJc").text("");
  13260. $("#textZd").text("");
  13261. $("#report_no").text("");
  13262. $("#reportId").text("");
  13263. $("#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;");
  13264. $("#confirmId").text("");
  13265. $("#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;");
  13266. }
  13267. /**
  13268. * 初始化检验报告列表
  13269. */
  13270. function initJyListTable() {
  13271. var patientId = $("#previewYjReqModalPatientId").val();
  13272. var times = $("#previewYjReqModalTimes").val();
  13273. $('#tb_table_list').bootstrapTable("destroy");
  13274. $('#tb_table_list').bootstrapTable({
  13275. url: '/thmz/getJyListByPatientIdAndTimes?patientId=' + patientId + "&times=" + times, //请求后台的URL(*)
  13276. method: 'get', //请求方式(*)
  13277. toolbar: '#toolbar', //工具按钮用哪个容器
  13278. striped: true, //是否显示行间隔色
  13279. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  13280. pagination: true, //是否显示分页(*)
  13281. sortable: true, //是否启用排序
  13282. sortOrder: "asc", //排序方式
  13283. //queryParams: queryJyPNameParams, //传递参数(*)
  13284. sidePagination: "client", //分页方式:client客户端分页,server服务端分页(*)
  13285. pageNumber: 1, //初始化加载第一页,默认第一页
  13286. pageSize: 5, //每页的记录行数(*)
  13287. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  13288. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  13289. strictSearch: true,
  13290. showColumns: false, //是否显示所有的列
  13291. showRefresh: false, //是否显示刷新按钮
  13292. minimumCountColumns: 2, //最少允许的列数
  13293. clickToSelect: true, //是否启用点击选中行
  13294. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  13295. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  13296. cardView: false, //是否显示详细视图
  13297. detailView: false,
  13298. //rowStyle:rowStyle,//通过自定义函数设置行样式
  13299. ajaxOptions: {
  13300. headers: {
  13301. 'Accept': 'application/json',
  13302. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  13303. }
  13304. },
  13305. columns: [
  13306. {
  13307. field: 'aply_CTNT',
  13308. title: '检验名称',
  13309. align: "center",
  13310. valign: 'middle',
  13311. }, {
  13312. field: 'ordr_CREATE_DATE',
  13313. title: '检验时间',
  13314. align: "center",
  13315. valign: 'middle',
  13316. formatter: function (value, row, index) {
  13317. if (value == null || value == "") {
  13318. return "";
  13319. }
  13320. return format(value, "yyyy-MM-dd HH:mm:ss");
  13321. }
  13322. }
  13323. ],
  13324. onClickRow: function (row) {
  13325. queryInspectionDetail(row.ordr_ID);
  13326. },
  13327. responseHandler: function (res) {
  13328. if (res == '401' || res == 401) {
  13329. window.location.href = '/thmz/login/view'
  13330. return;
  13331. }
  13332. var ress = eval(res);
  13333. if (ress.code == -1) {
  13334. if (retryCount == 0) {
  13335. retryCount++;
  13336. $("#jcButton").click();
  13337. return;
  13338. }
  13339. if (ress.message != null && ress.message != '') {
  13340. errorMesage(ress);
  13341. }
  13342. return {
  13343. "total": ress.data.length,//总页数
  13344. "rows": ress.data //数据
  13345. };
  13346. }
  13347. if (ress.data.length <= 0 && retryCount == 0) {
  13348. retryCount++;
  13349. $("#jcButton").click();
  13350. return;
  13351. }
  13352. //有数据的时候,计数也需要加1,防止这时医生自己候点击检查没数据又跳回检验
  13353. retryCount++;
  13354. return {
  13355. "total": ress.data.length,//总页数
  13356. "rows": ress.data //数据
  13357. };
  13358. },
  13359. onLoadSuccess: function (data) {
  13360. $("#jy_table_table_div").find(".pagination-detail").css("display", "none");
  13361. }
  13362. });
  13363. }
  13364. /**
  13365. * 清空检验明细
  13366. * @param orderId
  13367. */
  13368. function clearInspectionDetail() {
  13369. canBePrintJy = false;
  13370. $("#patientId_t_jy").text("");
  13371. $("#name_t_jy").text("");
  13372. $("#gender_jy").text("");
  13373. $("#age_jy").text("");
  13374. $("#reqDept_t_jy").text("");
  13375. $("#bed_no_jy").text("");
  13376. $("#smpl_jy").text("");
  13377. $("#item_jy").text("");
  13378. $("#applyDate").text("");
  13379. $("#orderCreateDate").text("");
  13380. $("#auditTime").text("");
  13381. $("#orderUsrName").text("");
  13382. $("#testUsrName").text("");
  13383. $("#auditUsrName").text("");
  13384. $("#jyBody").html("");
  13385. }
  13386. /**
  13387. * 加载检验明细
  13388. * @param orderId
  13389. */
  13390. function queryInspectionDetail(orderId) {
  13391. clearInspectionDetail();
  13392. $.ajax({
  13393. type: "GET",
  13394. url: '/thmz/getInspectionDetail?orderId=' + orderId,
  13395. contentType: "application/json;charset=UTF-8",
  13396. dataType: "json",
  13397. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  13398. success: function (res) {
  13399. if (res == '401' || res == 401) {
  13400. window.location.href = '/thmz/login/view'
  13401. return;
  13402. }
  13403. if (res.code == 0) {
  13404. canBePrintJy = true;
  13405. $("#jc_detail").removeClass("in").addClass("hide");
  13406. $("#jy_detail").removeClass("hide").addClass("in");
  13407. var mzPatientMi = res.mzPatientMi;
  13408. $("#patientId_t_jy").text(mzPatientMi.patientId);
  13409. $("#name_t_jy").text(mzPatientMi.name);
  13410. $("#gender_jy").text(mzPatientMi.gender);
  13411. $("#age_jy").text(mzPatientMi.ageString);
  13412. var html = "";
  13413. if (res.data != null) {
  13414. var inspectionHeader = res.data.inspectionHeader;
  13415. $("#reqDept_t_jy").text(inspectionHeader.dept_NAME);
  13416. $("#bed_no_jy").text(inspectionHeader.ptnt_BED_NO);
  13417. $("#smpl_jy").text(inspectionHeader.smpl_NAME);
  13418. $("#item_jy").text(inspectionHeader.aply_CNTN);
  13419. $("#applyDate").text(format(inspectionHeader.aply_DATE, "yyyy-MM-dd HH:mm:ss"));
  13420. $("#orderCreateDate").text(format(inspectionHeader.ordr_CREATE_DATE, "yyyy-MM-dd HH:mm:ss"));
  13421. $("#auditTime").text(format(inspectionHeader.audt_TIME, "yyyy-MM-dd HH:mm:ss"));
  13422. $("#orderUsrName").text(inspectionHeader.doc_NAME);
  13423. $("#testUsrName").text(inspectionHeader.test_USR_NAME);
  13424. $("#auditUsrName").text(inspectionHeader.audt_USR_NAME);
  13425. var inspectionItems = res.data.inspectionItems;
  13426. if (inspectionItems != null && inspectionItems.length > 0) {
  13427. for (var i = 0; i < inspectionItems.length; i++) {
  13428. html += "<tr>";
  13429. var obj = inspectionItems[i];
  13430. var itm_VALUE = obj.itm_VALUE;
  13431. if (itm_VALUE == null || itm_VALUE == "null") {
  13432. itm_VALUE = "";
  13433. }
  13434. itm_VALUE += (obj.itm_STR_VALUE == null || obj.itm_STR_VALUE == "null") ? "" : obj.itm_STR_VALUE;
  13435. var range = obj.range;
  13436. if (range == null || range == "null") {
  13437. range = "";
  13438. }
  13439. range += (obj.range_STR == null || obj.range_STR == "null") ? "" : obj.range_STR;
  13440. html += "<td width='25%'>" + obj.itm_NAME + "</td>";
  13441. html += "<td width='16.66%'>" + itm_VALUE + "</td>";
  13442. html += "<td width='16.66%'>" + obj.itm_UNIT + "</td>";
  13443. if (obj.itm_ALERT == null || obj.itm_ALERT == "") {
  13444. html += "<td width='16.66%'><span style=\"color:#67C23A;font-weight:bold\"></span></td>";
  13445. } else if (obj.itm_ALERT == "H") {
  13446. html += "<td width='16.66%'><span style=\"color:#F56C6C;font-weight:bold\">↑</span></td>";
  13447. } else if (obj.itm_ALERT == "L") {
  13448. html += "<td width='16.66%'><span style=\"color:#F56C6C;font-weight:bold\">↓</span></td>";
  13449. }
  13450. html += "<td width='25%'>" + range + "</td>";
  13451. html += "</tr>";
  13452. var bacteriaResults = obj.bacteriaResults;
  13453. if (bacteriaResults == null || bacteriaResults.length == 0) {
  13454. continue;
  13455. }
  13456. var bacteriaResult = bacteriaResults[0];
  13457. if (bacteriaResult == null || bacteriaResult.length == 0) {
  13458. continue;
  13459. }
  13460. var antibioticResults = bacteriaResult.antibioticResults;
  13461. if (antibioticResults == null || antibioticResults.length == 0) {
  13462. continue;
  13463. }
  13464. 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>';
  13465. for (var j = 0; j < antibioticResults.length; j++) {
  13466. var antibioticResultsObj = antibioticResults[j];
  13467. html += "<tr>";
  13468. html += "<td width='35%' style='padding-left: 2%;";
  13469. if (j == 0) {
  13470. html += "border-top: 1px solid black;";
  13471. }
  13472. html += "'>" + antibioticResultsObj.anti_NAME_CN + "</td>";
  13473. html += "<td width='20%' ";
  13474. if (j == 0) {
  13475. html += "style='border-top: 1px solid black;'";
  13476. }
  13477. html += ">" + antibioticResultsObj.anti_ABB + "</td>";
  13478. html += "<td width='25%' ";
  13479. if (j == 0) {
  13480. html += "style='border-top: 1px solid black;'";
  13481. }
  13482. html += ">" + antibioticResultsObj.anti_MIC + "</td>";
  13483. html += "<td width='20%' style='padding-right: 2%;";
  13484. if (j == 0) {
  13485. html += "border-top: 1px solid black;";
  13486. }
  13487. html += "'>" + antibioticResultsObj.anti_VALUE + "</td>";
  13488. html += "</tr>";
  13489. }
  13490. }
  13491. }
  13492. }
  13493. $("#jyBody").html(html);
  13494. } else {
  13495. errorMesage(res);
  13496. }
  13497. }
  13498. });
  13499. }
  13500. /**
  13501. * 打印检查检验报告单
  13502. * @param printType 打印模式 1 预览打印 2 打印设置
  13503. */
  13504. function printJyJcReport(printType) {
  13505. var typeIndex = getIndex("jcjy_group");
  13506. var title = "检查报告单";
  13507. if (typeIndex == 1) {
  13508. title = "检验报告单"
  13509. if (!canBePrintJy) {
  13510. warningMesageSimaple("没有任何【" + title + "】可供打印!");
  13511. return;
  13512. }
  13513. } else {
  13514. if (!canBePrintJc) {
  13515. warningMesageSimaple("没有任何【" + title + "】可供打印!");
  13516. return;
  13517. }
  13518. }
  13519. setPrint();
  13520. LODOP = getLodop();
  13521. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", hospitalName + title);
  13522. LODOP.SET_PRINT_STYLE("FontSize", 7); //字体大小
  13523. //设置默认打印机
  13524. LODOP.SET_PRINTER_INDEX(printIndex);
  13525. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  13526. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  13527. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  13528. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", title);//对新建的纸张重命名
  13529. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  13530. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  13531. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  13532. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  13533. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  13534. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  13535. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  13536. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  13537. var strStyle = "<style>table{width: 96%;} #jy_detail_content thead {border-bottom: 1px solid black;border-collapse: collapse;}</style>";
  13538. if (typeIndex == 0) {
  13539. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("jc_detail").innerHTML);
  13540. }
  13541. if (typeIndex == 1) {
  13542. LODOP.ADD_PRINT_TABLE("37mm", "5mm", "130mm", "138mm", strStyle + document.getElementById("jy_detail_content").innerHTML);
  13543. LODOP.SET_PRINT_STYLEA(0, "Vorient", 3);
  13544. LODOP.ADD_PRINT_HTM("0mm", "5mm", "130mm", "200mm", strStyle + document.getElementById("jy_detail_title").innerHTML);
  13545. LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
  13546. LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
  13547. LODOP.ADD_PRINT_HTM("177mm", "5mm", "130mm", "200mm", strStyle + document.getElementById("jy_detail_foot").innerHTML);
  13548. LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
  13549. LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
  13550. }
  13551. if (printType == 1) {
  13552. LODOP.PREVIEW();
  13553. } else if (printType == 2) {
  13554. LODOP.PRINT_SETUP();
  13555. }
  13556. }
  13557. /**
  13558. * 初始化科室下拉选
  13559. */
  13560. function initExecUnit() {
  13561. //父科室列表
  13562. $.ajax({
  13563. type: "GET",
  13564. url: '/thmz/allUnitCode',
  13565. dataType: "json",
  13566. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  13567. success: function (data) {
  13568. if (data == '401' || data == 401) {
  13569. window.location.href = '/thmz/login/view'
  13570. return;
  13571. }
  13572. $('#execUnit').empty(); //清空resText里面的所有内容
  13573. $('#zlExecUnit').empty(); //清空resText里面的所有内容
  13574. var html = '';
  13575. $.each(data.data, function (commentIndex, comment) {
  13576. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + '-' + comment.code + ')</option>';
  13577. });
  13578. $('#execUnit').html(html);
  13579. $('#execUnit').selectpicker('refresh');
  13580. $('#zlExecUnit').html(html);
  13581. $('#zlExecUnit').selectpicker('refresh');
  13582. }
  13583. });
  13584. }
  13585. /**
  13586. * 初始化证件类型下拉选
  13587. */
  13588. function initCertificateTypeSelect() {
  13589. $.ajax({
  13590. type: "GET",
  13591. url: '/thmz/listCertificateType',
  13592. contentType: "application/json;charset=UTF-8",
  13593. dataType: "json",
  13594. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  13595. success: function (res) {
  13596. if (res == '401' || res == 401) {
  13597. window.location.href = '/thmz/login/view'
  13598. return;
  13599. }
  13600. if (res.code == 0) {
  13601. res.data.forEach(function (item, index) {
  13602. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  13603. $('#rapidAcceptsUserCertificateType').append(html);
  13604. $('#editUserCertificateType').append(html);
  13605. $('#crbMainCardCertificateType').append(html);
  13606. });
  13607. $('#rapidAcceptsUserCertificateType').selectpicker('refresh');
  13608. $('#editUserCertificateType').selectpicker('refresh');
  13609. $('#crbMainCardCertificateType').selectpicker('refresh');
  13610. } else {
  13611. errorMesage(res);
  13612. }
  13613. }
  13614. });
  13615. }
  13616. /**
  13617. * 加载病历信息编辑预览
  13618. * @param patientId
  13619. * @param times
  13620. * @param type 1 编辑 2 预览
  13621. */
  13622. function showMzBlRecordModal(patientId, times, type) {
  13623. $.ajax({
  13624. type: "GET",
  13625. url: '/thmz/getMzBlrecord?patientId=' + patientId + '&times=' + times+'&type='+type,
  13626. contentType: "application/json;charset=UTF-8",
  13627. dataType: "json",
  13628. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  13629. success: function (res) {
  13630. if (res == '401' || res == 401) {
  13631. window.location.href = '/thmz/login/view'
  13632. return;
  13633. }
  13634. if (res.code == 0) {
  13635. var mzPatientMi = res.mzPatientMi;
  13636. $("#editPatientId").text(mzPatientMi.patientId);
  13637. $("#editPatientName").text(mzPatientMi.name);
  13638. $("#editPatientGender").text(mzPatientMi.gender);
  13639. $("#editPatientAge").text(mzPatientMi.ageString);
  13640. var mzBlRecord = res.mzBlRecord;
  13641. $("#editEmrChiefComplaint").val(mzBlRecord.emrChiefComplaint == null ? "" : mzBlRecord.emrChiefComplaint);
  13642. $("#editEmrHpi").val(mzBlRecord.emrHpi == null ? "" : mzBlRecord.emrHpi);
  13643. $("#editEmrPs").val(mzBlRecord.emrPs == null ? "" : mzBlRecord.emrPs);
  13644. $("#editPersonalHistory").val(mzBlRecord.personalHistory == null ? "" : mzBlRecord.personalHistory);
  13645. $("#editFamilyHistory").val(mzBlRecord.familyHistory == null ? "" : mzBlRecord.familyHistory);
  13646. $("#editFzZl").val(mzBlRecord.fzZl == null ? "" : mzBlRecord.fzZl);
  13647. $("#editCrbHistory").val(mzBlRecord.crbHistory == null ? "" : mzBlRecord.crbHistory);
  13648. $("#editObstericalHistory").val(mzBlRecord.obstericalHistory == null ? "" : mzBlRecord.obstericalHistory);
  13649. $("#editQtjc").val(mzBlRecord.emrPe == null ? "" : mzBlRecord.emrPe);
  13650. setSelectedAttr("editZd", mzBlRecord.icdCode, mzBlRecord.icdText);
  13651. setSelectedAttr("editTcmZd", mzBlRecord.tcmIcdCode, mzBlRecord.tcmIcdText);
  13652. var patientAllergenInfoList = res.patientAllergenInfoList;
  13653. if (patientAllergenInfoList != null && patientAllergenInfoList.length > 0) {
  13654. var zdAllergen = [];
  13655. var ypDitList = [];
  13656. var zdAllergenHtml = '';
  13657. var ypDitListHtml = '';
  13658. var zdAllergeCodes = null;
  13659. var zdAllergeTexts = null;
  13660. var ypDitListodes = null;
  13661. var ypDitListTexts = null;
  13662. for (var i = 0; i < patientAllergenInfoList.length; i++) {
  13663. var patientAllergenInfo = patientAllergenInfoList[i];
  13664. if (patientAllergenInfo.type == 0 || patientAllergenInfo.type == '0') {
  13665. zdAllergen[zdAllergen.length] = patientAllergenInfo.allergenCode;
  13666. zdAllergenHtml += '<option value="' + patientAllergenInfo.allergenCode + '">' + patientAllergenInfo.allergenName + '</option>';
  13667. if (zdAllergeCodes == null) {
  13668. zdAllergeCodes = patientAllergenInfo.allergenCode;
  13669. zdAllergeTexts = patientAllergenInfo.allergenName;
  13670. } else {
  13671. zdAllergeCodes += "," + patientAllergenInfo.allergenCode;
  13672. zdAllergeTexts += "," + patientAllergenInfo.allergenName;
  13673. }
  13674. } else if (patientAllergenInfo.type == 1 || patientAllergenInfo.type == '1') {
  13675. ypDitList[ypDitList.length] = patientAllergenInfo.allergenCode;
  13676. ypDitListHtml += '<option value="' + patientAllergenInfo.allergenCode + '">' + patientAllergenInfo.allergenName + '</option>';
  13677. if (zdAllergeCodes == null) {
  13678. ypDitListodes = patientAllergenInfo.allergenCode;
  13679. ypDitListTexts = patientAllergenInfo.allergenName;
  13680. } else {
  13681. ypDitListodes += "," + patientAllergenInfo.allergenCode;
  13682. ypDitListTexts += "," + patientAllergenInfo.allergenName;
  13683. }
  13684. }
  13685. }
  13686. $("#editZdAllergen").empty();
  13687. $('#editZdAllergen').append(zdAllergenHtml);
  13688. $('#editZdAllergen').selectpicker('refresh');
  13689. $("#editYpDitList").empty();
  13690. $('#editYpDitList').append(ypDitListHtml);
  13691. $('#editYpDitList').selectpicker('refresh');
  13692. $("#editZdAllergen").selectpicker('val', zdAllergen);
  13693. $("#editZdAllergen").selectpicker('refresh');
  13694. $("#editYpDitList").selectpicker('val', ypDitList);
  13695. $("#editYpDitList").selectpicker('refresh');
  13696. $("#editZdAllergen").attr("selectedCodes", zdAllergeCodes);
  13697. $("#editZdAllergen").attr("selectedTexts", zdAllergeTexts);
  13698. $("#editYpDitList").attr("selectedCodes", ypDitListodes);
  13699. $("#editYpDitList").attr("selectedTexts", ypDitListTexts);
  13700. }
  13701. var tentativeDiagnosis = mzBlRecord.tentativeDiagnosis == null ? "" : mzBlRecord.tentativeDiagnosis;
  13702. if ((mzBlRecord.icdCode == null || mzBlRecord.icdCode == "") && mzBlRecord.icdText != null && mzBlRecord.icdText != "") {
  13703. if (tentativeDiagnosis == null || tentativeDiagnosis == "") {
  13704. tentativeDiagnosis = mzBlRecord.icdText;
  13705. } else {
  13706. tentativeDiagnosis = mzBlRecord.icdText + " " + tentativeDiagnosis;
  13707. }
  13708. }
  13709. $("#edittentativeDiagnosis").val(tentativeDiagnosis);
  13710. $("#editEmrJkjy").val(mzBlRecord.emrJkjy == null ? "" : mzBlRecord.emrJkjy);
  13711. $("#bl_weight").val(mzBlRecord.weight == 0 ? null : mzBlRecord.weight);
  13712. $("#bl_temperature").val(mzBlRecord.temperature == 0 ? null : mzBlRecord.temperature);
  13713. $("#bl_sphygmus").val(mzBlRecord.sphygmus == 0 ? null : mzBlRecord.sphygmus);
  13714. $("#bl_breathe").val(mzBlRecord.breathe == 0 ? null : mzBlRecord.breathe);
  13715. $("#bl_pressure_high").val(mzBlRecord.pressureHigh == 0 ? null : mzBlRecord.pressureHigh);
  13716. $("#bl_pressure_floor").val(mzBlRecord.pressureFloor == 0 ? null : mzBlRecord.pressureFloor);
  13717. $("#bl_pressure_high_left").val(mzBlRecord.pressureHighLeft == 0 ? null : mzBlRecord.pressureHighLeft);
  13718. $("#bl_pressure_floor_left").val(mzBlRecord.pressureFloorLeft == 0 ? null : mzBlRecord.pressureFloorLeft);
  13719. if (mzBlRecord.emrProcess != null && mzBlRecord.emrProcess != "") {
  13720. var reg = new RegExp("</br>", "g");//g,表示全部替换。
  13721. var editEmrProcess = mzBlRecord.emrProcess.replace(reg, "\n");
  13722. reg = new RegExp("&nbsp;", "g");//g,表示全部替换。
  13723. editEmrProcess = editEmrProcess.replace(reg, "");
  13724. $("#editEmrProcess").val(editEmrProcess);
  13725. } else {
  13726. $("#editEmrProcess").val("");
  13727. }
  13728. if (type == 1) {
  13729. $("#mzBlRecorTitle").html("门诊病历【编辑】");
  13730. $("#setOtherEmrProcess").removeClass("in").addClass("hide");
  13731. $("#openBlRecordModel").removeClass("hide").addClass("in");
  13732. $("#setEmrProcess").removeClass("hide").addClass("in");
  13733. $("#visitingDetailModal").modal("hide");
  13734. } else if (type == 2) {
  13735. $("#mzBlRecorTitle").html("门诊病历【预览】");
  13736. $("#setOtherEmrProcess").removeClass("hide").addClass("in");
  13737. $("#openBlRecordModel").removeClass("in").addClass("hide");
  13738. $("#setEmrProcess").removeClass("in").addClass("hide");
  13739. //因为预览的时候,关闭预览框没有清空数据,且 此时基础数据的病历次数被清空
  13740. if ($("#mzBlTimes").val() != null && $("#mzBlTimes").val() != "" && ($("#baseMzBlTimes").val() == null || $("#baseMzBlTimes").val() == "")) {
  13741. $("#baseMzBlTimes").val($("#mzBlTimes").val());
  13742. }
  13743. $("#otherBlRecordModal").modal("hide");
  13744. }
  13745. $("#mzBlTimes").val(mzBlRecord.times);
  13746. $("#editMzBlRecordModal").modal();
  13747. } else {
  13748. errorMesage(res);
  13749. }
  13750. }
  13751. });
  13752. }
  13753. /**
  13754. * 清空区域
  13755. */
  13756. function clearInput() {
  13757. //编辑病历的时候,没有基础病历的就诊次数,如果是预览病历的时候,有基础病历的次数
  13758. var baseMzBlTimes = $("#baseMzBlTimes").val();
  13759. $("#editPatientId").text(null);
  13760. $("#editPatientName").text(null);
  13761. $("#editPatientGender").text(null);
  13762. $("#editPatientAge").text(null);
  13763. $("#editEmrChiefComplaint").val(null);
  13764. $("#editEmrHpi").val(null);
  13765. $("#editEmrPs").val(null);
  13766. $("#editPersonalHistory").val(null);
  13767. $("#editFamilyHistory").val(null);
  13768. $("#editFzZl").val(null);
  13769. $("#editCrbHistory").val(null);
  13770. $("#editObstericalHistory").val(null);
  13771. $("#bl_weight").val(null);
  13772. $("#bl_sphygmus").val(null);
  13773. $("#bl_breathe").val(null);
  13774. $("#bl_pressure_high").val(null);
  13775. $("#bl_pressure_floor").val(null);
  13776. $("#bl_pressure_high_left").val(null);
  13777. $("#bl_pressure_floor_left").val(null);
  13778. $("#editQtjc").val(null);
  13779. $("#editZd").selectpicker('val', null);
  13780. $("#editZd").selectpicker('refresh');
  13781. $("#editTcmZd").selectpicker('val', null);
  13782. $("#editTcmZd").selectpicker('refresh');
  13783. $("#edittentativeDiagnosis").val(null);
  13784. $("#editEmrProcess").val(null);
  13785. $("#editEmrJkjy").val(null);
  13786. $("#mzBlTimes").val(null);
  13787. if (baseMzBlTimes != null && baseMzBlTimes != "") {
  13788. $("#otherBlRecordModal").modal();
  13789. }
  13790. }
  13791. /**
  13792. * 保存门诊病历
  13793. */
  13794. function setEmrProcess() {
  13795. $("#editMzBlRecordModal").modal("hide");
  13796. $("#messageModal").modal();
  13797. $("#messageContent").html("确认修改当前门诊病历吗?");
  13798. $("#messageButton").off("click").on("click", function (t) {
  13799. $("#messageModal").modal("hide");
  13800. sendEmrProcess();
  13801. });
  13802. $("#cancelButton").off("click").on("click", function (t) {
  13803. $("#editMzBlRecordModal").modal();
  13804. });
  13805. }
  13806. /**
  13807. * 提交保存门诊病历
  13808. */
  13809. function sendEmrProcess() {
  13810. //修改告警人员
  13811. var icdCodes = $("#editZd").val();
  13812. var icdCodeStr = null;
  13813. if (icdCodes != null && icdCodes.length > 0) {
  13814. for (var i = 0; i < icdCodes.length; i++) {
  13815. if (icdCodeStr == null) {
  13816. icdCodeStr = icdCodes[i];
  13817. } else {
  13818. icdCodeStr += "," + icdCodes[i];
  13819. }
  13820. }
  13821. }
  13822. //中医诊断
  13823. let tcmIcdCodes = $("#editTcmZd").val();
  13824. let tcmIcdCodeStr = null;
  13825. if (tcmIcdCodes != null && tcmIcdCodes.length > 0) {
  13826. for (let i = 0; i < tcmIcdCodes.length; i++) {
  13827. if (tcmIcdCodeStr == null) {
  13828. tcmIcdCodeStr = tcmIcdCodes[i];
  13829. } else {
  13830. tcmIcdCodeStr += "," + tcmIcdCodes[i];
  13831. }
  13832. }
  13833. }
  13834. //设置过敏源
  13835. var patientAllergenInfoList = [];
  13836. var zdAllergen = $("#editZdAllergen").val();
  13837. var ypDitList = $("#editYpDitList").val();
  13838. if (zdAllergen != null && zdAllergen.length > 0) {
  13839. for (var i = 0; i < zdAllergen.length; i++) {
  13840. var tempJson = JSON.parse('{}');
  13841. tempJson.allergenCode = zdAllergen[i];
  13842. tempJson.type = 0;
  13843. patientAllergenInfoList[patientAllergenInfoList.length] = tempJson;
  13844. }
  13845. }
  13846. if (ypDitList != null && ypDitList.length > 0) {
  13847. for (var i = 0; i < ypDitList.length; i++) {
  13848. var tempJson = JSON.parse('{}');
  13849. tempJson.allergenCode = ypDitList[i];
  13850. tempJson.type = 1;
  13851. patientAllergenInfoList[patientAllergenInfoList.length] = tempJson;
  13852. }
  13853. }
  13854. $.ajax({
  13855. type: "POST",
  13856. url: '/thmz/setEmrProcess',
  13857. contentType: "application/json;charset=UTF-8",
  13858. dataType: "json",
  13859. data: JSON.stringify({
  13860. "patientId": $("#editPatientId").text(),
  13861. "times": $("#mzBlTimes").val(),
  13862. "emrChiefComplaint": $("#editEmrChiefComplaint").val(),
  13863. "emrHpi": $("#editEmrHpi").val(),
  13864. "emrPs": $("#editEmrPs").val(),
  13865. "personalHistory": $("#editPersonalHistory").val(),
  13866. "familyHistory": $("#editFamilyHistory").val(),
  13867. "fzZl": $("#editFzZl").val(),
  13868. "crbHistory": $("#editCrbHistory").val(),
  13869. "obstericalHistory": $("#editObstericalHistory").val(),
  13870. "emrPe": $("#editQtjc").val(),
  13871. "weight": $("#bl_weight").val(),
  13872. "temperature": $("#bl_temperature").val(),
  13873. "sphygmus": $("#bl_sphygmus").val(),
  13874. "breathe": $("#bl_breathe").val(),
  13875. "pressureHigh": $("#bl_pressure_high").val(),
  13876. "pressureFloor": $("#bl_pressure_floor").val(),
  13877. "pressureHighLeft": $("#bl_pressure_high_left").val(),
  13878. "pressureFloorLeft": $("#bl_pressure_floor_left").val(),
  13879. "icdCode": icdCodeStr,
  13880. "tcmIcdCode": tcmIcdCodeStr,
  13881. "icdText": $('#editZd').next().attr("title"),
  13882. "tcmIcdText": $('#editTcmZd').next().attr("title"),
  13883. "tentativeDiagnosis": $("#edittentativeDiagnosis").val(),
  13884. "emrJkjy": $("#editEmrJkjy").val(),
  13885. "emrProcess": $("#editEmrProcess").val(),
  13886. "patientAllergenInfoList": patientAllergenInfoList
  13887. }),
  13888. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  13889. success: function (res) {
  13890. if (res == '401' || res == 401) {
  13891. window.location.href = '/thmz/login/view'
  13892. return;
  13893. }
  13894. if (res.code == 0) {
  13895. clearInput();
  13896. successMesage(res);
  13897. $("#editMzBlRecordModal").modal("hide");
  13898. } else {
  13899. errorMesage(res);
  13900. }
  13901. }
  13902. });
  13903. }
  13904. /**
  13905. * 打开待合并病历列表弹框
  13906. */
  13907. function openBlRecordModel() {
  13908. $("#editMzBlRecordModal").modal("hide");
  13909. $("#otherBlRecordModal").modal();
  13910. initOtherMzBlRecordList();
  13911. }
  13912. /**
  13913. * 关闭待合并病历列表
  13914. */
  13915. function closeBlRecordModel() {
  13916. $('#baseMzBlTimes').val(null);
  13917. $("#visitingDetailModal").modal();
  13918. }
  13919. /**
  13920. * 病历列表
  13921. */
  13922. function initOtherMzBlRecordList() {
  13923. $('#other_bl_record_table').bootstrapTable("destroy");
  13924. $('#other_bl_record_table').bootstrapTable({
  13925. url: '/thmz/getMzBlRecordList', //请求后台的URL(*)
  13926. method: 'post', //请求方式(*)
  13927. toolbar: '#toolbar', //工具按钮用哪个容器
  13928. striped: true, //是否显示行间隔色
  13929. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  13930. pagination: true, //是否显示分页(*)
  13931. sortable: true, //是否启用排序
  13932. sortOrder: "desc", //排序方式
  13933. queryParams: queryOtherParams, //传递参数(*)
  13934. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  13935. pageNumber: 1, //初始化加载第一页,默认第一页
  13936. pageSize: 5, //每页的记录行数(*)
  13937. pageList: [10, 15, 25, 50, 100], //可供选择的每页的行数(*)
  13938. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  13939. strictSearch: true,
  13940. showColumns: false, //是否显示所有的列
  13941. showRefresh: false, //是否显示刷新按钮
  13942. minimumCountColumns: 2, //最少允许的列数
  13943. clickToSelect: true, //是否启用点击选中行
  13944. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  13945. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  13946. cardView: false, //是否显示详细视图
  13947. detailView: false,
  13948. //rowStyle:rowStyle,//通过自定义函数设置行样式
  13949. ajaxOptions: {
  13950. headers: {
  13951. 'Accept': 'application/json',
  13952. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  13953. }
  13954. },
  13955. columns: [
  13956. {
  13957. title: '操作',
  13958. field: 'op',
  13959. align: "center",
  13960. valign: 'middle',
  13961. formatter: function (value, row, index) {
  13962. 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>';
  13963. return [str].join('');
  13964. }
  13965. },
  13966. {
  13967. field: 'patientId',
  13968. title: '门诊ID',
  13969. align: "center",
  13970. valign: 'middle'
  13971. }, {
  13972. field: 'patientName',
  13973. title: '患者姓名',
  13974. align: "center",
  13975. valign: 'middle'
  13976. }, {
  13977. field: 'deptCode',
  13978. title: '就诊科室',
  13979. align: "center",
  13980. valign: 'middle'
  13981. }, {
  13982. field: 'doctorCode',
  13983. title: '接诊医师',
  13984. align: "center",
  13985. valign: 'middle'
  13986. }, {
  13987. field: 'firstOrNot',
  13988. title: '初/复诊',
  13989. align: "center",
  13990. valign: 'middle',
  13991. formatter: function (value, row, index) {
  13992. if (value == '1') {
  13993. return "复诊";
  13994. }
  13995. return "初诊";
  13996. }
  13997. }
  13998. , {
  13999. field: 'visitDate',
  14000. title: '就诊时间',
  14001. align: "center",
  14002. valign: 'middle',
  14003. formatter: function (value, row, index) {
  14004. if (value == null || value == "") {
  14005. return "";
  14006. }
  14007. return format(value, "yyyy-MM-dd HH:mm:ss");
  14008. }
  14009. }
  14010. ],
  14011. responseHandler: function (res) {
  14012. if (res == '401' || res == 401) {
  14013. window.location.href = '/thmz/login/view'
  14014. return;
  14015. }
  14016. var ress = eval(res);
  14017. if (ress.code == -1) {
  14018. if (ress.message != null && ress.message != '') {
  14019. errorMesage(ress);
  14020. }
  14021. return {
  14022. "total": 0,//总页数
  14023. "rows": {} //数据
  14024. };
  14025. }
  14026. return {
  14027. "total": ress.total,//总页数
  14028. "rows": ress.data //数据
  14029. };
  14030. },
  14031. });
  14032. }
  14033. /**
  14034. * 构建列表查询参数
  14035. * @param params
  14036. * @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}}
  14037. */
  14038. function queryOtherParams(params) {
  14039. var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的
  14040. patientId: $("#editPatientId").text(),
  14041. exceptTimes: $("#mzBlTimes").val(),
  14042. pageSize: params.limit, //页面大小
  14043. pageIndex: params.offset / params.limit, //页码
  14044. };
  14045. return temp;
  14046. }
  14047. /**
  14048. * 提取处理意见保存
  14049. */
  14050. function setOtherEmrProcess() {
  14051. $("#editMzBlRecordModal").modal("hide");
  14052. $("#messageModal").modal();
  14053. $("#messageContent").html("确定要执行此次提取处理意见操作吗?");
  14054. $("#messageButton").off("click").on("click", function (t) {
  14055. $("#messageModal").modal("hide");
  14056. $.ajax({
  14057. type: "GET",
  14058. url: '/thmz/extractEmrProcess?patientId=' + $("#editPatientId").html() + '&baseTimes=' + $("#baseMzBlTimes").val() + '&times=' + $("#mzBlTimes").val(),
  14059. contentType: "application/json;charset=UTF-8",
  14060. dataType: "json",
  14061. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  14062. success: function (res) {
  14063. if (res == '401' || res == 401) {
  14064. window.location.href = '/thmz/login/view'
  14065. return;
  14066. }
  14067. if (res.code == 0) {
  14068. successMesage(res);
  14069. $("#editMzBlRecordModal").modal("hide");
  14070. } else {
  14071. errorMesage(res);
  14072. }
  14073. }
  14074. });
  14075. });
  14076. $("#cancelButton").off("click").on("click", function (t) {
  14077. $("#editMzBlRecordModal").modal();
  14078. });
  14079. }
  14080. /**
  14081. * 医保电子凭证读卡
  14082. * @param params
  14083. */
  14084. function siReadCard(params) {
  14085. $.ajax({
  14086. type: "GET",
  14087. url: params && params.startsWith('jiangsu_qrcode') ? 'http://localhost:8321/api/entry?param=' + params : 'http://localhost:8321/readcard/entry?param=' + params,
  14088. contentType: "application/json;charset=UTF-8",
  14089. dataType: "json",
  14090. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  14091. success: function (res) {
  14092. if (res == '401' || res == 401) {
  14093. window.location.href = '/thmz/login/view'
  14094. return;
  14095. }
  14096. //console.log(res);
  14097. if (res.code == 200) {
  14098. var data = JSON.parse(res.data);
  14099. queryUserInfoBySocialNoNotFillPatient('rapidAcceptsUserCardNo', "" + data.data.idNo + "", queryUserInfoByCardNo, 'rapidAcceptsModal');
  14100. } else {
  14101. errorMesage(res);
  14102. }
  14103. }
  14104. });
  14105. // window.open('ReadCard://'+prm, '_self')
  14106. }
  14107. /**
  14108. * 西药品类按钮点击事件 因为原插件有点未解决bug,点击title的时候,加载的列表非对应的,
  14109. * @param paneId
  14110. */
  14111. function xyTableOnClick(paneId) {
  14112. setTimeout(function () {
  14113. $("#xyTabContent div.tab-pane").each(function (index, obj) {
  14114. var targetId = $(obj).attr("id");
  14115. //如果处方内容是空的,就删除没有处方
  14116. if ($(obj).find("div.cf_content").children().length == 0) {
  14117. $(obj).remove();
  14118. $("[href='#" + targetId + "']").parent().remove();
  14119. } else if (targetId == paneId) {
  14120. $(obj).addClass("active").addClass("in");
  14121. } else {
  14122. $(obj).removeClass("active").removeClass("in");
  14123. }
  14124. });
  14125. }, 400);
  14126. }
  14127. /**
  14128. * 打开转诊弹层
  14129. */
  14130. function transferTreatment() {
  14131. $("#turnDept").selectpicker({
  14132. size: 5
  14133. });
  14134. $("#turnToConsultationTitle").html("转诊");
  14135. $("#opType").val(1);
  14136. $("#turnToConsultationDoctorDiv").removeClass("hide").addClass("in");
  14137. $("#turnDeptDiv").removeClass("hide").addClass("in");
  14138. $("#consultationDeptDiv").removeClass("in").addClass("hide");
  14139. //科室列表
  14140. $.ajax({
  14141. type: "GET",
  14142. url: '/thmz/getUnitCodeByRequestDay',
  14143. dataType: "json",
  14144. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  14145. success: function (data) {
  14146. if (data == '401' || data == 401) {
  14147. window.location.href = '/thmz/login/view'
  14148. return;
  14149. }
  14150. var html = '';
  14151. $.each(data.data, function (commentIndex, comment) {
  14152. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';
  14153. });
  14154. $('#turnDept').empty();
  14155. $('#turnDept').html(html);
  14156. $('#turnDept').selectpicker('refresh');
  14157. }
  14158. });
  14159. $("#turnToConsultationModal").modal();
  14160. }
  14161. /**
  14162. * 打开会诊弹层
  14163. */
  14164. function consultation() {
  14165. $("#consultationDept").selectpicker({
  14166. size: 5
  14167. });
  14168. $("#turnToConsultationTitle").html("发起会诊");
  14169. $("#opType").val(2);
  14170. $("#turnToConsultationDoctorDiv").removeClass("in").addClass("hide");
  14171. $("#consultationDeptDiv").removeClass("hide").addClass("in");
  14172. $("#turnDeptDiv").removeClass("in").addClass("hide");
  14173. //科室列表
  14174. $.ajax({
  14175. type: "GET",
  14176. url: '/thmz/allMzUnitCode',
  14177. dataType: "json",
  14178. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  14179. success: function (res) {
  14180. if (res == '401' || res == 401) {
  14181. window.location.href = '/thmz/login/view'
  14182. return;
  14183. }
  14184. var html = '';
  14185. $.each(res.data, function (commentIndex, comment) {
  14186. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';
  14187. });
  14188. $('#consultationDept').empty();
  14189. $('#consultationDept').html(html);
  14190. $('#consultationDept').selectpicker('refresh');
  14191. $.ajax({
  14192. type: "GET",
  14193. url: '/thmz/getUnConsultation?serialNo=' + $("#mzfzSerialNoInClick").val(),
  14194. dataType: "json",
  14195. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  14196. success: function (res) {
  14197. if (res == '401' || res == 401) {
  14198. window.location.href = '/thmz/login/view'
  14199. return;
  14200. }
  14201. var data = res.data;
  14202. if (data != null && data.length > 0) {
  14203. $('#consultationDept').selectpicker('val', data);
  14204. $('#consultationDept').selectpicker('refresh');
  14205. }
  14206. }
  14207. });
  14208. }
  14209. });
  14210. $("#turnToConsultationModal").modal();
  14211. }
  14212. /**
  14213. * 清空转诊和发起会诊区域
  14214. */
  14215. function clearTurnToConsultationInput() {
  14216. $("#turnDept").selectpicker('val', null);
  14217. $("#turnDept").selectpicker('refresh');
  14218. $("#consultationDept").selectpicker('val', null);
  14219. $("#consultationDept").selectpicker('refresh');
  14220. $("#turnToConsultationDoctor").selectpicker('val', null);
  14221. $("#turnToConsultationDoctor").selectpicker('refresh');
  14222. $("#turnToConsultationId").val(null);
  14223. $("#opType").val(null);
  14224. $("#turnToConsultationDoctorDiv").removeClass("in").addClass("hide");
  14225. $("#turnDeptDiv").removeClass("in").addClass("hide");
  14226. $("#consultationDeptDiv").removeClass("in").addClass("hide");
  14227. }
  14228. /**
  14229. * 清空门诊统筹额外内容区域
  14230. */
  14231. function clearExpContentRequired() {
  14232. $("#mdtrtGrpType").selectpicker('val', null);
  14233. $("#mdtrtGrpType").selectpicker('refresh');
  14234. $("#trumFlag").selectpicker('val', null);
  14235. $("#trumFlag").selectpicker('refresh');
  14236. $("#relTtpFlag").selectpicker('val', null);
  14237. $("#relTtpFlag").selectpicker('refresh');
  14238. $("#otpErReflFlag").selectpicker('val', null);
  14239. $("#otpErReflFlag").selectpicker('refresh');
  14240. }
  14241. /**
  14242. * 清空门诊统筹支付参数区域
  14243. */
  14244. function clearZgtczfInput() {
  14245. $("#zgmztczf").selectpicker('val', null);
  14246. $("#zgmztczf").selectpicker('refresh');
  14247. $("#grzhzf").selectpicker('val', null);
  14248. $("#grzhzf").selectpicker('refresh');
  14249. $("#readCardResult").val(null);
  14250. }
  14251. /**
  14252. * 保存转诊/会诊
  14253. */
  14254. function setTurnToConsultation() {
  14255. $("#turnToConsultationModal").modal("hide");
  14256. $("#messageModal").modal();
  14257. var opType = $("#opType").val();
  14258. var targetDeptNo = $("#turnDept").val();
  14259. var title = "确认提交转诊操作吗,提交后您将无法继续接诊该患者?";
  14260. if (opType == 2 || opType == "2") {
  14261. title = "确认提交本次会诊操作吗?";
  14262. var consultationDept = $("#consultationDept").val();
  14263. if (consultationDept != null && consultationDept.length > 0) {
  14264. targetDeptNo = null;
  14265. for (var i = 0; i < consultationDept.length; i++) {
  14266. if (targetDeptNo == null) {
  14267. targetDeptNo = consultationDept[i];
  14268. } else {
  14269. targetDeptNo += "," + consultationDept[i];
  14270. }
  14271. }
  14272. }
  14273. }
  14274. $("#messageContent").html(title);
  14275. $("#messageButton").off("click").on("click", function (t) {
  14276. $("#messageModal").modal("hide");
  14277. $.ajax({
  14278. type: "POST",
  14279. url: '/thmz/saveTurnToConsultation',
  14280. contentType: "application/json;charset=UTF-8",
  14281. dataType: "json",
  14282. data: JSON.stringify({
  14283. "id": $("#turnToConsultationId").val(),
  14284. "opType": opType,
  14285. "targetDeptNo": targetDeptNo,
  14286. "targetDoctorNo": $("#turnToConsultationDoctor").val(),
  14287. "serialNo": $("#mzfzSerialNoInClick").val(),
  14288. "remark": $("#turnToConsultationRemark").val(),
  14289. }),
  14290. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  14291. success: function (res) {
  14292. if (res == '401' || res == 401) {
  14293. window.location.href = '/thmz/login/view'
  14294. return;
  14295. }
  14296. if (res.code == 0) {
  14297. successMesage(res);
  14298. clearTurnToConsultationInput();
  14299. if (opType == 1 || opType == "1") {
  14300. //加载候诊患者列表
  14301. loadUnClinicTableList();
  14302. //加载接诊中患者列表
  14303. loadInClinicTableList();
  14304. clearWorkSpace();
  14305. }
  14306. } else {
  14307. $("#turnToConsultationModal").modal();
  14308. errorMesage(res);
  14309. }
  14310. }
  14311. });
  14312. });
  14313. $("#cancelButton").off("click");
  14314. }
  14315. /**
  14316. * 初始医生下拉选
  14317. * @param ampm 时间段区间
  14318. */
  14319. function initEmployee() {
  14320. var opType = $("#opType").val();
  14321. if (opType == 2) {
  14322. return;
  14323. }
  14324. $("#turnToConsultationDoctor").selectpicker({
  14325. size: 5
  14326. });
  14327. //医生列表
  14328. $.ajax({
  14329. type: "GET",
  14330. url: '/thmz/getDoctorCodeByRequestDay?unitCode=' + $('#turnDept').val(),
  14331. dataType: "json",
  14332. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  14333. success: function (res) {
  14334. if (res == '401' || res == 401) {
  14335. window.location.href = '/thmz/login/view'
  14336. return;
  14337. }
  14338. var html = '';
  14339. var defaultCode = null;
  14340. $.each(res.data, function (commentIndex, comment) {
  14341. var employeeName = comment.employee.employeeName;
  14342. if (comment.leftNum != null) {
  14343. employeeName = employeeName + " 余号(" + comment.leftNum + ")"
  14344. }
  14345. html += '<option value="' + comment.employee.employeeCode + '" data-chargeType="' + comment.chargeType + '" data-checkFee="' + comment.checkFee + '" data-mzyRequestId="' + comment.mzyRequestId + '">' + employeeName + '</option>';
  14346. if (res.data.length == 1) {
  14347. //如果只有一个号别,默认选中
  14348. defaultCode = comment.employee.employeeCode;
  14349. }
  14350. });
  14351. $('#turnToConsultationDoctor').empty();
  14352. $('#turnToConsultationDoctor').html(html);
  14353. $('#turnToConsultationDoctor').selectpicker('refresh');
  14354. if (defaultCode != null) {
  14355. //如果有无需选择医生的选项,默认选择
  14356. $('#turnToConsultationDoctor').selectpicker('val', defaultCode);
  14357. $('#turnToConsultationDoctor').selectpicker('refresh');
  14358. }
  14359. }
  14360. });
  14361. }
  14362. /**
  14363. * 设置挂号号别
  14364. * @param patientId
  14365. * @param times
  14366. * @param reqType
  14367. */
  14368. function setMzReqType(patientId,times,reqType) {
  14369. if(stringIsBlank(reqType)){
  14370. postAjaxJsonHttpRequst("/thmz/queryMzOrderDetails",{patientId:patientId,times:times},true,function (res) {
  14371. if(res.code == 0 && res.data != null){
  14372. $("#mzReqTypeName").text(res.data.reqTypeName)
  14373. $("#mzReqType").val(res.data.reqType)
  14374. if(res.data.reqType == '45') {
  14375. $("#mzOrderTypeSelect").val('4');
  14376. $('#mzOrderTypeSelect').selectpicker('refresh');
  14377. }
  14378. }
  14379. })
  14380. }else {
  14381. getAjaxRequst("/thmz/getMzChargeTypeByCode",{code:reqType},true,function (res) {
  14382. if(res.code == 0 && res.data != null){
  14383. $("#mzReqType").val(reqType)
  14384. $("#mzReqTypeName").text(res.data.name)
  14385. if(reqType == '45'){
  14386. $("#mzOrderTypeSelect").val('4');
  14387. $('#mzOrderTypeSelect').selectpicker('refresh');
  14388. }
  14389. }
  14390. })
  14391. }
  14392. }
  14393. /**
  14394. * 选择处方类型进行效验
  14395. */
  14396. function verifyMzOrderType() {
  14397. let mzOrderTypeSelectVal = $("#mzOrderTypeSelect").val();
  14398. if(mzOrderTypeSelectVal == '3'){
  14399. if(stringIsBlank(curOpspDiseCode)){
  14400. errorMesageSimaple('不是特门病人,请先点击[查询特门]并选中特门编码!')
  14401. $("#mzOrderTypeSelect").val('1');
  14402. $('#mzOrderTypeSelect').selectpicker('refresh');
  14403. return
  14404. }
  14405. }
  14406. let mzReqTypeVal = $("#mzReqType").val()
  14407. if(mzOrderTypeSelectVal == '4' && mzReqTypeVal != '45'){
  14408. errorMesageSimaple('当前病人不是GCP实验类型,不能选择该选项!')
  14409. $("#mzOrderTypeSelect").val('1');
  14410. $('#mzOrderTypeSelect').selectpicker('refresh');
  14411. return
  14412. }
  14413. }
  14414. /**
  14415. * 初始化门诊处方类型下拉框
  14416. */
  14417. function initMzOrderTypeSelect() {
  14418. getAjaxRequst("/thmz/queryMzOrderType",{},true,function (res) {
  14419. let html = ''
  14420. $.each(res.data, function (commentIndex, comment) {
  14421. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  14422. });
  14423. $('#mzOrderTypeSelect').empty();
  14424. $('#mzOrderTypeSelect').html(html);
  14425. $('#mzOrderTypeSelect').selectpicker('refresh');
  14426. $('#mzOrderTypeSelect').val('1');
  14427. $('#mzOrderTypeSelect').selectpicker('refresh');
  14428. })
  14429. }
  14430. /**
  14431. * 选择门诊统筹支付时校验门诊诊断是否是标准诊断,校验医生是否具有医保编码
  14432. */
  14433. function verifyInsuranceInfo() {
  14434. var zgmztczf = $("#zgmztczf").val();
  14435. if (zgmztczf != null && (zgmztczf == 1 || zgmztczf == "1")) {
  14436. $('#mzOrderTypeSelect').val('2');
  14437. $('#mzOrderTypeSelect').selectpicker('refresh');
  14438. postAjaxJsonHttpRequst("/thmz/queryVisitTypeName",{patientId:$("#patientId").text()},true,function (res) {
  14439. if(res.code ==0){
  14440. if(!stringIsBlank(res.data)){
  14441. warningMesageSimaple("该患者为股东卡用户,选择医保门诊统筹将不能享受股东卡优惠,请告知患者,请悉知!")
  14442. }
  14443. }
  14444. })
  14445. var diagnoseValue = $("#diagnoseValue").val();
  14446. if (diagnoseValue == null || diagnoseValue == "" || diagnoseValue.length == 0) {
  14447. errorMesageSimaple("门诊统筹就诊必须使用标准的医保诊断,请修改诊断或者消门诊统筹选项");
  14448. // $("#zgmztczf").selectpicker('val', null);
  14449. // $("#zgmztczf").selectpicker('refresh');
  14450. return false;
  14451. }
  14452. diagnoseValue = diagnoseValue.replace(/,/g, "");
  14453. if (diagnoseValue == null || diagnoseValue == "" || diagnoseValue.length == 0) {
  14454. errorMesageSimaple("门诊统筹就诊必须使用标准的医保诊断,请修改诊断或者消门诊统筹选项");
  14455. // $("#zgmztczf").selectpicker('val', null);
  14456. // $("#zgmztczf").selectpicker('refresh');
  14457. return false;
  14458. }
  14459. var ybCode = localStorage.getItem("ybCode");
  14460. if (ybCode == null || ybCode == "" || ybCode.length == 0) {
  14461. errorMesageSimaple("您还没有医保赋码,无法进行门诊统筹接诊,请取消门诊统筹选项");
  14462. // $("#zgmztczf").selectpicker('val', null);
  14463. // $("#zgmztczf").selectpicker('refresh');
  14464. return false;
  14465. }
  14466. }else {
  14467. if($('#mzOrderTypeSelect').val() =='2'){
  14468. $('#mzOrderTypeSelect').val('1');
  14469. $('#mzOrderTypeSelect').selectpicker('refresh');
  14470. }
  14471. }
  14472. return true;
  14473. }
  14474. /**
  14475. * 已诊列表发起会诊
  14476. * @param patientId
  14477. */
  14478. function consultationCliniced(patientId) {
  14479. $.ajax({
  14480. type: "GET",
  14481. url: '/thmz/getLastClinicedFzOrder?patientId=' + patientId,
  14482. dataType: "json",
  14483. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  14484. success: function (res) {
  14485. if (res == '401' || res == 401) {
  14486. window.location.href = '/thmz/login/view'
  14487. return;
  14488. }
  14489. if (res.code == 0) {
  14490. $("#visitingDetailModal").modal("hide");
  14491. $("#mzfzSerialNoInClick").val(res.data.serialNo);
  14492. consultation();
  14493. } else {
  14494. errorMesage(res);
  14495. }
  14496. }
  14497. });
  14498. }
  14499. /**
  14500. * 计算诊疗金额
  14501. * @param flag true ,直接计算总价, false 还要计算总量
  14502. */
  14503. function calculateZl(flag) {
  14504. if (!flag) {
  14505. var itemQuantity = $("#itemQuantity").val();
  14506. if (itemQuantity == null) {
  14507. return;
  14508. }
  14509. var dayZlNum = $("#dayZlNum").val();
  14510. if (dayZlNum == null) {
  14511. return;
  14512. }
  14513. //频率
  14514. var times = $('#orderFrequencyZl').find("option:selected").attr('desc');
  14515. if (times == null) {
  14516. return;
  14517. }
  14518. var totalNumZl = Multiply(Multiply(itemQuantity, dayZlNum), times);
  14519. $("#totalNumZl").val(totalNumZl);
  14520. }
  14521. //总量
  14522. var totalNumZl = $("#totalNumZl").val();
  14523. if (totalNumZl == null) {
  14524. return;
  14525. }
  14526. //单价
  14527. var zlItemPrice = $("#zlItemPrice").val();
  14528. if (zlItemPrice == null) {
  14529. return;
  14530. }
  14531. $("#totalAmountZl").val(Multiply(totalNumZl, zlItemPrice));
  14532. }
  14533. /**
  14534. *打印外伤无第三方责任承诺书
  14535. */
  14536. function printNoThirdParty() {
  14537. printNoThirdPartyCommon(1);
  14538. }
  14539. /**
  14540. * 打印外伤无第三方责任承诺书
  14541. * @param printType 打印模式 1 预览打印 2 打印设置
  14542. */
  14543. function printNoThirdPartyCommon(printType) {
  14544. warningMesageSimaple("请提醒患者至医保窗口审核,审核通过方能报销!");
  14545. var title = "外伤无第三方责任承诺书";
  14546. setPrint();
  14547. LODOP = getLodop();
  14548. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", hospitalName + title);
  14549. LODOP.SET_PRINT_STYLE("FontSize", 7); //字体大小
  14550. //设置默认打印机
  14551. LODOP.SET_PRINTER_INDEX(printIndex);
  14552. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  14553. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  14554. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  14555. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", title);//对新建的纸张重命名
  14556. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  14557. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  14558. // var strStyle = "<style>table{width: 96%;}</style>";
  14559. var strStyle = "<style>table{width: 96%;margin-top: 20px;margin-bottom: 10px;} table,th {border-width: 1px;border-style: solid;border-collapse: collapse}</style>";
  14560. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("print_no_third_party_table").innerHTML);
  14561. if (printType == 1) {
  14562. LODOP.PREVIEW();
  14563. } else if (printType == 2) {
  14564. LODOP.PRINT_SETUP();
  14565. }
  14566. }
  14567. /**
  14568. * 打印自费承诺书
  14569. */
  14570. function printSelfPay() {
  14571. printSelfPayCommon(1);
  14572. }
  14573. /**
  14574. * 打印自费承诺书
  14575. * @param printType 打印模式 1 预览打印 2 打印设置
  14576. */
  14577. function printSelfPayCommon(printType) {
  14578. var title = "参保人员门诊统筹医保支付告知审核表";
  14579. setPrint();
  14580. LODOP = getLodop();
  14581. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", hospitalName + title);
  14582. LODOP.SET_PRINT_STYLE("FontSize", 7); //字体大小
  14583. //设置默认打印机
  14584. LODOP.SET_PRINTER_INDEX(printIndex);
  14585. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  14586. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  14587. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  14588. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", title);//对新建的纸张重命名
  14589. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  14590. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  14591. // var strStyle = "<style>table{width: 96%;}</style>";
  14592. //table,th {border-width: 1px;border-style: solid;border-collapse: collapse}
  14593. var strStyle = "<style>table{width: 96%;margin-top: 20px;margin-bottom: 10px;} </style>";
  14594. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("self_pay_table").innerHTML);
  14595. if (printType == 1) {
  14596. LODOP.PREVIEW();
  14597. } else if (printType == 2) {
  14598. LODOP.PRINT_SETUP();
  14599. }
  14600. }
  14601. /**
  14602. * 将科室缓存到内存中
  14603. */
  14604. function saveDeptConfig() {
  14605. var clinicDeptNo = $("#clinicDeptNo").val();
  14606. if (clinicDeptNo != null && clinicDeptNo != "") {
  14607. var userIdCode = localStorage.getItem("userIdCode");
  14608. localStorage.setItem(userIdCode, clinicDeptNo);
  14609. }
  14610. $("#selectDeptModal").modal("hide");
  14611. }
  14612. /**
  14613. * 合理用药药品说明书
  14614. */
  14615. function hlyyypsms() {
  14616. $("#western_medicine_name").webuiPopover('hide');
  14617. var code = $("#western_medicine_current_code").val();
  14618. var serial = $("#western_medicine_current_serial").val();
  14619. $("#hlyyTitle").html("药品说明书");
  14620. showHlyyModel('hlyysmsDiv', 'hlyysmsLoading', 'hlyysmsModal', "http://172.16.32.121:9097/web/sms/hpms_medi_show.aspx?his_code=" + code + "_" + serial);
  14621. }
  14622. /**
  14623. * 预约挂号
  14624. * @param patientId
  14625. */
  14626. function registration(patientId) {
  14627. clearRegistrationModal();
  14628. $("#patientIdRegistration").val(patientId);
  14629. $("#visitingDetailModal").modal('hide');
  14630. $("#registrationModal").modal();
  14631. }
  14632. /**
  14633. * 初始门诊时间区间下拉选
  14634. */
  14635. function initMzWorkTime() {
  14636. $("#ampm").selectpicker({
  14637. size: 10
  14638. });
  14639. $.ajax({
  14640. type: "GET",
  14641. url: '/thmz/getMzWorkTime',
  14642. dataType: "json",
  14643. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  14644. success: function (res) {
  14645. if (res == '401' || res == 401) {
  14646. window.location.href = '/thmz/login/view'
  14647. return;
  14648. }
  14649. var html = '';
  14650. var ampm = null;
  14651. $.each(res.data, function (commentIndex, comment) {
  14652. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  14653. // if (ampm == null || (ampm != "a" && ampm != "p")) {
  14654. // var startTime = paseToFullTime(comment.startTime);
  14655. // var endTime = paseToFullTime(comment.endTime);
  14656. // if (range(startTime, endTime)) {
  14657. // ampm = comment.code;
  14658. // }
  14659. // }
  14660. });
  14661. $('#ampm').empty(); //清空resText里面的所有内容
  14662. $('#ampm').html(html);
  14663. $('#ampm').selectpicker('refresh');
  14664. // $("#ampm").selectpicker('val', ampm);
  14665. // $('#ampm').selectpicker('refresh');
  14666. initDeptPlus(1);
  14667. }
  14668. });
  14669. }
  14670. /**
  14671. * 初始科室下拉选
  14672. * @param ampm 时间段区间
  14673. */
  14674. function initDeptPlus(type) {
  14675. var ampm = $("#ampm").val();
  14676. if (type == 1) {
  14677. setAmTimes(ampm);
  14678. }
  14679. $("#deptNo").selectpicker({
  14680. size: 10
  14681. });
  14682. var apTimes = $("#apTimes").val();
  14683. //科室列表
  14684. $.ajax({
  14685. type: "GET",
  14686. url: '/thmz/getUnitCodeByRequestDayAndAmpm?ampm=' + $("#ampm").val() + '&date=' + $("#registrationTime").val() + "&apTimes=" + apTimes,
  14687. dataType: "json",
  14688. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  14689. success: function (data) {
  14690. if (data == '401' || data == 401) {
  14691. window.location.href = '/thmz/login/view'
  14692. return;
  14693. }
  14694. var html = '';
  14695. $.each(data.data, function (commentIndex, comment) {
  14696. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';
  14697. });
  14698. $('#deptNo').empty();
  14699. $('#deptNo').html(html);
  14700. $('#deptNo').selectpicker('refresh');
  14701. $('#chargeType').empty();
  14702. $('#chargeType').selectpicker('refresh');
  14703. emptyInput();
  14704. }
  14705. });
  14706. }
  14707. /**
  14708. * 设置时间下拉选
  14709. * @param ampm
  14710. */
  14711. function setAmTimes(ampm) {
  14712. if (ampm == "a" || ampm == "p") {
  14713. $("#apTimesDiv").removeClass("hide").addClass("in");
  14714. $("#doctorDiv").css("margin-top", "10px");
  14715. var timeHtml = null;
  14716. var defaultTime = null;
  14717. var date = new Date($("#registrationTime").val());
  14718. var currentDate = getCurrentDate();
  14719. var afterToday = date.getTime() > currentDate.getTime();
  14720. if (ampm == "a") {
  14721. if (afterToday || range(paseToFullTime("00:00"), paseToFullTime("08:30"))) {
  14722. defaultTime = "a1";
  14723. timeHtml = '<option value="a1">08:00-08:30</option><option value="a2">08:30-09:00</option><option value="a3">09:00-09:30</option><option value="a4">09:30-10:00</option><option value="a5">10:00-10:30</option><option value="a6">10:30-11:00</option><option value="a7">11:00-11:30</option><option value="a8">11:30-12:00</option>';
  14724. } else if (range(paseToFullTime("08:30"), paseToFullTime("09:00"))) {
  14725. defaultTime = "a2";
  14726. timeHtml = '<option value="a2">08:30-09:00</option><option value="a3">09:00-09:30</option><option value="a4">09:30-10:00</option><option value="a5">10:00-10:30</option><option value="a6">10:30-11:00</option><option value="a7">11:00-11:30</option><option value="a8">11:30-12:00</option>';
  14727. } else if (range(paseToFullTime("09:00"), paseToFullTime("09:30"))) {
  14728. defaultTime = "a3";
  14729. timeHtml = '<option value="a3">09:00-09:30</option><option value="a4">09:30-10:00</option><option value="a5">10:00-10:30</option><option value="a6">10:30-11:00</option><option value="a7">11:00-11:30</option><option value="a8">11:30-12:00</option>';
  14730. } else if (range(paseToFullTime("09:30"), paseToFullTime("10:00"))) {
  14731. defaultTime = "a4";
  14732. timeHtml = '<option value="a4">09:30-10:00</option><option value="a5">10:00-10:30</option><option value="a6">10:30-11:00</option><option value="a7">11:00-11:30</option><option value="a8">11:30-12:00</option>';
  14733. } else if (range(paseToFullTime("10:00"), paseToFullTime("10:30"))) {
  14734. defaultTime = "a5";
  14735. timeHtml = '<option value="a5">10:00-10:30</option><option value="a6">10:30-11:00</option><option value="a7">11:00-11:30</option><option value="a8">11:30-12:00</option>';
  14736. } else if (range(paseToFullTime("10:30"), paseToFullTime("11:00"))) {
  14737. defaultTime = "a6";
  14738. timeHtml = '<option value="a6">10:30-11:00</option><option value="a7">11:00-11:30</option><option value="a8">11:30-12:00</option>';
  14739. } else if (range(paseToFullTime("11:00"), paseToFullTime("11:30"))) {
  14740. defaultTime = "a7";
  14741. timeHtml = '<option value="a7">11:00-11:30</option><option value="a8">11:30-12:00</option>';
  14742. } else if (range(paseToFullTime("11:30"), paseToFullTime("12:00"))) {
  14743. defaultTime = "a8";
  14744. timeHtml = '<option value="a8">11:30-12:00</option>';
  14745. }
  14746. } else {
  14747. if (afterToday || range(paseToFullTime("00:00"), paseToFullTime("14:30"))) {
  14748. defaultTime = "p1";
  14749. timeHtml = '<option value="p1">14:00-14:30</option><option value="p2">14:30-15:00</option><option value="p3">15:00-15:30</option><option value="p4">15:30-16:00</option><option value="p5">16:00-16:30</option><option value="p6">16:30-17:00</option><option value="p7">17:00-17:30</option>';
  14750. } else if (range(paseToFullTime("14:30"), paseToFullTime("15:00"))) {
  14751. defaultTime = "p2";
  14752. timeHtml = '<option value="p2">14:30-15:00</option><option value="p3">15:00-15:30</option><option value="p4">15:30-16:00</option><option value="p5">16:00-16:30</option><option value="p6">16:30-17:00</option><option value="p7">17:00-17:30</option>';
  14753. } else if (range(paseToFullTime("15:00"), paseToFullTime("15:30"))) {
  14754. defaultTime = "p3";
  14755. timeHtml = '<option value="p3">15:00-15:30</option><option value="p4">15:30-16:00</option><option value="p5">16:00-16:30</option><option value="p6">16:30-17:00</option><option value="p7">17:00-17:30</option>';
  14756. } else if (range(paseToFullTime("15:30"), paseToFullTime("16:00"))) {
  14757. defaultTime = "p4";
  14758. timeHtml = '<option value="p4">15:30-16:00</option><option value="p5">16:00-16:30</option><option value="p6">16:30-17:00</option><option value="p7">17:00-17:30</option>';
  14759. } else if (range(paseToFullTime("16:00"), paseToFullTime("16:30"))) {
  14760. defaultTime = "p5";
  14761. timeHtml = '<option value="p5">16:00-16:30</option><option value="p6">16:30-17:00</option><option value="p7">17:00-17:30</option>';
  14762. } else if (range(paseToFullTime("16:30"), paseToFullTime("17:00"))) {
  14763. defaultTime = "p6";
  14764. timeHtml = '<option value="p6">16:30-17:00</option><option value="p7">17:00-17:30</option>';
  14765. } else if (range(paseToFullTime("17:00"), paseToFullTime("17:30"))) {
  14766. defaultTime = "p7";
  14767. timeHtml = '<option value="p7">17:00-17:30</option>';
  14768. }
  14769. }
  14770. $('#apTimes').html(timeHtml);
  14771. $('#apTimes').selectpicker('refresh');
  14772. $("#apTimes").selectpicker('val', defaultTime);
  14773. $('#apTimes').selectpicker('refresh');
  14774. $("#chargeTypeDiv").css("margin-top", "10px");
  14775. $("#apTimesDiv").removeClass("hide").addClass("in");
  14776. } else {
  14777. $("#apTimes").selectpicker('val', null);
  14778. $('#apTimes').selectpicker('refresh');
  14779. $("#apTimesDiv").removeClass("in").addClass("hide");
  14780. $("#chargeTypeDiv").css("margin-top", "0px");
  14781. }
  14782. }
  14783. /**
  14784. * 初始门诊号别下拉选
  14785. */
  14786. function initChargeType() {
  14787. $.ajax({
  14788. type: "GET",
  14789. url: '/thmz/getChargeTypeByRequestDayAndDoctor?unitCode=' + $('#deptNo').val() + "&ampm=" + $("#ampm").val() + '&date=' + $("#registrationTime").val() + "&apTime=" + $("#apTimes").val(),
  14790. dataType: "json",
  14791. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  14792. success: function (res) {
  14793. if (res == '401' || res == 401) {
  14794. window.location.href = '/thmz/login/view'
  14795. return;
  14796. }
  14797. var html = '';
  14798. var defaultCode = null;
  14799. $.each(res.data, function (commentIndex, comment) {
  14800. if (res.data.length == 1) {
  14801. //如果只有一个号别,默认选中
  14802. defaultCode = comment.code;
  14803. }
  14804. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  14805. });
  14806. $('#chargeType').empty(); //清空resText里面的所有内容
  14807. $('#chargeType').html(html);
  14808. $('#chargeType').selectpicker('refresh');
  14809. if (defaultCode != null) {
  14810. //如果有默认选项,默认选择
  14811. $('#chargeType').selectpicker('val', defaultCode);
  14812. $('#chargeType').selectpicker('refresh');
  14813. initDoctorInfo();
  14814. }
  14815. emptyInput();
  14816. }
  14817. });
  14818. }
  14819. /**
  14820. * 初始医生下拉选
  14821. * @param ampm 时间段区间
  14822. */
  14823. function initDoctorInfo() {
  14824. $("#doctorInfo").selectpicker({
  14825. size: 10
  14826. });
  14827. //医生列表
  14828. $.ajax({
  14829. type: "GET",
  14830. url: '/thmz/getDoctorCodeByRequestDayAndDoctor?unitCode=' + $('#deptNo').val() + "&ampm=" + $("#ampm").val() + "&chargeType=" + $("#chargeType").val() + '&date=' + $("#registrationTime").val() + "&apTime=" + $("#apTimes").val(),
  14831. dataType: "json",
  14832. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  14833. success: function (res) {
  14834. if (res == '401' || res == 401) {
  14835. window.location.href = '/thmz/login/view'
  14836. return;
  14837. }
  14838. var html = '';
  14839. var defaultCode = null;
  14840. $.each(res.data, function (commentIndex, comment) {
  14841. var employeeName = comment.employee.employeeName;
  14842. if (comment.leftNum != null) {
  14843. employeeName = employeeName + " 余号(" + comment.leftNum + ")"
  14844. }
  14845. html += '<option value="' + comment.employee.employeeCode + '" data-chargeType="' + comment.chargeType + '" data-checkFee="' + comment.checkFee + '" data-mzyRequestId="' + comment.mzyRequestId + '">' + employeeName + '</option>';
  14846. if (res.data.length == 1) {
  14847. //如果只有一个号别,默认选中
  14848. defaultCode = comment.employee.employeeCode;
  14849. }
  14850. });
  14851. $('#doctorInfo').empty();
  14852. $('#doctorInfo').html(html);
  14853. $('#doctorInfo').selectpicker('refresh');
  14854. //validator.checkAll($("#regi_form"));
  14855. if (defaultCode != null) {
  14856. //如果有无需选择医生的选项,默认选择
  14857. $('#doctorInfo').selectpicker('val', defaultCode);
  14858. $('#doctorInfo').selectpicker('refresh');
  14859. fitFee();
  14860. }
  14861. }
  14862. });
  14863. }
  14864. /**
  14865. * 设置挂号费等费用
  14866. */
  14867. function fitFee() {
  14868. var mzyRequestId = $('#doctorInfo').find("option:selected").attr('data-mzyRequestId');
  14869. var checkFee = $('#doctorInfo').find("option:selected").attr('data-checkFee');
  14870. $("#checkFee").val(checkFee);
  14871. $("#totalFee").val(checkFee);
  14872. $.ajax({
  14873. type: "GET",
  14874. url: '/thmz/getMzChargeTypeByMzyRequestId?mzyRequestId=' + mzyRequestId + "&birthDay=&patientId=" + $("#patientIdRegistration").val(),
  14875. dataType: "json",
  14876. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  14877. success: function (res) {
  14878. if (res == '401' || res == 401) {
  14879. window.location.href = '/thmz/login/view'
  14880. return;
  14881. }
  14882. $("#registrationFee").val(res.data.reqFee);
  14883. $("#hospitalFee").val(res.data.clinicFee);
  14884. $("#othFee").val(parseFloat(res.data.othFee) - parseFloat(checkFee));
  14885. checkFee = parseFloat(res.data.reqFee) + parseFloat(res.data.clinicFee) + parseFloat(res.data.othFee);
  14886. $("#totalFee").val(checkFee);
  14887. }
  14888. });
  14889. }
  14890. /**
  14891. * 科室与时间区间下拉选改变时清空输入框内容
  14892. */
  14893. function emptyInput() {
  14894. $('#doctorInfo').empty();
  14895. $('#doctorInfo').selectpicker('refresh');
  14896. $("#registrationFee").val(0.00);
  14897. $("#hospitalFee").val(0.00);
  14898. $("#checkFee").val(0.00);
  14899. $("#othFee").val(0.00);
  14900. $("#totalFee").val(0.00);
  14901. }
  14902. /**
  14903. * 科室与时间区间下拉选改变时清空输入框内容
  14904. */
  14905. function clearRegistrationModal() {
  14906. $("#patientIdRegistration").val(null);
  14907. $("#registrationTime").val(null);
  14908. $('#ampm').selectpicker('val', null);
  14909. $('#ampm').selectpicker('refresh');
  14910. $('#deptNo').empty();
  14911. $('#deptNo').selectpicker('refresh');
  14912. $('#chargeType').empty();
  14913. $('#chargeType').selectpicker('refresh');
  14914. $('#doctorInfo').empty();
  14915. $('#doctorInfo').selectpicker('refresh');
  14916. $('#apTimes').empty();
  14917. $('#apTimes').selectpicker('refresh');
  14918. $("#registrationFee").val(0.00);
  14919. $("#hospitalFee").val(0.00);
  14920. $("#checkFee").val(0.00);
  14921. $("#othFee").val(0.00);
  14922. $("#totalFee").val(0.00);
  14923. }
  14924. /**
  14925. * 保存挂号信息
  14926. */
  14927. function saveMzyReqrecUnPay() {
  14928. $("#registrationModal").modal('hide');
  14929. $("#messageModal").modal();
  14930. $("#messageContent").html("确定提交本次预约挂号申请吗?");
  14931. $("#messageButton").off("click").bind("click", function (t) {
  14932. $("#messageModal").modal('hide');
  14933. realSaveMzyReqrecUnPay();
  14934. });
  14935. $("#cancelButton").off("click").bind("click", function (t) {
  14936. $("#messageModal").modal('hide');
  14937. $("#registrationModal").modal();
  14938. });
  14939. }
  14940. /**
  14941. * 保存挂号信息
  14942. */
  14943. function realSaveMzyReqrecUnPay() {
  14944. $("#saveRegistration").attr("disabled", true);
  14945. var mzyRequestId = $('#doctorInfo').find("option:selected").attr('data-mzyRequestId');
  14946. var patientId = $("#patientIdRegistration").val();
  14947. var totalFee = $("#totalFee").val();
  14948. $.ajax({
  14949. type: "POST",
  14950. url: '/thmz/saveMzyReqrec',
  14951. contentType: "application/json;charset=UTF-8",
  14952. dataType: "json",
  14953. data: JSON.stringify({
  14954. "mzyReqrec": {
  14955. "patientId": patientId,
  14956. "ampm": $("#ampm").val(),
  14957. "apTime": $("#apTimes").val(),
  14958. "unitCode": $("#deptNo").val(),
  14959. "chargeType": $("#chargeType").val(),
  14960. "requestDayStr": $("#registrationTime").val()
  14961. }, "mzyRequestId": mzyRequestId, "totalFee": totalFee, "payMark": "5"
  14962. }),
  14963. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  14964. success: function (res) {
  14965. if (res == '401' || res == 401) {
  14966. window.location.href = '/thmz/login/view'
  14967. return;
  14968. }
  14969. if (res.code == 0) {
  14970. successMesage(res);
  14971. clearRegistrationModal();
  14972. $("#registrationModal").modal('hide');
  14973. } else {
  14974. errorMesage(res);
  14975. }
  14976. $("#saveRegistration").attr("disabled", false);
  14977. }
  14978. });
  14979. }
  14980. //打开门诊电子病历
  14981. function openEmr() {
  14982. $.ajax({
  14983. type: "GET",
  14984. url: '/thmz/getMzjsdHost',
  14985. dataType: "json",
  14986. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  14987. success: function (res) {
  14988. if (res == '401' || res == 401) {
  14989. window.location.href = '/thmz/login/view'
  14990. return;
  14991. }
  14992. if (res.code == 0) {
  14993. let times = $("#visitTimes").val();
  14994. let patientId = $("#patientId").text();
  14995. if(stringIsBlank(patientId)){
  14996. return errorMesageSimaple('门诊号不能为空,请先接诊')
  14997. }
  14998. let age = $("#patientAge").text();
  14999. let sex= $("#patientGender").text();
  15000. let userIdCode = localStorage.getItem("userIdCode");
  15001. let patNo = window.btoa(JSON.stringify({
  15002. patientId:patientId,
  15003. times: Number(times),
  15004. userIdCode:userIdCode
  15005. })
  15006. )
  15007. window.open(`${res.data}/mzEmr/${patNo}`, '_blank');
  15008. }
  15009. }
  15010. });
  15011. }
  15012. //打开pacs检查
  15013. function openPacsJc() {
  15014. getAjaxRequst("/thmz/getPacsUrl",{},true,function (res) {
  15015. if (res == '401' || res == 401) {
  15016. window.location.href = '/thmz/login/view'
  15017. return;
  15018. }
  15019. if(res.code == 0 ){
  15020. let patientId = $("#patientId").text();
  15021. let pacsurl = res.data +"/Index.htm?CLINICALNUM="+patientId
  15022. window.open(pacsurl, '_blank');
  15023. }else {
  15024. errorMesage(res)
  15025. }
  15026. })
  15027. }
  15028. //打开检查检验
  15029. function openJcJyPacsModal() {
  15030. $("#previewJcJyPacsModal").modal()
  15031. getAjaxRequst("/thmz/getMzjsdHost",{},true,function (res) {
  15032. if (res == '401' || res == 401) {
  15033. window.location.href = '/thmz/login/view'
  15034. return;
  15035. }
  15036. if(res.code == 0){
  15037. let userIdCode = localStorage.getItem("userIdCode");
  15038. let patNo = $("#patientId").text();
  15039. let end = format(new Date(),'yyyy-MM-dd')
  15040. let start = format(getPreviousDays(new Date(),30),'yyyy-MM-dd')
  15041. let showUrl = `${res.data}/jumpRedirect?url=%2FinspectionResult%3FpatNo%3D${patNo}%26start%3D${start}%26end%3D${end}&code=${userIdCode}`
  15042. $("#jyjcpacsDiv").attr("src", showUrl);
  15043. }
  15044. })
  15045. }
  15046. function openDiscountLv() {
  15047. $("#discountLvModal").modal();
  15048. postAjaxJsonHttpRequst("/thmz/queryDiscountLv",{patientId: $("#patientId").text()},true,function (res) {
  15049. if(res.code == 0){
  15050. if(res.data != null){
  15051. $("#discountLv").val(res.data)
  15052. $('#discountLv').selectpicker('refresh');
  15053. }
  15054. }else {
  15055. errorMesage(res)
  15056. }
  15057. })
  15058. }
  15059. //保存股东卡优先级
  15060. function saveDiscountLv() {
  15061. postAjaxJsonHttpRequst("/thmz/updateDiscountLv",{patientId: $("#patientId").text(),discountLv : $("#discountLv").val()},true,function (res) {
  15062. if(res.code == 0){
  15063. successMesageSimaple("修改成功")
  15064. $("#discountLvModal").modal("hide");
  15065. }else {
  15066. errorMesage(res)
  15067. }
  15068. })
  15069. }
  15070. //打开医技预约
  15071. function openYjYyModal() {
  15072. getAjaxRequst("/thmz/getYjYyUrl",{},true,function (res) {
  15073. if (res == '401' || res == 401) {
  15074. window.location.href = '/thmz/login/view'
  15075. return;
  15076. }
  15077. if(res.code == 0 ){
  15078. let patientId = $("#patientId").text();
  15079. let yjyyUrl = res.data +"?MZH="+patientId
  15080. window.open(yjyyUrl, '_blank');
  15081. }else {
  15082. errorMesage(res)
  15083. }
  15084. })
  15085. }
  15086. function getPreviousDays(date, days) {
  15087. var prevDate = new Date(date); // 创建一个与指定日期相同的新日期对象
  15088. prevDate.setDate(date.getDate() - days); // 将日期设置为前几天(days)的日期
  15089. return prevDate;
  15090. }
  15091. function stringIsBlank(val) {
  15092. try {
  15093. val = val.trim()
  15094. } catch {
  15095. }
  15096. return typeof val === 'undefined' || val === null || val === ''
  15097. }
  15098. //是否开启复制粘贴
  15099. function initCopy() {
  15100. getAjaxRequst("/thmz/initCopy",{},true,function (res) {
  15101. if(res.code == -1){
  15102. document.oncontextmenu = function(event){
  15103. event.returnValue = false;
  15104. }
  15105. document.onkeydown = function(event){
  15106. if(event.ctrlKey && window.event.keyCode == 67){
  15107. return false;
  15108. }
  15109. if(event.ctrlKey && window.event.keyCode == 86){
  15110. return false;
  15111. }
  15112. }
  15113. }else {
  15114. document.oncontextmenu = function(event){
  15115. event.returnValue = true;
  15116. }
  15117. document.onkeydown = function(event){
  15118. if(event.ctrlKey && window.event.keyCode == 67){
  15119. return true;
  15120. }
  15121. if(event.ctrlKey && window.event.keyCode == 86){
  15122. return true;
  15123. }
  15124. }
  15125. }
  15126. })
  15127. }