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

deskPrescription.vue 102KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865
  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 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">
  47. <el-select style="width:100%;" v-model="diagnose" placeholder="">
  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" closable
  100. @tab-remove="removeTab"
  101. :before-leave="moreState" @tab-click="tabclickEvent">
  102. <el-tab-pane
  103. v-for="(item, index) in prescriptions"
  104. :key="index"
  105. :label="item.name"
  106. :name="item.name"
  107. >
  108. <div class="RP">Rp
  109. <el-date-picker
  110. v-model="item.pre_time"
  111. type="datetime"
  112. :clearable="false"
  113. format="yyyy-MM-dd HH:mm"
  114. value-format="yyyy-MM-dd HH:mm"
  115. placeholder="选择日期">
  116. </el-date-picker>
  117. <div style="float: right;margin-bottom:5px;margin-right:1%;">
  118. <el-button
  119. round
  120. size="small"
  121. @click="openLast(3)"
  122. >上一方
  123. </el-button>
  124. <el-button
  125. round
  126. size="small"
  127. @click="openNext(4)"
  128. >下一方
  129. </el-button>
  130. </div>
  131. </div>
  132. </el-tab-pane>
  133. <el-tab-pane name="more" closable v-if="dayorMonth == 'day'"><span slot="label"><i class="el-icon-plus"
  134. @click="addTab"></i></span>
  135. </el-tab-pane>
  136. <prescription-table v-if="dayorMonth == 'day'" ref="prescription_tables" :prescription="curPrescriptions"
  137. :preDrugs="preDrugs"
  138. :activeType="customTabIndex"></prescription-table>
  139. </el-tabs>
  140. <el-tabs v-show="dayorMonth == 'month'" class="preTabs" v-model="editableTabsValueTwo" type="border-card"
  141. :before-leave="moreState" @tab-click="monthTabclickEvent">
  142. <el-tab-pane
  143. v-for="(item, index) in month_prescriptions"
  144. :key="index"
  145. :label="item.name"
  146. :name="item.name"
  147. >
  148. </el-tab-pane>
  149. <month-prescription-table v-if="dayorMonth == 'month' && !isShowDayPrescription"
  150. ref="month_prescription_tables"
  151. :prescription="curMonthPrescriptions"
  152. :activeType="monthCustomTabIndex"></month-prescription-table>
  153. <day-prescription-table v-if="dayorMonth == 'month' && isShowDayPrescription"
  154. ref="month_prescription_tables" :prescription="curDayPrescriptions"
  155. :activeType="monthCustomTabIndex"></day-prescription-table>
  156. </el-tabs>
  157. </div>
  158. <div class="costBox">
  159. <div>
  160. <span><span style="color: red">*</span>医生:</span>
  161. <el-select style="margin-right:5px;width:140px;" v-model="doctorValue" placeholder=""
  162. @change="changeDoctor">
  163. <el-option
  164. v-for="(item,index) in doctors"
  165. :key="index"
  166. :label="item.user_name"
  167. :value="item.admin_user_id">
  168. </el-option>
  169. </el-select>
  170. <span> <span style="color: red">*</span>科室:</span>
  171. <el-select style="margin-right:5px;width:140px;" v-model="departmentValue" placeholder="">
  172. <el-option
  173. v-for="(item,index) in department"
  174. :key="index"
  175. :label="item.name"
  176. :value="item.id">
  177. </el-option>
  178. </el-select>
  179. <span>当前处方总价:</span>
  180. <span style="color:red;" v-if="dayorMonth == 'day'">{{getTotalOne()?getTotalOne():''}}元</span>
  181. <span style="color:red;" v-if="dayorMonth == 'month'">{{getTotalTwo()?getTotalTwo():''}}元</span>
  182. <span style="margin-left:10px;">总价:</span>
  183. <span style="color:red;" v-if="dayorMonth == 'day'">{{ getTotal()?getTotal():''}}元</span>
  184. <span style="color:red;" v-if="dayorMonth == 'month'">{{ getMonthTotal()?getMonthTotal():''}}元</span>
  185. </div>
  186. <span :class="order_status == '未收费' ? 'statusRed' : ''">{{order_status}}</span>
  187. </div>
  188. </div>
  189. <div class='centerRight'>
  190. <!-- <div class="rightTab">
  191. <p :class="rightTab == 1 ? 'activeP' : ''" @click="clickTab(1)">药品</p>
  192. <p :class="rightTab == 2 ? 'activeP' : ''" @click="clickTab(2)">项目</p>
  193. </div> -->
  194. <el-tabs class="borderCard" type="border-card" v-model="rightTab" @tab-click="clickTab"
  195. :before-leave='beforeLeave'>
  196. <el-tab-pane label="药品" :name="1">
  197. </el-tab-pane>
  198. <el-tab-pane label="项目" :name="2">
  199. </el-tab-pane>
  200. <div style="height:100%;" v-show="showOne">
  201. <el-tabs class="rightTabs" v-model="drug_activeName">
  202. <el-tab-pane label="药品列表" name="1">
  203. <div style="margin-bottom:5px;display:flex;">
  204. <el-input style="width:50%;" @input="searchAction" @keyup.enter.native='searchAction'
  205. v-model.trim="search_keyword"
  206. placeholder="请输入药品名字"></el-input>
  207. <el-select style="margin-left:5px;width:50%;" v-model="value" placeholder="" @change="changeKind">
  208. <el-option
  209. label="全部"
  210. value="0">
  211. </el-option>
  212. <el-option
  213. v-for="(item,index) in getDictionaryDataConfig('system','drug_type')"
  214. :key="index"
  215. :label="item.name"
  216. :value="item.id">
  217. </el-option>
  218. </el-select>
  219. </div>
  220. <div style="width: 100%;flex:1;overflow: hidden;" ref="rightTable">
  221. <el-table ref="multipleTable" :height="multipleTableHeight != '' ? multipleTableHeight : '200'"
  222. :data="drugs" border @select='selectDrugs'
  223. :row-style="{ color: '#303133' }"
  224. @select-all="changeAllGoodInfoTableData"
  225. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  226. highlight-current-row>
  227. <el-table-column type="selection" width="40" align="center"></el-table-column>
  228. <el-table-column label="名称">
  229. <template slot-scope="scope">{{ scope.row.drug_name }}</template>
  230. </el-table-column>
  231. <el-table-column label="规格" width="60">
  232. <template slot-scope="scope">{{ scope.row.drug_spec }}</template>
  233. </el-table-column>
  234. <el-table-column label="库存" width="60">
  235. <template slot-scope="scope">{{
  236. stockInCount(scope.row) -
  237. salesReturnCount(scope.row) -
  238. stockOutCount(scope.row) +
  239. cancelStockCount(scope.row)
  240. }}
  241. </template>
  242. </el-table-column>
  243. <el-table-column label="单价" width="40">
  244. <template slot-scope="scope">{{ scope.row.retail_price }}</template>
  245. </el-table-column>
  246. </el-table>
  247. </div>
  248. </el-tab-pane>
  249. <!--<el-tab-pane label="医嘱模板" name="2">-->
  250. <!--<div style="margin-bottom:5px;">-->
  251. <!--&lt;!&ndash;<el-input style="width:50%;" v-model="input" placeholder=""></el-input>&ndash;&gt;-->
  252. <!--<el-select style="float: right;width: 49%;" v-model="value" placeholder="">-->
  253. <!--<el-option-->
  254. <!--v-for="item in options"-->
  255. <!--:key="item.value"-->
  256. <!--:label="item.label"-->
  257. <!--:value="item.value">-->
  258. <!--</el-option>-->
  259. <!--</el-select>-->
  260. <!--</div>-->
  261. <!--<div style="width: 100%;flex:1;overflow-y: auto;">-->
  262. <!--<el-table ref="multipleTableTwo" :height="multipleTableHeight != '' ? multipleTableHeight : '200'"-->
  263. <!--:data="advices_template" border-->
  264. <!--:row-style="{ color: '#303133' }"-->
  265. <!--:header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"-->
  266. <!--highlight-current-row-->
  267. <!--@select='selectTemplate'-->
  268. <!--@select-all="changeTemplateData"-->
  269. <!--&gt;-->
  270. <!--<el-table-column type="selection" width="40" align="center"></el-table-column>-->
  271. <!--<el-table-column prop="name" label="名称">-->
  272. <!--<template slot-scope="scope">{{scope.row.name}}</template>-->
  273. <!--</el-table-column>-->
  274. <!--&lt;!&ndash;<el-table-column label="规格" width="60">&ndash;&gt;-->
  275. <!--&lt;!&ndash;<template slot-scope="scope">33</template>&ndash;&gt;-->
  276. <!--&lt;!&ndash;</el-table-column>&ndash;&gt;-->
  277. <!--&lt;!&ndash;<el-table-column label="库存" width="60">&ndash;&gt;-->
  278. <!--&lt;!&ndash;<template slot-scope="scope">22</template>&ndash;&gt;-->
  279. <!--&lt;!&ndash;</el-table-column>&ndash;&gt;-->
  280. <!--&lt;!&ndash;<el-table-column label="单价" width="40">&ndash;&gt;-->
  281. <!--&lt;!&ndash;<template slot-scope="scope">12</template>&ndash;&gt;-->
  282. <!--&lt;!&ndash;</el-table-column>&ndash;&gt;-->
  283. <!--</el-table>-->
  284. <!--</div>-->
  285. <!--</el-tab-pane>-->
  286. </el-tabs>
  287. </div>
  288. <div style="height:100%;" v-show="showTwo">
  289. <el-tabs class="rightTabs" v-model="activeName" >
  290. <el-tab-pane label="项目列表" name="1">
  291. <div style="margin-bottom:5px;">
  292. <!--<el-input style="width:50%;" v-model="input" placeholder=""></el-input>-->
  293. <el-input style="width:50%;" @input="searchProjectAction" @keyup.enter.native='searchProjectAction'
  294. v-model.trim="search_project_keyword"
  295. placeholder="请输入项目名称"></el-input>
  296. <el-select style="float: right;width: 49%;" v-model="value" placeholder="" @change="changeClass">
  297. <el-option
  298. label="全部"
  299. value="0">
  300. </el-option>
  301. <el-option
  302. v-for="(item, index) in getDictionaryDataConfig('system','cost_classify')"
  303. :key="index"
  304. :label="item.name"
  305. :value="item.id">
  306. </el-option>
  307. </el-select>
  308. </div>
  309. <div style="width: 100%;flex:1;overflow-y: auto;">
  310. <el-table ref="tables" :height="multipleTableHeight != '' ? multipleTableHeight : '200'"
  311. :data="tabProject" border @select='selectChange'
  312. :row-style="{ color: '#303133' }"
  313. @select-all="changeAllGoodInfoTableDataTwo"
  314. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  315. highlight-current-row>
  316. <el-table-column type="selection" width="40" align="center"></el-table-column>
  317. <el-table-column prop="name" label="名称">
  318. <template slot-scope="scope">{{ scope.row.project_name }}</template>
  319. </el-table-column>
  320. <el-table-column label="规格" width="60">
  321. <template slot-scope="scope">{{ scope.row.single_dose }}</template>
  322. </el-table-column>
  323. <el-table-column label="单价" width="40">
  324. <template slot-scope="scope">{{ scope.row.price }}</template>
  325. </el-table-column>
  326. </el-table>
  327. </div>
  328. </el-tab-pane>
  329. <el-tab-pane label="项目组套" name="2">
  330. <div style="width: 100%;flex:1;overflow-y: auto;">
  331. <el-table :data="tabPrjectTeam" border
  332. :height="multipleTableHeight != '' ? multipleTableHeight : '200'"
  333. :row-style="{ color: '#303133' }"
  334. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  335. highlight-current-row
  336. @select='selectTeam'>
  337. <el-table-column type="selection" width="40" align="center"></el-table-column>
  338. <el-table-column prop="name" label="名称">
  339. <template slot-scope="scope">{{scope.row.project_team}}</template>
  340. </el-table-column>
  341. </el-table>
  342. </div>
  343. </el-tab-pane>
  344. </el-tabs>
  345. </div>
  346. </el-tabs>
  347. <template>
  348. <div class="comfirmBox">
  349. <!-- <div>
  350. <span>药品类型:</span>
  351. <el-select style="margin-right:5px;width:100px;" v-model="value" placeholder="" @change="changeKind">
  352. <el-option
  353. label="全部"
  354. value="0">
  355. </el-option>
  356. <el-option
  357. v-for="(item,index) in getDictionaryDataConfig('system','drug_type')"
  358. :key="index"
  359. :label="item.name"
  360. :value="item.id">
  361. </el-option>
  362. </el-select>
  363. </div> -->
  364. <el-button type="primary" style="width:100%;" @click="comfirm">确定添加</el-button>
  365. </div>
  366. </template>
  367. </div>
  368. </div>
  369. <additionalCharges v-on:setData="setCharge" ref='additionalCharges' :hisPatientInfo="hisPatientInfo"
  370. :patientInfo="patientInfo" :additions="additions"></additionalCharges>
  371. <select-template ref='selectTemplate'></select-template>
  372. <save-template ref='saveTemplate'></save-template>
  373. <next-or-last-prescription ref='next_or_last_prescription' v-on:save="setValue"
  374. v-on:cancel="cancel"></next-or-last-prescription>
  375. <!--<next-or-last-prescription ref='next_or_last_prescription' v-on:save="setValue" v-on:cancel="cancel"></next-or-last-prescription>-->
  376. <call-prescription ref='call_prescription' v-on:call="call" v-on:call-cancel="callCancel"></call-prescription>
  377. </div>
  378. </template>
  379. <script>
  380. import MonthPrescriptionTable from '../../outpatientCharges/components/monthPrescriptionTable'
  381. import {
  382. createHisPrescription,
  383. delHisPrescription,
  384. editHisPrescription,
  385. getCallHisPrescription,
  386. getDayOrMonthHisPrescription,
  387. getInitData,
  388. getNextOrLastHisPrescription,
  389. getPatientInfo,
  390. getSchedulePatientList
  391. } from '@/api/his/his'
  392. import { getDictionaryDataConfig } from '@/utils/data'
  393. import prescriptionTable from './prescriptionTable'
  394. import selectTemplate from './selectTemplate'
  395. import saveTemplate from './saveTemplate'
  396. import additionalCharges from './additionalCharges'
  397. import { addProjectTeam, getAllProjectTeam, getHisProject, getPojectListById,getAllProjectList } from '@/api/project/project'
  398. import { uParseTime } from '@/utils/tools'
  399. import NextOrLastPrescription from './nextOrLastPrescription'
  400. import CallPrescription from './callPrescription'
  401. import DayPrescriptionTable from '../../outpatientCharges/components/dayPrescriptionTable'
  402. const moment = require('moment');
  403. export default {
  404. props: {
  405. patientInfo: Object,
  406. hisPatientInfo: Object,
  407. prescriptions: Array,
  408. record_date: String,
  409. search_keyword: '',
  410. month_prescriptions: Array,
  411. isloading: false,
  412. loading: false,
  413. other_sick: {
  414. type: Array,
  415. default: function() {
  416. return []
  417. }
  418. }
  419. },
  420. components: {
  421. DayPrescriptionTable,
  422. MonthPrescriptionTable,
  423. CallPrescription,
  424. NextOrLastPrescription,
  425. selectTemplate,
  426. saveTemplate,
  427. prescriptionTable,
  428. additionalCharges
  429. },
  430. data() {
  431. return {
  432. start_time: moment(new Date()).subtract(30, 'days').format('YYYY-MM-DD'),
  433. end_time: moment(new Date()).add('year', 0).format('YYYY-MM-DD'),
  434. register: [
  435. { value: 11, label: '普通门诊' },
  436. { value: 12, label: '门诊挂号' },
  437. { value: 13, label: '急诊' },
  438. { value: 14, label: '门诊特殊病' },
  439. { value: 15, label: '门诊统筹' },
  440. { value: 16, label: '门诊慢性病' },
  441. { value: 21, label: '普通住院' }
  442. ],
  443. isLastOrNextVisible: false,
  444. multipleTableHeight: '',
  445. register_type: '',
  446. value: '0',
  447. search_project_keyword: '',
  448. form: {
  449. name: ''
  450. },
  451. drugs: [],
  452. allDrugs: [],
  453. advices_template: [],
  454. additions: [],
  455. editableTabsValueTwo: '处方1',
  456. editableTabsValue: '处方1',
  457. editableTabs: [{
  458. title: '处方1',
  459. name: '1'
  460. }],
  461. tabIndex: this.prescriptions.length,
  462. curDayPrescriptions: null,
  463. dayPrescriptions: [],
  464. currenet_inedx: 0,
  465. rightTab: 1,
  466. activeName: '1',
  467. drug_activeName: '1',
  468. curPrescriptions: null,
  469. curMonthPrescriptions: this.month_prescriptions[0],
  470. drugTableData: [],
  471. preDrugs: [],
  472. curDrugs: [],
  473. doctorOptions: [],
  474. doctorValue: '',
  475. departmentOptions: [],
  476. departmentValue: '',
  477. total: 0,
  478. state1: '',
  479. request_record_date: '',
  480. state2: '',
  481. customTabIndex: 1,
  482. options: [],
  483. tabProject: [],
  484. allProject: [],
  485. strids: '',
  486. showOne: true,
  487. showTwo: false,
  488. tableData: [],
  489. tabPrjectTeam: [],
  490. teamList: [],
  491. doctors: [],
  492. departMent: [],
  493. curStatus: 0,
  494. isShowDayPrescription: false,
  495. monthCustomTabIndex: 1,
  496. order_status: '',
  497. register_types: [
  498. { id: 1, name: '医保' },
  499. { id: 2, name: '自费' }
  500. ],
  501. pickerOptions: {
  502. disabledDate(time) {
  503. let threeMonths = new Date(new Date().setFullYear(new Date().getFullYear() - 1)).getTime() - 24 * 3600 * 1000;
  504. return time.getTime() > Date.now() || time.getTime() < threeMonths
  505. }
  506. },
  507. department: [],
  508. sick: [],
  509. diagnoses: [],
  510. diagnose: '',
  511. curTotal: 0,
  512. prescription_id: 0,
  513. tempDrugs: [],
  514. dayorMonth: 'day',
  515. pickerBeginDateBefore: {
  516. disabledDate: (time) => {
  517. let beginDateVal = this.end_time;
  518. if (beginDateVal) {
  519. return time.getTime() > new Date(beginDateVal).getTime()
  520. }
  521. }
  522. },
  523. pickerBeginDateAfter: {
  524. disabledDate: (time) => {
  525. let beginDateVal = this.start_time;
  526. if (beginDateVal) {
  527. return time.getTime() <= new Date(beginDateVal).getTime()
  528. }
  529. }
  530. },
  531. hisList:[]
  532. }
  533. },
  534. methods: {
  535. changeClass(id) {
  536. this.tabProject = [];
  537. if (id == 0) {
  538. this.tabProject = this.allProject
  539. } else {
  540. for (let i = 0; i < this.allProject.length; i++) {
  541. if (this.allProject[i].cost_classify == id) {
  542. this.tabProject.push(this.allProject[i])
  543. }
  544. }
  545. }
  546. },
  547. setMonthPrescription(month_prescriptions) {
  548. this.month_prescriptions = [];
  549. let drug_month_prescriptions = {
  550. advices: []
  551. };
  552. let drug_ids = [];
  553. let project_month_prescriptions = {
  554. project: []
  555. };
  556. let project_ids = [];
  557. let addition_month_prescriptions = {
  558. addition: []
  559. };
  560. let additions_ids = [];
  561. for (let i = 0; i < month_prescriptions.length; i++) {
  562. if (month_prescriptions[i].type == 1) { //药品
  563. for (let a = 0; a < month_prescriptions[i].advices.length; a++) {
  564. let obj = {
  565. id: month_prescriptions[i].advices[a].drug_id,
  566. price: month_prescriptions[i].advices[a].price
  567. };
  568. drug_ids.push(obj);
  569. drug_month_prescriptions.advices.push(month_prescriptions[i].advices[a])
  570. }
  571. } else if (month_prescriptions[i].type == 2) { //项目
  572. for (let a = 0; a < month_prescriptions[i].project.length; a++) {
  573. let obj = {
  574. id: month_prescriptions[i].project[a].project_id,
  575. price: month_prescriptions[i].project[a].price
  576. };
  577. project_ids.push(obj);
  578. project_month_prescriptions.project.push(month_prescriptions[i].project[a])
  579. }
  580. }
  581. //附加收费
  582. for (let a = 0; a < month_prescriptions[i].addition.length; a++) {
  583. let obj = {
  584. id: month_prescriptions[i].addition[a].item_id,
  585. price: month_prescriptions[i].addition[a].price
  586. };
  587. additions_ids.push(obj);
  588. addition_month_prescriptions.addition.push(month_prescriptions[i].addition[a])
  589. }
  590. }
  591. const obj = {};
  592. const obj1 = {};
  593. const obj2 = {};
  594. drug_ids = drug_ids.reduce((cur, next) => {
  595. obj[next.price] ? '' : obj[next.price] = true && cur.push(next);
  596. return cur
  597. }, []); // 设置cur默认类型为数组,并且初始值为空的数组
  598. project_ids = project_ids.reduce((cur, next) => {
  599. obj1[next.price] ? '' : obj1[next.price] = true && cur.push(next);
  600. return cur
  601. }, []); // 设置cur默认类型为数组,并且初始值为空的数组
  602. additions_ids = additions_ids.reduce((cur, next) => {
  603. obj2[next.price] ? '' : obj2[next.price] = true && cur.push(next);
  604. return cur
  605. }, []); // 设置cur默认类型为数组,并且初始值为空的数组
  606. console.log(drug_ids);
  607. console.log(project_ids);
  608. console.log(additions_ids);
  609. console.log(additions_ids);
  610. let drugs = [];
  611. let projects = [];
  612. let additions = [];
  613. for (let i = 0; i < drug_ids.length; i++) {
  614. let obj = {};
  615. let count = 0;
  616. for (let a = 0; a < drug_month_prescriptions.advices.length; a++) {
  617. if (drug_ids[i].price == drug_month_prescriptions.advices[a].price) {
  618. obj['drug_name'] = drug_month_prescriptions.advices[a].advice_name;
  619. obj['single_dose'] = drug_month_prescriptions.advices[a].single_dose;
  620. obj['delivery_way'] = drug_month_prescriptions.advices[a].delivery_way;
  621. obj['execution_frequency'] = drug_month_prescriptions.advices[a].execution_frequency;
  622. obj['day'] = drug_month_prescriptions.advices[a].day;
  623. // obj['prescribing_number'] = obj['prescribing_number'] + drug_month_prescriptions.advices[a].prescribing_number
  624. obj['prescribing_number_unit'] = drug_month_prescriptions.advices[a].prescribing_number_unit;
  625. obj['medical_insurance_number'] = drug_month_prescriptions.advices[a].drug.medical_insurance_number;
  626. obj['id'] = drug_month_prescriptions.advices[a].drug_id;
  627. // obj['retail_price'] = obj['retail_price'] + drug_month_prescriptions.advices[a].drug.retail_price
  628. obj['retail_price'] = parseFloat(drug_month_prescriptions.advices[a].price);
  629. count = count + drug_month_prescriptions.advices[a].prescribing_number
  630. }
  631. }
  632. obj['prescribing_number'] = count;
  633. drugs.push(obj)
  634. }
  635. for (let i = 0; i < project_ids.length; i++) {
  636. let obj = {};
  637. let count = 0;
  638. for (let a = 0; a < project_month_prescriptions.project.length; a++) {
  639. if (project_ids[i].price == project_month_prescriptions.project[a].price) {
  640. obj['project_name'] = project_month_prescriptions.project[a].project.project_name;
  641. obj['statistical_classification'] = project_month_prescriptions.project[a].project.statistical_classification;
  642. obj['single_dose'] = project_month_prescriptions.project[a].single_dose;
  643. obj['delivery_way'] = project_month_prescriptions.project[a].delivery_way;
  644. obj['execution_frequency'] = project_month_prescriptions.project[a].execution_frequency;
  645. obj['number_days'] = project_month_prescriptions.project[a].day;
  646. obj['medical_code'] = project_month_prescriptions.project[a].project.medical_code;
  647. obj['unit'] = project_month_prescriptions.project[a].unit;
  648. obj['project_id'] = project_month_prescriptions.project[a].project_id;
  649. count = count + project_month_prescriptions.project[a].count;
  650. // price = price + project_month_prescriptions.project[a].price
  651. obj['price'] = parseFloat(project_month_prescriptions.project[a].price)
  652. }
  653. }
  654. obj['total'] = count;
  655. projects.push(obj)
  656. }
  657. for (let i = 0; i < additions_ids.length; i++) {
  658. let obj = {};
  659. let count = 0;
  660. console.log(addition_month_prescriptions.addition);
  661. if (addition_month_prescriptions.addition) {
  662. for (let a = 0; a < addition_month_prescriptions.addition.length; a++) {
  663. if (additions_ids[i].price == addition_month_prescriptions.addition[a].price) {
  664. obj['item_name'] = addition_month_prescriptions.addition[a].item_name;
  665. obj['id'] = addition_month_prescriptions.addition[a].id;
  666. obj['item_id'] = addition_month_prescriptions.addition[a].item_id;
  667. count = count + addition_month_prescriptions.addition[a].count;
  668. obj['price'] = parseFloat(addition_month_prescriptions.addition[a].price)
  669. }
  670. }
  671. obj['count'] = count;
  672. additions.push(obj)
  673. }
  674. }
  675. console.log(drugs);
  676. console.log(projects);
  677. console.log(additions);
  678. let p1 = {
  679. name: '处方' + 1,
  680. advices: drugs,
  681. project: [],
  682. type: 1,
  683. addition: additions
  684. };
  685. let p2 = {
  686. name: '处方' + 2,
  687. type: 2,
  688. project: projects,
  689. advices: [],
  690. addition: []
  691. };
  692. console.log(this.month_prescriptions);
  693. console.log(this.curMonthPrescriptions);
  694. this.month_prescriptions.push(p1);
  695. this.month_prescriptions.push(p2);
  696. this.curMonthPrescriptions = this.month_prescriptions[0]
  697. },
  698. // setMonthPrescription(month_prescriptions) {
  699. // let drug_month_prescriptions = {
  700. // advices: [],
  701. // }
  702. // let drug_ids = []
  703. // let project_month_prescriptions = {
  704. // project: [],
  705. //
  706. // }
  707. // let project_ids = []
  708. //
  709. // let addition_month_prescriptions = {
  710. // addtions: [],
  711. //
  712. // }
  713. // let additions_ids = []
  714. //
  715. //
  716. // for (let i = 0; i < month_prescriptions.length; i++) {
  717. // if (month_prescriptions[i].type == 1) { //药品
  718. // for (let a = 0; a < month_prescriptions[i].advices.length; a++) {
  719. // drug_ids.push(month_prescriptions[i].advices[a].drug_id)
  720. // drug_month_prescriptions.advices.push(month_prescriptions[i].advices[a])
  721. // }
  722. //
  723. // } else if (month_prescriptions[i].type == 2) { //项目
  724. // for (let a = 0; a < month_prescriptions[i].project.length; a++) {
  725. // project_ids.push(month_prescriptions[i].project[a].project_id)
  726. // project_month_prescriptions.project.push(month_prescriptions[i].project[a])
  727. // }
  728. // }
  729. // //附加收费
  730. // for (let a = 0; a < month_prescriptions[i].addition.length; a++) {
  731. // additions_ids.push(month_prescriptions[i].addition[a].item_id)
  732. // addition_month_prescriptions.addtions.push(month_prescriptions[i].addition[a])
  733. // }
  734. //
  735. // }
  736. //
  737. // console.log(drug_ids)
  738. // console.log(drug_month_prescriptions)
  739. // console.log(project_ids)
  740. // console.log(project_month_prescriptions)
  741. // console.log(additions_ids)
  742. // console.log(addition_month_prescriptions)
  743. //
  744. //
  745. // const obj = {}
  746. // const obj1 = {}
  747. // const obj2 = {}
  748. //
  749. // drug_ids = drug_ids.reduce((cur, next) => {
  750. // obj[next] ? '' : obj[next] = true && cur.push(next)
  751. // return cur
  752. // }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  753. // project_ids = project_ids.reduce((cur, next) => {
  754. // obj1[next] ? '' : obj1[next] = true && cur.push(next)
  755. // return cur
  756. // }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  757. // additions_ids = additions_ids.reduce((cur, next) => {
  758. // obj2[next] ? '' : obj2[next] = true && cur.push(next)
  759. // return cur
  760. // }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  761. //
  762. //
  763. // console.log(drug_ids)
  764. // console.log(project_ids)
  765. // console.log(additions_ids)
  766. //
  767. //
  768. // let drugs = []
  769. // let projects = []
  770. // let additions = []
  771. //
  772. //
  773. // for (let i = 0; i < drug_ids.length; i++) {
  774. // let obj = {}
  775. // let price = 0
  776. // let count = 0
  777. // for (let a = 0; a < drug_month_prescriptions.advices.length; a++) {
  778. // if (drug_ids[i] == drug_month_prescriptions.advices[a].drug_id) {
  779. // obj['drug_name'] = drug_month_prescriptions.advices[a].advice_name
  780. // obj['single_dose'] = drug_month_prescriptions.advices[a].single_dose
  781. // obj['delivery_way'] = drug_month_prescriptions.advices[a].delivery_way
  782. // obj['execution_frequency'] = drug_month_prescriptions.advices[a].execution_frequency
  783. // obj['day'] = drug_month_prescriptions.advices[a].day
  784. // // obj['prescribing_number'] = obj['prescribing_number'] + drug_month_prescriptions.advices[a].prescribing_number
  785. // obj['prescribing_number_unit'] = drug_month_prescriptions.advices[a].prescribing_number_unit
  786. // obj['medical_insurance_number'] = drug_month_prescriptions.advices[a].drug.medical_insurance_number
  787. // obj['id'] = drug_month_prescriptions.advices[a].drug_id
  788. // // obj['retail_price'] = obj['retail_price'] + drug_month_prescriptions.advices[a].drug.retail_price
  789. //
  790. //
  791. // count = count + drug_month_prescriptions.advices[a].prescribing_number
  792. // price = price + drug_month_prescriptions.advices[a].price
  793. //
  794. // }
  795. // }
  796. // obj['retail_price'] =this.formatDecimal(price,2)
  797. // obj['prescribing_number'] = count
  798. // drugs.push(obj)
  799. // }
  800. //
  801. //
  802. // for (let i = 0; i < project_ids.length; i++) {
  803. // let obj = {}
  804. // let price = 0
  805. // let count = 0
  806. // for (let a = 0; a < project_month_prescriptions.project.length; a++) {
  807. // if (project_ids[i] == project_month_prescriptions.project[a].project_id) {
  808. // obj['project_name'] = project_month_prescriptions.project[a].project.project_name
  809. // obj['statistical_classification'] = project_month_prescriptions.project[a].project.statistical_classification
  810. // obj['single_dose'] = project_month_prescriptions.project[a].single_dose
  811. // obj['delivery_way'] = project_month_prescriptions.project[a].delivery_way
  812. // obj['execution_frequency'] = project_month_prescriptions.project[a].execution_frequency
  813. // obj['number_days'] = project_month_prescriptions.project[a].day
  814. // obj['medical_code'] = project_month_prescriptions.project[a].project.medical_code
  815. // obj['unit'] = project_month_prescriptions.project[a].unit
  816. // obj['project_id'] = project_month_prescriptions.project[a].project_id
  817. // count = count + project_month_prescriptions.project[a].count
  818. // price = price + project_month_prescriptions.project[a].price
  819. // }
  820. // }
  821. // obj['price'] = this.formatDecimal(price,2)
  822. // obj['total'] = count
  823. // projects.push(obj)
  824. // }
  825. //
  826. //
  827. // for (let i = 0; i < additions_ids.length; i++) {
  828. // let obj = {}
  829. // let price = 0
  830. // let count = 0
  831. // for (let a = 0; a < addition_month_prescriptions.addition.length; a++) {
  832. // if (project_ids[i] == addition_month_prescriptions.addition[a].item_id) {
  833. // obj['item_name'] = addition_month_prescriptions.addition[a].item_name
  834. // obj['id'] = addition_month_prescriptions.addition[a].id
  835. // obj['item_id'] = addition_month_prescriptions.addition[a].item_id
  836. // count = count + addition_month_prescriptions.addition[a].count
  837. // price = price + addition_month_prescriptions.addition[a].price
  838. // }
  839. // }
  840. // obj['price'] = this.formatDecimal(price,2)
  841. // obj['count'] = count
  842. // additions.push(obj)
  843. // }
  844. //
  845. // console.log(drugs)
  846. // console.log(projects)
  847. // console.log(additions)
  848. //
  849. //
  850. // if (drugs.length > 0) {
  851. // let p1 = {
  852. // name: '处方' + 1,
  853. // advices: drugs,
  854. // project: [],
  855. // type: 1,
  856. // addition: additions,
  857. // }
  858. // this.month_prescriptions.push(p1)
  859. //
  860. // }
  861. //
  862. // if (projects.length > 0) {
  863. // let p2 = {
  864. // name: '处方' + 2,
  865. // type: 2,
  866. // project: projects,
  867. // advices: [],
  868. // }
  869. // this.month_prescriptions.push(p2)
  870. // }
  871. //
  872. // console.log(this.month_prescriptions)
  873. //
  874. // },
  875. formatDecimal(num, decimal) {
  876. num = num.toString();
  877. let index = num.indexOf('.');
  878. if (index !== -1) {
  879. num = num.substring(0, decimal + index + 1)
  880. } else {
  881. num = num.substring(0)
  882. }
  883. return parseFloat(num).toFixed(decimal)
  884. },
  885. changeTime(val) {
  886. if (val == this.end_time) {
  887. this.isShowDayPrescription = true
  888. } else {
  889. this.isShowDayPrescription = false
  890. }
  891. let params = {
  892. patient_id: this.patientInfo.id,
  893. start_time: val,
  894. end_time: this.end_time
  895. };
  896. getDayOrMonthHisPrescription(params).then(response => {
  897. if (response.data.state == 1) {
  898. this.month_prescriptions = [];
  899. if (val == this.end_time) {
  900. var day_prescription = response.data.data.day_prescription;
  901. // this.month_prescriptions = day_prescription
  902. if (day_prescription.length > 0) {
  903. for (let i = 0; i < day_prescription.length; i++) {
  904. var prescription = day_prescription[i];
  905. let tempAdvice = [];
  906. let tempProject = [];
  907. let tempAddition = [];
  908. //药品
  909. for (let b = 0; b < prescription.advices.length; b++) {
  910. let obj = {
  911. advice_id: prescription.advices[b].id,
  912. drug_name: prescription.advices[b].advice_name,
  913. single_dose: prescription.advices[b].single_dose,
  914. delivery_way: prescription.advices[b].delivery_way,
  915. execution_frequency: prescription.advices[b].execution_frequency,
  916. retail_price: prescription.advices[b].price.toString(),
  917. remark: prescription.advices[b].remark,
  918. day: prescription.advices[b].day,
  919. prescribing_number: prescription.advices[b].prescribing_number.toString(),
  920. single_dose_unit: prescription.advices[b].single_dose_unit,
  921. prescribing_number_unit: prescription.advices[b].prescribing_number_unit,
  922. medical_insurance_number: prescription.advices[b].med_list_codg,
  923. id: prescription.advices[b].drug_id
  924. };
  925. tempAdvice.push(obj)
  926. }
  927. //项目
  928. for (let b = 0; b < prescription.project.length; b++) {
  929. let obj = {
  930. id: prescription.project[b].id,
  931. project_id: prescription.project[b].project_id,
  932. project_name: prescription.project[b].project.project_name,
  933. statistical_classification: prescription.project[b].project.statistical_classification,
  934. single_dose: prescription.project[b].single_dose,
  935. delivery_way: prescription.project[b].delivery_way,
  936. execution_frequency: prescription.project[b].execution_frequency,
  937. number_days: prescription.project[b].day,
  938. total: prescription.project[b].count.toString(),
  939. price: prescription.project[b].price,
  940. remark: prescription.project[b].remark,
  941. medical_code: prescription.project[b].project.medical_code,
  942. unit: prescription.project[b].project.unit
  943. };
  944. tempProject.push(obj)
  945. }
  946. //附加收费
  947. for (let b = 0; b < prescription.addition.length; b++) {
  948. let obj = {
  949. id: prescription.addition[b].id,
  950. item_name: prescription.addition[b].item_name,
  951. price: prescription.addition[b].price,
  952. count: prescription.addition[b].count,
  953. item_id: prescription.addition[b].item_id
  954. };
  955. tempAddition.push(obj)
  956. }
  957. let index = i + 1;
  958. let obj = {
  959. id: prescription.id,
  960. name: '处方' + index,
  961. advices: tempAdvice,
  962. project: tempProject,
  963. addition: tempAddition,
  964. order_status: prescription.order_status
  965. };
  966. this.month_prescriptions.push(obj)
  967. }
  968. this.curDayPrescriptions = this.month_prescriptions[0]
  969. }
  970. } else {
  971. this.setMonthPrescription(response.data.data.day_prescription);
  972. this.curMonthPrescriptions = this.month_prescriptions[0]
  973. }
  974. } else {
  975. this.$message.error(response.data.msg)
  976. }
  977. })
  978. },
  979. changeEndTime(val) {
  980. if (val == this.start_time) {
  981. this.isShowDayPrescription = true
  982. } else {
  983. this.isShowDayPrescription = false
  984. }
  985. let params = {
  986. patient_id: this.patientInfo.id,
  987. start_time: this.start_time,
  988. end_time: val
  989. };
  990. getDayOrMonthHisPrescription(params).then(response => {
  991. if (response.data.state == 1) {
  992. console.log(val);
  993. console.log(this.end_time);
  994. this.month_prescriptions = [];
  995. if (val == this.start_time) {
  996. var day_prescription = response.data.data.day_prescription;
  997. // this.month_prescriptions = day_prescription
  998. if (day_prescription.length > 0) {
  999. for (let i = 0; i < day_prescription.length; i++) {
  1000. var prescription = day_prescription[i];
  1001. let tempAdvice = [];
  1002. let tempProject = [];
  1003. let tempAddition = [];
  1004. //药品
  1005. for (let b = 0; b < prescription.advices.length; b++) {
  1006. let obj = {
  1007. advice_id: prescription.advices[b].id,
  1008. drug_name: prescription.advices[b].advice_name,
  1009. single_dose: prescription.advices[b].single_dose,
  1010. delivery_way: prescription.advices[b].delivery_way,
  1011. execution_frequency: prescription.advices[b].execution_frequency,
  1012. retail_price: prescription.advices[b].price.toString(),
  1013. remark: prescription.advices[b].remark,
  1014. day: prescription.advices[b].day,
  1015. prescribing_number: prescription.advices[b].prescribing_number.toString(),
  1016. single_dose_unit: prescription.advices[b].single_dose_unit,
  1017. prescribing_number_unit: prescription.advices[b].prescribing_number_unit,
  1018. medical_insurance_number: prescription.advices[b].med_list_codg,
  1019. id: prescription.advices[b].drug_id
  1020. };
  1021. tempAdvice.push(obj)
  1022. }
  1023. //项目
  1024. for (let b = 0; b < prescription.project.length; b++) {
  1025. let obj = {
  1026. id: prescription.project[b].id,
  1027. project_id: prescription.project[b].project_id,
  1028. project_name: prescription.project[b].project.project_name,
  1029. statistical_classification: prescription.project[b].project.statistical_classification,
  1030. single_dose: prescription.project[b].single_dose,
  1031. delivery_way: prescription.project[b].delivery_way,
  1032. execution_frequency: prescription.project[b].execution_frequency,
  1033. number_days: prescription.project[b].day,
  1034. total: prescription.project[b].count.toString(),
  1035. price: prescription.project[b].price,
  1036. remark: prescription.project[b].remark,
  1037. medical_code: prescription.project[b].project.medical_code,
  1038. unit: prescription.project[b].project.unit
  1039. };
  1040. tempProject.push(obj)
  1041. }
  1042. //附加收费
  1043. for (let b = 0; b < prescription.addition.length; b++) {
  1044. let obj = {
  1045. id: prescription.addition[b].id,
  1046. item_name: prescription.addition[b].item_name,
  1047. price: prescription.addition[b].price,
  1048. count: prescription.addition[b].count,
  1049. item_id: prescription.addition[b].item_id
  1050. };
  1051. tempAddition.push(obj)
  1052. }
  1053. let index = i + 1;
  1054. let obj = {
  1055. id: prescription.id,
  1056. name: '处方' + index,
  1057. advices: tempAdvice,
  1058. project: tempProject,
  1059. addition: tempAddition,
  1060. order_status: prescription.order_status
  1061. };
  1062. this.month_prescriptions.push(obj)
  1063. }
  1064. this.curDayPrescriptions = this.month_prescriptions[0]
  1065. }
  1066. } else {
  1067. this.setMonthPrescription(response.data.data.day_prescription);
  1068. this.curMonthPrescriptions = this.month_prescriptions[0]
  1069. }
  1070. } else {
  1071. this.$message.error(response.data.msg)
  1072. }
  1073. })
  1074. },
  1075. call(val) {
  1076. this.prescriptions = [];
  1077. this.prescriptions = val;
  1078. for (let i = 0; i < this.prescriptions.length; i++) {
  1079. var nowDate = new Date();
  1080. var nowYear = nowDate.getFullYear();
  1081. var nowMonth = nowDate.getMonth() + 1;
  1082. var nowDay = nowDate.getDate();
  1083. var hours = nowDate.getHours();
  1084. var min = nowDate.getMinutes();
  1085. var nowTime =
  1086. nowYear +
  1087. '-' +
  1088. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  1089. '-' +
  1090. (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + (hours < 10 ? '0' + hours : hours) +
  1091. ':' + (min < 10 ? '0' + min : min);
  1092. this.prescriptions[i]['pre_time'] = nowTime;
  1093. this.prescriptions[i].name = '处方' + (i + 1);
  1094. if (i == 0) {
  1095. if (this.prescriptions[0].advices.length > 0 && this.prescriptions[0].project.length == 0) {
  1096. this.customTabIndex = 1;
  1097. this.curStatus = 1;
  1098. this.rightTab = 1;
  1099. this.showOne = true;
  1100. this.showTwo = false
  1101. }
  1102. if (this.prescriptions[0].advices.length == 0 && this.prescriptions[0].project.length > 0) {
  1103. this.customTabIndex = 2;
  1104. this.curStatus = 2;
  1105. this.rightTab = 2;
  1106. this.showTwo = true;
  1107. this.showOne = false
  1108. }
  1109. }
  1110. }
  1111. this.curPrescriptions = this.prescriptions[0];
  1112. this.$refs.call_prescription.close();
  1113. this.$emit('setData', this.prescriptions)
  1114. },
  1115. callCancel() {
  1116. this.$refs.call_prescription.close()
  1117. },
  1118. cancel() {
  1119. this.$refs.next_or_last_prescription.close();
  1120. this.request_record_date = this.record_date
  1121. },
  1122. setValue(val) {
  1123. this.prescriptions = [];
  1124. this.prescriptions = val;
  1125. this.$refs.next_or_last_prescription.close();
  1126. var nowDate = new Date();
  1127. var nowYear = nowDate.getFullYear();
  1128. var nowMonth = nowDate.getMonth() + 1;
  1129. var nowDay = nowDate.getDate();
  1130. var hours = nowDate.getHours();
  1131. var min = nowDate.getMinutes();
  1132. var nowTime =
  1133. nowYear +
  1134. '-' +
  1135. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  1136. '-' +
  1137. (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + (hours < 10 ? '0' + hours : hours) +
  1138. ':' + (min < 10 ? '0' + min : min);
  1139. for (let i = 0; i < this.prescriptions.length; i++) {
  1140. this.prescriptions[i].name = '处方' + (i + 1);
  1141. this.prescriptions[i]['pre_time'] = nowTime;
  1142. if (i == 0) {
  1143. if (this.prescriptions[0].advices.length > 0 && this.prescriptions[0].project.length == 0) {
  1144. this.customTabIndex = 1;
  1145. this.curStatus = 1;
  1146. this.rightTab = 1;
  1147. this.showOne = true;
  1148. this.showTwo = false
  1149. }
  1150. if (this.prescriptions[0].advices.length == 0 && this.prescriptions[0].project.length > 0) {
  1151. this.customTabIndex = 2;
  1152. this.curStatus = 2;
  1153. this.rightTab = 2;
  1154. this.showTwo = true;
  1155. this.showOne = false
  1156. }
  1157. }
  1158. }
  1159. this.curPrescriptions = this.prescriptions[0];
  1160. this.request_record_date = this.record_date;
  1161. this.$emit('setData', this.prescriptions)
  1162. },
  1163. GetNextOrLastHisPrescription(params) {
  1164. getNextOrLastHisPrescription(params).then(response => {
  1165. if (response.data.state == 1) {
  1166. if (this.dayorMonth == 'day') {
  1167. this.$refs.next_or_last_prescription.show(response.data.data.prescriptions, this.patientInfo.name, this.patientInfo.id, this.prescriptions);
  1168. this.request_record_date = uParseTime(response.data.data.prescriptions[0].record_date, '{y}-{m}-{d}')
  1169. } else {
  1170. this.$message.error('当前处于月结,无法使用上一方或下一方功能');
  1171. }
  1172. } else {
  1173. this.$message.error(response.data.msg)
  1174. }
  1175. })
  1176. },
  1177. openLast(val) {
  1178. if (this.curPrescriptions.order_status == 2) {
  1179. this.$message.error('处方已经结算,无法添加');
  1180. return
  1181. }
  1182. if (this.patientInfo.id == 0) {
  1183. this.$message.error('请选择患者');
  1184. return
  1185. }
  1186. if (val == 1) {
  1187. this.isVisibility = false;
  1188. this.request_record_date = this.record_date;
  1189. let params = {
  1190. patient_id: this.patientInfo.id,
  1191. record_time: this.request_record_date,
  1192. type: 1
  1193. };
  1194. this.GetNextOrLastHisPrescription(params)
  1195. } else if (val == 3) {
  1196. let params = {
  1197. patient_id: this.patientInfo.id,
  1198. record_time: this.request_record_date,
  1199. type: 1
  1200. };
  1201. this.GetNextOrLastHisPrescription(params)
  1202. }
  1203. },
  1204. openNext(val) {
  1205. if (this.curPrescriptions.order_status == 2) {
  1206. this.$message.error('处方已经结算,无法添加');
  1207. return
  1208. }
  1209. if (this.patientInfo.id == 0) {
  1210. this.$message.error('请选择患者');
  1211. return
  1212. }
  1213. if (val == 2) {
  1214. this.isVisibility = false;
  1215. this.request_record_date = this.record_date;
  1216. let params = {
  1217. patient_id: this.patientInfo.id,
  1218. record_time: this.request_record_date,
  1219. type: 2
  1220. };
  1221. this.GetNextOrLastHisPrescription(params)
  1222. } else if (val == 4) {
  1223. let params = {
  1224. patient_id: this.patientInfo.id,
  1225. record_time: this.request_record_date,
  1226. type: 2
  1227. };
  1228. this.GetNextOrLastHisPrescription(params)
  1229. }
  1230. },
  1231. selectTemplate(selection, row) {
  1232. this.tempDrugs = selection
  1233. }, changeTemplateData(selection) {
  1234. this.tempDrugs = selection
  1235. },
  1236. stockInCount: function(row) {
  1237. let total = 0;
  1238. if (row.stock_in != null) {
  1239. for (let i = 0; i < row.stock_in.length; i++) {
  1240. total = total + row.stock_in[i].warehousing_count
  1241. }
  1242. }
  1243. return total
  1244. },
  1245. salesReturnCount: function(row) {
  1246. let total = 0;
  1247. if (row.sales_return != null) {
  1248. for (let i = 0; i < row.sales_return.length; i++) {
  1249. total = total + row.sales_return[i].count
  1250. }
  1251. }
  1252. return total
  1253. },
  1254. stockOutCount: function(row) {
  1255. let total = 0;
  1256. if (row.stock_out != null) {
  1257. for (let i = 0; i < row.stock_out.length; i++) {
  1258. total = total + row.stock_out[i].count
  1259. }
  1260. }
  1261. return total
  1262. },
  1263. cancelStockCount: function(row) {
  1264. let total = 0;
  1265. if (row.cancel_stock != null) {
  1266. for (let i = 0; i < row.cancel_stock.length; i++) {
  1267. total = total + row.cancel_stock[i].count
  1268. }
  1269. }
  1270. return total
  1271. },
  1272. setCharge(additional_charges) {
  1273. for (let i = 0; i < additional_charges.length; i++) {
  1274. additional_charges[i].count = 1;
  1275. this.curPrescriptions.addition.push(additional_charges[i])
  1276. }
  1277. this.$refs.additionalCharges.hide()
  1278. }, searchProjectAction() {
  1279. if (this.search_project_keyword.length == 0) {
  1280. this.tabProject = this.allProject
  1281. } else {
  1282. let arr = [];
  1283. for (let i = 0; i < this.allProject.length; i++) {
  1284. if (this.allProject[i].project_name.indexOf(this.search_project_keyword) != -1 || this.allProject[i].wubi.indexOf(this.search_project_keyword) != -1 || this.allProject[i].pinyin.indexOf(this.search_project_keyword) != -1) {
  1285. arr = arr.concat(this.allProject[i])
  1286. }
  1287. }
  1288. this.tabProject = arr
  1289. }
  1290. },
  1291. searchAction() {
  1292. if (this.search_keyword.length == 0) {
  1293. this.drugs = this.allDrugs
  1294. } else {
  1295. let arr = [];
  1296. for (let i = 0; i < this.drugs.length; i++) {
  1297. 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) {
  1298. arr = arr.concat(this.drugs[i])
  1299. }
  1300. }
  1301. this.drugs = arr
  1302. }
  1303. },
  1304. getTotalOne() {
  1305. var total = 0;
  1306. for (let i = 0; i < this.prescriptions.length; i++) {
  1307. if (this.prescriptions[i].name == this.editableTabsValue) {
  1308. if (this.prescriptions[i].advices != null) {
  1309. for (let a = 0; a < this.prescriptions[i].advices.length; a++) {
  1310. total = total + this.prescriptions[i].advices[a].retail_price * this.prescriptions[i].advices[a].prescribing_number
  1311. }
  1312. }
  1313. if (this.prescriptions[i].project != null) {
  1314. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  1315. total = total + this.prescriptions[i].project[b].price * this.prescriptions[i].project[b].total
  1316. }
  1317. }
  1318. if (this.prescriptions[i].addition != null) {
  1319. for (let b = 0; b < this.prescriptions[i].addition.length; b++) {
  1320. total = total + this.prescriptions[i].addition[b].price * this.prescriptions[i].addition[b].count
  1321. }
  1322. }
  1323. total = Math.floor(total * 100) / 100
  1324. }
  1325. }
  1326. return total
  1327. }, getTotalTwo() {
  1328. var total = 0;
  1329. for (let i = 0; i < this.month_prescriptions.length; i++) {
  1330. if (this.month_prescriptions[i].name == this.editableTabsValueTwo) {
  1331. if (this.month_prescriptions[i].advices != null) {
  1332. for (let a = 0; a < this.month_prescriptions[i].advices.length; a++) {
  1333. total = total + this.month_prescriptions[i].advices[a].retail_price * this.month_prescriptions[i].advices[a].prescribing_number
  1334. }
  1335. }
  1336. if (this.month_prescriptions[i].project != null) {
  1337. for (let b = 0; b < this.month_prescriptions[i].project.length; b++) {
  1338. total = total + this.month_prescriptions[i].project[b].price * this.month_prescriptions[i].project[b].total
  1339. }
  1340. }
  1341. if (this.month_prescriptions[i].addition != null) {
  1342. for (let b = 0; b < this.month_prescriptions[i].addition.length; b++) {
  1343. total = total + this.month_prescriptions[i].addition[b].price * this.month_prescriptions[i].addition[b].count
  1344. }
  1345. }
  1346. total = Math.floor(total * 100) / 100
  1347. }
  1348. }
  1349. return total
  1350. },
  1351. getCurTotal() {
  1352. var total = 0;
  1353. if (this.curPrescriptions.type == 1) {
  1354. for (let a = 0; a < this.curPrescriptions.advices.length; a++) {
  1355. total = total + this.curPrescriptions.advices[a].retail_price * this.curPrescriptions.advices[a].prescribing_number
  1356. }
  1357. return Math.floor(total * 100) / 100
  1358. } else {
  1359. for (let a = 0; a < this.curPrescriptions.project.length; a++) {
  1360. total = total + this.curPrescriptions.project[a].price * this.curPrescriptions.project[a].total
  1361. }
  1362. return Math.floor(total * 100) / 100
  1363. }
  1364. },
  1365. getTotal() {
  1366. var total = 0;
  1367. for (let i = 0; i < this.prescriptions.length; i++) {
  1368. if (this.prescriptions[i].advices != null) {
  1369. for (let a = 0; a < this.prescriptions[i].advices.length; a++) {
  1370. total = total + this.prescriptions[i].advices[a].retail_price * this.prescriptions[i].advices[a].prescribing_number
  1371. }
  1372. }
  1373. if (this.prescriptions[i].project != null) {
  1374. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  1375. total = total + this.prescriptions[i].project[b].price * this.prescriptions[i].project[b].total
  1376. }
  1377. }
  1378. if (this.prescriptions[i].addition != null) {
  1379. for (let b = 0; b < this.prescriptions[i].addition.length; b++) {
  1380. total = total + this.prescriptions[i].addition[b].price * this.prescriptions[i].addition[b].count
  1381. }
  1382. }
  1383. }
  1384. return Math.floor(total * 100) / 100
  1385. }, getMonthTotal() {
  1386. var total = 0;
  1387. for (let i = 0; i < this.month_prescriptions.length; i++) {
  1388. if (this.month_prescriptions[i].advices != null) {
  1389. for (let a = 0; a < this.month_prescriptions[i].advices.length; a++) {
  1390. total = total + this.month_prescriptions[i].advices[a].retail_price * this.month_prescriptions[i].advices[a].prescribing_number
  1391. }
  1392. }
  1393. if (this.month_prescriptions[i].project != null) {
  1394. for (let b = 0; b < this.month_prescriptions[i].project.length; b++) {
  1395. total = total + this.month_prescriptions[i].project[b].price * this.month_prescriptions[i].project[b].total
  1396. }
  1397. }
  1398. if (this.month_prescriptions[i].addition != null) {
  1399. for (let b = 0; b < this.month_prescriptions[i].addition.length; b++) {
  1400. total = total + this.month_prescriptions[i].addition[b].price * this.month_prescriptions[i].addition[b].count
  1401. }
  1402. }
  1403. }
  1404. return Math.floor(total * 100) / 100
  1405. },
  1406. createFilter(queryString) {
  1407. return (restaurant) => {
  1408. return (restaurant.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0)
  1409. }
  1410. },
  1411. querySearch2(queryString, cb) {
  1412. var restaurants = this.other_sick;
  1413. restaurants.map(item => {
  1414. item.value = item.name
  1415. });
  1416. var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants;
  1417. // 调用 callback 返回建议列表的数据
  1418. cb(results)
  1419. },
  1420. changeKind(val) {
  1421. this.drugs = [];
  1422. if (val == 0) {
  1423. this.drugs = this.allDrugs
  1424. } else {
  1425. for (let i = 0; i < this.allDrugs.length; i++) {
  1426. if (this.allDrugs[i].drug_type == val) {
  1427. this.drugs.push(this.allDrugs[i])
  1428. }
  1429. }
  1430. }
  1431. },
  1432. getDictionaryDataConfig(module, filed_name) {
  1433. return getDictionaryDataConfig(module, filed_name)
  1434. },
  1435. getInitData() {
  1436. getInitData().then(response => {
  1437. if (response.data.state == 0) {
  1438. this.$message.error(response.data.msg);
  1439. return false
  1440. } else {
  1441. this.drugs = response.data.data.drugs;
  1442. this.allDrugs = response.data.data.drugs;
  1443. this.advices_template = response.data.data.advices_template;
  1444. this.doctors = response.data.data.doctors;
  1445. for (let i = 0; i < this.doctors.length; i++){
  1446. if(this.doctors[i].user_type == 1){
  1447. this.doctors.splice(i,1)
  1448. }
  1449. }
  1450. this.department = response.data.data.department;
  1451. this.sick = response.data.data.sick;
  1452. this.diagnoses = response.data.data.diagnose;
  1453. this.additions = response.data.data.additions
  1454. // var info = response.data.data.info
  1455. // if (info.user_type == 2 || info.user_type == 1) {
  1456. // this.doctorValue = info.admin_user_id
  1457. // if (info.department_id == 0) {
  1458. // if (this.department.length > 0) {
  1459. // this.departmentValue = this.department[0].id
  1460. // } else {
  1461. // this.departmentValue = ''
  1462. //
  1463. // }
  1464. // } else {
  1465. // this.departmentValue = info.department_id
  1466. // }
  1467. // }else{
  1468. // this.doctorValue = this.doctors[0].admin_user_id
  1469. // }
  1470. }
  1471. })
  1472. },
  1473. monthTabclickEvent(val) {
  1474. console.log(val);
  1475. console.log(this.month_prescriptions);
  1476. for (let i = 0; i < this.month_prescriptions.length; i++) {
  1477. if (this.month_prescriptions[i].name == val.name) {
  1478. if (this.dayorMonth == 'month') {
  1479. if (this.isShowDayPrescription) {
  1480. this.curDayPrescriptions = this.month_prescriptions[i];
  1481. console.log(this.curDayPrescriptions);
  1482. //用来区分处方属于项目还是药品
  1483. if (this.curDayPrescriptions.advices.length > 0 && this.curDayPrescriptions.project.length == 0) {
  1484. this.monthCustomTabIndex = 1
  1485. }
  1486. if (this.curDayPrescriptions.advices.length == 0 && this.curDayPrescriptions.project.length > 0) {
  1487. this.monthCustomTabIndex = 2
  1488. }
  1489. } else {
  1490. this.curMonthPrescriptions = this.month_prescriptions[i];
  1491. //用来区分处方属于项目还是药品
  1492. if (this.curMonthPrescriptions.advices.length > 0 && this.curMonthPrescriptions.project.length == 0) {
  1493. this.monthCustomTabIndex = 1
  1494. }
  1495. if (this.curMonthPrescriptions.advices.length == 0 && this.curMonthPrescriptions.project.length > 0) {
  1496. this.monthCustomTabIndex = 2
  1497. }
  1498. }
  1499. }
  1500. this.teamList = [];
  1501. this.curDrugs = [];
  1502. this.$refs.multipleTable.clearSelection();
  1503. this.$refs.tables.clearSelection()
  1504. }
  1505. }
  1506. },
  1507. tabclickEvent(val) {
  1508. for (let i = 0; i < this.prescriptions.length; i++) {
  1509. if (this.prescriptions[i].name == val.name) {
  1510. this.prescription_id = this.prescriptions[i].id;
  1511. this.$emit('event1', this.prescription_id);
  1512. this.curPrescriptions = this.prescriptions[i];
  1513. this.teamList = [];
  1514. this.curDrugs = [];
  1515. this.$refs.multipleTable.clearSelection();
  1516. this.$refs.tables.clearSelection();
  1517. //用来区分处方属于项目还是药品
  1518. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  1519. this.customTabIndex = 1;
  1520. this.curStatus = 1;
  1521. this.rightTab = 1;
  1522. this.showOne = true;
  1523. this.showTwo = false
  1524. }
  1525. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  1526. this.customTabIndex = 2;
  1527. this.curStatus = 2;
  1528. this.rightTab = 2;
  1529. this.showTwo = true;
  1530. this.showOne = false
  1531. }
  1532. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length == 0) {
  1533. this.customTabIndex = this.rightTab;
  1534. this.curStatus = 0
  1535. }
  1536. }
  1537. }
  1538. },
  1539. clearData() {
  1540. this.curPrescriptions = [];
  1541. this.curStatus = 0;
  1542. this.curDrugs = [];
  1543. this.preDrugs = [];
  1544. this.teamList = []
  1545. },
  1546. setData(data, info, admin_info, doctors, department, hisPatientInfo, month_data) {
  1547. for (let i = 0; i < doctors.length; i++){
  1548. if(doctors[i].user_type == 1){
  1549. doctors.splice(i,1)
  1550. }
  1551. }
  1552. this.curMonthPrescriptions = {};
  1553. this.curPrescriptions = {};
  1554. this.prescription_id = data[0].id;
  1555. this.editableTabsValue = '处方1';
  1556. this.dayorMonth = 'day';
  1557. this.$emit('event1', this.prescription_id);
  1558. this.curStatus = 0;
  1559. this.curPrescriptions = {};
  1560. this.curMonthPrescriptions = {};
  1561. if (month_data && month_data.length > 0) {
  1562. this.curMonthPrescriptions = month_data[0]
  1563. } else {
  1564. this.curMonthPrescriptions = {}
  1565. }
  1566. if (data && data.length > 0) {
  1567. this.curPrescriptions = data[0]
  1568. } else {
  1569. this.curPrescriptions = {}
  1570. }
  1571. this.diagnose = info.diagnosis;
  1572. if (this.diagnose == 0) {
  1573. this.diagnose = ''
  1574. }
  1575. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  1576. this.curStatus = 1;
  1577. this.customTabIndex = 1;
  1578. this.rightTab = 1;
  1579. this.showOne = true;
  1580. this.showTwo = false
  1581. }
  1582. if (this.curPrescriptions.project.length > 0 && this.curPrescriptions.advices.length == 0) {
  1583. this.curStatus = 2;
  1584. this.customTabIndex = 2;
  1585. this.rightTab = 2;
  1586. this.showOne = false;
  1587. this.showTwo = true
  1588. }
  1589. this.state1 = info.sick_type;
  1590. if (this.state1 == 0) {
  1591. this.state1 = ''
  1592. }
  1593. this.state2 = info.sick_history;
  1594. if (this.state2 == 0) {
  1595. this.state2 = ''
  1596. }
  1597. if (info.prescription_status == 0) {
  1598. this.order_status = ''
  1599. }
  1600. if (info.prescription_status == 1 || info.prescription_status == 2) {
  1601. this.order_status = '未收费'
  1602. }
  1603. if (info.prescription_status == 3) {
  1604. this.order_status = '已结算'
  1605. }
  1606. if (info.prescription_status == 4) {
  1607. this.order_status = '已退费'
  1608. }
  1609. if (info.id > 0) {
  1610. this.doctorValue = info.doctor_id;
  1611. this.departmentValue = info.departments
  1612. } else {
  1613. if (hisPatientInfo.doctor != 0 && hisPatientInfo.department != 0) {
  1614. this.doctorValue = hisPatientInfo.doctor;
  1615. this.departmentValue = hisPatientInfo.department
  1616. } else {
  1617. if (admin_info.user_type == 2 || admin_info.user_type == 1) {
  1618. this.doctorValue = admin_info.admin_user_id;
  1619. if (admin_info.department_id == 0) {
  1620. if (this.department.length > 0) {
  1621. if (department && department.length > 0) {
  1622. this.departmentValue = department[0].id
  1623. } else {
  1624. this.departmentValue = ''
  1625. }
  1626. } else {
  1627. this.departmentValue = ''
  1628. }
  1629. } else {
  1630. this.departmentValue = admin_info.department_id
  1631. }
  1632. } else {
  1633. this.doctorValue = doctors[0].admin_user_id
  1634. }
  1635. if (this.doctorValue == 0) {
  1636. this.doctorValue = ''
  1637. }
  1638. }
  1639. }
  1640. if (info.register_type == 0) {
  1641. this.register_type = ''
  1642. } else {
  1643. this.register_type = info.register_type
  1644. }
  1645. },
  1646. moreState(tab, event) {
  1647. if (tab == 'more') {
  1648. return false
  1649. }
  1650. }, open_two() {
  1651. if (this.dayorMonth == 'day') {
  1652. if (this.curPrescriptions.order_status == 2) {
  1653. this.$message.error('处方已经结算,无法添加');
  1654. return
  1655. }
  1656. if (this.patientInfo == null || this.patientInfo.id == 0) {
  1657. this.$message.error('请选择患者');
  1658. return
  1659. }
  1660. let params = {
  1661. end_time: this.record_date,
  1662. start_time: moment(new Date()).subtract(30, 'days').format('YYYY-MM-DD'),
  1663. patient_id: this.patientInfo.id
  1664. };
  1665. getCallHisPrescription(params).then(response => {
  1666. if (response.data.state == 1) {
  1667. this.$refs.call_prescription.show(this.patientInfo.name, this.patientInfo.id, params.end_time, params.start_time, this.prescriptions, response.data.data.prescriptions)
  1668. } else {
  1669. this.$message.error(response.data.msg)
  1670. }
  1671. })
  1672. } else {
  1673. this.$message.error('当前属于月结状态,无法试用处方调用');
  1674. }
  1675. },
  1676. open(index, isLoading) {
  1677. if (this.dayorMonth == 'day') {
  1678. if (this.prescriptions[0].advices.length == 0 && this.prescriptions[0].project.length == 0) {
  1679. this.$message.error('请先开处方');
  1680. return
  1681. }
  1682. }
  1683. if (this.dayorMonth == 'day') {
  1684. if (this.curPrescriptions.order_status == 2) {
  1685. this.$message.error('当前处方已经结算,无法保存');
  1686. return
  1687. }
  1688. if (this.doctorValue.length <= 0) {
  1689. this.$message.error('医生不能为空');
  1690. return
  1691. }
  1692. if (this.departmentValue.length <= 0) {
  1693. this.$message.error('科室不能为空');
  1694. return
  1695. }
  1696. if (this.state1 <= 0) {
  1697. this.$message.error('疾病类型不能为空');
  1698. return
  1699. }
  1700. if (index == 1) {
  1701. let params = {
  1702. p_type:2,
  1703. patient_id: this.patientInfo.id,
  1704. diagnose: this.diagnose,
  1705. sick_type: this.state1,
  1706. sick_history: this.state2,
  1707. doctor: this.doctorValue,
  1708. department: this.departmentValue,
  1709. record_date: this.record_date,
  1710. his_patient_id: this.hisPatientInfo.id,
  1711. reg_type: this.register_type
  1712. };
  1713. for (let i = 0; i < this.prescriptions.length; i++) {
  1714. if (this.prescriptions[i].advices.length > 0 && this.prescriptions[i].project.length == 0) {
  1715. this.prescriptions[i]['type'] = 1
  1716. }
  1717. if (this.prescriptions[i].advices.length == 0 && this.prescriptions[i].project.length > 0) {
  1718. this.prescriptions[i]['type'] = 2
  1719. }
  1720. for (let b = 0; b < this.prescriptions[i].advices.length; b++) {
  1721. this.prescriptions[i].advices[b].single_dose = this.prescriptions[i].advices[b].single_dose.toString();
  1722. this.prescriptions[i].advices[b].prescribing_number = this.prescriptions[i].advices[b].prescribing_number.toString();
  1723. this.prescriptions[i].advices[b].retail_price = this.prescriptions[i].advices[b].retail_price.toString();
  1724. this.prescriptions[i].advices[b].day = parseInt(this.prescriptions[i].advices[b].day)
  1725. }
  1726. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  1727. this.prescriptions[i].project[b].price = this.prescriptions[i].project[b].price.toString();
  1728. this.prescriptions[i].project[b].total = this.prescriptions[i].project[b].total.toString();
  1729. this.prescriptions[i].project[b].delivery_way = this.prescriptions[i].project[b].delivery_way.toString()
  1730. }
  1731. for (let b = 0; b < this.prescriptions[i].addition.length; b++) {
  1732. this.prescriptions[i].addition[b].id = parseInt(this.prescriptions[i].addition[b].id);
  1733. this.prescriptions[i].addition[b].item_id = parseInt(this.prescriptions[i].addition[b].item_id);
  1734. this.prescriptions[i].addition[b].price = this.prescriptions[i].addition[b].price.toString();
  1735. this.prescriptions[i].addition[b].count = this.prescriptions[i].addition[b].count.toString()
  1736. }
  1737. }
  1738. let data = {
  1739. 'prescriptions': this.prescriptions
  1740. };
  1741. isLoading = true;
  1742. createHisPrescription(data, params).then(response => {
  1743. if (response.data.state == 1) {
  1744. this.$emit('change',this.patientInfo.id);
  1745. this.$message.success('保存成功')
  1746. }
  1747. })
  1748. } else if (index == 2) {
  1749. this.$router.push('/outpatientDoctorStation/print')
  1750. } else if (index == 4) {
  1751. } else if (index == 5) {
  1752. this.$refs.saveTemplate.show()
  1753. }
  1754. } else if (this.dayorMonth == 'month') {
  1755. if (this.isShowDayPrescription) {
  1756. if (this.curDayPrescriptions.order_status == 2) {
  1757. this.$message.error('当前处方已经结算,无法保存');
  1758. return
  1759. }
  1760. if (this.doctorValue.length <= 0) {
  1761. this.$message.error('医生不能为空');
  1762. return
  1763. }
  1764. if (this.departmentValue.length <= 0) {
  1765. this.$message.error('科室不能为空');
  1766. return
  1767. }
  1768. if (index == 1) {
  1769. let params = {
  1770. patient_id: this.patientInfo.id,
  1771. diagnose: this.diagnose,
  1772. sick_type: this.state1,
  1773. sick_history: this.state2,
  1774. doctor: this.doctorValue,
  1775. department: this.departmentValue,
  1776. record_date: this.end_time,
  1777. his_patient_id: this.hisPatientInfo.id,
  1778. reg_type: this.register_type,
  1779. p_type: 2,
  1780. };
  1781. var month_prescriptions = this.deepClone(this.month_prescriptions);
  1782. for (let i = 0; i < month_prescriptions.length; i++) {
  1783. if (month_prescriptions[i].advices.length > 0 && month_prescriptions[i].project.length == 0) {
  1784. month_prescriptions[i]['type'] = 1
  1785. }
  1786. if (month_prescriptions[i].advices.length == 0 && month_prescriptions[i].project.length > 0) {
  1787. month_prescriptions[i]['type'] = 2
  1788. }
  1789. for (let b = 0; b < month_prescriptions[i].advices.length; b++) {
  1790. month_prescriptions[i].advices[b].single_dose = month_prescriptions[i].advices[b].single_dose.toString();
  1791. month_prescriptions[i].advices[b].prescribing_number = month_prescriptions[i].advices[b].prescribing_number.toString();
  1792. month_prescriptions[i].advices[b].retail_price = month_prescriptions[i].advices[b].retail_price.toString();
  1793. month_prescriptions[i].advices[b].day = parseInt(month_prescriptions[i].advices[b].day)
  1794. }
  1795. for (let b = 0; b < month_prescriptions[i].project.length; b++) {
  1796. console.log('~~~~~~~');
  1797. month_prescriptions[i].project[b].price = month_prescriptions[i].project[b].price.toString();
  1798. month_prescriptions[i].project[b].total = month_prescriptions[i].project[b].total.toString();
  1799. month_prescriptions[i].project[b].delivery_way = month_prescriptions[i].project[b].delivery_way.toString()
  1800. }
  1801. for (let b = 0; b < month_prescriptions[i].addition.length; b++) {
  1802. month_prescriptions[i].addition[b].id = parseInt(month_prescriptions[i].addition[b].id);
  1803. month_prescriptions[i].addition[b].item_id = parseInt(month_prescriptions[i].addition[b].item_id);
  1804. month_prescriptions[i].addition[b].price = month_prescriptions[i].addition[b].price.toString();
  1805. month_prescriptions[i].addition[b].count = month_prescriptions[i].addition[b].count.toString()
  1806. }
  1807. }
  1808. let data = {
  1809. 'prescriptions': month_prescriptions
  1810. };
  1811. editHisPrescription(data, params).then(response => {
  1812. if (response.data.state == 1) {
  1813. this.month_prescriptions = month_prescriptions;
  1814. this.$message.success('编辑成功')
  1815. }
  1816. })
  1817. }
  1818. }
  1819. }
  1820. },
  1821. addTab(targetName) {
  1822. if (this.curPrescriptions.order_status == 2) {
  1823. this.$message.error('该处方已经结算或者退费,无法继续添加处方');
  1824. return
  1825. }
  1826. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length == 0) {
  1827. this.$message.error('当前处方无数据,新增数据后才能新增处方');
  1828. return
  1829. }
  1830. this.tabIndex = this.prescriptions.length;
  1831. ++this.tabIndex;
  1832. let newTabName = '处方' + this.tabIndex;
  1833. var nowDate = new Date();
  1834. var nowYear = nowDate.getFullYear();
  1835. var nowMonth = nowDate.getMonth() + 1;
  1836. var nowDay = nowDate.getDate();
  1837. var hours = nowDate.getHours();
  1838. var min = nowDate.getMinutes();
  1839. var nowTime =
  1840. nowYear +
  1841. '-' +
  1842. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  1843. '-' +
  1844. (nowDay < 10 ? '0' + nowDay : nowDay) + ' ' + (hours < 10 ? '0' + hours : hours) +
  1845. ':' + (min < 10 ? '0' + min : min);
  1846. this.prescriptions.push({
  1847. id: 0,
  1848. name: newTabName,
  1849. order_status: 0,
  1850. advices: [],
  1851. project: [],
  1852. addition: [],
  1853. pre_time: nowTime
  1854. });
  1855. this.editableTabsValue = newTabName;
  1856. this.curPrescriptions = this.prescriptions[this.prescriptions.length - 1];
  1857. this.curStatus = 0
  1858. },
  1859. removeTab(targetName) {
  1860. if (this.curPrescriptions.order_status == 2) {
  1861. this.$message.error('该处方已经结算,无法删除');
  1862. return
  1863. }
  1864. if (targetName == '处方1') {
  1865. this.$message.error('该处方无法删除');
  1866. return
  1867. }
  1868. this.$confirm('处方删除后不可恢复,是否确认删除', '删除', {
  1869. confirmButtonText: '确 定',
  1870. cancelButtonText: '取 消',
  1871. type: 'warning'
  1872. }).then(() => {
  1873. let id = 0;
  1874. for (let i = 0; i < this.prescriptions.length; i++) {
  1875. if (this.prescriptions[i].name == targetName) {
  1876. id = this.prescriptions[i].id
  1877. }
  1878. }
  1879. if (id == 0) {
  1880. let tabs = this.prescriptions;
  1881. let activeName = this.editableTabsValue;
  1882. if (activeName === targetName) {
  1883. tabs.forEach((tab, index) => {
  1884. if (tab.name === targetName) {
  1885. let nextTab = tabs[index + 1] || tabs[index - 1];
  1886. if (nextTab) {
  1887. activeName = nextTab.name
  1888. }
  1889. }
  1890. })
  1891. }
  1892. this.editableTabsValue = activeName;
  1893. this.prescriptions = tabs.filter(tab => tab.name !== targetName);
  1894. for (let i = 0; i < this.prescriptions.length; i++) {
  1895. if (activeName == this.prescriptions[i].name) {
  1896. this.curPrescriptions = this.prescriptions[i];
  1897. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  1898. this.curStatus = 1
  1899. }
  1900. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  1901. this.curStatus = 2
  1902. }
  1903. }
  1904. }
  1905. if (this.prescriptions.length == 0) {
  1906. this.curPrescriptions = [];
  1907. this.curStatus = 0
  1908. }
  1909. } else {
  1910. let params = {
  1911. 'id': id
  1912. };
  1913. delHisPrescription(params).then(response => {
  1914. if (response.data.state == 1) {
  1915. this.$message.success('删除成功');
  1916. let tabs = this.prescriptions;
  1917. let activeName = this.editableTabsValue;
  1918. if (activeName === targetName) {
  1919. tabs.forEach((tab, index) => {
  1920. if (tab.name === targetName) {
  1921. let nextTab = tabs[index + 1] || tabs[index - 1];
  1922. if (nextTab) {
  1923. activeName = nextTab.name
  1924. }
  1925. }
  1926. })
  1927. }
  1928. this.editableTabsValue = activeName;
  1929. this.prescriptions = tabs.filter(tab => tab.name !== targetName);
  1930. for (let i = 0; i < this.prescriptions.length; i++) {
  1931. if (activeName == this.prescriptions[i].name) {
  1932. this.curPrescriptions = this.prescriptions[i];
  1933. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  1934. this.curStatus = 1
  1935. }
  1936. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  1937. this.curStatus = 2
  1938. }
  1939. }
  1940. }
  1941. if (this.prescriptions.length == 0) {
  1942. this.curPrescriptions = [];
  1943. this.curStatus = 0
  1944. }
  1945. } else {
  1946. this.$message.success(response.data.msg)
  1947. }
  1948. })
  1949. }
  1950. }).catch(() => {
  1951. })
  1952. },
  1953. beforeLeave(activeName, oldActiveName) {
  1954. let index = activeName;
  1955. if (index == 1) {
  1956. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  1957. return false
  1958. }
  1959. } else {
  1960. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  1961. return false
  1962. }
  1963. }
  1964. },
  1965. clickTab(tab) {
  1966. let index = parseInt(tab.name);
  1967. if (index == 1) {
  1968. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  1969. this.$message.error('当前处方为项目,无法切换为药品,需要新开处方');
  1970. return
  1971. }
  1972. } else {
  1973. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  1974. this.$message.error('当前处方为药品,无法切换为项目,需要新开处方');
  1975. return
  1976. }
  1977. }
  1978. if (index == 1) {
  1979. this.teamList = [];
  1980. this.$refs.tables.clearSelection();
  1981. this.showOne = true;
  1982. this.showTwo = false;
  1983. this.$nextTick(() => {
  1984. this.$refs.prescription_tables.setNewData(this.prescriptions[this.prescriptions.length - 1])
  1985. });
  1986. this.customTabIndex = 1
  1987. }
  1988. if (index == 2) {
  1989. this.curDrugs = [];
  1990. this.$refs.multipleTable.clearSelection();
  1991. this.showTwo = true;
  1992. this.showOne = false;
  1993. this.$nextTick(() => {
  1994. this.$refs.prescription_tables.setNewData(this.prescriptions[this.prescriptions.length - 1])
  1995. });
  1996. this.customTabIndex = 2
  1997. }
  1998. this.rightTab = index;
  1999. //用来区分处方属于项目还是药品
  2000. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  2001. this.customTabIndex = 1;
  2002. this.curStatus = 1
  2003. }
  2004. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  2005. this.customTabIndex = 2;
  2006. this.curStatus = 2
  2007. }
  2008. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length == 0) {
  2009. // this.customTabIndex = this.rightTab
  2010. this.customTabIndex = index;
  2011. this.curStatus = 0
  2012. }
  2013. }, changeAllGoodInfoTableData: function(selection) {
  2014. this.curDrugs = selection
  2015. }, addCharges() {
  2016. this.$refs.additionalCharges.show()
  2017. },
  2018. selectDrugs(selection, row) {
  2019. this.curDrugs = selection
  2020. },
  2021. comfirm() {
  2022. console.log("222222222222",this.curPrescriptions);
  2023. if (this.curPrescriptions.order_status == 2) {
  2024. this.$message.error('该处方已经结算,无法继续添加药品或者项目');
  2025. this.teamList = [];
  2026. this.curDrugs = [];
  2027. this.tempDrugs = [];
  2028. this.$refs.tables.clearSelection();
  2029. this.$refs.multipleTableTwo.clearSelection();
  2030. this.$refs.multipleTable.clearSelection();
  2031. return
  2032. }
  2033. if (this.curStatus == 1 && this.rightTab == 2) {
  2034. this.$message.error('改处方是药品,无法添加项目');
  2035. this.teamList = [];
  2036. this.$refs.tables.clearSelection();
  2037. return
  2038. }
  2039. if (this.curStatus == 2 && this.rightTab == 1) {
  2040. this.$message.error('改处方是项目,无法添加药品');
  2041. this.curDrugs = [];
  2042. this.tempDrugs = [];
  2043. this.$refs.multipleTable.clearSelection();
  2044. this.$refs.multipleTableTwo.clearSelection();
  2045. return
  2046. }
  2047. for (let i = 0; i < this.teamList.length; i++) {
  2048. for (let a = 0; a < this.curPrescriptions.project.length; a++) {
  2049. if (this.teamList[i].id == this.curPrescriptions.project[a].project_id) {
  2050. this.$message.error('当前处方存在相同的药品,无法添加相同的项目');
  2051. return
  2052. }
  2053. }
  2054. }
  2055. console.log( this.curDrugs);
  2056. console.log( this.curPrescriptions.advices);
  2057. for (let i = 0; i < this.curDrugs.length; i++) {
  2058. for (let a = 0; a < this.curPrescriptions.advices.length; a++) {
  2059. if (this.curDrugs[i].id == this.curPrescriptions.advices[a].id) {
  2060. this.$message.error('当前处方存在相同的药品,无法添加相同的药品');
  2061. return
  2062. }
  2063. }
  2064. }
  2065. let templateDrugs = [];
  2066. for (let i = 0; i < this.tempDrugs.length; i++) {
  2067. for (let a = 0; a < this.tempDrugs[i].advices.length; a++) {
  2068. templateDrugs.push(this.tempDrugs[i].advices[a])
  2069. }
  2070. }
  2071. // for (let i = 0; i < templateDrugs.length; i++) {
  2072. // for (let a = 0; a < this.curPrescriptions.advices.length; a++) {
  2073. // if (this.templateDrugs[i].drug_id == this.curPrescriptions.advices[i].id) {
  2074. // this.$message.error('改处方存在相同的药品,无法添加相同的药品')
  2075. // return
  2076. //
  2077. // }
  2078. // }
  2079. // }
  2080. for (let i = 0; i < this.prescriptions.length; i++) {
  2081. if (this.prescriptions[i].name == this.editableTabsValue) {
  2082. var temp = this.deepClone(this.curDrugs);
  2083. var temp2 = this.deepClone(this.teamList);
  2084. var temp3 = this.deepClone(templateDrugs);
  2085. if (temp3.length > 0) {
  2086. for (let b = 0; b < temp3.length; b++) {
  2087. let obj = {
  2088. advice_id: 0,
  2089. id: temp3[b].id,
  2090. drug_name: temp3[b].advice_name,
  2091. single_dose: temp3[b].single_dose,
  2092. delivery_way: temp3[b].delivery_way,
  2093. execution_frequency: temp3[b].execution_frequency,
  2094. retail_price: temp3[b].drug.retail_price.toString(),
  2095. remark: '',
  2096. day: 1,
  2097. prescribing_number: temp3[b].prescribing_number,
  2098. single_dose_unit: temp3[b].drug.min_unit,
  2099. prescribing_number_unit: temp3[b].drug.max_unit,
  2100. medical_insurance_number: temp3[b].drug.medical_insurance_number
  2101. };
  2102. if (obj.prescribing_number == 0 || obj.prescribing_number.length == 0) {
  2103. obj.prescribing_number = 1
  2104. }
  2105. this.prescriptions[i].advices.push(obj)
  2106. }
  2107. this.curStatus = 1
  2108. }
  2109. if (temp.length > 0) {
  2110. for (let b = 0; b < temp.length; b++) {
  2111. let obj = {
  2112. advice_id: 0,
  2113. id: temp[b].id,
  2114. drug_name: temp[b].drug_name,
  2115. single_dose: temp[b].single_dose,
  2116. delivery_way: temp[b].delivery_way,
  2117. execution_frequency: temp[b].execution_frequency,
  2118. retail_price: temp[b].retail_price.toString(),
  2119. remark: '',
  2120. day: 1,
  2121. prescribing_number: temp[b].prescribing_number,
  2122. single_dose_unit: temp[b].min_unit,
  2123. prescribing_number_unit: temp[b].max_unit,
  2124. medical_insurance_number: temp[b].medical_insurance_number
  2125. };
  2126. if (obj.prescribing_number == 0 || obj.prescribing_number.length == 0) {
  2127. obj.prescribing_number = 1
  2128. }
  2129. this.prescriptions[i].advices.push(obj)
  2130. }
  2131. this.curStatus = 1
  2132. }
  2133. if(this.activeName == 2){
  2134. for(let i = 0; i<temp2.length;i++){
  2135. for(let j=0;j<this.hisList.length;j++){
  2136. if(temp2[i].id == this.hisList[j].project_id){
  2137. temp2[i].total = this.hisList[j].number
  2138. }
  2139. }
  2140. }
  2141. }
  2142. if (temp2.length > 0) {
  2143. console.log("temp2222222222",temp2);
  2144. for (let b = 0; b < temp2.length; b++) {
  2145. let obj = {
  2146. id: 0,
  2147. project_id: temp2[b].id,
  2148. project_name: temp2[b].project_name,
  2149. statistical_classification: temp2[b].statistical_classification,
  2150. single_dose: temp2[b].single_dose,
  2151. delivery_way: temp2[b].delivery_way,
  2152. execution_frequency: temp2[b].execution_frequency,
  2153. number_days: temp2[b].number_days,
  2154. total: temp2[b].total,
  2155. price: temp2[b].price,
  2156. remark: '',
  2157. medical_code: temp2[b].medical_code,
  2158. unit: temp2[b].unit
  2159. };
  2160. if (obj.total == 0) {
  2161. obj.total = 1
  2162. }
  2163. this.prescriptions[i].project.push(obj)
  2164. }
  2165. this.curStatus = 2
  2166. }
  2167. this.curPrescriptions = this.prescriptions[i];
  2168. this.$refs.multipleTable.clearSelection();
  2169. this.$refs.tables.clearSelection()
  2170. }
  2171. }
  2172. this.curDrugs = [];
  2173. this.preDrugs = [];
  2174. this.teamList = []
  2175. }, changeAllGoodInfoTableDataTwo(row) {
  2176. this.teamList = row
  2177. },
  2178. selectChange(row) {
  2179. this.teamList = row
  2180. },
  2181. getlist() {
  2182. getHisProject().then(response => {
  2183. if (response.data.state == 1) {
  2184. var project = response.data.data.project;
  2185. this.tabProject = project;
  2186. this.allProject = project
  2187. }
  2188. })
  2189. }, deepClone(source) {
  2190. if (!source && typeof source !== 'object') {
  2191. throw new Error('error arguments', 'shallowClone')
  2192. }
  2193. const targetObj = source.constructor === Array ? [] : {};
  2194. Object.keys(source).forEach((keys) => {
  2195. if (source[keys] && typeof source[keys] === 'object') {
  2196. targetObj[keys] = this.deepClone(source[keys])
  2197. } else {
  2198. targetObj[keys] = source[keys]
  2199. }
  2200. });
  2201. return targetObj
  2202. },
  2203. getAllProjectTeam() {
  2204. getAllProjectTeam().then(response => {
  2205. if (response.data.state == 1) {
  2206. var team = response.data.data.team;
  2207. console.log("team2222",team);
  2208. this.tabPrjectTeam = team
  2209. }
  2210. })
  2211. },
  2212. selectTeam(row) {
  2213. console.log("row",row);
  2214. var arr = [];
  2215. for (let i = 0; i < row.length; i++) {
  2216. arr.push(row[i].project_id)
  2217. }
  2218. var ids = arr.join(',');
  2219. var strArr = ids.split(',');
  2220. var res = [];//接收不重复的数据
  2221. for (var i = 0; i < strArr.length; i++) {
  2222. var flag = true;
  2223. for (var j = 0; j < i; j++) {
  2224. if (strArr[i] === strArr[j]) {
  2225. flag = false;
  2226. break
  2227. }
  2228. }
  2229. if (flag) {
  2230. res.push(strArr[i])
  2231. }
  2232. }
  2233. var idstr = res.join(',');
  2234. const params = {
  2235. project_id: idstr
  2236. };
  2237. getPojectListById(params).then(response => {
  2238. if (response.data.state == 1) {
  2239. var project = response.data.data.project;
  2240. this.teamList = [];
  2241. this.teamList = project
  2242. }
  2243. })
  2244. }, changeDoctor(val) {
  2245. for (let i = 0; i < this.doctors.length; i++) {
  2246. if (this.doctors[i].admin_user_id == this.doctorValue) {
  2247. this.departmentValue = this.doctors[i].department_id
  2248. }
  2249. }
  2250. if (this.departmentValue == 0) {
  2251. this.departmentValue = ''
  2252. }
  2253. },
  2254. changeDayOrMonth(tab) {
  2255. if (this.dayorMonth == 'day') {
  2256. } else if (this.dayorMonth == 'month') {
  2257. }
  2258. },
  2259. getAllProjectList(){
  2260. getAllProjectList().then(response=>{
  2261. if(response.data.state == 1){
  2262. var hisprojectlist = response.data.data.hisprojectlist;
  2263. console.log("hisprojectlist",hisprojectlist);
  2264. this.hisList = hisprojectlist
  2265. }
  2266. })
  2267. }
  2268. }, mounted() {
  2269. this.request_record_date = this.record_date;
  2270. this.getInitData();
  2271. //获取所有项目
  2272. this.getlist();
  2273. //获取所以项目组套
  2274. this.getAllProjectTeam();
  2275. this.getAllProjectList();
  2276. this.$nextTick(() => {
  2277. this.multipleTableHeight = parseInt(this.$refs.rightTable.offsetHeight)
  2278. })
  2279. },
  2280. watch: {
  2281. fullHeight(val) {
  2282. if (!this.timer) {
  2283. this.fullHeight = val;
  2284. let tableHeight = val - 263;
  2285. this.tableHeight = tableHeight;
  2286. this.multipleTableHeight = parseInt(this.$refs.rightTable.offsetHeight);
  2287. this.timer = true;
  2288. let that = this;
  2289. setTimeout(function() {
  2290. that.timer = false
  2291. }, 400)
  2292. }
  2293. }
  2294. }
  2295. }
  2296. </script>
  2297. <style lang="scss" scoped>
  2298. .new-main-contain {
  2299. height: 100%;
  2300. display: flex;
  2301. flex-direction: column;
  2302. }
  2303. .app-container {
  2304. height: 100%;
  2305. }
  2306. .mainCell {
  2307. height: 36px;
  2308. display: flex;
  2309. align-items: center;
  2310. }
  2311. .mainLeft {
  2312. width: 200px;
  2313. height: 100%;
  2314. display: flex;
  2315. flex-direction: column;
  2316. margin-top: 2px;
  2317. .el-radio {
  2318. margin-right: 5px;
  2319. }
  2320. }
  2321. .mainRight {
  2322. margin-left: 20px;
  2323. flex: 1;
  2324. height: 100%;
  2325. display: flex;
  2326. flex-direction: column;
  2327. .cellSpan {
  2328. min-width: 80px;
  2329. display: inline-block;
  2330. margin-right: 10px;
  2331. }
  2332. }
  2333. .mainCenter {
  2334. display: flex;
  2335. flex: 1;
  2336. height: 100%;
  2337. }
  2338. .centerLeft {
  2339. flex: 1;
  2340. display: flex;
  2341. flex-direction: column;
  2342. position: relative;
  2343. .el-form-item {
  2344. width: 33%;
  2345. margin-bottom: 14px;
  2346. }
  2347. .el-form-item__label {
  2348. text-align: left;
  2349. }
  2350. }
  2351. .backColor {
  2352. background: #f6f8f9;
  2353. height: 5px;
  2354. margin-bottom: 5px;
  2355. }
  2356. .RP {
  2357. color: #409EFF;
  2358. font-size: 14px;
  2359. margin-bottom: 5px;
  2360. }
  2361. .tabsBox {
  2362. position: relative;
  2363. flex: 1;
  2364. overflow-y: auto;
  2365. margin-bottom: 60px;
  2366. /*/ / margin-top: 4 px;*/
  2367. .el-tabs__item {
  2368. padding: 0 10px;
  2369. }
  2370. }
  2371. .preTabs {
  2372. height: 100%;
  2373. display: flex;
  2374. flex-direction: column;
  2375. .el-tabs__content {
  2376. flex: 1;
  2377. overflow-y: auto;
  2378. }
  2379. }
  2380. .costBox {
  2381. width: 100%;
  2382. height: 60px;
  2383. background: #fff;
  2384. position: absolute;
  2385. bottom: 0;
  2386. display: flex;
  2387. align-items: center;
  2388. justify-content: space-between;
  2389. }
  2390. .statusRed {
  2391. color: red;
  2392. }
  2393. .addTab {
  2394. position: absolute;
  2395. right: 8px;
  2396. top: 3px;
  2397. z-index: 20;
  2398. }
  2399. .centerRight {
  2400. width: 300px;
  2401. margin-left: 10px;
  2402. display: flex;
  2403. flex-direction: column;
  2404. position: relative;
  2405. }
  2406. .rightTab {
  2407. height: 40px;
  2408. width: 100%;
  2409. border: 1px solid #d2d2d2;
  2410. box-sizing: border-box;
  2411. p {
  2412. width: 50%;
  2413. height: 40px;
  2414. line-height: 40px;
  2415. text-align: center;
  2416. background: #eee;
  2417. float: left;
  2418. }
  2419. > p:last-child {
  2420. border-left: 1px solid #d2d2d2;
  2421. float: right;
  2422. }
  2423. .activeP {
  2424. background: #409EFF;
  2425. color: #fff;
  2426. }
  2427. }
  2428. .rightTabs {
  2429. display: flex;
  2430. flex-direction: column;
  2431. }
  2432. .comfirmBox {
  2433. width: 100%;
  2434. height: 60px;
  2435. background: #fff;
  2436. position: absolute;
  2437. bottom: 0;
  2438. display: flex;
  2439. align-items: center;
  2440. justify-content: space-between;
  2441. z-index: 99;
  2442. }
  2443. .borderCard {
  2444. height: 100%;
  2445. display: flex;
  2446. flex-direction: column;
  2447. margin-bottom: 60px;
  2448. .el-tabs--border-card > .el-tabs__content {
  2449. padding: 0;
  2450. }
  2451. }
  2452. </style>
  2453. <style lang="scss">
  2454. .borderCard {
  2455. .el-tabs__nav {
  2456. width: 100%;
  2457. }
  2458. .el-tabs__item {
  2459. width: 50%;
  2460. text-align: center;
  2461. }
  2462. .el-tabs__content {
  2463. padding: 5px;
  2464. flex: 1;
  2465. }
  2466. }
  2467. .centerLeft {
  2468. .el-form-item__label {
  2469. text-align: left;
  2470. }
  2471. }
  2472. .tabsBox {
  2473. .el-tabs__item {
  2474. padding: 0 10px;
  2475. }
  2476. .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) {
  2477. padding: 0 10px;
  2478. }
  2479. .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 {
  2480. padding: 0 10px;
  2481. }
  2482. .el-tabs--card > .el-tabs__header .el-tabs__item.is-active.is-closable {
  2483. padding: 0 10px;
  2484. }
  2485. }
  2486. .centerRight {
  2487. .el-tabs__nav-scroll {
  2488. display: flex;
  2489. }
  2490. .el-tabs__nav {
  2491. margin: 0 auto;
  2492. }
  2493. .el-table th .cell, .el-table td .cell {
  2494. padding: 0 2px;
  2495. }
  2496. }
  2497. .preTabs {
  2498. .el-tabs__content {
  2499. flex: 1;
  2500. overflow-y: auto;
  2501. padding: 5px 0 5px 5px;
  2502. }
  2503. }
  2504. .rightTabs {
  2505. height: 100%;
  2506. .el-tabs__nav {
  2507. width: auto;
  2508. }
  2509. .el-tabs__header {
  2510. margin-bottom: 5px;
  2511. }
  2512. .el-tabs__item {
  2513. width: auto;
  2514. text-align: inherit;
  2515. }
  2516. .el-tabs__content {
  2517. flex: 1;
  2518. overflow-y: auto;
  2519. }
  2520. .el-tab-pane {
  2521. display: flex;
  2522. flex-direction: column;
  2523. height: 100%;
  2524. }
  2525. }
  2526. #tab-more {
  2527. .el-icon-close {
  2528. display: none;
  2529. }
  2530. }
  2531. ::-webkit-scrollbar {
  2532. height: 15px;
  2533. }
  2534. </style>