deskPrescription.vue 174KB

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