Elizabeth's proactive approach involves introducing urinal toilet attachment , an ingenious concept that optimizes space and functionality.

deskPrescription.vue 151KB

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