deskPrescription.vue 61KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855
  1. <template>
  2. <div style="height: calc(100% - 56px);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">
  13. <div class="centerLeft">
  14. <el-form :model="form" ref="form" label-width="80px"
  15. style="display: flex;flex-wrap: wrap;justify-content: space-between;">
  16. <el-form-item label="姓名:" prop="name" label-position="right">
  17. <el-input v-model="patientInfo.name" placeholder="" readonly></el-input>
  18. </el-form-item>
  19. <el-form-item label="证件号: " prop="name" label-position="right">
  20. <el-input v-model="patientInfo.id_card_no" placeholder="" readonly></el-input>
  21. </el-form-item>
  22. <!--<el-form-item label="挂号类型: " prop="name">-->
  23. <!--<el-input v-model="hisPatientInfo.register_type" placeholder="" readonly></el-input>-->
  24. <!--</el-form-item>-->
  25. <el-form-item label="处方类型: " prop="name" label-position="right">
  26. <el-select style="width:100%;" v-model="register_type" placeholder="">
  27. <el-option
  28. v-for="(item,index) in register"
  29. :key="index"
  30. :label="item.label"
  31. :value="item.value">
  32. </el-option>
  33. </el-select>
  34. </el-form-item>
  35. <el-form-item label="疾病类型:" prop="name" label-position="right">
  36. <el-select style="width:100%;" v-model="state1" placeholder="">
  37. <el-option
  38. v-for="(item,index) in sick"
  39. :key="index"
  40. :label="item.class_name"
  41. :value="item.id">
  42. </el-option>
  43. </el-select>
  44. </el-form-item>
  45. <el-form-item label="诊断:" prop="name" label-position="right">
  46. <el-select style="width:100%;" v-model="diagnose" placeholder="">
  47. <el-option
  48. v-for="(item,index) in diagnoses"
  49. :key="index"
  50. :label="item.class_name"
  51. :value="item.id">
  52. </el-option>
  53. </el-select>
  54. </el-form-item>
  55. <el-form-item label="过敏病史: " prop="name" label-position="right">
  56. <el-autocomplete
  57. style="width:100%;"
  58. class="inline-input"
  59. v-model="state2"
  60. :fetch-suggestions="querySearch2"
  61. placeholder="请输入内容"
  62. ></el-autocomplete>
  63. </el-form-item>
  64. </el-form>
  65. <div class="tabsBox">
  66. <el-button type="text" class="addTab" @click="addCharges" icon="el-icon-circle-plus">附加收费</el-button>
  67. <el-tabs class="preTabs" v-model="editableTabsValue" type="border-card" closable @tab-remove="removeTab"
  68. :before-leave="moreState" @tab-click="tabclickEvent">
  69. <el-tab-pane
  70. v-for="(item, index) in prescriptions"
  71. :key="index"
  72. :label="item.name"
  73. :name="item.name"
  74. >
  75. <el-date-picker
  76. v-model="item.pre_time"
  77. type="datetime"
  78. :clearable="false"
  79. format="yyyy-MM-dd hh:mm"
  80. value-format="yyyy-MM-dd hh:mm"
  81. placeholder="选择日期">
  82. </el-date-picker>
  83. </el-tab-pane>
  84. <el-tab-pane name="more" closable><span slot="label"><i class="el-icon-plus" @click="addTab"></i></span>
  85. </el-tab-pane>
  86. <div class="RP">Rp
  87. <div style="float: right;margin-bottom:5px;margin-right:1%;">
  88. <el-button
  89. round
  90. size="small"
  91. @click="openLast(3)"
  92. >上一方
  93. </el-button>
  94. <el-button
  95. round
  96. size="small"
  97. @click="openNext(4)"
  98. >下一方
  99. </el-button>
  100. </div>
  101. </div>
  102. <prescription-table ref="prescription_tables" :prescription="curPrescriptions" :preDrugs="preDrugs"
  103. :activeType="customTabIndex"></prescription-table>
  104. </el-tabs>
  105. </div>
  106. <div class="costBox">
  107. <div>
  108. <span><span style="color: red">*</span>医生:</span>
  109. <el-select style="margin-right:5px;width:140px;" v-model="doctorValue" placeholder=""
  110. @change="changeDoctor">
  111. <el-option
  112. v-for="(item,index) in doctors"
  113. :key="index"
  114. :label="item.user_name"
  115. :value="item.admin_user_id">
  116. </el-option>
  117. </el-select>
  118. <span> <span style="color: red">*</span>科室:</span>
  119. <el-select style="margin-right:5px;width:140px;" v-model="departmentValue" placeholder="">
  120. <el-option
  121. v-for="(item,index) in department"
  122. :key="index"
  123. :label="item.name"
  124. :value="item.id">
  125. </el-option>
  126. </el-select>
  127. <span>当前处方总价:</span>
  128. <span style="color:red;">{{getTotalOne()?getTotalOne():''}}</span>元
  129. <span style="margin-left:10px;">总价:</span>
  130. <span style="color:red;">{{ getTotal()?getTotal():''}}</span>元
  131. </div>
  132. <span :class="order_status == '未收费' ? 'statusRed' : ''">{{order_status}}</span>
  133. </div>
  134. </div>
  135. <div class='centerRight'>
  136. <!-- <div class="rightTab">
  137. <p :class="rightTab == 1 ? 'activeP' : ''" @click="clickTab(1)">药品</p>
  138. <p :class="rightTab == 2 ? 'activeP' : ''" @click="clickTab(2)">项目</p>
  139. </div> -->
  140. <el-tabs class="borderCard" type="border-card" v-model="rightTab" @tab-click="clickTab"
  141. :before-leave='beforeLeave'>
  142. <el-tab-pane label="药品" :name="1">
  143. </el-tab-pane>
  144. <el-tab-pane label="项目" :name="2">
  145. </el-tab-pane>
  146. <div style="height:100%;" v-show="showOne">
  147. <el-tabs class="rightTabs" v-model="activeName">
  148. <el-tab-pane label="药品列表" name="1">
  149. <div style="margin-bottom:5px;display:flex;">
  150. <el-input style="width:50%;" @input="searchAction" @keyup.enter.native='searchAction'
  151. v-model.trim="search_keyword"
  152. placeholder="请输入药品名字"></el-input>
  153. <el-select style="margin-left:5px;width:50%;" v-model="value" placeholder="" @change="changeKind">
  154. <el-option
  155. label="全部"
  156. value="0">
  157. </el-option>
  158. <el-option
  159. v-for="(item,index) in getDictionaryDataConfig('system','drug_type')"
  160. :key="index"
  161. :label="item.name"
  162. :value="item.id">
  163. </el-option>
  164. </el-select>
  165. </div>
  166. <div style="width: 100%;flex:1;overflow: hidden;" ref="rightTable">
  167. <el-table ref="multipleTable" :height="multipleTableHeight != '' ? multipleTableHeight : '200'"
  168. :data="drugs" border @select='selectDrugs'
  169. :row-style="{ color: '#303133' }"
  170. @select-all="changeAllGoodInfoTableData"
  171. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  172. highlight-current-row>
  173. <el-table-column type="selection" width="40" align="center"></el-table-column>
  174. <el-table-column label="名称">
  175. <template slot-scope="scope">{{ scope.row.drug_name }}</template>
  176. </el-table-column>
  177. <el-table-column label="规格" width="60">
  178. <template slot-scope="scope">{{ scope.row.drug_spec }}</template>
  179. </el-table-column>
  180. <el-table-column label="库存" width="60">
  181. <template slot-scope="scope">{{
  182. stockInCount(scope.row) -
  183. salesReturnCount(scope.row) -
  184. stockOutCount(scope.row) +
  185. cancelStockCount(scope.row)
  186. }}
  187. </template>
  188. </el-table-column>
  189. <el-table-column label="单价" width="40">
  190. <template slot-scope="scope">{{ scope.row.retail_price }}</template>
  191. </el-table-column>
  192. </el-table>
  193. </div>
  194. </el-tab-pane>
  195. <!--<el-tab-pane label="医嘱模板" name="2">-->
  196. <!--<div style="margin-bottom:5px;">-->
  197. <!--&lt;!&ndash;<el-input style="width:50%;" v-model="input" placeholder=""></el-input>&ndash;&gt;-->
  198. <!--<el-select style="float: right;width: 49%;" v-model="value" placeholder="">-->
  199. <!--<el-option-->
  200. <!--v-for="item in options"-->
  201. <!--:key="item.value"-->
  202. <!--:label="item.label"-->
  203. <!--:value="item.value">-->
  204. <!--</el-option>-->
  205. <!--</el-select>-->
  206. <!--</div>-->
  207. <!--<div style="width: 100%;flex:1;overflow-y: auto;">-->
  208. <!--<el-table ref="multipleTableTwo" :height="multipleTableHeight != '' ? multipleTableHeight : '200'"-->
  209. <!--:data="advices_template" border-->
  210. <!--:row-style="{ color: '#303133' }"-->
  211. <!--:header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"-->
  212. <!--highlight-current-row-->
  213. <!--@select='selectTemplate'-->
  214. <!--@select-all="changeTemplateData"-->
  215. <!--&gt;-->
  216. <!--<el-table-column type="selection" width="40" align="center"></el-table-column>-->
  217. <!--<el-table-column prop="name" label="名称">-->
  218. <!--<template slot-scope="scope">{{scope.row.name}}</template>-->
  219. <!--</el-table-column>-->
  220. <!--&lt;!&ndash;<el-table-column label="规格" width="60">&ndash;&gt;-->
  221. <!--&lt;!&ndash;<template slot-scope="scope">33</template>&ndash;&gt;-->
  222. <!--&lt;!&ndash;</el-table-column>&ndash;&gt;-->
  223. <!--&lt;!&ndash;<el-table-column label="库存" width="60">&ndash;&gt;-->
  224. <!--&lt;!&ndash;<template slot-scope="scope">22</template>&ndash;&gt;-->
  225. <!--&lt;!&ndash;</el-table-column>&ndash;&gt;-->
  226. <!--&lt;!&ndash;<el-table-column label="单价" width="40">&ndash;&gt;-->
  227. <!--&lt;!&ndash;<template slot-scope="scope">12</template>&ndash;&gt;-->
  228. <!--&lt;!&ndash;</el-table-column>&ndash;&gt;-->
  229. <!--</el-table>-->
  230. <!--</div>-->
  231. <!--</el-tab-pane>-->
  232. </el-tabs>
  233. </div>
  234. <div style="height:100%;" v-show="showTwo">
  235. <el-tabs class="rightTabs" v-model="activeName">
  236. <el-tab-pane label="项目列表" name="1">
  237. <div style="width: 100%;flex:1;overflow-y: auto;">
  238. <el-table ref="tables" :height="multipleTableHeight != '' ? multipleTableHeight : '200'"
  239. :data="tabProject" border @select='selectChange'
  240. :row-style="{ color: '#303133' }"
  241. @select-all="changeAllGoodInfoTableDataTwo"
  242. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  243. highlight-current-row>
  244. <el-table-column type="selection" width="40" align="center"></el-table-column>
  245. <el-table-column prop="name" label="名称">
  246. <template slot-scope="scope">{{ scope.row.project_name }}</template>
  247. </el-table-column>
  248. <el-table-column label="规格" width="60">
  249. <template slot-scope="scope">{{ scope.row.single_dose }}</template>
  250. </el-table-column>
  251. <el-table-column label="单价" width="40">
  252. <template slot-scope="scope">{{ scope.row.price }}</template>
  253. </el-table-column>
  254. </el-table>
  255. </div>
  256. </el-tab-pane>
  257. <el-tab-pane label="项目组套" name="2">
  258. <div style="width: 100%;flex:1;overflow-y: auto;">
  259. <el-table :data="tabPrjectTeam" border
  260. :height="multipleTableHeight != '' ? multipleTableHeight : '200'"
  261. :row-style="{ color: '#303133' }"
  262. :header-cell-style="{backgroundColor: 'rgb(245, 247, 250)',color: '#606266'}"
  263. highlight-current-row
  264. @select='selectTeam'>
  265. <el-table-column type="selection" width="40" align="center"></el-table-column>
  266. <el-table-column prop="name" label="名称">
  267. <template slot-scope="scope">{{scope.row.project_team}}</template>
  268. </el-table-column>
  269. </el-table>
  270. </div>
  271. </el-tab-pane>
  272. </el-tabs>
  273. </div>
  274. </el-tabs>
  275. <template>
  276. <div class="comfirmBox">
  277. <!-- <div>
  278. <span>药品类型:</span>
  279. <el-select style="margin-right:5px;width:100px;" v-model="value" placeholder="" @change="changeKind">
  280. <el-option
  281. label="全部"
  282. value="0">
  283. </el-option>
  284. <el-option
  285. v-for="(item,index) in getDictionaryDataConfig('system','drug_type')"
  286. :key="index"
  287. :label="item.name"
  288. :value="item.id">
  289. </el-option>
  290. </el-select>
  291. </div> -->
  292. <el-button type="primary" style="width:100%;" @click="comfirm">确定添加</el-button>
  293. </div>
  294. </template>
  295. </div>
  296. </div>
  297. <additionalCharges v-on:setData="setCharge" ref='additionalCharges' :hisPatientInfo="hisPatientInfo"
  298. :patientInfo="patientInfo" :additions="additions"></additionalCharges>
  299. <select-template ref='selectTemplate'></select-template>
  300. <save-template ref='saveTemplate'></save-template>
  301. <next-or-last-prescription ref='next_or_last_prescription' v-on:save="setValue"
  302. v-on:cancel="cancel"></next-or-last-prescription>
  303. <!--<next-or-last-prescription ref='next_or_last_prescription' v-on:save="setValue" v-on:cancel="cancel"></next-or-last-prescription>-->
  304. <call-prescription ref='call_prescription' v-on:call="call" v-on:call-cancel="callCancel"></call-prescription>
  305. </div>
  306. </template>
  307. <script>
  308. const moment = require('moment')
  309. import {
  310. createHisPrescription,
  311. delHisPrescription,
  312. getCallHisPrescription,
  313. getInitData,
  314. getNextOrLastHisPrescription,
  315. getPatientInfo,
  316. getSchedulePatientList
  317. } from '@/api/his/his'
  318. import {getDictionaryDataConfig} from '@/utils/data'
  319. import prescriptionTable from './prescriptionTable'
  320. import selectTemplate from './selectTemplate'
  321. import saveTemplate from './saveTemplate'
  322. import additionalCharges from './additionalCharges'
  323. import {addProjectTeam, getAllProjectTeam, getHisProject, getPojectListById} from '@/api/project/project'
  324. import {uParseTime} from '@/utils/tools'
  325. import NextOrLastPrescription from "./nextOrLastPrescription";
  326. import CallPrescription from "./callPrescription";
  327. export default {
  328. props: {
  329. patientInfo: Object,
  330. hisPatientInfo: Object,
  331. prescriptions: Array,
  332. record_date: String,
  333. search_keyword: '',
  334. addtions_charge: {
  335. type: Array,
  336. default: []
  337. },
  338. other_sick: {
  339. type: Array,
  340. default: []
  341. },
  342. },
  343. components: {
  344. CallPrescription,
  345. NextOrLastPrescription,
  346. selectTemplate,
  347. saveTemplate,
  348. prescriptionTable,
  349. additionalCharges
  350. },
  351. data() {
  352. return {
  353. register: [
  354. {value: 11, label: "普通门诊"},
  355. {value: 12, label: '门诊挂号'},
  356. {value: 13, label: "急诊"},
  357. {value: 14, label: "门诊慢性病"},
  358. {value: 15, label: "门诊统筹"},
  359. {value: 16, label: "门诊特殊病"},
  360. {value: 21, label: "普通住院"},
  361. ],
  362. isLastOrNextVisible: false,
  363. multipleTableHeight: '',
  364. register_type: '',
  365. value: '0',
  366. form: {
  367. name: ''
  368. },
  369. drugs: [],
  370. allDrugs: [],
  371. advices_template: [],
  372. additions: [],
  373. editableTabsValue: '处方1',
  374. editableTabs: [{
  375. title: '处方1',
  376. name: '1'
  377. }],
  378. tabIndex: this.prescriptions.length,
  379. currenet_inedx: 0,
  380. rightTab: 1,
  381. activeName: '1',
  382. curPrescriptions: this.prescriptions[0],
  383. drugTableData: [],
  384. preDrugs: [],
  385. curDrugs: [],
  386. doctorOptions: [],
  387. doctorValue: '',
  388. departmentOptions: [],
  389. departmentValue: '',
  390. total: 0,
  391. state1: '',
  392. request_record_date: '',
  393. state2: '',
  394. customTabIndex: 1,
  395. options: [],
  396. tabProject: [],
  397. strids: '',
  398. showOne: true,
  399. showTwo: false,
  400. tableData: [],
  401. tabPrjectTeam: [],
  402. teamList: [],
  403. doctors: [],
  404. departMent: [],
  405. curStatus: 0,
  406. order_status: '',
  407. register_types: [
  408. {id: 1, name: '医保'},
  409. {id: 2, name: '自费'}
  410. ],
  411. department: [],
  412. sick: [],
  413. diagnoses: [],
  414. diagnose: '',
  415. curTotal: 0,
  416. prescription_id: 0,
  417. tempDrugs: []
  418. }
  419. },
  420. methods: {
  421. call(val){
  422. this.prescriptions = []
  423. this.prescriptions = val
  424. for (let i = 0; i < this.prescriptions.length; i++) {
  425. this.prescriptions[i].name = "处方" + (i + 1)
  426. if (i == 0) {
  427. if (this.prescriptions[0].advices.length > 0 && this.prescriptions[0].project.length == 0) {
  428. this.customTabIndex = 1
  429. this.curStatus = 1
  430. this.rightTab = 1
  431. this.showOne = true
  432. this.showTwo = false
  433. }
  434. if (this.prescriptions[0].advices.length == 0 && this.prescriptions[0].project.length > 0) {
  435. this.customTabIndex = 2
  436. this.curStatus = 2
  437. this.rightTab = 2
  438. this.showTwo = true
  439. this.showOne = false
  440. }
  441. }
  442. }
  443. this.curPrescriptions = this.prescriptions[0]
  444. this.$refs.call_prescription.close()
  445. this.$emit('setData',this.prescriptions)
  446. },
  447. callCancel(){
  448. this.$refs.call_prescription.close()
  449. },
  450. cancel() {
  451. this.$refs.next_or_last_prescription.close()
  452. this.request_record_date = this.record_date
  453. },
  454. setValue(val) {
  455. this.prescriptions = []
  456. this.prescriptions = val
  457. this.$refs.next_or_last_prescription.close()
  458. for (let i = 0; i < this.prescriptions.length; i++) {
  459. this.prescriptions[i].name = "处方" + (i + 1)
  460. if (i == 0) {
  461. if (this.prescriptions[0].advices.length > 0 && this.prescriptions[0].project.length == 0) {
  462. this.customTabIndex = 1
  463. this.curStatus = 1
  464. this.rightTab = 1
  465. this.showOne = true
  466. this.showTwo = false
  467. }
  468. if (this.prescriptions[0].advices.length == 0 && this.prescriptions[0].project.length > 0) {
  469. this.customTabIndex = 2
  470. this.curStatus = 2
  471. this.rightTab = 2
  472. this.showTwo = true
  473. this.showOne = false
  474. }
  475. }
  476. }
  477. this.curPrescriptions = this.prescriptions[0]
  478. this.request_record_date = this.record_date
  479. this.$emit('setData',this.prescriptions)
  480. },
  481. GetNextOrLastHisPrescription(params) {
  482. getNextOrLastHisPrescription(params).then(response => {
  483. if (response.data.state == 1) {
  484. this.$refs.next_or_last_prescription.show(response.data.data.prescriptions, this.patientInfo.name, this.patientInfo.id, this.prescriptions)
  485. this.request_record_date = uParseTime(response.data.data.prescriptions[0].record_date, '{y}-{m}-{d}')
  486. } else {
  487. this.$message.error(response.data.msg)
  488. }
  489. })
  490. },
  491. openLast(val) {
  492. if (this.curPrescriptions.order_status == 2) {
  493. this.$message.error('处方已经结算,无法添加')
  494. return
  495. }
  496. if (this.patientInfo.id == 0) {
  497. this.$message.error('请选择患者')
  498. return
  499. }
  500. if (val == 1) {
  501. this.isVisibility = false
  502. this.request_record_date = this.record_date
  503. let params = {
  504. patient_id: this.patientInfo.id,
  505. record_time: this.request_record_date,
  506. type: 1
  507. }
  508. this.GetNextOrLastHisPrescription(params)
  509. } else if (val == 3) {
  510. let params = {
  511. patient_id: this.patientInfo.id,
  512. record_time: this.request_record_date,
  513. type: 1
  514. }
  515. this.GetNextOrLastHisPrescription(params)
  516. }
  517. },
  518. openNext(val) {
  519. if (this.curPrescriptions.order_status == 2) {
  520. this.$message.error('处方已经结算,无法添加')
  521. return
  522. }
  523. if (this.patientInfo.id == 0) {
  524. this.$message.error('请选择患者')
  525. return
  526. }
  527. if (val == 2) {
  528. this.isVisibility = false
  529. this.request_record_date = this.record_date
  530. let params = {
  531. patient_id: this.patientInfo.id,
  532. record_time: this.request_record_date,
  533. type: 2
  534. }
  535. this.GetNextOrLastHisPrescription(params)
  536. } else if (val == 4) {
  537. let params = {
  538. patient_id: this.patientInfo.id,
  539. record_time: this.request_record_date,
  540. type: 2
  541. }
  542. this.GetNextOrLastHisPrescription(params)
  543. }
  544. },
  545. selectTemplate(selection, row) {
  546. this.tempDrugs = selection
  547. }, changeTemplateData(selection) {
  548. this.tempDrugs = selection
  549. },
  550. stockInCount: function (row) {
  551. let total = 0;
  552. if (row.stock_in != null) {
  553. for (let i = 0; i < row.stock_in.length; i++) {
  554. total = total + row.stock_in[i].warehousing_count;
  555. }
  556. }
  557. return total;
  558. },
  559. salesReturnCount: function (row) {
  560. let total = 0;
  561. if (row.sales_return != null) {
  562. for (let i = 0; i < row.sales_return.length; i++) {
  563. total = total + row.sales_return[i].count;
  564. }
  565. }
  566. return total;
  567. },
  568. stockOutCount: function (row) {
  569. let total = 0;
  570. if (row.stock_out != null) {
  571. for (let i = 0; i < row.stock_out.length; i++) {
  572. total = total + row.stock_out[i].count;
  573. }
  574. }
  575. return total;
  576. },
  577. cancelStockCount: function (row) {
  578. let total = 0;
  579. if (row.cancel_stock != null) {
  580. for (let i = 0; i < row.cancel_stock.length; i++) {
  581. total = total + row.cancel_stock[i].count;
  582. }
  583. }
  584. return total;
  585. },
  586. setCharge(additional_charges) {
  587. for (let i = 0; i < additional_charges.length; i++) {
  588. additional_charges[i].count = 1
  589. this.curPrescriptions.addition.push(additional_charges[i])
  590. }
  591. this.$refs.additionalCharges.hide()
  592. },
  593. searchAction() {
  594. if (this.search_keyword.length == 0) {
  595. this.drugs = this.allDrugs
  596. } else {
  597. let arr = []
  598. for (let i = 0; i < this.drugs.length; i++) {
  599. if (this.drugs[i].drug_name.indexOf(this.search_keyword) != -1) {
  600. arr = arr.concat(this.drugs[i])
  601. }
  602. }
  603. this.drugs = arr
  604. }
  605. },
  606. getTotalOne() {
  607. var total = 0
  608. console.log(this.prescriptions)
  609. for (let i = 0; i < this.prescriptions.length; i++) {
  610. if (this.prescriptions[i].name == this.editableTabsValue) {
  611. if (this.prescriptions[i].advices != null) {
  612. for (let a = 0; a < this.prescriptions[i].advices.length; a++) {
  613. total = total + this.prescriptions[i].advices[a].retail_price * this.prescriptions[i].advices[a].prescribing_number
  614. }
  615. }
  616. if (this.prescriptions[i].project != null) {
  617. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  618. total = total + this.prescriptions[i].project[b].price * this.prescriptions[i].project[b].total
  619. }
  620. }
  621. if (this.prescriptions[i].addition != null) {
  622. for (let b = 0; b < this.prescriptions[i].addition.length; b++) {
  623. total = total + this.prescriptions[i].addition[b].price * this.prescriptions[i].addition[b].count
  624. }
  625. }
  626. total = Math.floor(total * 100) / 100
  627. }
  628. }
  629. return total
  630. },
  631. getCurTotal() {
  632. var total = 0
  633. if (this.curPrescriptions.type == 1) {
  634. for (let a = 0; a < this.curPrescriptions.advices.length; a++) {
  635. total = total + this.curPrescriptions.advices[a].retail_price * this.curPrescriptions.advices[a].prescribing_number
  636. }
  637. return Math.floor(total * 100) / 100
  638. } else {
  639. for (let a = 0; a < this.curPrescriptions.project.length; a++) {
  640. total = total + this.curPrescriptions.project[a].price * this.curPrescriptions.project[a].total
  641. }
  642. return Math.floor(total * 100) / 100
  643. }
  644. },
  645. getTotal() {
  646. var total = 0
  647. for (let i = 0; i < this.prescriptions.length; i++) {
  648. if (this.prescriptions[i].advices != null) {
  649. for (let a = 0; a < this.prescriptions[i].advices.length; a++) {
  650. total = total + this.prescriptions[i].advices[a].retail_price * this.prescriptions[i].advices[a].prescribing_number
  651. }
  652. }
  653. if (this.prescriptions[i].project != null) {
  654. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  655. total = total + this.prescriptions[i].project[b].price * this.prescriptions[i].project[b].total
  656. }
  657. }
  658. if (this.prescriptions[i].addition != null) {
  659. for (let b = 0; b < this.prescriptions[i].addition.length; b++) {
  660. total = total + this.prescriptions[i].addition[b].price * this.prescriptions[i].addition[b].count
  661. }
  662. }
  663. }
  664. return Math.floor(total * 100) / 100
  665. },
  666. createFilter(queryString) {
  667. return (restaurant) => {
  668. return (restaurant.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0)
  669. }
  670. },
  671. querySearch2(queryString, cb) {
  672. var restaurants = this.other_sick
  673. restaurants.map(item => {
  674. item.value = item.name
  675. })
  676. var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants
  677. // 调用 callback 返回建议列表的数据
  678. cb(results)
  679. },
  680. changeKind(val) {
  681. this.drugs = []
  682. if (val == 0) {
  683. this.drugs = this.allDrugs
  684. } else {
  685. for (let i = 0; i < this.allDrugs.length; i++) {
  686. if (this.allDrugs[i].drug_type == val) {
  687. this.drugs.push(this.allDrugs[i])
  688. }
  689. }
  690. }
  691. },
  692. getDictionaryDataConfig(module, filed_name) {
  693. return getDictionaryDataConfig(module, filed_name)
  694. },
  695. getInitData() {
  696. getInitData().then(response => {
  697. if (response.data.state == 0) {
  698. this.$message.error(response.data.msg)
  699. return false
  700. } else {
  701. this.drugs = response.data.data.drugs
  702. this.allDrugs = response.data.data.drugs
  703. this.advices_template = response.data.data.advices_template
  704. this.doctors = response.data.data.doctors
  705. this.department = response.data.data.department
  706. this.sick = response.data.data.sick
  707. this.diagnoses = response.data.data.diagnose
  708. this.additions = response.data.data.additions
  709. // var info = response.data.data.info
  710. // if (info.user_type == 2 || info.user_type == 1) {
  711. // this.doctorValue = info.admin_user_id
  712. // if (info.department_id == 0) {
  713. // if (this.department.length > 0) {
  714. // this.departmentValue = this.department[0].id
  715. // } else {
  716. // this.departmentValue = ''
  717. //
  718. // }
  719. // } else {
  720. // this.departmentValue = info.department_id
  721. // }
  722. // }else{
  723. // this.doctorValue = this.doctors[0].admin_user_id
  724. // }
  725. }
  726. })
  727. },
  728. tabclickEvent(val) {
  729. for (let i = 0; i < this.prescriptions.length; i++) {
  730. console.log(this.prescriptions[i].name)
  731. if (this.prescriptions[i].name == val.name) {
  732. console.log("2323323", this.prescriptions)
  733. this.prescription_id = this.prescriptions[i].id
  734. this.$emit('event1', this.prescription_id)
  735. this.curPrescriptions = this.prescriptions[i]
  736. this.teamList = []
  737. this.curDrugs = []
  738. this.$refs.multipleTable.clearSelection()
  739. this.$refs.tables.clearSelection()
  740. //用来区分处方属于项目还是药品
  741. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  742. this.customTabIndex = 1
  743. this.curStatus = 1
  744. this.rightTab = 1
  745. this.showOne = true
  746. this.showTwo = false
  747. }
  748. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  749. this.customTabIndex = 2
  750. this.curStatus = 2
  751. this.rightTab = 2
  752. this.showTwo = true
  753. this.showOne = false
  754. }
  755. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length == 0) {
  756. this.customTabIndex = this.rightTab
  757. this.curStatus = 0
  758. }
  759. }
  760. }
  761. },
  762. clearData() {
  763. this.curPrescriptions = []
  764. this.curStatus = 0
  765. this.curDrugs = []
  766. this.preDrugs = []
  767. this.teamList = []
  768. },
  769. setData(data, info, admin_info, doctors, department, hisPatientInfo) {
  770. console.log(data)
  771. this.prescription_id = data[0].id
  772. this.editableTabsValue = "处方1"
  773. this.$emit('event1', this.prescription_id)
  774. this.curStatus = 0
  775. this.prescriptions = data
  776. this.curPrescriptions = this.prescriptions[0]
  777. this.diagnose = info.diagnosis
  778. if (this.diagnose == 0) {
  779. this.diagnose = ""
  780. }
  781. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  782. this.curStatus = 1
  783. this.customTabIndex = 1
  784. this.rightTab = 1
  785. this.showOne = true
  786. this.showTwo = false
  787. }
  788. if (this.curPrescriptions.project.length > 0 && this.curPrescriptions.advices.length == 0) {
  789. this.curStatus = 2
  790. this.customTabIndex = 2
  791. this.rightTab = 2
  792. this.showOne = false
  793. this.showTwo = true
  794. }
  795. this.state1 = info.sick_type
  796. if (this.state1 == 0) {
  797. this.state1 = ""
  798. }
  799. this.state2 = info.sick_history
  800. if (this.state2 == 0) {
  801. this.state2 = ""
  802. }
  803. // this.register_type = info.register_type
  804. if (info.prescription_status == 0) {
  805. this.order_status = ''
  806. }
  807. if (info.prescription_status == 1 || info.prescription_status == 2) {
  808. this.order_status = '未收费'
  809. }
  810. if (info.prescription_status == 3) {
  811. this.order_status = '已结算'
  812. }
  813. if (info.prescription_status == 4) {
  814. this.order_status = '已退费'
  815. }
  816. console.log(info)
  817. if (info.id > 0) {
  818. this.doctorValue = info.doctor_id
  819. this.departmentValue = info.departments
  820. } else {
  821. if (hisPatientInfo.doctor != 0 && hisPatientInfo.department != 0) {
  822. this.doctorValue = hisPatientInfo.doctor
  823. this.departmentValue = hisPatientInfo.department
  824. } else {
  825. if (admin_info.user_type == 2 || admin_info.user_type == 1) {
  826. this.doctorValue = admin_info.admin_user_id
  827. if (admin_info.department_id == 0) {
  828. if (this.department.length > 0) {
  829. if (department && department.length > 0) {
  830. this.departmentValue = department[0].id
  831. } else {
  832. this.departmentValue = ''
  833. }
  834. } else {
  835. this.departmentValue = ''
  836. }
  837. } else {
  838. this.departmentValue = admin_info.department_id
  839. }
  840. } else {
  841. this.doctorValue = doctors[0].admin_user_id
  842. }
  843. if (this.doctorValue == 0) {
  844. this.doctorValue = ''
  845. }
  846. }
  847. }
  848. if (info.register_type == 0) {
  849. // if(hisPatientInfo.register_type != 0){
  850. // this.register_type = hisPatientInfo.register_type
  851. // }else{
  852. this.register_type = ''
  853. // }
  854. } else {
  855. this.register_type = info.register_type
  856. }
  857. },
  858. moreState(tab, event) {
  859. if (tab == 'more') {
  860. return false
  861. }
  862. },open_two(){
  863. if (this.curPrescriptions.order_status == 2) {
  864. this.$message.error('处方已经结算,无法添加')
  865. return
  866. }
  867. if (this.patientInfo == null || this.patientInfo.id == 0) {
  868. this.$message.error('请选择患者')
  869. return
  870. }
  871. let params = {
  872. end_time: this.record_date,
  873. start_time: moment(new Date()).subtract(30, 'days').format('YYYY-MM-DD'),
  874. patient_id: this.patientInfo.id
  875. }
  876. getCallHisPrescription(params).then(response => {
  877. if (response.data.state == 1) {
  878. this.$refs.call_prescription.show(this.patientInfo.name, this.patientInfo.id,params.end_time, params.start_time,this.prescriptions,response.data.data.prescriptions)
  879. } else {
  880. this.$message.error(response.data.msg)
  881. }
  882. })
  883. },
  884. open(index, isLoading) {
  885. if (this.curPrescriptions.order_status == 2) {
  886. this.$message.error('当前处方已经结算,无法保存')
  887. return
  888. }
  889. if (this.doctorValue.length <= 0) {
  890. this.$message.error('医生不能为空')
  891. return
  892. }
  893. if (this.departmentValue.length <= 0) {
  894. this.$message.error('科室不能为空')
  895. return
  896. }
  897. if (index == 1) {
  898. let params = {
  899. patient_id: this.patientInfo.id,
  900. diagnose: this.diagnose,
  901. sick_type: this.state1,
  902. sick_history: this.state2,
  903. doctor: this.doctorValue,
  904. department: this.departmentValue,
  905. record_date: this.record_date,
  906. his_patient_id: this.hisPatientInfo.id,
  907. reg_type: this.register_type
  908. }
  909. for (let i = 0; i < this.prescriptions.length; i++) {
  910. if (this.prescriptions[i].advices.length > 0 && this.prescriptions[i].project.length == 0) {
  911. this.prescriptions[i]['type'] = 1
  912. }
  913. if (this.prescriptions[i].advices.length == 0 && this.prescriptions[i].project.length > 0) {
  914. this.prescriptions[i]['type'] = 2
  915. }
  916. for (let b = 0; b < this.prescriptions[i].advices.length; b++) {
  917. this.prescriptions[i].advices[b].single_dose = this.prescriptions[i].advices[b].single_dose.toString()
  918. this.prescriptions[i].advices[b].prescribing_number = this.prescriptions[i].advices[b].prescribing_number.toString()
  919. this.prescriptions[i].advices[b].retail_price = this.prescriptions[i].advices[b].retail_price.toString()
  920. this.prescriptions[i].advices[b].day = parseInt(this.prescriptions[i].advices[b].day)
  921. }
  922. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  923. this.prescriptions[i].project[b].price = this.prescriptions[i].project[b].price.toString()
  924. this.prescriptions[i].project[b].total = this.prescriptions[i].project[b].total.toString()
  925. this.prescriptions[i].project[b].delivery_way = this.prescriptions[i].project[b].delivery_way.toString()
  926. }
  927. for (let b = 0; b < this.prescriptions[i].addition.length; b++) {
  928. this.prescriptions[i].addition[b].id = parseInt(this.prescriptions[i].addition[b].id)
  929. this.prescriptions[i].addition[b].item_id = parseInt(this.prescriptions[i].addition[b].item_id)
  930. this.prescriptions[i].addition[b].price = parseFloat(this.prescriptions[i].addition[b].price)
  931. this.prescriptions[i].addition[b].count = this.prescriptions[i].addition[b].count.toString()
  932. }
  933. }
  934. let data = {
  935. 'prescriptions': this.prescriptions
  936. }
  937. isLoading = true
  938. createHisPrescription(data, params).then(response => {
  939. if (response.data.state == 1) {
  940. this.$emit("change")
  941. this.$message.success('保存成功')
  942. }
  943. })
  944. } else if (index == 2) {
  945. this.$router.push('/outpatientDoctorStation/print')
  946. } else if (index == 4) {
  947. } else if (index == 5) {
  948. this.$refs.saveTemplate.show()
  949. }
  950. },
  951. addTab(targetName) {
  952. if (this.curPrescriptions.order_status >= 2) {
  953. this.$message.error('该处方已经结算或者退费,无法继续添加处方')
  954. return
  955. }
  956. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length == 0) {
  957. this.$message.error('当前处方无数据,新增数据后才能新增处方')
  958. return
  959. }
  960. this.tabIndex = this.prescriptions.length
  961. ++this.tabIndex
  962. let newTabName = '处方' + this.tabIndex
  963. var nowDate = new Date()
  964. var nowYear = nowDate.getFullYear()
  965. var nowMonth = nowDate.getMonth() + 1
  966. var nowDay = nowDate.getDate()
  967. var hours = nowDate.getHours()
  968. var min = nowDate.getMinutes()
  969. var nowTime =
  970. nowYear +
  971. '-' +
  972. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  973. '-' +
  974. (nowDay < 10 ? '0' + nowDay : nowDay) + " "+(hours < 10 ? '0' + hours : hours) +
  975. ':' + (min < 10 ? '0' + min : min)
  976. this.prescriptions.push({
  977. id: 0,
  978. name: newTabName,
  979. order_status: 0,
  980. advices: [],
  981. project: [],
  982. addition: [],
  983. pre_time:nowTime,
  984. })
  985. this.editableTabsValue = newTabName
  986. this.curPrescriptions = this.prescriptions[this.prescriptions.length - 1]
  987. this.curStatus = 0
  988. },
  989. removeTab(targetName) {
  990. if (this.curPrescriptions.order_status == 2) {
  991. this.$message.error('该处方已经结算,无法删除')
  992. return
  993. }
  994. if (targetName == '处方1') {
  995. this.$message.error('该处方无法删除')
  996. return
  997. }
  998. this.$confirm('处方删除后不可恢复,是否确认删除', '删除', {
  999. confirmButtonText: '确 定',
  1000. cancelButtonText: '取 消',
  1001. type: 'warning'
  1002. }).then(() => {
  1003. let id = 0
  1004. for (let i = 0; i < this.prescriptions.length; i++) {
  1005. if (this.prescriptions[i].name == targetName) {
  1006. id = this.prescriptions[i].id
  1007. }
  1008. }
  1009. if (id == 0) {
  1010. let tabs = this.prescriptions
  1011. let activeName = this.editableTabsValue
  1012. if (activeName === targetName) {
  1013. tabs.forEach((tab, index) => {
  1014. if (tab.name === targetName) {
  1015. let nextTab = tabs[index + 1] || tabs[index - 1]
  1016. if (nextTab) {
  1017. activeName = nextTab.name
  1018. }
  1019. }
  1020. })
  1021. }
  1022. this.editableTabsValue = activeName
  1023. this.prescriptions = tabs.filter(tab => tab.name !== targetName)
  1024. for (let i = 0; i < this.prescriptions.length; i++) {
  1025. if (activeName == this.prescriptions[i].name) {
  1026. this.curPrescriptions = this.prescriptions[i]
  1027. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  1028. this.curStatus = 1
  1029. }
  1030. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  1031. this.curStatus = 2
  1032. }
  1033. }
  1034. }
  1035. if (this.prescriptions.length == 0) {
  1036. this.curPrescriptions = []
  1037. this.curStatus = 0
  1038. }
  1039. } else {
  1040. let params = {
  1041. 'id': id
  1042. }
  1043. delHisPrescription(params).then(response => {
  1044. if (response.data.state == 1) {
  1045. this.$message.success('删除成功')
  1046. let tabs = this.prescriptions
  1047. let activeName = this.editableTabsValue
  1048. if (activeName === targetName) {
  1049. tabs.forEach((tab, index) => {
  1050. if (tab.name === targetName) {
  1051. let nextTab = tabs[index + 1] || tabs[index - 1]
  1052. if (nextTab) {
  1053. activeName = nextTab.name
  1054. }
  1055. }
  1056. })
  1057. }
  1058. this.editableTabsValue = activeName
  1059. this.prescriptions = tabs.filter(tab => tab.name !== targetName)
  1060. for (let i = 0; i < this.prescriptions.length; i++) {
  1061. if (activeName == this.prescriptions[i].name) {
  1062. this.curPrescriptions = this.prescriptions[i]
  1063. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  1064. this.curStatus = 1
  1065. }
  1066. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  1067. this.curStatus = 2
  1068. }
  1069. }
  1070. }
  1071. if (this.prescriptions.length == 0) {
  1072. this.curPrescriptions = []
  1073. this.curStatus = 0
  1074. }
  1075. } else {
  1076. this.$message.success(response.data.msg)
  1077. }
  1078. })
  1079. }
  1080. }).catch(() => {
  1081. })
  1082. },
  1083. beforeLeave(activeName, oldActiveName) {
  1084. let index = activeName
  1085. if (index == 1) {
  1086. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  1087. return false
  1088. }
  1089. } else {
  1090. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  1091. return false
  1092. }
  1093. }
  1094. },
  1095. clickTab(tab) {
  1096. let index = parseInt(tab.name)
  1097. if (index == 1) {
  1098. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  1099. this.$message.error('当前处方为项目,无法切换为药品,需要新开处方')
  1100. return
  1101. }
  1102. } else {
  1103. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  1104. this.$message.error('当前处方为药品,无法切换为项目,需要新开处方')
  1105. return
  1106. }
  1107. }
  1108. if (index == 1) {
  1109. this.teamList = []
  1110. this.$refs.tables.clearSelection()
  1111. this.showOne = true
  1112. this.showTwo = false
  1113. this.$nextTick(() => {
  1114. this.$refs.prescription_tables.setNewData(this.prescriptions[this.prescriptions.length - 1])
  1115. })
  1116. this.customTabIndex = 1
  1117. }
  1118. if (index == 2) {
  1119. this.curDrugs = []
  1120. this.$refs.multipleTable.clearSelection()
  1121. this.showTwo = true
  1122. this.showOne = false
  1123. this.$nextTick(() => {
  1124. this.$refs.prescription_tables.setNewData(this.prescriptions[this.prescriptions.length - 1])
  1125. })
  1126. this.customTabIndex = 2
  1127. }
  1128. this.rightTab = index
  1129. //用来区分处方属于项目还是药品
  1130. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  1131. this.customTabIndex = 1
  1132. this.curStatus = 1
  1133. }
  1134. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  1135. this.customTabIndex = 2
  1136. this.curStatus = 2
  1137. }
  1138. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length == 0) {
  1139. // this.customTabIndex = this.rightTab
  1140. this.customTabIndex = index
  1141. this.curStatus = 0
  1142. }
  1143. }, changeAllGoodInfoTableData: function (selection) {
  1144. this.curDrugs = selection
  1145. }, addCharges() {
  1146. this.$refs.additionalCharges.show()
  1147. },
  1148. selectDrugs(selection, row) {
  1149. this.curDrugs = selection
  1150. },
  1151. comfirm() {
  1152. if (this.curPrescriptions.order_status >= 2) {
  1153. this.$message.error('该处方已经结算或者退费,无法继续添加药品或者项目')
  1154. this.teamList = []
  1155. this.curDrugs = []
  1156. this.tempDrugs = []
  1157. this.$refs.tables.clearSelection()
  1158. this.$refs.multipleTableTwo.clearSelection()
  1159. this.$refs.multipleTable.clearSelection()
  1160. return
  1161. }
  1162. if (this.curStatus == 1 && this.rightTab == 2) {
  1163. this.$message.error('改处方是药品,无法添加项目')
  1164. this.teamList = []
  1165. this.$refs.tables.clearSelection()
  1166. return
  1167. }
  1168. if (this.curStatus == 2 && this.rightTab == 1) {
  1169. this.$message.error('改处方是项目,无法添加药品')
  1170. this.curDrugs = []
  1171. this.tempDrugs = []
  1172. this.$refs.multipleTable.clearSelection()
  1173. this.$refs.multipleTableTwo.clearSelection()
  1174. return
  1175. }
  1176. for (let i = 0; i < this.teamList.length; i++) {
  1177. for (let a = 0; a < this.curPrescriptions.project.length; a++) {
  1178. if (this.teamList[i].id == this.curPrescriptions.project[a].project_id) {
  1179. this.$message.error('改处方存在相同的项目,无法添加相同的项目')
  1180. return
  1181. }
  1182. }
  1183. }
  1184. for (let i = 0; i < this.curDrugs.length; i++) {
  1185. for (let a = 0; a < this.curPrescriptions.advices.length; a++) {
  1186. if (this.curDrugs[i].id == this.curPrescriptions.advices[i].id) {
  1187. this.$message.error('改处方存在相同的药品,无法添加相同的药品')
  1188. return
  1189. }
  1190. }
  1191. }
  1192. let templateDrugs = []
  1193. for (let i = 0; i < this.tempDrugs.length; i++) {
  1194. for (let a = 0; a < this.tempDrugs[i].advices.length; a++) {
  1195. templateDrugs.push(this.tempDrugs[i].advices[a])
  1196. }
  1197. }
  1198. // for (let i = 0; i < templateDrugs.length; i++) {
  1199. // for (let a = 0; a < this.curPrescriptions.advices.length; a++) {
  1200. // if (this.templateDrugs[i].drug_id == this.curPrescriptions.advices[i].id) {
  1201. // this.$message.error('改处方存在相同的药品,无法添加相同的药品')
  1202. // return
  1203. //
  1204. // }
  1205. // }
  1206. // }
  1207. for (let i = 0; i < this.prescriptions.length; i++) {
  1208. if (this.prescriptions[i].name == this.editableTabsValue) {
  1209. var temp = this.deepClone(this.curDrugs)
  1210. var temp2 = this.deepClone(this.teamList)
  1211. var temp3 = this.deepClone(templateDrugs)
  1212. if (temp3.length > 0) {
  1213. for (let b = 0; b < temp3.length; b++) {
  1214. let obj = {
  1215. advice_id: 0,
  1216. id: temp3[b].id,
  1217. drug_name: temp3[b].advice_name,
  1218. single_dose: temp3[b].single_dose,
  1219. delivery_way: temp3[b].delivery_way,
  1220. execution_frequency: temp3[b].execution_frequency,
  1221. retail_price: temp3[b].drug.retail_price.toString(),
  1222. remark: '',
  1223. day: 1,
  1224. prescribing_number: temp3[b].prescribing_number,
  1225. single_dose_unit: temp3[b].drug.min_unit,
  1226. prescribing_number_unit: temp3[b].drug.max_unit,
  1227. medical_insurance_number: temp3[b].drug.medical_insurance_number
  1228. }
  1229. if (obj.prescribing_number == 0 || obj.prescribing_number.length == 0) {
  1230. obj.prescribing_number = 1
  1231. }
  1232. this.prescriptions[i].advices.push(obj)
  1233. }
  1234. this.curStatus = 1
  1235. }
  1236. if (temp.length > 0) {
  1237. for (let b = 0; b < temp.length; b++) {
  1238. let obj = {
  1239. advice_id: 0,
  1240. id: temp[b].id,
  1241. drug_name: temp[b].drug_name,
  1242. single_dose: temp[b].single_dose,
  1243. delivery_way: temp[b].delivery_way,
  1244. execution_frequency: temp[b].execution_frequency,
  1245. retail_price: temp[b].retail_price.toString(),
  1246. remark: '',
  1247. day: 1,
  1248. prescribing_number: temp[b].prescribing_number,
  1249. single_dose_unit: temp[b].min_unit,
  1250. prescribing_number_unit: temp[b].max_unit,
  1251. medical_insurance_number: temp[b].medical_insurance_number
  1252. }
  1253. if (obj.prescribing_number == 0 || obj.prescribing_number.length == 0) {
  1254. obj.prescribing_number = 1
  1255. }
  1256. this.prescriptions[i].advices.push(obj)
  1257. }
  1258. this.curStatus = 1
  1259. }
  1260. if (temp2.length > 0) {
  1261. for (let b = 0; b < temp2.length; b++) {
  1262. let obj = {
  1263. id: 0,
  1264. project_id: temp2[b].id,
  1265. project_name: temp2[b].project_name,
  1266. statistical_classification: temp2[b].statistical_classification,
  1267. single_dose: temp2[b].single_dose,
  1268. delivery_way: temp2[b].delivery_way,
  1269. execution_frequency: temp2[b].execution_frequency,
  1270. number_days: temp2[b].number_days,
  1271. total: temp2[b].total,
  1272. price: temp2[b].price,
  1273. remark: '',
  1274. medical_code: temp2[b].medical_code,
  1275. unit: temp2[b].unit
  1276. }
  1277. if (obj.total == 0) {
  1278. obj.total = 1
  1279. }
  1280. this.prescriptions[i].project.push(obj)
  1281. }
  1282. this.curStatus = 2
  1283. }
  1284. this.curPrescriptions = this.prescriptions[i]
  1285. this.$refs.multipleTable.clearSelection()
  1286. this.$refs.tables.clearSelection()
  1287. }
  1288. }
  1289. this.curDrugs = []
  1290. this.preDrugs = []
  1291. this.teamList = []
  1292. }, changeAllGoodInfoTableDataTwo(row) {
  1293. this.teamList = row
  1294. },
  1295. selectChange(row) {
  1296. this.teamList = row
  1297. },
  1298. getlist() {
  1299. getHisProject().then(response => {
  1300. if (response.data.state == 1) {
  1301. var project = response.data.data.project
  1302. console.log('project', project)
  1303. this.tabProject = project
  1304. }
  1305. })
  1306. }, deepClone(source) {
  1307. if (!source && typeof source !== 'object') {
  1308. throw new Error('error arguments', 'shallowClone')
  1309. }
  1310. const targetObj = source.constructor === Array ? [] : {}
  1311. Object.keys(source).forEach((keys) => {
  1312. if (source[keys] && typeof source[keys] === 'object') {
  1313. targetObj[keys] = this.deepClone(source[keys])
  1314. } else {
  1315. targetObj[keys] = source[keys]
  1316. }
  1317. })
  1318. return targetObj
  1319. },
  1320. getAllProjectTeam() {
  1321. getAllProjectTeam().then(response => {
  1322. if (response.data.state == 1) {
  1323. var team = response.data.data.team
  1324. console.log('team', team)
  1325. this.tabPrjectTeam = team
  1326. }
  1327. })
  1328. },
  1329. selectTeam(row) {
  1330. console.log('row------', row)
  1331. var arr = []
  1332. for (let i = 0; i < row.length; i++) {
  1333. arr.push(row[i].project_id)
  1334. }
  1335. var ids = arr.join(',')
  1336. var strArr = ids.split(',')
  1337. var res = []//接收不重复的数据
  1338. for (var i = 0; i < strArr.length; i++) {
  1339. var flag = true
  1340. for (var j = 0; j < i; j++) {
  1341. if (strArr[i] === strArr[j]) {
  1342. flag = false
  1343. break
  1344. }
  1345. }
  1346. if (flag) {
  1347. res.push(strArr[i])
  1348. }
  1349. }
  1350. var idstr = res.join(',')
  1351. const params = {
  1352. project_id: idstr
  1353. }
  1354. console.log('params', params)
  1355. getPojectListById(params).then(response => {
  1356. if (response.data.state == 1) {
  1357. var project = response.data.data.project
  1358. console.log('project222', project)
  1359. this.teamList = []
  1360. this.teamList = project
  1361. }
  1362. })
  1363. }, changeDoctor(val) {
  1364. for (let i = 0; i < this.doctors.length; i++) {
  1365. if (this.doctors[i].admin_user_id == this.doctorValue) {
  1366. this.departmentValue = this.doctors[i].department_id
  1367. }
  1368. }
  1369. if (this.departmentValue == 0) {
  1370. this.departmentValue = ""
  1371. }
  1372. }
  1373. }, mounted() {
  1374. this.request_record_date = this.record_date
  1375. this.getInitData()
  1376. //获取所有项目
  1377. this.getlist()
  1378. //获取所以项目组套
  1379. this.getAllProjectTeam()
  1380. this.$nextTick(() => {
  1381. this.multipleTableHeight = parseInt(this.$refs.rightTable.offsetHeight)
  1382. })
  1383. },
  1384. watch: {
  1385. fullHeight(val) {
  1386. if (!this.timer) {
  1387. this.fullHeight = val
  1388. let tableHeight = val - 263
  1389. this.tableHeight = tableHeight
  1390. this.multipleTableHeight = parseInt(this.$refs.rightTable.offsetHeight)
  1391. this.timer = true
  1392. let that = this
  1393. setTimeout(function () {
  1394. that.timer = false
  1395. }, 400)
  1396. }
  1397. }
  1398. },
  1399. }
  1400. </script>
  1401. <style lang="scss" scoped>
  1402. .new-main-contain {
  1403. height: 100%;
  1404. display: flex;
  1405. flex-direction: column;
  1406. }
  1407. .app-container {
  1408. height: 100%;
  1409. }
  1410. .mainCell {
  1411. height: 36px;
  1412. display: flex;
  1413. align-items: center;
  1414. }
  1415. .mainLeft {
  1416. width: 200px;
  1417. height: 100%;
  1418. display: flex;
  1419. flex-direction: column;
  1420. margin-top: 2px;
  1421. .el-radio {
  1422. margin-right: 5px;
  1423. }
  1424. }
  1425. .mainRight {
  1426. margin-left: 20px;
  1427. flex: 1;
  1428. height: 100%;
  1429. display: flex;
  1430. flex-direction: column;
  1431. .cellSpan {
  1432. min-width: 80px;
  1433. display: inline-block;
  1434. margin-right: 10px;
  1435. }
  1436. }
  1437. .mainCenter {
  1438. display: flex;
  1439. flex: 1;
  1440. height: 100%;
  1441. }
  1442. .centerLeft {
  1443. flex: 1;
  1444. display: flex;
  1445. flex-direction: column;
  1446. position: relative;
  1447. .el-form-item {
  1448. width: 33%;
  1449. margin-bottom: 14px;
  1450. }
  1451. .el-form-item__label {
  1452. text-align: left;
  1453. }
  1454. }
  1455. .backColor {
  1456. background: #f6f8f9;
  1457. height: 5px;
  1458. margin-bottom: 5px;
  1459. }
  1460. .RP {
  1461. color: #409EFF;
  1462. font-size: 14px;
  1463. margin-bottom: 5px;
  1464. }
  1465. .tabsBox {
  1466. position: relative;
  1467. flex: 1;
  1468. overflow-y: auto;
  1469. margin-bottom: 60px;
  1470. margin-top: 4px;
  1471. .el-tabs__item {
  1472. padding: 0 10px;
  1473. }
  1474. }
  1475. .preTabs {
  1476. height: 100%;
  1477. display: flex;
  1478. flex-direction: column;
  1479. .el-tabs__content {
  1480. flex: 1;
  1481. overflow-y: auto;
  1482. }
  1483. }
  1484. .costBox {
  1485. width: 100%;
  1486. height: 60px;
  1487. background: #fff;
  1488. position: absolute;
  1489. bottom: 0;
  1490. display: flex;
  1491. align-items: center;
  1492. justify-content: space-between;
  1493. }
  1494. .statusRed {
  1495. color: red;
  1496. }
  1497. .addTab {
  1498. position: absolute;
  1499. right: 8px;
  1500. top: 3px;
  1501. z-index: 20;
  1502. }
  1503. .centerRight {
  1504. width: 300px;
  1505. margin-left: 10px;
  1506. display: flex;
  1507. flex-direction: column;
  1508. position: relative;
  1509. }
  1510. .rightTab {
  1511. height: 40px;
  1512. width: 100%;
  1513. border: 1px solid #d2d2d2;
  1514. box-sizing: border-box;
  1515. p {
  1516. width: 50%;
  1517. height: 40px;
  1518. line-height: 40px;
  1519. text-align: center;
  1520. background: #eee;
  1521. float: left;
  1522. }
  1523. > p:last-child {
  1524. border-left: 1px solid #d2d2d2;
  1525. float: right;
  1526. }
  1527. .activeP {
  1528. background: #409EFF;
  1529. color: #fff;
  1530. }
  1531. }
  1532. .rightTabs {
  1533. display: flex;
  1534. flex-direction: column;
  1535. }
  1536. .comfirmBox {
  1537. width: 100%;
  1538. height: 60px;
  1539. background: #fff;
  1540. position: absolute;
  1541. bottom: 0;
  1542. display: flex;
  1543. align-items: center;
  1544. justify-content: space-between;
  1545. z-index: 99;
  1546. }
  1547. .borderCard {
  1548. height: 100%;
  1549. display: flex;
  1550. flex-direction: column;
  1551. margin-bottom: 60px;
  1552. .el-tabs--border-card > .el-tabs__content {
  1553. padding: 0;
  1554. }
  1555. }
  1556. </style>
  1557. <style lang="scss">
  1558. .borderCard {
  1559. .el-tabs__nav {
  1560. width: 100%;
  1561. }
  1562. .el-tabs__item {
  1563. width: 50%;
  1564. text-align: center;
  1565. }
  1566. .el-tabs__content {
  1567. padding: 5px;
  1568. flex: 1;
  1569. }
  1570. }
  1571. .centerLeft {
  1572. .el-form-item__label {
  1573. text-align: left;
  1574. }
  1575. }
  1576. .tabsBox {
  1577. .el-tabs__item {
  1578. padding: 0 10px;
  1579. }
  1580. .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) {
  1581. padding: 0 10px;
  1582. }
  1583. .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 {
  1584. padding: 0 10px;
  1585. }
  1586. .el-tabs--card > .el-tabs__header .el-tabs__item.is-active.is-closable {
  1587. padding: 0 10px;
  1588. }
  1589. }
  1590. .centerRight {
  1591. .el-tabs__nav-scroll {
  1592. display: flex;
  1593. }
  1594. .el-tabs__nav {
  1595. margin: 0 auto;
  1596. }
  1597. .el-table th .cell, .el-table td .cell {
  1598. padding: 0 2px;
  1599. }
  1600. }
  1601. .preTabs {
  1602. .el-tabs__content {
  1603. flex: 1;
  1604. overflow-y: auto;
  1605. padding: 5px 0 5px 5px;
  1606. }
  1607. }
  1608. .rightTabs {
  1609. height: 100%;
  1610. .el-tabs__nav {
  1611. width: auto;
  1612. }
  1613. .el-tabs__header {
  1614. margin-bottom: 5px;
  1615. }
  1616. .el-tabs__item {
  1617. width: auto;
  1618. text-align: inherit;
  1619. }
  1620. .el-tabs__content {
  1621. flex: 1;
  1622. overflow-y: auto;
  1623. }
  1624. .el-tab-pane {
  1625. display: flex;
  1626. flex-direction: column;
  1627. height: 100%;
  1628. }
  1629. }
  1630. #tab-more {
  1631. .el-icon-close {
  1632. display: none;
  1633. }
  1634. }
  1635. ::-webkit-scrollbar {
  1636. height: 15px;
  1637. }
  1638. </style>