deskPrescription.vue 199KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428
  1. <template>
  2. <div style="height: calc(100% - 58px);display: flex;flex-direction: column;margin-top: 56px;">
  3. <!-- <div style="border-top:1px solid #e5e5e5;margin-top:5px;">
  4. <div class="mainCell" style="margin-bottom:10px;float:right">
  5. <el-button size="small" @click="open(1)" type="primary" style="margin-left:10px;">保存</el-button>
  6. <el-button size="small" @click="open(2)" type="primary">打印</el-button>
  7. <el-button size="small" @click="open(4)" type="primary">选择模板</el-button>
  8. <el-button size="small" @click="open(5)" type="primary">存模板</el-button>
  9. </div>
  10. </div> -->
  11. <!-- <div class="backColor"></div> -->
  12. <div class="mainCenter" v-loading="loading">
  13. <div class="centerLeft">
  14. <div v-if="prescriptions[0].id >0 && (org_id == 10454) ">
  15. <el-button style="width: 100px" size="small" @click="callElePre(1)" type="primary">处方预核验</el-button>
  16. <el-button style="width: 100px" size="small" @click="callElePre(2)" type="primary">处方签名</el-button>
  17. <el-button style="width: 100px" size="small" @click="callElePre(3)" type="primary">处方上传</el-button>
  18. <el-button style="width: 100px" size="small" @click="callElePre(4)" type="primary">处方撤销</el-button>
  19. <el-button style="width: 100px" size="small" @click="callElePre(5)" type="primary">处方信息查询</el-button>
  20. <el-button style="width: 100px" size="small" @click="callElePre(6)" type="primary">处方审核结果查询
  21. </el-button>
  22. <el-button style="width: 100px" size="small" @click="callElePre(7)" type="primary">处方取药结果查询
  23. </el-button>
  24. <el-button style="width: 100px" size="small" @click="callElePre(8)" type="primary">药品在售查询</el-button>
  25. </div>
  26. <el-tabs v-model="dayorMonth" @tab-click="changeDayOrMonth">
  27. <el-tab-pane label="日结" name="day"></el-tab-pane>
  28. <el-tab-pane label="月结" name="month"></el-tab-pane>
  29. </el-tabs>
  30. <el-form :model="form" ref="form" label-width="80px"
  31. style="display: flex;flex-wrap: wrap;justify-content: space-between;">
  32. <el-form-item label="姓名:" prop="name" label-position="right">
  33. <el-input v-model="patientInfo.name" placeholder="" readonly></el-input>
  34. </el-form-item>
  35. <el-form-item label="证件号: " prop="name" label-position="right">
  36. <el-input v-model="patientInfo.id_card_no" placeholder="" readonly></el-input>
  37. </el-form-item>
  38. <!--<el-form-item label="处方类型: " prop="name" label-position="right">-->
  39. <!--<el-select style="width:100%;" v-model="register_type" placeholder="">-->
  40. <!--<el-option-->
  41. <!--v-for="(item,index) in register"-->
  42. <!--:key="index"-->
  43. <!--:label="item.label"-->
  44. <!--:value="item.value">-->
  45. <!--</el-option>-->
  46. <!--</el-select>-->
  47. <!--</el-form-item>-->
  48. <el-form-item label="疾病类型:" prop="name" label-position="right">
  49. <el-select filterable style="width:100%;" v-model="state1" placeholder="">
  50. <el-option
  51. v-for="(item,index) in sick"
  52. :key="index"
  53. :label="item.class_name"
  54. :value="item.id">
  55. </el-option>
  56. </el-select>
  57. </el-form-item>
  58. <el-form-item label="诊断:" prop="name" label-position="right" style="width:66.6%;" v-if="org_id != 10721 && org_id != 0">
  59. <el-select style="width:100%;" v-model="diagnose" placeholder="" multiple filterable>
  60. <el-option
  61. v-for="(item,index) in diagnoses"
  62. :key="index"
  63. :label="item.class_name"
  64. :value="item.id">
  65. </el-option>
  66. </el-select>
  67. </el-form-item>
  68. <el-form-item label="过敏病史: " prop="name" label-position="right">
  69. <el-autocomplete
  70. style="width:100%;"
  71. class="inline-input"
  72. v-model="state2"
  73. :fetch-suggestions="querySearch2"
  74. placeholder="请输入内容"
  75. ></el-autocomplete>
  76. </el-form-item>
  77. <el-form-item label="疾病诊断:" prop="name" label-position="right" style="width:66.6%;" v-if="org_id ==10485">
  78. <el-select style="width:100%;" v-model="patient_diagnose" placeholder="" multiple filterable>
  79. <el-option
  80. v-for="(item,index) in patient_diagnoses"
  81. :key="index"
  82. :label="item.class_name"
  83. :value="item.id">
  84. </el-option>
  85. </el-select>
  86. </el-form-item>
  87. </el-form>
  88. <div class="tabsBox">
  89. <!-- <el-button v-if="dayorMonth == 'day'" type="text" class="addTab" @click="addCharges"-->
  90. <!-- icon="el-icon-circle-plus">附加收费-->
  91. <!-- </el-button>-->
  92. <div class="RP" v-if="dayorMonth == 'month'">Rp
  93. <el-date-picker
  94. v-model="start_time"
  95. prefix-icon="el-icon-date"
  96. @change="changeTime"
  97. :editable="false"
  98. style="width: 150px;"
  99. type="date"
  100. placeholder="选择开始时间"
  101. align="right"
  102. format="yyyy-MM-dd"
  103. :picker-options="pickerBeginDateBefore"
  104. value-format="yyyy-MM-dd">
  105. </el-date-picker>
  106. <span class>-</span>
  107. <el-date-picker
  108. v-model="end_time"
  109. prefix-icon="el-icon-date"
  110. @change="changeEndTime"
  111. :editable="false"
  112. :picker-options="pickerBeginDateAfter"
  113. style="width: 150px;"
  114. type="date"
  115. placeholder="选择结束时间"
  116. align="right"
  117. format="yyyy-MM-dd"
  118. value-format="yyyy-MM-dd">
  119. </el-date-picker>
  120. </div>
  121. <el-tabs v-show="dayorMonth == 'day'" class="preTabs" v-model="editableTabsValue" type="border-card"
  122. closable
  123. @tab-remove="removeTab"
  124. :before-leave="moreState" @tab-click="tabclickEvent">
  125. <el-tab-pane
  126. v-for="(item, index) in prescriptions"
  127. :key="index"
  128. :label="item.name"
  129. :name="item.name"
  130. >
  131. <div class="RP">Rp
  132. <el-date-picker
  133. v-model="item.pre_time"
  134. type="datetime"
  135. :clearable="false"
  136. format="yyyy-MM-dd HH:mm"
  137. value-format="yyyy-MM-dd HH:mm"
  138. placeholder="选择日期">
  139. </el-date-picker>
  140. <el-select v-if="org_id != 10206 && org_id != 10721 && org_id != 0 && org_id != 10726" style="width:50%;" v-model="item.med_type" placeholder="医疗类型"
  141. @change="changevalue">
  142. <el-option
  143. v-for="(item,index) in register"
  144. :key="index"
  145. :label="item.label"
  146. :value="item.value">
  147. </el-option>
  148. </el-select>
  149. <!-- //针对海拉尔普爱肾病医院-->
  150. <el-select v-if="org_id == 10206" style="width:50%;" v-model="item.med_type" placeholder="医疗类型"
  151. @change="changevalue">
  152. <el-option
  153. v-for="(item,index) in register10206"
  154. :key="index"
  155. :label="item.label"
  156. :value="item.value">
  157. </el-option>
  158. </el-select>
  159. <el-select v-if="org_id == 10721 || org_id == 0" style="width:30%;" v-model="item.med_type" placeholder="医疗类型"
  160. @change="changevalue">
  161. <el-option
  162. v-for="(item,index) in register10721"
  163. :key="index"
  164. :label="item.label"
  165. :value="item.value">
  166. </el-option>
  167. </el-select>
  168. <el-select v-if="org_id == 10721 || org_id == 0" style="width:30%;" v-model="item.diagnose" multiple filterable placeholder="诊断">
  169. <el-option
  170. v-for="(item,index) in diagnoses"
  171. :key="index"
  172. :label="item.class_name"
  173. :value="item.id">
  174. </el-option>
  175. </el-select>
  176. <el-select v-if="org_id == 10726" style="width:30%;" v-model="item.med_type" placeholder="医疗类型"
  177. @change="changevalue">
  178. <el-option
  179. v-for="(item,index) in register10726"
  180. :key="index"
  181. :label="item.label"
  182. :value="item.value">
  183. </el-option>
  184. </el-select>
  185. <div style="float: right;margin-bottom:5px;margin-right:1%;">
  186. <el-button
  187. round
  188. size="small"
  189. @click="openLast(3)"
  190. >上一方
  191. </el-button>
  192. <el-button
  193. round
  194. size="small"
  195. @click="openNext(4)"
  196. >下一方
  197. </el-button>
  198. </div>
  199. </div>
  200. </el-tab-pane>
  201. <el-tab-pane name="more" closable v-if="dayorMonth == 'day'"><span slot="label"><i
  202. class="el-icon-plus"
  203. @click="addTab"></i></span>
  204. </el-tab-pane>
  205. <prescription-table v-if="dayorMonth == 'day'" ref="prescription_tables"
  206. :prescription="curPrescriptions"
  207. :preDrugs="preDrugs"
  208. :activeType="customTabIndex"
  209. v-on="$listeners"
  210. v-bind="$attrs"
  211. ></prescription-table>
  212. </el-tabs>
  213. <el-tabs v-show="dayorMonth == 'month'" class="preTabs" v-model="editableTabsValueTwo"
  214. type="border-card"
  215. :before-leave="moreState" @tab-click="monthTabclickEvent">
  216. <el-tab-pane
  217. v-for="(item, index) in month_prescriptions"
  218. :key="index"
  219. :label="item.name"
  220. :name="item.name"
  221. >
  222. </el-tab-pane>
  223. <month-prescription-table v-if="dayorMonth == 'month' && !isShowDayPrescription"
  224. ref="month_prescription_tables"
  225. :prescription="curMonthPrescriptions"
  226. :activeType="monthCustomTabIndex"></month-prescription-table>
  227. <day-prescription-table v-if="dayorMonth == 'month' && isShowDayPrescription"
  228. ref="month_prescription_tables" :prescription="curDayPrescriptions"
  229. :activeType="monthCustomTabIndex"></day-prescription-table>
  230. </el-tabs>
  231. </div>
  232. <div class="costBox">
  233. <div>
  234. <span><span style="color: red">*</span>医生:</span>
  235. <el-select style="margin-right:5px;width:140px;" v-model="doctorValue" placeholder=""
  236. @change="changeDoctor">
  237. <el-option
  238. v-for="(item,index) in doctors"
  239. :key="index"
  240. :label="item.user_name"
  241. :value="item.admin_user_id">
  242. </el-option>
  243. </el-select>
  244. <span> <span style="color: red">*</span>科室:</span>
  245. <el-select style="margin-right:5px;width:140px;" v-model="departmentValue" placeholder="">
  246. <el-option
  247. v-for="(item,index) in department"
  248. :key="index"
  249. :label="item.name"
  250. :value="item.id">
  251. </el-option>
  252. </el-select>
  253. <span>当前处方总价:</span>
  254. <span style="color:red;" v-if="dayorMonth == 'day'">{{ getTotalOne() ? getTotalOne() : '' }}元</span>
  255. <span style="color:red;" v-if="dayorMonth == 'month'">{{ getTotalTwo() ? getTotalTwo() : '' }}元</span>
  256. <span style="margin-left:10px;">总价:</span>
  257. <span style="color:red;" v-if="dayorMonth == 'day'">{{ getTotal() ? getTotal() : '' }}元</span>
  258. <span style="color:red;"
  259. v-if="dayorMonth == 'month'">{{ getMonthTotal() ? getMonthTotal() : '' }}元</span>
  260. </div>
  261. <span :class="!is_medicine_status ? 'statusRed' : ''">{{ is_medicine_status ? '已发药' : '未发药' }}</span>
  262. <span :class="order_status == '未收费' ? 'statusRed' : ''">{{ order_status }}</span>
  263. </div>
  264. </div>
  265. <div class='centerRight'>
  266. <!-- <div class="rightTab">
  267. <p :class="rightTab == 1 ? 'activeP' : ''" @click="clickTab(1)">药品</p>
  268. <p :class="rightTab == 2 ? 'activeP' : ''" @click="clickTab(2)">项目</p>
  269. </div> -->
  270. <el-tabs class="borderCard" type="border-card" v-model="rightTab" @tab-click="clickTab"
  271. :before-leave='beforeLeave'>
  272. <el-tab-pane label="药品" :name="1">
  273. </el-tab-pane>
  274. <el-tab-pane label="项目" :name="2">
  275. </el-tab-pane>
  276. <el-tab-pane label="项目组套" :name="3">
  277. </el-tab-pane>
  278. <div style="height:100%;" v-show="showOne">
  279. <el-tabs class="rightTabs" v-model="drug_activeName">
  280. <div style="margin-bottom:5px;display:flex;">
  281. <el-input style="width:50%;" @input="searchAction"
  282. @keyup.enter.native='searchAction'
  283. v-model.trim="search_keyword"
  284. placeholder="请输入药品名字" :clearable="true"></el-input>
  285. <el-select style="margin-left:5px;width:50%;" v-model="value" placeholder=""
  286. @change="changeKind">
  287. <el-option
  288. label="全部"
  289. value="0">
  290. </el-option>
  291. <el-option
  292. v-for="(item,index) in getDictionaryDataConfig('system','drug_type')"
  293. :key="index"
  294. :label="item.name"
  295. :value="item.id">
  296. </el-option>
  297. </el-select>
  298. </div>
  299. <div style="width: 100%;flex:1;overflow: hidden;" ref="rightTable">
  300. <el-table ref="multipleTable"
  301. :height="multipleTableHeight != '' ? multipleTableHeight : '700'"
  302. :data="drugs" border @select='selectDrugs'
  303. :row-style="{ color: '#303133' }"
  304. @select-all="changeAllGoodInfoTableData"
  305. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  306. highlight-current-row>
  307. <el-table-column type="selection" width="40" align="center"></el-table-column>
  308. <el-table-column label="名称" v-if="org_id != 10206">
  309. <template slot-scope="scope">{{ scope.row.drug_name }}</template>
  310. </el-table-column>
  311. <el-table-column label="名称" v-if="org_id == 10206">
  312. <template slot-scope="scope">{{ scope.row.drug_name }} {{ scope.row.number }}</template>
  313. </el-table-column>
  314. <el-table-column label="规格" width="60" v-if="org_id == 10206">
  315. <template slot-scope="scope">
  316. <span>{{ scope.row.drug_spec }}</span>
  317. </template>
  318. </el-table-column>
  319. <el-table-column label="规格" width="60" v-if="org_id != 10206">
  320. <template slot-scope="scope">
  321. <span
  322. v-if="scope.row.min_unit != scope.row.dose_unit">{{ scope.row.dose }}{{ scope.row.dose_unit }}&nbsp;* &nbsp;</span>{{
  323. scope.row.min_number
  324. }}{{ scope.row.min_unit }}/{{ scope.row.max_unit }}
  325. </template>
  326. </el-table-column>
  327. <el-table-column label="库存" width="60" v-if="org_id != 10206">
  328. <template slot-scope="scope">
  329. <!-- <span v-if="org_id == 9671 || org_id == 9675 || org_id == 4 || org_id == 10138 || org_id == 3877 || org_id == 10028 || org_id == 10243 || org_id == 10088 || org_id == 10245 || org_id == 9919 || org_id == 10106 || org_id == 9504 || org_id ==10215 || org_id == 10188 || org_id == 10265 || org_id == 10164 || org_id ==9956 || org_id == 10188 || org_id == 10191 || org_id == 10278 || org_id == 10217 || org_id ==10210 || org_id ==record_date ||org_id ==10340">
  330. <span v-if="scope.row.count/scope.row.min_number>0">{{Math.floor(scope.row.count/scope.row.min_number)}}{{scope.row.max_unit}}</span>
  331. <span v-if="scope.row.count%scope.row.min_number>0"> {{scope.row.count%scope.row.min_number}}{{scope.row.min_unit}}</span>
  332. </span>
  333. <span v-else> {{scope.row.total}}{{scope.row.total?scope.row.min_unit:''}}</span> -->
  334. <span
  335. v-if="scope.row.sum_count >0 && scope.row.max_unit!=scope.row.min_unit && scope.row.sum_count/scope.row.min_number >0">{{
  336. Math.floor(scope.row.sum_count / scope.row.min_number)
  337. }}{{ scope.row.max_unit }}</span>
  338. <span
  339. v-if="scope.row.sum_count >0 && scope.row.max_unit!=scope.row.min_unit && scope.row.sum_count%scope.row.min_number >0">{{
  340. Math.floor(scope.row.sum_count % scope.row.min_number)
  341. }}{{ scope.row.min_unit }}</span>
  342. <span
  343. v-if="scope.row.sum_count >0 && scope.row.max_unit == scope.row.min_unit">{{
  344. scope.row.sum_count
  345. }}{{ scope.row.max_unit }}</span>
  346. </template>
  347. </el-table-column>
  348. <!-- //针对对接坐标系统的,使用坐标的库存数据-->
  349. <el-table-column label="库存" width="60" v-if="org_id == 10206">
  350. <template slot-scope="scope">
  351. <span>{{ scope.row.zuobiao_stock_num }}</span>
  352. </template>
  353. </el-table-column>
  354. <el-table-column label="单价" width="40">
  355. <template slot-scope="scope">{{ scope.row.min_price }}</template>
  356. </el-table-column>
  357. </el-table>
  358. <!-- <div>{{3*(2/3)}}</div> -->
  359. </div>
  360. <!--<el-tab-pane label="医嘱模板" name="2">-->
  361. <!--<div style="margin-bottom:5px;">-->
  362. <!--&lt;!&ndash;<el-input style="width:50%;" v-model="input" placeholder=""></el-input>&ndash;&gt;-->
  363. <!--<el-select style="float: right;width: 49%;" v-model="value" placeholder="">-->
  364. <!--<el-option-->
  365. <!--v-for="item in options"-->
  366. <!--:key="item.value"-->
  367. <!--:label="item.label"-->
  368. <!--:value="item.value">-->
  369. <!--</el-option>-->
  370. <!--</el-select>-->
  371. <!--</div>-->
  372. <!--<div style="width: 100%;flex:1;overflow-y: auto;">-->
  373. <!--<el-table ref="multipleTableTwo" :height="multipleTableHeight != '' ? multipleTableHeight : '200'"-->
  374. <!--:data="advices_template" border-->
  375. <!--:row-style="{ color: '#303133' }"-->
  376. <!--:header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"-->
  377. <!--highlight-current-row-->
  378. <!--@select='selectTemplate'-->
  379. <!--@select-all="changeTemplateData"-->
  380. <!--&gt;-->
  381. <!--<el-table-column type="selection" width="40" align="center"></el-table-column>-->
  382. <!--<el-table-column prop="name" label="名称">-->
  383. <!--<template slot-scope="scope">{{scope.row.name}}</template>-->
  384. <!--</el-table-column>-->
  385. <!--&lt;!&ndash;<el-table-column label="规格" width="60">&ndash;&gt;-->
  386. <!--&lt;!&ndash;<template slot-scope="scope">33</template>&ndash;&gt;-->
  387. <!--&lt;!&ndash;</el-table-column>&ndash;&gt;-->
  388. <!--&lt;!&ndash;<el-table-column label="库存" width="60">&ndash;&gt;-->
  389. <!--&lt;!&ndash;<template slot-scope="scope">22</template>&ndash;&gt;-->
  390. <!--&lt;!&ndash;</el-table-column>&ndash;&gt;-->
  391. <!--&lt;!&ndash;<el-table-column label="单价" width="40">&ndash;&gt;-->
  392. <!--&lt;!&ndash;<template slot-scope="scope">12</template>&ndash;&gt;-->
  393. <!--&lt;!&ndash;</el-table-column>&ndash;&gt;-->
  394. <!--</el-table>-->
  395. <!--</div>-->
  396. <!--</el-tab-pane>-->
  397. </el-tabs>
  398. </div>
  399. <div style="height:100%;" v-show="showTwo">
  400. <el-tabs class="rightTabs" v-model="activeName">
  401. <div style="margin-bottom:5px;">
  402. <!--<el-input style="width:50%;" v-model="input" placeholder=""></el-input>-->
  403. <el-input style="width:50%;" @input="searchProjectAction"
  404. @keyup.enter.native='searchProjectAction'
  405. v-model.trim="search_project_keyword"
  406. placeholder="请输入项目名称" :clearable="true"></el-input>
  407. <el-select style="float: right;width: 49%;" v-model="value" placeholder=""
  408. @change="changeClass">
  409. <el-option
  410. label="全部"
  411. value="0">
  412. </el-option>
  413. <el-option
  414. v-for="(item, index) in getDictionaryDataConfig('system','cost_classify')"
  415. :key="index"
  416. :label="item.name"
  417. :value="item.id">
  418. </el-option>
  419. </el-select>
  420. </div>
  421. <div style="width: 100%;flex:1;overflow-y: auto;">
  422. <el-table ref="tables"
  423. :height="multipleTableHeight != '' ? multipleTableHeight : '700'"
  424. :data="tabProject" border @select='selectChange'
  425. :row-style="{ color: '#303133' }"
  426. @select-all="changeAllGoodInfoTableDataTwo"
  427. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  428. highlight-current-row>
  429. <el-table-column type="selection" width="40" align="center"></el-table-column>
  430. <el-table-column prop="name" label="名称" v-if="org_id != 10206 && org_id != 0">
  431. <template slot-scope="scope">{{ scope.row.project_name }}</template>
  432. </el-table-column>
  433. <el-table-column prop="name" label="名称" v-if="org_id == 10206 || org_id == 0">
  434. <template slot-scope="scope">{{ scope.row.project_name }}{{ scope.row.number }}</template>
  435. </el-table-column>
  436. <el-table-column label="规格" width="60">
  437. <template slot-scope="scope">{{ scope.row.single_dose }}</template>
  438. </el-table-column>
  439. <el-table-column label="库存" width="40">
  440. <template slot-scope="scope">
  441. <!-- <span v-if="org_id == 9671 || org_id == 9675 || org_id == 4 || org_id == 10138 || org_id == 3877 || org_id == 10028 || org_id == 10243 || org_id == 10088 || org_id == 10245 || org_id == 9919 || org_id == 10106 || org_id == 9504 || org_id ==10215 || org_id == 10188 || org_id == 10265 || org_id == 10164 || org_id == 9956 || org_id == 10188 || org_id == 10191 || org_id == 10278 || org_id == 10217 || org_id ==10210 || org_id ==10318 || org_id ==10340">
  442. {{scope.row.stock_count}}
  443. </span>
  444. <span v-else> {{ scope.row.total }}</span> -->
  445. <span
  446. v-if="org_id != 10206 && scope.row.type == 3 && scope.row.good_info.sum_count > 0">{{
  447. scope.row.good_info.sum_count
  448. }}</span>
  449. <!-- //针对坐标系统的库存数据-->
  450. <span v-if="org_id == 10206 && scope.row.type == 3">{{ scope.row.zuobiao_stock_num }}</span>
  451. </template>
  452. </el-table-column>
  453. <el-table-column label="单价" width="40">
  454. <template slot-scope="scope">{{ scope.row.price }}</template>
  455. </el-table-column>
  456. </el-table>
  457. </div>
  458. </el-tabs>
  459. </div>
  460. <div style="height:100%;" v-show="showThree">
  461. <el-tabs class="rightTabs" v-model="activeName_two">
  462. <el-input style="width:50%;" @input="searchProjectTeamAction"
  463. @keyup.enter.native='searchProjectTeamAction'
  464. v-model.trim="search_project_team_keyword"
  465. placeholder="请输入项目组套名称" :clearable="true"></el-input>
  466. <div style="width: 100%;flex:1;overflow-y: auto;">
  467. <el-table :data="tabPrjectTeam" border ref="tabProjectTeam"
  468. :height="multipleTableHeight != '' ? multipleTableHeight : '700'"
  469. :row-style="{ color: '#303133' }"
  470. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  471. highlight-current-row
  472. @select='selectTeam'>
  473. <el-table-column type="selection" width="40" align="center"></el-table-column>
  474. <el-table-column prop="name" label="名称">
  475. <template slot-scope="scope">{{ scope.row.project_team }}</template>
  476. </el-table-column>
  477. </el-table>
  478. </div>
  479. </el-tabs>
  480. </div>
  481. </el-tabs>
  482. <template>
  483. <div class="comfirmBox">
  484. <!-- <div>
  485. <span>药品类型:</span>
  486. <el-select style="margin-right:5px;width:100px;" v-model="value" placeholder="" @change="changeKind">
  487. <el-option
  488. label="全部"
  489. value="0">
  490. </el-option>
  491. <el-option
  492. v-for="(item,index) in getDictionaryDataConfig('system','drug_type')"
  493. :key="index"
  494. :label="item.name"
  495. :value="item.id">
  496. </el-option>
  497. </el-select>
  498. </div> -->
  499. <el-button type="primary" style="width:100%;" @click="comfirm">确定添加</el-button>
  500. </div>
  501. </template>
  502. </div>
  503. </div>
  504. <additionalCharges v-on:setData="setCharge" ref='additionalCharges' :hisPatientInfo="hisPatientInfo"
  505. :patientInfo="patientInfo" :additions="additions"></additionalCharges>
  506. <select-template ref='selectTemplate'></select-template>
  507. <save-template ref='saveTemplate' v-on:save_template="saveTemplate"></save-template>
  508. <next-or-last-prescription ref='next_or_last_prescription' v-on:save="setValue"
  509. v-on:cancel="cancel"></next-or-last-prescription>
  510. <!--<next-or-last-prescription ref='next_or_last_prescription' v-on:save="setValue" v-on:cancel="cancel"></next-or-last-prescription>-->
  511. <call-prescription ref='call_prescription' v-on:call="call" v-on:call-cancel="callCancel"></call-prescription>
  512. <el-dialog title="提醒" :visible.sync="dialogTableVisible">
  513. <el-table :data="err_msg">
  514. <el-table-column label="提示" width="150"></el-table-column>
  515. </el-table>
  516. </el-dialog>
  517. </div>
  518. </template>
  519. <script>
  520. import MonthPrescriptionTable from '../../outpatientCharges/components/monthPrescriptionTable'
  521. import {
  522. createdTemplate,
  523. createHisPrescription,
  524. delHisPrescription,
  525. editHisPrescription,
  526. getCallHisPrescription,
  527. getDayOrMonthHisPrescription,
  528. getNextOrLastHisPrescription
  529. } from '@/api/his/his'
  530. import { getDictionaryDataConfig } from '@/utils/data'
  531. import prescriptionTable from './prescriptionTable'
  532. import selectTemplate from './selectTemplate'
  533. import saveTemplate from './saveTemplate'
  534. import additionalCharges from './additionalCharges'
  535. import { getAllProjectList, getAllProjectTeam, getHisProject, getPojectListById } from '@/api/project/project'
  536. import { uParseTime } from '@/utils/tools'
  537. import NextOrLastPrescription from './nextOrLastPrescription'
  538. import CallPrescription from './callPrescription'
  539. import DayPrescriptionTable from '../../outpatientCharges/components/dayPrescriptionTable'
  540. import axios from 'axios'
  541. const moment = require('moment')
  542. export default {
  543. props: {
  544. drugs: Array,
  545. allDrugs: Array,
  546. advices_template: Array,
  547. doctors: Array,
  548. department: Array,
  549. sick: Array,
  550. diagnoses: Array,
  551. additions: Array,
  552. patientInfo: Object,
  553. hisPatientInfo: Object,
  554. prescriptions: Array,
  555. record_date: String,
  556. search_keyword: '',
  557. month_prescriptions: Array,
  558. org_id: Number,
  559. isloading: false,
  560. loading: false,
  561. other_sick: {
  562. type: Array,
  563. default: function() {
  564. return []
  565. }
  566. },
  567. patient_diagnoses: Array
  568. },
  569. components: {
  570. DayPrescriptionTable,
  571. MonthPrescriptionTable,
  572. CallPrescription,
  573. NextOrLastPrescription,
  574. selectTemplate,
  575. saveTemplate,
  576. prescriptionTable,
  577. additionalCharges
  578. },
  579. data() {
  580. return {
  581. dialogTableVisible:false,
  582. drugs: [],
  583. err_msg:[],
  584. zuobiao_drug: [],
  585. zuobiao_project: [],
  586. start_time: moment(new Date()).subtract(30, 'days').format('YYYY-MM-DD'),
  587. end_time: moment(new Date()).add('year', 0).format('YYYY-MM-DD'),
  588. register10206: [
  589. { value: 1, label: '普通' },
  590. { value: 2, label: '急诊' },
  591. { value: 5, label: '第一类精神药品' },
  592. { value: 6, label: '第二类精神药品' },
  593. { value: 7, label: '放射药品' },
  594. { value: 8, label: '毒性药品' },
  595. { value: 9, label: '检查' },
  596. { value: 10, label: '检验' },
  597. { value: 12, label: '治疗' },
  598. { value: 99, label: '其他' }
  599. ],
  600. register: [
  601. { value: 11, label: '普通门诊' },
  602. { value: 12, label: '门诊挂号' },
  603. { value: 1102, label: '新冠门诊' },
  604. { value: 14, label: '门诊特殊病' },
  605. { value: 9922, label: '家庭通道' },
  606. { value: 9933, label: '门诊特殊病(9933)' },
  607. { value: 990602, label: '门诊特殊病(990602)' },
  608. { value: 140201, label: '门诊特病(140201)' },
  609. { value: 992102, label: '单病种(992102)' },
  610. { value: 140104, label: '城乡门诊特殊病(140104)' },
  611. { value: 1402, label: '门诊特殊病(1402)' },
  612. { value: 1401, label: '门诊慢特病(1401)' },
  613. { value: 2302, label: '异地就医(2302)' },
  614. { value: 1111, label: '精一' },
  615. { value: 1112, label: '精二' },
  616. { value: 999999, label: '自费' },
  617. { value: 118801, label: '118801' }
  618. ],
  619. register10721: [
  620. { value: 11, label: '普通门诊' },
  621. { value: 14, label: '门诊特殊病' },
  622. { value: 992102, label: '透析(992102)' },
  623. { value: 140104, label: '门诊慢病(140104)' },
  624. { value: 140201, label: '门诊特病(140201)' },
  625. { value: 1111, label: '精一' },
  626. { value: 1112, label: '精二' },
  627. ],
  628. register10726: [
  629. { value: 11, label: '普通门诊' },
  630. { value: 14, label: '门诊特殊病' },
  631. { value: 990101, label: '单病种(990101)' },
  632. { value: 1111, label: '精一' },
  633. { value: 1112, label: '精二' },
  634. ],
  635. medical_care: [
  636. { value: 11, label: '普通门诊' },
  637. { value: 1102, label: '新冠门诊' },
  638. { value: 992102, label: '单病种(992102)' },
  639. { value: 140104, label: '城乡门诊特殊病(140104)' },
  640. { value: 12, label: '家庭通道' },
  641. { value: 13, label: '门诊大病' },
  642. { value: 14, label: '重疾特药' },
  643. { value: 15, label: '门诊慢病' },
  644. { value: 16, label: '门诊特检' },
  645. { value: 17, label: '健康体检' },
  646. { value: 18, label: '预防接种' },
  647. { value: 19, label: '门诊输血' },
  648. { value: 91, label: '新冠肺炎门诊' },
  649. { value: 1111, label: '精一' },
  650. { value: 1112, label: '精二' },
  651. { value: 118801, label: '118801' }
  652. ],
  653. isLastOrNextVisible: false,
  654. multipleTableHeight: '',
  655. register_type: '',
  656. value: '0',
  657. search_project_keyword: '',
  658. search_project_team_keyword: '',
  659. form: {
  660. name: ''
  661. },
  662. allDrugs: [],
  663. advices_template: [],
  664. additions: [],
  665. editableTabsValueTwo: '处方1',
  666. editableTabsValue: '处方1',
  667. editableTabs: [{
  668. title: '处方1',
  669. name: '1'
  670. }],
  671. tabIndex: this.prescriptions.length,
  672. curDayPrescriptions: null,
  673. dayPrescriptions: [],
  674. currenet_inedx: 0,
  675. rightTab: 1,
  676. activeName: '1',
  677. activeName_two:'3',
  678. drug_activeName: '1',
  679. curPrescriptions: null,
  680. curMonthPrescriptions: this.month_prescriptions[0],
  681. drugTableData: [],
  682. preDrugs: [],
  683. curDrugs: [],
  684. doctorOptions: [],
  685. doctorValue: '',
  686. departmentOptions: [],
  687. departmentValue: '',
  688. total: 0,
  689. request_record_date: '',
  690. state2: '',
  691. customTabIndex: 1,
  692. options: [],
  693. tabProject: [],
  694. allProject: [],
  695. strids: '',
  696. showOne: true,
  697. showTwo: false,
  698. showThree:false,
  699. tableData: [],
  700. tabPrjectTeam: [],
  701. allTabPrjectTeam: [],
  702. teamList: [],
  703. doctors: [],
  704. departMent: [],
  705. curStatus: 0,
  706. isShowDayPrescription: false,
  707. monthCustomTabIndex: 1,
  708. order_status: '',
  709. is_medicine_status: false,
  710. register_types: [
  711. { id: 1, name: '医保' },
  712. { id: 2, name: '自费' }
  713. ],
  714. pickerOptions: {
  715. disabledDate(time) {
  716. let threeMonths = new Date(new Date().setFullYear(new Date().getFullYear() - 1)).getTime() - 24 * 3600 * 1000
  717. return time.getTime() > Date.now() || time.getTime() < threeMonths
  718. }
  719. },
  720. department: [],
  721. sick: [],
  722. diagnoses: [],
  723. diagnose: [],
  724. patient_diagnose: [],
  725. patient_diagnose_list: [],
  726. state1: '',
  727. curTotal: 0,
  728. prescription_id: 0,
  729. tempDrugs: [],
  730. dayorMonth: 'day',
  731. pickerBeginDateBefore: {
  732. disabledDate: (time) => {
  733. let beginDateVal = this.end_time
  734. if (beginDateVal) {
  735. return time.getTime() > new Date(beginDateVal).getTime()
  736. }
  737. }
  738. },
  739. pickerBeginDateAfter: {
  740. disabledDate: (time) => {
  741. let beginDateVal = this.start_time
  742. if (beginDateVal) {
  743. return time.getTime() <= new Date(beginDateVal).getTime()
  744. }
  745. }
  746. },
  747. hisList: [],
  748. patient_diagnose: []
  749. }
  750. },
  751. methods: {
  752. getZuobiaoGoodStock() {
  753. var that = this
  754. axios.get('http://127.0.0.1:9532' + '/nmg/coordinate/querystockgood', {})
  755. .then(function(response) {
  756. if (response.data.state == 0) {
  757. that.$message.error(response.data.msg)
  758. that.loadingtwo = false
  759. return false
  760. } else {
  761. if (response.data.data.failed_code == -10) {
  762. that.$confirm(response.data.data.msg, '医保错误信息', {
  763. confirmButtonText: '确 定',
  764. type: 'warning'
  765. }).then(() => {
  766. }).catch(() => {
  767. })
  768. } else {
  769. that.zuobiao_project = response.data.data.project
  770. for (let i = 0; i < that.zuobiao_project.length; i++) {
  771. for (let b = 0; b < that.tabProject.length; b++) {
  772. if (that.zuobiao_project[i].bbx01 == that.tabProject[b].bbx01 && that.zuobiao_project[i].bby01 == that.tabProject[b].bby01) {
  773. console.log(that.zuobiao_project[i].lsqty)
  774. console.log(that.tabProject[b].zuobiao_stock_num)
  775. that.tabProject[b].zuobiao_stock_num = that.zuobiao_project[i].lsqty
  776. that.tabProject[b].price = that.zuobiao_project[i].price
  777. }
  778. }
  779. }
  780. that.$forceUpdate()
  781. }
  782. }
  783. })
  784. .catch(function(error) {
  785. })
  786. },
  787. getZuobiaoDrugStock() {
  788. var that = this
  789. axios.get('http://127.0.0.1:9532' + '/nmg/coordinate/querystockdrug', {})
  790. .then(function(response) {
  791. if (response.data.state == 0) {
  792. that.$message.error(response.data.msg)
  793. that.loadingtwo = false
  794. return false
  795. } else {
  796. if (response.data.data.failed_code == -10) {
  797. that.$confirm(response.data.data.msg, '医保错误信息', {
  798. confirmButtonText: '确 定',
  799. type: 'warning'
  800. }).then(() => {
  801. }).catch(() => {
  802. })
  803. } else {
  804. that.zuobiao_drug = response.data.data.drug
  805. // that.zuobiao_project = response.data.data.project
  806. //跟坐标数据进行匹配,如果bbx01相等的话则,替换库存数量
  807. for (let i = 0; i < that.zuobiao_drug.length; i++) {
  808. for (let b = 0; b < that.drugs.length; b++) {
  809. if (that.zuobiao_drug[i].bby01 == that.drugs[b].bby01) {
  810. that.drugs[b]['zuobiao_stock_num'] = that.zuobiao_drug[i].sysl
  811. that.drugs[b].min_price = that.zuobiao_drug[i].lsj
  812. }
  813. }
  814. }
  815. that.$forceUpdate()
  816. }
  817. }
  818. })
  819. .catch(function(error) {
  820. })
  821. },
  822. getzuobiao() {
  823. if (this.org_id == 10206) {
  824. var that = this
  825. axios.get('http://127.0.0.1:9532' + '/nmg/coordinate/querystockgood', {})
  826. .then(function(response) {
  827. if (response.data.state == 0) {
  828. that.$message.error(response.data.msg)
  829. that.loadingtwo = false
  830. return false
  831. } else {
  832. if (response.data.data.failed_code == -10) {
  833. that.$confirm(response.data.data.msg, '医保错误信息', {
  834. confirmButtonText: '确 定',
  835. type: 'warning'
  836. }).then(() => {
  837. }).catch(() => {
  838. })
  839. } else {
  840. // that.zuobiao_drug = response.data.data.drug
  841. that.zuobiao_project = response.data.data.project
  842. }
  843. }
  844. })
  845. .catch(function(error) {
  846. })
  847. }
  848. },
  849. changeClass(id) {
  850. this.tabProject = []
  851. if (id == 0) {
  852. this.tabProject = this.allProject
  853. } else {
  854. for (let i = 0; i < this.allProject.length; i++) {
  855. if (this.allProject[i].project.cost_classify == id) {
  856. this.tabProject.push(this.allProject[i])
  857. }
  858. }
  859. }
  860. },
  861. setMonthPrescription(month_prescriptions) {
  862. this.month_prescriptions = []
  863. let drug_month_prescriptions = {
  864. advices: []
  865. }
  866. let drug_ids = []
  867. let project_month_prescriptions = {
  868. project: []
  869. }
  870. let project_ids = []
  871. let addition_month_prescriptions = {
  872. addition: []
  873. }
  874. let additions_ids = []
  875. for (let i = 0; i < month_prescriptions.length; i++) {
  876. if (month_prescriptions[i].type == 1) { //药品
  877. for (let a = 0; a < month_prescriptions[i].advices.length; a++) {
  878. let obj = {
  879. id: month_prescriptions[i].advices[a].drug_id,
  880. price: month_prescriptions[i].advices[a].price
  881. }
  882. drug_ids.push(obj)
  883. drug_month_prescriptions.advices.push(month_prescriptions[i].advices[a])
  884. }
  885. } else if (month_prescriptions[i].type == 2) { //项目
  886. for (let a = 0; a < month_prescriptions[i].project.length; a++) {
  887. let obj = {
  888. id: month_prescriptions[i].project[a].project_id,
  889. price: month_prescriptions[i].project[a].price
  890. }
  891. project_ids.push(obj)
  892. project_month_prescriptions.project.push(month_prescriptions[i].project[a])
  893. }
  894. }
  895. //附加收费
  896. // for (let a = 0; a < month_prescriptions[i].addition.length; a++) {
  897. // let obj = {
  898. // id: month_prescriptions[i].addition[a].item_id,
  899. // price: month_prescriptions[i].addition[a].price
  900. //
  901. // }
  902. // additions_ids.push(obj)
  903. // addition_month_prescriptions.addition.push(month_prescriptions[i].addition[a])
  904. //
  905. // }
  906. }
  907. const obj = {}
  908. const obj1 = {}
  909. const obj2 = {}
  910. drug_ids = drug_ids.reduce((cur, next) => {
  911. obj[next.price] ? '' : obj[next.price] = true && cur.push(next)
  912. return cur
  913. }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  914. project_ids = project_ids.reduce((cur, next) => {
  915. obj1[next.price] ? '' : obj1[next.price] = true && cur.push(next)
  916. return cur
  917. }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  918. additions_ids = additions_ids.reduce((cur, next) => {
  919. obj2[next.price] ? '' : obj2[next.price] = true && cur.push(next)
  920. return cur
  921. }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  922. let drugs = []
  923. let projects = []
  924. let additions = []
  925. for (let i = 0; i < drug_ids.length; i++) {
  926. let obj = {}
  927. let count = 0
  928. for (let a = 0; a < drug_month_prescriptions.advices.length; a++) {
  929. if (drug_ids[i].price == drug_month_prescriptions.advices[a].price) {
  930. obj['drug_name'] = drug_month_prescriptions.advices[a].advice_name
  931. obj['single_dose'] = drug_month_prescriptions.advices[a].single_dose
  932. obj['delivery_way'] = drug_month_prescriptions.advices[a].delivery_way
  933. obj['execution_frequency'] = drug_month_prescriptions.advices[a].execution_frequency
  934. obj['day'] = drug_month_prescriptions.advices[a].day
  935. // obj['prescribing_number'] = obj['prescribing_number'] + drug_month_prescriptions.advices[a].prescribing_number
  936. obj['prescribing_number_unit'] = drug_month_prescriptions.advices[a].prescribing_number_unit
  937. obj['medical_insurance_number'] = drug_month_prescriptions.advices[a].drug.medical_insurance_number
  938. obj['id'] = drug_month_prescriptions.advices[a].drug_id
  939. // obj['single_dose_unit'] = drug_month_prescriptions.advices[a].single_dose_unit
  940. obj['single_dose_unit'] = drug_month_prescriptions.advices[a].drug.dose_unit
  941. // obj['retail_price'] = obj['retail_price'] + drug_month_prescriptions.advices[a].drug.retail_price
  942. obj['retail_price'] = parseFloat(drug_month_prescriptions.advices[a].price)
  943. obj['drug'] = drug_month_prescriptions.advices[a].drug
  944. count = count + drug_month_prescriptions.advices[a].prescribing_number
  945. }
  946. }
  947. obj['prescribing_number'] = count
  948. drugs.push(obj)
  949. }
  950. for (let i = 0; i < project_ids.length; i++) {
  951. let obj = {}
  952. let count = 0
  953. for (let a = 0; a < project_month_prescriptions.project.length; a++) {
  954. if (project_ids[i].price == project_month_prescriptions.project[a].price) {
  955. if (project_month_prescriptions.project[a].type == 2) {
  956. obj['statistical_classification'] = ''
  957. obj['medical_code'] = project_month_prescriptions.project[a].project.medical_code
  958. obj['project_name'] = project_month_prescriptions.project[a].project.project_name
  959. obj['project'] = project_month_prescriptions.project[a].project
  960. } else if (project_month_prescriptions.project[a].type == 3) {
  961. obj['statistical_classification'] = ''
  962. obj['medical_code'] = project_month_prescriptions.project[a].good_info.medical_insurance_number
  963. obj['project_name'] = project_month_prescriptions.project[a].good_info.good_name
  964. obj['good_info'] = project_month_prescriptions.project[a].good_info
  965. }
  966. // obj['project_name'] = project_month_prescriptions.project[a].project.project_name;
  967. // obj['statistical_classification'] = project_month_prescriptions.project[a].project.statistical_classification;
  968. obj['single_dose'] = project_month_prescriptions.project[a].single_dose
  969. obj['delivery_way'] = project_month_prescriptions.project[a].delivery_way
  970. obj['execution_frequency'] = project_month_prescriptions.project[a].execution_frequency
  971. obj['number_days'] = project_month_prescriptions.project[a].day
  972. // obj['medical_code'] = project_month_prescriptions.project[a].project.medical_code;
  973. obj['unit'] = project_month_prescriptions.project[a].unit
  974. obj['project_id'] = project_month_prescriptions.project[a].project_id
  975. count = count + parseFloat(project_month_prescriptions.project[a].count)
  976. // price = price + project_month_prescriptions.project[a].price
  977. obj['price'] = parseFloat(project_month_prescriptions.project[a].price)
  978. }
  979. }
  980. obj['total'] = count
  981. projects.push(obj)
  982. }
  983. for (let i = 0; i < additions_ids.length; i++) {
  984. let obj = {}
  985. let count = 0
  986. if (addition_month_prescriptions.addition) {
  987. for (let a = 0; a < addition_month_prescriptions.addition.length; a++) {
  988. if (additions_ids[i].price == addition_month_prescriptions.addition[a].price) {
  989. obj['item_name'] = addition_month_prescriptions.addition[a].item_name
  990. obj['id'] = addition_month_prescriptions.addition[a].id
  991. obj['item_id'] = addition_month_prescriptions.addition[a].item_id
  992. count = count + addition_month_prescriptions.addition[a].count
  993. obj['price'] = parseFloat(addition_month_prescriptions.addition[a].price)
  994. }
  995. }
  996. obj['count'] = count
  997. additions.push(obj)
  998. }
  999. }
  1000. let p1 = {
  1001. name: '处方' + 1,
  1002. advices: drugs,
  1003. project: [],
  1004. type: 1,
  1005. addition: additions
  1006. }
  1007. let p2 = {
  1008. name: '处方' + 2,
  1009. type: 2,
  1010. project: projects,
  1011. advices: [],
  1012. addition: []
  1013. }
  1014. this.month_prescriptions.push(p1)
  1015. this.month_prescriptions.push(p2)
  1016. this.curMonthPrescriptions = this.month_prescriptions[0]
  1017. },
  1018. // setMonthPrescription(month_prescriptions) {
  1019. // let drug_month_prescriptions = {
  1020. // advices: [],
  1021. // }
  1022. // let drug_ids = []
  1023. // let project_month_prescriptions = {
  1024. // project: [],
  1025. //
  1026. // }
  1027. // let project_ids = []
  1028. //
  1029. // let addition_month_prescriptions = {
  1030. // addtions: [],
  1031. //
  1032. // }
  1033. // let additions_ids = []
  1034. //
  1035. //
  1036. // for (let i = 0; i < month_prescriptions.length; i++) {
  1037. // if (month_prescriptions[i].type == 1) { //药品
  1038. // for (let a = 0; a < month_prescriptions[i].advices.length; a++) {
  1039. // drug_ids.push(month_prescriptions[i].advices[a].drug_id)
  1040. // drug_month_prescriptions.advices.push(month_prescriptions[i].advices[a])
  1041. // }
  1042. //
  1043. // } else if (month_prescriptions[i].type == 2) { //项目
  1044. // for (let a = 0; a < month_prescriptions[i].project.length; a++) {
  1045. // project_ids.push(month_prescriptions[i].project[a].project_id)
  1046. // project_month_prescriptions.project.push(month_prescriptions[i].project[a])
  1047. // }
  1048. // }
  1049. // //附加收费
  1050. // for (let a = 0; a < month_prescriptions[i].addition.length; a++) {
  1051. // additions_ids.push(month_prescriptions[i].addition[a].item_id)
  1052. // addition_month_prescriptions.addtions.push(month_prescriptions[i].addition[a])
  1053. // }
  1054. //
  1055. // }
  1056. //
  1057. // console.log(drug_ids)
  1058. // console.log(drug_month_prescriptions)
  1059. // console.log(project_ids)
  1060. // console.log(project_month_prescriptions)
  1061. // console.log(additions_ids)
  1062. // console.log(addition_month_prescriptions)
  1063. //
  1064. //
  1065. // const obj = {}
  1066. // const obj1 = {}
  1067. // const obj2 = {}
  1068. //
  1069. // drug_ids = drug_ids.reduce((cur, next) => {
  1070. // obj[next] ? '' : obj[next] = true && cur.push(next)
  1071. // return cur
  1072. // }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  1073. // project_ids = project_ids.reduce((cur, next) => {
  1074. // obj1[next] ? '' : obj1[next] = true && cur.push(next)
  1075. // return cur
  1076. // }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  1077. // additions_ids = additions_ids.reduce((cur, next) => {
  1078. // obj2[next] ? '' : obj2[next] = true && cur.push(next)
  1079. // return cur
  1080. // }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  1081. //
  1082. //
  1083. // console.log(drug_ids)
  1084. // console.log(project_ids)
  1085. // console.log(additions_ids)
  1086. //
  1087. //
  1088. // let drugs = []
  1089. // let projects = []
  1090. // let additions = []
  1091. //
  1092. //
  1093. // for (let i = 0; i < drug_ids.length; i++) {
  1094. // let obj = {}
  1095. // let price = 0
  1096. // let count = 0
  1097. // for (let a = 0; a < drug_month_prescriptions.advices.length; a++) {
  1098. // if (drug_ids[i] == drug_month_prescriptions.advices[a].drug_id) {
  1099. // obj['drug_name'] = drug_month_prescriptions.advices[a].advice_name
  1100. // obj['single_dose'] = drug_month_prescriptions.advices[a].single_dose
  1101. // obj['delivery_way'] = drug_month_prescriptions.advices[a].delivery_way
  1102. // obj['execution_frequency'] = drug_month_prescriptions.advices[a].execution_frequency
  1103. // obj['day'] = drug_month_prescriptions.advices[a].day
  1104. // // obj['prescribing_number'] = obj['prescribing_number'] + drug_month_prescriptions.advices[a].prescribing_number
  1105. // obj['prescribing_number_unit'] = drug_month_prescriptions.advices[a].prescribing_number_unit
  1106. // obj['medical_insurance_number'] = drug_month_prescriptions.advices[a].drug.medical_insurance_number
  1107. // obj['id'] = drug_month_prescriptions.advices[a].drug_id
  1108. // // obj['retail_price'] = obj['retail_price'] + drug_month_prescriptions.advices[a].drug.retail_price
  1109. //
  1110. //
  1111. // count = count + drug_month_prescriptions.advices[a].prescribing_number
  1112. // price = price + drug_month_prescriptions.advices[a].price
  1113. //
  1114. // }
  1115. // }
  1116. // obj['retail_price'] =this.formatDecimal(price,2)
  1117. // obj['prescribing_number'] = count
  1118. // drugs.push(obj)
  1119. // }
  1120. //
  1121. //
  1122. // for (let i = 0; i < project_ids.length; i++) {
  1123. // let obj = {}
  1124. // let price = 0
  1125. // let count = 0
  1126. // for (let a = 0; a < project_month_prescriptions.project.length; a++) {
  1127. // if (project_ids[i] == project_month_prescriptions.project[a].project_id) {
  1128. // obj['project_name'] = project_month_prescriptions.project[a].project.project_name
  1129. // obj['statistical_classification'] = project_month_prescriptions.project[a].project.statistical_classification
  1130. // obj['single_dose'] = project_month_prescriptions.project[a].single_dose
  1131. // obj['delivery_way'] = project_month_prescriptions.project[a].delivery_way
  1132. // obj['execution_frequency'] = project_month_prescriptions.project[a].execution_frequency
  1133. // obj['number_days'] = project_month_prescriptions.project[a].day
  1134. // obj['medical_code'] = project_month_prescriptions.project[a].project.medical_code
  1135. // obj['unit'] = project_month_prescriptions.project[a].unit
  1136. // obj['project_id'] = project_month_prescriptions.project[a].project_id
  1137. // count = count + project_month_prescriptions.project[a].count
  1138. // price = price + project_month_prescriptions.project[a].price
  1139. // }
  1140. // }
  1141. // obj['price'] = this.formatDecimal(price,2)
  1142. // obj['total'] = count
  1143. // projects.push(obj)
  1144. // }
  1145. //
  1146. //
  1147. // for (let i = 0; i < additions_ids.length; i++) {
  1148. // let obj = {}
  1149. // let price = 0
  1150. // let count = 0
  1151. // for (let a = 0; a < addition_month_prescriptions.addition.length; a++) {
  1152. // if (project_ids[i] == addition_month_prescriptions.addition[a].item_id) {
  1153. // obj['item_name'] = addition_month_prescriptions.addition[a].item_name
  1154. // obj['id'] = addition_month_prescriptions.addition[a].id
  1155. // obj['item_id'] = addition_month_prescriptions.addition[a].item_id
  1156. // count = count + addition_month_prescriptions.addition[a].count
  1157. // price = price + addition_month_prescriptions.addition[a].price
  1158. // }
  1159. // }
  1160. // obj['price'] = this.formatDecimal(price,2)
  1161. // obj['count'] = count
  1162. // additions.push(obj)
  1163. // }
  1164. //
  1165. // console.log(drugs)
  1166. // console.log(projects)
  1167. // console.log(additions)
  1168. //
  1169. //
  1170. // if (drugs.length > 0) {
  1171. // let p1 = {
  1172. // name: '处方' + 1,
  1173. // advices: drugs,
  1174. // project: [],
  1175. // type: 1,
  1176. // addition: additions,
  1177. // }
  1178. // this.month_prescriptions.push(p1)
  1179. //
  1180. // }
  1181. //
  1182. // if (projects.length > 0) {
  1183. // let p2 = {
  1184. // name: '处方' + 2,
  1185. // type: 2,
  1186. // project: projects,
  1187. // advices: [],
  1188. // }
  1189. // this.month_prescriptions.push(p2)
  1190. // }
  1191. //
  1192. // console.log(this.month_prescriptions)
  1193. //
  1194. // },
  1195. formatDecimal(num, decimal) {
  1196. num = num.toString()
  1197. let index = num.indexOf('.')
  1198. if (index !== -1) {
  1199. num = num.substring(0, decimal + index + 1)
  1200. } else {
  1201. num = num.substring(0)
  1202. }
  1203. return parseFloat(num).toFixed(decimal)
  1204. },
  1205. changeTime(val) {
  1206. if (val == this.end_time) {
  1207. this.isShowDayPrescription = true
  1208. } else {
  1209. this.isShowDayPrescription = false
  1210. }
  1211. let params = {
  1212. patient_id: this.patientInfo.id,
  1213. start_time: val,
  1214. end_time: this.end_time,
  1215. p_type: 2
  1216. }
  1217. getDayOrMonthHisPrescription(params).then(response => {
  1218. if (response.data.state == 1) {
  1219. this.month_prescriptions = []
  1220. if (val == this.end_time) {
  1221. var day_prescription = response.data.data.day_prescription
  1222. // this.month_prescriptions = day_prescription
  1223. if (day_prescription.length > 0) {
  1224. for (let i = 0; i < day_prescription.length; i++) {
  1225. var prescription = day_prescription[i]
  1226. let tempAdvice = []
  1227. let tempProject = []
  1228. let tempAddition = []
  1229. //药品
  1230. for (let b = 0; b < prescription.advices.length; b++) {
  1231. let obj = {
  1232. advice_id: prescription.advices[b].id,
  1233. drug_name: prescription.advices[b].advice_name,
  1234. single_dose: prescription.advices[b].single_dose,
  1235. delivery_way: prescription.advices[b].delivery_way,
  1236. execution_frequency: prescription.advices[b].execution_frequency,
  1237. retail_price: prescription.advices[b].price.toString(),
  1238. remark: prescription.advices[b].remark,
  1239. day: prescription.advices[b].day,
  1240. prescribing_number: prescription.advices[b].prescribing_number.toString(),
  1241. single_dose_unit: prescription.advices[b].single_dose_unit,
  1242. prescribing_number_unit: prescription.advices[b].prescribing_number_unit,
  1243. medical_insurance_number: prescription.advices[b].med_list_codg,
  1244. id: prescription.advices[b].drug_id,
  1245. drug: prescription.advices[b].drug
  1246. }
  1247. tempAdvice.push(obj)
  1248. }
  1249. //项目
  1250. for (let b = 0; b < prescription.project.length; b++) {
  1251. let obj = {
  1252. id: prescription.project[b].id,
  1253. project_id: prescription.project[b].project_id,
  1254. // project_name: prescription.project[b].project.project_name,
  1255. // statistical_classification: prescription.project[b].project.statistical_classification,
  1256. single_dose: prescription.project[b].single_dose,
  1257. delivery_way: prescription.project[b].delivery_way,
  1258. execution_frequency: prescription.project[b].execution_frequency,
  1259. number_days: prescription.project[b].day,
  1260. total: prescription.project[b].count.toString(),
  1261. price: prescription.project[b].price,
  1262. remark: prescription.project[b].remark,
  1263. // medical_code: prescription.project[b].project.medical_code,
  1264. unit: prescription.project[b].unit
  1265. }
  1266. if (prescription.project[b].type == 2) {
  1267. obj['statistical_classification'] = prescription.project[b].team.project_team
  1268. obj['medical_code'] = prescription.project[b].project.medical_code
  1269. obj['project_name'] = prescription.project[b].project.project_name
  1270. obj['project'] = prescription.project[b].project
  1271. } else if (prescription.project[b].type == 3) {
  1272. if (prescription.project[b].team_id > 0) {
  1273. obj['statistical_classification'] = prescription.project[b].team.project_team
  1274. }
  1275. obj['medical_code'] = prescription.project[b].good_info.medical_insurance_number
  1276. obj['project_name'] = prescription.project[b].good_info.good_name
  1277. obj['good_info'] = prescription.project[b].good_info
  1278. }
  1279. tempProject.push(obj)
  1280. }
  1281. //附加收费
  1282. // for (let b = 0; b < prescription.addition.length; b++) {
  1283. // let obj = {
  1284. // id: prescription.addition[b].id,
  1285. // item_name: prescription.addition[b].item_name,
  1286. // price: prescription.addition[b].price,
  1287. // count: prescription.addition[b].count,
  1288. // item_id: prescription.addition[b].item_id
  1289. // }
  1290. // tempAddition.push(obj)
  1291. // }
  1292. let index = i + 1
  1293. let obj = {
  1294. id: prescription.id,
  1295. name: '处方' + index,
  1296. advices: tempAdvice,
  1297. project: tempProject,
  1298. addition: tempAddition,
  1299. order_status: prescription.order_status
  1300. }
  1301. this.month_prescriptions.push(obj)
  1302. }
  1303. this.curDayPrescriptions = this.month_prescriptions[0]
  1304. }
  1305. } else {
  1306. this.setMonthPrescription(response.data.data.day_prescription)
  1307. this.curMonthPrescriptions = this.month_prescriptions[0]
  1308. }
  1309. } else {
  1310. this.$message.error(response.data.msg)
  1311. }
  1312. })
  1313. },
  1314. changeEndTime(val) {
  1315. if (val == this.start_time) {
  1316. this.isShowDayPrescription = true
  1317. } else {
  1318. this.isShowDayPrescription = false
  1319. }
  1320. let params = {
  1321. patient_id: this.patientInfo.id,
  1322. start_time: this.start_time,
  1323. end_time: val,
  1324. p_type: 2
  1325. }
  1326. getDayOrMonthHisPrescription(params).then(response => {
  1327. if (response.data.state == 1) {
  1328. this.month_prescriptions = []
  1329. if (val == this.start_time) {
  1330. var day_prescription = response.data.data.day_prescription
  1331. // this.month_prescriptions = day_prescription
  1332. if (day_prescription.length > 0) {
  1333. for (let i = 0; i < day_prescription.length; i++) {
  1334. var prescription = day_prescription[i]
  1335. let tempAdvice = []
  1336. let tempProject = []
  1337. let tempAddition = []
  1338. //药品
  1339. for (let b = 0; b < prescription.advices.length; b++) {
  1340. let obj = {
  1341. advice_id: prescription.advices[b].id,
  1342. drug_name: prescription.advices[b].advice_name,
  1343. single_dose: prescription.advices[b].single_dose,
  1344. delivery_way: prescription.advices[b].delivery_way,
  1345. execution_frequency: prescription.advices[b].execution_frequency,
  1346. retail_price: prescription.advices[b].price.toString(),
  1347. remark: prescription.advices[b].remark,
  1348. day: prescription.advices[b].day,
  1349. prescribing_number: prescription.advices[b].prescribing_number.toString(),
  1350. single_dose_unit: prescription.advices[b].single_dose_unit,
  1351. prescribing_number_unit: prescription.advices[b].prescribing_number_unit,
  1352. medical_insurance_number: prescription.advices[b].med_list_codg,
  1353. id: prescription.advices[b].drug_id,
  1354. drug: prescription.advices[b].drug
  1355. }
  1356. tempAdvice.push(obj)
  1357. }
  1358. //项目
  1359. for (let b = 0; b < prescription.project.length; b++) {
  1360. let obj = {
  1361. id: prescription.project[b].id,
  1362. project_id: prescription.project[b].project_id,
  1363. // project_name: prescription.project[b].project.project_name,
  1364. // statistical_classification: prescription.project[b].project.statistical_classification,
  1365. single_dose: prescription.project[b].single_dose,
  1366. delivery_way: prescription.project[b].delivery_way,
  1367. execution_frequency: prescription.project[b].execution_frequency,
  1368. number_days: prescription.project[b].day,
  1369. total: prescription.project[b].count.toString(),
  1370. price: prescription.project[b].price,
  1371. remark: prescription.project[b].remark,
  1372. // medical_code: prescription.project[b].project.medical_code,
  1373. unit: prescription.project[b].unit
  1374. }
  1375. if (prescription.project[b].type == 2) {
  1376. obj['statistical_classification'] = prescription.project[b].team.project_team
  1377. obj['medical_code'] = prescription.project[b].project.medical_code
  1378. obj['project_name'] = prescription.project[b].project.project_name
  1379. obj['project'] = prescription.project[b].project
  1380. } else if (prescription.project[b].type == 3) {
  1381. if (prescription.project[b].team_id > 0) {
  1382. obj['statistical_classification'] = prescription.project[b].team.project_team
  1383. }
  1384. obj['medical_code'] = prescription.project[b].good_info.medical_insurance_number
  1385. obj['project_name'] = prescription.project[b].good_info.good_name
  1386. obj['good_info'] = prescription.project[b].good_info
  1387. }
  1388. tempProject.push(obj)
  1389. }
  1390. //附加收费
  1391. // for (let b = 0; b < prescription.addition.length; b++) {
  1392. // let obj = {
  1393. // id: prescription.addition[b].id,
  1394. // item_name: prescription.addition[b].item_name,
  1395. // price: prescription.addition[b].price,
  1396. // count: prescription.addition[b].count,
  1397. // item_id: prescription.addition[b].item_id
  1398. // }
  1399. // tempAddition.push(obj)
  1400. // }
  1401. let index = i + 1
  1402. let obj = {
  1403. id: prescription.id,
  1404. name: '处方' + index,
  1405. advices: tempAdvice,
  1406. project: tempProject,
  1407. addition: tempAddition,
  1408. order_status: prescription.order_status
  1409. }
  1410. this.month_prescriptions.push(obj)
  1411. }
  1412. this.curDayPrescriptions = this.month_prescriptions[0]
  1413. }
  1414. } else {
  1415. this.setMonthPrescription(response.data.data.day_prescription)
  1416. this.curMonthPrescriptions = this.month_prescriptions[0]
  1417. }
  1418. } else {
  1419. this.$message.error(response.data.msg)
  1420. }
  1421. })
  1422. }, saveTemplate(val) {
  1423. let params = {
  1424. name: val.name,
  1425. mode: val.mode,
  1426. patient_id: this.patientInfo.id
  1427. }
  1428. let data = {
  1429. 'prescriptions': val.prescriptions
  1430. }
  1431. createdTemplate(params, data).then(response => {
  1432. if (response.data.state == 1) {
  1433. this.$refs.saveTemplate.hide()
  1434. this.$message.success('保存成功')
  1435. } else {
  1436. this.$message.error(response.data.msg)
  1437. }
  1438. })
  1439. },
  1440. call(val) {
  1441. this.prescriptions = []
  1442. this.prescriptions = val
  1443. for (let i = 0; i < this.prescriptions.length; i++) {
  1444. var nowDate = new Date()
  1445. var nowYear = nowDate.getFullYear()
  1446. var nowMonth = nowDate.getMonth() + 1
  1447. var nowDay = nowDate.getDate()
  1448. var hours = nowDate.getHours()
  1449. var min = nowDate.getMinutes()
  1450. var preTime = ''
  1451. var nowTime =
  1452. nowYear +
  1453. '-' +
  1454. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  1455. '-' +
  1456. (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + (hours < 10 ? '0' + hours : hours) +
  1457. ':' + (min < 10 ? '0' + min : min)
  1458. if (nowTime.split(' ')[0] != this.record_date) {
  1459. if (this.org_id == 10206 || this.org_id == 0) {
  1460. preTime = this.record_date + ' ' + (hours < 10 ? '0' + hours : hours) +
  1461. ':' + (min < 10 ? '0' + min : min)
  1462. } else {
  1463. preTime = this.record_date + ' ' + (hours < 10 ? '0' + hours : hours) +
  1464. ':' + (min < 10 ? '0' + min : min)
  1465. }
  1466. } else {
  1467. preTime = nowTime
  1468. }
  1469. this.prescriptions[i]['pre_time'] = preTime
  1470. this.prescriptions[i].name = '处方' + (i + 1)
  1471. if (i == 0) {
  1472. if (this.prescriptions[0].advices.length > 0 && this.prescriptions[0].project.length == 0) {
  1473. this.customTabIndex = 1
  1474. this.curStatus = 1
  1475. this.rightTab = 1
  1476. this.showOne = true
  1477. this.showTwo = false
  1478. this.showThree = false
  1479. }
  1480. if (this.prescriptions[0].advices.length == 0 && this.prescriptions[0].project.length > 0) {
  1481. this.customTabIndex = 2
  1482. this.curStatus = 2
  1483. this.rightTab = 2
  1484. this.showTwo = true
  1485. this.showOne = false
  1486. this.showThree = false
  1487. }
  1488. }
  1489. }
  1490. this.curPrescriptions = this.prescriptions[0]
  1491. this.$refs.call_prescription.close()
  1492. this.$emit('setData', this.prescriptions)
  1493. }, changevalue(val) {
  1494. this.$forceUpdate()
  1495. },
  1496. callCancel() {
  1497. this.$refs.call_prescription.close()
  1498. },
  1499. cancel() {
  1500. this.$refs.next_or_last_prescription.close()
  1501. this.request_record_date = this.record_date
  1502. },
  1503. setValue(val) {
  1504. this.prescriptions = []
  1505. this.prescriptions = val
  1506. this.$refs.next_or_last_prescription.close()
  1507. var nowDate = new Date()
  1508. var nowYear = nowDate.getFullYear()
  1509. var nowMonth = nowDate.getMonth() + 1
  1510. var nowDay = nowDate.getDate()
  1511. var hours = nowDate.getHours()
  1512. var min = nowDate.getMinutes()
  1513. var nowTime =
  1514. nowYear +
  1515. '-' +
  1516. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  1517. '-' +
  1518. (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + (hours < 10 ? '0' + hours : hours) +
  1519. ':' + (min < 10 ? '0' + min : min)
  1520. var preTime = ''
  1521. console.log(nowTime.split(' ')[0])
  1522. console.log(this.record_date)
  1523. if (nowTime.split(' ')[0] != this.record_date) {
  1524. preTime = this.record_date + ' ' + (hours < 10 ? '0' + hours : hours) +
  1525. ':' + (min < 10 ? '0' + min : min)
  1526. } else {
  1527. preTime = nowTime
  1528. }
  1529. for (let i = 0; i < this.prescriptions.length; i++) {
  1530. this.prescriptions[i].name = '处方' + (i + 1)
  1531. this.prescriptions[i]['pre_time'] = preTime
  1532. if (i == 0) {
  1533. if (this.prescriptions[0].advices.length > 0 && this.prescriptions[0].project.length == 0) {
  1534. this.customTabIndex = 1
  1535. this.curStatus = 1
  1536. this.rightTab = 1
  1537. this.showOne = true
  1538. this.showTwo = false
  1539. this.showThree = false
  1540. }
  1541. if (this.prescriptions[0].advices.length == 0 && this.prescriptions[0].project.length > 0) {
  1542. this.customTabIndex = 2
  1543. this.curStatus = 2
  1544. this.rightTab = 2
  1545. this.showTwo = true
  1546. this.showOne = false
  1547. this.showThree = false
  1548. }
  1549. }
  1550. }
  1551. this.curPrescriptions = this.prescriptions[0]
  1552. this.request_record_date = this.record_date
  1553. this.$emit('setData', this.prescriptions)
  1554. },
  1555. GetNextOrLastHisPrescription(params) {
  1556. getNextOrLastHisPrescription(params).then(response => {
  1557. if (response.data.state == 1) {
  1558. if (this.dayorMonth == 'day') {
  1559. this.$refs.next_or_last_prescription.show(response.data.data.prescriptions, this.patientInfo.name, this.patientInfo.id, this.prescriptions)
  1560. this.request_record_date = uParseTime(response.data.data.prescriptions[0].record_date, '{y}-{m}-{d}')
  1561. } else {
  1562. this.$message.error('当前处于月结,无法使用上一方或下一方功能')
  1563. }
  1564. } else {
  1565. this.$message.error(response.data.msg)
  1566. }
  1567. })
  1568. },
  1569. openLast(val) {
  1570. // if (this.curPrescriptions.order_status == 2) {
  1571. // this.$message.error('处方已经结算,无法添加')
  1572. // return
  1573. // }
  1574. if (this.patientInfo.id == 0) {
  1575. this.$message.error('请选择患者')
  1576. return
  1577. }
  1578. if (val == 1) {
  1579. this.isVisibility = false
  1580. this.request_record_date = this.record_date
  1581. let params = {
  1582. patient_id: this.patientInfo.id,
  1583. record_time: this.request_record_date,
  1584. type: 1,
  1585. p_type: 2
  1586. }
  1587. this.GetNextOrLastHisPrescription(params)
  1588. } else if (val == 3) {
  1589. let params = {
  1590. patient_id: this.patientInfo.id,
  1591. record_time: this.request_record_date,
  1592. type: 1,
  1593. p_type: 2
  1594. }
  1595. this.GetNextOrLastHisPrescription(params)
  1596. }
  1597. },
  1598. openNext(val) {
  1599. // if (this.curPrescriptions.order_status == 2) {
  1600. // this.$message.error('处方已经结算,无法添加')
  1601. // return
  1602. // }
  1603. if (this.patientInfo.id == 0) {
  1604. this.$message.error('请选择患者')
  1605. return
  1606. }
  1607. if (val == 2) {
  1608. this.isVisibility = false
  1609. this.request_record_date = this.record_date
  1610. let params = {
  1611. patient_id: this.patientInfo.id,
  1612. record_time: this.request_record_date,
  1613. type: 2,
  1614. p_type: 2
  1615. }
  1616. this.GetNextOrLastHisPrescription(params)
  1617. } else if (val == 4) {
  1618. let params = {
  1619. patient_id: this.patientInfo.id,
  1620. record_time: this.request_record_date,
  1621. type: 2,
  1622. p_type: 2
  1623. }
  1624. this.GetNextOrLastHisPrescription(params)
  1625. }
  1626. },
  1627. selectTemplate(selection, row) {
  1628. this.tempDrugs = selection
  1629. }, changeTemplateData(selection) {
  1630. this.tempDrugs = selection
  1631. },
  1632. stockInCount: function(row) {
  1633. let total = 0
  1634. if (row.stock_in != null) {
  1635. for (let i = 0; i < row.stock_in.length; i++) {
  1636. total = total + row.stock_in[i].warehousing_count
  1637. }
  1638. }
  1639. return total
  1640. },
  1641. salesReturnCount: function(row) {
  1642. let total = 0
  1643. if (row.sales_return != null) {
  1644. for (let i = 0; i < row.sales_return.length; i++) {
  1645. total = total + row.sales_return[i].count
  1646. }
  1647. }
  1648. return total
  1649. },
  1650. stockOutCount: function(row) {
  1651. let total = 0
  1652. if (row.stock_out != null) {
  1653. for (let i = 0; i < row.stock_out.length; i++) {
  1654. total = total + row.stock_out[i].count
  1655. }
  1656. }
  1657. return total
  1658. },
  1659. cancelStockCount: function(row) {
  1660. let total = 0
  1661. if (row.cancel_stock != null) {
  1662. for (let i = 0; i < row.cancel_stock.length; i++) {
  1663. total = total + row.cancel_stock[i].count
  1664. }
  1665. }
  1666. return total
  1667. },
  1668. setCharge(additional_charges) {
  1669. for (let i = 0; i < additional_charges.length; i++) {
  1670. additional_charges[i].count = 1
  1671. this.curPrescriptions.addition.push(additional_charges[i])
  1672. }
  1673. this.$refs.additionalCharges.hide()
  1674. },
  1675. // 项目
  1676. searchProjectAction() {
  1677. console.log('~~~~', this.search_project_keyword)
  1678. const tabProjects = this.allProject
  1679. console.log('4444', tabProjects)
  1680. if (this.search_project_keyword.length == 0) {
  1681. this.tabProject = this.allProject
  1682. } else {
  1683. let arr = []
  1684. for (let i = 0; i < tabProjects.length; i++) {
  1685. // console.log('4444',this.tabProject[i].first_letter.indexOf(this.search_project_keyword) != -1)
  1686. if (tabProjects[i].project_name.indexOf(this.search_project_keyword) != -1 ||
  1687. tabProjects[i].first_letter.indexOf(this.search_project_keyword) != -1) {
  1688. arr = arr.concat(tabProjects[i])
  1689. }
  1690. }
  1691. // for (let i = 0; i < this.tabProject.length; i++) {
  1692. // // console.log('4444',this.tabProject[i].first_letter.indexOf(this.search_project_keyword) != -1)
  1693. // if (this.tabProject[i].project_name.indexOf(this.search_project_keyword) != -1 ||
  1694. // this.tabProject[i].first_letter.indexOf(this.search_project_keyword) !=-1) {
  1695. // arr = arr.concat(this.tabProject[i])
  1696. // }
  1697. // }
  1698. this.tabProject = arr
  1699. console.log('kkkk', this.tabProject)
  1700. }
  1701. },
  1702. // 项目组套搜索
  1703. searchProjectTeamAction() {
  1704. const allTabPrjectTeam = this.allTabPrjectTeam
  1705. if (this.search_project_team_keyword.length == 0) {
  1706. this.tabPrjectTeam = this.allTabPrjectTeam
  1707. } else {
  1708. // console.log('555555',allTabPrjectTeam,this.search_project_team_keyword);
  1709. let arr = []
  1710. for (let i = 0; i < allTabPrjectTeam.length; i++) {
  1711. if (allTabPrjectTeam[i].project_team.indexOf(this.search_project_team_keyword) != -1 ||
  1712. allTabPrjectTeam[i].pinyin.indexOf(this.search_project_team_keyword) != -1) {
  1713. arr = arr.concat(allTabPrjectTeam[i])
  1714. }
  1715. }
  1716. this.tabPrjectTeam = arr
  1717. }
  1718. },
  1719. // 药品
  1720. searchAction() {
  1721. const drug2 = this.allDrugs
  1722. console.log('this.allDrugs', drug2)
  1723. if (this.search_keyword.length == 0) {
  1724. this.drugs = this.allDrugs
  1725. } else {
  1726. let arr = []
  1727. for (let i = 0; i < drug2.length; i++) {
  1728. if (drug2[i].drug_name.indexOf(this.search_keyword) != -1 ||
  1729. drug2[i].wubi.indexOf(this.search_keyword) != -1 ||
  1730. drug2[i].pinyin.indexOf(this.search_keyword) != -1 ||
  1731. drug2[i].first_letter.indexOf(this.search_keyword) != -1
  1732. ) {
  1733. arr = arr.concat(drug2[i])
  1734. }
  1735. }
  1736. // for (let i = 0; i < this.drugs.length; i++) {
  1737. // if (this.drugs[i].drug_name.indexOf(this.search_keyword) != -1 ||
  1738. // this.drugs[i].wubi.indexOf(this.search_keyword) != -1 ||
  1739. // this.drugs[i].pinyin.indexOf(this.search_keyword) != -1 ||
  1740. // this.drugs[i].first_letter.indexOf(this.search_keyword) != -1
  1741. // ) {
  1742. // arr = arr.concat(this.drugs[i])
  1743. // }
  1744. // }
  1745. this.drugs = arr
  1746. }
  1747. },
  1748. getTotalOne() {
  1749. var total = 0
  1750. for (let i = 0; i < this.prescriptions.length; i++) {
  1751. if (this.prescriptions[i].name == this.editableTabsValue) {
  1752. if (this.prescriptions[i].advices != null) {
  1753. for (let a = 0; a < this.prescriptions[i].advices.length; a++) {
  1754. total = total + this.prescriptions[i].advices[a].retail_price * this.prescriptions[i].advices[a].prescribing_number
  1755. }
  1756. }
  1757. if (this.prescriptions[i].project != null) {
  1758. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  1759. total = total + this.prescriptions[i].project[b].price * this.prescriptions[i].project[b].total
  1760. }
  1761. }
  1762. if (this.prescriptions[i].addition != null) {
  1763. for (let b = 0; b < this.prescriptions[i].addition.length; b++) {
  1764. total = total + this.prescriptions[i].addition[b].price * this.prescriptions[i].addition[b].count
  1765. }
  1766. }
  1767. total = total.toFixed(2)
  1768. }
  1769. }
  1770. return total
  1771. }, getTotalTwo() {
  1772. var total = 0
  1773. for (let i = 0; i < this.month_prescriptions.length; i++) {
  1774. if (this.month_prescriptions[i].name == this.editableTabsValueTwo) {
  1775. if (this.month_prescriptions[i].advices != null) {
  1776. for (let a = 0; a < this.month_prescriptions[i].advices.length; a++) {
  1777. total = total + this.month_prescriptions[i].advices[a].retail_price * this.month_prescriptions[i].advices[a].prescribing_number
  1778. }
  1779. }
  1780. if (this.month_prescriptions[i].project != null) {
  1781. for (let b = 0; b < this.month_prescriptions[i].project.length; b++) {
  1782. total = total + this.month_prescriptions[i].project[b].price * this.month_prescriptions[i].project[b].total
  1783. }
  1784. }
  1785. if (this.month_prescriptions[i].addition != null) {
  1786. for (let b = 0; b < this.month_prescriptions[i].addition.length; b++) {
  1787. total = total + this.month_prescriptions[i].addition[b].price * this.month_prescriptions[i].addition[b].count
  1788. }
  1789. }
  1790. total = total.toFixed(2)
  1791. }
  1792. }
  1793. return total
  1794. },
  1795. getCurTotal() {
  1796. var total = 0
  1797. if (this.curPrescriptions.type == 1) {
  1798. for (let a = 0; a < this.curPrescriptions.advices.length; a++) {
  1799. total = total + this.curPrescriptions.advices[a].retail_price * this.curPrescriptions.advices[a].prescribing_number
  1800. }
  1801. return total.toFixed(2)
  1802. } else {
  1803. for (let a = 0; a < this.curPrescriptions.project.length; a++) {
  1804. total = total + this.curPrescriptions.project[a].price * this.curPrescriptions.project[a].total
  1805. }
  1806. return total.toFixed(2)
  1807. }
  1808. },
  1809. getTotal() {
  1810. var total = 0
  1811. for (let i = 0; i < this.prescriptions.length; i++) {
  1812. if (this.prescriptions[i].advices != null) {
  1813. for (let a = 0; a < this.prescriptions[i].advices.length; a++) {
  1814. total = total + this.prescriptions[i].advices[a].retail_price * this.prescriptions[i].advices[a].prescribing_number
  1815. }
  1816. }
  1817. if (this.prescriptions[i].project != null) {
  1818. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  1819. total = total + this.prescriptions[i].project[b].price * this.prescriptions[i].project[b].total
  1820. }
  1821. }
  1822. if (this.prescriptions[i].addition != null) {
  1823. for (let b = 0; b < this.prescriptions[i].addition.length; b++) {
  1824. total = total + this.prescriptions[i].addition[b].price * this.prescriptions[i].addition[b].count
  1825. }
  1826. }
  1827. }
  1828. return total.toFixed(2)
  1829. }, getMonthTotal() {
  1830. var total = 0
  1831. for (let i = 0; i < this.month_prescriptions.length; i++) {
  1832. if (this.month_prescriptions[i].advices != null) {
  1833. for (let a = 0; a < this.month_prescriptions[i].advices.length; a++) {
  1834. total = total + this.month_prescriptions[i].advices[a].retail_price * this.month_prescriptions[i].advices[a].prescribing_number
  1835. }
  1836. }
  1837. if (this.month_prescriptions[i].project != null) {
  1838. for (let b = 0; b < this.month_prescriptions[i].project.length; b++) {
  1839. total = total + this.month_prescriptions[i].project[b].price * this.month_prescriptions[i].project[b].total
  1840. }
  1841. }
  1842. if (this.month_prescriptions[i].addition != null) {
  1843. for (let b = 0; b < this.month_prescriptions[i].addition.length; b++) {
  1844. total = total + this.month_prescriptions[i].addition[b].price * this.month_prescriptions[i].addition[b].count
  1845. }
  1846. }
  1847. }
  1848. return total.toFixed(2)
  1849. },
  1850. createFilter(queryString) {
  1851. return (restaurant) => {
  1852. return (restaurant.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0)
  1853. }
  1854. },
  1855. querySearch2(queryString, cb) {
  1856. var restaurants = this.sick
  1857. restaurants.map(item => {
  1858. item.value = item.name
  1859. })
  1860. var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants
  1861. // 调用 callback 返回建议列表的数据
  1862. cb(results)
  1863. },
  1864. changeKind(val) {
  1865. this.drugs = []
  1866. if (val == 0) {
  1867. this.drugs = this.allDrugs
  1868. } else {
  1869. for (let i = 0; i < this.allDrugs.length; i++) {
  1870. if (this.allDrugs[i].drug_type == val) {
  1871. this.drugs.push(this.allDrugs[i])
  1872. }
  1873. }
  1874. }
  1875. },
  1876. getDictionaryDataConfig(module, filed_name) {
  1877. return getDictionaryDataConfig(module, filed_name)
  1878. },
  1879. // getInitData() {
  1880. // getInitData().then(response => {
  1881. // if (response.data.state == 0) {
  1882. // this.$message.error(response.data.msg)
  1883. // return false
  1884. // } else {
  1885. // this.drugs = response.data.data.drugs
  1886. // this.allDrugs = response.data.data.drugs
  1887. // this.advices_template = response.data.data.advices_template
  1888. // this.doctors = response.data.data.doctors
  1889. // for (let i = 0; i < this.doctors.length; i++) {
  1890. // if (this.doctors[i].user_type == 1) {
  1891. // this.doctors.splice(i, 1)
  1892. // }
  1893. // }
  1894. // this.department = response.data.data.department
  1895. // this.sick = response.data.data.sick
  1896. // this.diagnoses = response.data.data.diagnose
  1897. // this.additions = response.data.data.additions
  1898. //
  1899. // }
  1900. // })
  1901. //
  1902. // },
  1903. monthTabclickEvent(val) {
  1904. for (let i = 0; i < this.month_prescriptions.length; i++) {
  1905. if (this.month_prescriptions[i].name == val.name) {
  1906. if (this.dayorMonth == 'month') {
  1907. if (this.isShowDayPrescription) {
  1908. this.curDayPrescriptions = this.month_prescriptions[i]
  1909. //用来区分处方属于项目还是药品
  1910. if (this.curDayPrescriptions.advices.length > 0 && this.curDayPrescriptions.project.length == 0) {
  1911. this.monthCustomTabIndex = 1
  1912. }
  1913. if (this.curDayPrescriptions.advices.length == 0 && this.curDayPrescriptions.project.length > 0) {
  1914. this.monthCustomTabIndex = 2
  1915. }
  1916. } else {
  1917. this.curMonthPrescriptions = this.month_prescriptions[i]
  1918. //用来区分处方属于项目还是药品
  1919. if (this.curMonthPrescriptions.advices.length > 0 && this.curMonthPrescriptions.project.length == 0) {
  1920. this.monthCustomTabIndex = 1
  1921. }
  1922. if (this.curMonthPrescriptions.advices.length == 0 && this.curMonthPrescriptions.project.length > 0) {
  1923. this.monthCustomTabIndex = 2
  1924. }
  1925. }
  1926. }
  1927. this.teamList = []
  1928. this.curDrugs = []
  1929. this.$refs.multipleTable.clearSelection()
  1930. this.$refs.tables.clearSelection()
  1931. }
  1932. }
  1933. },
  1934. tabclickEvent(val) {
  1935. console.log('li3333333333333li')
  1936. for (let i = 0; i < this.prescriptions.length; i++) {
  1937. if (this.prescriptions[i].name == val.name) {
  1938. this.prescription_id = this.prescriptions[i].id
  1939. this.$emit('event1', this.prescription_id)
  1940. this.curPrescriptions = this.prescriptions[i]
  1941. this.teamList = []
  1942. this.curDrugs = []
  1943. this.$refs.multipleTable.clearSelection()
  1944. this.$refs.tables.clearSelection()
  1945. //用来区分处方属于项目还是药品
  1946. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  1947. this.customTabIndex = 1
  1948. this.curStatus = 1
  1949. this.rightTab = 1
  1950. this.showOne = true
  1951. this.showTwo = false
  1952. this.showThree = false
  1953. }
  1954. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  1955. this.customTabIndex = 2
  1956. this.curStatus = 2
  1957. this.rightTab = 2
  1958. this.showTwo = true
  1959. this.showOne = false
  1960. this.showThree = false
  1961. }
  1962. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length == 0) {
  1963. console.log(this.rightTab)
  1964. this.customTabIndex = this.rightTab
  1965. this.curStatus = 0
  1966. }
  1967. }
  1968. }
  1969. this.is_medicine_status = this.curPrescriptions.is_medicine_status
  1970. if (this.curPrescriptions.order_status == 0) {
  1971. this.order_status = ''
  1972. }
  1973. if (this.curPrescriptions.order_status == 1) {
  1974. this.order_status = '未收费'
  1975. }
  1976. if (this.curPrescriptions.order_status == 2) {
  1977. this.order_status = '已结算'
  1978. }
  1979. if (this.curPrescriptions.order_status == 3) {
  1980. this.order_status = '已退费'
  1981. }
  1982. if (this.curPrescriptions.order_status == 5) {
  1983. this.order_status = '已记账'
  1984. }
  1985. },
  1986. clearData() {
  1987. this.curPrescriptions = []
  1988. this.curStatus = 0
  1989. this.curDrugs = []
  1990. this.preDrugs = []
  1991. this.teamList = []
  1992. },
  1993. setData(data, info, admin_info, doctors, department, hisPatientInfo, month_data, last_info, sick, diagnoses, patient_diagnose) {
  1994. for(let i = 0; i < data.length;i++){
  1995. let aaa = data[i].diagnose
  1996. let uniqueArr = [...new Set(aaa)];
  1997. data[i].diagnose = uniqueArr
  1998. }
  1999. //针对普爱医院获取药品和耗材相关库存数据
  2000. if (this.org_id == 10206 && this.zuobiao_drug.length == 0) {
  2001. var that = this
  2002. axios.get('http://127.0.0.1:9532' + '/nmg/coordinate/querystockdrug', {})
  2003. .then(function(response) {
  2004. if (response.data.state == 0) {
  2005. that.$message.error(response.data.msg)
  2006. that.loadingtwo = false
  2007. return false
  2008. } else {
  2009. if (response.data.data.failed_code == -10) {
  2010. that.$confirm(response.data.data.msg, '医保错误信息', {
  2011. confirmButtonText: '确 定',
  2012. type: 'warning'
  2013. }).then(() => {
  2014. }).catch(() => {
  2015. })
  2016. } else {
  2017. that.zuobiao_drug = response.data.data.drug
  2018. console.log('坐标~~坐标')
  2019. console.log(that.zuobiao_drug)
  2020. console.log(response.data.data.drug)
  2021. console.log('坐标~~坐标')
  2022. // that.zuobiao_project = response.data.data.project
  2023. //跟坐标数据进行匹配,如果bbx01相等的话则,替换库存数量
  2024. for (let i = 0; i < that.zuobiao_drug.length; i++) {
  2025. for (let b = 0; b < that.drugs.length; b++) {
  2026. if (that.zuobiao_drug[i].bby01 == that.drugs[b].bby01) {
  2027. that.drugs[b]['zuobiao_stock_num'] = that.zuobiao_drug[i].sysl
  2028. that.drugs[b].min_price = that.zuobiao_drug[i].lsj
  2029. }
  2030. }
  2031. }
  2032. console.log('坐标~~坐标')
  2033. console.log(that.drugs)
  2034. console.log('坐标~~坐标')
  2035. }
  2036. }
  2037. })
  2038. .catch(function(error) {
  2039. })
  2040. }
  2041. this.sick = sick
  2042. this.diagnoses = diagnoses
  2043. this.department = department
  2044. this.curMonthPrescriptions = {}
  2045. this.curPrescriptions = {}
  2046. this.patient_diagnose = patient_diagnose
  2047. // this.$refs.tabProjectTeam.clearSelection()
  2048. for (let i = 0; i < doctors.length; i++) {
  2049. if (doctors[i].user_type == 1) {
  2050. doctors.splice(i, 1)
  2051. }
  2052. }
  2053. this.prescription_id = data[0].id
  2054. this.editableTabsValue = '处方1'
  2055. this.dayorMonth = 'day'
  2056. this.$emit('event1', this.prescription_id)
  2057. this.curStatus = 0
  2058. if (month_data && month_data.length > 0) {
  2059. this.curMonthPrescriptions = month_data[0]
  2060. } else {
  2061. this.curMonthPrescriptions = {}
  2062. }
  2063. if (data && data.length > 0) {
  2064. this.curPrescriptions = data[0]
  2065. } else {
  2066. this.curPrescriptions = {}
  2067. }
  2068. this.is_medicine_status = this.curPrescriptions.is_medicine_status
  2069. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  2070. this.curStatus = 1
  2071. this.customTabIndex = 1
  2072. this.rightTab = 1
  2073. this.showOne = true
  2074. this.showTwo = false
  2075. this.showThree = false
  2076. }
  2077. if (this.curPrescriptions.project.length > 0 && this.curPrescriptions.advices.length == 0) {
  2078. this.curStatus = 2
  2079. this.customTabIndex = 2
  2080. this.rightTab = 2
  2081. this.showOne = false
  2082. this.showTwo = true
  2083. this.showThree = false
  2084. }
  2085. if (this.curPrescriptions.project.length == 0 && this.curPrescriptions.advices.length == 0) {
  2086. this.curStatus = 1
  2087. this.customTabIndex = 1
  2088. this.rightTab = 1
  2089. this.showOne = true
  2090. this.showTwo = false
  2091. this.showThree = false
  2092. }
  2093. if (info.prescription_status == 0) {
  2094. this.order_status = ''
  2095. }
  2096. if (this.curPrescriptions.order_status == 1) {
  2097. this.order_status = '未收费'
  2098. }
  2099. if (this.curPrescriptions.order_status == 2) {
  2100. this.order_status = '已结算'
  2101. }
  2102. if (this.curPrescriptions.order_status == 3) {
  2103. this.order_status = '已退费'
  2104. }
  2105. this.state1 = info.sick_type
  2106. // if (this.state1 == 0 || this.state1 == '') {
  2107. // this.state1 = ''
  2108. // for (let i = 0; i < this.sick.length; i++) {
  2109. // this.state1 = this.sick[0].id
  2110. //
  2111. // }
  2112. // }
  2113. if (this.departmentValue == '' || this.departmentValue == 0) {
  2114. if (department.length > 0) {
  2115. this.departmentValue = department[0].id
  2116. }
  2117. }
  2118. if (this.org_id == 10375) {
  2119. this.state1 = 607
  2120. }
  2121. if (this.org_id == 10537 || this.org_id == 0) {
  2122. this.state1 = 662
  2123. }
  2124. //
  2125. // if (this.org_id == 10598 || this.org_id == 0) {
  2126. // if (this.org_id == 10598 || this.org_id == 0) {
  2127. // this.state1 = 662
  2128. // }
  2129. if (info.id > 0) {
  2130. this.doctorValue = info.doctor_id
  2131. this.departmentValue = info.departments
  2132. } else {
  2133. if (admin_info.id > 0 && admin_info.user_type == 2) {
  2134. this.doctorValue = admin_info.admin_user_id
  2135. this.departmentValue = department[0].id
  2136. } else {
  2137. this.doctorValue = doctors[0].admin_user_id
  2138. this.departmentValue = department[0].id
  2139. }
  2140. }
  2141. // if (info.register_type == 0) {
  2142. // for (let i = 0; i < this.register.length; i++) {
  2143. // this.register_type = this.register[0].value
  2144. // }
  2145. // } else {
  2146. // this.register_type = info.register_type
  2147. // }
  2148. this.diagnose = []
  2149. console.log('处方----------------------------------------------', info.id)
  2150. if (info.id == 0) {
  2151. if (last_info.diagnosis.length == 0) {
  2152. this.diagnose = []
  2153. } else {
  2154. for (let i = 0; i < last_info.diagnosis.split(",").length; i++) {
  2155. if (last_info.diagnosis.split(',')[i].length > 0) {
  2156. this.diagnose.push(parseInt(last_info.diagnosis.split(',')[i]))
  2157. }
  2158. }
  2159. }
  2160. if (last_info.sick_history == 0) {
  2161. this.state2 = ''
  2162. } else {
  2163. this.state2 = last_info.sick_history
  2164. }
  2165. if (this.org_id == 10138) {
  2166. this.diagnose = []
  2167. this.diagnose.push(24)
  2168. this.diagnose.push(85)
  2169. this.diagnose.push(252)
  2170. }
  2171. if (this.org_id == 10278) {
  2172. this.diagnose = []
  2173. this.diagnose.push(203)
  2174. this.diagnose.push(309)
  2175. this.diagnose.push(202)
  2176. }
  2177. if (this.org_id == 10537) {
  2178. this.diagnose = []
  2179. this.diagnose.push(557)
  2180. this.diagnose.push(612)
  2181. this.diagnose.push(620)
  2182. }
  2183. } else {
  2184. this.state2 = info.sick_history
  2185. if (this.state2 == 0) {
  2186. this.state2 = ''
  2187. }
  2188. if (info.diagnosis.length == 0) {
  2189. this.diagnose = []
  2190. } else {
  2191. for (let i = 0; i < info.diagnosis.split(",").length; i++) {
  2192. if (info.diagnosis.split(',')[i].length > 0) {
  2193. this.diagnose.push(parseInt(info.diagnosis.split(',')[i]))
  2194. }
  2195. }
  2196. }
  2197. }
  2198. // console.log("info233333333333333333333",info.id)
  2199. // console.log("LAST_INFO2323232323WO",last_info.patient_diagnosis)
  2200. this.patient_diagnose = []
  2201. if (info.id == 0) {
  2202. if (last_info.patient_diagnosis.length == 0) {
  2203. this.patient_diagnose = []
  2204. } else {
  2205. for (let i = 0; i < last_info.patient_diagnosis.split(",").length; i++) {
  2206. if (last_info.patient_diagnosis.split(',')[i].length > 0) {
  2207. this.patient_diagnose.push(parseInt(last_info.patient_diagnosis.split(',')[i]))
  2208. }
  2209. }
  2210. }
  2211. }
  2212. if (info.id > 0) {
  2213. if (info.patient_diagnosis.length == 0) {
  2214. this.patient_diagnose = []
  2215. } else {
  2216. this.patient_diagnose = []
  2217. for (let i = 0; i < info.patient_diagnosis.split(",").length; i++) {
  2218. if (info.patient_diagnosis.split(',')[i].length > 0) {
  2219. this.patient_diagnose.push(parseInt(info.patient_diagnosis.split(',')[i]))
  2220. }
  2221. }
  2222. }
  2223. console.log('hhahahahah', this.patient_diagnose)
  2224. }
  2225. console.log('--------', info.sick_type)
  2226. this.state1 = info.sick_type
  2227. if (this.state1 == 0 || this.state1 == '') {
  2228. this.state1 = ''
  2229. for (let i = 0; i < this.sick.length; i++) {
  2230. this.state1 = this.sick[0].id
  2231. }
  2232. }
  2233. if (this.org_id == 10375) {
  2234. this.state1 = 607
  2235. }
  2236. if (this.org_id == 10598 ) {
  2237. this.state1 = 693
  2238. }
  2239. if (this.departmentValue == '' || this.departmentValue == 0) {
  2240. if (department.length > 0) {
  2241. this.departmentValue = department[0].id
  2242. }
  2243. }
  2244. if (this.org_id == 10206) {
  2245. this.departmentValue = 263
  2246. if (this.diagnose.length == 0) {
  2247. this.diagnose.push(716)
  2248. }
  2249. }
  2250. if (this.org_id == 10726) {
  2251. this.doctorValue = 5835
  2252. }
  2253. if (this.org_id == 9478 ) {
  2254. this.state1 = 827
  2255. }
  2256. if (this.patientInfo.id == 38626 ) {
  2257. this.state1 = 828
  2258. }
  2259. },
  2260. setMonthData(info, admin_info, doctors, department, hisPatientInfo, month_data, last_info) {
  2261. // this.start_time = moment(new Date()).subtract(30, 'days').format('YYYY-MM-DD')
  2262. // this.end_time = moment(new Date()).subtract(30, 'days').format('YYYY-MM-DD')
  2263. this.start_time = moment(new Date()).subtract(30, 'days').format('YYYY-MM-DD')
  2264. this.end_time = moment(new Date()).add('year', 0).format('YYYY-MM-DD')
  2265. this.editableTabsValueTwo = '处方1'
  2266. this.curMonthPrescriptions = {}
  2267. this.curPrescriptions = {}
  2268. // this.$refs.tabProjectTeam.clearSelection()
  2269. for (let i = 0; i < doctors.length; i++) {
  2270. if (doctors[i].user_type == 1) {
  2271. doctors.splice(i, 1)
  2272. }
  2273. }
  2274. this.editableTabsValue = '处方1'
  2275. this.curStatus = 0
  2276. if (month_data && month_data.length > 0) {
  2277. this.curMonthPrescriptions = month_data[0]
  2278. } else {
  2279. this.curMonthPrescriptions = {}
  2280. }
  2281. if (info.prescription_status == 0) {
  2282. this.order_status = ''
  2283. }
  2284. if (info.id > 0) {
  2285. this.doctorValue = info.doctor_id
  2286. this.departmentValue = info.departments
  2287. } else {
  2288. if (admin_info.id > 0 && admin_info.user_type == 2) {
  2289. this.doctorValue = admin_info.admin_user_id
  2290. this.departmentValue = this.department[0].id
  2291. } else {
  2292. this.doctorValue = this.doctors[0].admin_user_id
  2293. this.departmentValue = this.department[0].id
  2294. }
  2295. }
  2296. if (info.register_type == 0) {
  2297. for (let i = 0; i < this.register.length; i++) {
  2298. this.register_type = this.register[0].value
  2299. }
  2300. } else {
  2301. this.register_type = info.register_type
  2302. }
  2303. this.diagnose = []
  2304. if (info.id == 0) {
  2305. if (last_info.diagnosis.length == 0) {
  2306. this.diagnose = []
  2307. } else {
  2308. for (let i = 0; i < last_info.diagnosis.split(",").length; i++) {
  2309. this.diagnose.push(parseInt(last_info.diagnosis.split(',')[i]))
  2310. }
  2311. }
  2312. if (last_info.sick_history == 0) {
  2313. this.state2 = ''
  2314. } else {
  2315. this.state2 = last_info.sick_history
  2316. }
  2317. } else {
  2318. this.state2 = info.sick_history
  2319. if (this.state2 == 0) {
  2320. this.state2 = ''
  2321. }
  2322. if (info.diagnosis.length == 0) {
  2323. this.diagnose = []
  2324. } else {
  2325. for (let i = 0; i < info.diagnosis.split(",").length; i++) {
  2326. this.diagnose.push(parseInt(info.diagnosis.split(',')[i]))
  2327. }
  2328. }
  2329. }
  2330. this.state1 = info.sick_type
  2331. if (this.state1 == 0 || this.state1 == '') {
  2332. this.state1 = ''
  2333. for (let i = 0; i < this.sick.length; i++) {
  2334. this.state1 = this.sick[0].id
  2335. }
  2336. }
  2337. if (this.org_id == 0 || this.org_id == 10375) {
  2338. this.state1 = 607
  2339. }
  2340. if (this.departmentValue == '' || this.departmentValue == 0) {
  2341. if (this.department.length > 0) {
  2342. this.departmentValue = this.department[0].id
  2343. }
  2344. }
  2345. },
  2346. moreState(tab, event) {
  2347. console.log('li222222222')
  2348. if (tab == 'more') {
  2349. return false
  2350. }
  2351. },
  2352. open_three() {
  2353. for (let i = 0; i < this.prescriptions.length; i++) {
  2354. for (let b = 0; b < this.prescriptions[i].advices.length; b++) {
  2355. if (this.prescriptions[i].advices[b].prescribing_number == 0 || this.prescriptions[i].advices[b].prescribing_number == '') {
  2356. this.$message.error('药品处方总量不能为0')
  2357. return
  2358. }
  2359. }
  2360. }
  2361. for (let i = 0; i < this.prescriptions.length; i++) {
  2362. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  2363. if (this.prescriptions[i].project[b].total == 0 || this.prescriptions[i].project[b].total == '') {
  2364. this.$message.error('项目处方总量不能为0')
  2365. return
  2366. }
  2367. }
  2368. }
  2369. this.$refs.saveTemplate.show(this.prescriptions)
  2370. }, open_two() {
  2371. if (this.dayorMonth == 'day') {
  2372. if (this.patientInfo == null || this.patientInfo.id == 0) {
  2373. this.$message.error('请选择患者')
  2374. return
  2375. }
  2376. let params = {
  2377. end_time: this.record_date,
  2378. start_time: moment().add(-7, 'd').format('YYYY-MM-DD'),
  2379. patient_id: this.patientInfo.id,
  2380. p_type: 2
  2381. }
  2382. getCallHisPrescription(params).then(response => {
  2383. if (response.data.state == 1) {
  2384. this.$refs.call_prescription.show(this.patientInfo.name, this.patientInfo.id, params.end_time, params.start_time, this.prescriptions, response.data.data.prescriptions)
  2385. } else {
  2386. this.$message.error(response.data.msg)
  2387. }
  2388. })
  2389. } else {
  2390. this.$message.error('当前属于月结状态,无法试用处方调用')
  2391. }
  2392. },
  2393. open(index, isLoading) {
  2394. // if(this.curStatus == 0){
  2395. // this.prescriptions = []
  2396. // }
  2397. if (!isLoading) {
  2398. if (this.dayorMonth == 'day') {
  2399. if(this.org_id == 10721) {
  2400. for (let i = 0; i < this.prescriptions.length; i++) {
  2401. let index = i + 1
  2402. // for (let b = 0; b < this.prescriptions[i].length; b++) {
  2403. if (this.prescriptions[i].diagnose.length == 0) {
  2404. this.$message.error('处方' + index + "诊断不能为空")
  2405. return
  2406. // }
  2407. }
  2408. }
  2409. }
  2410. for (let i = 0; i < this.prescriptions.length; i++) {
  2411. let index = i + 1
  2412. if (this.prescriptions[i].advices.length == 0 && this.prescriptions[i].project.length == 0) {
  2413. this.$message.error('处方' + index + '内容不能为空,请先开处方')
  2414. return
  2415. }
  2416. }
  2417. }
  2418. if (this.dayorMonth == 'day') {
  2419. if (this.curPrescriptions.order_status == 2) {
  2420. this.$message.error('当前处方已经结算,无法保存')
  2421. return
  2422. }
  2423. if (this.doctorValue.length <= 0) {
  2424. this.$message.error('医生不能为空')
  2425. return
  2426. }
  2427. if (this.departmentValue.length <= 0) {
  2428. this.$message.error('科室不能为空')
  2429. return
  2430. }
  2431. if (this.state1 <= 0) {
  2432. this.$message.error('疾病类型不能为空')
  2433. return
  2434. }
  2435. if (this.diagnose.length <= 0 && this.org_id != 10721) {
  2436. this.$message.error('诊断不能为空')
  2437. return
  2438. }
  2439. for (let i = 0; i < this.prescriptions.length; i++) {
  2440. for (let b = 0; b < this.prescriptions[i].advices.length; b++) {
  2441. if (this.prescriptions[i].advices[b].prescribing_number == 0 || this.prescriptions[i].advices[b].prescribing_number == '' || Number.isNaN(this.prescriptions[i].advices[b].prescribing_number)) {
  2442. this.$message.error('药品处方总量不能为0或者不能为NAN')
  2443. return
  2444. }
  2445. }
  2446. }
  2447. for (let i = 0; i < this.prescriptions.length; i++) {
  2448. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  2449. if (this.prescriptions[i].project[b].total == 0 || this.prescriptions[i].project[b].total == '' || Number.isNaN()) {
  2450. this.$message.error('项目处方总量不能为0')
  2451. return
  2452. }
  2453. }
  2454. }
  2455. // for (let i = 0; i < this.prescriptions.length; i++) {
  2456. // if (this.prescriptions[i].med_type == 0 || this.prescriptions[i].med_type == '') {
  2457. // this.$message.error('处方医疗类型不能为空')
  2458. // return
  2459. // }
  2460. // }
  2461. if (index == 1) {
  2462. // console.log(this.prescriptions)
  2463. // if (this.org_id == 10206 || this.org_id == 0) {
  2464. // console.log(this.prescriptions)
  2465. //
  2466. // //药品
  2467. // for (let i = 0; i < this.prescriptions.length; i++) {
  2468. // for (let b = 0; b < this.prescriptions[i].advices.length; b++) {
  2469. // // if(this.prescriptions[i].advices[b].advice_id == 0) {
  2470. // // this.judgmentsDrugStock(this.prescriptions[i].advices[b].drug.bby01, this.prescriptions[i].advices[b].drug.bbx01,this.prescriptions[i].advices[b].drug_name,this.prescriptions[i].advices[b].prescribing_number,isLoading)
  2471. // for (let c = 0; c < this.zuobiao_drug.length; c++) {
  2472. // if (this.zuobiao_drug[c].bby01 == this.prescriptions[i].advices[b].drug.bby01) {
  2473. // if (this.zuobiao_drug[c].sysl < parseInt(this.prescriptions[i].advices[b].prescribing_number)) {
  2474. // isLoading = false
  2475. // this.$message.error(this.prescriptions[i].advices[b].drug_name + '库存不足,无法保存')
  2476. // return
  2477. // }
  2478. // }
  2479. // }
  2480. // // }
  2481. // }
  2482. // }
  2483. // //耗材
  2484. // for (let i = 0; i < this.prescriptions.length; i++) {
  2485. //
  2486. // for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  2487. // if (this.prescriptions[i].project[b].type == 3) {
  2488. // // if(this.prescriptions[i].project[b].id == 0) {
  2489. // // this.judgmentsGoodStock(this.prescriptions[i].project[b].good_info.bby01, this.prescriptions[i].project[b].good_info.bbx01,this.prescriptions[i].project[b].good_info.good_name,this.prescriptions[i].project[b].good_info.specification_name,this.prescriptions[i].project[b].total,isLoading)
  2490. // for (let c = 0; c < this.zuobiao_project.length; c++) {
  2491. // if (this.zuobiao_project[c].bbx01 == this.prescriptions[i].project[b].good_info.bbx01 && this.zuobiao_project[c].bby01 == this.prescriptions[i].project[b].good_info.bby01) {
  2492. // if (this.zuobiao_project[c].lsqty < parseInt(this.prescriptions[i].project[b].total)) {
  2493. // isLoading = false
  2494. // this.$message.error(this.prescriptions[i].project[b].good_info.good_name + '库存不足,无法保存')
  2495. // return
  2496. // }
  2497. // }
  2498. // }
  2499. //
  2500. // }
  2501. // }
  2502. // }
  2503. // }
  2504. if (this.org_id != 10206 && this.org_id != 0) {
  2505. for (let i = 0; i < this.prescriptions.length; i++) {
  2506. for (let b = 0; b < this.prescriptions[i].advices.length; b++) {
  2507. if (this.prescriptions[i].med_type == 14 && this.prescriptions[i].advices[b].drug.is_special_diseases != 1) {
  2508. this.$message.error(this.prescriptions[i].name.toString() + '属于特病类型处方,不能开非特病类型的药')
  2509. return
  2510. }
  2511. }
  2512. for (let c = 0; c < this.prescriptions[i].project.length; c++) {
  2513. if (this.prescriptions[i].med_type == 14 && this.prescriptions[i].project[c].type == 2 && this.prescriptions[i].project[c].project.disease_directory != 1) {
  2514. this.$message.error(this.prescriptions[i].name.toString() + '属于特病类型处方,请开特病类型的项目')
  2515. return
  2516. }
  2517. if (this.prescriptions[i].med_type == 14 && this.prescriptions[i].project[c].type == 3 && this.prescriptions[i].project[c].good_info.is_special_diseases != 1) {
  2518. this.$message.error(this.prescriptions[i].name.toString() + '属于特病类型处方,请开特病类型的耗材')
  2519. return
  2520. }
  2521. }
  2522. }
  2523. }
  2524. for (let i = 0; i < this.prescriptions.length; i++) {
  2525. if (this.prescriptions[i].advices.length == 0 && this.prescriptions[i].project.length == 0) {
  2526. this.$message.error('处方内容不能为空')
  2527. return
  2528. }
  2529. }
  2530. //库存限制
  2531. this.$emit('editKeepLoad', true)
  2532. var str = ''
  2533. if (this.patient_diagnoses != '') {
  2534. str = this.patient_diagnose.join(',')
  2535. }
  2536. let params = {
  2537. p_type: 2,
  2538. patient_id: this.patientInfo.id,
  2539. diagnose: this.diagnose.join(','),
  2540. sick_type: this.state1,
  2541. sick_history: this.state2,
  2542. doctor: this.doctorValue,
  2543. department: this.departmentValue,
  2544. record_date: this.record_date,
  2545. his_patient_id: this.hisPatientInfo.id,
  2546. reg_type: this.register_type,
  2547. patient_diagnose: str
  2548. }
  2549. for (let i = 0; i < this.prescriptions.length; i++) {
  2550. if (this.prescriptions[i].advices.length > 0 && this.prescriptions[i].project.length == 0) {
  2551. this.prescriptions[i]['type'] = 1
  2552. }
  2553. if (this.prescriptions[i].advices.length == 0 && this.prescriptions[i].project.length > 0) {
  2554. this.prescriptions[i]['type'] = 2
  2555. }
  2556. for (let b = 0; b < this.prescriptions[i].advices.length; b++) {
  2557. this.prescriptions[i].advices[b].single_dose = this.prescriptions[i].advices[b].single_dose.toString()
  2558. this.prescriptions[i].advices[b].prescribing_number = this.prescriptions[i].advices[b].prescribing_number.toString()
  2559. this.prescriptions[i].advices[b].retail_price = this.prescriptions[i].advices[b].retail_price.toString()
  2560. this.prescriptions[i].advices[b].day = parseInt(this.prescriptions[i].advices[b].day)
  2561. this.prescriptions[i].advices[b].groupno = parseInt(this.prescriptions[i].advices[b].groupno)
  2562. }
  2563. for (let b = 0; b < this.prescriptions[i].advices.length; b++) {
  2564. if (this.prescriptions[i].advices[b].delivery_way == '') {
  2565. this.$message.error(`处方${i + 1}的${this.prescriptions[i].advices[b].drug_name}用法未填写`)
  2566. this.$emit('editKeepLoad', false)
  2567. return
  2568. }
  2569. if (this.prescriptions[i].advices[b].execution_frequency == '') {
  2570. this.$message.error(`处方${i + 1}的${this.prescriptions[i].advices[b].drug_name}频率未填写`)
  2571. this.$emit('editKeepLoad', false)
  2572. return
  2573. }
  2574. console.log('2o23o23o23o2o23', this.prescriptions[i].advices[b])
  2575. if (this.prescriptions[i].advices[b].day == NaN) {
  2576. this.$message.error(`处方${i + 1}的${this.prescriptions[i].advices[b].drug_name}天数未填写`)
  2577. this.$emit('editKeepLoad', false)
  2578. return
  2579. }
  2580. if (this.prescriptions[i].advices[b].day == 0) {
  2581. this.$message.error(`处方${i + 1}的${this.prescriptions[i].advices[b].drug_name}天数不能为0`)
  2582. this.$emit('editKeepLoad', false)
  2583. return
  2584. }
  2585. if (this.prescriptions[i].advices[b].prescribing_number == '') {
  2586. this.$message.error(`处方${i + 1}的${this.prescriptions[i].advices[b].drug_name}总量未填写`)
  2587. this.$emit('editKeepLoad', false)
  2588. return
  2589. }
  2590. if (this.prescriptions[i].advices[b].prescribing_number == '0') {
  2591. this.$message.error(`处方${i + 1}的${this.prescriptions[i].advices[b].drug_name}总量不能为0`)
  2592. this.$emit('editKeepLoad', false)
  2593. return
  2594. }
  2595. if (this.prescriptions[i].advices[b].prescribing_number_unit == '') {
  2596. this.$message.error(`处方${i + 1}的${this.prescriptions[i].advices[b].drug_name}总量单位未填写`)
  2597. this.$emit('editKeepLoad', false)
  2598. return
  2599. }
  2600. }
  2601. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  2602. this.prescriptions[i].project[b].price = this.prescriptions[i].project[b].price.toString()
  2603. this.prescriptions[i].project[b].total = this.prescriptions[i].project[b].total.toString()
  2604. this.prescriptions[i].project[b].delivery_way = this.prescriptions[i].project[b].delivery_way.toString()
  2605. this.prescriptions[i].project[b].single_dose = this.prescriptions[i].project[b].single_dose.toString()
  2606. }
  2607. // for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  2608. // if(this.prescriptions[i].project[b].delivery_way == "" ){
  2609. // this.$message.error(`处方${i+1}的${this.prescriptions[i].project[b].project_name}用法未填写`)
  2610. // this.$emit('editKeepLoad', false)
  2611. // return
  2612. // }
  2613. // if(this.prescriptions[i].project[b].execution_frequency == "" ){
  2614. // this.$message.error(`处方${i+1}的${this.prescriptions[i].project[b].project_name}频率未填写`)
  2615. // this.$emit('editKeepLoad', false)
  2616. // return
  2617. // }
  2618. // if(this.prescriptions[i].project[b].day == " "){
  2619. // this.$message.error(`处方${i+1}的${this.prescriptions[i].project[b].number_days}天数未填写`)
  2620. // this.$emit('editKeepLoad', false)
  2621. // return
  2622. // }
  2623. // if(this.prescriptions[i].project[b].day == "0"){
  2624. // this.$message.error(`处方${i+1}的${this.prescriptions[i].project[b].number_days}天数不能为0`)
  2625. // this.$emit('editKeepLoad', false)
  2626. // return
  2627. // }
  2628. // }
  2629. for (let b = 0; b < this.prescriptions[i].addition.length; b++) {
  2630. this.prescriptions[i].addition[b].id = prarseInt(this.prescriptions[i].addition[b].id)
  2631. this.prescriptions[i].addition[b].item_id = parseInt(this.prescriptions[i].addition[b].item_id)
  2632. this.prescriptions[i].addition[b].price = this.prescriptions[i].addition[b].price.toString()
  2633. this.prescriptions[i].addition[b].count = this.prescriptions[i].addition[b].count.toString()
  2634. }
  2635. }
  2636. let data = {
  2637. 'prescriptions': this.prescriptions
  2638. }
  2639. isLoading = true
  2640. console.log('this.prescriptionsthis.prescriptions', this.prescriptions)
  2641. console.log('this.prescriptionsthis.prescriptions', params)
  2642. let num = 0
  2643. // this.prescriptions.map(item => {
  2644. // if (item.advices.length > 0) {
  2645. // item.advices.map(it => {
  2646. // if (it.drug.total <= 0) {
  2647. // num++
  2648. // setTimeout(() => {
  2649. // this.$message.error(it.drug.drug_name + '库存不足')
  2650. // }, 100)
  2651. // }
  2652. // })
  2653. // }
  2654. // })
  2655. if (num == 0) {
  2656. var arr = []//新增处方
  2657. var arr_one = []
  2658. var arr_Two = []
  2659. console.log('ooo233323233232323232', this.prescriptions)
  2660. //药品
  2661. for (let i = 0; i < this.prescriptions.length; i++) {
  2662. if (this.prescriptions[i].id == 0) {
  2663. for (let j = 0; j < this.prescriptions[i].advices.length; j++) {
  2664. arr.push(this.prescriptions[i].advices[j])
  2665. }
  2666. if (arr.length > 0) {
  2667. let objInfo = {}
  2668. arr.forEach((item, index) => {
  2669. let { id } = item.id
  2670. if (!objInfo[id]) {
  2671. objInfo[id] = {
  2672. drug_id: item.drug.id,
  2673. child: [],
  2674. sum_count: item.drug.sum_count,
  2675. out_count: 0,
  2676. str: item.drug.drug_name + ' ' + item.drug.dose + item.drug.dose_unit + '*' + item.drug.min_number + item.drug.min_unit + '/' + item.drug.max_unit,
  2677. is_user: item.drug.is_user
  2678. }
  2679. }
  2680. })
  2681. let newArr = Object.values(objInfo)
  2682. for (let i = 0; i < arr.length; i++) {
  2683. for (let j = 0; j < newArr.length; j++) {
  2684. if (arr[i].id == newArr[j].drug_id) {
  2685. newArr[j].child.push(arr[i])
  2686. }
  2687. }
  2688. }
  2689. if (newArr.length > 0) {
  2690. for (let i = 0; i < newArr.length; i++) {
  2691. for (let j = 0; j < newArr[i].child.length; j++) {
  2692. // newArr[i].child[j].prescribing_number_total = 0
  2693. if (newArr[i].child[j].prescribing_number_unit == newArr[i].child[j].drug.max_unit && newArr[i].child[j].drug.max_unit != newArr[i].child[j].drug.min_unit) {
  2694. newArr[i].child[j].prescribing_number_total = parseInt(newArr[i].child[j].prescribing_number) * newArr[i].child[j].drug.min_number
  2695. }
  2696. if (newArr[i].child[j].prescribing_number_unit == newArr[i].child[j].drug.min_unit && newArr[i].child[j].drug.max_unit != newArr[i].child[j].drug.min_unit) {
  2697. newArr[i].child[j].prescribing_number_total = parseInt(newArr[i].child[j].prescribing_number)
  2698. }
  2699. if (newArr[i].child[j].prescribing_number_unit == newArr[i].child[j].drug.max_unit && newArr[i].child[j].drug.max_unit == newArr[i].child[j].drug.min_unit) {
  2700. newArr[i].child[j].prescribing_number_total = parseInt(newArr[i].child[j].prescribing_number)
  2701. }
  2702. }
  2703. }
  2704. for (let i = 0; i < newArr.length; i++) {
  2705. for (let j = 0; j < newArr[i].child.length; j++) {
  2706. newArr[i].out_count += newArr[i].child[j].prescribing_number_total
  2707. }
  2708. }
  2709. }
  2710. if(this.org_id != 10206) {
  2711. if (newArr.length > 0 && this.org_id != 10206 && this.org_id != 0) {
  2712. for (let i = 0; i < newArr.length; i++) {
  2713. if (newArr[i].is_user != 1) {
  2714. if (newArr[i].out_count > newArr[i].sum_count) {
  2715. this.$message.error(newArr[i].str + '库存不足,保存失败!')
  2716. isLoading = false
  2717. this.$emit('editKeepLoad', false)
  2718. return
  2719. }
  2720. }
  2721. }
  2722. }
  2723. }
  2724. }
  2725. }
  2726. if (this.prescriptions[i].id > 0) { //修改处方
  2727. for (let j = 0; j < this.prescriptions[i].advices.length; j++) {
  2728. if (this.prescriptions[i].advices[j].advice_id == 0) { //新增列
  2729. arr_one.push(this.prescriptions[i].advices[j])
  2730. }
  2731. if (this.prescriptions[i].advices[j].advice_id > 0) {
  2732. arr_Two.push(this.prescriptions[i].advices[j])
  2733. }
  2734. }
  2735. if (arr_one.length > 0) {
  2736. let objInfo = {}
  2737. arr_one.forEach((item, index) => {
  2738. let { id } = item.id
  2739. if (!objInfo[id]) {
  2740. objInfo[id] = {
  2741. drug_id: item.drug.id,
  2742. child: [],
  2743. sum_count: item.drug.sum_count,
  2744. out_count: 0,
  2745. str: item.drug.drug_name + ' ' + item.drug.dose + item.drug.dose_unit + '*' + item.drug.min_number + item.drug.min_unit + '/' + item.drug.max_unit,
  2746. is_user: item.drug.is_user
  2747. }
  2748. }
  2749. })
  2750. let newArr = Object.values(objInfo)
  2751. for (let i = 0; i < arr_one.length; i++) {
  2752. for (let j = 0; j < newArr.length; j++) {
  2753. if (arr_one[i].id == newArr[j].drug_id) {
  2754. newArr[j].child.push(arr_one[i])
  2755. }
  2756. }
  2757. }
  2758. if (newArr.length > 0) {
  2759. for (let i = 0; i < newArr.length; i++) {
  2760. for (let j = 0; j < newArr[i].child.length; j++) {
  2761. if (newArr[i].child[j].prescribing_number_unit == newArr[i].child[j].drug.max_unit) {
  2762. newArr[i].child[j].prescribing_number_total = parseInt(newArr[i].child[j].prescribing_number) * newArr[i].child[j].drug.min_number
  2763. }
  2764. newArr[i].out_count += newArr[i].child[j].prescribing_number_total
  2765. }
  2766. }
  2767. }
  2768. if (newArr.length > 0 && this.org_id != 10206 && this.org_id != 0) {
  2769. for (let i = 0; i < newArr.length; i++) {
  2770. if (newArr[i].is_user != 1) {
  2771. if (newArr[i].out_count > newArr[i].sum_count) {
  2772. this.$message.error(newArr[i].str + '库存不足,保存失败!')
  2773. isLoading = false
  2774. this.$emit('editKeepLoad', false)
  2775. return
  2776. }
  2777. }
  2778. }
  2779. }
  2780. }
  2781. }
  2782. }
  2783. if (arr.length > 0) {
  2784. for (let i = 0; i < arr.length; i++) {
  2785. if (arr[i].drug != null) {
  2786. if (arr[i].drug.is_user == 2) {
  2787. if (arr[i].prescribing_number_unit != arr[i].drug.max_unit && arr[i].prescribing_number_unit != arr[i].drug.min_unit) {
  2788. this.$message.error(arr[i].drug.drug_name + ' ' + arr[i].drug.dose + arr[i].drug.dose_unit + '*' + arr[i].drug.min_number + arr[i].drug.min_unit + '/' + arr[i].drug.max_unit + ' ' + '总量单位不统一,保存失败!')
  2789. isLoading = false
  2790. this.$emit('editKeepLoad', false)
  2791. return
  2792. }
  2793. }
  2794. }
  2795. }
  2796. }
  2797. if (arr_one.length > 0) {
  2798. for (let i = 0; i < arr_one.length; i++) {
  2799. if (arr_one[i].drug != null) {
  2800. if (arr_one[i].drug.is_user == 2) {
  2801. if (arr_one[i].prescribing_number_unit != arr_one[i].drug.max_unit && arr_one[i].prescribing_number_unit != arr_one[i].drug.min_unit) {
  2802. this.$message.error(arr_one[i].drug.drug_name + ' ' + arr_one[i].drug.dose + arr_one[i].drug.dose_unit + '*' + arr_one[i].drug.min_number + arr_one[i].drug.min_unit + '/' + arr_one[i].drug.max_unit + ' ' + '总量单位不匹配,保存失败!')
  2803. isLoading = false
  2804. this.$emit('editKeepLoad', false)
  2805. return
  2806. }
  2807. }
  2808. }
  2809. }
  2810. }
  2811. if (arr_Two.length > 0) {
  2812. for (let i = 0; i < arr_Two.length; i++) {
  2813. if (arr_Two[i].drug != null) {
  2814. if (arr_Two[i].drug.is_user == 2) {
  2815. if (arr_Two[i].prescribing_number_unit != arr_Two[i].drug.max_unit && arr_Two[i].prescribing_number_unit != arr_Two[i].drug.min_unit) {
  2816. this.$message.error(arr_Two[i].drug.drug_name + ' ' + arr_Two[i].drug.dose + arr_Two[i].drug.dose_unit + '*' + arr_Two[i].drug.min_number + arr_Two[i].drug.min_unit + '/' + arr_Two[i].drug.max_unit + ' ' + '总量单位不匹配,保存失败!')
  2817. isLoading = false
  2818. this.$emit('editKeepLoad', false)
  2819. return
  2820. }
  2821. }
  2822. }
  2823. }
  2824. }
  2825. if (this.org_id == 9671 || this.org_id == 9675 || this.org_id == 9679) {
  2826. var project_arr = []
  2827. //耗材
  2828. for (let i = 0; i < this.prescriptions.length; i++) {
  2829. if (this.prescriptions[i].id == 0) {
  2830. for (let j = 0; j < this.prescriptions[i].project.length; j++) {
  2831. if (this.prescriptions[i].project[j].type == 3) {
  2832. project_arr.push(this.prescriptions[i].project[j])
  2833. }
  2834. }
  2835. }
  2836. }
  2837. if (project_arr.length > 0) {
  2838. let objInfo = {}
  2839. project_arr.forEach((item, index) => {
  2840. let { project_id } = item.project_id
  2841. if (!objInfo[project_id]) {
  2842. objInfo[project_id] = {
  2843. project_id: item.project_id,
  2844. child: [],
  2845. sum_count: item.good_info.sum_count,
  2846. out_count: 0,
  2847. str: item.good_info.good_name + ' ' + item.good_info.specification_name,
  2848. is_user: item.good_info.is_user
  2849. }
  2850. }
  2851. })
  2852. let newProjectArr = Object.values(objInfo)
  2853. for (let i = 0; i < project_arr.length; i++) {
  2854. for (let j = 0; j < newProjectArr.length; j++) {
  2855. if (project_arr[i].project_id == newProjectArr[j].project_id) {
  2856. newProjectArr[j].child.push(project_arr[i])
  2857. }
  2858. }
  2859. }
  2860. for (let i = 0; i < newProjectArr.length; i++) {
  2861. for (let j = 0; j < newProjectArr[i].child.length; j++) {
  2862. newProjectArr[i].out_count += parseInt(newProjectArr[i].child[j].total)
  2863. }
  2864. }
  2865. for (let i = 0; i < newProjectArr.length; i++) {
  2866. if (newProjectArr[i].out_count > newProjectArr[i].sum_count && this.org_id != 10206 && this.org_id != 0) {
  2867. this.$message.error(newProjectArr[i].str + '库存不足,保存失败!')
  2868. isLoading = false
  2869. this.$emit('editKeepLoad', false)
  2870. return
  2871. }
  2872. }
  2873. }
  2874. }
  2875. if (this.org_id == 10721) {
  2876. for (let i = 0; i < data.prescriptions.length; i++) {
  2877. data.prescriptions[i]["diagnoses"] = data.prescriptions[i].diagnose.join(",")
  2878. }
  2879. }
  2880. //针对广州从化意达对单位进行判断
  2881. // 在保存处方的时候,在前端判断,所开的药品里的总量单位是否是最小单位
  2882. // 如果不是,则弹窗提醒“******总量单位不是最小单位,是否继续保存”,
  2883. // 取消 则不往后台提交,继续,则提交给后台
  2884. console.log("this.prescriptions[i].advices[b]")
  2885. // console.log(this.prescriptions[i].advices[b])
  2886. if(this.org_id == 10318){
  2887. var err_msg = ""
  2888. for(let i =0; i < this.prescriptions.length; i++){
  2889. for(let b= 0; b < this.prescriptions[i].advices.length;b++){
  2890. if(this.prescriptions[i].advices[b].prescribing_number_unit !=this.prescriptions[i].advices[b].drug.min_unit && this.prescriptions[i].advices[b].delivery_way.indexOf("口服") != -1 ){
  2891. isLoading = false
  2892. if(err_msg.length == 0){
  2893. err_msg = '<span>' + '<span style="color:red">' + this.prescriptions[i].advices[b].drug_name + '</span>' +"总量单位不是最小单位" + '</span>'
  2894. }else{
  2895. err_msg = err_msg + "</br>"+ '<span>' + '<span style="color:red">' + this.prescriptions[i].advices[b].drug_name + '</span>' +"总量单位不是最小单位" + '</span>'
  2896. }
  2897. }
  2898. }
  2899. }
  2900. if (err_msg.length > 0){
  2901. err_msg = err_msg + "</br>" + '<span style="font-size: 20px">' + "是否继续保存" + '</span>'
  2902. this.$confirm(err_msg, '提示信息', {
  2903. distinguishCancelAndClose: true,
  2904. dangerouslyUseHTMLString: true,
  2905. confirmButtonText: '保存',
  2906. cancelButtonText: '取消'
  2907. })
  2908. .then(() => {
  2909. createHisPrescription(data, params).then(response => {
  2910. if (response.data.state == 1) {
  2911. this.$emit('change', this.patientInfo.id)
  2912. this.$message.success('保存成功!')
  2913. this.$emit('editKeepLoad', false)
  2914. this.$parent.getInitData()
  2915. this.getlist()
  2916. } else {
  2917. this.$message.error(response.data.msg)
  2918. this.$emit('editKeepLoad', false)
  2919. }
  2920. })
  2921. })
  2922. .catch(action => {
  2923. // isLoading = false
  2924. this.$emit('editKeepLoad', false)
  2925. });
  2926. }else{
  2927. createHisPrescription(data, params).then(response => {
  2928. if (response.data.state == 1) {
  2929. this.$emit('change', this.patientInfo.id)
  2930. this.$message.success('保存成功!')
  2931. this.$emit('editKeepLoad', false)
  2932. this.$parent.getInitData()
  2933. this.getlist()
  2934. } else {
  2935. this.$message.error(response.data.msg)
  2936. this.$emit('editKeepLoad', false)
  2937. }
  2938. })
  2939. }
  2940. }else{
  2941. createHisPrescription(data, params).then(response => {
  2942. if (response.data.state == 1) {
  2943. this.$emit('change', this.patientInfo.id)
  2944. this.$message.success('保存成功!')
  2945. this.$emit('editKeepLoad', false)
  2946. this.$parent.getInitData()
  2947. this.getlist()
  2948. if(this.org_id == 10653){ //将数据同步到费森系统
  2949. var that = this
  2950. axios.get('http://127.0.0.1:9531/api/yb/syncadvice', {
  2951. params: {patient_id: this.patientInfo.id}
  2952. })
  2953. .then(function(response) {
  2954. if (response.data.state == 0) {
  2955. that.$message.error(response.data.msg)
  2956. return false
  2957. } else {
  2958. if(response.data.data.status == -1){
  2959. that.$confirm(response.data.data.msg, '错误信息', {
  2960. confirmButtonText: '确 定',
  2961. type: 'warning'
  2962. }).then(() => {
  2963. }).catch(() => {
  2964. })
  2965. }else{
  2966. that.$message.success('同步费森系统成功!')
  2967. }
  2968. }
  2969. })
  2970. .catch(function(error) {
  2971. })
  2972. }
  2973. } else {
  2974. this.$message.error(response.data.msg)
  2975. this.$emit('editKeepLoad', false)
  2976. }
  2977. })
  2978. }
  2979. }
  2980. }
  2981. } else if (index == 2) {
  2982. this.$router.push('/outpatientDoctorStation/print')
  2983. } else if (index == 4) {
  2984. } else if (index == 5) {
  2985. this.$refs.saveTemplate.show()
  2986. }
  2987. } else if (this.dayorMonth == 'month') {
  2988. if (this.isShowDayPrescription) {
  2989. // if (this.curDayPrescriptions.order_status == 2) {
  2990. // this.$message.error('当前处方已经结算,无法保存')
  2991. // return
  2992. // }
  2993. if (this.doctorValue.length <= 0) {
  2994. this.$message.error('医生不能为空')
  2995. return
  2996. }
  2997. if (this.departmentValue.length <= 0) {
  2998. this.$message.error('科室不能为空')
  2999. return
  3000. }
  3001. var str = ''
  3002. if (patient_diagnose != '') {
  3003. str = this.patient_diagnose.join(',')
  3004. }
  3005. if (index == 1) {
  3006. let params = {
  3007. patient_id: this.patientInfo.id,
  3008. diagnose: this.diagnose.join(','),
  3009. sick_type: this.state1,
  3010. sick_history: this.state2,
  3011. doctor: this.doctorValue,
  3012. department: this.departmentValue,
  3013. record_date: this.end_time,
  3014. his_patient_id: this.hisPatientInfo.id,
  3015. reg_type: this.register_type,
  3016. p_type: 2,
  3017. patient_diagnose: str
  3018. }
  3019. var month_prescriptions = this.deepClone(this.month_prescriptions)
  3020. for (let i = 0; i < month_prescriptions.length; i++) {
  3021. if (month_prescriptions[i].advices.length > 0 && month_prescriptions[i].project.length == 0) {
  3022. month_prescriptions[i]['type'] = 1
  3023. }
  3024. if (month_prescriptions[i].advices.length == 0 && month_prescriptions[i].project.length > 0) {
  3025. month_prescriptions[i]['type'] = 2
  3026. }
  3027. for (let b = 0; b < month_prescriptions[i].advices.length; b++) {
  3028. month_prescriptions[i].advices[b].single_dose = month_prescriptions[i].advices[b].single_dose.toString()
  3029. month_prescriptions[i].advices[b].prescribing_number = month_prescriptions[i].advices[b].prescribing_number.toString()
  3030. month_prescriptions[i].advices[b].retail_price = month_prescriptions[i].advices[b].retail_price.toString()
  3031. month_prescriptions[i].advices[b].day = parseInt(month_prescriptions[i].advices[b].day)
  3032. }
  3033. for (let b = 0; b < month_prescriptions[i].project.length; b++) {
  3034. month_prescriptions[i].project[b].price = month_prescriptions[i].project[b].price.toString()
  3035. month_prescriptions[i].project[b].total = month_prescriptions[i].project[b].total.toString()
  3036. month_prescriptions[i].project[b].delivery_way = month_prescriptions[i].project[b].delivery_way.toString()
  3037. }
  3038. for (let b = 0; b < month_prescriptions[i].addition.length; b++) {
  3039. month_prescriptions[i].addition[b].id = parseInt(month_prescriptions[i].addition[b].id)
  3040. month_prescriptions[i].addition[b].item_id = parseInt(month_prescriptions[i].addition[b].item_id)
  3041. month_prescriptions[i].addition[b].price = month_prescriptions[i].addition[b].price.toString()
  3042. month_prescriptions[i].addition[b].count = month_prescriptions[i].addition[b].count.toString()
  3043. }
  3044. }
  3045. let data = {
  3046. 'prescriptions': month_prescriptions
  3047. }
  3048. editHisPrescription(data, params).then(response => {
  3049. if (response.data.state == 1) {
  3050. this.month_prescriptions = month_prescriptions
  3051. this.$message.success('编辑成功')
  3052. }
  3053. })
  3054. }
  3055. }
  3056. }
  3057. }, judgmentsDrugStock(bby01, bbx01, name, count, isLoading) {
  3058. for (let i = 0; i < this.zuobiao_drug.length; i++) {
  3059. if (this.zuobiao_drug[i].bby01 == bby01) {
  3060. if (this.zuobiao_drug[i].sysl < parseInt(count)) {
  3061. isLoading = false
  3062. this.$message.error(name + '库存不足,无法保存')
  3063. return
  3064. }
  3065. }
  3066. }
  3067. }, judgmentsGoodStock(bby01, bbx01, name, specification_name, count, isLoading) {
  3068. for (let i = 0; i < this.zuobiao_project.length; i++) {
  3069. if (this.zuobiao_project[i].bbx01 == bbx01 && this.zuobiao_project[i].bby06 == specification_name) {
  3070. if (this.zuobiao_project[i].lsqty < parseInt(count)) {
  3071. isLoading = false
  3072. this.$message.error(name + '库存不足,无法保存')
  3073. return
  3074. }
  3075. }
  3076. }
  3077. },
  3078. addTab(targetName) {
  3079. // for (let i = 0; i < this.prescriptions.length; i++) {
  3080. // if (this.prescriptions[i].is_medicine_status) {
  3081. // this.$message.error('处方中包含已发药处方,无法新增')
  3082. // return
  3083. // }
  3084. // }
  3085. // for(let i = 0; i < this.prescriptions.length; i++){
  3086. // if (this.prescriptions[i].order_status == 2 || this.prescriptions[i].order_status == 4) {
  3087. // this.$message.error('处方中包含已收费处方或者包含已经上传的处方,无法新增')
  3088. // return
  3089. // }
  3090. // }
  3091. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length == 0) {
  3092. this.$message.error('当前处方无数据,新增数据后才能新增处方')
  3093. return
  3094. }
  3095. this.tabIndex = this.prescriptions.length
  3096. var str = this.prescriptions[this.prescriptions.length - 1].name
  3097. var reg = /[\u4e00-\u9fa5]/g
  3098. // var str= " 阿达 adas 123132 一二三 ";
  3099. // str= str.replace(/[ ]/g, "");//去空格
  3100. // str= ;//去除中文
  3101. this.tabIndex = parseInt(str.replace(reg, ''))
  3102. ++this.tabIndex
  3103. let newTabName = '处方' + this.tabIndex
  3104. var nowDate = new Date()
  3105. var nowYear = nowDate.getFullYear()
  3106. var nowMonth = nowDate.getMonth() + 1
  3107. var nowDay = nowDate.getDate()
  3108. var hours = nowDate.getHours()
  3109. var min = nowDate.getMinutes()
  3110. var nowTime =
  3111. nowYear +
  3112. '-' +
  3113. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  3114. '-' +
  3115. (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + (hours < 10 ? '0' + hours : hours) +
  3116. ':' + (min < 10 ? '0' + min : min)
  3117. var preTime = ''
  3118. console.log(nowTime.split(' ')[0])
  3119. console.log(this.record_date)
  3120. if (nowTime.split(' ')[0] != this.record_date) {
  3121. preTime = this.record_date + ' ' + (hours < 10 ? '0' + hours : hours) +
  3122. ':' + (min < 10 ? '0' + min : min)
  3123. } else {
  3124. preTime = nowTime
  3125. }
  3126. let obj = {
  3127. id: 0,
  3128. name: newTabName,
  3129. order_status: 0,
  3130. advices: [],
  3131. project: [],
  3132. addition: [],
  3133. diagnose:"",
  3134. pre_time: preTime
  3135. }
  3136. if (this.org_id != 10206) {
  3137. obj.med_type = 14
  3138. if (this.org_id == 10721 || this.org_id == 0){
  3139. obj.med_type = 992102
  3140. }
  3141. } else {
  3142. obj.med_type = 12
  3143. }
  3144. this.prescriptions.push(obj)
  3145. this.editableTabsValue = newTabName
  3146. this.curPrescriptions = this.prescriptions[this.prescriptions.length - 1]
  3147. this.curStatus = 0
  3148. if (this.curPrescriptions.order_status == 0) {
  3149. this.order_status = '未收费'
  3150. }
  3151. if (this.curPrescriptions.order_status == 1) {
  3152. this.order_status = '未收费'
  3153. }
  3154. if (this.curPrescriptions.order_status == 2) {
  3155. this.order_status = '已结算'
  3156. }
  3157. if (this.curPrescriptions.order_status == 3) {
  3158. this.order_status = '已退费'
  3159. }
  3160. this.teamList = []
  3161. this.$refs.tables.clearSelection()
  3162. this.showOne = true
  3163. this.showTwo = false
  3164. this.showThree = false
  3165. this.customTabIndex = 1
  3166. this.rightTab = 1
  3167. },
  3168. removeTab(targetName) {
  3169. if (this.curPrescriptions.order_status == 2 || this.curPrescriptions.order_status == 5 ) {
  3170. this.$message.error('该处方已经结算或者记账,无法删除')
  3171. return
  3172. }
  3173. for(let i = 0; i < this.curPrescriptions.advices.length; i++){
  3174. if(this.curPrescriptions.advices[i].is_medicine == 1){
  3175. this.$message.error('该处方已发药,无法删除')
  3176. return
  3177. }
  3178. }
  3179. this.$confirm('处方删除后不可恢复,是否确认删除', '删除', {
  3180. confirmButtonText: '确 定',
  3181. cancelButtonText: '取 消',
  3182. type: 'warning'
  3183. }).then(() => {
  3184. let id = 0
  3185. for (let i = 0; i < this.prescriptions.length; i++) {
  3186. if (this.prescriptions[i].name == targetName) {
  3187. id = this.prescriptions[i].id
  3188. }
  3189. }
  3190. if (id == 0) {
  3191. let tabs = this.prescriptions
  3192. let activeName = this.editableTabsValue
  3193. if (activeName === targetName) {
  3194. tabs.forEach((tab, index) => {
  3195. if (tab.name === targetName) {
  3196. let nextTab = tabs[index + 1] || tabs[index - 1]
  3197. if (nextTab) {
  3198. activeName = nextTab.name
  3199. }
  3200. }
  3201. })
  3202. }
  3203. this.editableTabsValue = activeName
  3204. this.prescriptions = tabs.filter(tab => tab.name !== targetName)
  3205. for (let i = 0; i < this.prescriptions.length; i++) {
  3206. if (activeName == this.prescriptions[i].name) {
  3207. this.curPrescriptions = this.prescriptions[i]
  3208. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  3209. this.curStatus = 1
  3210. }
  3211. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  3212. this.curStatus = 2
  3213. }
  3214. }
  3215. }
  3216. if (this.prescriptions.length == 0) {
  3217. this.curPrescriptions = []
  3218. this.curStatus = 0
  3219. }
  3220. this.$parent.getInitDataOne(this.prescriptions)
  3221. } else {
  3222. let params = {
  3223. 'id': id
  3224. }
  3225. delHisPrescription(params).then(response => {
  3226. if (response.data.state == 1) {
  3227. this.$message.success('删除成功!')
  3228. let tabs = this.prescriptions
  3229. let activeName = this.editableTabsValue
  3230. if (activeName === targetName) {
  3231. tabs.forEach((tab, index) => {
  3232. if (tab.name === targetName) {
  3233. let nextTab = tabs[index + 1] || tabs[index - 1]
  3234. if (nextTab) {
  3235. activeName = nextTab.name
  3236. }
  3237. }
  3238. })
  3239. }
  3240. this.editableTabsValue = activeName
  3241. this.prescriptions = tabs.filter(tab => tab.name !== targetName)
  3242. for (let i = 0; i < this.prescriptions.length; i++) {
  3243. if (activeName == this.prescriptions[i].name) {
  3244. this.curPrescriptions = this.prescriptions[i]
  3245. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  3246. this.curStatus = 1
  3247. }
  3248. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  3249. this.curStatus = 2
  3250. }
  3251. }
  3252. }
  3253. if (this.prescriptions.length == 0) {
  3254. this.curPrescriptions = []
  3255. this.curStatus = 0
  3256. }
  3257. this.$parent.getInitData()
  3258. this.$parent.getInitDataOne(this.prescriptions)
  3259. } else {
  3260. this.$message.error(response.data.msg)
  3261. }
  3262. })
  3263. }
  3264. }).catch(() => {
  3265. })
  3266. },
  3267. beforeLeave(activeName, oldActiveName) {
  3268. let index = activeName
  3269. if (index == 1) {
  3270. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  3271. return false
  3272. }
  3273. } else {
  3274. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  3275. return false
  3276. }
  3277. }
  3278. },
  3279. clickTab(tab) {
  3280. let index = parseInt(tab.name)
  3281. if (index == 1) {
  3282. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  3283. this.$message.error('当前处方为项目,无法切换为药品,需要新开处方')
  3284. return
  3285. }
  3286. } else {
  3287. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  3288. this.$message.error('当前处方为药品,无法切换为项目,需要新开处方')
  3289. return
  3290. }
  3291. }
  3292. if (index == 1) {
  3293. this.teamList = []
  3294. this.$refs.tables.clearSelection()
  3295. this.showOne = true
  3296. this.showTwo = false
  3297. this.showThree = false
  3298. this.$nextTick(() => {
  3299. this.$refs.prescription_tables.setNewData(this.prescriptions[this.prescriptions.length - 1])
  3300. })
  3301. this.customTabIndex = 1
  3302. }
  3303. if (index == 2) {
  3304. this.curDrugs = []
  3305. this.$refs.multipleTable.clearSelection()
  3306. this.showTwo = true
  3307. this.showOne = false
  3308. this.showThree = false
  3309. this.$nextTick(() => {
  3310. this.$refs.prescription_tables.setNewData(this.prescriptions[this.prescriptions.length - 1])
  3311. })
  3312. this.customTabIndex = 2
  3313. }
  3314. if (index == 3) {
  3315. this.curDrugs = []
  3316. this.$refs.multipleTable.clearSelection()
  3317. this.showTwo = false
  3318. this.showOne = false
  3319. this.showThree = true
  3320. this.$nextTick(() => {
  3321. this.$refs.prescription_tables.setNewData(this.prescriptions[this.prescriptions.length - 1])
  3322. })
  3323. this.customTabIndex = 2
  3324. }
  3325. console.log(this.customTabIndex)
  3326. console.log( this.rightTab )
  3327. this.rightTab = index
  3328. //用来区分处方属于项目还是药品
  3329. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  3330. this.customTabIndex = 1
  3331. this.curStatus = 1
  3332. }
  3333. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  3334. this.customTabIndex = 2
  3335. this.curStatus = 2
  3336. }
  3337. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length == 0) {
  3338. // this.customTabIndex = this.rightTab
  3339. if(index == 1){
  3340. this.customTabIndex = 1
  3341. this.curStatus = 1
  3342. }else if(index == 2){
  3343. this.customTabIndex = 2
  3344. this.curStatus = 2
  3345. }else{
  3346. this.customTabIndex = 2
  3347. this.curStatus = 2
  3348. }
  3349. }
  3350. }, changeAllGoodInfoTableData: function(selection) {
  3351. this.curDrugs = selection
  3352. }, addCharges() {
  3353. this.$refs.additionalCharges.show()
  3354. },
  3355. selectDrugs(selection, row) {
  3356. // if(this.org_id == 10138 || this.org_id == 9671 || this.org_id == 9675 || this.org_id == 4 || this.org_id == 3877 || this.org_id == 10028 || this.org_id == 10243 || this.org_id == 10188 || this.org_id == 10245 || this.org_id == 9919 || this.org_id == 10106 || this.org_id == 9504 || this.org_id ==10215 || this.org_id == 10188 || this.org_id == 10265 || this.org_id == 10164 || this.org_id == 9956 || this.org_id == 10188 || this.org_id == 10191 || this.org_id == 10278 || this.org_id == 10217 || this.org_id ==10210 || this.org_id ==10318 || this.org_id ==10340){
  3357. // if (row.count <= 0) {
  3358. // if (selection) {
  3359. // selection.forEach(row => {
  3360. // if (row.count <= 0) {
  3361. // this.$refs.multipleTable.toggleRowSelection(row)
  3362. // }
  3363. // })
  3364. // } else {
  3365. // this.$refs.multipleTable.clearSelection()
  3366. // }
  3367. // this.$message.error(row.drug_name + '库存不足')
  3368. // return
  3369. // }
  3370. // }else{
  3371. // if (row.total <= 0) {
  3372. // if (selection) {
  3373. // selection.forEach(row => {
  3374. // if (row.total <= 0) {
  3375. // this.$refs.multipleTable.toggleRowSelection(row)
  3376. // }
  3377. // })
  3378. // } else {
  3379. // this.$refs.multipleTable.clearSelection()
  3380. // }
  3381. // this.$message.error(row.drug_name + '库存不足')
  3382. // return
  3383. // }
  3384. // }
  3385. if (row.is_user != 1 && this.org_id != 10206) {
  3386. console.log('row.sum_count', row)
  3387. if (row.sum_count <= 0) {
  3388. if (selection) {
  3389. selection.forEach(row => {
  3390. if (row.is_project != 1) {
  3391. if (row.sum_count <= 0) {
  3392. this.$refs.multipleTable.toggleRowSelection(row)
  3393. }
  3394. }
  3395. })
  3396. } else {
  3397. this.$refs.multipleTable.clearSelection()
  3398. }
  3399. if (row.is_project == 0 || row.is_project == 2) {
  3400. this.$message.error(row.drug_name + '库存不足')
  3401. return
  3402. }
  3403. }
  3404. }
  3405. if (this.org_id == 10206) {
  3406. if (row.zuobiao_stock_num <= 0) {
  3407. if (selection) {
  3408. selection.forEach(row => {
  3409. if (row.zuobiao_stock_num <= 0) {
  3410. this.$refs.multipleTable.toggleRowSelection(row)
  3411. }
  3412. })
  3413. } else {
  3414. this.$refs.multipleTable.clearSelection()
  3415. }
  3416. this.$message.error(row.drug_name + '库存不足')
  3417. return
  3418. }
  3419. }
  3420. this.curDrugs = selection
  3421. },
  3422. comfirm() {
  3423. if (this.teamList.length > 0) {
  3424. let arr = this.teamList
  3425. let newArr = []
  3426. arr.map(item => {
  3427. if (this.curPrescriptions.med_type != 14) {
  3428. newArr.push(item)
  3429. }
  3430. if (this.curPrescriptions.med_type == 14 && item.is_special_diseases == 1) {
  3431. newArr.push(item)
  3432. }
  3433. })
  3434. this.teamList = newArr
  3435. }
  3436. if (this.curStatus == 1 && this.rightTab == 2) {
  3437. this.$message.error('该处方是药品,无法添加项目')
  3438. this.teamList = []
  3439. this.$refs.tables.clearSelection()
  3440. return
  3441. }
  3442. if (this.curStatus == 2 && this.rightTab == 1) {
  3443. this.$message.error('该处方是项目,无法添加药品')
  3444. this.curDrugs = []
  3445. this.tempDrugs = []
  3446. this.$refs.multipleTable.clearSelection()
  3447. this.$refs.multipleTableTwo.clearSelection()
  3448. return
  3449. }
  3450. for (let i = 0; i < this.teamList.length; i++) {
  3451. for (let a = 0; a < this.curPrescriptions.project.length; a++) {
  3452. if (this.teamList[i].id == this.curPrescriptions.project[a].project_id && this.teamList[i].type == this.curPrescriptions.project[a].type) {
  3453. // this.$message.error('当前处方存在相同的药品,无法添加相同的项目')
  3454. // return
  3455. }
  3456. }
  3457. }
  3458. for (let i = 0; i < this.curDrugs.length; i++) {
  3459. for (let a = 0; a < this.curPrescriptions.advices.length; a++) {
  3460. if (this.curDrugs[i].id == this.curPrescriptions.advices[a].id) {
  3461. // this.$message.error('当前处方存在相同的药品,无法添加相同的药品')
  3462. // return
  3463. }
  3464. }
  3465. }
  3466. let templateDrugs = []
  3467. for (let i = 0; i < this.tempDrugs.length; i++) {
  3468. for (let a = 0; a < this.tempDrugs[i].advices.length; a++) {
  3469. templateDrugs.push(this.tempDrugs[i].advices[a])
  3470. }
  3471. }
  3472. //大丰限制用药提醒逻辑
  3473. var temp = this.deepClone(this.curDrugs)
  3474. console.log('-----~~~~')
  3475. console.log(temp)
  3476. console.log('-----~~~~')
  3477. let limit_remark = ''
  3478. if (temp.length > 0) {
  3479. for (let b = 0; b < temp.length; b++) {
  3480. if (temp[b].limit_remark.length > 0) {
  3481. if (limit_remark.length == 0) {
  3482. limit_remark = temp[b].limit_remark
  3483. } else {
  3484. limit_remark = limit_remark + '\n' + temp[b].limit_remark
  3485. }
  3486. }
  3487. }
  3488. }
  3489. if ((limit_remark.length > 0 && this.org_id == 10217)) {
  3490. var that = this
  3491. this.$confirm(limit_remark, '限制用药提醒', {
  3492. confirmButtonText: '确 定',
  3493. cancelButtonText: '取 消',
  3494. type: 'warning'
  3495. }).then(() => {
  3496. for (let i = 0; i < that.prescriptions.length; i++) {
  3497. if (that.prescriptions[i].name == that.editableTabsValue) {
  3498. var temp = that.deepClone(that.curDrugs)
  3499. var temp2 = that.deepClone(that.teamList)
  3500. var temp3 = that.deepClone(templateDrugs)
  3501. if (temp3.length > 0) {
  3502. for (let b = 0; b < temp3.length; b++) {
  3503. let obj = {
  3504. advice_id: 0,
  3505. id: temp3[b].id,
  3506. drug_name: temp3[b].advice_name,
  3507. single_dose: temp3[b].single_dose.toString(),
  3508. delivery_way: temp3[b].delivery_way,
  3509. execution_frequency: temp3[b].execution_frequency,
  3510. retail_price: temp3[b].drug.retail_price.toString(),
  3511. remark: '',
  3512. day: '1',
  3513. is_medicine:0,
  3514. prescribing_number: temp3[b].prescribing_number,
  3515. single_dose_unit: temp3[b].drug.drug_dose_unit,
  3516. prescribing_number_unit: temp3[b].drug.prescribing_number_unit,
  3517. medical_insurance_number: temp3[b].drug.medical_insurance_number
  3518. }
  3519. if (obj.prescribing_number == 0 || obj.prescribing_number.length == 0) {
  3520. obj.prescribing_number = 1
  3521. }
  3522. that.prescriptions[i].advices.push(obj)
  3523. }
  3524. that.curStatus = 1
  3525. }
  3526. let index = 0
  3527. if (that.curPrescriptions.advices.length > 0) {
  3528. index = that.curPrescriptions.advices.length
  3529. }
  3530. let maxIndexAdvice = null
  3531. if (that.curPrescriptions.advices.length > 0) {
  3532. for (let i = 0; i < that.curPrescriptions.advices.length; i++) {
  3533. // 获取当前对象
  3534. let currentAdvice = that.curPrescriptions.advices[i]
  3535. // 如果 maxIndexAdvice 为空或当前对象的序号大于最大序号对象的序号,则更新最大序号对象
  3536. if (maxIndexAdvice == null) {
  3537. maxIndexAdvice = currentAdvice
  3538. } else if (maxIndexAdvice != null) {
  3539. if (currentAdvice.groupno > maxIndexAdvice.groupno) {
  3540. maxIndexAdvice = currentAdvice
  3541. }
  3542. }
  3543. }
  3544. } else {
  3545. maxIndexAdvice = tempMaxIndexAdvice
  3546. }
  3547. console.log(maxIndexAdvice)
  3548. if (temp.length > 0) {
  3549. for (let b = 0; b < temp.length; b++) {
  3550. if (temp[b].max_unit == temp[b].min_unit) {
  3551. temp[b].retail_price = temp[b].min_price
  3552. }
  3553. let temp_index = 0
  3554. if (that.org_id == 0 || that.org_id == 10206) {
  3555. temp_index = maxIndexAdvice.groupno
  3556. } else {
  3557. temp_index = b + 1
  3558. }
  3559. let obj = {
  3560. advice_id: 0,
  3561. id: temp[b].id,
  3562. drug_name: temp[b].drug_name,
  3563. single_dose: temp[b].single_dose,
  3564. delivery_way: temp[b].delivery_way,
  3565. execution_frequency: temp[b].execution_frequency,
  3566. retail_price: temp[b].prescribing_number_unit == temp[b].max_unit ? temp[b].retail_price.toString() : temp[b].min_price.toString(),
  3567. remark: '',
  3568. day: temp[b].drug_day ? temp[b].drug_day : 1,
  3569. prescribing_number: temp[b].prescribing_number,
  3570. single_dose_unit: temp[b].dose_unit,
  3571. prescribing_number_unit: temp[b].prescribing_number_unit,
  3572. medical_insurance_number: temp[b].medical_insurance_number,
  3573. drug: temp[b],
  3574. is_medicine:0,
  3575. groupno: index + temp_index,
  3576. hosp_appr_flag: '1',
  3577. execution_state: 2
  3578. }
  3579. if (obj.prescribing_number == 0 || obj.prescribing_number.length == 0) {
  3580. obj.prescribing_number = 1
  3581. }
  3582. // 针对灵山圣康
  3583. if (that.org_id == 0 || that.org_id == 10375) {
  3584. if (that.prescriptions[i] != null) {
  3585. console.log('禅古this.prescriptions[i].advices.length', that.prescriptions[i].advices.length)
  3586. if (that.prescriptions[i].advices.length >= 5) {
  3587. that.$message.error('添加条数已经大于5条,添加失败!')
  3588. return false
  3589. }
  3590. }
  3591. }
  3592. that.prescriptions[i].advices.push(obj)
  3593. }
  3594. that.curStatus = 1
  3595. }
  3596. if (temp2.length > 0) {
  3597. for (let b = 0; b < temp2.length; b++) {
  3598. let obj = {
  3599. id: 0,
  3600. project_id: temp2[b].id,
  3601. project_name: temp2[b].project_name,
  3602. statistical_classification: '',
  3603. single_dose: temp2[b].single_dose.toString(),
  3604. delivery_way: temp2[b].delivery_way,
  3605. execution_frequency: temp2[b].execution_frequency,
  3606. number_days: temp2[b].number_days.toString(),
  3607. total: temp2[b].cus_total,
  3608. price: temp2[b].price,
  3609. remark: '',
  3610. medical_code: temp2[b].medical_code,
  3611. type: temp2[b].type,
  3612. execution_state: 2
  3613. }
  3614. if (temp2[b].type == 2) {
  3615. obj['project'] = temp2[b].project
  3616. obj['unit'] = temp2[b].project.unit
  3617. } else if (temp2[b].type == 3) {
  3618. obj['good_info'] = temp2[b].good_info
  3619. obj['unit'] = temp2[b].good_info.packing_unit
  3620. }
  3621. if (temp2[b].team_id == undefined) {
  3622. obj['team_id'] = 0
  3623. } else {
  3624. obj['team_id'] = temp2[b].team_id
  3625. }
  3626. if (obj.total == 0 || obj.total == undefined) {
  3627. obj.total = 1
  3628. }
  3629. if (obj.type == 3) {
  3630. obj.single_dose = 1
  3631. }
  3632. // 针对灵山圣康
  3633. // if (this.org_id == 0 || this.org_id == 10375) {
  3634. // if (this.prescriptions[i] != null) {
  3635. // if (this.prescriptions[i].project.length >= 5) {
  3636. // this.$message.error('添加条数已经大于5条,添加失败!')
  3637. // return false
  3638. // }
  3639. // }
  3640. // }
  3641. that.prescriptions[i].project.push(obj)
  3642. }
  3643. that.curStatus = 2
  3644. }
  3645. that.curPrescriptions = that.prescriptions[i]
  3646. that.$refs.multipleTable.clearSelection()
  3647. that.$refs.tables.clearSelection()
  3648. that.clearSelection()
  3649. }
  3650. }
  3651. that.curDrugs = []
  3652. that.preDrugs = []
  3653. that.teamList = []
  3654. }).catch(() => {
  3655. })
  3656. } else {
  3657. for (let i = 0; i < this.prescriptions.length; i++) {
  3658. if (this.prescriptions[i].name == this.editableTabsValue) {
  3659. var temp = this.deepClone(this.curDrugs)
  3660. var temp2 = this.deepClone(this.teamList)
  3661. console.log(this.teamList)
  3662. var temp3 = this.deepClone(templateDrugs)
  3663. if (temp3.length > 0) {
  3664. for (let b = 0; b < temp3.length; b++) {
  3665. let obj = {
  3666. advice_id: 0,
  3667. id: temp3[b].id,
  3668. drug_name: temp3[b].advice_name,
  3669. single_dose: temp3[b].single_dose.toString(),
  3670. delivery_way: temp3[b].delivery_way,
  3671. execution_frequency: temp3[b].execution_frequency,
  3672. retail_price: temp3[b].drug.retail_price.toString(),
  3673. remark: '',
  3674. day: '1',
  3675. is_medicine:0,
  3676. prescribing_number: temp3[b].prescribing_number,
  3677. single_dose_unit: temp3[b].drug.drug_dose_unit,
  3678. prescribing_number_unit: temp3[b].drug.prescribing_number_unit,
  3679. medical_insurance_number: temp3[b].drug.medical_insurance_number
  3680. }
  3681. if (obj.prescribing_number == 0 || obj.prescribing_number.length == 0) {
  3682. obj.prescribing_number = 1
  3683. }
  3684. this.prescriptions[i].advices.push(obj)
  3685. }
  3686. this.curStatus = 1
  3687. }
  3688. let index = 0
  3689. if (this.curPrescriptions.advices.length > 0) {
  3690. index = this.curPrescriptions.advices.length
  3691. }
  3692. let tempMaxIndexAdvice = {
  3693. groupno: 0
  3694. }
  3695. let maxIndexAdvice = null
  3696. if (this.curPrescriptions.advices.length > 0) {
  3697. for (let i = 0; i < this.curPrescriptions.advices.length; i++) {
  3698. // 获取当前对象
  3699. let currentAdvice = this.curPrescriptions.advices[i]
  3700. // 如果 maxIndexAdvice 为空或当前对象的序号大于最大序号对象的序号,则更新最大序号对象
  3701. if (maxIndexAdvice == null) {
  3702. maxIndexAdvice = currentAdvice
  3703. } else if (maxIndexAdvice != null) {
  3704. if (currentAdvice.groupno > maxIndexAdvice.groupno) {
  3705. maxIndexAdvice = currentAdvice
  3706. }
  3707. }
  3708. }
  3709. } else {
  3710. maxIndexAdvice = tempMaxIndexAdvice
  3711. }
  3712. if (temp.length > 0) {
  3713. for (let b = 0; b < temp.length; b++) {
  3714. if (temp[b].max_unit == temp[b].min_unit) {
  3715. temp[b].retail_price = temp[b].min_price
  3716. }
  3717. let temp_index = 0
  3718. if (this.org_id == 0 || this.org_id == 10206) {
  3719. temp_index = maxIndexAdvice.groupno
  3720. } else {
  3721. temp_index = b + 1
  3722. }
  3723. let obj = {
  3724. advice_id: 0,
  3725. id: temp[b].id,
  3726. drug_name: temp[b].drug_name,
  3727. single_dose: temp[b].single_dose,
  3728. delivery_way: temp[b].delivery_way,
  3729. execution_frequency: temp[b].execution_frequency,
  3730. retail_price: temp[b].prescribing_number_unit == temp[b].max_unit ? temp[b].retail_price.toString() : temp[b].min_price.toString(),
  3731. remark: '',
  3732. day: temp[b].drug_day ? temp[b].drug_day : 1,
  3733. prescribing_number: temp[b].prescribing_number,
  3734. single_dose_unit: temp[b].dose_unit,
  3735. prescribing_number_unit: temp[b].prescribing_number_unit,
  3736. medical_insurance_number: temp[b].medical_insurance_number,
  3737. drug: temp[b],
  3738. groupno: index + temp_index,
  3739. hosp_appr_flag: '1',
  3740. execution_state: 2,
  3741. is_medicine:0,
  3742. }
  3743. if (obj.prescribing_number == 0 || obj.prescribing_number.length == 0) {
  3744. obj.prescribing_number = 1
  3745. }
  3746. // 针对灵山圣康
  3747. if (this.org_id == 0 || this.org_id == 10375) {
  3748. if (this.prescriptions[i] != null) {
  3749. console.log('禅古this.prescriptions[i].advices.length', this.prescriptions[i].advices.length)
  3750. if (this.prescriptions[i].advices.length >= 5) {
  3751. this.$message.error('添加条数已经大于5条,添加失败!')
  3752. return false
  3753. }
  3754. }
  3755. }
  3756. this.prescriptions[i].advices.push(obj)
  3757. }
  3758. this.curStatus = 1
  3759. }
  3760. var advices = []
  3761. if (temp2.length > 0) {
  3762. for (let b = 0; b < temp2.length; b++) {
  3763. if(temp2[b].type == 1){
  3764. if (temp2[b].max_unit == temp2[b].min_unit) {
  3765. temp2[b].retail_price = temp2[b].min_price
  3766. }
  3767. let temp_index = 0
  3768. if (this.org_id == 0 || this.org_id == 10206) {
  3769. temp_index = maxIndexAdvice.groupno
  3770. } else {
  3771. temp_index = b + 1
  3772. }
  3773. let obj = {
  3774. advice_id: 0,
  3775. id: temp2[b].id,
  3776. drug_name: temp2[b].drug.drug_name,
  3777. single_dose: temp2[b].single_dose,
  3778. delivery_way: temp2[b].delivery_way,
  3779. execution_frequency: temp2[b].execution_frequency,
  3780. retail_price: temp2[b].prescribing_number_unit == temp2[b].drug.max_unit ? temp2[b].drug.retail_price.toString() : temp2[b].drug.min_price.toString(),
  3781. remark: '',
  3782. day: temp2[b].day,
  3783. prescribing_number: temp2[b].prescribing_number,
  3784. single_dose_unit: temp2[b].single_dose_unit,
  3785. prescribing_number_unit: temp2[b].prescribing_number_unit,
  3786. medical_insurance_number: temp2[b].medical_insurance_number,
  3787. drug: temp2[b].drug,
  3788. groupno: index + temp_index,
  3789. hosp_appr_flag: '1',
  3790. execution_state: 2,
  3791. is_medicine:0,
  3792. }
  3793. if (obj.prescribing_number == 0 || obj.prescribing_number.length == 0) {
  3794. obj.prescribing_number = 1
  3795. }
  3796. advices.push(obj)
  3797. }else{
  3798. let obj = {
  3799. id: 0,
  3800. project_id: temp2[b].id,
  3801. project_name: temp2[b].project_name,
  3802. statistical_classification: '',
  3803. single_dose: temp2[b].single_dose.toString(),
  3804. delivery_way: temp2[b].delivery_way,
  3805. execution_frequency: temp2[b].execution_frequency,
  3806. number_days: temp2[b].number_days.toString(),
  3807. total: temp2[b].cus_total,
  3808. price: temp2[b].price,
  3809. remark: '',
  3810. medical_code: temp2[b].medical_code,
  3811. type: temp2[b].type,
  3812. execution_state: 2
  3813. }
  3814. if (temp2[b].type == 2) {
  3815. obj['project'] = temp2[b].project
  3816. obj['unit'] = temp2[b].project.unit
  3817. } else if (temp2[b].type == 3) {
  3818. obj['good_info'] = temp2[b].good_info
  3819. obj['unit'] = temp2[b].good_info.packing_unit
  3820. }
  3821. if (temp2[b].team_id == undefined) {
  3822. obj['team_id'] = 0
  3823. } else {
  3824. obj['team_id'] = temp2[b].team_id
  3825. }
  3826. if (obj.total == 0 || obj.total == undefined) {
  3827. obj.total = 1
  3828. }
  3829. if (obj.type == 3) {
  3830. obj.single_dose = 1
  3831. }
  3832. this.prescriptions[i].project.push(obj)
  3833. }
  3834. this.curStatus = 2
  3835. }
  3836. }
  3837. var nowDate = new Date()
  3838. var nowYear = nowDate.getFullYear()
  3839. var nowMonth = nowDate.getMonth() + 1
  3840. var nowDay = nowDate.getDate()
  3841. var hours = nowDate.getHours()
  3842. var min = nowDate.getMinutes()
  3843. var nowTime =
  3844. nowYear +
  3845. '-' +
  3846. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  3847. '-' +
  3848. (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + (hours < 10 ? '0' + hours : hours) +
  3849. ':' + (min < 10 ? '0' + min : min)
  3850. if(advices.length > 0){
  3851. let index = this.prescriptions.length + 1
  3852. let obj = {
  3853. id: 0,
  3854. name: '处方' + index,
  3855. advices: advices,
  3856. project: [],
  3857. addition: [],
  3858. diagnose: [],
  3859. order_status: 0,
  3860. pre_time: nowTime,
  3861. med_type: "",
  3862. is_medicine_status: 0,
  3863. }
  3864. if (obj.med_type == 0 || obj.med_type == '') {
  3865. if (this.org_id != 10206) {
  3866. obj.med_type = 14
  3867. if (this.org_id == 10721 || this.org_id == 0){
  3868. obj.med_type = 992102
  3869. }
  3870. } else {
  3871. obj.med_type = 1
  3872. }
  3873. }else{
  3874. if (this.org_id == 10721 || this.org_id == 0){
  3875. obj.med_type = 992102
  3876. }
  3877. }
  3878. this.prescriptions.push(obj)
  3879. }
  3880. this.curPrescriptions = this.prescriptions[i]
  3881. this.$refs.multipleTable.clearSelection()
  3882. this.$refs.tables.clearSelection()
  3883. this.clearSelection()
  3884. }
  3885. }
  3886. this.curDrugs = []
  3887. this.preDrugs = []
  3888. this.teamList = []
  3889. }
  3890. }, changeAllGoodInfoTableDataTwo(row) {
  3891. this.teamList = row
  3892. },
  3893. selectChange(selection, row) {
  3894. // if(this.org_id == 10138 || this.org_id == 9671 || this.org_id == 9675 || this.org_id == 4 || this.org_id ==3877 || this.org_id == 10028 || this.org_id == 10243 || this.org_id == 10188 || this.org_id ==10245 || this.org_id == 9919 || this.org_id == 10106 || this.org_id == 9504 || this.org_id ==10215 || this.org_id == 10188 || this.org_id == 10265 || this.org_id == 10164 || this.org_id == 9956 || this.org_id == 10188 || this.org_id == 10191 || this.org_id == 10278 || this.org_id == 10217 || this.org_id ==10210 || this.org_id ==10318 || this.org_id ==10340){
  3895. // if (row.stock_count <= 0) {
  3896. // if (row.type == 3) {
  3897. // if (selection) {
  3898. // selection.forEach(row => {
  3899. // if (row.stock_count <= 0) {
  3900. // this.$refs.tables.toggleRowSelection(row)
  3901. // }
  3902. // })
  3903. // } else {
  3904. // this.$refs.tables.clearSelection()
  3905. // }
  3906. // this.$message.error(row.project_name + '库存不足')
  3907. // return
  3908. // }
  3909. // }
  3910. // }else{
  3911. // if (row.total <= 0) {
  3912. // if (row.type == 3) {
  3913. // if (selection) {
  3914. // selection.forEach(row => {
  3915. // if (row.total <= 0) {
  3916. // this.$refs.tables.toggleRowSelection(row)
  3917. // }
  3918. // })
  3919. // } else {
  3920. // this.$refs.tables.clearSelection()
  3921. // }
  3922. // this.$message.error(row.project_name + '库存不足')
  3923. // return
  3924. // }
  3925. // }
  3926. // }
  3927. if (row.stock_count <= 0 && this.org_id != 10206 && this.org_id != 0) {
  3928. if (row.type == 3) {
  3929. if (selection) {
  3930. selection.forEach(row => {
  3931. if (row.stock_count <= 0) {
  3932. this.$refs.tables.toggleRowSelection(row)
  3933. }
  3934. })
  3935. } else {
  3936. this.$refs.tables.clearSelection()
  3937. }
  3938. this.$message.error(row.project_name + '库存不足')
  3939. return
  3940. }
  3941. }
  3942. if (this.org_id == 10206 && row.zuobiao_stock_num <= 0) {
  3943. if (row.type == 3) {
  3944. if (selection) {
  3945. selection.forEach(row => {
  3946. if (row.zuobiao_stock_num <= 0) {
  3947. this.$refs.tables.toggleRowSelection(row)
  3948. }
  3949. })
  3950. } else {
  3951. this.$refs.tables.clearSelection()
  3952. }
  3953. this.$message.error(row.project_name + '库存不足')
  3954. return
  3955. }
  3956. }
  3957. this.teamList = selection
  3958. },
  3959. getlist() {
  3960. this.tabProject = []
  3961. getHisProject().then(response => {
  3962. if (response.data.state == 1) {
  3963. var project = response.data.data.project
  3964. // this.tabProject = project
  3965. console.log('zzzzzzzzzz', project)
  3966. for (let i = 0; i < project.length; i++) {
  3967. let obj = {
  3968. id: project[i].id,
  3969. project_name: project[i].project_name,
  3970. statistical_classification: '',
  3971. single_dose: project[i].single_dose,
  3972. delivery_way: project[i].delivery_way,
  3973. execution_frequency: project[i].execution_frequency,
  3974. number_days: project[i].number_days,
  3975. price: project[i].price,
  3976. medical_code: project[i].medical_code,
  3977. cus_total: 1,
  3978. unit: project[i].unit,
  3979. type: 2,
  3980. total: project[i].total,
  3981. is_special_diseases: project[i].disease_directory,
  3982. project: project[i],
  3983. stock_count: 0,
  3984. first_letter: project[i].first_letter,
  3985. bbx01: project[i].bbx01,
  3986. bby01: project[i].bby01,
  3987. zuobiao_stock_num: 0,
  3988. number: ''
  3989. }
  3990. this.tabProject.push(obj)
  3991. }
  3992. var good_info = response.data.data.good_info
  3993. for (let i = 0; i < good_info.length; i++) {
  3994. good_info[i].stock_count = 0
  3995. if (good_info[i].good_stock_in && good_info[i].good_stock_in.length > 0) {
  3996. for (let j = 0; j < good_info[i].good_stock_in.length; j++) {
  3997. good_info[i].stock_count += good_info[i].good_stock_in[j].stock_count
  3998. }
  3999. }
  4000. let obj = {
  4001. id: good_info[i].id,
  4002. project_name: good_info[i].good_name,
  4003. statistical_classification: '',
  4004. single_dose: good_info[i].specification_name,
  4005. specification_name: good_info[i].specification_name,
  4006. delivery_way: '',
  4007. execution_frequency: '',
  4008. number_days: 1,
  4009. cus_total: 1,
  4010. price: good_info[i].packing_price,
  4011. medical_code: good_info[i].medical_insurance_number,
  4012. unit: this.getGoodUnit(good_info[i].good_unit),
  4013. type: 3,
  4014. total: good_info[i].total,
  4015. is_special_diseases: good_info[i].is_special_diseases,
  4016. good_info: good_info[i],
  4017. stock_count: good_info[i].stock_count,
  4018. first_letter: good_info[i].first_letter,
  4019. bbx01: good_info[i].bbx01,
  4020. bby01: good_info[i].bby01,
  4021. zuobiao_stock_num: 0,
  4022. number: good_info[i].good_number
  4023. }
  4024. this.tabProject.push(obj)
  4025. }
  4026. this.allProject = this.tabProject
  4027. //跟坐标数据进行匹配,如果bbx01相等的话则,替换库存数量
  4028. if (this.org_id == 10206) {
  4029. console.log('-=======')
  4030. console.log(this.zuobiao_project)
  4031. console.log(this.tabProject)
  4032. console.log('-=======')
  4033. for (let i = 0; i < this.zuobiao_project.length; i++) {
  4034. for (let b = 0; b < this.tabProject.length; b++) {
  4035. if (this.zuobiao_project[i].bbx01 == this.tabProject[b].bbx01 && this.zuobiao_project[i].bby01 == this.tabProject[b].bby01) {
  4036. console.log(this.zuobiao_project[i].lsqty)
  4037. console.log(this.tabProject[b].zuobiao_stock_num)
  4038. this.tabProject[b].zuobiao_stock_num = this.zuobiao_project[i].lsqty
  4039. this.tabProject[b].price = this.zuobiao_project[i].price
  4040. }
  4041. }
  4042. }
  4043. }
  4044. this.allProject = this.tabProject
  4045. // console.log('cccc',this.allProject);
  4046. }
  4047. })
  4048. }, deepClone(source) {
  4049. if (!source && typeof source !== 'object') {
  4050. throw new Error('error arguments', 'shallowClone')
  4051. }
  4052. const targetObj = source.constructor === Array ? [] : {}
  4053. Object.keys(source).forEach((keys) => {
  4054. if (source[keys] && typeof source[keys] === 'object') {
  4055. targetObj[keys] = this.deepClone(source[keys])
  4056. } else {
  4057. targetObj[keys] = source[keys]
  4058. }
  4059. })
  4060. return targetObj
  4061. }, getGoodUnit(id) {
  4062. var goodUnit = this.$store.getters.good_unit
  4063. for (let i = 0; i < goodUnit.length; i++) {
  4064. if (goodUnit[i].id == id) {
  4065. return goodUnit[i].name
  4066. }
  4067. }
  4068. },
  4069. // 项目组套数据源
  4070. getAllProjectTeam() {
  4071. getAllProjectTeam().then(response => {
  4072. if (response.data.state == 1) {
  4073. var team = response.data.data.team
  4074. // console.log('44444444422222',response.data.data);
  4075. this.tabPrjectTeam = team.sort(this.compare('sort'))
  4076. this.allTabPrjectTeam = team
  4077. this.projectList = team
  4078. }
  4079. })
  4080. },
  4081. compare(property) {
  4082. return function(a, b) {
  4083. var value1 = a[property]
  4084. var value2 = b[property]
  4085. return value1 - value2
  4086. }
  4087. },
  4088. selectTeam(row) {
  4089. this.teamList = []
  4090. let teamList = []
  4091. for (let i = 0; i < row.length; i++) {
  4092. let team_id = row[i].id
  4093. const params = {
  4094. project_id: row[i].item_id,
  4095. drug_id: row[i].drug_item_id,
  4096. }
  4097. getPojectListById(params).then(response => {
  4098. if (response.data.state == 1) {
  4099. var project = response.data.data.project
  4100. var advice = response.data.data.advice
  4101. let num = 0
  4102. for (let i = 0; i < project.length; i++) {
  4103. if (project[i].type == 2 && project[i].status == 1) {
  4104. let obj = {
  4105. id: project[i].project_id,
  4106. project_name: project[i].project.project_name,
  4107. statistical_classification: '',
  4108. single_dose: project[i].project.single_dose,
  4109. delivery_way: project[i].project.delivery_way,
  4110. execution_frequency: project[i].project.execution_frequency,
  4111. number_days: project[i].project.number_days,
  4112. cus_total: project[i].number,
  4113. price: project[i].project.price,
  4114. remark: '',
  4115. medical_code: project[i].project.medical_code,
  4116. unit: project[i].project.unit,
  4117. type: project[i].type,
  4118. is_special_diseases: project[i].project.disease_directory,
  4119. team_id: team_id,
  4120. project: project[i].project
  4121. }
  4122. if (obj.cus_total == 0 || obj.cus_total == undefined) {
  4123. obj.cus_total = 1
  4124. }
  4125. teamList.push(obj)
  4126. } else if (project[i].type == 3 && project[i].status == 1) {
  4127. if (project[i].good_info.sum_count <= 0 && this.org_id != 10206) {
  4128. num++
  4129. this.$refs.tabProjectTeam.toggleRowSelection(row)
  4130. this.$message.error(project[i].good_info.good_name + '库存不足')
  4131. }
  4132. if (project[i].good_info.zuobiao_stock_num <= 0 && this.org_id == 10206) {
  4133. num++
  4134. this.$refs.tabProjectTeam.toggleRowSelection(row)
  4135. this.$message.error(project[i].good_info.good_name + '库存不足')
  4136. }
  4137. if (num > 0) {
  4138. this.$refs.tabProjectTeam.clearSelection()
  4139. }
  4140. let obj = {
  4141. id: project[i].project_id,
  4142. project_name: project[i].good_info.good_name,
  4143. statistical_classification: '',
  4144. single_dose: '',
  4145. delivery_way: '',
  4146. execution_frequency: '',
  4147. number_days: '',
  4148. cus_total: project[i].number,
  4149. price: project[i].good_info.retail_price,
  4150. remark: '',
  4151. medical_code: project[i].good_info.medical_insurance_number,
  4152. unit: project[i].good_info.unit,
  4153. type: project[i].type,
  4154. is_special_diseases: project[i].good_info.is_special_diseases,
  4155. team_id: team_id,
  4156. good_info: project[i].good_info
  4157. }
  4158. if (obj.cus_total == 0 || obj.cus_total == undefined) {
  4159. obj.cus_total = 1
  4160. }
  4161. teamList.push(obj)
  4162. }
  4163. }
  4164. for (let i = 0; i < advice.length; i++) {
  4165. if (advice[i].drug.sum_count <= 0 && this.org_id != 10206) {
  4166. num++
  4167. this.$refs.tabProjectTeam.toggleRowSelection(row)
  4168. this.$message.error(advice[i].drug.drug_name + '库存不足')
  4169. }
  4170. if (project[i].good_info.zuobiao_stock_num <= 0 && this.org_id == 10206) {
  4171. num++
  4172. this.$refs.tabProjectTeam.toggleRowSelection(row)
  4173. this.$message.error(advice[i].drug.drug_name + '库存不足')
  4174. }
  4175. if (num > 0) {
  4176. this.$refs.tabProjectTeam.clearSelection()
  4177. }
  4178. let obj = {
  4179. advice_id: 0,
  4180. id: advice[i].drug_id,
  4181. drug_name: advice[i].drug_name,
  4182. single_dose: advice[i].single_dose,
  4183. delivery_way: advice[i].delivery_way,
  4184. execution_frequency: advice[i].execution_frequency,
  4185. retail_price: advice[i].prescribing_number_unit == advice[i].drug.max_unit ? advice[i].drug.retail_price.toString() : advice[i].drug.min_price.toString(),
  4186. remark: '',
  4187. day: advice[i].day_count,
  4188. prescribing_number: advice[i].prescribing_number,
  4189. single_dose_unit: advice[i].single_dose_unit,
  4190. prescribing_number_unit: advice[i].prescribing_number_unit,
  4191. medical_insurance_number: advice[i].drug.medical_insurance_number,
  4192. drug: advice[i].drug,
  4193. groupno: i,
  4194. type:1,
  4195. hosp_appr_flag: '1',
  4196. execution_state: 2,
  4197. is_medicine:0,
  4198. }
  4199. if (obj.cus_total == 0 || obj.cus_total == undefined) {
  4200. obj.cus_total = 1
  4201. }
  4202. teamList.push(obj)
  4203. }
  4204. this.teamList = teamList
  4205. }
  4206. })
  4207. }
  4208. }, changeDoctor(val) {
  4209. for (let i = 0; i < this.doctors.length; i++) {
  4210. if (this.doctors[i].admin_user_id == this.doctorValue) {
  4211. this.departmentValue = this.doctors[i].department_id
  4212. }
  4213. }
  4214. if (this.departmentValue == 0) {
  4215. this.departmentValue = ''
  4216. }
  4217. },
  4218. changeDayOrMonth(tab) {
  4219. if (this.dayorMonth == 'day') {
  4220. this.$emit('day')
  4221. } else if (this.dayorMonth == 'month') {
  4222. let form = {
  4223. id: this.patientInfo.id,
  4224. his_patient_id: this.hisPatientInfo.id
  4225. }
  4226. this.$emit('month', form)
  4227. }
  4228. },
  4229. getAllProjectList() {
  4230. getAllProjectList().then(response => {
  4231. if (response.data.state == 1) {
  4232. var hisprojectlist = response.data.data.hisprojectlist
  4233. this.hisList = hisprojectlist
  4234. }
  4235. })
  4236. },
  4237. clearSelection() {
  4238. this.$refs.tabProjectTeam.clearSelection()
  4239. }, callElePre(type) {
  4240. switch (type) {
  4241. case 1:
  4242. var that = this
  4243. let params = {
  4244. 'admin_user_id': 3626,
  4245. 'patient_id': this.patientInfo.id,
  4246. 'his_patient_id': this.hisPatientInfo.id,
  4247. 'record_time': this.record_date
  4248. }
  4249. axios.get('http://127.0.0.1:9532/api/CFYLJG001', {
  4250. params: params
  4251. }).then(function(response) {
  4252. if (response.data.state == 0) {
  4253. that.$message.error(response.data.msg)
  4254. that.fapiaoCodeDialogVisible = false
  4255. return false
  4256. } else {
  4257. that.fapiaoCodeDialogVisible = false
  4258. if (response.data.data.failed_code == -10) {
  4259. that.$confirm(response.data.data.msg, '医保错误信息', {
  4260. confirmButtonText: '确 定',
  4261. type: 'warning'
  4262. }).then(() => {
  4263. }).catch(() => {
  4264. })
  4265. } else {
  4266. that.$message({ message: '预核验成功', type: 'success', duration: 5000 })
  4267. // that.order.is_upload_diagnose = 1
  4268. }
  4269. }
  4270. })
  4271. .catch(function(error) {
  4272. })
  4273. break
  4274. case 2:
  4275. var that = this
  4276. let params2 = {
  4277. 'admin_user_id': 3626,
  4278. 'patient_id': this.patientInfo.id,
  4279. 'his_patient_id': this.hisPatientInfo.id,
  4280. 'record_time': this.record_date
  4281. }
  4282. axios.get('http://127.0.0.1:9532/api/CFYLJG002', {
  4283. params: params2
  4284. }).then(function(response) {
  4285. if (response.data.state == 0) {
  4286. that.$message.error(response.data.msg)
  4287. that.fapiaoCodeDialogVisible = false
  4288. return false
  4289. } else {
  4290. that.fapiaoCodeDialogVisible = false
  4291. if (response.data.data.failed_code == -10) {
  4292. that.$confirm(response.data.data.msg, '医保错误信息', {
  4293. confirmButtonText: '确 定',
  4294. type: 'warning'
  4295. }).then(() => {
  4296. }).catch(() => {
  4297. })
  4298. } else {
  4299. that.$message({ message: '签名成功', type: 'success', duration: 5000 })
  4300. }
  4301. }
  4302. })
  4303. .catch(function(error) {
  4304. })
  4305. break
  4306. case 3:
  4307. var that = this
  4308. let params3 = {
  4309. 'admin_user_id': 3626,
  4310. 'patient_id': this.patientInfo.id,
  4311. 'his_patient_id': this.hisPatientInfo.id,
  4312. 'record_time': this.record_date
  4313. }
  4314. axios.get('http://127.0.0.1:9532/api/CFYLJG003', {
  4315. params: params3
  4316. }).then(function(response) {
  4317. if (response.data.state == 0) {
  4318. that.$message.error(response.data.msg)
  4319. that.fapiaoCodeDialogVisible = false
  4320. return false
  4321. } else {
  4322. that.fapiaoCodeDialogVisible = false
  4323. if (response.data.data.failed_code == -10) {
  4324. that.$confirm(response.data.data.msg, '医保错误信息', {
  4325. confirmButtonText: '确 定',
  4326. type: 'warning'
  4327. }).then(() => {
  4328. }).catch(() => {
  4329. })
  4330. } else {
  4331. that.$message({ message: '处方上传成功', type: 'success', duration: 5000 })
  4332. }
  4333. }
  4334. })
  4335. .catch(function(error) {
  4336. })
  4337. break
  4338. case 4:
  4339. var that = this
  4340. let params4 = {
  4341. 'admin_user_id': 3626,
  4342. 'patient_id': this.patientInfo.id,
  4343. 'his_patient_id': this.hisPatientInfo.id,
  4344. 'record_time': this.record_date
  4345. }
  4346. axios.get('http://127.0.0.1:9532/api/CFYLJG004', {
  4347. params: params4
  4348. }).then(function(response) {
  4349. if (response.data.state == 0) {
  4350. that.$message.error(response.data.msg)
  4351. that.fapiaoCodeDialogVisible = false
  4352. return false
  4353. } else {
  4354. that.fapiaoCodeDialogVisible = false
  4355. if (response.data.data.failed_code == -10) {
  4356. that.$confirm(response.data.data.msg, '医保错误信息', {
  4357. confirmButtonText: '确 定',
  4358. type: 'warning'
  4359. }).then(() => {
  4360. }).catch(() => {
  4361. })
  4362. } else {
  4363. that.$message({ message: '撤销成功', type: 'success', duration: 5000 })
  4364. }
  4365. }
  4366. })
  4367. .catch(function(error) {
  4368. })
  4369. break
  4370. case 5:
  4371. var that = this
  4372. let params5 = {
  4373. 'admin_user_id': 3626,
  4374. 'patient_id': this.patientInfo.id,
  4375. 'his_patient_id': this.hisPatientInfo.id,
  4376. 'record_time': this.record_date
  4377. }
  4378. axios.get('http://127.0.0.1:9532/api/CFYLJG005', {
  4379. params: params5
  4380. }).then(function(response) {
  4381. if (response.data.state == 0) {
  4382. that.$message.error(response.data.msg)
  4383. that.fapiaoCodeDialogVisible = false
  4384. return false
  4385. } else {
  4386. that.fapiaoCodeDialogVisible = false
  4387. if (response.data.data.failed_code == -10) {
  4388. that.$confirm(response.data.data.msg, '医保错误信息', {
  4389. confirmButtonText: '确 定',
  4390. type: 'warning'
  4391. }).then(() => {
  4392. }).catch(() => {
  4393. })
  4394. } else {
  4395. that.$confirm(response.data.data.info, '医保信息', {
  4396. confirmButtonText: '确 定',
  4397. type: 'warning'
  4398. }).then(() => {
  4399. }).catch(() => {
  4400. })
  4401. }
  4402. }
  4403. })
  4404. .catch(function(error) {
  4405. })
  4406. break
  4407. case 6:
  4408. var that = this
  4409. let params6 = {
  4410. 'admin_user_id': 3626,
  4411. 'patient_id': this.patientInfo.id,
  4412. 'his_patient_id': this.hisPatientInfo.id,
  4413. 'record_time': this.record_date
  4414. }
  4415. axios.get('http://127.0.0.1:9532/api/CFYLJG006', {
  4416. params: params6
  4417. }).then(function(response) {
  4418. if (response.data.state == 0) {
  4419. that.$message.error(response.data.msg)
  4420. that.fapiaoCodeDialogVisible = false
  4421. return false
  4422. } else {
  4423. that.fapiaoCodeDialogVisible = false
  4424. if (response.data.data.failed_code == -10) {
  4425. that.$confirm(response.data.data.msg, '医保错误信息', {
  4426. confirmButtonText: '确 定',
  4427. type: 'warning'
  4428. }).then(() => {
  4429. }).catch(() => {
  4430. })
  4431. } else {
  4432. that.$confirm(response.data.data.info, '医保信息', {
  4433. confirmButtonText: '确 定',
  4434. type: 'warning'
  4435. }).then(() => {
  4436. }).catch(() => {
  4437. })
  4438. }
  4439. }
  4440. })
  4441. .catch(function(error) {
  4442. })
  4443. break
  4444. case 7:
  4445. var that = this
  4446. let params7 = {
  4447. 'admin_user_id': 3626,
  4448. 'patient_id': this.patientInfo.id,
  4449. 'his_patient_id': this.hisPatientInfo.id,
  4450. 'record_time': this.record_date
  4451. }
  4452. axios.get('http://127.0.0.1:9532/api/CFYLJG007', {
  4453. params: params7
  4454. }).then(function(response) {
  4455. if (response.data.state == 0) {
  4456. that.$message.error(response.data.msg)
  4457. that.fapiaoCodeDialogVisible = false
  4458. return false
  4459. } else {
  4460. that.fapiaoCodeDialogVisible = false
  4461. if (response.data.data.failed_code == -10) {
  4462. that.$confirm(response.data.data.msg, '医保错误信息', {
  4463. confirmButtonText: '确 定',
  4464. type: 'warning'
  4465. }).then(() => {
  4466. }).catch(() => {
  4467. })
  4468. } else {
  4469. that.$confirm(response.data.data.info, '医保信息', {
  4470. confirmButtonText: '确 定',
  4471. type: 'warning'
  4472. }).then(() => {
  4473. }).catch(() => {
  4474. })
  4475. }
  4476. }
  4477. })
  4478. .catch(function(error) {
  4479. })
  4480. break
  4481. case 8:
  4482. var that = this
  4483. let params8 = {
  4484. 'admin_user_id': 3626,
  4485. 'patient_id': this.patientInfo.id,
  4486. 'his_patient_id': this.hisPatientInfo.id,
  4487. 'record_time': this.record_date
  4488. }
  4489. axios.get('http://127.0.0.1:9532/api/CFYLJG008', {
  4490. params: params8
  4491. }).then(function(response) {
  4492. if (response.data.state == 0) {
  4493. that.$message.error(response.data.msg)
  4494. that.fapiaoCodeDialogVisible = false
  4495. return false
  4496. } else {
  4497. that.fapiaoCodeDialogVisible = false
  4498. if (response.data.data.failed_code == -10) {
  4499. that.$confirm(response.data.data.msg, '医保错误信息', {
  4500. confirmButtonText: '确 定',
  4501. type: 'warning'
  4502. }).then(() => {
  4503. }).catch(() => {
  4504. })
  4505. } else {
  4506. that.$message({ message: '上传成功', type: 'success', duration: 5000 })
  4507. that.order.is_upload_diagnose = 1
  4508. }
  4509. }
  4510. })
  4511. .catch(function(error) {
  4512. })
  4513. break
  4514. }
  4515. }
  4516. }, mounted() {
  4517. this.request_record_date = this.record_date
  4518. // this.getInitData()
  4519. //获取所有项目
  4520. this.getzuobiao()
  4521. this.getlist()
  4522. //获取所以项目组套
  4523. this.getAllProjectTeam()
  4524. this.getAllProjectList()
  4525. this.$nextTick(() => {
  4526. this.multipleTableHeight = parseInt(this.$refs.rightTable.offsetHeight)
  4527. })
  4528. },
  4529. watch: {
  4530. fullHeight(val) {
  4531. if (!this.timer) {
  4532. this.fullHeight = val
  4533. let tableHeight = val - 263
  4534. this.tableHeight = tableHeight
  4535. this.multipleTableHeight = parseInt(this.$refs.rightTable.offsetHeight)
  4536. this.timer = true
  4537. let that = this
  4538. setTimeout(function() {
  4539. that.timer = false
  4540. }, 400)
  4541. }
  4542. }
  4543. }
  4544. }
  4545. </script>
  4546. <style lang="scss" scoped>
  4547. .new-main-contain {
  4548. height: 100%;
  4549. display: flex;
  4550. flex-direction: column;
  4551. }
  4552. .app-container {
  4553. height: 100%;
  4554. }
  4555. .mainCell {
  4556. height: 36px;
  4557. display: flex;
  4558. align-items: center;
  4559. }
  4560. .mainLeft {
  4561. width: 200px;
  4562. height: 100%;
  4563. display: flex;
  4564. flex-direction: column;
  4565. margin-top: 2px;
  4566. .el-radio {
  4567. margin-right: 5px;
  4568. }
  4569. }
  4570. .mainRight {
  4571. margin-left: 20px;
  4572. flex: 1;
  4573. height: 100%;
  4574. display: flex;
  4575. flex-direction: column;
  4576. .cellSpan {
  4577. min-width: 80px;
  4578. display: inline-block;
  4579. margin-right: 10px;
  4580. }
  4581. }
  4582. .mainCenter {
  4583. display: flex;
  4584. flex: 1;
  4585. height: 100%;
  4586. }
  4587. .centerLeft {
  4588. flex: 1;
  4589. display: flex;
  4590. flex-direction: column;
  4591. position: relative;
  4592. width: 30%;
  4593. .el-form-item {
  4594. width: 33%;
  4595. margin-bottom: 14px;
  4596. }
  4597. .el-form-item__label {
  4598. text-align: left;
  4599. }
  4600. }
  4601. .backColor {
  4602. background: #f6f8f9;
  4603. height: 5px;
  4604. margin-bottom: 5px;
  4605. }
  4606. .RP {
  4607. color: #409EFF;
  4608. font-size: 14px;
  4609. margin-bottom: 5px;
  4610. }
  4611. .tabsBox {
  4612. position: relative;
  4613. flex: 1;
  4614. overflow-y: auto;
  4615. margin-bottom: 60px;
  4616. /*/ / margin-top: 4 px;*/
  4617. .el-tabs__item {
  4618. padding: 0 10px;
  4619. }
  4620. }
  4621. .preTabs {
  4622. height: 100%;
  4623. display: flex;
  4624. flex-direction: column;
  4625. .el-tabs__content {
  4626. flex: 1;
  4627. overflow-y: auto;
  4628. }
  4629. }
  4630. .costBox {
  4631. width: 100%;
  4632. height: 60px;
  4633. background: #fff;
  4634. position: absolute;
  4635. bottom: 0;
  4636. display: flex;
  4637. align-items: center;
  4638. justify-content: space-between;
  4639. }
  4640. .statusRed {
  4641. color: red;
  4642. }
  4643. .addTab {
  4644. position: absolute;
  4645. right: 8px;
  4646. top: 3px;
  4647. z-index: 20;
  4648. }
  4649. .centerRight {
  4650. width: 300px;
  4651. margin-left: 10px;
  4652. display: flex;
  4653. flex-direction: column;
  4654. position: relative;
  4655. }
  4656. .rightTab {
  4657. height: 40px;
  4658. width: 100%;
  4659. border: 1px solid #d2d2d2;
  4660. box-sizing: border-box;
  4661. p {
  4662. width: 50%;
  4663. height: 40px;
  4664. line-height: 40px;
  4665. text-align: center;
  4666. background: #eee;
  4667. float: left;
  4668. }
  4669. > p:last-child {
  4670. border-left: 1px solid #d2d2d2;
  4671. float: right;
  4672. }
  4673. .activeP {
  4674. background: #409EFF;
  4675. color: #fff;
  4676. }
  4677. }
  4678. .rightTabs {
  4679. display: flex;
  4680. flex-direction: column;
  4681. }
  4682. .comfirmBox {
  4683. width: 100%;
  4684. height: 60px;
  4685. background: #fff;
  4686. position: absolute;
  4687. bottom: 0;
  4688. display: flex;
  4689. align-items: center;
  4690. justify-content: space-between;
  4691. z-index: 99;
  4692. }
  4693. .borderCard {
  4694. height: 100%;
  4695. display: flex;
  4696. flex-direction: column;
  4697. margin-bottom: 60px;
  4698. .el-tabs--border-card > .el-tabs__content {
  4699. padding: 0;
  4700. }
  4701. }
  4702. </style>
  4703. <style lang="scss">
  4704. .borderCard {
  4705. .el-tabs__nav {
  4706. width: 100%;
  4707. }
  4708. .el-tabs__item {
  4709. width: 30%;
  4710. text-align: center;
  4711. }
  4712. .el-tabs__content {
  4713. padding: 5px;
  4714. flex: 1;
  4715. }
  4716. }
  4717. .centerLeft {
  4718. .el-form-item__label {
  4719. text-align: left;
  4720. }
  4721. }
  4722. .tabsBox {
  4723. .el-tabs__item {
  4724. padding: 0 10px;
  4725. }
  4726. .el-tabs--bottom .el-tabs--left > .el-tabs__header .el-tabs__item:nth-child(2), .el-tabs--bottom .el-tabs--right > .el-tabs__header .el-tabs__item:nth-child(2), .el-tabs--bottom.el-tabs--border-card > .el-tabs__header .el-tabs__item:nth-child(2), .el-tabs--bottom.el-tabs--card > .el-tabs__header .el-tabs__item:nth-child(2), .el-tabs--top .el-tabs--left > .el-tabs__header .el-tabs__item:nth-child(2), .el-tabs--top .el-tabs--right > .el-tabs__header .el-tabs__item:nth-child(2), .el-tabs--top.el-tabs--border-card > .el-tabs__header .el-tabs__item:nth-child(2), .el-tabs--top.el-tabs--card > .el-tabs__header .el-tabs__item:nth-child(2) {
  4727. padding: 0 10px;
  4728. }
  4729. .el-tabs--bottom .el-tabs--left > .el-tabs__header .el-tabs__item:last-child, .el-tabs--bottom .el-tabs--right > .el-tabs__header .el-tabs__item:last-child, .el-tabs--bottom.el-tabs--border-card > .el-tabs__header .el-tabs__item:last-child, .el-tabs--bottom.el-tabs--card > .el-tabs__header .el-tabs__item:last-child, .el-tabs--top .el-tabs--left > .el-tabs__header .el-tabs__item:last-child, .el-tabs--top .el-tabs--right > .el-tabs__header .el-tabs__item:last-child, .el-tabs--top.el-tabs--border-card > .el-tabs__header .el-tabs__item:last-child, .el-tabs--top.el-tabs--card > .el-tabs__header .el-tabs__item:last-child {
  4730. padding: 0 10px;
  4731. }
  4732. .el-tabs--card > .el-tabs__header .el-tabs__item.is-active.is-closable {
  4733. padding: 0 10px;
  4734. }
  4735. }
  4736. .centerRight {
  4737. .el-tabs__nav-scroll {
  4738. display: flex;
  4739. }
  4740. .el-tabs__nav {
  4741. margin: 0 auto;
  4742. }
  4743. .el-table th .cell, .el-table td .cell {
  4744. padding: 0 2px;
  4745. }
  4746. }
  4747. .preTabs {
  4748. .el-tabs__content {
  4749. flex: 1;
  4750. overflow-y: auto;
  4751. padding: 5px 0 5px 5px;
  4752. }
  4753. }
  4754. .rightTabs {
  4755. height: 100%;
  4756. .el-tabs__nav {
  4757. width: auto;
  4758. }
  4759. .el-tabs__header {
  4760. margin-bottom: 5px;
  4761. }
  4762. .el-tabs__item {
  4763. width: auto;
  4764. text-align: inherit;
  4765. }
  4766. .el-tabs__content {
  4767. flex: 1;
  4768. overflow-y: auto;
  4769. }
  4770. .el-tab-pane {
  4771. display: flex;
  4772. flex-direction: column;
  4773. height: 100%;
  4774. }
  4775. }
  4776. #tab-more {
  4777. .el-icon-close {
  4778. display: none;
  4779. }
  4780. }
  4781. ::-webkit-scrollbar {
  4782. height: 15px;
  4783. }
  4784. </style>