clinic.js 229 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515
  1. //@ sourceURL=clinic.js
  2. //判断病人列表是否在加载中,防止重复加载
  3. var msg_list_loading = false;
  4. //挂号卡片列表页面下标
  5. var pageIndex = 0;
  6. //药品使用方法,天数和频次的集合
  7. var groupIdMap = null;
  8. $(function () {
  9. initGenderSelect();
  10. initResponceTypeSelect();
  11. initTemplateTypeSelect();
  12. initZyClassTypeSelect();
  13. initInstructionSelect();
  14. setSelectSize();
  15. $('#editUserBirthDayGroup').datetimepicker({
  16. format: 'yyyy-mm-dd',
  17. language: 'zh-CN',
  18. minView: "month",
  19. });
  20. initDaterangepickerWithId('reportrange', "right");
  21. formatCheck();
  22. //数据校验
  23. init_validator();
  24. //初始频次下拉选
  25. initOrderFrequencys("orderFrequency", true);
  26. //初始用药方式下拉选
  27. initSupplyTypes();
  28. //加载候诊患者列表
  29. loadUnClinicTableList();
  30. //加载接诊中患者列表
  31. loadInClinicTableList();
  32. //加载已接诊患者列表
  33. loadClinicTableList();
  34. //每隔一分钟秒读加载候诊患者列表
  35. setInterval(function () {
  36. //加载候诊患者列表
  37. loadUnClinicTableList();
  38. }, 60000);
  39. //初始化快速接诊病人姓名栏事件
  40. initUserList();
  41. //初始化主诉弹出层
  42. initRecommendList();
  43. //卡号输入改变事件
  44. cardNoChange();
  45. /**
  46. * 患者信息修改
  47. */
  48. $("#saveEditUser").on("click", function (t) {
  49. modifyPatient();
  50. });
  51. //折叠按钮初始化
  52. $('.collapse-link').on('click', function () {
  53. var $BOX_PANEL = $(this).closest('.x_panel_mine'),
  54. $ICON = $(this).find('i'),
  55. $BOX_CONTENT = $BOX_PANEL.find('.x_content');
  56. // fix for some div with hardcoded fix class
  57. if ($BOX_PANEL.attr('style')) {
  58. $BOX_CONTENT.slideToggle(200, function () {
  59. $BOX_PANEL.removeAttr('style');
  60. });
  61. } else {
  62. $BOX_CONTENT.slideToggle(200);
  63. $BOX_PANEL.css('height', 'auto');
  64. }
  65. $ICON.toggleClass('fa-chevron-up fa-chevron-down');
  66. });
  67. /**
  68. * 接诊
  69. */
  70. $("#clinicalReception").on("click", function (t) {
  71. var patientIdDb = $("#patientIdDb").val();
  72. if (patientIdDb == null || patientIdDb == "") {
  73. errorMesageSimaple("当前未选择病人,无法接诊");
  74. return;
  75. }
  76. //快速接诊的时候不知道分诊号
  77. clinicalReception(patientIdDb, "-1");
  78. clearRapidAcceptsModal();
  79. $("#rapidAcceptsModal").modal("hide");
  80. });
  81. /**
  82. * 存为范本
  83. */
  84. $("#saveapidAccepts").on("click", function (t) {
  85. var symptom = $("#symptom").val();
  86. if (symptom == null || symptom == "") {
  87. errorMesageSimaple("主诉不能为空!");
  88. return;
  89. }
  90. var emrHpi = $("#emrHpi").val();
  91. if (emrHpi == null || emrHpi == "") {
  92. errorMesageSimaple("现病史不能为空!");
  93. return;
  94. }
  95. var diagnoseValue = $("#diagnoseValue").val();
  96. if (diagnoseValue == null || diagnoseValue == "") {
  97. errorMesageSimaple("诊断不能为空!");
  98. return;
  99. }
  100. $("#saveapidAcceptsModal").modal("show");
  101. });
  102. /**
  103. * 实例化智能问诊弹窗
  104. */
  105. // $("[data-toggle='popover']").popover();
  106. $("#box-arrow-left").popover({
  107. html: 'true',
  108. content: '<div id="smartAssistPopoverContent"></div>'
  109. });
  110. //初始化药品分组下拉选
  111. initGroupOrder();
  112. // 初始化用药天数下拉选
  113. initDayNum();
  114. //页面加载完成初始化西药处方
  115. initNavTabs(0);
  116. //初始医生工作太配置
  117. initWorkspaceConfigForCurrent();
  118. /**
  119. * 西药点击事件
  120. */
  121. $("#western_medicine_name").on("click", function (t) {
  122. var obj = $("#westernMedicinePopoverContent").parent().parent().parent();
  123. if ($(obj).hasClass("in") || $(obj).css("display") == "block") {
  124. $('#western_medicine_name').webuiPopover('hide');
  125. $("#treeButton").webuiPopover('hide');
  126. return;
  127. }
  128. $('#western_medicine_name').webuiPopover('show');
  129. loadYpList(0);
  130. });
  131. /**
  132. * 项目点击事件
  133. */
  134. $("#jcJyItem").on("click", function (t) {
  135. if ($("#jcJyItemPopoverContent").parent().parent().parent().hasClass("in")) {
  136. $('#jcJyItem').webuiPopover('hide');
  137. $("#treeButton").webuiPopover('hide');
  138. return;
  139. }
  140. $('#jcJyItem').webuiPopover('show');
  141. loadjcJyItemList();
  142. });
  143. initYshPart();
  144. initJyZdSample();
  145. });
  146. /**
  147. * 打开配置页面
  148. */
  149. function configWorkspaceModal() {
  150. initWorkspaceConfigForCurrent();
  151. $("#configWorkspaceModal").modal("show");
  152. }
  153. /**
  154. * 初始化用药天数下拉选
  155. */
  156. function initDayNum() {
  157. var html = '<option value="1">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option>';
  158. $('#dayNum').html(html);
  159. $('#dayNum').selectpicker('refresh');
  160. }
  161. /**
  162. * 初始化药品分组下拉选
  163. */
  164. function initGroupOrder() {
  165. var html = '<option value="1">1</option>';
  166. $('#groupId').html(html);
  167. $('#groupId').selectpicker('refresh');
  168. $("#groupId").selectpicker('val', 1);
  169. $('#groupId').selectpicker('refresh');
  170. groupIdMap = new Map();
  171. }
  172. /**
  173. * 追加分组
  174. */
  175. function appendGroupOrder() {
  176. var last = parseInt($("#groupId > option:last").val());
  177. last++;
  178. var html = '<option value="' + last + '">' + last + '</option>';
  179. $('#groupId').append(html);
  180. $('#groupId').selectpicker('refresh');
  181. }
  182. /**
  183. * 组号改变事件
  184. */
  185. function groupIdChange() {
  186. var last = parseInt($("#groupId > option:last").val());
  187. var groupId = $("#groupId").val();
  188. if (groupId == last) {
  189. //是新增药品清空药品输入区域
  190. var updateFlag = $("#update_flag").val();
  191. var currentCode = $("#current_code").val();
  192. //当前时新增药品,而且没有选择药品的时候,组号变更,清空区域
  193. if ((updateFlag == undefined || updateFlag == null || updateFlag == "false" || updateFlag == false) && (currentCode == null || currentCode == "")) {
  194. clearWesternMedicine(true);
  195. }
  196. } else {
  197. var map = groupIdMap.get(groupId);
  198. if (map != null) {
  199. var supplyType = map.get("supplyType");
  200. var orderFrequency = map.get("orderFrequency");
  201. var dayNum = map.get("dayNum");
  202. //用法编码
  203. $("#supplyType").selectpicker('val', supplyType);
  204. $('#supplyType').selectpicker('refresh');
  205. //$("#supplyType").attr("disabled", "disabled");
  206. //天数
  207. $("#dayNum").selectpicker('val', dayNum);
  208. $('#dayNum').selectpicker('refresh');
  209. // $("#dayNum").attr("disabled", "disabled");
  210. //频次编码
  211. $("#orderFrequency").selectpicker('val', orderFrequency);
  212. $('#orderFrequency').selectpicker('refresh');
  213. // $("#orderFrequency").attr("disabled", "disabled");
  214. }
  215. }
  216. }
  217. /**
  218. * 关闭智能问诊弹框
  219. */
  220. function closePopover() {
  221. //$(".popover").popover('hide');
  222. $("#box-arrow-left").click();
  223. }
  224. /**
  225. * 加载只能问诊弹框内容
  226. */
  227. function contentMethod() {
  228. setTimeout(function () {
  229. $(".popover div.arrow").css("display", "none");
  230. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  231. if (popoverId == undefined) {
  232. return;
  233. }
  234. var left = $("#" + popoverId).css("left");
  235. left = left.replace("px", "");
  236. left = parseInt(left);
  237. left = left + 55;
  238. $("#" + popoverId).css("height", "100%").css("top", "0px").css("left", left + "px").css("border-radius", "0px").css("z-index", "11");
  239. $("#" + popoverId + " .popover-content").css("height", "100%");
  240. $("#smartAssistPopoverContent").css("height", "100%");
  241. var html = ' <div style="height: 34%;padding-left: 15px;width: 100%;">' +
  242. ' <button type="button" style="cursor: default;margin-bottom: 0px;margin-right: 0px; font-size: 12px;"' +
  243. ' class="btn btn-primary">' +
  244. ' <span id="patientHisData"></span>就医轨迹' +
  245. ' </button>' +
  246. ' <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true" onclick="closePopover()">×</span>' +
  247. ' </button>' +
  248. ' <div style="height: calc(100% - 39px);border: 1px solid #DDDDDD;margin-top: 5px;width: 100%;">' +
  249. ' <form class="form-horizontal form-label-left mz-fixed-form" novalidate autocomplete="off"' +
  250. ' style="height: 100%;overflow-y: auto;width: 100%;text-align: -webkit-center;position: relative;" id="patientHisDataForm">' +
  251. ' </form>' +
  252. ' </div>' +
  253. ' </div>' +
  254. ' <div style="height: 33%;padding-left: 15px;">' +
  255. ' <button type="button" style="cursor: default;margin-bottom: 0px;margin-right: 0px;margin-top: 5px;"' +
  256. ' class="btn btn-primary">' +
  257. ' <span id="recommendType"></span>推荐' +
  258. ' </button>' +
  259. ' <div style="height: calc(100% - 44px);border: 1px solid #DDDDDD;overflow-y: auto;margin-top: 5px;width: 100%;">' +
  260. ' <form class="form-horizontal form-label-left mz-fixed-form" novalidate autocomplete="off"' +
  261. ' style="height: 100%;overflow-y: auto;width: 100%;text-align: -webkit-center;position: relative;" id="recommendForm">' +
  262. ' <img src="/thmz/images/no-recommend.png" style="height: 120px;position: absolute;top: 50%;transform: translateY(-50%);margin-left: -30px;">' +
  263. ' </form>' +
  264. ' </div>' +
  265. ' </div>' +
  266. ' <div style="height: 33%;padding-left: 15px;">' +
  267. ' <button type="button"' +
  268. ' style="cursor: default;margin-bottom: 0px;margin-right: 0px;margin-top: 5px; font-size: 12px;"' +
  269. ' class="btn btn-primary">' +
  270. ' 医疗范本' +
  271. ' </button>' +
  272. ' <div style="height: calc(100% - 44px);border: 1px solid #DDDDDD;overflow-y: auto;margin-top: 5px;width: 100%;">' +
  273. ' <form class="form-horizontal form-label-left mz-fixed-form" novalidate autocomplete="off"' +
  274. ' style="height: 100%;overflow-y: auto;width: 100%;" id="TemplateData">' +
  275. ' </form>' +
  276. ' </div>' +
  277. ' </div>';
  278. $("#smartAssistPopoverContent").html(html);
  279. fitPatientHisData();
  280. fitSymptomData();
  281. fitEmrHpiData();
  282. fitEmrPsData();
  283. fitDiagnoseData();
  284. fitTemplateData();
  285. }, 100);
  286. // setTimeout(function () {
  287. // $("#patientHisDataForm").html("aadsasfasdfasdfasdfasdfsdfasdfasdfasdfdfafda");
  288. // },1000);
  289. }
  290. /**
  291. * 设置患者的就诊轨迹
  292. */
  293. function fitPatientHisData() {
  294. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  295. if (!$("#" + popoverId).hasClass("in")) {
  296. return;
  297. }
  298. var emptyHtml = '<img src="/thmz/images/locus.png" style="height: 120px;position: absolute;top: 50%;transform: translateY(-50%);margin-left: -30px;">';
  299. if ($("#patientId").val() == null || $("#patientId").val() == "") {
  300. $("#patientHisDataForm").html(emptyHtml);
  301. return;
  302. }
  303. $.ajax({
  304. type: "POST",
  305. url: '/thmz/getClinicWithPage',
  306. contentType: "application/json;charset=UTF-8",
  307. dataType: "json",
  308. data: JSON.stringify({
  309. "patientId": $("#patientId").val(),
  310. //"clinicStatuses": [5, 6],
  311. "clinicStatuses": [6],
  312. "pageSize": 10000,
  313. "offset": 0,
  314. "beginDate": "2012-02-01 00:00:00",
  315. "endDate": format(new Date(), "yyyy-MM-dd HH:mm:ss"),
  316. "doctorCode":"-1"
  317. }),
  318. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  319. success: function (res) {
  320. if (res == '401' || res == 401) {
  321. window.location.href = '/thmz/login/view'
  322. return;
  323. }
  324. if (res.code == 0) {
  325. var html = '';
  326. var data = res.data;
  327. if (data == null || data.length == 0) {
  328. html += emptyHtml;
  329. } else {
  330. for (var i = 0; i < data.length; i++) {
  331. var icdText = data[i].icdText;
  332. if (icdText == null) {
  333. // continue;
  334. icdText = "空白诊断";
  335. }
  336. icdText = icdText.trim();
  337. html += ' <div class="item form-group thmz_alert" style="padding: 10px 0;width: 100%;">';
  338. html += ' <div style="float: left;width: 172px;">';
  339. html += ' <img src="/thmz/css/bootstrap/bootstrap-icons-1.5.0/stopwatch.svg"';
  340. html += ' style="margin-left: 10px!important;vertical-align: -.15em;margin-right: 10px!important;"/>';
  341. html += ' <span style="width: 120px;margin-right: 20px!important;">' + format(data[i].opDay, "yyyy-MM-dd HH:mm") + '</span>';
  342. html += ' </div>';
  343. html += ' <div style="text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 172px);"';
  344. html += ' title="' + icdText + '">诊断:<a style="cursor: pointer; color: #2e69eb;"';
  345. html += ' onclick="visitingDetailModal(\'' + data[i].patientId + '\',' + data[i].times + ',' + data[i].id + ','+data[i].clinicStatus+')">' + icdText + '</a>';
  346. html += ' </div>';
  347. html += ' </div>';
  348. }
  349. }
  350. $("#patientHisData").text($("#patientName").text() + "的");
  351. if ($("#patientId").val() == null || $("#patientId").val() == "") {
  352. $("#patientHisDataForm").html(emptyHtml);
  353. } else {
  354. $("#patientHisDataForm").html(html);
  355. }
  356. } else {
  357. errorMesage(res);
  358. }
  359. }
  360. });
  361. }
  362. /**
  363. * 设置主诉推荐
  364. */
  365. function fitSymptomData() {
  366. fitRecommendData(12);
  367. }
  368. /**
  369. * 设置现病史推荐
  370. */
  371. function fitEmrHpiData() {
  372. fitRecommendData(5);
  373. }
  374. /**
  375. * 设置既往史推荐
  376. */
  377. function fitEmrPsData() {
  378. fitRecommendData(6);
  379. }
  380. /**
  381. * 设置诊断推荐
  382. */
  383. function fitDiagnoseData() {
  384. fitRecommendData(13);
  385. }
  386. /**
  387. * 设置推荐通用方法
  388. */
  389. function fitRecommendData(paramsType) {
  390. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  391. if (!$("#" + popoverId).hasClass("in")) {
  392. return;
  393. }
  394. var inputId = "symptom";
  395. var text = "主诉";
  396. if (paramsType == 5) {
  397. inputId = "emrHpi";
  398. text = "现病史";
  399. } else if (paramsType == 6) {
  400. inputId = "emrPs";
  401. text = "既往史";
  402. } else if (paramsType == 13) {
  403. inputId = "diagnose";
  404. text = "诊断";
  405. }
  406. //光标不在现病史上
  407. if (document.activeElement.id != inputId) {
  408. return;
  409. }
  410. $("#recommendType").html(text);
  411. var emptyHtml = '<img src="/thmz/images/no-recommend.png" style="height: 120px;position: absolute;top: 50%;transform: translateY(-50%);margin-left: -30px;">';
  412. $.ajax({
  413. type: "GET",
  414. url: '/thmz/getTCommonParamsByParamsType?paramsType=' + paramsType + '&commonParams=&pageSize=10',
  415. contentType: "application/json;charset=UTF-8",
  416. dataType: "json",
  417. async: false,
  418. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  419. success: function (res) {
  420. if (res == '401' || res == 401) {
  421. window.location.href = '/thmz/login/view'
  422. return;
  423. }
  424. if (res.code == 0) {
  425. var html = '';
  426. var data = res.data;
  427. if (data == null || data.length == 0) {
  428. html += emptyHtml;
  429. } else {
  430. for (var i = 0; i < data.length; i++) {
  431. var paramsContent = data[i].paramsContent;
  432. html += ' <div class="item form-group thmz_alert" style="padding: 10px 0;width: 100%;">';
  433. html += ' <div style="margin-left: 10px;float: left;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 60px);" title="' + paramsContent + '">';
  434. html += paramsContent;
  435. html += ' </div>';
  436. html += ' <div style="float: left;width: 36px;cursor: pointer;"';
  437. html += ' onclick="fitAppeal(\'' + paramsContent + '\',' + paramsType + ')">';
  438. html += ' <img';
  439. html += ' src="/thmz/css/bootstrap/bootstrap-icons-1.5.0/cursor-fill.svg"';
  440. html += ' style="margin-left: 10px!important;vertical-align: -.15em;margin-right: 10px!important;"/>';
  441. html += ' </div>';
  442. html += ' </div>';
  443. }
  444. }
  445. $("#recommendForm").html(html);
  446. } else {
  447. errorMesage(res);
  448. }
  449. }
  450. });
  451. }
  452. /**
  453. * 设置医疗范文方法
  454. */
  455. function fitTemplateData() {
  456. var popoverId = $("#box-arrow-left").attr("aria-describedby");
  457. if (!$("#" + popoverId).hasClass("in")) {
  458. return;
  459. }
  460. var emptyHtml = '<img src="/thmz/images/no-recommend.png" style="height: 120px;position: absolute;top: 50%;transform: translateY(-50%);margin-left: -30px;">';
  461. $.ajax({
  462. type: "GET",
  463. url: '/thmz/getTemplate',
  464. contentType: "application/json;charset=UTF-8",
  465. dataType: "json",
  466. async: false,
  467. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  468. success: function (res) {
  469. if (res == '401' || res == 401) {
  470. window.location.href = '/thmz/login/view'
  471. return;
  472. }
  473. if (res.code == 0) {
  474. var html = '';
  475. var data = res.data;
  476. if (data == null || data.length == 0) {
  477. html += emptyHtml;
  478. } else {
  479. for (var i = 0; i < data.length; i++) {
  480. var template = data[i];
  481. html += ' <div class="item form-group thmz_alert" style="padding: 10px 0;width: 100%;">';
  482. html += ' <div title="' + template.name + '"';
  483. html += ' style="margin-left: 10px!important;float: left;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: 100px;">';
  484. html += template.name;
  485. html += ' </div>';
  486. html += ' <div style="float: left;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;width: calc(100% - 160px);"';
  487. html += ' title="' + template.icdText + '">诊断:<a';
  488. html += ' style="cursor: pointer; color: #2e69eb;"';
  489. html += ' onclick="medicalModelModal(' + template.id + ')">' + template.icdText + '</a>';
  490. html += ' </div>';
  491. html += ' <div style="float: left;width: 36px;cursor: pointer;" onclick="medicalModelModal(' + template.id + ')"><img';
  492. html += ' src="/thmz/css/bootstrap/bootstrap-icons-1.5.0/cursor-fill.svg"';
  493. html += ' style="margin-left: 10px!important;vertical-align: -.15em;margin-right: 10px!important;"/>';
  494. html += ' </div>';
  495. html += ' </div>';
  496. }
  497. }
  498. $("#TemplateData").html(html);
  499. } else {
  500. errorMesage(res);
  501. }
  502. }
  503. });
  504. }
  505. /**
  506. * 清空快速接诊弹窗
  507. */
  508. function clearRapidAcceptsModal() {
  509. $("#rapidAcceptsUserName").val(null);
  510. $("#rapidAcceptsUserCode").val(null);
  511. $("#patientIdDb").val(null);
  512. $("#rapidAcceptsUserCardNo").val(null);
  513. $("#rapidAcceptsUserGender").selectpicker('val', 0);
  514. $("#rapidAcceptsUserGender").selectpicker('refresh');
  515. $("#rapidAcceptsUserPhoneNum").val(null);
  516. $("#rapidAcceptsUserIdCard").val(null);
  517. $("#rapidAcceptsUserIdCard").attr("title", null);
  518. $("#rapidAcceptsUserPhoneNum").attr("title", null);
  519. }
  520. /**
  521. * 清空接诊台用户信息
  522. */
  523. function clearUser() {
  524. $("#patientName").html("");
  525. $("#patientAge").html("");
  526. $("#patientGender").html("");
  527. $("#patientId").val(null);
  528. $("#patientPhone").html("");
  529. $("#patientPhoneLabel").hide();
  530. $("#patientResponseType").html("");
  531. $("#first").parent().addClass("checked");
  532. $("#not").parent().removeClass("checked");
  533. $("#not").click();
  534. $("#patientHisData").text("");
  535. $("#mzfzSerialNoInClick").val(null);
  536. }
  537. /**
  538. * 卡号输入改变事件
  539. */
  540. function cardNoChange() {
  541. if (window.ActiveXObject || "ActiveXObject" in window) {
  542. $("#rapidAcceptsUserCardNo").on('input propertychange', function () {
  543. queryUserInfoByCardNo();
  544. });
  545. } else {
  546. $("#rapidAcceptsUserCardNo").on('input οninput', function () {
  547. queryUserInfoByCardNo();
  548. });
  549. }
  550. }
  551. /**
  552. * 刷新就诊列表
  553. */
  554. function refreshClinic() {
  555. loadInClinicTableList();
  556. loadClinicTableList();
  557. }
  558. /**
  559. * 加载已接诊患者列表
  560. */
  561. function loadClinicTableList() {
  562. //loadCommonClinicTableList("tb_table_clinic","/thmz/getClinicWithPage");
  563. loadCommonClinicTableList("tb_table_clinic", queryParamsClinic);
  564. }
  565. /**
  566. * 加载患者列表通用方法
  567. * @param id
  568. * @param queryParams
  569. */
  570. function loadCommonClinicTableList(id, queryParams) {
  571. $('#' + id).bootstrapTable('refresh');
  572. $('#' + id).bootstrapTable({
  573. url: "/thmz/getClinicWithPage", //请求后台的URL(*)
  574. method: 'post', //请求方式(*)
  575. toolbar: '#toolbar', //工具按钮用哪个容器
  576. striped: true, //是否显示行间隔色
  577. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  578. pagination: true, //是否显示分页(*)
  579. sortable: true, //是否启用排序
  580. sortOrder: "asc", //排序方式
  581. queryParams: queryParams, //传递参数(*)
  582. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  583. pageNumber: 1, //初始化加载第一页,默认第一页
  584. pageSize: 5, //每页的记录行数(*)
  585. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  586. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  587. strictSearch: true,
  588. showColumns: false, //是否显示所有的列
  589. showRefresh: false, //是否显示刷新按钮
  590. minimumCountColumns: 2, //最少允许的列数
  591. clickToSelect: true, //是否启用点击选中行
  592. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  593. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  594. cardView: false, //是否显示详细视图
  595. detailView: false,
  596. //rowStyle:rowStyle,//通过自定义函数设置行样式
  597. ajaxOptions: {
  598. headers: {
  599. 'Accept': 'application/json',
  600. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  601. }
  602. },
  603. columns: [
  604. {
  605. field: 'patientName',
  606. title: '姓名/性别/年龄',
  607. align: "center",
  608. valign: 'middle',
  609. // sortable: true
  610. formatter: function (value, row, index) {
  611. return value + "/" + row.gender + "/" + row.age + "岁";
  612. }
  613. }, {
  614. field: 'opDay',
  615. title: '接诊时间',
  616. align: "center",
  617. valign: 'middle',
  618. // sortable: true
  619. formatter: function (value, row, index) {
  620. return format(value, "MM/dd HH:mm");
  621. }
  622. }
  623. , {
  624. title: '操作',
  625. align: "center",
  626. valign: 'middle',
  627. // sortable: true,
  628. formatter: function (value, row, index) {
  629. if (row.clinicStatus == 5) {
  630. 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>';
  631. // 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>';
  632. } else if (row.clinicStatus == 6) {
  633. 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>';
  634. }
  635. }
  636. }
  637. ],
  638. responseHandler: function (res) {
  639. if (res == '401' || res == 401) {
  640. window.location.href = '/thmz/login/view'
  641. return;
  642. }
  643. var ress = eval(res);
  644. if (ress.code == -1) {
  645. new PNotify({
  646. title: '错误提示',
  647. text: ress.message,
  648. type: 'error',
  649. hide: false,
  650. styling: 'bootstrap3'
  651. });
  652. return {
  653. "total": 0,//总页数
  654. "rows": {} //数据
  655. };
  656. }
  657. return {
  658. "total": ress.total,//总页数
  659. "rows": ress.data //数据
  660. };
  661. },
  662. onLoadSuccess: function (data) {
  663. $(".pagination-detail").css("display", "none");
  664. if (id == "tb_table_clinic") {
  665. $("#ClinicNum").html(data.total);
  666. } else {
  667. $("#inClinicNum").html(data.total);
  668. }
  669. }
  670. });
  671. }
  672. /**
  673. * 得到查询的参数 接诊中
  674. * @param params
  675. * @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}}
  676. */
  677. function queryParamsInClinic(params) {
  678. var temp = {
  679. pageSize: params.limit,
  680. pageIndex: params.offset / params.limit, //页码
  681. statusFlagList: [8]
  682. };
  683. return temp;
  684. };
  685. /**
  686. * 得到查询的参数
  687. * @param params
  688. * @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}}
  689. */
  690. function queryParamsClinic(params) {
  691. var rePortRangeArr = getRePortRangeArr();
  692. var temp = {
  693. beginDate: rePortRangeArr[0],
  694. endDate: rePortRangeArr[1],
  695. commonParams: $("#userName").val(),
  696. clinicStatuses: [5, 6, 7],
  697. pageSize: params.limit,
  698. offset: params.offset
  699. };
  700. return temp;
  701. };
  702. /**
  703. * 加载待诊患者列表方法
  704. */
  705. function loadUnClinicTableList() {
  706. loadCanClinicTableList("tb_table_un_clinic", queryParamsUnClinic);
  707. }
  708. /**
  709. * 加载接诊中患者列表方法
  710. */
  711. function loadInClinicTableList() {
  712. loadCanClinicTableList("tb_table_in_clinic", queryParamsInClinic);
  713. }
  714. /**
  715. * 加载待诊和接诊中患者列表通用方法方法
  716. */
  717. function loadCanClinicTableList(id, queryParams) {
  718. $('#' + id).bootstrapTable('refresh');
  719. $('#' + id).bootstrapTable({
  720. url: "/thmz/getUnClinicWithPage", //请求后台的URL(*)
  721. method: 'post', //请求方式(*)
  722. toolbar: '#toolbar', //工具按钮用哪个容器
  723. striped: true, //是否显示行间隔色
  724. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  725. pagination: true, //是否显示分页(*)
  726. sortable: true, //是否启用排序
  727. sortOrder: "asc", //排序方式
  728. queryParams: queryParams, //传递参数(*)
  729. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  730. pageNumber: 1, //初始化加载第一页,默认第一页
  731. pageSize: 5, //每页的记录行数(*)
  732. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  733. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  734. strictSearch: true,
  735. showColumns: false, //是否显示所有的列
  736. showRefresh: false, //是否显示刷新按钮
  737. minimumCountColumns: 2, //最少允许的列数
  738. clickToSelect: true, //是否启用点击选中行
  739. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  740. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  741. cardView: false, //是否显示详细视图
  742. detailView: false,
  743. //rowStyle:rowStyle,//通过自定义函数设置行样式
  744. ajaxOptions: {
  745. headers: {
  746. 'Accept': 'application/json',
  747. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  748. }
  749. },
  750. columns: [
  751. {
  752. field: 'name',
  753. title: '姓名/性别/年龄',
  754. align: "center",
  755. valign: 'middle',
  756. // sortable: true
  757. formatter: function (value, row, index) {
  758. return value + "/" + row.gender + "/" + row.age + "岁";
  759. }
  760. }, {
  761. field: 'visitDate',
  762. title: '分诊时间',
  763. align: "center",
  764. valign: 'middle',
  765. // sortable: true
  766. formatter: function (value, row, index) {
  767. return format(value, "MM/dd HH:mm");
  768. }
  769. }
  770. , {
  771. title: '操作',
  772. align: "center",
  773. valign: 'middle',
  774. // sortable: true,
  775. formatter: function (value, row, index) {
  776. if (row.statusFlag == 0) {
  777. return '<a title="接诊" onclick="clinicalReception(\'' + row.patientId + '\',\'' + row.serialNo + '\')" style="cursor: pointer">接诊</a>';
  778. } else if (row.statusFlag == 8) {
  779. //TODO 继续接诊需要新方法
  780. return '<a title="继续接诊" onclick="clinicalReception(\'' + row.patientId + '\',\'' + row.serialNo + '\')" style="cursor: pointer">继续接诊</a>';
  781. } else if (row.statusFlag == 1 || row.statusFlag == 2 || row.statusFlag == 3) {
  782. return '<a title="通知" onclick="clinicCallNumber(\'' + row.serialNo + '\')" style="cursor: pointer">通知</a>&nbsp;<a title="接诊" onclick="clinicalReception(\'' + row.patientId + '\',\'' + row.serialNo + '\')" style="cursor: pointer">接诊</a>';
  783. }
  784. }
  785. }
  786. ],
  787. responseHandler: function (res) {
  788. if (res == '401' || res == 401) {
  789. window.location.href = '/thmz/login/view'
  790. return;
  791. }
  792. var ress = eval(res);
  793. if (ress.code == -1) {
  794. new PNotify({
  795. title: '错误提示',
  796. text: ress.message,
  797. type: 'error',
  798. hide: false,
  799. styling: 'bootstrap3'
  800. });
  801. return {
  802. "total": 0,//总页数
  803. "rows": {} //数据
  804. };
  805. }
  806. return {
  807. "total": ress.total,//总页数
  808. "rows": ress.data //数据
  809. };
  810. },
  811. onLoadSuccess: function (data) {
  812. $(".pagination-detail").css("display", "none");
  813. $("#unClinicNum").html(data.total);
  814. }
  815. });
  816. }
  817. /**
  818. * 得到查询的参数
  819. * @param params
  820. * @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}}
  821. */
  822. function queryParamsUnClinic(params) {
  823. var temp = {
  824. pageSize: params.limit,
  825. pageIndex: params.offset / params.limit, //页码
  826. statusFlagList: [0, 1, 2, 3]
  827. };
  828. return temp;
  829. };
  830. /**
  831. * 通知叫号
  832. * @param serialNo
  833. */
  834. function clinicCallNumber(serialNo) {
  835. $.ajax({
  836. type: "GET",
  837. url: '/thmz/clinicCallNumber?serialNo=' + serialNo,
  838. contentType: "application/json;charset=UTF-8",
  839. dataType: "json",
  840. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  841. success: function (res) {
  842. if (res == '401' || res == 401) {
  843. window.location.href = '/thmz/login/view'
  844. return;
  845. }
  846. if (res.code == 0) {
  847. successMesage(res);
  848. } else {
  849. errorMesage(res);
  850. }
  851. }
  852. });
  853. }
  854. /**
  855. * 接诊方法
  856. * @param patientId 门诊id
  857. * @param serialNo 分诊流水号
  858. */
  859. function clinicalReception(patientId, serialNo) {
  860. var existPatientId = $("#patientId").val();
  861. if (existPatientId != null && existPatientId != "" && existPatientId != patientId) {
  862. $("#messageModal").modal();
  863. $("#messageContent").html("当前有病人正在接诊,是否切换?");
  864. $("#messageButton").off("click").on("click", function (t) {
  865. $("#messageModal").modal("hide");
  866. //当前有人在接诊,提示是否需要切换和保存
  867. $("#messagePrescriptionModal").modal();
  868. $("#confirmPrescriptionButton").off("click").on("click", function (t) {
  869. $("#messagePrescriptionModal").modal("hide");
  870. //先保存目前接诊信息,再切换就诊人
  871. var jsonData = getParamsForOrescription();
  872. $.ajax({
  873. type: "POST",
  874. url: '/thmz/savePrescription',
  875. contentType: "application/json;charset=UTF-8",
  876. dataType: "json",
  877. data: JSON.stringify(jsonData),
  878. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  879. success: function (res) {
  880. if (res == '401' || res == 401) {
  881. window.location.href = '/thmz/login/view'
  882. return;
  883. }
  884. if (res.code == 0) {
  885. clearWorkSpace();
  886. realClinicalReception(patientId, serialNo);
  887. //加载已接诊患者列表
  888. loadClinicTableList();
  889. } else {
  890. errorMesage(res);
  891. }
  892. }
  893. });
  894. });
  895. $("#cancelPrescriptionButton").off("click").on("click", function (t) {
  896. $("#messagePrescriptionModal").modal("hide");
  897. clearWorkSpace();
  898. realClinicalReception(patientId, serialNo);
  899. });
  900. });
  901. } else {
  902. realClinicalReception(patientId, serialNo);
  903. }
  904. }
  905. /**
  906. * 设置当前接诊病人信息
  907. * @param mzPatientMi
  908. */
  909. function setMzPatientInfo(mzPatientMi) {
  910. $("#patientName").html(mzPatientMi.name);
  911. $("#patientAge").html(mzPatientMi.age);
  912. $("#patientGender").html(mzPatientMi.gender);
  913. $("#patientId").val(mzPatientMi.patientId);
  914. if (mzPatientMi.phoneNo != null && mzPatientMi.phoneNo != '') {
  915. $("#patientPhone").html(mzPatientMi.phoneNo);
  916. $("#patientPhoneLabel").show();
  917. } else {
  918. $("#patientPhoneLabel").hide();
  919. }
  920. $("#patientResponseType").html(mzPatientMi.responseTypeName);
  921. if (mzPatientMi.times == 1) {
  922. $("#first").parent().addClass("checked");
  923. $("#not").parent().removeClass("checked");
  924. $("#first").click();
  925. } else {
  926. $("#not").parent().addClass("checked");
  927. $("#first").parent().removeClass("checked");
  928. $("#not").click();
  929. }
  930. $("#patientHisData").text(mzPatientMi.name);
  931. fitPatientHisData();
  932. }
  933. /**
  934. * 真实的接诊方法
  935. * @param patientId
  936. * @param serialNo 分诊流水号
  937. */
  938. function realClinicalReception(patientId, serialNo) {
  939. $.ajax({
  940. type: "GET",
  941. url: '/thmz/saveClinic?patientId=' + patientId + "&serialNo=" + serialNo,
  942. contentType: "application/json;charset=UTF-8",
  943. dataType: "json",
  944. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  945. success: function (res) {
  946. if (res == '401' || res == 401) {
  947. window.location.href = '/thmz/login/view'
  948. return;
  949. }
  950. if (res.code == 0) {
  951. if (res.data != null) {
  952. var mzPatientMi = res.data;
  953. setMzPatientInfo(mzPatientMi);
  954. $("#mzfzSerialNoInClick").val(serialNo);
  955. //加载候诊患者列表
  956. loadUnClinicTableList();
  957. //加载接诊中患者列表
  958. loadInClinicTableList();
  959. }
  960. } else {
  961. errorMesage(res);
  962. }
  963. }
  964. });
  965. }
  966. /**
  967. * 清空工作台
  968. */
  969. function clearWorkSpace() {
  970. clearUser();
  971. $("#symptom").val(null);
  972. $("#emrHpi").val(null);
  973. $("#emrPs").val(null);
  974. $("#personalHistory").val(null);
  975. $("#familyHistory").val(null);
  976. $("#obstericalHistory").val(null);
  977. $("#weight").val(null);
  978. $("#temperature").val(null);
  979. $("#sphygmus").val(null);
  980. $("#breathe").val(null);
  981. $("#pressure_high").val(null);
  982. $("#pressure_floor").val(null);
  983. $("#pressure_high_left").val(null);
  984. $("#pressure_floor_left").val(null);
  985. $("#tentativeDiagnosis").val(null);
  986. $("#otherCheck").val(null);
  987. $("#diagnoseValue").val(null);
  988. $("#diagnoseTags").html(null);
  989. $("#healthEducation").html(null);
  990. clearWesternMedicine(true);
  991. clearChineseMedicine();
  992. clearJyJcItem();
  993. initNavTabs(0);
  994. initNavTabs(1);
  995. initNavTabs(2);
  996. clearApidAcceptsModal();
  997. $("#totalAmount").text(0);
  998. }
  999. /**
  1000. * 医疗范文详情预览
  1001. * @param id
  1002. */
  1003. function medicalModelModal(id) {
  1004. $.ajax({
  1005. type: "GET",
  1006. url: '/thmz/getTemplateById?id=' + id,
  1007. contentType: "application/json;charset=UTF-8",
  1008. dataType: "json",
  1009. async: false,
  1010. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1011. success: function (res) {
  1012. if (res == '401' || res == 401) {
  1013. window.location.href = '/thmz/login/view'
  1014. return;
  1015. }
  1016. if (res.code == 0) {
  1017. var jsonData = JSON.parse(res.data.templateData);
  1018. $("#vmedicalModelName").text(res.data.name);
  1019. $("#idTemplate").val(res.data.id);
  1020. $("#zsTemplate").html(jsonData.mzBlRecord.emrChiefComplaint);
  1021. $("#xbsTemplate").html(jsonData.mzBlRecord.emrHpi);
  1022. var icdText = res.data.icdText;
  1023. $("#zdTemplate").html("");
  1024. $("#xyzlContent").html("");
  1025. $("#zyzlContent").html("");
  1026. $("#zlyjContent").html("");
  1027. if (icdText != null) {
  1028. var arr = icdText.split(",");
  1029. var html = "";
  1030. for (var i = 0; i < arr.length; i++) {
  1031. if (i == 0) {
  1032. html += ' <div class="tagZdy tagZdy-back">';
  1033. } else {
  1034. html += ' <div class="tagZdy tagZdy-back-green">';
  1035. }
  1036. html += arr[i];
  1037. html += '</div>';
  1038. }
  1039. $("#zdTemplate").html(html);
  1040. }
  1041. var emrProcess = jsonData.mzBlRecord.emrProcess;
  1042. if (emrProcess != null) {
  1043. var xy = null;
  1044. if (emrProcess.indexOf("西药治疗:") >= 0) {
  1045. if (emrProcess.indexOf("中药治疗:") >= 0) {
  1046. xy = emrProcess.substring(emrProcess.indexOf("西药治疗:") + 5, emrProcess.indexOf("中药治疗:"));
  1047. } else if (emrProcess.indexOf("医技与诊疗:") >= 0) {
  1048. xy = emrProcess.substring(emrProcess.indexOf("西药治疗:") + 5, emrProcess.indexOf("医技与诊疗:"));
  1049. } else {
  1050. xy = emrProcess.substring(emrProcess.indexOf("西药治疗:") + 5);
  1051. }
  1052. var arr = xy.split("_");
  1053. if (arr != null && arr.length > 0) {
  1054. var xyhtml = "";
  1055. for (var i = 0; i < arr.length; i++) {
  1056. xyhtml += "<div>";
  1057. xyhtml += arr[i];
  1058. xyhtml += "</div>";
  1059. }
  1060. $("#xyzlContent").html(xyhtml);
  1061. $("#xyzlTitle").removeClass("hide").addClass("in");
  1062. } else {
  1063. $("#xyzlTitle").removeClass("in").addClass("hide");
  1064. }
  1065. } else {
  1066. $("#xyzlTitle").removeClass("in").addClass("hide");
  1067. }
  1068. var zy = null;
  1069. if (emrProcess.indexOf("中药治疗:") >= 0) {
  1070. if (emrProcess.indexOf("医技与诊疗:") >= 0) {
  1071. zy = emrProcess.substring(emrProcess.indexOf("中药治疗:") + 5, emrProcess.indexOf("医技与诊疗:"));
  1072. } else {
  1073. zy = emrProcess.substring(emrProcess.indexOf("中药治疗:") + 5);
  1074. }
  1075. var zyArr = zy.split("_");
  1076. if (zyArr != null && zyArr.length > 0) {
  1077. var zyhtml = "";
  1078. for (var i = 1; i < zyArr.length; i++) {
  1079. zyhtml += "<div>";
  1080. zyhtml += zyArr[i];
  1081. zyhtml += "</div>";
  1082. }
  1083. var zyfs = zyArr[0].substring(zyArr[0].indexOf("付数:") + 3);
  1084. if (zyfs != null && zyfs != "") {
  1085. zyhtml += " <div>";
  1086. zyhtml += ' <div style="text-indent: 2em;">';
  1087. zyhtml += ' <div>';
  1088. zyhtml += 'x<span>';
  1089. zyhtml += zyfs;
  1090. zyhtml += '</span> 付</div></div></div>';
  1091. }
  1092. $("#zyzlContent").html(zyhtml);
  1093. $("#zyzlTitle").removeClass("hide").addClass("in");
  1094. } else {
  1095. $("#zyzlTitle").removeClass("in").addClass("hide");
  1096. }
  1097. } else {
  1098. $("#zyzlTitle").removeClass("in").addClass("hide");
  1099. }
  1100. if (emrProcess.indexOf("医技与诊疗:") >= 0) {
  1101. var zlyj = emrProcess.substring(emrProcess.indexOf("医技与诊疗:") + 6);
  1102. var zlyjArr = zlyj.split("_");
  1103. if (zlyjArr != null && zlyjArr.length > 0) {
  1104. var zlyjhtml = "";
  1105. for (var i = 0; i < zlyjArr.length; i++) {
  1106. zlyjhtml += "<div>";
  1107. zlyjhtml += zlyjArr[i];
  1108. zlyjhtml += "</div>";
  1109. }
  1110. $("#zlyjContent").html(zlyjhtml);
  1111. $("#zlyjTitle").removeClass("hide").addClass("in");
  1112. } else {
  1113. $("#zlyjTitle").removeClass("in").addClass("hide");
  1114. }
  1115. } else {
  1116. $("#zlyjTitle").removeClass("in").addClass("hide");
  1117. }
  1118. }
  1119. } else {
  1120. errorMesage(res);
  1121. }
  1122. }
  1123. });
  1124. $("#medicalModelModal").modal();
  1125. }
  1126. /**
  1127. * 诊疗项目回写
  1128. * @param code
  1129. * @param mzChargeDetail
  1130. */
  1131. function callBackZlDetail(code, mzChargeDetail) {
  1132. //诊疗项目
  1133. $.ajax({
  1134. type: "GET",
  1135. url: '/thmz/getJcJyItemByCommonParams?commonParams=' + code,
  1136. contentType: "application/json;charset=UTF-8",
  1137. dataType: "json",
  1138. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1139. async: false,
  1140. success: function (res) {
  1141. if (res == '401' || res == 401) {
  1142. window.location.href = '/thmz/login/view'
  1143. return;
  1144. }
  1145. if (res.code == 0) {
  1146. if (res.data != null && res.data.length > 0) {
  1147. //如果
  1148. if ($("#zlTab").find("li") == null || $("#zlTab").find("li").length == 0) {
  1149. initNavTabs(2);
  1150. }
  1151. var row = res.data[0];
  1152. $("#jcJyItem").val(row.name);
  1153. $("#jcJyItem").blur();
  1154. $("#jcjyItemPrice").val(row.chargeAmount);
  1155. $("#chargeUnit").val(row.specification);
  1156. $("#current_code").val(row.code);
  1157. $("#remark").val(mzChargeDetail.instructionText);
  1158. $("#jcJyZltype").val(row.type);
  1159. saveJyJcItem(false);
  1160. }
  1161. } else {
  1162. errorMesage(res);
  1163. }
  1164. }
  1165. });
  1166. }
  1167. /**
  1168. * 处方回写
  1169. * @param jsonData 处方数据
  1170. */
  1171. function editPrescription(jsonData) {
  1172. var firstOrNot = jsonData.firstOrNot;
  1173. if (firstOrNot == 0) {
  1174. $("#first").parent().addClass("checked");
  1175. $("#not").parent().removeClass("checked");
  1176. $("#first").click();
  1177. } else if (firstOrNot == 1) {
  1178. $("#first").parent().removeClass("checked");
  1179. $("#not").parent().addClass("checked");
  1180. $("#not").click();
  1181. }
  1182. $("#symptom").val(jsonData.mzBlRecord.emrChiefComplaint);
  1183. $("#emrHpi").val(jsonData.mzBlRecord.emrHpi);
  1184. $("#emrPs").val(jsonData.mzBlRecord.emrPs);
  1185. $("#personalHistory").val(jsonData.mzBlRecord.personalHistory);
  1186. $("#familyHistory").val(jsonData.mzBlRecord.familyHistory);
  1187. $("#obstericalHistory").val(jsonData.mzBlRecord.obstericalHistory);
  1188. $("#weight").val(jsonData.mzBlRecord.weight);
  1189. $("#temperature").val(jsonData.mzBlRecord.temperature);
  1190. $("#sphygmus").val(jsonData.mzBlRecord.sphygmus);
  1191. $("#breathe").val(jsonData.mzBlRecord.breathe);
  1192. $("#pressure_high").val(jsonData.mzBlRecord.pressureHigh);
  1193. $("#pressure_floor").val(jsonData.mzBlRecord.pressureFloor);
  1194. $("#pressure_high_left").val(jsonData.mzBlRecord.pressureHighLeft);
  1195. $("#pressure_floor_left").val(jsonData.mzBlRecord.pressureFloorLeft);
  1196. $("#tentativeDiagnosis").val(jsonData.mzBlRecord.tentativeDiagnosis);
  1197. $("#otherCheck").val(jsonData.mzBlRecord.emrPe);
  1198. var icdCode = jsonData.icdCode;
  1199. var icdText = jsonData.icdText;
  1200. var icdCodeArr = icdCode.split(",");
  1201. var icdTextArr = icdText.split(",");
  1202. if (icdCodeArr != null && icdCodeArr.length > 0 && icdTextArr != null && icdTextArr.length > 0) {
  1203. for (var i = 0; i < icdCodeArr.length; i++) {
  1204. fitDiagnoseValue(icdTextArr[i], icdCodeArr[i]);
  1205. }
  1206. }
  1207. $("#healthEducation").val(jsonData.mzBlRecord.emrJkjy);
  1208. var mzChargeDetailList = jsonData.mzChargeDetailList;
  1209. //中药的公共参数是否已经设置了
  1210. var hadSetZyFullParams = false;
  1211. //西药,成药,医材,麻精,中药,诊疗
  1212. if (mzChargeDetailList != null && mzChargeDetailList.length > 0) {
  1213. for (var i = 0; i < mzChargeDetailList.length; i++) {
  1214. var mzChargeDetail = mzChargeDetailList[i];
  1215. var groupNo = mzChargeDetail.groupNo;
  1216. var code = mzChargeDetail.chargeItemCode;
  1217. var serial = mzChargeDetail.serial;
  1218. if (groupNo == "00") {
  1219. callBackZlDetail(code, mzChargeDetail);
  1220. } else if (groupNo == "71" || groupNo == "91" || groupNo == "111" || groupNo == "131") {
  1221. // 71 西成药 91 医材 111 精一 131 精二
  1222. checkYpInfo(code, serial, groupNo, false);
  1223. $("#groupId").selectpicker('val', mzChargeDetail.groupOrder);
  1224. $('#groupId').selectpicker('refresh');
  1225. // 给药方式 同组药品给药方式相同
  1226. $("#supplyType").selectpicker('val', mzChargeDetail.supplyCode);
  1227. $('#supplyType').selectpicker('refresh');
  1228. $("#drugWin").val(mzChargeDetail.drugQuan);
  1229. $("#drugWinUnit").selectpicker('val', mzChargeDetail.drugUnit);
  1230. $('#drugWinUnit').selectpicker('refresh');
  1231. //天数 同组药品天数相同
  1232. $("#dayNum").selectpicker('val', mzChargeDetail.orderDays);
  1233. $('#dayNum').selectpicker('refresh');
  1234. //频次编码 同组药品频次编码相同
  1235. $("#orderFrequency").selectpicker('val', mzChargeDetail.frequency);
  1236. $('#orderFrequency').selectpicker('refresh');
  1237. if (mzChargeDetail.tryFlag == 1 || mzChargeDetail.tryFlag == "1") {
  1238. $("#tryFlag").parent().addClass("checked");
  1239. } else {
  1240. $("#tryFlag").parent().removeClass("checked");
  1241. }
  1242. $("#gross").val(mzChargeDetail.quantity);
  1243. $("#totalRetprice").val(Multiply(mzChargeDetail.quantity, $("#packRetprice").val()).toFixed(2));
  1244. $("#medicalAdvice").selectpicker('val', mzChargeDetail.instructionCode);
  1245. $('#medicalAdvice').selectpicker('refresh');
  1246. saveWesternMedicine(false);
  1247. } else {
  1248. //中药与颗粒剂
  1249. checkZyInfo(code, serial, false);
  1250. //类型
  1251. $("#zyClassType").selectpicker('val', groupNo);
  1252. $('#zyClassType').selectpicker('refresh');
  1253. $("#zy_drugWin").val(mzChargeDetail.quantity);
  1254. $("#zyInstruction").selectpicker('val', mzChargeDetail.instructionCode);
  1255. $('#zyInstruction').selectpicker('refresh');
  1256. saveChineseMedicine(false);
  1257. if (!hadSetZyFullParams) {
  1258. hadSetZyFullParams = true;
  1259. $("input.zyfs").val(mzChargeDetail.drugWin);
  1260. $("#zy_orderFrequency_1").selectpicker('val', mzChargeDetail.frequency);
  1261. $('#zy_orderFrequency_1').selectpicker('refresh');
  1262. $("#useType_1").selectpicker('val', mzChargeDetail.cyFysm);
  1263. $('#useType_1').selectpicker('refresh');
  1264. $("#cyJssm").selectpicker('val', mzChargeDetail.cyJssm);
  1265. $('#cyJssm').selectpicker('refresh');
  1266. $("#zy_supplyType_1").selectpicker('val', mzChargeDetail.cyDj);
  1267. $('#zy_supplyType_1').selectpicker('refresh');
  1268. }
  1269. }
  1270. }
  1271. }
  1272. //检验与检查
  1273. var mzYjReqList = jsonData.mzYjReqList;
  1274. if (mzYjReqList != null && mzYjReqList.length > 0) {
  1275. for (var i = 0; i < mzYjReqList.length; i++) {
  1276. var mzYjReq = mzYjReqList[i];
  1277. var code = mzYjReq.orderCode;
  1278. checkJcJyItemInfo(code, null, false);
  1279. $("#remark").val(mzYjReq.jyRemark);
  1280. saveJyJcItem(false);
  1281. }
  1282. }
  1283. //设置总金额
  1284. calculateTotalAmount();
  1285. }
  1286. /**
  1287. * 调用医疗范文
  1288. */
  1289. function callTemplate() {
  1290. clearWorkSpace();
  1291. $.ajax({
  1292. type: "GET",
  1293. url: '/thmz/getTemplateById?id=' + $("#idTemplate").val(),
  1294. contentType: "application/json;charset=UTF-8",
  1295. dataType: "json",
  1296. async: false,
  1297. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1298. success: function (res) {
  1299. if (res == '401' || res == 401) {
  1300. window.location.href = '/thmz/login/view'
  1301. return;
  1302. }
  1303. if (res.code == 0) {
  1304. var jsonData = JSON.parse(res.data.templateData);
  1305. editPrescription(jsonData);
  1306. $("#medicalModelModal").modal("hide");
  1307. closePopover();
  1308. } else {
  1309. errorMesage(res);
  1310. }
  1311. }
  1312. });
  1313. }
  1314. /**
  1315. * 底层填充推荐方法
  1316. * @param paramsType
  1317. * @param appeal
  1318. * @param inputId
  1319. */
  1320. function extracted(paramsType, appeal, inputId) {
  1321. if (paramsType == 13) {
  1322. var contentArr = appeal.split(",");
  1323. if (contentArr != null && contentArr.length > 0) {
  1324. for (var i = 0; i < contentArr.length; i++) {
  1325. var content = contentArr[i].replace(")", "").replace("(", "-");
  1326. var diagnoseArr = content.split("-");
  1327. if (diagnoseArr == null || diagnoseArr.length == 0) {
  1328. continue;
  1329. }
  1330. fitDiagnoseValue(diagnoseArr[0], diagnoseArr[1]);
  1331. }
  1332. }
  1333. } else {
  1334. $("#" + inputId).val(appeal);
  1335. }
  1336. }
  1337. /**
  1338. * 填充推荐
  1339. * @param appeal
  1340. * @param paramsType
  1341. */
  1342. function fitAppeal(appeal, paramsType) {
  1343. var inputId = "symptom";
  1344. var text = "主诉项已经录入,是否覆盖?";
  1345. if (paramsType == 5) {
  1346. inputId = "emrHpi";
  1347. text = "现病史项已经录入,是否覆盖?";
  1348. } else if (paramsType == 6) {
  1349. inputId = "emrPs";
  1350. text = "既往史项已经录入,是否覆盖?";
  1351. } else if (paramsType == 13) {
  1352. inputId = "diagnoseValue";
  1353. text = "诊断项已经录入,是否覆盖?";
  1354. }
  1355. var symptom = $("#" + inputId).val();
  1356. if (paramsType == 13 && (symptom == ",," || symptom == ",")) {
  1357. symptom = null;
  1358. }
  1359. if (symptom != null && symptom != "") {
  1360. $("#messageModal").modal();
  1361. $("#messageContent").html(text);
  1362. $("#messageButton").off("click").on("click", function (t) {
  1363. $("#messageModal").modal("hide");
  1364. if (paramsType == 13) {
  1365. $("#" + inputId).val(null);
  1366. $("#diagnoseTags").html(null);
  1367. }
  1368. extracted(paramsType, appeal, inputId);
  1369. });
  1370. } else {
  1371. extracted(paramsType, appeal, inputId);
  1372. }
  1373. }
  1374. /**
  1375. * 初始嘱托下拉选
  1376. */
  1377. function initInstructionSelect() {
  1378. //西药医嘱
  1379. $.ajax({
  1380. type: "GET",
  1381. url: '/thmz/getMzZdInstructionByType?instructionType=0',
  1382. contentType: "application/json;charset=UTF-8",
  1383. dataType: "json",
  1384. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1385. success: function (res) {
  1386. if (res == '401' || res == 401) {
  1387. window.location.href = '/thmz/login/view'
  1388. return;
  1389. }
  1390. if (res.code == 0) {
  1391. res.data.forEach(function (item, index) {
  1392. var html = '<option value="' + item.code + '">' + item.instructionText + '</option>';
  1393. $('#medicalAdvice').append(html);
  1394. });
  1395. $('#medicalAdvice').selectpicker('refresh');
  1396. } else {
  1397. errorMesage(res);
  1398. }
  1399. }
  1400. });
  1401. //中药医嘱
  1402. $.ajax({
  1403. type: "GET",
  1404. url: '/thmz/getMzZdInstructionByType?instructionType=1',
  1405. contentType: "application/json;charset=UTF-8",
  1406. dataType: "json",
  1407. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1408. success: function (res) {
  1409. if (res == '401' || res == 401) {
  1410. window.location.href = '/thmz/login/view'
  1411. return;
  1412. }
  1413. if (res.code == 0) {
  1414. res.data.forEach(function (item, index) {
  1415. var html = '<option value="' + item.code + '">' + item.instructionText.trim() + '</option>';
  1416. $('#zyInstruction').append(html);
  1417. });
  1418. $('#zyInstruction').selectpicker('refresh');
  1419. } else {
  1420. errorMesage(res);
  1421. }
  1422. }
  1423. });
  1424. }
  1425. /**
  1426. * 设置下拉选的尺寸
  1427. */
  1428. function setSelectSize() {
  1429. $(".selectpicker").selectpicker({
  1430. dropuAuto: false,
  1431. size: 10
  1432. });
  1433. }
  1434. /**
  1435. * 初始化性别下拉选
  1436. */
  1437. function initGenderSelect() {
  1438. var gender = '<option value="1">男</option><option value="2">女</option><option value="0">未知</option>';
  1439. $('#rapidAcceptsUserGender').html(gender);
  1440. $('#rapidAcceptsUserGender').selectpicker('refresh');
  1441. $('#editUserGender').html(gender);
  1442. $('#editUserGender').selectpicker('refresh');
  1443. //医疗范文状态
  1444. var templateStatus = '<option value="0">启用</option><option value="1">停用</option>';
  1445. $('#templateStatus').html(templateStatus);
  1446. $('#templateStatus').selectpicker('refresh');
  1447. }
  1448. /**
  1449. * 初始化中药类型下拉选
  1450. */
  1451. function initZyClassTypeSelect() {
  1452. var gender = '<option value="81">普通</option><option value="82">颗粒剂</option>';
  1453. $('#zyClassType').html(gender);
  1454. $('#zyClassType').selectpicker('refresh');
  1455. //$('#zyClassType').selectpicker('val', "81");
  1456. // $('#zyClassType').selectpicker('refresh');
  1457. }
  1458. /**
  1459. * 初始化病人身份类别下拉选
  1460. */
  1461. function initResponceTypeSelect() {
  1462. $.ajax({
  1463. type: "GET",
  1464. url: '/thmz/getMzResponceType',
  1465. contentType: "application/json;charset=UTF-8",
  1466. dataType: "json",
  1467. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1468. success: function (res) {
  1469. if (res == '401' || res == 401) {
  1470. window.location.href = '/thmz/login/view'
  1471. return;
  1472. }
  1473. if (res.code == 0) {
  1474. res.data.forEach(function (item, index) {
  1475. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  1476. $('#patientsNature').append(html);
  1477. $('#editUserPatientsNature').append(html);
  1478. });
  1479. $('#patientsNature').selectpicker('refresh');
  1480. $('#editUserPatientsNature').selectpicker('refresh');
  1481. } else {
  1482. errorMesage(res);
  1483. }
  1484. }
  1485. });
  1486. }
  1487. /**
  1488. * 初始化医疗范文类型下拉选
  1489. */
  1490. function initTemplateTypeSelect() {
  1491. $.ajax({
  1492. type: "GET",
  1493. url: '/thmz/getTemplateTypes',
  1494. contentType: "application/json;charset=UTF-8",
  1495. dataType: "json",
  1496. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1497. success: function (res) {
  1498. if (res == '401' || res == 401) {
  1499. window.location.href = '/thmz/login/view'
  1500. return;
  1501. }
  1502. if (res.code == 0) {
  1503. res.data.forEach(function (item) {
  1504. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  1505. $('#templateType').append(html);
  1506. });
  1507. $('#templateType').selectpicker('refresh');
  1508. } else {
  1509. errorMesage(res);
  1510. }
  1511. }
  1512. });
  1513. }
  1514. /**
  1515. * 初始频次下拉选
  1516. * @param id
  1517. * @param async 是否是异步 true 异步 false 同步
  1518. */
  1519. function initOrderFrequencys(id, async) {
  1520. $.ajax({
  1521. type: "GET",
  1522. url: '/thmz/getOrderFrequencys',
  1523. dataType: "json",
  1524. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1525. async: async,
  1526. success: function (res) {
  1527. if (res == '401' || res == 401) {
  1528. window.location.href = '/thmz/login/view'
  1529. return;
  1530. }
  1531. var html = '';
  1532. $.each(res.data, function (commentIndex, comment) {
  1533. html += '<option value="' + comment.code + '" desc="' + comment.times + '">' + comment.name + '(' + comment.code + ')' + '</option>';
  1534. });
  1535. $('#' + id).empty();
  1536. $('#' + id).html(html);
  1537. $('#' + id).selectpicker('refresh');
  1538. }
  1539. });
  1540. }
  1541. /**
  1542. * 初始用药方式下拉选
  1543. */
  1544. function initSupplyTypes() {
  1545. $.ajax({
  1546. type: "GET",
  1547. url: '/thmz/getSupplyTypes',
  1548. dataType: "json",
  1549. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1550. success: function (res) {
  1551. if (res == '401' || res == 401) {
  1552. window.location.href = '/thmz/login/view'
  1553. return;
  1554. }
  1555. var html = '';
  1556. $.each(res.data, function (commentIndex, comment) {
  1557. if (comment.groupNo === "71") {
  1558. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')' + '</option>';
  1559. }
  1560. });
  1561. $('#supplyType').empty();
  1562. $('#supplyType').html(html);
  1563. $('#supplyType').selectpicker('refresh');
  1564. }
  1565. });
  1566. }
  1567. /**
  1568. * 初始煎药方式下拉选
  1569. * @param async 是否是异步 true 异步 false 同步
  1570. */
  1571. function initZySupplyTypes(id, async) {
  1572. setSelectSize();
  1573. $.ajax({
  1574. type: "GET",
  1575. url: '/thmz/getSupplyTypes',
  1576. dataType: "json",
  1577. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1578. async: async,
  1579. success: function (res) {
  1580. if (res == '401' || res == 401) {
  1581. window.location.href = '/thmz/login/view'
  1582. return;
  1583. }
  1584. var html = '';
  1585. $.each(res.data, function (commentIndex, comment) {
  1586. if (comment.groupNo === "81") {
  1587. // html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  1588. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')' + '</option>';
  1589. }
  1590. });
  1591. $('#' + id).empty();
  1592. $('#' + id).html(html);
  1593. $('#' + id).selectpicker('refresh');
  1594. }
  1595. });
  1596. }
  1597. /**
  1598. * 初始查检查部位
  1599. */
  1600. function initYshPart() {
  1601. setSelectSize();
  1602. $.ajax({
  1603. type: "GET",
  1604. url: '/thmz/getYshPart',
  1605. dataType: "json",
  1606. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1607. success: function (res) {
  1608. if (res == '401' || res == 401) {
  1609. window.location.href = '/thmz/login/view'
  1610. return;
  1611. }
  1612. var html = '';
  1613. $.each(res.data, function (commentIndex, comment) {
  1614. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')' + '</option>';
  1615. });
  1616. $('#yshPart').empty();
  1617. $('#yshPart').html(html);
  1618. $('#yshPart').selectpicker('refresh');
  1619. }
  1620. });
  1621. }
  1622. /**
  1623. * 初始化验物下拉选
  1624. */
  1625. function initJyZdSample() {
  1626. setSelectSize();
  1627. $.ajax({
  1628. type: "GET",
  1629. url: '/thmz/getJyZdSample',
  1630. dataType: "json",
  1631. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1632. success: function (res) {
  1633. if (res == '401' || res == 401) {
  1634. window.location.href = '/thmz/login/view'
  1635. return;
  1636. }
  1637. var html = '';
  1638. $.each(res.data, function (commentIndex, comment) {
  1639. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')' + '</option>';
  1640. });
  1641. $('#jyZdSample').empty();
  1642. $('#jyZdSample').html(html);
  1643. $('#jyZdSample').selectpicker('refresh');
  1644. }
  1645. });
  1646. }
  1647. /**
  1648. * 保存当前药品到右边处方区域
  1649. * @param index 0 西药 1中药 2 诊疗和社备
  1650. */
  1651. function saveMedicine(index) {
  1652. if (index == 0) {
  1653. // //每个处方不能超过5个药品
  1654. // var tableId = $("#xyTab li.active").find("a").attr("href");
  1655. // var childrens = $(tableId).find("div:eq(0)").children().length;
  1656. // if (childrens === 5) {
  1657. // $("#messageModal").modal();
  1658. // $("#messageContent").html("单张处方最多只能开具5个药品,是否需要新增处方?");
  1659. // $("#messageButton").off("click").on("click", function (t) {
  1660. // $("#messageModal").modal("hide");
  1661. // refreshNavTabs(index);
  1662. // saveWesternMedicine();
  1663. // });
  1664. // } else {
  1665. // saveWesternMedicine();
  1666. // }
  1667. saveWesternMedicine(true);
  1668. } else if (index == 1) {
  1669. saveChineseMedicine(true);
  1670. }
  1671. }
  1672. /**
  1673. * 保存当前药品到右边处方区域 西药
  1674. * calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  1675. */
  1676. function saveWesternMedicine(calculateTotalAmountFlag) {
  1677. //组号
  1678. var groupId = $("#groupId").val();
  1679. //药品名称
  1680. var westernMedicineNamme = $("#western_medicine_name").val();
  1681. //当前药品编码
  1682. var currentCode = $("#current_code").val();
  1683. //当前药品规格
  1684. var currentSerial = $("#current_serial").val();
  1685. //当前药房编码
  1686. var currentGroupNo = $("#current_groupNo").val();
  1687. //用法编码
  1688. var supplyType = $("#supplyType").val();
  1689. //用法描述
  1690. var supplyTypeText = $('#supplyType option:selected').text();
  1691. //药品默认单次使用剂量
  1692. var drugWinDb = $("#drugWinDb").val();
  1693. //处方实际单次使用剂量
  1694. var drugWin = $("#drugWin").val();
  1695. //剂量单位
  1696. var drugWinUnit = $('#drugWinUnit option:selected').text();
  1697. //天数
  1698. var dayNum = $("#dayNum").val();
  1699. //频次编码
  1700. var orderFrequency = $("#orderFrequency").val();
  1701. //频次描述
  1702. var orderFrequencyText = $('#orderFrequency option:selected').text();
  1703. //总量
  1704. var gross = $("#gross").val();
  1705. //包装单位
  1706. var packUnit = $("#packUnit").val();
  1707. if (packUnit == null) {
  1708. packUnit = "";
  1709. }
  1710. //医嘱码
  1711. var medicalAdvice = $("#medicalAdvice").val();
  1712. //医嘱内容
  1713. var medicalAdviceText = $('#medicalAdvice option:selected').text();
  1714. //金额
  1715. var totalRetprice = parseFloat($("#totalRetprice").val());
  1716. //单价
  1717. var packRetprice = $("#packRetprice").val();
  1718. //皮试
  1719. var tryFlag = $("#tryFlag").parent().hasClass("checked");
  1720. if (currentCode == null || currentCode == '') {
  1721. errorMesageSimaple("未选择任何药品!");
  1722. return;
  1723. }
  1724. if (currentGroupNo != '91') {
  1725. if (supplyType == null || supplyType == "") {
  1726. errorMesageSimaple("用法为空!");
  1727. return;
  1728. }
  1729. if (drugWin == null || drugWin == "") {
  1730. errorMesageSimaple("剂量为空!");
  1731. return;
  1732. }
  1733. if (dayNum == null || dayNum == "") {
  1734. errorMesageSimaple("天数为空!");
  1735. return;
  1736. }
  1737. if (orderFrequency == null || orderFrequency == "") {
  1738. errorMesageSimaple("频次为空!");
  1739. return;
  1740. }
  1741. }
  1742. if (gross == null || gross == "") {
  1743. errorMesageSimaple("总量为空!");
  1744. return;
  1745. }
  1746. var html = '<div class="form-group">';
  1747. html += groupId + '.<span style="margin-left: 5px"></span>';
  1748. html += westernMedicineNamme + ' ';
  1749. html += drugWinDb + drugWinUnit + ' ';
  1750. html += drugWin + drugWinUnit + ' 共';
  1751. html += gross + packUnit + '<br/><span style="margin-left: 15px"></span>';
  1752. html += '用法:' + supplyTypeText + ' ';
  1753. html += '频次:' + orderFrequencyText + ' ';
  1754. html += dayNum + '天 ';
  1755. if (tryFlag == "true" || tryFlag == true) {
  1756. html += '皮试 ';
  1757. }
  1758. if (medicalAdvice != null && medicalAdvice != '') {
  1759. html += '医嘱:' + medicalAdviceText;
  1760. }
  1761. html += ' <i class="fa fa-long-arrow-left" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;margin-left: 10px;" onclick="editWesternMedicine(this)"></i>';
  1762. 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>';
  1763. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  1764. html += '<input type="hidden" class="temporary_items_serial" value="' + currentSerial + '"/>';
  1765. html += '<input type="hidden" class="temporary_items_amount" value="' + totalRetprice + '"/>';
  1766. html += '<input type="hidden" class="temporary_items_groupId" value="' + groupId + '"/>';
  1767. html += '<input type="hidden" class="temporary_items_westernMedicineNamme" value="' + westernMedicineNamme + '"/>';
  1768. html += '<input type="hidden" class="temporary_items_drugWinDb" value="' + drugWinDb + '"/>';
  1769. html += '<input type="hidden" class="temporary_items_drugWin" value="' + drugWin + '"/>';
  1770. html += '<input type="hidden" class="temporary_items_drugWinUnit" value="' + $("#drugWinUnit").val() + '"/>';
  1771. html += '<input type="hidden" class="temporary_items_gross" value="' + gross + '"/>';
  1772. html += '<input type="hidden" class="temporary_items_packUnit" value="' + packUnit + '"/>';
  1773. html += '<input type="hidden" class="temporary_items_supplyType" value="' + supplyType + '"/>';
  1774. html += '<input type="hidden" class="temporary_items_orderFrequency" value="' + orderFrequency + '"/>';
  1775. html += '<input type="hidden" class="temporary_items_dayNum" value="' + dayNum + '"/>';
  1776. html += '<input type="hidden" class="temporary_items_medicalAdvice" value="' + medicalAdvice + '"/>';
  1777. html += '<input type="hidden" class="temporary_items_medicalAdviceText" value="' + medicalAdviceText + '"/>';
  1778. html += '<input type="hidden" class="temporary_items_packRetprice" value="' + packRetprice + '"/>';
  1779. html += '<input type="hidden" class="temporary_items_tryFlag" value="' + tryFlag + '"/>';
  1780. html += '</div>';
  1781. var tableId = $("#xyTab li.active").find("a").attr("href");
  1782. //是新增药品还是编辑 true 修改 默认false
  1783. var updateFlag = $("#update_flag").val();
  1784. if (updateFlag == undefined || updateFlag == null) {
  1785. updateFlag = false;
  1786. }
  1787. // //原药品金额 如果是修改则需要设置
  1788. // var temporaryItemsAmount = 0;
  1789. //当前需要被移除元素的下个兄弟节点
  1790. var nextObj = null;
  1791. //当前修改的药品是不是最后一个
  1792. var isLast = false;
  1793. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  1794. if (formGroups != null && formGroups.length > 0) {
  1795. //如果是修改,需要减去原来的费用
  1796. if (updateFlag == "true" || updateFlag == true) {
  1797. for (var i = 0; i < formGroups.length; i++) {
  1798. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  1799. var temporaryItemsSerial = $(formGroups[i]).find("input.temporary_items_serial").val();
  1800. if (temporaryItemsCode === currentCode && temporaryItemsSerial === currentSerial) {
  1801. //temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  1802. if (formGroups.length > 1) {
  1803. nextObj = $(formGroups[i]).next();
  1804. }
  1805. isLast = (i + 1) === formGroups.length;
  1806. $(formGroups[i]).remove();
  1807. break;
  1808. }
  1809. }
  1810. } else {
  1811. //因为药品可以换组号,要保证相同组号的在一起
  1812. for (var i = 0; i < formGroups.length; i++) {
  1813. var temporaryItemsGroupId = parseInt($(formGroups[i]).find("input.temporary_items_groupId").val());
  1814. //如果当前的组号小与遍历到的组号,说明是原组号的下一个兄弟节点,新的药品插入到兄弟节点前就可以了
  1815. if (temporaryItemsGroupId > groupId) {
  1816. nextObj = $(formGroups[i]);
  1817. break;
  1818. }
  1819. }
  1820. }
  1821. }
  1822. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  1823. if (nextObj == null || isLast) {
  1824. $(tableId).find("div:eq(0)").append(html);
  1825. } else {
  1826. $(nextObj).before(html);
  1827. }
  1828. //设置当前处方金额
  1829. //calculateCfAmount(tableId, totalRetprice, temporaryItemsAmount, 0, 0);
  1830. if (calculateTotalAmountFlag) {
  1831. //设置总金额
  1832. calculateTotalAmount();
  1833. }
  1834. //判断当前组号是不是最后一个,是最后一个组号,就需要新增组号
  1835. var groupIdLast = $("#groupId option:last-child").text();
  1836. if (groupId === groupIdLast) {
  1837. appendGroupOrder();
  1838. }
  1839. //设置药品的用法,频次,天数
  1840. var map = groupIdMap.get(groupId);
  1841. if (map == null) {
  1842. map = new Map();
  1843. map.put("supplyType", supplyType);
  1844. map.put("orderFrequency", orderFrequency);
  1845. map.put("dayNum", dayNum);
  1846. groupIdMap.put(groupId, map);
  1847. }
  1848. //设置当前药品的品类
  1849. $(tableId).find("input.current_groupNo").val($("#current_groupNo").val());
  1850. clearWesternMedicine(false);
  1851. }
  1852. /**
  1853. * 上移
  1854. * @param obj
  1855. */
  1856. function arrowUp(obj) {
  1857. var parentObject = $(obj).parent();
  1858. if ($(parentObject).prev() == null) {
  1859. return;
  1860. }
  1861. //当前元素的序号
  1862. var thisJcjyItemGroupId = null;
  1863. //前一个兄弟节点的序号
  1864. var prevJcjyItemGroupId = null;
  1865. //当是项目时有序号,进行序号调整
  1866. if ($(parentObject).find("span.jcjyItemGroupId") != null) {
  1867. thisJcjyItemGroupId = $(parentObject).find("span.jcjyItemGroupId").html();
  1868. prevJcjyItemGroupId = $(parentObject).prev().find("span.jcjyItemGroupId").html();
  1869. $(parentObject).find("span.jcjyItemGroupId").html(prevJcjyItemGroupId);
  1870. $(parentObject).prev().find("span.jcjyItemGroupId").html(thisJcjyItemGroupId);
  1871. }
  1872. $(parentObject).prev().before($(parentObject));
  1873. }
  1874. /**
  1875. * 下移
  1876. * @param obj
  1877. */
  1878. function arrowDown(obj) {
  1879. var parentObject = $(obj).parent();
  1880. if ($(parentObject).next() == null) {
  1881. return;
  1882. }
  1883. //当前元素的序号
  1884. var thisJcjyItemGroupId = null;
  1885. //后一个兄弟节点的序号
  1886. var afterJcjyItemGroupId = null;
  1887. //当是项目时有序号,进行序号调整
  1888. if ($(parentObject).find("span.jcjyItemGroupId") != null) {
  1889. thisJcjyItemGroupId = $(parentObject).find("span.jcjyItemGroupId").html();
  1890. afterJcjyItemGroupId = $(parentObject).after().find("span.jcjyItemGroupId").html();
  1891. $(parentObject).find("span.jcjyItemGroupId").html(afterJcjyItemGroupId);
  1892. $(parentObject).after().find("span.jcjyItemGroupId").html(thisJcjyItemGroupId);
  1893. }
  1894. $(parentObject).next().after($(parentObject));
  1895. }
  1896. /**
  1897. * 修改西药
  1898. * @param obj
  1899. */
  1900. function editWesternMedicine(obj) {
  1901. //是新增药品还是编辑 true 修改 默认false
  1902. $("#update_flag").val(true);
  1903. var parentObject = $(obj).parent();
  1904. //组号
  1905. $("#groupId").val($(parentObject).find("input.temporary_items_groupId").val());
  1906. $('#groupId').selectpicker('refresh');
  1907. //药品名称
  1908. $("#western_medicine_name").val($(parentObject).find("input.temporary_items_westernMedicineNamme").val());
  1909. var code = $(parentObject).find("input.temporary_items_code").val();
  1910. var serial = $(parentObject).find("input.temporary_items_serial").val();
  1911. //当前药品编码
  1912. $("#current_code").val(code);
  1913. //当前药品规格
  1914. $("#current_serial").val(serial);
  1915. //用法编码
  1916. $("#supplyType").val($(parentObject).find("input.temporary_items_supplyType").val());
  1917. $('#supplyType').selectpicker('refresh');
  1918. //药品默认单次使用剂量
  1919. $("#drugWinDb").val($(parentObject).find("input.temporary_items_drugWinDb").val());
  1920. //处方实际单次使用剂量
  1921. $("#drugWin").val($(parentObject).find("input.temporary_items_drugWin").val());
  1922. //天数
  1923. $("#dayNum").val($(parentObject).find("input.temporary_items_dayNum").val());
  1924. $('#dayNum').selectpicker('refresh');
  1925. //频次编码
  1926. $("#orderFrequency").val($(parentObject).find("input.temporary_items_orderFrequency").val());
  1927. $('#orderFrequency').selectpicker('refresh');
  1928. //总量
  1929. $("#gross").val($(parentObject).find("input.temporary_items_gross").val());
  1930. //医嘱
  1931. $("#medicalAdvice").val($(parentObject).find("input.temporary_items_medicalAdvice").val());
  1932. $('#medicalAdvice').selectpicker('refresh');
  1933. //金额
  1934. $("#totalRetprice").val($(parentObject).find("input.temporary_items_amount").val());
  1935. //单价
  1936. $("#packRetprice").val($(parentObject).find("input.temporary_items_packRetprice").val());
  1937. //皮试
  1938. var tryFlag = $(parentObject).find("input.temporary_items_tryFlag").val();
  1939. if (tryFlag == true || tryFlag == "true") {
  1940. $("#tryFlag").parent().addClass("checked");
  1941. $("#tryFlag").parent().parent().parent().removeClass("hide").addClass("in");
  1942. }
  1943. $.ajax({
  1944. type: "GET",
  1945. url: '/thmz/getYpZdDictByCodeAndSerial?code=' + code + "&serial=" + serial,
  1946. contentType: "application/json;charset=UTF-8",
  1947. dataType: "json",
  1948. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1949. success: function (res) {
  1950. if (res == '401' || res == 401) {
  1951. window.location.href = '/thmz/login/view'
  1952. return;
  1953. }
  1954. if (res.code == 0) {
  1955. if (res.data != null) {
  1956. var drugWinHtml = '';
  1957. if (res.data.weight != null) {
  1958. $("#drugWin").val(res.data.weight);
  1959. $("#drugWinDb").val(res.data.weight);
  1960. drugWinHtml = '<option value="' + res.data.weighUnit + '" desc="' + res.data.weight + '">' + res.data.weighUnitDesc + '</option>';
  1961. }
  1962. if (res.data.volum != null) {
  1963. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  1964. $("#drugWin").val(res.data.volum);
  1965. $("#drugWinDb").val(res.data.volum);
  1966. }
  1967. drugWinHtml += '<option value="' + res.data.volUnit + '" desc="' + res.data.volum + '">' + res.data.volUnitDesc + '</option>';
  1968. }
  1969. if (res.data.miniUnit != null && res.data.miniUnit != "") {
  1970. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  1971. $("#drugWin").val(1);
  1972. $("#drugWinDb").val(1);
  1973. }
  1974. drugWinHtml += '<option value="' + res.data.miniUnit + '" desc="1">' + res.data.miniUnitDesc + '</option>';
  1975. }
  1976. $('#drugWinUnit').html(drugWinHtml);
  1977. $('#drugWinUnit').selectpicker('refresh');
  1978. //剂量单位
  1979. $("#drugWinUnit").val($(parentObject).find("input.temporary_items_drugWinUnit").val());
  1980. $('#drugWinUnit').selectpicker('refresh');
  1981. if (res.data.packUnitDesc != null && res.data.packUnitDesc != "") {
  1982. var html = '<option value="' + res.data.packUnitDesc + '" >' + res.data.packUnitDesc + '</option>';
  1983. $('#packUnit').html(html);
  1984. $('#packUnit').selectpicker('refresh');
  1985. //包装单位
  1986. $("#packUnit").val($(parentObject).find("input.temporary_items_packUnit").val());
  1987. $('#packUnit').selectpicker('refresh');
  1988. }
  1989. if (res.data.psFlag != null && (res.data.psFlag == 1 || res.data.psFlag == "1")) {
  1990. $("#tryFlag").parent().parent().parent().removeClass("hide").addClass("in");
  1991. } else {
  1992. $("#tryFlag").parent().parent().parent().removeClass("in").addClass("hide");
  1993. }
  1994. }
  1995. } else {
  1996. errorMesage(res);
  1997. }
  1998. }
  1999. });
  2000. }
  2001. /**
  2002. * 修改中药
  2003. * @param obj
  2004. */
  2005. function editChineseMedicine(obj) {
  2006. //是新增药品还是编辑 true 修改 默认false
  2007. $("#update_flag").val(true);
  2008. var parentObject = $(obj).parent();
  2009. //当前药品编码
  2010. $("#current_code").val($(parentObject).find("input.temporary_items_code").val());
  2011. //当前药品规格
  2012. $("#current_serial").val($(parentObject).find("input.temporary_items_serial").val());
  2013. //中药类型
  2014. $("#zyClassType").val($(parentObject).find("input.temporary_items_zyClassType").val());
  2015. $('#zyClassType').selectpicker('refresh');
  2016. //药品名称
  2017. $("#chinese_medicine_name").val($(parentObject).find("input.temporary_items_chineseMedicineNamme").val());
  2018. //单价
  2019. $("#zy_packRetprice").val($(parentObject).find("input.temporary_items_zyPackRetprice").val());
  2020. //处方实际单次使用剂量
  2021. $("#zy_drugWin").val($(parentObject).find("input.temporary_items_drugWin").val());
  2022. //医嘱码
  2023. $("#zyInstruction").val($(parentObject).find("input.temporary_items_zyInstruction").val());
  2024. $('#zyInstruction').selectpicker('refresh');
  2025. }
  2026. /**
  2027. * 修改项目
  2028. * @param obj
  2029. */
  2030. function editJyJcItem(obj) {
  2031. //是新增药品还是编辑 true 修改 默认false
  2032. $("#update_flag").val(true);
  2033. var parentObject = $(obj).parent();
  2034. //当前项目编码
  2035. $("#current_code").val($(parentObject).find("input.temporary_items_code").val());
  2036. //项目名称
  2037. $("#jcJyItem").val($(parentObject).find("input.temporary_items_jcJyItemName").val());
  2038. //单价
  2039. $("#jcjyItemPrice").val($(parentObject).find("input.temporary_items_amount").val());
  2040. //备注
  2041. $("#remark").val($(parentObject).find("input.temporary_items_remark").val());
  2042. var chargeUnit = $(parentObject).find("input.temporary_items_desc_value").val();
  2043. var jcJyZltype = $(parentObject).find("input.temporary_items_type").val();
  2044. if (jcJyZltype == 1 || jcJyZltype == "1") {
  2045. $("#jyZdSample").selectpicker('val', chargeUnit);
  2046. $('#jyZdSample').selectpicker('refresh');
  2047. $("#jyZdSampleDiv").removeClass("hide").addClass("in");
  2048. $("#chargeUnitDiv").removeClass("in").addClass("hide");
  2049. $("#yshPartDiv").removeClass("in").addClass("hide");
  2050. } else if (jcJyZltype == 2 || jcJyZltype == "2") {
  2051. $("#yshPart").selectpicker('val', chargeUnit);
  2052. $('#yshPart').selectpicker('refresh');
  2053. $("#yshPartDiv").removeClass("hide").addClass("in");
  2054. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  2055. $("#chargeUnitDiv").removeClass("in").addClass("hide");
  2056. } else if (jcJyZltype == 3 || jcJyZltype == "3") {
  2057. //描述
  2058. $("#chargeUnit").val(chargeUnit);
  2059. $("#chargeUnitDiv").removeClass("hide").addClass("in");
  2060. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  2061. $("#yshPartDiv").removeClass("in").addClass("hide");
  2062. }
  2063. $("#jcJyZltype").val(jcJyZltype);
  2064. }
  2065. /**
  2066. * 保存当前项目到右边处方区域
  2067. * @param calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  2068. */
  2069. function saveJyJcItem(calculateTotalAmountFlag) {
  2070. var tableId = $("#zlTab li.active").find("a").attr("href");
  2071. //组号
  2072. var groupId = $(tableId).find("div:eq(0)").children().length + 1;
  2073. //项目名称
  2074. var jcJyItem = $("#jcJyItem").val();
  2075. //当前项目编码
  2076. var currentCode = $("#current_code").val();
  2077. //当前项目价格
  2078. var jcjyItemPrice = $("#jcjyItemPrice").val();
  2079. //描述
  2080. var chargeUnit = $("#chargeUnit").val();
  2081. //描述编码
  2082. var chargeUnitCode = chargeUnit;
  2083. var chargeUnitName = "描述:";
  2084. //备注
  2085. var remark = $("#remark").val();
  2086. //项目类型
  2087. var jcJyZltype = $("#jcJyZltype").val();
  2088. if (jcJyZltype == "1" || jcJyZltype == 1) {
  2089. //检验
  2090. chargeUnit = $('#jyZdSample option:selected').text();
  2091. chargeUnitCode = $('#jyZdSample').val();
  2092. chargeUnitName = "检验物:";
  2093. } else if (jcJyZltype == "2" || jcJyZltype == 2) {
  2094. //检查
  2095. chargeUnit = $('#yshPart option:selected').text();
  2096. chargeUnitCode = $('#yshPart').val();
  2097. chargeUnitName = "检查部位:";
  2098. }
  2099. if (currentCode == null || currentCode == '') {
  2100. errorMesageSimaple("未选择任何项目!");
  2101. return;
  2102. }
  2103. //原药品金额 如果是修改则需要设置
  2104. var temporaryItemsAmount = 0;
  2105. //当前需要被移除元素的下个兄弟节点
  2106. var nextObj = null;
  2107. //当前修改的药品是不是最后一个
  2108. var isLast = false;
  2109. //是新增药品还是编辑 true 修改 默认false
  2110. var updateFlag = $("#update_flag").val();
  2111. if (updateFlag == undefined || updateFlag == null) {
  2112. updateFlag = false;
  2113. }
  2114. //如果是修改,需要减去原来的费用
  2115. //原组号
  2116. var oriGroupId = null;
  2117. if (updateFlag == "true" || updateFlag == true) {
  2118. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  2119. if (formGroups != null && formGroups.length > 0) {
  2120. for (var i = 0; i < formGroups.length; i++) {
  2121. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  2122. if (temporaryItemsCode === currentCode) {
  2123. temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  2124. if (formGroups.length > 1) {
  2125. nextObj = $(formGroups[i]).next();
  2126. }
  2127. isLast = (i + 1) === formGroups.length;
  2128. oriGroupId = $(formGroups[i]).find("span.jcjyItemGroupId").text();
  2129. $(formGroups[i]).remove();
  2130. break;
  2131. }
  2132. }
  2133. }
  2134. }
  2135. if (oriGroupId != null) {
  2136. groupId = oriGroupId;
  2137. }
  2138. var html = '<div class="form-group">';
  2139. html += '<span class="jcjyItemGroupId">' + groupId + '</span>.<span style="margin-left: 5px"></span>'
  2140. html += jcJyItem + ' ';
  2141. if (chargeUnit != null && chargeUnit != '') {
  2142. html += chargeUnitName + chargeUnit;
  2143. }
  2144. if (remark != null && remark != '') {
  2145. html += '备注:' + remark;
  2146. }
  2147. 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>';
  2148. 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>';
  2149. 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>';
  2150. 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>';
  2151. if ($("#jcJyItemChargeDetail").hasClass("in")) {
  2152. html += '<i class="fa fa-eye" style="cursor: pointer;height: 20px;line-height: 20px;width: 20px;font-size: 20px;" onclick="getJcJyItemChargeByCode(\'' + currentCode + '\')"></i>';
  2153. }
  2154. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  2155. html += '<input type="hidden" class="temporary_items_jcJyItemName" value="' + jcJyItem + '"/>';
  2156. html += '<input type="hidden" class="temporary_items_amount" value="' + jcjyItemPrice + '"/>';
  2157. html += '<input type="hidden" class="temporary_items_remark" value="' + remark + '"/>';
  2158. html += '<input type="hidden" class="temporary_items_type" value="' + jcJyZltype + '"/>';
  2159. html += '<input type="hidden" class="temporary_items_desc_value" value="' + chargeUnitCode + '"/>';
  2160. html += '</div>';
  2161. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  2162. if (nextObj == null || isLast) {
  2163. $(tableId).find("div:eq(0)").append(html);
  2164. } else {
  2165. $(nextObj).before(html);
  2166. }
  2167. //设置当前处方金额
  2168. //calculateCfAmount(tableId, jcjyItemPrice, temporaryItemsAmount, 2, 0);
  2169. if (calculateTotalAmountFlag) {
  2170. //设置总金额
  2171. calculateTotalAmount();
  2172. }
  2173. clearJyJcItem();
  2174. }
  2175. /**
  2176. * 删除药品或者项目
  2177. * @param index 0 西药 1 中药 2 项目
  2178. * @param obj 当前点击的对象
  2179. */
  2180. function removeYpOrProject(index, obj) {
  2181. var tabId = null;
  2182. //西药
  2183. if (index == 0) {
  2184. tabId = "xyTab";
  2185. } else if (index == 1) {
  2186. //中成药
  2187. tabId = "zyTab";
  2188. } else if (index == 2) {
  2189. //医技与诊疗
  2190. tabId = "zlTab";
  2191. }
  2192. var tableId = $("#" + tabId + " li.active").find("a").attr("href");
  2193. //var totalRetprice = $(obj).parent().find("input.temporary_items_amount").val();
  2194. //calculateCfAmount(tableId, totalRetprice, null, index, 1);
  2195. calculateTotalAmount();
  2196. $(obj).parent().remove();
  2197. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  2198. if (formGroups == null || formGroups.length == 0) {
  2199. if (index == 0) {
  2200. //西药被清空后,重置药房类型编码
  2201. $(tableId).find("input.current_groupNo").val(null);
  2202. //当本处方内容都被删除完后,也删除处方table
  2203. $("#" + tabId).find("a[href=\"" + tableId + "\"]").parent().remove();
  2204. $(tableId).remove();
  2205. //切换处方 最后一个被选中
  2206. $("#" + tabId).find("li:last > a").off("click").tab('show');
  2207. } else if (index == 1) {
  2208. //当中药处方被清空完后,重置当前中药类型为空
  2209. $("#current_zyClassType").val(null);
  2210. }
  2211. }
  2212. }
  2213. /**
  2214. * 清空西药
  2215. * @param flag 是否全部清空 因为 西药有分组,同一组的药品用药方式和频率以及天数一样,不能改变。所以不换组是不能改变 并且设置成不可编辑
  2216. */
  2217. function clearWesternMedicine(flag) {
  2218. $("#update_flag").val(false);
  2219. //药品名称
  2220. $("#western_medicine_name").val(null);
  2221. //当前药品编码
  2222. $("#current_code").val(null);
  2223. //当前药品规格
  2224. $("#current_serial").val(null);
  2225. //当前药房编码
  2226. $("#current_groupNo").val(null);
  2227. if (flag) {
  2228. //用法编码
  2229. $("#supplyType").selectpicker('val', null);
  2230. $('#supplyType').selectpicker('refresh');
  2231. //$("#supplyType").removeAttr("disabled");
  2232. //天数
  2233. $("#dayNum").selectpicker('val', null);
  2234. $('#dayNum').selectpicker('refresh');
  2235. // $("#dayNum").removeAttr("disabled");
  2236. //频次编码
  2237. $("#orderFrequency").selectpicker('val', null);
  2238. $('#orderFrequency').selectpicker('refresh');
  2239. // $("#orderFrequency").removeAttr("disabled");
  2240. }
  2241. //药品默认单次使用剂量
  2242. $("#drugWinDb").val(null);
  2243. //处方实际单次使用剂量
  2244. $("#drugWin").val(null);
  2245. //剂量单位
  2246. $("#drugWinUnit").selectpicker('val', null);
  2247. $('#drugWinUnit').selectpicker('refresh');
  2248. //总量
  2249. $("#gross").val(null);
  2250. //包装单位
  2251. $("#packUnit").selectpicker('val', null);
  2252. $('#packUnit').selectpicker('refresh');
  2253. //单价
  2254. $("#packRetprice").val(null);
  2255. //金额
  2256. $("#totalRetprice").val(null);
  2257. //医嘱
  2258. $("#medicalAdvice").selectpicker('val', null);
  2259. $('#medicalAdvice').selectpicker('refresh');
  2260. //皮试
  2261. $("#tryFlag").parent().removeClass('checked');
  2262. $("#tryFlag").parent().parent().parent().removeClass("in").addClass("hide");
  2263. $("#gross").attr("readonly", "readonly");
  2264. }
  2265. /**
  2266. * 保存当前药品到右边处方区域 中药
  2267. * calculateTotalAmountFlag 是否计算总金额 回写的时候一次计算
  2268. */
  2269. function saveChineseMedicine(calculateTotalAmountFlag) {
  2270. //药品名称
  2271. var chineseMedicineNamme = $("#chinese_medicine_name").val();
  2272. //当前药品编码
  2273. var currentCode = $("#current_code").val();
  2274. //当前药品规格
  2275. var currentSerial = $("#current_serial").val();
  2276. //处方实际单次使用剂量
  2277. var drugWin = $("#zy_drugWin").val();
  2278. //医嘱码
  2279. var zyInstruction = $("#zyInstruction").val();
  2280. //医嘱
  2281. var zyInstructionText = $('#zyInstruction option:selected').text();
  2282. //单价
  2283. var zyPackRetprice = parseFloat($("#zy_packRetprice").val());
  2284. //当前中药的总价
  2285. var totalRetprice = Multiply(drugWin, zyPackRetprice);
  2286. //中药类型
  2287. var zyClassType = $("#zyClassType").val();
  2288. //已经选中的药品类型, 中药不允许一个处方里有普通中药和颗粒剂
  2289. var currentYyClassType = $("#current_zyClassType").val();
  2290. if (currentYyClassType == null || currentYyClassType == "") {
  2291. //中药此时是第一次选择药品,不控制类型
  2292. $("#current_zyClassType").val(zyClassType);
  2293. } else if (currentYyClassType != zyClassType) {
  2294. errorMesageSimaple("同一个中药处方不允许同时出现普通中药和颗粒剂中药!");
  2295. return;
  2296. }
  2297. if (currentCode == null || currentCode == '') {
  2298. errorMesageSimaple("未选择任何药品!");
  2299. return;
  2300. }
  2301. var html = '<div class="form-group" style="float: left;">';
  2302. html += chineseMedicineNamme;
  2303. if (zyInstruction != null && zyInstruction != '') {
  2304. html += '[' + zyInstructionText + ']';
  2305. }
  2306. html += '<span style="margin-left: 5px"></span>';
  2307. html += drugWin + 'g';
  2308. 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>';
  2309. 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>';
  2310. 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>';
  2311. 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>';
  2312. html += '<input type="hidden" class="temporary_items_code" value="' + currentCode + '"/>';
  2313. html += '<input type="hidden" class="temporary_items_serial" value="' + currentSerial + '"/>';
  2314. html += '<input type="hidden" class="temporary_items_amount" value="' + totalRetprice + '"/>';
  2315. html += '<input type="hidden" class="temporary_items_zyClassType" value="' + zyClassType + '"/>';
  2316. html += '<input type="hidden" class="temporary_items_chineseMedicineNamme" value="' + chineseMedicineNamme + '"/>';
  2317. html += '<input type="hidden" class="temporary_items_zyPackRetprice" value="' + zyPackRetprice + '"/>';
  2318. html += '<input type="hidden" class="temporary_items_drugWin" value="' + drugWin + '"/>';
  2319. html += '<input type="hidden" class="temporary_items_zyInstruction" value="' + zyInstruction + '"/>';
  2320. html += '<input type="hidden" class="temporary_items_zyInstructionText" value="' + zyInstructionText + '"/>';
  2321. html += '</div>';
  2322. var tableId = $("#zyTab li.active").find("a").attr("href");
  2323. //原药品金额 如果是修改则需要设置
  2324. var temporaryItemsAmount = 0;
  2325. //当前需要被移除元素的下个兄弟节点
  2326. var nextObj = null;
  2327. //当前修改的药品是不是最后一个
  2328. var isLast = false;
  2329. //是新增药品还是编辑 true 修改 默认false
  2330. var updateFlag = $("#update_flag").val();
  2331. if (updateFlag == undefined || updateFlag == null) {
  2332. updateFlag = false;
  2333. }
  2334. //如果是修改,需要减去原来的费用
  2335. if (updateFlag == "true" || updateFlag == true) {
  2336. var formGroups = $(tableId).find("div.cf_content").find("div.form-group");
  2337. if (formGroups != null && formGroups.length > 0) {
  2338. for (var i = 0; i < formGroups.length; i++) {
  2339. var temporaryItemsCode = $(formGroups[i]).find("input.temporary_items_code").val();
  2340. var temporaryItemsSerial = $(formGroups[i]).find("input.temporary_items_serial").val();
  2341. if (temporaryItemsCode === currentCode && temporaryItemsSerial === currentSerial) {
  2342. temporaryItemsAmount = $(formGroups[i]).find("input.temporary_items_amount").val();
  2343. if (formGroups.length > 1) {
  2344. nextObj = $(formGroups[i]).next();
  2345. }
  2346. isLast = (i + 1) === formGroups.length;
  2347. $(formGroups[i]).remove();
  2348. break;
  2349. }
  2350. }
  2351. }
  2352. }
  2353. //当没有下一个兄弟节点或者当前编辑的药品是最后一个时,直接添加
  2354. if (nextObj == null || isLast) {
  2355. $(tableId).find("div:eq(0)").append(html);
  2356. } else {
  2357. $(nextObj).before(html);
  2358. }
  2359. //设置当前处方金额
  2360. // calculateCfAmount(tableId, totalRetprice, temporaryItemsAmount, 1, 0);
  2361. if (calculateTotalAmountFlag) {
  2362. //设置总金额
  2363. calculateTotalAmount();
  2364. }
  2365. clearChineseMedicine();
  2366. }
  2367. /**
  2368. * 清空中药
  2369. */
  2370. function clearChineseMedicine() {
  2371. $("#update_flag").val(false);
  2372. //药品名称
  2373. $("#chinese_medicine_name").val(null);
  2374. //当前药品编码
  2375. $("#current_code").val(null);
  2376. //当前药品规格
  2377. $("#current_serial").val(null);
  2378. //医嘱
  2379. $("#zyInstruction").selectpicker('val', null);
  2380. $('#zyInstruction').selectpicker('refresh');
  2381. //剂量
  2382. $("#zy_drugWin").val(null);
  2383. //单价
  2384. $("#zy_packRetprice").val(null);
  2385. }
  2386. /**
  2387. * 清空项目
  2388. */
  2389. function clearJyJcItem() {
  2390. $("#update_flag").val(false);
  2391. //项目名称
  2392. $("#jcJyItem").val(null);
  2393. //当前项目编码
  2394. $("#current_code").val(null);
  2395. //单价
  2396. $("#jcjyItemPrice").val(null);
  2397. //备注
  2398. $("#remark").val(null);
  2399. //描述
  2400. $("#chargeUnit").val(null);
  2401. $("#jcJyZltype").val(null);
  2402. $("#jyZdSample").selectpicker('val', null);
  2403. $('#jyZdSample').selectpicker('refresh');
  2404. $("#yshPart").selectpicker('val', null);
  2405. $('#yshPart').selectpicker('refresh');
  2406. $("#jcJyItemChargeDetail").removeClass("in").addClass("hide");
  2407. $("#chargeUnitDiv").removeClass("in").addClass("hide");
  2408. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  2409. $("#yshPartDiv").removeClass("in").addClass("hide");
  2410. }
  2411. /**
  2412. * 计算总金额
  2413. */
  2414. function calculateTotalAmount() {
  2415. var jsonData = getParamsForOrescription();
  2416. $.ajax({
  2417. type: "POST",
  2418. url: '/thmz/getAmountForTempPrescription',
  2419. contentType: "application/json;charset=UTF-8",
  2420. dataType: "json",
  2421. data: JSON.stringify(jsonData),
  2422. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2423. success: function (res) {
  2424. if (res == '401' || res == 401) {
  2425. window.location.href = '/thmz/login/view'
  2426. return;
  2427. }
  2428. if (res.code == 0) {
  2429. $("#totalAmount").html(res.data.amount.toFixed(1));
  2430. var arrs = $("#xyTabContent").find("span.cf_amount");
  2431. for (var i = 0; i < arrs.length; i++) {
  2432. $(arrs[i]).html(res.data.xyAmount.toFixed(1));
  2433. }
  2434. $("#zyTabContent").find("span.cf_amount").html(res.data.zyAmount.toFixed(1));
  2435. if (res.data.yjAmount != null) {
  2436. //如果
  2437. if ($("#zlTab").find("li") == null || $("#zlTab").find("li").length == 0) {
  2438. initNavTabs(2);
  2439. }
  2440. $("#zlTabContent").find("span.cf_amount").html(res.data.yjAmount.toFixed(1));
  2441. }
  2442. } else {
  2443. errorMesage(res);
  2444. }
  2445. }
  2446. });
  2447. }
  2448. /**
  2449. * 打开编辑用户信息窗口
  2450. * @param data
  2451. */
  2452. function editUserModal() {
  2453. $("#editUserModal").modal();
  2454. $.ajax({
  2455. type: "GET",
  2456. url: '/thmz/getByPatientId?patientId=' + $("#patientId").val(),
  2457. contentType: "application/json;charset=UTF-8",
  2458. dataType: "json",
  2459. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2460. success: function (res) {
  2461. if (res == '401' || res == 401) {
  2462. window.location.href = '/thmz/login/view'
  2463. return;
  2464. }
  2465. if (res.code == 0) {
  2466. if (res.data != null) {
  2467. //延时调用,因为当前弹框还没有加载出来,校验规则无法获取光标与模拟光标丢失事件,延时可以等弹框加载出来后模拟事件
  2468. setTimeout(function () {
  2469. fillPlusPatinet(res.data);
  2470. }, 400);
  2471. }
  2472. } else {
  2473. errorMesage(res);
  2474. }
  2475. }
  2476. });
  2477. }
  2478. /**
  2479. * 收费明细类型按钮切换事件
  2480. * @param object
  2481. * @param objectIndex
  2482. */
  2483. function billItemButtonChange(object, objectIndex) {
  2484. $(".nav-tabs").removeClass("in").addClass("hide");
  2485. $(".tab-content").removeClass("in").addClass("hide");
  2486. $(".nav-tabs:eq(" + objectIndex + ")").removeClass("hide").addClass("in");
  2487. $(".tab-content:eq(" + objectIndex + ")").removeClass("hide").addClass("in");
  2488. // initNavTabs(objectIndex);
  2489. $("#bill_item_group").find("button").each(function (index, element) {
  2490. if ($(element).hasClass("btn-primary")) {
  2491. $(element).removeClass("btn-primary").addClass("btn-default");
  2492. }
  2493. $("#rp_form" + index).removeClass("show").addClass("hide");
  2494. });
  2495. $("#rp_form" + objectIndex).removeClass("hide").addClass("show");
  2496. $(object).removeClass("btn-default").addClass("btn-primary");
  2497. $("#western_medicine_name").webuiPopover('hide');
  2498. $("#jcJyItem").webuiPopover('hide');
  2499. }
  2500. /**
  2501. * 打开快速接诊窗口
  2502. * @param data
  2503. */
  2504. function rapidAcceptsModal() {
  2505. $("#rapidAcceptsModal").modal();
  2506. //延迟触发 默认光标在卡号输入框
  2507. setTimeout('$("#rapidAcceptsUserCardNo").focus();', 500);
  2508. }
  2509. /**
  2510. * checkBox样式
  2511. */
  2512. function formatCheck() {
  2513. if ($("input.flat")[0]) {
  2514. $(document).ready(function () {
  2515. $('input.flat').iCheck({
  2516. checkboxClass: 'icheckbox_flat-blue',
  2517. radioClass: 'iradio_flat-blue'
  2518. });
  2519. });
  2520. }
  2521. }
  2522. /**
  2523. * 卡号有变化后查询病人信息
  2524. */
  2525. function queryUserInfoByCardNo() {
  2526. //当反写的id不存在,说明不是查询后的改变事件,触发查询
  2527. var rapidAcceptsUserCardNo = $("#rapidAcceptsUserCardNo").val();
  2528. var index = rapidAcceptsUserCardNo.indexOf("-");
  2529. if (($("#patientIdDb").val() == null || $("#patientIdDb").val() == "") && ((index > 0 && index == rapidAcceptsUserCardNo.length - 2) || rapidAcceptsUserCardNo.length == 8)) {
  2530. $("#cardNo").attr("title", rapidAcceptsUserCardNo);
  2531. $.ajax({
  2532. type: "GET",
  2533. url: '/thmz/getByIcCardNo?icCardNo=' + rapidAcceptsUserCardNo,
  2534. contentType: "application/json;charset=UTF-8",
  2535. dataType: "json",
  2536. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2537. success: function (res) {
  2538. if (res == '401' || res == 401) {
  2539. window.location.href = '/thmz/login/view'
  2540. return;
  2541. }
  2542. if (res.code == 0) {
  2543. if (res.data != null) {
  2544. $("#rapidAcceptsUserName").val(res.data.name);
  2545. $("#rapidAcceptsUserCode").val(res.data.patientId);
  2546. $("#patientIdDb").val(res.data.patientId);
  2547. $("#rapidAcceptsUserCardNo").val(res.data.icCardNo);
  2548. $("#rapidAcceptsUserGender").selectpicker('val', res.data.sex);
  2549. $("#rapidAcceptsUserGender").selectpicker('refresh');
  2550. $("#rapidAcceptsUserPhoneNum").val(res.data.phoneNo);
  2551. $("#rapidAcceptsUserIdCard").val(res.data.socialNo);
  2552. $("#rapidAcceptsUserIdCard").attr("title", res.data.socialNo);
  2553. $("#rapidAcceptsUserPhoneNum").attr("title", res.data.phoneNo);
  2554. //查询分诊号
  2555. $.ajax({
  2556. type: "POST",
  2557. url: '/thmz/getUnClinicWithPage',
  2558. contentType: "application/json;charset=UTF-8",
  2559. dataType: "json",
  2560. data: JSON.stringify({"patientId": res.data.patientId}),
  2561. headers: {
  2562. 'Accept': 'application/json',
  2563. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  2564. },
  2565. success: function (resFz) {
  2566. if (resFz == '401' || resFz == 401) {
  2567. window.location.href = '/thmz/login/view'
  2568. return;
  2569. }
  2570. if (resFz.code == 0) {
  2571. if (resFz.data == null || resFz.data.length == 0) {
  2572. errorMesageSimaple("没有查询到符合条件的分诊记录!");
  2573. clearRapidAcceptsModal();
  2574. return;
  2575. }
  2576. $("#mzfzSerialNo").val(resFz.data[0].serialNo);
  2577. }
  2578. }
  2579. });
  2580. } else {
  2581. errorMesageSimaple("病人信息不存在!");
  2582. }
  2583. } else {
  2584. errorMesage(res);
  2585. }
  2586. }
  2587. });
  2588. }
  2589. }
  2590. /**
  2591. * 清空快速接诊查询框
  2592. */
  2593. function clearRapidAccepts() {
  2594. $("#rapidAcceptsUserName").val(null);
  2595. $("#rapidAcceptsUserCode").val(null);
  2596. $("#patientIdDb").val(null);
  2597. $("#rapidAcceptsUserCardNo").val(null);
  2598. $("#rapidAcceptsUserGender").selectpicker('val', 0);
  2599. $("#rapidAcceptsUserGender").selectpicker('refresh');
  2600. $("#rapidAcceptsUserPhoneNum").val(null);
  2601. $("#rapidAcceptsUserIdCard").val(null);
  2602. $("#rapidAcceptsUserIdCard").attr("title", null);
  2603. $("#rapidAcceptsUserPhoneNum").attr("title", null);
  2604. $("#mzfzSerialNo").val(null);
  2605. $("#rapidAcceptsUserCardNo").focus();
  2606. }
  2607. /**
  2608. * 根据病人姓名输入框内容动态加载病人列表
  2609. */
  2610. function initUserList() {
  2611. //var width=$("#userName").css("width");
  2612. var settings = {
  2613. trigger: 'click',
  2614. content: '',
  2615. width: 170,
  2616. multi: true,
  2617. closeable: false,
  2618. style: '',
  2619. delay: 300,
  2620. padding: true,
  2621. height: 300,
  2622. };
  2623. var webuiPopover = $('#rapidAcceptsUserName').webuiPopover('destroy').webuiPopover(settings);
  2624. //用户姓名选中事件
  2625. $("#rapidAcceptsUserName").on("click", function (t) {
  2626. if ($(webuiPopover).css("display") == "block") {
  2627. refeshPatinetList(true);
  2628. }
  2629. });
  2630. }
  2631. /**
  2632. * 刷新候诊病人列表
  2633. */
  2634. function refeshPatinetList(flag) {
  2635. //如果是重新加载病人列表,需要重置下标
  2636. if (flag) {
  2637. //重置下标
  2638. pageIndex = 0;
  2639. msg_list_loading = true;
  2640. }
  2641. var userName = $('#rapidAcceptsUserName').val();
  2642. if (!(userName == null || userName == "" || isChinese(userName))) {
  2643. return;
  2644. }
  2645. $.ajax({
  2646. type: "POST",
  2647. url: '/thmz/getUnClinicWithPage',
  2648. contentType: "application/json;charset=UTF-8",
  2649. dataType: "json",
  2650. data: JSON.stringify({"name": userName, "pageIndex": pageIndex}),
  2651. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2652. success: function (res) {
  2653. if (res == '401' || res == 401) {
  2654. window.location.href = '/thmz/login/view'
  2655. return;
  2656. }
  2657. if (res.code == 0) {
  2658. if (res.data != null && res.data.length > 0) {
  2659. $("#webuiPopover0").css("display", "block");
  2660. $("#webuiPopover0 .webui-popover-content").css("max-height", "300px").css("height", "auto");
  2661. var html = '<div class="list-group">';
  2662. for (var i = 0; i < res.data.length; i++) {
  2663. var mzPatientMi = res.data[i];
  2664. html += '<a href="#" class="list-group-item list-group-item-action" onclick="fillUnClinicPatinet(\'' + mzPatientMi.patientId + '\')">';
  2665. if (mzPatientMi.gender == "男") {
  2666. html += '<img src="/thmz/images/boy.png"/>'
  2667. } else if (mzPatientMi.gender == "女") {
  2668. html += '<img src="/thmz/images/girl.png"/>'
  2669. } else if (mzPatientMi.gender == "未知" || mzPatientMi.gender == null) {
  2670. html += '<img src="/thmz/images/girl_or_boy.png"/>'
  2671. }
  2672. html += '<div>' + mzPatientMi.name + '&nbsp;' + mzPatientMi.gender + '&nbsp;';
  2673. if (mzPatientMi.age != null && mzPatientMi.age != "") {
  2674. html += mzPatientMi.age + '岁';
  2675. } else {
  2676. html += '**岁';
  2677. }
  2678. if (mzPatientMi.phoneNo != null && mzPatientMi.phoneNo != "") {
  2679. html += '<span>' + mzPatientMi.phoneNo + '</span>';
  2680. }
  2681. html += '</div></a>';
  2682. }
  2683. html += '</div>';
  2684. if (flag) {
  2685. $("#webuiPopover0 div.webui-popover-content").html("");
  2686. }
  2687. $("#webuiPopover0 div.webui-popover-content").append(html);
  2688. $("#webuiPopover0 div.arrow").css("left", "23px");
  2689. refeshPatinetListScrollEvent();
  2690. } else {
  2691. $("#webuiPopover0").css("display", "none");
  2692. }
  2693. }
  2694. //查询完成,设置加载完成
  2695. msg_list_loading = false;
  2696. }
  2697. });
  2698. }
  2699. /**
  2700. * 病人下拉列表滚动条滚动到底部时继续加载新纪录
  2701. */
  2702. function refeshPatinetListScrollEvent() {
  2703. $('.webui-popover-content').scroll(function (event) {
  2704. var top = $(this).scrollTop();
  2705. var height = $(this).height();
  2706. var scrollHeight = $(this).get(0).scrollHeight;
  2707. if (scrollHeight <= top + height) {
  2708. if (!msg_list_loading) {
  2709. msg_list_loading = true;
  2710. pageIndex = pageIndex + 1;
  2711. refeshPatinetList(false);
  2712. }
  2713. }
  2714. });
  2715. }
  2716. /**
  2717. * 按照病人id查询病人信息
  2718. * @param patientId
  2719. */
  2720. function fillUnClinicPatinet(patientId) {
  2721. $("#rapidAcceptsUserCardNo").val(patientId);
  2722. $("#webuiPopover0").css("display", "none");
  2723. queryUserInfoByCardNo();
  2724. }
  2725. /**
  2726. * 加载主诉,体格检查,诊断窗口
  2727. */
  2728. function initRecommendList() {
  2729. var width = $("#symptom").parent().css("width");
  2730. var settings = {
  2731. placement: 'bottom-right',//值: auto,top,right,bottom,left,top-right,top-left,bottom-right,bottom-left 要显示的位置
  2732. trigger: 'click', //值:click,hover 触发方式 manual 手动
  2733. content: '',//内容,内容可以是函数
  2734. width: width,
  2735. //arrow:false,//是否显示箭头
  2736. multi: true,//在页面允许其他弹出层
  2737. closeable: true,//显示关闭按钮
  2738. style: '', //值:'',inverse
  2739. delay: 300,//延迟时间, 悬浮属性才执行
  2740. padding: true,//内容填充
  2741. height: 320,
  2742. //offsetTop:10,
  2743. cache: true,//如果缓存设置为false,则popover将销毁并重新创建
  2744. };
  2745. //主诉弹窗
  2746. var symptomWebuiPopover = $('#symptom').webuiPopover('destroy').webuiPopover(settings);
  2747. //体格检查弹窗
  2748. settings.height = 260;
  2749. $('#weight').webuiPopover('destroy').webuiPopover(settings);
  2750. //诊断弹窗
  2751. settings.height = 320;
  2752. var diagnoseWebuiPopover = $('#diagnose').webuiPopover('destroy').webuiPopover(settings);
  2753. //西药弹窗
  2754. settings.width = 680;
  2755. settings.closeable = false;
  2756. settings.arrow = false;//显示箭头或不显示箭头
  2757. settings.content = '<div id="westernMedicinePopoverContent"><table id="tb_table_western_medicine"></table></div>';
  2758. //手动触发
  2759. settings.trigger = 'manual';
  2760. var westernMedicineWebuiPopover = $('#western_medicine_name').webuiPopover('destroy').webuiPopover(settings);
  2761. //中药弹窗
  2762. settings.trigger = 'click';
  2763. settings.content = '<div id="chineseMedicinePopoverContent"><table id="tb_table_chinese_medicine"></table></div>';
  2764. var chineseMedicineWebuiPopover = $('#chinese_medicine_name').webuiPopover('destroy').webuiPopover(settings);
  2765. //诊疗与医技弹窗
  2766. settings.trigger = 'manual';
  2767. settings.content = '<div id="jcJyItemPopoverContent"><table id="tb_table_jc_jy_item"></table></div>';
  2768. var jcJyItemWebuiPopover = $('#jcJyItem').webuiPopover('destroy').webuiPopover(settings);
  2769. //主诉选中事件
  2770. $("#symptom").on("click", function (t) {
  2771. if ($(symptomWebuiPopover).css("display") == "block") {
  2772. $("#webuiPopover1 div.arrow").css("left", "23px");
  2773. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">主诉</span>';
  2774. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='contentHtml'>";
  2775. html += "</div>";
  2776. html += '<div style="height: 60px; line-height: 60px; font-size: 14px;">' +
  2777. '<div style="float: left">' +
  2778. '<span style="margin-left: 20px;">内容:</span> ' +
  2779. '</div>' +
  2780. '<div style="float: left;">' +
  2781. '<select class="form-control selectpicker show-tick" id="paramsType" dropupAuto="true">' +
  2782. '<option label="常用症状" value="0">常用症状</option>' +
  2783. '<option label="常用时间" value="1">常用时间</option>' +
  2784. '<option label="常用标点" value="2">常用标点</option>' +
  2785. '<option label="常用词" value="3">常用词</option>' +
  2786. '</select> ' +
  2787. '</div>' +
  2788. '<div style="width: 200px;float: left;margin-left: 10px;">' +
  2789. '<input id="paramsNameInput" class="form-control" type="text" style="position: relative;top: 13px;height: 34px;">' +
  2790. '</div>' +
  2791. '<div style="float: left;margin-left: 10px;">' +
  2792. ' <button type="button" class="btn" onclick="saveParams();"' +
  2793. ' style="height: 30px;line-height: 15px;border-color: #2e69eb!important;color: #2e69eb;background-color: white;">' +
  2794. ' <svg class="bi" width="1em" height="1em" fill="currentColor" style="vertical-align: -.15em;margin-right: 10px!important;color: #2e69eb;">' +
  2795. ' <use xlink:href="/thmz/css/bootstrap/bootstrap-icons-1.5.0/bootstrap-icons.svg#plus-circle"></use>' +
  2796. ' </svg>' +
  2797. '新增' +
  2798. ' </button>' +
  2799. ' </div>' +
  2800. '</div>';
  2801. $("#webuiPopover1 div.webui-popover-content").html(html);
  2802. $('#paramsType').selectpicker('refresh');
  2803. $("#paramsType").parent().css("width", "140px").css("height", "34px");
  2804. $("#webuiPopover1").css("z-index", "10");
  2805. if ($("#webuiPopover1").hasClass("in")) {
  2806. loadSymptom();
  2807. }
  2808. }
  2809. //加载智能接诊模块的主诉推荐
  2810. fitSymptomData();
  2811. });
  2812. //体格检查各输入框选中事件
  2813. $("#weight,#temperature,#sphygmus,#breathe,#pressure_high,#pressure_floor,#pressure_high_left,#pressure_floor_left").on("click", function (t) {
  2814. if ($("#webuiPopover2").css("display") == "block") {
  2815. $("#webuiPopover2").css("left", $("#webuiPopover1").css("left"));
  2816. if ($("#healthCheckupContentHtml").html() == null || $("#healthCheckupContentHtml").html() == "") {
  2817. $("#webuiPopover2 div.arrow").css("left", "23px");
  2818. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">体格检查</span>';
  2819. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='healthCheckupContentHtml'>";
  2820. html += "</div>";
  2821. $("#webuiPopover2 div.webui-popover-content").html(html);
  2822. $("#webuiPopover2").css("z-index", "10");
  2823. if ($("#webuiPopover2").hasClass("in")) {
  2824. loadHealthCheckup();
  2825. }
  2826. }
  2827. //loadSymptom();
  2828. } else {
  2829. $('#weight').webuiPopover('show');
  2830. $("#webuiPopover2").css("left", $("#webuiPopover1").css("left"));
  2831. if ($("#healthCheckupContentHtml").html() == null || $("#healthCheckupContentHtml").html() != "") {
  2832. $("#webuiPopover2 div.arrow").css("left", "23px");
  2833. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">体格检查</span>';
  2834. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='healthCheckupContentHtml'>";
  2835. html += "</div>";
  2836. $("#webuiPopover2 div.webui-popover-content").html(html);
  2837. $("#webuiPopover2").css("z-index", "10");
  2838. if ($("#webuiPopover2").hasClass("in")) {
  2839. loadHealthCheckup();
  2840. }
  2841. }
  2842. }
  2843. return false;
  2844. });
  2845. //诊断选中事件
  2846. $("#diagnose").on("click", function (t) {
  2847. if ($(diagnoseWebuiPopover).css("display") == "block") {
  2848. $("#webuiPopover3 div.arrow").css("left", "23px");
  2849. $("#webuiPopover3 a.close").css("margin-top", "15px");
  2850. var html = '<span style="font-size: 18px;margin-left: 20px!important;color: #2e69eb!important;line-height: 50px;">诊断</span>';
  2851. html += '<div class="form-group has-feedback" style="float: right;width: 300px;margin-right: 20px;margin-top: 10px;">' +
  2852. ' <input type="text" class="form-control has-feedback-left" ' +
  2853. ' placeholder="搜索" style="padding-left: 10px;" oninput="loadDiagnose(this.value)" id="paramsDiagnose">' +
  2854. ' <span class="fa fa-search form-control-feedback right" aria-hidden="true" style="right: 0px;"></span>' +
  2855. ' </div>';
  2856. html += "<div style='width: 100%;height:210px;overflow-y: auto;padding: 0px 20px;' id='diagnoseContentHtml'>";
  2857. html += "</div>";
  2858. $("#webuiPopover3 div.webui-popover-content").html(html);
  2859. $("#webuiPopover3").css("z-index", "10");
  2860. //$("#paramsDiagnose").on('input propertychange', loadDiagnose($("#paramsDiagnose").val()));
  2861. loadDiagnose("");
  2862. }
  2863. //加载智能接诊模块的诊断推荐推荐
  2864. fitDiagnoseData();
  2865. });
  2866. //现病史选中事件
  2867. $("#emrHpi").on("click", function (t) {
  2868. //加载智能接诊模块的现病史推荐推荐
  2869. fitEmrHpiData();
  2870. });
  2871. //既往史选中事件
  2872. $("#emrPs").on("click", function (t) {
  2873. //加载智能接诊模块的既往史推荐推荐
  2874. fitEmrPsData();
  2875. });
  2876. // //西药选中事件
  2877. // $("#western_medicine_name").on("click", function (t) {
  2878. // if ($(westernMedicineWebuiPopover).css("display") == "block") {
  2879. // $("#westernMedicinePopoverContent").parent().parent().prev().css("left", "23px");
  2880. // loadYpList(0);
  2881. // }
  2882. // });
  2883. //中药选中事件
  2884. $("#chinese_medicine_name").on("click", function (t) {
  2885. if ($(chineseMedicineWebuiPopover).css("display") == "block") {
  2886. $("#chineseMedicinePopoverContent").parent().parent().prev().css("left", "23px");
  2887. loadYpList(1);
  2888. }
  2889. });
  2890. // //诊疗与医技弹窗选中事件
  2891. // $("#jcJyItem").on("click", function (t) {
  2892. // if ($(jcJyItemWebuiPopover).css("display") == "block") {
  2893. // $("#jcJyItemPopoverContent").parent().parent().prev().css("left", "23px");
  2894. // loadjcJyItemList();
  2895. // }
  2896. // });
  2897. //帮助字典弹窗
  2898. settings.width = 250;
  2899. settings.height = 200;
  2900. settings.placement = 'right';//值: auto,top,right,bottom,left,top-right,top-left,bottom-right,bottom-left 要显示的位置
  2901. settings.content = '<div id="treePopoverContent"><div><ul id="treeDemo" class="ztree"></ul></div></div>';
  2902. settings.trigger = 'click';
  2903. var treeWebuiPopover = $('#treeButton').webuiPopover('destroy').webuiPopover(settings);
  2904. $("#treeButton").on("click", function (t) {
  2905. // $("#treePopoverContent").parent().parent().prev().css("left", "23px");
  2906. //初始化药品,检查检验菜单树
  2907. initzTree();
  2908. });
  2909. }
  2910. /**
  2911. * 新增通用参数
  2912. */
  2913. function saveParams() {
  2914. $.ajax({
  2915. type: "POST",
  2916. url: '/thmz/saveTCommonParams',
  2917. contentType: "application/json;charset=UTF-8",
  2918. dataType: "json",
  2919. data: JSON.stringify({
  2920. "paramsType": $("#paramsType").val(),
  2921. "paramsName": $("#paramsNameInput").val()
  2922. }),
  2923. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2924. success: function (res) {
  2925. if (res == '401' || res == 401) {
  2926. window.location.href = '/thmz/login/view'
  2927. return;
  2928. }
  2929. if (res.code == 0) {
  2930. successMesage(res);
  2931. loadSymptom();
  2932. $("#paramsNameInput").val(null);
  2933. // $("#paramsType").selectpicker('val', 0);
  2934. // $("#paramsType").selectpicker('refresh');
  2935. } else {
  2936. errorMesage(res);
  2937. }
  2938. }
  2939. });
  2940. }
  2941. /**
  2942. * 加载主诉参数列表
  2943. */
  2944. function loadSymptom() {
  2945. $.ajax({
  2946. type: "GET",
  2947. url: '/thmz/loadSymptom',
  2948. contentType: "application/json;charset=UTF-8",
  2949. dataType: "json",
  2950. async: false,
  2951. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2952. success: function (res) {
  2953. if (res == '401' || res == 401) {
  2954. window.location.href = '/thmz/login/view'
  2955. return;
  2956. }
  2957. var html = '';
  2958. if (res.code == 0) {
  2959. if (res.featureList != null && res.featureList.length > 0) {
  2960. html += '<div id="feature">';
  2961. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用症状:</div>';
  2962. html += '<div style="width: calc(100% - 80px); float: left;">';
  2963. for (var i = 0; i < res.featureList.length; i++) {
  2964. 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;">';
  2965. html += res.featureList[i].paramsName;
  2966. html += '</span></button>';
  2967. }
  2968. html += '</div><div style="clear:both"></div></div>';
  2969. }
  2970. if (res.timeList != null && res.timeList.length > 0) {
  2971. html += '<div id="time">';
  2972. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用时间:</div>';
  2973. html += '<div style="width: calc(100% - 80px); float: left;">';
  2974. for (var i = 0; i < res.timeList.length; i++) {
  2975. 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;">';
  2976. html += res.timeList[i].paramsName;
  2977. html += '</span></button>';
  2978. }
  2979. html += '</div><div style="clear:both"></div></div>';
  2980. }
  2981. if (res.characterList != null && res.characterList.length > 0) {
  2982. html += '<div id="character">';
  2983. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用标点:</div>';
  2984. html += '<div style="width: calc(100% - 80px); float: left;">';
  2985. for (var i = 0; i < res.characterList.length; i++) {
  2986. 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;">';
  2987. html += res.characterList[i].paramsName;
  2988. html += '</span></button>';
  2989. }
  2990. html += '</div><div style="clear:both"></div></div>';
  2991. }
  2992. if (res.wordsList != null && res.wordsList.length > 0) {
  2993. html += '<div id="words">';
  2994. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">常用词:</div>';
  2995. html += '<div style="width: calc(100% - 80px); float: left;">';
  2996. for (var i = 0; i < res.wordsList.length; i++) {
  2997. 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;">';
  2998. html += res.wordsList[i].paramsName;
  2999. html += '</span></button>';
  3000. }
  3001. html += '</div><div style="clear:both"></div></div>';
  3002. }
  3003. } else {
  3004. errorMesage(res);
  3005. }
  3006. $("#contentHtml").html(html);
  3007. }
  3008. });
  3009. }
  3010. /**
  3011. * 加载体格检查参数列表
  3012. */
  3013. function loadHealthCheckup() {
  3014. $.ajax({
  3015. type: "GET",
  3016. url: '/thmz/loadHealthCheckup',
  3017. contentType: "application/json;charset=UTF-8",
  3018. dataType: "json",
  3019. async: false,
  3020. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3021. success: function (res) {
  3022. if (res == '401' || res == 401) {
  3023. window.location.href = '/thmz/login/view'
  3024. return;
  3025. }
  3026. var html = '';
  3027. if (res.code == 0) {
  3028. if (res.weightList != null && res.weightList.length > 0) {
  3029. html += '<div id="weightDiv">';
  3030. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">体重:</div>';
  3031. html += '<div style="width: calc(100% - 80px); float: left;">';
  3032. for (var i = 0; i < res.weightList.length; i++) {
  3033. 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;">';
  3034. html += res.weightList[i].paramsName;
  3035. html += '</span></button>';
  3036. }
  3037. html += '</div><div style="clear:both"></div></div>';
  3038. }
  3039. if (res.temperatureList != null && res.temperatureList.length > 0) {
  3040. html += '<div id="temperatureDiv">';
  3041. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">体温:</div>';
  3042. html += '<div style="width: calc(100% - 80px); float: left;">';
  3043. for (var i = 0; i < res.temperatureList.length; i++) {
  3044. 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;">';
  3045. html += res.temperatureList[i].paramsName;
  3046. html += '</span></button>';
  3047. }
  3048. html += '</div><div style="clear:both"></div></div>';
  3049. }
  3050. if (res.sphygmusList != null && res.sphygmusList.length > 0) {
  3051. html += '<div id="sphygmusDiv">';
  3052. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">脉搏:</div>';
  3053. html += '<div style="width: calc(100% - 80px); float: left;">';
  3054. for (var i = 0; i < res.sphygmusList.length; i++) {
  3055. 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;">';
  3056. html += res.sphygmusList[i].paramsName;
  3057. html += '</span></button>';
  3058. }
  3059. html += '</div><div style="clear:both"></div></div>';
  3060. }
  3061. if (res.breatheList != null && res.breatheList.length > 0) {
  3062. html += '<div id="breatheDiv">';
  3063. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">呼吸:</div>';
  3064. html += '<div style="width: calc(100% - 80px); float: left;">';
  3065. for (var i = 0; i < res.breatheList.length; i++) {
  3066. 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;">';
  3067. html += res.breatheList[i].paramsName;
  3068. html += '</span></button>';
  3069. }
  3070. html += '</div><div style="clear:both"></div></div>';
  3071. }
  3072. if (res.pressureList != null && res.pressureList.length > 0) {
  3073. html += '<div id="pressureDiv">';
  3074. html += '<div style="width: 80px; line-height: 25px; float: left;font-size: 16px;">呼吸:</div>';
  3075. html += '<div style="width: calc(100% - 80px); float: left;">';
  3076. for (var i = 0; i < res.pressureList.length; i++) {
  3077. 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;">';
  3078. html += res.pressureList[i].paramsName;
  3079. html += '</span></button>';
  3080. }
  3081. html += '</div><div style="clear:both"></div></div>';
  3082. }
  3083. } else {
  3084. errorMesage(res);
  3085. }
  3086. $("#healthCheckupContentHtml").html(html);
  3087. }
  3088. });
  3089. }
  3090. /**
  3091. * 加载诊断参数列表
  3092. * @param value
  3093. */
  3094. function loadDiagnose(value) {
  3095. if (!$("#webuiPopover3").hasClass("in")) {
  3096. return;
  3097. }
  3098. $.ajax({
  3099. type: "GET",
  3100. url: '/thmz/getTCommonParamsByParamsType?paramsType=4&commonParams=' + value + '&pageSize=100',
  3101. contentType: "application/json;charset=UTF-8",
  3102. dataType: "json",
  3103. async: false,
  3104. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3105. success: function (res) {
  3106. if (res == '401' || res == 401) {
  3107. window.location.href = '/thmz/login/view'
  3108. return;
  3109. }
  3110. var html = '';
  3111. if (res.code == 0) {
  3112. if (res.data != null && res.data.length > 0) {
  3113. html += '<div>';
  3114. for (var i = 0; i < res.data.length; i++) {
  3115. html += '<button type="button" class="button_color" style="background-color: rgb(255, 255, 255);border: none;" onclick="fitDiagnoseValue(\'' + res.data[i].paramsName + '\',\'' + res.data[i].paramsCode + '\')"><span style="padding: 0px 5px;font-size: 20px;">';
  3116. html += res.data[i].paramsName;
  3117. html += '<small>&nbsp;&nbsp;(' + res.data[i].paramsCode + ')</small>';
  3118. html += '</span></button>';
  3119. }
  3120. html += '</div>';
  3121. }
  3122. } else {
  3123. errorMesage(res);
  3124. }
  3125. $("#diagnoseContentHtml").html(html);
  3126. }
  3127. });
  3128. }
  3129. /**
  3130. * 填充诊断
  3131. * @param value
  3132. * @param code
  3133. */
  3134. function fitDiagnoseValue(value, code) {
  3135. var html = '';
  3136. var childrenNum = $("#diagnoseTags").children().length;
  3137. if (childrenNum == 2) {
  3138. errorMesageSimaple("最多填写两个诊断!");
  3139. return;
  3140. }
  3141. var diagnoseValue = $("#diagnoseValue").val();
  3142. if (diagnoseValue == null || diagnoseValue == "") {
  3143. diagnoseValue = code;
  3144. } else {
  3145. if (diagnoseValue.indexOf(code) != -1) {
  3146. errorMesageSimaple("诊断已存在,请勿重复添加!");
  3147. return;
  3148. }
  3149. diagnoseValue += "," + code;
  3150. }
  3151. $("#diagnoseValue").val(diagnoseValue);
  3152. if (childrenNum == 0) {
  3153. html += '<span class="el-tag--mainDiagnosis" ';
  3154. } else {
  3155. html += '<span class="el-tag--secondaryDiagnosis" ';
  3156. }
  3157. 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>';
  3158. $("#diagnoseTags").append(html);
  3159. }
  3160. /**
  3161. * 移除诊断
  3162. * @param code
  3163. */
  3164. function removeDiagnoseValue(code) {
  3165. var childrenIndex = 0;
  3166. var children = $("#diagnoseTags").children();
  3167. for (var i = 0; i < children.length; i++) {
  3168. if ($(children[i]).attr("id") == code) {
  3169. childrenIndex = i;
  3170. break;
  3171. }
  3172. }
  3173. $($("#diagnoseTags").children("span")[childrenIndex]).remove();
  3174. if (childrenIndex == 0) {
  3175. $($("#diagnoseTags").children("span")[childrenIndex]).removeClass("el-tag--secondaryDiagnosis").addClass("el-tag--mainDiagnosis");
  3176. }
  3177. var diagnoseValue = $("#diagnoseValue").val();
  3178. $("#diagnoseValue").val(diagnoseValue.replace(code, ""));
  3179. }
  3180. /**
  3181. * 点击通用参数属性值时设置值到对应的区域
  3182. * @param value
  3183. * @param id
  3184. */
  3185. function fitValue(value, id) {
  3186. //当选择的是血压时
  3187. if (id == "pressure_") {
  3188. var arr = value.split("/");
  3189. $("#pressure_high").val(arr[0]);
  3190. $("#pressure_floor").val(arr[1]);
  3191. if ($("#pressureLeftFlag").hasClass("in")) {
  3192. $("#pressure_high_left").val(arr[0]);
  3193. $("#pressure_floor_left").val(arr[1]);
  3194. }
  3195. //当选的是体重,体温,脉搏和呼吸时
  3196. } else if (id == "weight" || id == "temperature" || id == "sphygmus" || id == "breathe") {
  3197. $("#" + id).val(value);
  3198. } else {
  3199. //主诉拼写时
  3200. var valueExist = $("#" + id).val();
  3201. if (valueExist != null && valueExist != "") {
  3202. value = valueExist + value;
  3203. }
  3204. $("#" + id).val(value);
  3205. }
  3206. }
  3207. /**
  3208. * 加载药品列表数列表
  3209. * @param index
  3210. */
  3211. function loadYpList(index) {
  3212. //var medicinePopoverContent = null;
  3213. var tableMedicine = null;
  3214. var MedicineName = null;
  3215. //var groupNo=null;
  3216. if (index == 0) {
  3217. // medicinePopoverContent = "westernMedicinePopoverContent";
  3218. tableMedicine = "tb_table_western_medicine";
  3219. MedicineName = "western_medicine_name";
  3220. // groupNo=71;
  3221. }
  3222. if (index == 1) {
  3223. // medicinePopoverContent = "chineseMedicinePopoverContent";
  3224. tableMedicine = "tb_table_chinese_medicine";
  3225. MedicineName = "chinese_medicine_name";
  3226. // groupNo=$("#zyClassType").val();
  3227. }
  3228. // if (!$("#" + medicinePopoverContent).parent().parent().parent().hasClass("in")) {
  3229. // return;
  3230. // }
  3231. $('#' + tableMedicine).bootstrapTable('refresh');
  3232. $('#' + tableMedicine).bootstrapTable({
  3233. url: '/thmz/getYpListByCommonParams', //请求后台的URL(*)
  3234. method: 'GET', //请求方式(*)
  3235. toolbar: '#toolbar', //工具按钮用哪个容器
  3236. striped: true, //是否显示行间隔色
  3237. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  3238. pagination: false, //是否显示分页(*)
  3239. sortable: true, //是否启用排序
  3240. sortOrder: "asc", //排序方式
  3241. queryParams: function (params) {
  3242. var groupNo = null;
  3243. if (index == 0) {
  3244. groupNo = 71;
  3245. }
  3246. if (index == 1) {
  3247. groupNo = $("#zyClassType").val();
  3248. }
  3249. var temp = {
  3250. groupNo: groupNo,
  3251. commonParams: $("#" + MedicineName).val()
  3252. };
  3253. return temp;
  3254. }, //传递参数(*)
  3255. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  3256. pageNumber: 1, //初始化加载第一页,默认第一页
  3257. pageSize: 5, //每页的记录行数(*)
  3258. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  3259. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  3260. strictSearch: true,
  3261. showColumns: false, //是否显示所有的列
  3262. showRefresh: false, //是否显示刷新按钮
  3263. minimumCountColumns: 2, //最少允许的列数
  3264. clickToSelect: true, //是否启用点击选中行
  3265. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  3266. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  3267. cardView: false, //是否显示详细视图
  3268. detailView: false,
  3269. //rowStyle:rowStyle,//通过自定义函数设置行样式
  3270. ajaxOptions: {
  3271. headers: {
  3272. 'Accept': 'application/json',
  3273. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  3274. }
  3275. },
  3276. columns: [
  3277. {
  3278. field: 'code',
  3279. title: '编码',
  3280. align: "center",
  3281. valign: 'middle',
  3282. // sortable: true
  3283. }, {
  3284. field: 'name',
  3285. title: '药品名称',
  3286. align: "center",
  3287. valign: 'middle',
  3288. // sortable: true
  3289. }
  3290. , {
  3291. field: 'specification',
  3292. title: '规格',
  3293. align: "center",
  3294. valign: 'middle',
  3295. // sortable: true
  3296. }, {
  3297. field: 'manufactory',
  3298. title: '生产厂家',
  3299. align: "center",
  3300. valign: 'middle',
  3301. // sortable: true
  3302. }, {
  3303. field: 'miniUnitName',
  3304. title: '单位',
  3305. align: "center",
  3306. valign: 'middle',
  3307. // sortable: true
  3308. }, {
  3309. field: 'chargeAmount',
  3310. title: '零售价',
  3311. align: "center",
  3312. valign: 'middle',
  3313. // sortable: true
  3314. formatter: function (value, row, index) {
  3315. if (value == null) {
  3316. return '0.0元';
  3317. }
  3318. return value.toFixed(2) + "元";
  3319. }
  3320. }, {
  3321. field: 'drugWinDesc',
  3322. title: '剂量',
  3323. align: "center",
  3324. valign: 'middle',
  3325. // sortable: true
  3326. }, {
  3327. field: 'stockAmountVirtual',
  3328. title: '库存数量',
  3329. align: "center",
  3330. valign: 'middle',
  3331. // sortable: true
  3332. }
  3333. ],
  3334. responseHandler: function (res) {
  3335. if (res == '401' || res == 401) {
  3336. window.location.href = '/thmz/login/view'
  3337. return;
  3338. }
  3339. var ress = eval(res);
  3340. if (ress.code == -1) {
  3341. errorMesage(res);
  3342. return {
  3343. "total": 0,//总页数
  3344. "rows": {} //数据
  3345. };
  3346. }
  3347. return {
  3348. "total": ress.data.length,//总页数
  3349. "rows": ress.data //数据
  3350. };
  3351. },
  3352. onClickRow: function (row, $element) {
  3353. $('#' + MedicineName).webuiPopover('hide');
  3354. if (index == 0) {
  3355. checkYpInfo(row.code, row.serial, row.ypType, true);
  3356. }
  3357. if (index == 1) {
  3358. checkZyInfo(row.code, row.serial, true);
  3359. }
  3360. }
  3361. });
  3362. }
  3363. /**
  3364. * 按照药品的编码 和药品拆零规格查询药品信息 西药
  3365. * @param code
  3366. * @param serial
  3367. * @param groupNo
  3368. * @param needNotice 是否需要提示 当用户操作的时候 true 需要提示, 范文和处方回写的时候false不需要提示
  3369. */
  3370. function checkYpInfo(code, serial, groupNo, needNotice) {
  3371. //判断是否有重复的项目 返回true 说明有重复的
  3372. if (verifyRepeat(code, serial, 0)) {
  3373. return;
  3374. }
  3375. $("#current_groupNo").val(groupNo);
  3376. $("#treeButton").webuiPopover('hide');
  3377. $.ajax({
  3378. type: "GET",
  3379. url: '/thmz/getYpZdDictByCodeAndSerial?code=' + code + "&serial=" + serial,
  3380. contentType: "application/json;charset=UTF-8",
  3381. dataType: "json",
  3382. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3383. async: needNotice,//当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  3384. success: function (res) {
  3385. if (res == '401' || res == 401) {
  3386. window.location.href = '/thmz/login/view'
  3387. return;
  3388. }
  3389. if (res.code == 0) {
  3390. if (res.data != null) {
  3391. //每个处方不能超过5个药品
  3392. var tableId = $("#xyTab li.active").find("a").attr("href");
  3393. var childrens = $(tableId).find("div:eq(0)").children().length;
  3394. var currentGroupNo = $(tableId).find("input.current_groupNo").val();
  3395. if (childrens === 5) {
  3396. if (needNotice) {
  3397. $("#messageModal").modal();
  3398. $("#messageContent").html("单张处方最多只能开具5个药品,是否需要新增处方?");
  3399. $("#messageButton").off("click").on("click", function (t) {
  3400. $("#messageModal").modal("hide");
  3401. refreshNavTabs(0, groupNo);
  3402. fitWesternMedicine(res, groupNo);
  3403. });
  3404. } else {
  3405. refreshNavTabs(0, groupNo);
  3406. fitWesternMedicine(res, groupNo);
  3407. }
  3408. } else if (currentGroupNo != null && currentGroupNo != '' && groupNo != currentGroupNo) {
  3409. //当前编辑的处方与选中的品类非同一处方能保存的
  3410. var currentGroupNos = $("#xyTabContent").find("input.current_groupNo");
  3411. //是否需要新增处方页,以保存医材处方
  3412. var needAddTable = true;
  3413. for (var i = 0; i < currentGroupNos.length; i++) {
  3414. if ($(currentGroupNos[i]).val() == groupNo) {
  3415. var next = $(currentGroupNos[i]).next();
  3416. if ($(next).children().length < 5) {
  3417. var parentId = $(currentGroupNos[i]).parent().attr("id");
  3418. //切换处方
  3419. $("#xyTab").find("a[href='#" + parentId + "']").off("click").tab('show');
  3420. //因为存在没有满5个的处方页,直接保存到该页
  3421. needAddTable = false;
  3422. fitWesternMedicine(res, groupNo);
  3423. }
  3424. }
  3425. }
  3426. if (needAddTable) {
  3427. //91 医材
  3428. var message = "医材需要单独处方,是否需要新增医材处方?";
  3429. if (groupNo == '71') {
  3430. message = "普通西成药需要单独处方,是否需要新增处方?"
  3431. } else if (groupNo == '111') {
  3432. message = "麻、精一药物需要单独处方,是否需要新增处方?"
  3433. } else if (groupNo == '131') {
  3434. message = "精二药物需要单独处方,是否需要新增处方?"
  3435. }
  3436. if (needNotice) {
  3437. $("#messageModal").modal();
  3438. $("#messageContent").html(message);
  3439. $("#messageButton").off("click").on("click", function (t) {
  3440. $("#messageModal").modal("hide");
  3441. refreshNavTabs(0, groupNo);
  3442. fitWesternMedicine(res, groupNo);
  3443. });
  3444. } else {
  3445. refreshNavTabs(0, groupNo);
  3446. fitWesternMedicine(res, groupNo);
  3447. }
  3448. }
  3449. //当前编辑的处方非普通西药处方
  3450. } else {
  3451. //如果
  3452. if ($("#xyTab").find("li") == null || $("#xyTab").find("li").length == 0) {
  3453. initNavTabs(0);
  3454. }
  3455. var cfdesc = '普药';
  3456. if (groupNo == '91') {
  3457. cfdesc = '医材';
  3458. } else if (groupNo == '111') {
  3459. cfdesc = '麻、精一';
  3460. } else if (groupNo == '131') {
  3461. cfdesc = '精二';
  3462. }
  3463. // else if(groupNo=='151'){
  3464. // cfdesc='诊疗';
  3465. // }
  3466. $("#xyTab li.active").find("a").find("small.cfdesc").text("(" + cfdesc + ")");
  3467. fitWesternMedicine(res, groupNo);
  3468. }
  3469. }
  3470. } else {
  3471. errorMesage(res);
  3472. }
  3473. }
  3474. });
  3475. }
  3476. /**
  3477. * 按照药品的编码 和药品拆零规格查询药品信息 中药
  3478. * @param code
  3479. * @param serial
  3480. * @param async 当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  3481. */
  3482. function checkZyInfo(code, serial, async) {
  3483. //判断是否有重复的项目 返回true 说明有重复的
  3484. if (verifyRepeat(code, serial, 1)) {
  3485. return;
  3486. }
  3487. $.ajax({
  3488. type: "GET",
  3489. url: '/thmz/getYpZdDictByCodeAndSerial?code=' + code + "&serial=" + serial,
  3490. contentType: "application/json;charset=UTF-8",
  3491. dataType: "json",
  3492. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3493. async: async,//当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  3494. success: function (res) {
  3495. if (res == '401' || res == 401) {
  3496. window.location.href = '/thmz/login/view'
  3497. return;
  3498. }
  3499. if (res.code == 0) {
  3500. if (res.data != null) {
  3501. //如果
  3502. if ($("#zyTab").find("li") == null || $("#zyTab").find("li").length == 0) {
  3503. initNavTabs(1);
  3504. }
  3505. $("#chinese_medicine_name").val(res.data.name);
  3506. $("#chinese_medicine_name").blur();
  3507. $("#zy_drugWin").val(res.data.weight);
  3508. $("#zy_packRetprice").val(res.data.packRetprice);
  3509. $("#current_code").val(res.data.code);
  3510. $("#current_serial").val(res.data.serial);
  3511. }
  3512. } else {
  3513. errorMesage(res);
  3514. }
  3515. }
  3516. });
  3517. }
  3518. /**
  3519. * 加载医技与诊疗列表
  3520. * @param index
  3521. */
  3522. function loadjcJyItemList() {
  3523. // if (!$("#jcJyItemPopoverContent").parent().parent().parent().hasClass("in")) {
  3524. // return;
  3525. // }
  3526. $('#tb_table_jc_jy_item').bootstrapTable('refresh');
  3527. $('#tb_table_jc_jy_item').bootstrapTable({
  3528. url: '/thmz/getJcJyItemByCommonParams', //请求后台的URL(*)
  3529. method: 'GET', //请求方式(*)
  3530. toolbar: '#toolbar', //工具按钮用哪个容器
  3531. striped: true, //是否显示行间隔色
  3532. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  3533. pagination: false, //是否显示分页(*)
  3534. sortable: true, //是否启用排序
  3535. sortOrder: "asc", //排序方式
  3536. queryParams: function (params) {
  3537. var temp = {
  3538. commonParams: $("#jcJyItem").val()
  3539. };
  3540. return temp;
  3541. }, //传递参数(*)
  3542. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  3543. pageNumber: 1, //初始化加载第一页,默认第一页
  3544. pageSize: 5, //每页的记录行数(*)
  3545. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  3546. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  3547. strictSearch: true,
  3548. showColumns: false, //是否显示所有的列
  3549. showRefresh: false, //是否显示刷新按钮
  3550. minimumCountColumns: 2, //最少允许的列数
  3551. clickToSelect: true, //是否启用点击选中行
  3552. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  3553. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  3554. cardView: false, //是否显示详细视图
  3555. detailView: false,
  3556. //rowStyle:rowStyle,//通过自定义函数设置行样式
  3557. ajaxOptions: {
  3558. headers: {
  3559. 'Accept': 'application/json',
  3560. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  3561. }
  3562. },
  3563. columns: [
  3564. {
  3565. field: 'code',
  3566. title: '编码',
  3567. align: "center",
  3568. valign: 'middle',
  3569. // sortable: true
  3570. }, {
  3571. field: 'name',
  3572. title: '名称',
  3573. align: "center",
  3574. valign: 'middle',
  3575. // sortable: true
  3576. }
  3577. , {
  3578. field: 'execUnitName',
  3579. title: '执行科室',
  3580. align: "center",
  3581. valign: 'middle',
  3582. // sortable: true
  3583. }
  3584. // , {
  3585. // field: 'specification',
  3586. // title: '规格',
  3587. // align: "center",
  3588. // valign: 'middle',
  3589. // // sortable: true
  3590. // }, {
  3591. // field: 'chargeAmount',
  3592. // title: '单价',
  3593. // align: "center",
  3594. // valign: 'middle',
  3595. // formatter: function (value, row, index) {
  3596. // if (value != null && value != "") {
  3597. // return value.toFixed(1);
  3598. // }
  3599. // return 0;
  3600. // }
  3601. // }, {
  3602. // field: 'ybComment',
  3603. // title: '项目说明',
  3604. // align: "center",
  3605. // valign: 'middle',
  3606. // // sortable: true
  3607. // }
  3608. ],
  3609. responseHandler: function (res) {
  3610. if (res == '401' || res == 401) {
  3611. window.location.href = '/thmz/login/view'
  3612. return;
  3613. }
  3614. var ress = eval(res);
  3615. if (ress.code == -1) {
  3616. errorMesage(res);
  3617. return {
  3618. "total": 0,//总页数
  3619. "rows": {} //数据
  3620. };
  3621. }
  3622. return {
  3623. "total": ress.data.length,//总页数
  3624. "rows": ress.data //数据
  3625. };
  3626. },
  3627. onClickRow: function (row, $element) {
  3628. $('#jcJyItem').webuiPopover('hide');
  3629. $("#jcJyZltype").val(row.type);
  3630. if (row.type == 3) {
  3631. $("#jcJyItem").val(row.name);
  3632. $("#jcJyItem").blur();
  3633. $("#jcjyItemPrice").val(row.chargeAmount);
  3634. $("#chargeUnit").val(row.specification);
  3635. $("#current_code").val(row.code);
  3636. $("#jcJyItemChargeDetail").removeClass("in").addClass("hide");
  3637. $("#chargeUnitDiv").removeClass("hide").addClass("in");
  3638. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  3639. $("#yshPartDiv").removeClass("in").addClass("hide");
  3640. return;
  3641. }
  3642. if (row.type == 1) {
  3643. $("#jyZdSampleDiv").removeClass("hide").addClass("in");
  3644. $("#chargeUnitDiv").removeClass("in").addClass("hide");
  3645. $("#yshPartDiv").removeClass("in").addClass("hide");
  3646. if (row.sampleCode != null && row.sampleCode != "") {
  3647. $("#jyZdSample").selectpicker('val', row.sampleCode);
  3648. $('#jyZdSample').selectpicker('refresh');
  3649. }
  3650. } else if (row.type == 2) {
  3651. $("#yshPartDiv").removeClass("hide").addClass("in");
  3652. $("#jyZdSampleDiv").removeClass("in").addClass("hide");
  3653. $("#chargeUnitDiv").removeClass("in").addClass("hide");
  3654. if (row.bwCode != null && row.bwCode != "") {
  3655. $("#yshPart").selectpicker('val', row.bwCode);
  3656. $('#yshPart').selectpicker('refresh');
  3657. }
  3658. }
  3659. $("#jcJyItemChargeDetail").removeClass("hide").addClass("in");
  3660. checkJcJyItemInfo(row.code, row.name, true);
  3661. }
  3662. });
  3663. }
  3664. /**
  3665. * 诊疗与医技选中
  3666. * @param code
  3667. * @param name 回写的时候可以设置null
  3668. * @param type 1 检验 2 检查 3 诊疗
  3669. * @param async 当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  3670. */
  3671. //function checkJcJyItemInfo(code, name, type) {
  3672. function checkJcJyItemInfo(code, name, async) {
  3673. //判断是否有重复的项目 返回true 说明有重复的
  3674. if (verifyRepeat(code, null, 2)) {
  3675. return;
  3676. }
  3677. $("#treeButton").webuiPopover('hide');
  3678. $.ajax({
  3679. type: "GET",
  3680. url: '/thmz/getJcJyItemChargeByCode?code=' + code,
  3681. contentType: "application/json;charset=UTF-8",
  3682. dataType: "json",
  3683. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3684. async: async,//当用户操作的时候 true 异步, 范文和处方回写的时候false同步 因为需要等数据加载完才能设置对应的值
  3685. success: function (res) {
  3686. if (res == '401' || res == 401) {
  3687. window.location.href = '/thmz/login/view'
  3688. return;
  3689. }
  3690. if (res.code == 0) {
  3691. if (res.data != null) {
  3692. //如果
  3693. if ($("#zlTab").find("li") == null || $("#zlTab").find("li").length == 0) {
  3694. initNavTabs(2);
  3695. }
  3696. if (name == null) {
  3697. name = res.name;
  3698. }
  3699. $("#jcJyItem").val(name);
  3700. $("#jcJyItem").blur();
  3701. $("#jcjyItemPrice").val(res.totalAmount);
  3702. $("#current_code").val(code);
  3703. }
  3704. } else {
  3705. errorMesage(res);
  3706. }
  3707. }
  3708. });
  3709. }
  3710. /**
  3711. * 查询诊疗与医技项目明细
  3712. * @param code 编码
  3713. */
  3714. function getJcJyItemChargeByCode(code) {
  3715. if (code != null) {
  3716. $("#itemCodeSearch").val(code);
  3717. } else if ($("#current_code").val() == null || $("#current_code").val() == '') {
  3718. errorMesageSimaple("未选中任何项目!");
  3719. return;
  3720. }
  3721. $("#jcJyItemModal").modal("show");
  3722. $('#jcJyItemTable').bootstrapTable('refresh');
  3723. $('#jcJyItemTable').bootstrapTable({
  3724. url: '/thmz/getJcJyItemChargeByCode', //请求后台的URL(*)
  3725. method: 'GET', //请求方式(*)
  3726. toolbar: '#toolbar', //工具按钮用哪个容器
  3727. striped: true, //是否显示行间隔色
  3728. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  3729. pagination: false, //是否显示分页(*)
  3730. sortable: true, //是否启用排序
  3731. sortOrder: "asc", //排序方式
  3732. queryParams: function (params) {
  3733. var itemCodeSearch = $("#itemCodeSearch").val()
  3734. if (itemCodeSearch == null || itemCodeSearch == "") {
  3735. itemCodeSearch = $("#current_code").val();
  3736. }
  3737. var temp = {
  3738. code: itemCodeSearch
  3739. };
  3740. return temp;
  3741. }, //传递参数(*)
  3742. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  3743. pageNumber: 1, //初始化加载第一页,默认第一页
  3744. pageSize: 5, //每页的记录行数(*)
  3745. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  3746. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  3747. strictSearch: true,
  3748. showColumns: false, //是否显示所有的列
  3749. showRefresh: false, //是否显示刷新按钮
  3750. minimumCountColumns: 2, //最少允许的列数
  3751. clickToSelect: true, //是否启用点击选中行
  3752. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  3753. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  3754. cardView: false, //是否显示详细视图
  3755. detailView: false,
  3756. //rowStyle:rowStyle,//通过自定义函数设置行样式
  3757. ajaxOptions: {
  3758. headers: {
  3759. 'Accept': 'application/json',
  3760. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  3761. }
  3762. },
  3763. columns: [
  3764. {
  3765. title: '项目编码',
  3766. align: "center",
  3767. valign: 'middle',
  3768. // sortable: true
  3769. formatter: function (value, row, index) {
  3770. if (code == null || code == "") {
  3771. code = $("#current_code").val();
  3772. }
  3773. return code;
  3774. }
  3775. }, {
  3776. field: 'code',
  3777. title: '收费编码',
  3778. align: "center",
  3779. valign: 'middle',
  3780. // sortable: true
  3781. }
  3782. , {
  3783. field: 'name',
  3784. title: '收费名称',
  3785. align: "center",
  3786. valign: 'middle',
  3787. // sortable: true
  3788. }, {
  3789. field: 'num',
  3790. title: '数量',
  3791. align: "center",
  3792. valign: 'middle',
  3793. // sortable: true
  3794. }, {
  3795. field: 'chargeAmount',
  3796. title: '单价',
  3797. align: "center",
  3798. valign: 'middle',
  3799. // sortable: true
  3800. formatter: function (value, row, index) {
  3801. if (value == null || value == "") {
  3802. return 0;
  3803. }
  3804. return value.toFixed(2);
  3805. }
  3806. }, {
  3807. field: 'totalAmount',
  3808. title: '总金额',
  3809. align: "center",
  3810. valign: 'middle',
  3811. // sortable: true
  3812. formatter: function (value, row, index) {
  3813. if (value == null || value == "") {
  3814. return 0;
  3815. }
  3816. return value.toFixed(2);
  3817. }
  3818. }
  3819. ],
  3820. responseHandler: function (res) {
  3821. if (res == '401' || res == 401) {
  3822. window.location.href = '/thmz/login/view'
  3823. return;
  3824. }
  3825. $("#itemCodeSearch").val(null);
  3826. var ress = eval(res);
  3827. if (ress.code == -1) {
  3828. errorMesage(res);
  3829. return {
  3830. "total": 0,//总页数
  3831. "rows": {} //数据
  3832. };
  3833. }
  3834. return {
  3835. "total": ress.data.length,//总页数
  3836. "rows": ress.data //数据
  3837. };
  3838. }
  3839. });
  3840. }
  3841. /**
  3842. * 判断是否有重复的项目 返回true 说明有重复的
  3843. * @param code
  3844. * @param serial
  3845. * @param index
  3846. */
  3847. function verifyRepeat(code, serial, index) {
  3848. //是新增药品还是编辑 true 修改 默认false
  3849. var updateFlag = $("#update_flag").val();
  3850. if (updateFlag == undefined || updateFlag == null) {
  3851. updateFlag = false;
  3852. }
  3853. if (updateFlag == "true" || updateFlag == true) {
  3854. return false;
  3855. }
  3856. var tabId = null;
  3857. //西药
  3858. if (index == 0) {
  3859. tabId = "xyTab";
  3860. } else if (index == 1) {
  3861. //中成药
  3862. tabId = "zyTab";
  3863. } else if (index == 2) {
  3864. //医技与诊疗
  3865. tabId = "zlTab";
  3866. }
  3867. var tableId = $("#" + tabId + " li.active").find("a").attr("href");
  3868. var items = $(tableId).find("div:eq(0)").find("div.form-group");
  3869. if (items != null && items.length > 0) {
  3870. for (var i = 0; i < items.length; i++) {
  3871. if (serial == null) {
  3872. var temporary_items_code = $(items[i]).find("input.temporary_items_code").val();
  3873. if (code === temporary_items_code) {
  3874. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  3875. return true;
  3876. }
  3877. } else {
  3878. var temporary_items_code = $(items[i]).find("input.temporary_items_code").val();
  3879. var temporary_items_serial = $(items[i]).find("input.temporary_items_serial").val();
  3880. if (code === temporary_items_code && serial === temporary_items_serial) {
  3881. errorMesageSimaple("项目与第" + numToChineseNum(i + 1) + "条重复");
  3882. return true;
  3883. }
  3884. }
  3885. }
  3886. }
  3887. return false;
  3888. }
  3889. /**
  3890. * 初始化处方分页
  3891. * @param index 0 西药 1 中药 2 诊疗
  3892. */
  3893. function initNavTabs(index) {
  3894. var tabId = null;
  3895. var tabContentId = null;
  3896. var paneId = null;
  3897. var cfdesc = '普药';
  3898. //西药
  3899. if (index == 0) {
  3900. tabId = "xyTab";
  3901. tabContentId = "xyTabContent";
  3902. paneId = "xycf_" + getUID();
  3903. } else if (index == 1) {
  3904. //中草药
  3905. tabId = "zyTab";
  3906. tabContentId = "zyTabContent";
  3907. paneId = "zycf_" + getUID();
  3908. cfdesc = '中草药';
  3909. } else if (index == 2) {
  3910. //医技
  3911. tabId = "zlTab";
  3912. tabContentId = "zlTabContent";
  3913. paneId = "zlcf_" + getUID();
  3914. cfdesc = '医技与诊疗';
  3915. }
  3916. $("#" + tabId).html('<li class="active"><a href="#' + paneId + '" role="tab" data-toggle="tab">处方 <small class="cfdesc">(' + cfdesc + ')</small></a></li>');
  3917. var html = '<div class="tab-pane fade in active" id="' + paneId + '" style="height: 100%;min-height: 285px;position: relative;">';
  3918. html += '<input class="current_groupNo" type="hidden"/>';
  3919. html += ' <div class="cf_content rb_item" style="height: 250px;padding-top: 5px;"></div>' +
  3920. ' <div style="height: 30px;border-top: 1px solid #ddd;width: 100%;position: absolute;bottom:0;padding-top: 10px;">';
  3921. html += '<div style="width: 460px;">'
  3922. if (index == 1) {
  3923. html += ' <div style="width: 130px;float: left;">' +
  3924. ' <label class="my_label_2">付数:</label>' +
  3925. ' <input type="text" class="form-control my_label_input_2 zyfs"' +
  3926. ' placeholder="请输入" style="padding-left: 10px;" onchange="calculateZyAmount()" value="1">' +
  3927. ' </div>';
  3928. html += '<div style="width: 130px;float: left;">' +
  3929. ' <label class="my_label_2">频次:</label>' +
  3930. ' <div style="width: 85px;float: right;">' +
  3931. ' <select class="form-control selectpicker show-tick zy_orderFrequency"' +
  3932. ' title="请选择" data-live-search="true" onchange="calculate()" id="zy_orderFrequency_1">' +
  3933. ' </select>' +
  3934. ' </div>' +
  3935. ' </div>';
  3936. html += '<div style="width: 180px;float: left;">' +
  3937. ' <label class="my_label_2">用法:</label>' +
  3938. ' <div style="width: 135px;float: left;">' +
  3939. ' <select class="form-control selectpicker show-tick useType"' +
  3940. ' title="请选择" id="useType_1">' +
  3941. ' </select>' +
  3942. ' </div>' +
  3943. ' </div>';
  3944. html += '</div><div style="width: 460px;">'
  3945. html += '<input id="singleAmount" type="hidden"/>';
  3946. }
  3947. html += '<div style="width: 130px;float: left;padding-left: 7px;padding-top: 8px;">金额:<span class="cf_amount">0.0</span><span>元</span></div>';
  3948. //html += '<div style="width: 130px;float: left;padding-left: 7px;padding-top: 8px;"></div>';
  3949. if (index == 1) {
  3950. html += '<div style="width: 130px;float: left;">' +
  3951. ' <label class="my_label_2">液型:</label>' +
  3952. ' <div style="width: 85px;float: right;">' +
  3953. ' <select class="form-control selectpicker show-tick water" id="cyJssm">' +
  3954. ' </select>' +
  3955. ' </div>' +
  3956. ' </div>';
  3957. html += ' <div style="width: 180px;float: left;">' +
  3958. ' <label class="my_label_2">煎法:</label>' +
  3959. ' <div style="width: 135px;float: left;">' +
  3960. ' <select class="form-control selectpicker show-tick zy_supplyType"' +
  3961. ' title="请选择" id="zy_supplyType_1" onchange="calculateTotalAmount()">' +
  3962. ' </select>' +
  3963. ' </div>' +
  3964. ' </div>';
  3965. }
  3966. if (index == 2) {
  3967. html += '<div style="width: 310px;float: left;color: red;padding-top: 8px;">说明:此费用包含药品给药方式和代煎所产生的费用!</div>';
  3968. }
  3969. html += '</div></div></div>';
  3970. $("#" + tabContentId).html(html);
  3971. if (index == 1) {
  3972. var useType = '<option value="1">饭前温服</option><option value="2">饭后温服</option><option value="3">饭前凉服</option><option value="4">饭后凉服</option><option value="5">顿服</option><option value="6">冲服</option><option value="7">外用</option>';
  3973. $('.useType').html(useType);
  3974. $('.useType').selectpicker('refresh');
  3975. var water = '<option value="加凉水">加凉水</option><option value="加温水">加温水</option><option value="加开水">加开水</option><option value="加冰水">加冰水</option><option value="加糖水">加糖水</option>';
  3976. $('.water').html(water);
  3977. $('.water').selectpicker('refresh');
  3978. initOrderFrequencys("zy_orderFrequency_1", false);
  3979. initZySupplyTypes("zy_supplyType_1", false);
  3980. }
  3981. }
  3982. /**
  3983. * 添加处方分页
  3984. * @param index 0 西药 1 中药 2 诊疗
  3985. * @param groupNo 71 普通西药 91 医材 111 麻、精一 131 精二 151 诊疗
  3986. */
  3987. function refreshNavTabs(index, groupNo) {
  3988. var tabId = null;
  3989. var tabContentId = null;
  3990. var paneIdPrfix = null;
  3991. var cfdesc = '普药';
  3992. //西药
  3993. if (index == 0) {
  3994. tabId = "xyTab";
  3995. tabContentId = "xyTabContent";
  3996. paneIdPrfix = "xycf_";
  3997. if (groupNo == '91') {
  3998. cfdesc = '医材';
  3999. } else if (groupNo == '111') {
  4000. cfdesc = '麻、精一';
  4001. } else if (groupNo == '131') {
  4002. cfdesc = '精二';
  4003. }
  4004. // else if(groupNo=='151'){
  4005. // cfdesc='诊疗';
  4006. // }
  4007. } else if (index == 1) {
  4008. //中草药
  4009. tabId = "zyTab";
  4010. tabContentId = "zyTabContent";
  4011. paneIdPrfix = "zycf_";
  4012. cfdesc = '中草药';
  4013. } else if (index == 2) {
  4014. //医技
  4015. tabId = "zlTab";
  4016. tabContentId = "zlTabContent";
  4017. paneIdPrfix = "zlcf_";
  4018. cfdesc = '医技与诊疗';
  4019. }
  4020. // var tableId = $("#"+tabId+" li.active").find("a").attr("href");
  4021. // var length = $(tableId).find("div:eq(0)").children().length;
  4022. // if(length==0){
  4023. // //当前处方是空白的,不需要新增处方
  4024. // return;
  4025. // }
  4026. var cfTitle = "处方" + " <small class=\"cfdesc\">(" + cfdesc + ")</small>";
  4027. var paneId = paneIdPrfix + getUID();
  4028. //清除选中的样式
  4029. $("#" + tabId).find("li.active").removeClass("active");
  4030. $("#" + tabId).append('<li><a href="#' + paneId + '" role="tab" data-toggle="tab">' + cfTitle + '</a></li>');
  4031. $("#" + tabContentId).append('<div class="tab-pane fade in active" id="' + paneId + '" style="height: 100%;min-height: 285px;position: relative;">' +
  4032. '<input class="current_groupNo" type="hidden"/>' +
  4033. ' <div class="cf_content rb_item" style="height: 250px;padding-top: 5px;"></div>' +
  4034. ' <div style="height: 30px;border-top: 1px solid #ddd;width: 100%;position: absolute;bottom:0;">金额:<span class="cf_amount">0.0</span><span>元</span></div>' +
  4035. // ' <div style="height: 30px;border-top: 1px solid #ddd;width: 100%;position: absolute;bottom:0;"></div>' +
  4036. ' </div>');
  4037. //切换处方
  4038. $("#" + tabId).find("a[href='#" + paneId + "']").off("click").tab('show');
  4039. }
  4040. /**
  4041. * 填充西药选中的内容
  4042. * @param res
  4043. * @param groupNo
  4044. */
  4045. function fitWesternMedicine(res, groupNo) {
  4046. $("#western_medicine_name").val(res.data.name);
  4047. $("#western_medicine_name").blur();
  4048. var drugWinHtml = '';
  4049. var index = null;
  4050. if (res.data.weight != null) {
  4051. $("#drugWin").val(res.data.weight);
  4052. $("#drugWinDb").val(res.data.weight);
  4053. drugWinHtml = '<option value="' + res.data.weighUnit + '" desc="' + res.data.weight + '">' + res.data.weighUnitDesc + '</option>';
  4054. index = res.data.weighUnit;
  4055. }
  4056. if (res.data.volum != null) {
  4057. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  4058. $("#drugWin").val(res.data.volum);
  4059. $("#drugWinDb").val(res.data.volum);
  4060. }
  4061. drugWinHtml += '<option value="' + res.data.volUnit + '" desc="' + res.data.volum + '">' + res.data.volUnitDesc + '</option>';
  4062. if (index == null) {
  4063. index = res.data.volUnit;
  4064. }
  4065. }
  4066. if (res.data.miniUnit != null && res.data.miniUnit != "") {
  4067. if ($("#drugWin").val() == null || $("#drugWin").val() == '') {
  4068. $("#drugWin").val(1);
  4069. $("#drugWinDb").val(1);
  4070. }
  4071. drugWinHtml += '<option value="' + res.data.miniUnit + '" desc="1">' + res.data.miniUnitDesc + '</option>';
  4072. if (index == null) {
  4073. index = res.data.miniUnit;
  4074. }
  4075. }
  4076. $('#drugWinUnit').html(drugWinHtml);
  4077. $('#drugWinUnit').selectpicker('refresh');
  4078. $("#drugWinUnit").selectpicker('val', index);
  4079. $('#drugWinUnit').selectpicker('refresh');
  4080. if (res.data.packUnitDesc != null && res.data.packUnitDesc != "") {
  4081. var html = '<option value="' + res.data.packUnitDesc + '" >' + res.data.packUnitDesc + '</option>';
  4082. $('#packUnit').html(html);
  4083. $('#packUnit').selectpicker('refresh');
  4084. $("#packUnit").selectpicker('val', res.data.packUnitDesc);
  4085. $('#packUnit').selectpicker('refresh');
  4086. }
  4087. $("#packRetprice").val(res.data.packRetprice);
  4088. $("#packSize").val(res.data.packSize);
  4089. $("#current_code").val(res.data.code);
  4090. $("#current_serial").val(res.data.serial);
  4091. if ($("#dayNum").val() == null) {
  4092. //天数 同组药品天数相同
  4093. $("#dayNum").selectpicker('val', 1);
  4094. $('#dayNum').selectpicker('refresh');
  4095. }
  4096. if ($("#supplyType").val() == null && res.data.supplyType != null) {
  4097. // 给药方式 同组药品给药方式相同
  4098. $("#supplyType").selectpicker('val', res.data.supplyType);
  4099. $('#supplyType').selectpicker('refresh');
  4100. }
  4101. if ($("#orderFrequency").val() == null && res.data.frequency != null) {
  4102. //频次编码 同组药品频次编码相同
  4103. $("#orderFrequency").selectpicker('val', res.data.frequency);
  4104. $('#orderFrequency').selectpicker('refresh');
  4105. }
  4106. if ($("#orderFrequency").val() == null) {
  4107. //频次编码 防止频次为空
  4108. $("#orderFrequency").selectpicker('val', "ONCE");
  4109. $('#orderFrequency').selectpicker('refresh');
  4110. }
  4111. if (res.data.psFlag != null && (res.data.psFlag == 1 || res.data.psFlag == "1")) {
  4112. $("#tryFlag").parent().addClass("checked");
  4113. $("#tryFlag").parent().parent().parent().removeClass("hide").addClass("in");
  4114. } else {
  4115. $("#tryFlag").parent().removeClass("checked");
  4116. $("#tryFlag").parent().parent().parent().removeClass("in").addClass("hide");
  4117. }
  4118. if (groupNo == "91") {
  4119. //医材
  4120. $("#gross").removeAttr("readonly")
  4121. } else {
  4122. $("#gross").attr("readonly", "readonly");
  4123. }
  4124. calculate();
  4125. }
  4126. /**
  4127. * 剂量单位改变事件
  4128. */
  4129. function drugWinUnitChange() {
  4130. var desc = $('#drugWinUnit').find("option:selected").attr('desc');
  4131. $("#drugWin").val(desc);
  4132. $("#drugWinDb").val(desc);
  4133. calculate();
  4134. }
  4135. /**
  4136. * 根据选择的内容计算总的用药量
  4137. */
  4138. function calculate() {
  4139. //最小规格剂量
  4140. var drugWinDb = $("#drugWinDb").val();
  4141. //天数
  4142. var dayNum = $("#dayNum").val();
  4143. //当前使用的最小剂量
  4144. var drugWin = $("#drugWin").val();
  4145. //频率
  4146. var times = $('#orderFrequency').find("option:selected").attr('desc');
  4147. //包装规格数量
  4148. var packSize = $("#packSize").val();
  4149. //单价
  4150. var packRetprice = $("#packRetprice").val();
  4151. //当前药房编码
  4152. var currentGroupNo = $("#current_groupNo").val();
  4153. if (drugWinDb == null || drugWinDb === "") {
  4154. if (currentGroupNo == '71') {
  4155. return;
  4156. }
  4157. drugWinDb = 1;
  4158. }
  4159. if (dayNum == null || dayNum === "") {
  4160. if (currentGroupNo == '71') {
  4161. return;
  4162. }
  4163. dayNum = 1;
  4164. }
  4165. if (drugWin == null || drugWin === "") {
  4166. if (currentGroupNo == '71') {
  4167. return;
  4168. }
  4169. drugWin = 1;
  4170. }
  4171. if (times == null || times === "") {
  4172. if (currentGroupNo == '71') {
  4173. return;
  4174. }
  4175. times = 1;
  4176. }
  4177. if (packSize == null || packSize === "") {
  4178. return;
  4179. }
  4180. //拆零总量
  4181. var scatteredTotalNum = Multiply(Multiply(dayNum, drugWin), times);
  4182. //整包装的数量
  4183. var totalNum = Math.ceil(Division(scatteredTotalNum, Multiply(packSize, drugWinDb)));
  4184. $("#gross").val(totalNum);
  4185. $("#totalRetprice").val(Multiply(totalNum, packRetprice).toFixed(2));
  4186. }
  4187. /**
  4188. * 根据选择的总量计算金额 只有医材的时候需要计算
  4189. */
  4190. function calculateSimple() {
  4191. //总量
  4192. var gross = $("#gross").val();
  4193. //单价
  4194. var packRetprice = $("#packRetprice").val();
  4195. //当前药房编码
  4196. var currentGroupNo = $("#current_groupNo").val();
  4197. if (currentGroupNo != '91') {
  4198. return;
  4199. }
  4200. $("#totalRetprice").val(Multiply(gross, packRetprice).toFixed(2));
  4201. //医材默认天数为1
  4202. $("#dayNum").selectpicker('val', 1);
  4203. $('#dayNum').selectpicker('refresh');
  4204. $("#orderFrequency").selectpicker('val', "ONCE");
  4205. $('#orderFrequency').selectpicker('refresh');
  4206. }
  4207. /**
  4208. * 根据中药付数计算金额
  4209. */
  4210. function calculateZyAmount() {
  4211. var singleAmount = $("#singleAmount").val();
  4212. var tableId = $("#zyTab li.active").find("a").attr("href");
  4213. //获取中药付数
  4214. var zyfs = $(tableId).find("input.zyfs").val();
  4215. var cfAmount = Multiply(zyfs, singleAmount);
  4216. $(tableId).find("span.cf_amount").html(cfAmount);
  4217. calculateTotalAmount();
  4218. }
  4219. /**
  4220. * 将病人信息填入患者信息修改form
  4221. * @param patinet
  4222. */
  4223. function fillPlusPatinet(patinet) {
  4224. if (patinet != null) {
  4225. $("#editUserCode").val(patinet.patientId);
  4226. $("#editUserName").val(patinet.name);
  4227. $("#editUserName").blur();
  4228. $("#editUserAge").val(patinet.age);
  4229. $("#editUserAge").blur();
  4230. $("#editUserGender").selectpicker('val', patinet.sex);
  4231. $("#editUserGender").selectpicker('refresh');
  4232. $("#editUserGender").blur();
  4233. $("#editUserBirthDay").val(patinet.birthDayStr);
  4234. $("#editUserBirthDay").blur();
  4235. $("#editUserCardNo").val(patinet.icCardNo);
  4236. $("#editUserCardNo").attr("title", patinet.icCardNo);
  4237. $("#editUserCardNo").blur();
  4238. $("#editUserPhoneNum").val(patinet.phoneNo);
  4239. $("#editUserPhoneNum").attr("title", patinet.phoneNo);
  4240. $("#editUserPhoneNum").blur();
  4241. $("#editUserPatientsNature").selectpicker('val', patinet.responseType);//默认选中
  4242. $('#editUserPatientsNature').selectpicker('refresh');
  4243. $("#editUserPatientsNature").blur();
  4244. $("#editUserIdCard").val(patinet.socialNo);
  4245. $("#editUserIdCard").attr("title", patinet.socialNo);
  4246. $("#editUserIdCard").blur();
  4247. $("#editUserAddress").val(patinet.address);
  4248. $("#editUserAddress").blur();
  4249. $("#editUserContact").val(patinet.relName);
  4250. $("#editUserContactPhone").val(patinet.contractName);
  4251. }
  4252. }
  4253. /**
  4254. * 修改病人信息
  4255. */
  4256. function modifyPatient() {
  4257. $.ajax({
  4258. type: "POST",
  4259. url: '/thmz/modifyPatient',
  4260. contentType: "application/json;charset=UTF-8",
  4261. dataType: "json",
  4262. data: JSON.stringify({
  4263. "name": $("#editUserName").val(),
  4264. "age": $("#editUserAge").val(),
  4265. "sex": $("#editUserGender").val(),
  4266. "birthDay": $("#editUserBirthDay").val(),
  4267. "icCardNo": $("#editUserCardNo").val(),
  4268. "phoneNo": $("#editUserPhoneNum").val(),
  4269. "responseType": $("#editUserPatientsNature").val(),
  4270. "socialNo": $("#editUserIdCard").val(),
  4271. "address": $("#editUserAddress").val(),
  4272. "patientId": $("#editUserCode").val(),
  4273. "relName": $("#editUserContact").val(),
  4274. "contractName": $("#editUserContactPhone").val()
  4275. }),
  4276. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4277. success: function (res) {
  4278. if (res == '401' || res == 401) {
  4279. window.location.href = '/thmz/login/view'
  4280. return;
  4281. }
  4282. if (res.code == 0) {
  4283. $('#editUserModal').modal('hide');
  4284. realClinicalReception($("#patientId").val(), $("#mzfzSerialNoInClick").val());
  4285. } else {
  4286. errorMesage(res);
  4287. }
  4288. }
  4289. });
  4290. }
  4291. /**
  4292. * 获取按钮组选择的下标
  4293. * @param id
  4294. * @returns {number}
  4295. */
  4296. function getIndex(id) {
  4297. var index = 0;
  4298. var item = $("#" + id).find("button");
  4299. for (var i = 0; i <= item.length; i++) {
  4300. if ($(item[i]).hasClass("btn-primary")) {
  4301. index = i;
  4302. break;
  4303. }
  4304. }
  4305. return index;
  4306. }
  4307. /**
  4308. * 获取时间选择器的时间数组
  4309. * @returns {string[]}
  4310. */
  4311. function getRePortRangeArr() {
  4312. var rePortRange = $('#reportrange span').html();
  4313. var rePortRangeArr = rePortRange.split(" - ");
  4314. rePortRangeArr[0] = rePortRangeArr[0] + " 00:00:00"
  4315. rePortRangeArr[1] = rePortRangeArr[1] + " 23:59:59"
  4316. return rePortRangeArr;
  4317. }
  4318. /**
  4319. * 初始医生工作太配置
  4320. */
  4321. function initWorkspaceConfigForCurrent() {
  4322. $.ajax({
  4323. type: "GET",
  4324. url: '/thmz/getWorkspaceConfigForCurrent',
  4325. dataType: "json",
  4326. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4327. success: function (res) {
  4328. if (res == '401' || res == 401) {
  4329. window.location.href = '/thmz/login/view'
  4330. return;
  4331. }
  4332. if (res.code == 0) {
  4333. if (res.data.symptomFlag == 1) {
  4334. $("#symptomFlag").removeClass("in").addClass("hide");
  4335. //$("#symptomFlagCheck").prop("checked",false)
  4336. $("#symptomFlagCheck").parent().removeClass("checked");//不选中
  4337. } else if (res.data.symptomFlag == 0) {
  4338. $("#symptomFlag").removeClass("hide").addClass("in");
  4339. //$("#symptomFlagCheck").prop("checked",true)
  4340. $("#symptomFlagCheck").parent().addClass("checked");//选中
  4341. }
  4342. if (res.data.emrHpiFlag == 1) {
  4343. $("#emrHpiFlag").removeClass("in").addClass("hide");
  4344. // $("#emrHpiFlagCheck").attr("checked",false)//不选中
  4345. $("#emrHpiFlagCheck").parent().removeClass("checked");//不选中
  4346. } else if (res.data.emrHpiFlag == 0) {
  4347. $("#emrHpiFlag").removeClass("hide").addClass("in");
  4348. //$("#emrHpiFlagCheck").attr("checked",true)//选中
  4349. $("#emrHpiFlagCheck").parent().addClass("checked");//选中
  4350. }
  4351. if (res.data.emrPsFlag == 1) {
  4352. $("#emrPsFlag").removeClass("in").addClass("hide");
  4353. // $("#emrPsFlagCheck").attr("checked",false)//不选中
  4354. $("#emrPsFlagCheck").parent().removeClass("checked");//不选中
  4355. } else if (res.data.emrPsFlag == 0) {
  4356. $("#emrPsFlag").removeClass("hide").addClass("in");
  4357. //$("#emrPsFlagCheck").attr("checked",true)//选中
  4358. $("#emrPsFlagCheck").parent().addClass("checked");//选中
  4359. }
  4360. if (res.data.personalHistoryFlag == 1) {
  4361. $("#personalHistoryFlag").removeClass("in").addClass("hide");
  4362. //$("#personalHistoryFlagCheck").attr("checked",false)//不选中
  4363. $("#personalHistoryFlagCheck").parent().removeClass("checked");//不选中
  4364. } else if (res.data.personalHistoryFlag == 0) {
  4365. $("#personalHistoryFlag").removeClass("hide").addClass("in");
  4366. //$("#personalHistoryFlagCheck").attr("checked",true)//选中
  4367. $("#personalHistoryFlagCheck").parent().addClass("checked");//选中
  4368. }
  4369. if (res.data.familyHistoryFlag == 1) {
  4370. $("#familyHistoryFlag").removeClass("in").addClass("hide");
  4371. //$("#familyHistoryFlagCheck").attr("checked",false)//不选中
  4372. $("#familyHistoryFlagCheck").parent().removeClass("checked");//不选中
  4373. } else if (res.data.familyHistoryFlag == 0) {
  4374. $("#familyHistoryFlag").removeClass("hide").addClass("in");
  4375. //$("#familyHistoryFlagCheck").attr("checked",true)//选中
  4376. $("#familyHistoryFlagCheck").parent().addClass("checked");//选中
  4377. }
  4378. if (res.data.obstericalHistoryFlag == 1) {
  4379. $("#obstericalHistoryFlag").removeClass("in").addClass("hide");
  4380. //$("#obstericalHistoryFlagCheck").attr("checked",false)//不选中
  4381. $("#obstericalHistoryFlagCheck").parent().removeClass("checked");//不选中
  4382. } else if (res.data.obstericalHistoryFlag == 0) {
  4383. $("#obstericalHistoryFlag").removeClass("hide").addClass("in");
  4384. //$("#obstericalHistoryFlagCheck").attr("checked",true)//选中
  4385. $("#obstericalHistoryFlagCheck").parent().addClass("checked");//选中
  4386. }
  4387. if (res.data.pressureLeftFlag == 1) {
  4388. $("#pressureLeftFlag").removeClass("in").addClass("hide");
  4389. //$("#pressureLeftFlagCheck").attr("checked",false)//不选中
  4390. $("#pressureLeftFlagCheck").parent().removeClass("checked");//不选中
  4391. } else if (res.data.pressureLeftFlag == 0) {
  4392. $("#pressureLeftFlag").removeClass("hide").addClass("in");
  4393. //$("#pressureLeftFlagCheck").attr("checked",true)//选中
  4394. $("#pressureLeftFlagCheck").parent().addClass("checked");//选中
  4395. }
  4396. if (res.data.tentativeDiagnosisFlag == 1) {
  4397. $("#tentativeDiagnosisFlag").removeClass("in").addClass("hide");
  4398. $("#tentativeDiagnosisFlagCheck").parent().removeClass("checked");//不选中
  4399. } else if (res.data.tentativeDiagnosisFlag == 0) {
  4400. $("#tentativeDiagnosisFlag").removeClass("hide").addClass("in");
  4401. $("#tentativeDiagnosisFlagCheck").parent().addClass("checked");//选中
  4402. }
  4403. } else {
  4404. errorMesage(res);
  4405. }
  4406. }
  4407. });
  4408. }
  4409. /**
  4410. * 保存医生工作台配置
  4411. */
  4412. function saveWorkspaceConfig() {
  4413. var symptomFlag = $("#symptomFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  4414. var emrHpiFlag = $("#emrHpiFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  4415. var emrPsFlag = $("#emrPsFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  4416. var personalHistoryFlag = $("#personalHistoryFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  4417. var familyHistoryFlag = $("#familyHistoryFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  4418. var obstericalHistoryFlag = $("#obstericalHistoryFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  4419. var pressureLeftFlag = $("#pressureLeftFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  4420. var tentativeDiagnosisFlag = $("#tentativeDiagnosisFlagCheck").parent().hasClass("checked") == true ? 0 : 1;
  4421. $.ajax({
  4422. type: "POST",
  4423. url: '/thmz/saveWorkspaceConfig',
  4424. contentType: "application/json;charset=UTF-8",
  4425. dataType: "json",
  4426. data: JSON.stringify({
  4427. "symptomFlag": symptomFlag,
  4428. "emrHpiFlag": emrHpiFlag,
  4429. "emrPsFlag": emrPsFlag,
  4430. "personalHistoryFlag": personalHistoryFlag,
  4431. "familyHistoryFlag": familyHistoryFlag,
  4432. "obstericalHistoryFlag": obstericalHistoryFlag,
  4433. "pressureLeftFlag": pressureLeftFlag,
  4434. "tentativeDiagnosisFlag": tentativeDiagnosisFlag
  4435. }),
  4436. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4437. success: function (res) {
  4438. if (res == '401' || res == 401) {
  4439. window.location.href = '/thmz/login/view'
  4440. return;
  4441. }
  4442. if (res.code == 0) {
  4443. //successMesage(res);
  4444. initWorkspaceConfigForCurrent();
  4445. $("#configWorkspaceModal").modal("hide");
  4446. } else {
  4447. errorMesage(res);
  4448. }
  4449. }
  4450. });
  4451. }
  4452. /**
  4453. * 初始化药品,检查检验菜单树
  4454. */
  4455. function initzTree() {
  4456. var index = getIndex("bill_item_group");
  4457. if (index == 0) {
  4458. $("#western_medicine_name").webuiPopover('hide');
  4459. $.ajax({
  4460. type: "GET",
  4461. url: '/thmz/getYpZdClasses',
  4462. contentType: "application/json;charset=UTF-8",
  4463. dataType: "json",
  4464. async: false,
  4465. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4466. success: function (res) {
  4467. if (res == '401' || res == 401) {
  4468. window.location.href = '/thmz/login/view'
  4469. return;
  4470. }
  4471. if (res.code == 0) {
  4472. // zTree 的参数配置,深入使用请参考 API 文档(setting 配置详解)
  4473. var setting = {
  4474. callback: {
  4475. onClick: zTreeOnClick
  4476. }
  4477. };
  4478. $.fn.zTree.init($("#treeDemo"), setting, res.data);
  4479. } else {
  4480. errorMesage(res);
  4481. }
  4482. }
  4483. });
  4484. } else if (index == 2) {
  4485. $("#jcJyItem").webuiPopover('hide');
  4486. $.ajax({
  4487. type: "GET",
  4488. url: '/thmz/getJyJcZdClasses',
  4489. contentType: "application/json;charset=UTF-8",
  4490. dataType: "json",
  4491. async: false,
  4492. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4493. success: function (res) {
  4494. if (res == '401' || res == 401) {
  4495. window.location.href = '/thmz/login/view'
  4496. return;
  4497. }
  4498. if (res.code == 0) {
  4499. // zTree 的参数配置,深入使用请参考 API 文档(setting 配置详解)
  4500. var setting = {
  4501. callback: {
  4502. onClick: zTreeOnClick
  4503. }
  4504. };
  4505. $.fn.zTree.init($("#treeDemo"), setting, res.data);
  4506. } else {
  4507. errorMesage(res);
  4508. }
  4509. }
  4510. });
  4511. } else {
  4512. $("#treeButton").webuiPopover('hide');
  4513. warningMesageSimaple("中药暂无帮助字典");
  4514. }
  4515. }
  4516. /**
  4517. * 节点点击事件
  4518. * @param event
  4519. * @param treeId
  4520. * @param treeNode
  4521. */
  4522. function zTreeOnClick(event, treeId, treeNode) {
  4523. var index = getIndex("bill_item_group");
  4524. if (index == 0) {
  4525. $("#western_medicine_name").val(treeNode.id);
  4526. $('#western_medicine_name').webuiPopover('show');
  4527. loadYpList(0);
  4528. } else if (index == 2) {
  4529. $("#jcJyItem").val(treeNode.id);
  4530. $('#jcJyItem').webuiPopover('show');
  4531. loadjcJyItemList();
  4532. }
  4533. }
  4534. /**
  4535. * 构建处方参数
  4536. * @returns {any}
  4537. */
  4538. function getParamsForOrescription() {
  4539. var jsonData = JSON.parse('{"patientId": "","firstOrNot":"","icdCode": "","icdText": null,"jzFlag": "0","serialNo":"","mzBlRecord": {"firstOrNot": "","emrChiefComplaint": "","emrHpi": "","emrPs": "","emrPe": "","emrFzjc": null,"emrProcess": null,"emrXyy": "无","emrYypg": "无","emrGnpg": "无","emrJkjy": "","personalHistory": "","familyHistory": "","obstericalHistory": "","weight": "","temperature": "","sphygmus": "","breathe": "","pressureHigh": "","pressureFloor": "","pressureHighLeft": "","pressureFloorLeft": "","tentativeDiagnosis":""},"mzChargeDetailList": [],"mzYjReqList": []}');
  4540. jsonData.patientId = $("#patientId").val();
  4541. jsonData.firstOrNot = $("input[name='firstOrNot']:checked").val();
  4542. jsonData.icdCode = $("#diagnoseValue").val();
  4543. jsonData.serialNo = $("#mzfzSerialNoInClick").val();
  4544. jsonData.mzBlRecord.firstOrNot = jsonData.firstOrNot;
  4545. jsonData.mzBlRecord.emrChiefComplaint = $("#symptom").val();
  4546. jsonData.mzBlRecord.emrHpi = $("#emrHpi").val();
  4547. jsonData.mzBlRecord.emrPs = $("#emrPs").val();
  4548. jsonData.mzBlRecord.emrPe = $("#otherCheck").val();
  4549. jsonData.mzBlRecord.emrJkjy = $("#healthEducation").val();
  4550. jsonData.mzBlRecord.personalHistory = $("#personalHistory").val();
  4551. jsonData.mzBlRecord.familyHistory = $("#familyHistory").val();
  4552. jsonData.mzBlRecord.obstericalHistory = $("#obstericalHistory").val();
  4553. jsonData.mzBlRecord.weight = $("#weight").val();
  4554. jsonData.mzBlRecord.temperature = $("#temperature").val();
  4555. jsonData.mzBlRecord.sphygmus = $("#sphygmus").val();
  4556. jsonData.mzBlRecord.breathe = $("#breathe").val();
  4557. jsonData.mzBlRecord.pressureHigh = $("#pressure_high").val();
  4558. jsonData.mzBlRecord.pressureFloor = $("#pressure_floor").val();
  4559. jsonData.mzBlRecord.pressureHighLeft = $("#pressure_high_left").val();
  4560. jsonData.mzBlRecord.pressureFloorLeft = $("#pressure_floor_left").val();
  4561. jsonData.mzBlRecord.tentativeDiagnosis = $("#tentativeDiagnosis").val();
  4562. //设置处方详情
  4563. var emrProcess = "";
  4564. var emrFzjc = null;
  4565. var xyTabContents = $("#xyTabContent").find("div.tab-pane");
  4566. //处方号
  4567. var orderNo = 0;
  4568. //西药设置
  4569. if (xyTabContents != null && xyTabContents.length > 0) {
  4570. for (var i = 0; i < xyTabContents.length; i++) {
  4571. //当前药品类型
  4572. var currentGroupNo = $(xyTabContents[i]).find("input.current_groupNo").val();
  4573. var formGroups = $(xyTabContents[i]).find("div.form-group");
  4574. if (formGroups != null && formGroups.length > 0) {
  4575. if (i == 0) {
  4576. emrProcess += "西药治疗:"
  4577. } else if (i != xyTabContents.length - 1) {
  4578. emrProcess += "_";
  4579. }
  4580. for (var j = 0; j < formGroups.length; j++) {
  4581. // var cfAmount = $(xyTabContents[i]).find("span.cf_amount").parent().text();
  4582. // emrProcess += $(formGroups[j]).text().replace(cfAmount, "") + "-";
  4583. if (j == formGroups.length - 1) {
  4584. emrProcess += $(formGroups[j]).text();
  4585. } else {
  4586. emrProcess += $(formGroups[j]).text() + "_";
  4587. }
  4588. var tempJson = JSON.parse('{"chargeItemCode": "","serial": "","quantity": "","drugQuan": "","drugUnit": "","frequency": "","orderDays": "","paySelf": "0","drugWin": "1","instructionCode":"","instructionText":"","orderNo":"","groupOrder":"","supplyCode":"","cyJssm":"","cyDj":"","cyFysm":"","tryFlag":"0","groupNo":""}');
  4589. tempJson.chargeItemCode = $(formGroups[j]).find("input.temporary_items_code").val();
  4590. tempJson.serial = $(formGroups[j]).find("input.temporary_items_serial").val();
  4591. tempJson.quantity = $(formGroups[j]).find("input.temporary_items_gross").val();
  4592. tempJson.drugQuan = $(formGroups[j]).find("input.temporary_items_drugWin").val();
  4593. tempJson.drugUnit = $(formGroups[j]).find("input.temporary_items_drugWinUnit").val();
  4594. tempJson.frequency = $(formGroups[j]).find("input.temporary_items_orderFrequency").val();
  4595. tempJson.orderDays = $(formGroups[j]).find("input.temporary_items_dayNum").val();
  4596. tempJson.instructionCode = $(formGroups[j]).find("input.temporary_items_medicalAdvice").val();
  4597. tempJson.instructionText = $(formGroups[j]).find("input.temporary_items_medicalAdviceText").val();
  4598. tempJson.supplyCode = $(formGroups[j]).find("input.temporary_items_supplyType").val();
  4599. orderNo = i + 1;
  4600. tempJson.orderNo = orderNo;
  4601. tempJson.groupOrder = $(formGroups[j]).find("input.temporary_items_groupId").val();
  4602. tempJson.groupNo = currentGroupNo;
  4603. var tryFlag = $(formGroups[j]).find("input.temporary_items_tryFlag").val();
  4604. if (tryFlag == true || tryFlag == "true") {
  4605. tempJson.tryFlag = 1;
  4606. }
  4607. jsonData.mzChargeDetailList[jsonData.mzChargeDetailList.length] = tempJson;
  4608. }
  4609. }
  4610. }
  4611. }
  4612. //中草药
  4613. var zyTabContents = $("#zyTabContent").find("div.form-group");
  4614. if (zyTabContents != null && zyTabContents.length > 0) {
  4615. emrProcess += "中药治疗:"
  4616. orderNo++;
  4617. var zyfs = $("input.zyfs").val();
  4618. emrProcess += "付数" + zyfs + "_";
  4619. //中药的类型
  4620. var currentZyClassType = $("#current_zyClassType").val();
  4621. for (var i = 0; i < zyTabContents.length; i++) {
  4622. // var cfAmount = $(zyTabContents[i]).find("span.cf_amount").parent().text();
  4623. // emrProcess += $(zyTabContents[i]).text().replace(cfAmount, "") + "-";
  4624. if (i == zyTabContents.length - 1) {
  4625. emrProcess += $(zyTabContents[i]).text();
  4626. } else {
  4627. emrProcess += $(zyTabContents[i]).text() + "_";
  4628. }
  4629. var tempJson = JSON.parse('{"chargeItemCode": "","serial": "","quantity": "","drugQuan": "","drugUnit": "g","frequency": "","orderDays": "1","paySelf": "0","drugWin": "","instructionCode":"","instructionText":"","orderNo":"1","groupOrder":"1","supplyCode":"","cyJssm":"","cyDj":"","cyFysm":"","tryFlag":"0","groupNo":""}');
  4630. tempJson.chargeItemCode = $(zyTabContents[i]).find("input.temporary_items_code").val();
  4631. tempJson.serial = $(zyTabContents[i]).find("input.temporary_items_serial").val();
  4632. tempJson.quantity = $(zyTabContents[i]).find("input.temporary_items_drugWin").val();
  4633. tempJson.drugQuan = $(zyTabContents[i]).find("input.temporary_items_drugWin").val();
  4634. tempJson.drugWin = zyfs;
  4635. tempJson.frequency = $("#zy_orderFrequency_1").val();
  4636. tempJson.instructionCode = $(zyTabContents[i]).find("input.temporary_items_zyInstruction").val();
  4637. tempJson.instructionText = $(zyTabContents[i]).find("input.temporary_items_zyInstructionText").val();
  4638. tempJson.cyFysm = $("#useType_1").val();
  4639. tempJson.cyJssm = $("#cyJssm").val();
  4640. tempJson.cyDj = $("#zy_supplyType_1").val();
  4641. tempJson.orderNo = orderNo;
  4642. tempJson.groupNo = currentZyClassType;
  4643. jsonData.mzChargeDetailList[jsonData.mzChargeDetailList.length] = tempJson;
  4644. }
  4645. }
  4646. //设置诊疗与医技
  4647. var zlTabContents = $("#zlTabContent").find("div.form-group");
  4648. if (zlTabContents != null && zlTabContents.length > 0) {
  4649. emrProcess += "医技与诊疗:"
  4650. orderNo++;
  4651. for (var i = 0; i < zlTabContents.length; i++) {
  4652. // var cfAmount = $(zlTabContents[i]).find("span.cf_amount").parent().text();
  4653. // emrProcess += $(zlTabContents[i]).text().replace(cfAmount, "") + "-";
  4654. if (i == zlTabContents.length - 1) {
  4655. emrProcess += $(zlTabContents[i]).text();
  4656. } else {
  4657. emrProcess += $(zlTabContents[i]).text() + "_";
  4658. }
  4659. if (emrFzjc == null) {
  4660. emrFzjc = $(zlTabContents[i]).text();
  4661. } else {
  4662. emrFzjc += "," + $(zlTabContents[i]).text();
  4663. }
  4664. var tempJson = null;
  4665. //项目类型
  4666. var itemsType = $(zlTabContents[i]).find("input.temporary_items_type").val();
  4667. if (itemsType == "3" || itemsType == 3) {
  4668. //诊疗,放入药品类型中入库,因为诊疗是与药品一样直接入明细库,但是是与医技在同一处方开立页面开立
  4669. tempJson = JSON.parse('{"chargeItemCode": "","serial": "","quantity": "1","drugQuan": "1","drugUnit": "","frequency": "","orderDays": "1","paySelf": "0","drugWin": "1","instructionCode":"","instructionText":"","orderNo":"","groupOrder":"","supplyCode":"","cyJssm":"","cyDj":"","cyFysm":"","tryFlag":"0","groupNo":"00"}');
  4670. tempJson.chargeItemCode = $(zlTabContents[i]).find("input.temporary_items_code").val();
  4671. tempJson.instructionText = $(zlTabContents[i]).find("input.temporary_items_remark").val();
  4672. tempJson.orderNo = orderNo;
  4673. jsonData.mzChargeDetailList[jsonData.mzChargeDetailList.length] = tempJson;
  4674. } else {
  4675. tempJson = JSON.parse('{"orderCode":"","inspectPart":"","inspectStuff":"","jyRemark":"","orderNo":"1"}');
  4676. tempJson.orderCode = $(zlTabContents[i]).find("input.temporary_items_code").val();
  4677. if (itemsType == "1" || itemsType == 1) {
  4678. //检验
  4679. tempJson.inspectStuff = $(zlTabContents[i]).find("input.temporary_items_desc_value").val();
  4680. } else if (itemsType == "2" || itemsType == 2) {
  4681. //检查
  4682. tempJson.inspectPart = $(zlTabContents[i]).find("input.temporary_items_desc_value").val();
  4683. }
  4684. tempJson.jyRemark = $(zlTabContents[i]).find("input.temporary_items_remark").val();
  4685. tempJson.orderNo = orderNo;
  4686. jsonData.mzYjReqList[jsonData.mzYjReqList.length] = tempJson;
  4687. }
  4688. }
  4689. }
  4690. //设置诊断名称
  4691. var icdText = null;
  4692. var tagsTexts = $("span.el-select__tags-text");
  4693. if (tagsTexts != null && tagsTexts.length > 0) {
  4694. for (var i = 0; i < tagsTexts.length; i++) {
  4695. if (icdText == null) {
  4696. icdText = $(tagsTexts[i]).text();
  4697. } else {
  4698. icdText += "," + $(tagsTexts[i]).text();
  4699. }
  4700. }
  4701. }
  4702. jsonData.icdText = icdText;
  4703. jsonData.mzBlRecord.emrFzjc = emrFzjc;
  4704. jsonData.mzBlRecord.emrProcess = emrProcess;
  4705. return jsonData;
  4706. }
  4707. /**
  4708. * 保存处方
  4709. */
  4710. function savePrescription() {
  4711. $("#messageModal").modal();
  4712. $("#messageContent").html("确认保存处方吗?");
  4713. $("#messageButton").off("click").on("click", function (t) {
  4714. $("#messageModal").modal("hide");
  4715. var jsonData = getParamsForOrescription();
  4716. $.ajax({
  4717. type: "POST",
  4718. url: '/thmz/savePrescription',
  4719. contentType: "application/json;charset=UTF-8",
  4720. dataType: "json",
  4721. data: JSON.stringify(jsonData),
  4722. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4723. success: function (res) {
  4724. if (res == '401' || res == 401) {
  4725. window.location.href = '/thmz/login/view'
  4726. return;
  4727. }
  4728. if (res.code == 0) {
  4729. successMesage(res);
  4730. clearWorkSpace();
  4731. loadInClinicTableList();
  4732. loadClinicTableList();
  4733. } else {
  4734. errorMesage(res);
  4735. }
  4736. }
  4737. });
  4738. });
  4739. }
  4740. /**
  4741. * 保存医疗范文
  4742. */
  4743. function saveapidAccepts() {
  4744. var templateName = $("#templateName").val();
  4745. if (templateName == null || templateName == "") {
  4746. errorMesageSimaple("范文名称不能为空!");
  4747. return;
  4748. }
  4749. var templateType = $("#templateType").val();
  4750. if (templateType == null || templateType == "") {
  4751. errorMesageSimaple("范文类型不能为空!");
  4752. return;
  4753. }
  4754. var templateStatus = $("#templateStatus").val();
  4755. if (templateStatus == null || templateStatus == "") {
  4756. errorMesageSimaple("范文状态不能为空!");
  4757. return;
  4758. }
  4759. $("#saveapidAcceptsModal").modal("hide");
  4760. $("#messageModal").modal();
  4761. $("#messageContent").html("确认保存医疗范文吗?");
  4762. $("#messageButton").off("click").on("click", function (t) {
  4763. $("#messageModal").modal("hide");
  4764. var jsonData = getParamsForOrescription();
  4765. $.ajax({
  4766. type: "POST",
  4767. url: '/thmz/saveTemplate',
  4768. contentType: "application/json;charset=UTF-8",
  4769. dataType: "json",
  4770. data: JSON.stringify({
  4771. "id": $("#templateId").val(),
  4772. "name": templateName,
  4773. "icdText": jsonData.icdText,
  4774. "templateType": templateType,
  4775. "templateStatus": templateStatus,
  4776. "templateData": JSON.stringify(jsonData)
  4777. }),
  4778. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4779. success: function (res) {
  4780. if (res == '401' || res == 401) {
  4781. window.location.href = '/thmz/login/view'
  4782. return;
  4783. }
  4784. if (res.code == 0) {
  4785. successMesage(res);
  4786. clearWorkSpace();
  4787. } else {
  4788. $("#saveapidAcceptsModal").modal();
  4789. errorMesage(res);
  4790. }
  4791. }
  4792. });
  4793. });
  4794. }
  4795. /**
  4796. * 停用医疗范文
  4797. */
  4798. function removeTemplate() {
  4799. $("#messageModal").modal();
  4800. $("#messageContent").html("确认停用医疗范文吗?");
  4801. $("#messageButton").off("click").on("click", function (t) {
  4802. $("#messageModal").modal("hide");
  4803. $.ajax({
  4804. type: "POST",
  4805. url: '/thmz/removeTemplate',
  4806. contentType: "application/json;charset=UTF-8",
  4807. dataType: "json",
  4808. data: JSON.stringify({
  4809. "id": $("#idTemplate").val()
  4810. }),
  4811. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4812. success: function (res) {
  4813. if (res == '401' || res == 401) {
  4814. window.location.href = '/thmz/login/view'
  4815. return;
  4816. }
  4817. if (res.code == 0) {
  4818. successMesage(res);
  4819. $("#medicalModelModal").modal("hide");
  4820. fitTemplateData();
  4821. } else {
  4822. errorMesage(res);
  4823. }
  4824. }
  4825. });
  4826. });
  4827. }
  4828. /**
  4829. * 清空医疗范文模块内容
  4830. */
  4831. function clearApidAcceptsModal() {
  4832. $("#templateId").val(null);
  4833. $("#templateName").val(null);
  4834. $("#templateType").selectpicker('val', 0);
  4835. $("#templateType").selectpicker('refresh');
  4836. $("#templateStatus").selectpicker('val', 0);
  4837. $("#templateStatus").selectpicker('refresh');
  4838. }
  4839. /**
  4840. * 查询病人未缴费处方信息 加载到处方修改
  4841. * @param patientId
  4842. * @param times
  4843. * @param clnicId 就诊记录id
  4844. */
  4845. function getMzPrescriptionVoUnPaid(patientId, times, clnicId) {
  4846. var currentPatientId = $("#patientId").val();
  4847. //当前接诊的用户和操作接诊的是同一个人,不做任何操作
  4848. if (currentPatientId == patientId) {
  4849. return;
  4850. }
  4851. if (currentPatientId == null || currentPatientId == "") {
  4852. //当前没有人接诊,直接接诊
  4853. getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId);
  4854. } else {
  4855. //当前有人在接诊,提示是否需要切换和保存
  4856. $("#messagePrescriptionModal").modal();
  4857. $("#confirmPrescriptionButton").off("click").on("click", function (t) {
  4858. $("#messagePrescriptionModal").modal("hide");
  4859. //先保存目前接诊信息,再切换就诊人
  4860. var jsonData = getParamsForOrescription();
  4861. $.ajax({
  4862. type: "POST",
  4863. url: '/thmz/savePrescription',
  4864. contentType: "application/json;charset=UTF-8",
  4865. dataType: "json",
  4866. data: JSON.stringify(jsonData),
  4867. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4868. success: function (res) {
  4869. if (res == '401' || res == 401) {
  4870. window.location.href = '/thmz/login/view'
  4871. return;
  4872. }
  4873. if (res.code == 0) {
  4874. loadInClinicTableList();
  4875. loadClinicTableList();
  4876. getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId);
  4877. } else {
  4878. errorMesage(res);
  4879. }
  4880. }
  4881. });
  4882. });
  4883. $("#cancelPrescriptionButton").off("click").on("click", function (t) {
  4884. $("#messagePrescriptionModal").modal("hide");
  4885. getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId);
  4886. });
  4887. }
  4888. }
  4889. /**
  4890. * 查询病人未缴费处方信息 加载到处方修改 通用方法
  4891. * @param patientId
  4892. * @param times
  4893. * @param clnicId 就诊记录id
  4894. */
  4895. function getMzPrescriptionVoUnPaidCommon(patientId, times, clnicId) {
  4896. $.ajax({
  4897. type: "GET",
  4898. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + "&times=" + times + "&MzBlRecordFlag=false&payMark=5&clnicId=null",
  4899. contentType: "application/json;charset=UTF-8",
  4900. dataType: "json",
  4901. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4902. success: function (res) {
  4903. if (res == '401' || res == 401) {
  4904. window.location.href = '/thmz/login/view'
  4905. return;
  4906. }
  4907. if (res.code == 0) {
  4908. clearWorkSpace();
  4909. setMzPatientInfo(res.mzPatientMi);
  4910. editPrescription(res.data)
  4911. //修改患者的时候,将原纪录的就诊记录id带上,并借用分诊流水号字段传参
  4912. $("#mzfzSerialNoInClick").val("clnicId_" + clnicId);
  4913. } else {
  4914. errorMesage(res);
  4915. }
  4916. }
  4917. });
  4918. }
  4919. /**
  4920. * 查询病人已缴费处方信息 调用处方
  4921. * @param patientId
  4922. * @param times
  4923. * @param clnicId 就诊记录id
  4924. */
  4925. function getMzPrescriptionVoPaid(patientId, times, clnicId) {
  4926. $("#visitingDetailModal").modal("hide");
  4927. $("#messageModal").modal();
  4928. $("#messageContent").html("确认调用选中处方吗?将会覆盖当前处方。");
  4929. $("#messageButton").off("click").on("click", function (t) {
  4930. $("#messageModal").modal("hide");
  4931. $.ajax({
  4932. type: "GET",
  4933. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + "&times=" + times + "&MzBlRecordFlag=false&payMark=0&clnicId=null",
  4934. contentType: "application/json;charset=UTF-8",
  4935. dataType: "json",
  4936. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4937. success: function (res) {
  4938. if (res == '401' || res == 401) {
  4939. window.location.href = '/thmz/login/view'
  4940. return;
  4941. }
  4942. if (res.code == 0) {
  4943. var mzfzSerialNoInClick=$("#mzfzSerialNoInClick").val();
  4944. clearWorkSpace();
  4945. setMzPatientInfo(res.mzPatientMi);
  4946. editPrescription(res.data)
  4947. $("#mzfzSerialNoInClick").val(mzfzSerialNoInClick);
  4948. } else {
  4949. errorMesage(res);
  4950. }
  4951. }
  4952. });
  4953. });
  4954. }
  4955. /**
  4956. * 重复接诊
  4957. * @param patientId
  4958. * @param times
  4959. * @param clnicId
  4960. * @param deptCode 就诊科室编码
  4961. */
  4962. function repeatAccepts(patientId, times, clnicId, deptCode) {
  4963. $.ajax({
  4964. type: "GET",
  4965. url: '/thmz/validMzyReqrec?patientId=' + patientId + "&deptCode=" + deptCode,
  4966. contentType: "application/json;charset=UTF-8",
  4967. dataType: "json",
  4968. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4969. success: function (res) {
  4970. if (res == '401' || res == 401) {
  4971. window.location.href = '/thmz/login/view'
  4972. return;
  4973. }
  4974. if (res.code == 0) {
  4975. if (res.data == 0) {
  4976. $("#messageModal").modal();
  4977. $("#messageContent").html("挂号失效,确定继续就诊?");
  4978. $("#messageButton").off("click").on("click", function (t) {
  4979. $("#messageModal").modal("hide");
  4980. repeatAcceptsConfirm(patientId, times, clnicId);
  4981. });
  4982. return;
  4983. }
  4984. repeatAcceptsConfirm(patientId, times, clnicId);
  4985. } else {
  4986. errorMesage(res);
  4987. }
  4988. }
  4989. });
  4990. }
  4991. /**
  4992. * 重复接诊提示方法
  4993. * @param patientId
  4994. * @param times
  4995. * @param clnicId
  4996. */
  4997. function repeatAcceptsConfirm(patientId, times, clnicId) {
  4998. var currentPatientId = $("#patientId").val();
  4999. //当前接诊的用户和操作接诊的是同一个人,不做任何操作
  5000. if (currentPatientId == patientId) {
  5001. return;
  5002. }
  5003. if (currentPatientId == null || currentPatientId == "") {
  5004. //当前没有人接诊,直接接诊
  5005. repeatAcceptsCommon(patientId, times, clnicId);
  5006. } else {
  5007. //当前有人在接诊,提示是否需要切换和保存
  5008. $("#messagePrescriptionModal").modal();
  5009. $("#confirmPrescriptionButton").off("click").on("click", function (t) {
  5010. $("#messagePrescriptionModal").modal("hide");
  5011. //先保存目前接诊信息,再切换就诊人
  5012. var jsonData = getParamsForOrescription();
  5013. $.ajax({
  5014. type: "POST",
  5015. url: '/thmz/savePrescription',
  5016. contentType: "application/json;charset=UTF-8",
  5017. dataType: "json",
  5018. data: JSON.stringify(jsonData),
  5019. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5020. success: function (res) {
  5021. if (res == '401' || res == 401) {
  5022. window.location.href = '/thmz/login/view'
  5023. return;
  5024. }
  5025. if (res.code == 0) {
  5026. repeatAcceptsCommon(patientId, times, clnicId);
  5027. //加载已接诊患者列表
  5028. loadClinicTableList();
  5029. } else {
  5030. errorMesage(res);
  5031. }
  5032. }
  5033. });
  5034. });
  5035. $("#cancelPrescriptionButton").off("click").on("click", function (t) {
  5036. $("#messagePrescriptionModal").modal("hide");
  5037. repeatAcceptsCommon(patientId, times, clnicId);
  5038. });
  5039. }
  5040. }
  5041. /**
  5042. * 重复接诊通用方法
  5043. * @param patientId
  5044. * @param times
  5045. * @param clnicId
  5046. */
  5047. function repeatAcceptsCommon(patientId, times, clnicId) {
  5048. $.ajax({
  5049. type: "GET",
  5050. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + "&times=" + times + "&MzBlRecordFlag=true&payMark=null&clnicId=null",
  5051. contentType: "application/json;charset=UTF-8",
  5052. dataType: "json",
  5053. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5054. success: function (res) {
  5055. if (res == '401' || res == 401) {
  5056. window.location.href = '/thmz/login/view'
  5057. return;
  5058. }
  5059. if (res.code == 0) {
  5060. clearWorkSpace();
  5061. setMzPatientInfo(res.mzPatientMi);
  5062. editPrescription(res.data)
  5063. //修改患者的时候,将原纪录的就诊记录id带上,并借用分诊流水号字段传参
  5064. $("#mzfzSerialNoInClick").val("clnicId_" + clnicId);
  5065. } else {
  5066. errorMesage(res);
  5067. }
  5068. }
  5069. });
  5070. }
  5071. /**
  5072. * 就诊详情 已诊患者列表发起
  5073. * @param patientId
  5074. * @param times
  5075. * @param clnicId
  5076. * @param payMark
  5077. */
  5078. function prescriptionDetail(patientId, times, clnicId, payMark) {
  5079. prescriptionDetailCommon(patientId, times, clnicId, payMark, 0);
  5080. }
  5081. /**
  5082. * 就诊详情 历史轨迹发起
  5083. * @param patientId
  5084. * @param times
  5085. * @param clnicId
  5086. * @param clinicStatus
  5087. */
  5088. function visitingDetailModal(patientId, times, clnicId, clinicStatus) {
  5089. var payMark =null;
  5090. if(clinicStatus==5){
  5091. payMark=5;
  5092. }else {
  5093. payMark=0;
  5094. }
  5095. prescriptionDetailCommon(patientId, times, clnicId, payMark, 1);
  5096. }
  5097. /**
  5098. * 就诊详情通用方法
  5099. * @param patientId
  5100. * @param times
  5101. * @param clnicId
  5102. * @param payMark
  5103. * @param type 0 已诊患者列表发起 1 历史轨迹发起
  5104. */
  5105. function prescriptionDetailCommon(patientId, times, clnicId, payMark, type) {
  5106. $.ajax({
  5107. type: "GET",
  5108. url: '/thmz/getMzPrescriptionVo?patientId=' + patientId + '&times=' + times + '&MzBlRecordFlag=false&payMark=' + payMark + '&clnicId=' + clnicId,
  5109. contentType: "application/json;charset=UTF-8",
  5110. dataType: "json",
  5111. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  5112. success: function (res) {
  5113. if (res == '401' || res == 401) {
  5114. window.location.href = '/thmz/login/view'
  5115. return;
  5116. }
  5117. if (res.code == 0) {
  5118. $("#visitingDetailModal").modal();
  5119. var jsonData = res.data;
  5120. var mzPatientMi = res.mzPatientMi;
  5121. $("#visitingDetailPatientName").text(mzPatientMi.name);
  5122. $("#visitingDetailPatientAge").text(mzPatientMi.age);
  5123. $("#visitingDetailPatientGender").val(mzPatientMi.gender);
  5124. $("#prescriptionDetail_zd").html("");
  5125. $("#prescriptionDetail_xyzlContent").html("");
  5126. $("#prescriptionDetail_zyzlContent").html("");
  5127. $("#prescriptionDetail_zlyjContent").html("");
  5128. if (res.opDate != null) {
  5129. $("#visitingDetailDate").text(res.opDate);
  5130. }
  5131. if (res.deptName != null) {
  5132. $("#visitingDetailDept").text(res.deptName);
  5133. }
  5134. if (res.doctorName != null) {
  5135. $("#visitingDetailDoctor").text(res.doctorName);
  5136. }
  5137. var firstOrNot = jsonData.mzBlRecord.firstOrNot;
  5138. if (firstOrNot == 0) {
  5139. $("#visitFlag").html("初诊");
  5140. $("#first").click();
  5141. } else if (firstOrNot == 1) {
  5142. $("#visitFlag").html("复诊");
  5143. $("#not").click();
  5144. }
  5145. if (payMark == 0) {
  5146. $("#chargeImage").attr("src", "/thmz/images/charge.png");
  5147. } else if (payMark == 5) {
  5148. $("#chargeImage").attr("src", "/thmz/images/nocharge.png");
  5149. }
  5150. var icdText = jsonData.icdText;
  5151. if (icdText != null) {
  5152. var arr = icdText.split(",");
  5153. var html = "";
  5154. for (var i = 0; i < arr.length; i++) {
  5155. if (i == 0) {
  5156. html += ' <div class="tagZdy tagZdy-back">';
  5157. } else {
  5158. html += ' <div class="tagZdy tagZdy-back-green">';
  5159. }
  5160. html += arr[i];
  5161. html += '</div>';
  5162. }
  5163. $("#prescriptionDetail_zd").html(html);
  5164. }
  5165. var emrProcess = jsonData.mzBlRecord.emrProcess;
  5166. if (emrProcess != null) {
  5167. var xy = null;
  5168. if (emrProcess.indexOf("西药治疗:") >= 0) {
  5169. if (emrProcess.indexOf("中药治疗:") >= 0) {
  5170. xy = emrProcess.substring(emrProcess.indexOf("西药治疗:") + 5, emrProcess.indexOf("中药治疗:"));
  5171. } else if (emrProcess.indexOf("医技与诊疗:") >= 0) {
  5172. xy = emrProcess.substring(emrProcess.indexOf("西药治疗:") + 5, emrProcess.indexOf("医技与诊疗:"));
  5173. } else {
  5174. xy = emrProcess.substring(emrProcess.indexOf("西药治疗:") + 5);
  5175. }
  5176. var arr = xy.split("_");
  5177. if (arr != null && arr.length > 0) {
  5178. var xyhtml = "";
  5179. for (var i = 0; i < arr.length; i++) {
  5180. xyhtml += "<div>";
  5181. xyhtml += arr[i];
  5182. xyhtml += "</div>";
  5183. }
  5184. $("#prescriptionDetail_xyzlContent").html(xyhtml);
  5185. $("#prescriptionDetail_xyzlTitle").removeClass("hide").addClass("in");
  5186. } else {
  5187. $("#prescriptionDetail_xyzlTitle").removeClass("in").addClass("hide");
  5188. }
  5189. } else {
  5190. $("#prescriptionDetail_xyzlTitle").removeClass("in").addClass("hide");
  5191. }
  5192. var zy = null;
  5193. if (emrProcess.indexOf("中药治疗:") >= 0) {
  5194. if (emrProcess.indexOf("医技与诊疗:") >= 0) {
  5195. zy = emrProcess.substring(emrProcess.indexOf("中药治疗:") + 5, emrProcess.indexOf("医技与诊疗:"));
  5196. } else {
  5197. zy = emrProcess.substring(emrProcess.indexOf("中药治疗:") + 5);
  5198. }
  5199. var zyArr = zy.split("_");
  5200. if (zyArr != null && zyArr.length > 0) {
  5201. var zyhtml = "";
  5202. for (var i = 1; i < zyArr.length; i++) {
  5203. zyhtml += "<div>";
  5204. zyhtml += zyArr[i];
  5205. zyhtml += "</div>";
  5206. }
  5207. var zyfs = zyArr[0].substring(zyArr[0].indexOf("付数:") + 3);
  5208. if (zyfs != null && zyfs != "") {
  5209. zyhtml += " <div>";
  5210. zyhtml += ' <div style="text-indent: 2em;">';
  5211. zyhtml += ' <div>';
  5212. zyhtml += 'x<span>';
  5213. zyhtml += zyfs;
  5214. zyhtml += '</span> 付</div></div></div>';
  5215. }
  5216. $("#prescriptionDetail_zyzlContent").html(zyhtml);
  5217. $("#prescriptionDetail_zyzlTitle").removeClass("hide").addClass("in");
  5218. } else {
  5219. $("#prescriptionDetail_zyzlTitle").removeClass("in").addClass("hide");
  5220. }
  5221. } else {
  5222. $("#prescriptionDetail_zyzlTitle").removeClass("in").addClass("hide");
  5223. }
  5224. if (emrProcess.indexOf("医技与诊疗:") >= 0) {
  5225. var zlyj = emrProcess.substring(emrProcess.indexOf("医技与诊疗:") + 6);
  5226. var zlyjArr = zlyj.split("_");
  5227. if (zlyjArr != null && zlyjArr.length > 0) {
  5228. var zlyjhtml = "";
  5229. for (var i = 0; i < zlyjArr.length; i++) {
  5230. zlyjhtml += "<div>";
  5231. zlyjhtml += zlyjArr[i];
  5232. zlyjhtml += "</div>";
  5233. }
  5234. $("#prescriptionDetail_zlyjContent").html(zlyjhtml);
  5235. $("#prescriptionDetail_zlyjTitle").removeClass("hide").addClass("in");
  5236. } else {
  5237. $("#prescriptionDetail_zlyjTitle").removeClass("in").addClass("hide");
  5238. }
  5239. } else {
  5240. $("#prescriptionDetail_zlyjTitle").removeClass("in").addClass("hide");
  5241. }
  5242. }
  5243. if (type == 0) {
  5244. $("#printPrescription").removeClass("hide").addClass("in");
  5245. $("#callPrescription").removeClass("in").addClass("hide");
  5246. $("#printPrescription").off("click").on("click", function (t) {
  5247. alert("打印处方");
  5248. });
  5249. } else {
  5250. $("#printPrescription").removeClass("in").addClass("hide");
  5251. $("#callPrescription").removeClass("hide").addClass("in");
  5252. $("#callPrescription").off("click").on("click", function (t) {
  5253. getMzPrescriptionVoPaid(patientId, times, clnicId);
  5254. });
  5255. }
  5256. } else {
  5257. errorMesage(res);
  5258. }
  5259. }
  5260. });
  5261. }