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

deskPrescription.vue 62KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873
  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. <div class="RP">Rp
  76. <el-date-picker
  77. v-model="item.pre_time"
  78. type="datetime"
  79. :clearable="false"
  80. format="yyyy-MM-dd HH:mm"
  81. value-format="yyyy-MM-dd HH:mm"
  82. placeholder="选择日期">
  83. </el-date-picker>
  84. <div style="float: right;margin-bottom:5px;margin-right:1%;">
  85. <el-button
  86. round
  87. size="small"
  88. @click="openLast(3)"
  89. >上一方
  90. </el-button>
  91. <el-button
  92. round
  93. size="small"
  94. @click="openNext(4)"
  95. >下一方
  96. </el-button>
  97. </div>
  98. </div>
  99. </el-tab-pane>
  100. <el-tab-pane name="more" closable><span slot="label"><i class="el-icon-plus" @click="addTab"></i></span>
  101. </el-tab-pane>
  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. var nowDate = new Date()
  426. var nowYear = nowDate.getFullYear()
  427. var nowMonth = nowDate.getMonth() + 1
  428. var nowDay = nowDate.getDate()
  429. var hours = nowDate.getHours()
  430. var min = nowDate.getMinutes()
  431. var nowTime =
  432. nowYear +
  433. '-' +
  434. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  435. '-' +
  436. (nowDay < 10 ? '0' + nowDay : nowDay) + " "+(hours < 10 ? '0' + hours : hours) +
  437. ':' + (min < 10 ? '0' + min : min)
  438. this.prescriptions[i]['pre_time'] = nowTime
  439. this.prescriptions[i].name = "处方" + (i + 1)
  440. if (i == 0) {
  441. if (this.prescriptions[0].advices.length > 0 && this.prescriptions[0].project.length == 0) {
  442. this.customTabIndex = 1
  443. this.curStatus = 1
  444. this.rightTab = 1
  445. this.showOne = true
  446. this.showTwo = false
  447. }
  448. if (this.prescriptions[0].advices.length == 0 && this.prescriptions[0].project.length > 0) {
  449. this.customTabIndex = 2
  450. this.curStatus = 2
  451. this.rightTab = 2
  452. this.showTwo = true
  453. this.showOne = false
  454. }
  455. }
  456. }
  457. this.curPrescriptions = this.prescriptions[0]
  458. this.$refs.call_prescription.close()
  459. this.$emit('setData',this.prescriptions)
  460. },
  461. callCancel(){
  462. this.$refs.call_prescription.close()
  463. },
  464. cancel() {
  465. this.$refs.next_or_last_prescription.close()
  466. this.request_record_date = this.record_date
  467. },
  468. setValue(val) {
  469. this.prescriptions = []
  470. this.prescriptions = val
  471. this.$refs.next_or_last_prescription.close()
  472. for (let i = 0; i < this.prescriptions.length; i++) {
  473. this.prescriptions[i].name = "处方" + (i + 1)
  474. if (i == 0) {
  475. if (this.prescriptions[0].advices.length > 0 && this.prescriptions[0].project.length == 0) {
  476. this.customTabIndex = 1
  477. this.curStatus = 1
  478. this.rightTab = 1
  479. this.showOne = true
  480. this.showTwo = false
  481. }
  482. if (this.prescriptions[0].advices.length == 0 && this.prescriptions[0].project.length > 0) {
  483. this.customTabIndex = 2
  484. this.curStatus = 2
  485. this.rightTab = 2
  486. this.showTwo = true
  487. this.showOne = false
  488. }
  489. }
  490. }
  491. this.curPrescriptions = this.prescriptions[0]
  492. this.request_record_date = this.record_date
  493. this.$emit('setData',this.prescriptions)
  494. },
  495. GetNextOrLastHisPrescription(params) {
  496. getNextOrLastHisPrescription(params).then(response => {
  497. if (response.data.state == 1) {
  498. this.$refs.next_or_last_prescription.show(response.data.data.prescriptions, this.patientInfo.name, this.patientInfo.id, this.prescriptions)
  499. this.request_record_date = uParseTime(response.data.data.prescriptions[0].record_date, '{y}-{m}-{d}')
  500. } else {
  501. this.$message.error(response.data.msg)
  502. }
  503. })
  504. },
  505. openLast(val) {
  506. if (this.curPrescriptions.order_status == 2) {
  507. this.$message.error('处方已经结算,无法添加')
  508. return
  509. }
  510. if (this.patientInfo.id == 0) {
  511. this.$message.error('请选择患者')
  512. return
  513. }
  514. if (val == 1) {
  515. this.isVisibility = false
  516. this.request_record_date = this.record_date
  517. let params = {
  518. patient_id: this.patientInfo.id,
  519. record_time: this.request_record_date,
  520. type: 1
  521. }
  522. this.GetNextOrLastHisPrescription(params)
  523. } else if (val == 3) {
  524. let params = {
  525. patient_id: this.patientInfo.id,
  526. record_time: this.request_record_date,
  527. type: 1
  528. }
  529. this.GetNextOrLastHisPrescription(params)
  530. }
  531. },
  532. openNext(val) {
  533. if (this.curPrescriptions.order_status == 2) {
  534. this.$message.error('处方已经结算,无法添加')
  535. return
  536. }
  537. if (this.patientInfo.id == 0) {
  538. this.$message.error('请选择患者')
  539. return
  540. }
  541. if (val == 2) {
  542. this.isVisibility = false
  543. this.request_record_date = this.record_date
  544. let params = {
  545. patient_id: this.patientInfo.id,
  546. record_time: this.request_record_date,
  547. type: 2
  548. }
  549. this.GetNextOrLastHisPrescription(params)
  550. } else if (val == 4) {
  551. let params = {
  552. patient_id: this.patientInfo.id,
  553. record_time: this.request_record_date,
  554. type: 2
  555. }
  556. this.GetNextOrLastHisPrescription(params)
  557. }
  558. },
  559. selectTemplate(selection, row) {
  560. this.tempDrugs = selection
  561. }, changeTemplateData(selection) {
  562. this.tempDrugs = selection
  563. },
  564. stockInCount: function (row) {
  565. let total = 0;
  566. if (row.stock_in != null) {
  567. for (let i = 0; i < row.stock_in.length; i++) {
  568. total = total + row.stock_in[i].warehousing_count;
  569. }
  570. }
  571. return total;
  572. },
  573. salesReturnCount: function (row) {
  574. let total = 0;
  575. if (row.sales_return != null) {
  576. for (let i = 0; i < row.sales_return.length; i++) {
  577. total = total + row.sales_return[i].count;
  578. }
  579. }
  580. return total;
  581. },
  582. stockOutCount: function (row) {
  583. let total = 0;
  584. if (row.stock_out != null) {
  585. for (let i = 0; i < row.stock_out.length; i++) {
  586. total = total + row.stock_out[i].count;
  587. }
  588. }
  589. return total;
  590. },
  591. cancelStockCount: function (row) {
  592. let total = 0;
  593. if (row.cancel_stock != null) {
  594. for (let i = 0; i < row.cancel_stock.length; i++) {
  595. total = total + row.cancel_stock[i].count;
  596. }
  597. }
  598. return total;
  599. },
  600. setCharge(additional_charges) {
  601. for (let i = 0; i < additional_charges.length; i++) {
  602. additional_charges[i].count = 1
  603. this.curPrescriptions.addition.push(additional_charges[i])
  604. }
  605. this.$refs.additionalCharges.hide()
  606. },
  607. searchAction() {
  608. if (this.search_keyword.length == 0) {
  609. this.drugs = this.allDrugs
  610. } else {
  611. let arr = []
  612. for (let i = 0; i < this.drugs.length; i++) {
  613. if (this.drugs[i].drug_name.indexOf(this.search_keyword) != -1) {
  614. arr = arr.concat(this.drugs[i])
  615. }
  616. }
  617. this.drugs = arr
  618. }
  619. },
  620. getTotalOne() {
  621. var total = 0
  622. console.log(this.prescriptions)
  623. for (let i = 0; i < this.prescriptions.length; i++) {
  624. if (this.prescriptions[i].name == this.editableTabsValue) {
  625. if (this.prescriptions[i].advices != null) {
  626. for (let a = 0; a < this.prescriptions[i].advices.length; a++) {
  627. total = total + this.prescriptions[i].advices[a].retail_price * this.prescriptions[i].advices[a].prescribing_number
  628. }
  629. }
  630. if (this.prescriptions[i].project != null) {
  631. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  632. total = total + this.prescriptions[i].project[b].price * this.prescriptions[i].project[b].total
  633. }
  634. }
  635. if (this.prescriptions[i].addition != null) {
  636. for (let b = 0; b < this.prescriptions[i].addition.length; b++) {
  637. total = total + this.prescriptions[i].addition[b].price * this.prescriptions[i].addition[b].count
  638. }
  639. }
  640. total = Math.floor(total * 100) / 100
  641. }
  642. }
  643. return total
  644. },
  645. getCurTotal() {
  646. var total = 0
  647. if (this.curPrescriptions.type == 1) {
  648. for (let a = 0; a < this.curPrescriptions.advices.length; a++) {
  649. total = total + this.curPrescriptions.advices[a].retail_price * this.curPrescriptions.advices[a].prescribing_number
  650. }
  651. return Math.floor(total * 100) / 100
  652. } else {
  653. for (let a = 0; a < this.curPrescriptions.project.length; a++) {
  654. total = total + this.curPrescriptions.project[a].price * this.curPrescriptions.project[a].total
  655. }
  656. return Math.floor(total * 100) / 100
  657. }
  658. },
  659. getTotal() {
  660. var total = 0
  661. for (let i = 0; i < this.prescriptions.length; i++) {
  662. if (this.prescriptions[i].advices != null) {
  663. for (let a = 0; a < this.prescriptions[i].advices.length; a++) {
  664. total = total + this.prescriptions[i].advices[a].retail_price * this.prescriptions[i].advices[a].prescribing_number
  665. }
  666. }
  667. if (this.prescriptions[i].project != null) {
  668. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  669. total = total + this.prescriptions[i].project[b].price * this.prescriptions[i].project[b].total
  670. }
  671. }
  672. if (this.prescriptions[i].addition != null) {
  673. for (let b = 0; b < this.prescriptions[i].addition.length; b++) {
  674. total = total + this.prescriptions[i].addition[b].price * this.prescriptions[i].addition[b].count
  675. }
  676. }
  677. }
  678. return Math.floor(total * 100) / 100
  679. },
  680. createFilter(queryString) {
  681. return (restaurant) => {
  682. return (restaurant.name.toLowerCase().indexOf(queryString.toLowerCase()) === 0)
  683. }
  684. },
  685. querySearch2(queryString, cb) {
  686. var restaurants = this.other_sick
  687. restaurants.map(item => {
  688. item.value = item.name
  689. })
  690. var results = queryString ? restaurants.filter(this.createFilter(queryString)) : restaurants
  691. // 调用 callback 返回建议列表的数据
  692. cb(results)
  693. },
  694. changeKind(val) {
  695. this.drugs = []
  696. if (val == 0) {
  697. this.drugs = this.allDrugs
  698. } else {
  699. for (let i = 0; i < this.allDrugs.length; i++) {
  700. if (this.allDrugs[i].drug_type == val) {
  701. this.drugs.push(this.allDrugs[i])
  702. }
  703. }
  704. }
  705. },
  706. getDictionaryDataConfig(module, filed_name) {
  707. return getDictionaryDataConfig(module, filed_name)
  708. },
  709. getInitData() {
  710. getInitData().then(response => {
  711. if (response.data.state == 0) {
  712. this.$message.error(response.data.msg)
  713. return false
  714. } else {
  715. this.drugs = response.data.data.drugs
  716. this.allDrugs = response.data.data.drugs
  717. this.advices_template = response.data.data.advices_template
  718. this.doctors = response.data.data.doctors
  719. this.department = response.data.data.department
  720. this.sick = response.data.data.sick
  721. this.diagnoses = response.data.data.diagnose
  722. this.additions = response.data.data.additions
  723. // var info = response.data.data.info
  724. // if (info.user_type == 2 || info.user_type == 1) {
  725. // this.doctorValue = info.admin_user_id
  726. // if (info.department_id == 0) {
  727. // if (this.department.length > 0) {
  728. // this.departmentValue = this.department[0].id
  729. // } else {
  730. // this.departmentValue = ''
  731. //
  732. // }
  733. // } else {
  734. // this.departmentValue = info.department_id
  735. // }
  736. // }else{
  737. // this.doctorValue = this.doctors[0].admin_user_id
  738. // }
  739. }
  740. })
  741. },
  742. tabclickEvent(val) {
  743. for (let i = 0; i < this.prescriptions.length; i++) {
  744. console.log(this.prescriptions[i].name)
  745. if (this.prescriptions[i].name == val.name) {
  746. console.log("2323323", this.prescriptions)
  747. this.prescription_id = this.prescriptions[i].id
  748. this.$emit('event1', this.prescription_id)
  749. this.curPrescriptions = this.prescriptions[i]
  750. this.teamList = []
  751. this.curDrugs = []
  752. this.$refs.multipleTable.clearSelection()
  753. this.$refs.tables.clearSelection()
  754. //用来区分处方属于项目还是药品
  755. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  756. this.customTabIndex = 1
  757. this.curStatus = 1
  758. this.rightTab = 1
  759. this.showOne = true
  760. this.showTwo = false
  761. }
  762. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  763. this.customTabIndex = 2
  764. this.curStatus = 2
  765. this.rightTab = 2
  766. this.showTwo = true
  767. this.showOne = false
  768. }
  769. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length == 0) {
  770. this.customTabIndex = this.rightTab
  771. this.curStatus = 0
  772. }
  773. }
  774. }
  775. },
  776. clearData() {
  777. this.curPrescriptions = []
  778. this.curStatus = 0
  779. this.curDrugs = []
  780. this.preDrugs = []
  781. this.teamList = []
  782. },
  783. setData(data, info, admin_info, doctors, department, hisPatientInfo) {
  784. console.log(data)
  785. this.prescription_id = data[0].id
  786. this.editableTabsValue = "处方1"
  787. this.$emit('event1', this.prescription_id)
  788. this.curStatus = 0
  789. this.prescriptions = data
  790. this.curPrescriptions = this.prescriptions[0]
  791. this.diagnose = info.diagnosis
  792. if (this.diagnose == 0) {
  793. this.diagnose = ""
  794. }
  795. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  796. this.curStatus = 1
  797. this.customTabIndex = 1
  798. this.rightTab = 1
  799. this.showOne = true
  800. this.showTwo = false
  801. }
  802. if (this.curPrescriptions.project.length > 0 && this.curPrescriptions.advices.length == 0) {
  803. this.curStatus = 2
  804. this.customTabIndex = 2
  805. this.rightTab = 2
  806. this.showOne = false
  807. this.showTwo = true
  808. }
  809. this.state1 = info.sick_type
  810. if (this.state1 == 0) {
  811. this.state1 = ""
  812. }
  813. this.state2 = info.sick_history
  814. if (this.state2 == 0) {
  815. this.state2 = ""
  816. }
  817. // this.register_type = info.register_type
  818. if (info.prescription_status == 0) {
  819. this.order_status = ''
  820. }
  821. if (info.prescription_status == 1 || info.prescription_status == 2) {
  822. this.order_status = '未收费'
  823. }
  824. if (info.prescription_status == 3) {
  825. this.order_status = '已结算'
  826. }
  827. if (info.prescription_status == 4) {
  828. this.order_status = '已退费'
  829. }
  830. console.log(info)
  831. if (info.id > 0) {
  832. this.doctorValue = info.doctor_id
  833. this.departmentValue = info.departments
  834. } else {
  835. if (hisPatientInfo.doctor != 0 && hisPatientInfo.department != 0) {
  836. this.doctorValue = hisPatientInfo.doctor
  837. this.departmentValue = hisPatientInfo.department
  838. } else {
  839. if (admin_info.user_type == 2 || admin_info.user_type == 1) {
  840. this.doctorValue = admin_info.admin_user_id
  841. if (admin_info.department_id == 0) {
  842. if (this.department.length > 0) {
  843. if (department && department.length > 0) {
  844. this.departmentValue = department[0].id
  845. } else {
  846. this.departmentValue = ''
  847. }
  848. } else {
  849. this.departmentValue = ''
  850. }
  851. } else {
  852. this.departmentValue = admin_info.department_id
  853. }
  854. } else {
  855. this.doctorValue = doctors[0].admin_user_id
  856. }
  857. if (this.doctorValue == 0) {
  858. this.doctorValue = ''
  859. }
  860. }
  861. }
  862. if (info.register_type == 0) {
  863. // if(hisPatientInfo.register_type != 0){
  864. // this.register_type = hisPatientInfo.register_type
  865. // }else{
  866. this.register_type = ''
  867. // }
  868. } else {
  869. this.register_type = info.register_type
  870. }
  871. },
  872. moreState(tab, event) {
  873. if (tab == 'more') {
  874. return false
  875. }
  876. },open_two(){
  877. if (this.curPrescriptions.order_status == 2) {
  878. this.$message.error('处方已经结算,无法添加')
  879. return
  880. }
  881. if (this.patientInfo == null || this.patientInfo.id == 0) {
  882. this.$message.error('请选择患者')
  883. return
  884. }
  885. let params = {
  886. end_time: this.record_date,
  887. start_time: moment(new Date()).subtract(30, 'days').format('YYYY-MM-DD'),
  888. patient_id: this.patientInfo.id
  889. }
  890. getCallHisPrescription(params).then(response => {
  891. if (response.data.state == 1) {
  892. this.$refs.call_prescription.show(this.patientInfo.name, this.patientInfo.id,params.end_time, params.start_time,this.prescriptions,response.data.data.prescriptions)
  893. } else {
  894. this.$message.error(response.data.msg)
  895. }
  896. })
  897. },
  898. open(index, isLoading) {
  899. if (this.curPrescriptions.order_status == 2) {
  900. this.$message.error('当前处方已经结算,无法保存')
  901. return
  902. }
  903. if (this.doctorValue.length <= 0) {
  904. this.$message.error('医生不能为空')
  905. return
  906. }
  907. if (this.departmentValue.length <= 0) {
  908. this.$message.error('科室不能为空')
  909. return
  910. }
  911. if (index == 1) {
  912. let params = {
  913. patient_id: this.patientInfo.id,
  914. diagnose: this.diagnose,
  915. sick_type: this.state1,
  916. sick_history: this.state2,
  917. doctor: this.doctorValue,
  918. department: this.departmentValue,
  919. record_date: this.record_date,
  920. his_patient_id: this.hisPatientInfo.id,
  921. reg_type: this.register_type
  922. }
  923. for (let i = 0; i < this.prescriptions.length; i++) {
  924. if (this.prescriptions[i].advices.length > 0 && this.prescriptions[i].project.length == 0) {
  925. this.prescriptions[i]['type'] = 1
  926. }
  927. if (this.prescriptions[i].advices.length == 0 && this.prescriptions[i].project.length > 0) {
  928. this.prescriptions[i]['type'] = 2
  929. }
  930. for (let b = 0; b < this.prescriptions[i].advices.length; b++) {
  931. this.prescriptions[i].advices[b].single_dose = this.prescriptions[i].advices[b].single_dose.toString()
  932. this.prescriptions[i].advices[b].prescribing_number = this.prescriptions[i].advices[b].prescribing_number.toString()
  933. this.prescriptions[i].advices[b].retail_price = this.prescriptions[i].advices[b].retail_price.toString()
  934. this.prescriptions[i].advices[b].day = parseInt(this.prescriptions[i].advices[b].day)
  935. }
  936. for (let b = 0; b < this.prescriptions[i].project.length; b++) {
  937. this.prescriptions[i].project[b].price = this.prescriptions[i].project[b].price.toString()
  938. this.prescriptions[i].project[b].total = this.prescriptions[i].project[b].total.toString()
  939. this.prescriptions[i].project[b].delivery_way = this.prescriptions[i].project[b].delivery_way.toString()
  940. }
  941. for (let b = 0; b < this.prescriptions[i].addition.length; b++) {
  942. this.prescriptions[i].addition[b].id = parseInt(this.prescriptions[i].addition[b].id)
  943. this.prescriptions[i].addition[b].item_id = parseInt(this.prescriptions[i].addition[b].item_id)
  944. this.prescriptions[i].addition[b].price = this.prescriptions[i].addition[b].price.toString()
  945. this.prescriptions[i].addition[b].count = this.prescriptions[i].addition[b].count.toString()
  946. }
  947. }
  948. let data = {
  949. 'prescriptions': this.prescriptions
  950. }
  951. isLoading = true
  952. console.log("prescriptions9999",this.prescriptions)
  953. console.log("params---",params)
  954. console.log("data",data)
  955. createHisPrescription(data, params).then(response => {
  956. if (response.data.state == 1) {
  957. this.$emit("change")
  958. this.$message.success('保存成功')
  959. }
  960. })
  961. } else if (index == 2) {
  962. this.$router.push('/outpatientDoctorStation/print')
  963. } else if (index == 4) {
  964. } else if (index == 5) {
  965. this.$refs.saveTemplate.show()
  966. }
  967. },
  968. addTab(targetName) {
  969. if (this.curPrescriptions.order_status == 2) {
  970. this.$message.error('该处方已经结算或者退费,无法继续添加处方')
  971. return
  972. }
  973. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length == 0) {
  974. this.$message.error('当前处方无数据,新增数据后才能新增处方')
  975. return
  976. }
  977. this.tabIndex = this.prescriptions.length
  978. ++this.tabIndex
  979. let newTabName = '处方' + this.tabIndex
  980. var nowDate = new Date()
  981. var nowYear = nowDate.getFullYear()
  982. var nowMonth = nowDate.getMonth() + 1
  983. var nowDay = nowDate.getDate()
  984. var hours = nowDate.getHours()
  985. var min = nowDate.getMinutes()
  986. var nowTime =
  987. nowYear +
  988. '-' +
  989. (nowMonth < 10 ? '0' + nowMonth : nowMonth) +
  990. '-' +
  991. (nowDay < 10 ? '0' + nowDay : nowDay) + " "+(hours < 10 ? '0' + hours : hours) +
  992. ':' + (min < 10 ? '0' + min : min)
  993. this.prescriptions.push({
  994. id: 0,
  995. name: newTabName,
  996. order_status: 0,
  997. advices: [],
  998. project: [],
  999. addition: [],
  1000. pre_time:nowTime,
  1001. })
  1002. this.editableTabsValue = newTabName
  1003. this.curPrescriptions = this.prescriptions[this.prescriptions.length - 1]
  1004. this.curStatus = 0
  1005. },
  1006. removeTab(targetName) {
  1007. if (this.curPrescriptions.order_status == 2) {
  1008. this.$message.error('该处方已经结算,无法删除')
  1009. return
  1010. }
  1011. if (targetName == '处方1') {
  1012. this.$message.error('该处方无法删除')
  1013. return
  1014. }
  1015. this.$confirm('处方删除后不可恢复,是否确认删除', '删除', {
  1016. confirmButtonText: '确 定',
  1017. cancelButtonText: '取 消',
  1018. type: 'warning'
  1019. }).then(() => {
  1020. let id = 0
  1021. for (let i = 0; i < this.prescriptions.length; i++) {
  1022. if (this.prescriptions[i].name == targetName) {
  1023. id = this.prescriptions[i].id
  1024. }
  1025. }
  1026. if (id == 0) {
  1027. let tabs = this.prescriptions
  1028. let activeName = this.editableTabsValue
  1029. if (activeName === targetName) {
  1030. tabs.forEach((tab, index) => {
  1031. if (tab.name === targetName) {
  1032. let nextTab = tabs[index + 1] || tabs[index - 1]
  1033. if (nextTab) {
  1034. activeName = nextTab.name
  1035. }
  1036. }
  1037. })
  1038. }
  1039. this.editableTabsValue = activeName
  1040. this.prescriptions = tabs.filter(tab => tab.name !== targetName)
  1041. for (let i = 0; i < this.prescriptions.length; i++) {
  1042. if (activeName == this.prescriptions[i].name) {
  1043. this.curPrescriptions = this.prescriptions[i]
  1044. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  1045. this.curStatus = 1
  1046. }
  1047. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  1048. this.curStatus = 2
  1049. }
  1050. }
  1051. }
  1052. if (this.prescriptions.length == 0) {
  1053. this.curPrescriptions = []
  1054. this.curStatus = 0
  1055. }
  1056. } else {
  1057. let params = {
  1058. 'id': id
  1059. }
  1060. delHisPrescription(params).then(response => {
  1061. if (response.data.state == 1) {
  1062. this.$message.success('删除成功')
  1063. let tabs = this.prescriptions
  1064. let activeName = this.editableTabsValue
  1065. if (activeName === targetName) {
  1066. tabs.forEach((tab, index) => {
  1067. if (tab.name === targetName) {
  1068. let nextTab = tabs[index + 1] || tabs[index - 1]
  1069. if (nextTab) {
  1070. activeName = nextTab.name
  1071. }
  1072. }
  1073. })
  1074. }
  1075. this.editableTabsValue = activeName
  1076. this.prescriptions = tabs.filter(tab => tab.name !== targetName)
  1077. for (let i = 0; i < this.prescriptions.length; i++) {
  1078. if (activeName == this.prescriptions[i].name) {
  1079. this.curPrescriptions = this.prescriptions[i]
  1080. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  1081. this.curStatus = 1
  1082. }
  1083. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  1084. this.curStatus = 2
  1085. }
  1086. }
  1087. }
  1088. if (this.prescriptions.length == 0) {
  1089. this.curPrescriptions = []
  1090. this.curStatus = 0
  1091. }
  1092. } else {
  1093. this.$message.success(response.data.msg)
  1094. }
  1095. })
  1096. }
  1097. }).catch(() => {
  1098. })
  1099. },
  1100. beforeLeave(activeName, oldActiveName) {
  1101. let index = activeName
  1102. if (index == 1) {
  1103. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  1104. return false
  1105. }
  1106. } else {
  1107. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  1108. return false
  1109. }
  1110. }
  1111. },
  1112. clickTab(tab) {
  1113. let index = parseInt(tab.name)
  1114. if (index == 1) {
  1115. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  1116. this.$message.error('当前处方为项目,无法切换为药品,需要新开处方')
  1117. return
  1118. }
  1119. } else {
  1120. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  1121. this.$message.error('当前处方为药品,无法切换为项目,需要新开处方')
  1122. return
  1123. }
  1124. }
  1125. if (index == 1) {
  1126. this.teamList = []
  1127. this.$refs.tables.clearSelection()
  1128. this.showOne = true
  1129. this.showTwo = false
  1130. this.$nextTick(() => {
  1131. this.$refs.prescription_tables.setNewData(this.prescriptions[this.prescriptions.length - 1])
  1132. })
  1133. this.customTabIndex = 1
  1134. }
  1135. if (index == 2) {
  1136. this.curDrugs = []
  1137. this.$refs.multipleTable.clearSelection()
  1138. this.showTwo = true
  1139. this.showOne = false
  1140. this.$nextTick(() => {
  1141. this.$refs.prescription_tables.setNewData(this.prescriptions[this.prescriptions.length - 1])
  1142. })
  1143. this.customTabIndex = 2
  1144. }
  1145. this.rightTab = index
  1146. //用来区分处方属于项目还是药品
  1147. if (this.curPrescriptions.advices.length > 0 && this.curPrescriptions.project.length == 0) {
  1148. this.customTabIndex = 1
  1149. this.curStatus = 1
  1150. }
  1151. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length > 0) {
  1152. this.customTabIndex = 2
  1153. this.curStatus = 2
  1154. }
  1155. if (this.curPrescriptions.advices.length == 0 && this.curPrescriptions.project.length == 0) {
  1156. // this.customTabIndex = this.rightTab
  1157. this.customTabIndex = index
  1158. this.curStatus = 0
  1159. }
  1160. }, changeAllGoodInfoTableData: function (selection) {
  1161. this.curDrugs = selection
  1162. }, addCharges() {
  1163. this.$refs.additionalCharges.show()
  1164. },
  1165. selectDrugs(selection, row) {
  1166. this.curDrugs = selection
  1167. },
  1168. comfirm() {
  1169. if (this.curPrescriptions.order_status == 2) {
  1170. this.$message.error('该处方已经结算,无法继续添加药品或者项目')
  1171. this.teamList = []
  1172. this.curDrugs = []
  1173. this.tempDrugs = []
  1174. this.$refs.tables.clearSelection()
  1175. this.$refs.multipleTableTwo.clearSelection()
  1176. this.$refs.multipleTable.clearSelection()
  1177. return
  1178. }
  1179. if (this.curStatus == 1 && this.rightTab == 2) {
  1180. this.$message.error('改处方是药品,无法添加项目')
  1181. this.teamList = []
  1182. this.$refs.tables.clearSelection()
  1183. return
  1184. }
  1185. if (this.curStatus == 2 && this.rightTab == 1) {
  1186. this.$message.error('改处方是项目,无法添加药品')
  1187. this.curDrugs = []
  1188. this.tempDrugs = []
  1189. this.$refs.multipleTable.clearSelection()
  1190. this.$refs.multipleTableTwo.clearSelection()
  1191. return
  1192. }
  1193. for (let i = 0; i < this.teamList.length; i++) {
  1194. for (let a = 0; a < this.curPrescriptions.project.length; a++) {
  1195. if (this.teamList[i].id == this.curPrescriptions.project[a].project_id) {
  1196. this.$message.error('改处方存在相同的项目,无法添加相同的项目')
  1197. return
  1198. }
  1199. }
  1200. }
  1201. for (let i = 0; i < this.curDrugs.length; i++) {
  1202. for (let a = 0; a < this.curPrescriptions.advices.length; a++) {
  1203. if (this.curDrugs[i].id == this.curPrescriptions.advices[i].id) {
  1204. this.$message.error('改处方存在相同的药品,无法添加相同的药品')
  1205. return
  1206. }
  1207. }
  1208. }
  1209. let templateDrugs = []
  1210. for (let i = 0; i < this.tempDrugs.length; i++) {
  1211. for (let a = 0; a < this.tempDrugs[i].advices.length; a++) {
  1212. templateDrugs.push(this.tempDrugs[i].advices[a])
  1213. }
  1214. }
  1215. // for (let i = 0; i < templateDrugs.length; i++) {
  1216. // for (let a = 0; a < this.curPrescriptions.advices.length; a++) {
  1217. // if (this.templateDrugs[i].drug_id == this.curPrescriptions.advices[i].id) {
  1218. // this.$message.error('改处方存在相同的药品,无法添加相同的药品')
  1219. // return
  1220. //
  1221. // }
  1222. // }
  1223. // }
  1224. for (let i = 0; i < this.prescriptions.length; i++) {
  1225. if (this.prescriptions[i].name == this.editableTabsValue) {
  1226. var temp = this.deepClone(this.curDrugs)
  1227. var temp2 = this.deepClone(this.teamList)
  1228. var temp3 = this.deepClone(templateDrugs)
  1229. if (temp3.length > 0) {
  1230. for (let b = 0; b < temp3.length; b++) {
  1231. let obj = {
  1232. advice_id: 0,
  1233. id: temp3[b].id,
  1234. drug_name: temp3[b].advice_name,
  1235. single_dose: temp3[b].single_dose,
  1236. delivery_way: temp3[b].delivery_way,
  1237. execution_frequency: temp3[b].execution_frequency,
  1238. retail_price: temp3[b].drug.retail_price.toString(),
  1239. remark: '',
  1240. day: 1,
  1241. prescribing_number: temp3[b].prescribing_number,
  1242. single_dose_unit: temp3[b].drug.min_unit,
  1243. prescribing_number_unit: temp3[b].drug.max_unit,
  1244. medical_insurance_number: temp3[b].drug.medical_insurance_number
  1245. }
  1246. if (obj.prescribing_number == 0 || obj.prescribing_number.length == 0) {
  1247. obj.prescribing_number = 1
  1248. }
  1249. this.prescriptions[i].advices.push(obj)
  1250. }
  1251. this.curStatus = 1
  1252. }
  1253. if (temp.length > 0) {
  1254. for (let b = 0; b < temp.length; b++) {
  1255. let obj = {
  1256. advice_id: 0,
  1257. id: temp[b].id,
  1258. drug_name: temp[b].drug_name,
  1259. single_dose: temp[b].single_dose,
  1260. delivery_way: temp[b].delivery_way,
  1261. execution_frequency: temp[b].execution_frequency,
  1262. retail_price: temp[b].retail_price.toString(),
  1263. remark: '',
  1264. day: 1,
  1265. prescribing_number: temp[b].prescribing_number,
  1266. single_dose_unit: temp[b].min_unit,
  1267. prescribing_number_unit: temp[b].max_unit,
  1268. medical_insurance_number: temp[b].medical_insurance_number
  1269. }
  1270. if (obj.prescribing_number == 0 || obj.prescribing_number.length == 0) {
  1271. obj.prescribing_number = 1
  1272. }
  1273. this.prescriptions[i].advices.push(obj)
  1274. }
  1275. this.curStatus = 1
  1276. }
  1277. if (temp2.length > 0) {
  1278. for (let b = 0; b < temp2.length; b++) {
  1279. let obj = {
  1280. id: 0,
  1281. project_id: temp2[b].id,
  1282. project_name: temp2[b].project_name,
  1283. statistical_classification: temp2[b].statistical_classification,
  1284. single_dose: temp2[b].single_dose,
  1285. delivery_way: temp2[b].delivery_way,
  1286. execution_frequency: temp2[b].execution_frequency,
  1287. number_days: temp2[b].number_days,
  1288. total: temp2[b].total,
  1289. price: temp2[b].price,
  1290. remark: '',
  1291. medical_code: temp2[b].medical_code,
  1292. unit: temp2[b].unit
  1293. }
  1294. if (obj.total == 0) {
  1295. obj.total = 1
  1296. }
  1297. this.prescriptions[i].project.push(obj)
  1298. }
  1299. this.curStatus = 2
  1300. }
  1301. this.curPrescriptions = this.prescriptions[i]
  1302. this.$refs.multipleTable.clearSelection()
  1303. this.$refs.tables.clearSelection()
  1304. }
  1305. }
  1306. this.curDrugs = []
  1307. this.preDrugs = []
  1308. this.teamList = []
  1309. }, changeAllGoodInfoTableDataTwo(row) {
  1310. this.teamList = row
  1311. },
  1312. selectChange(row) {
  1313. this.teamList = row
  1314. },
  1315. getlist() {
  1316. getHisProject().then(response => {
  1317. if (response.data.state == 1) {
  1318. var project = response.data.data.project
  1319. console.log('project', project)
  1320. this.tabProject = project
  1321. }
  1322. })
  1323. }, deepClone(source) {
  1324. if (!source && typeof source !== 'object') {
  1325. throw new Error('error arguments', 'shallowClone')
  1326. }
  1327. const targetObj = source.constructor === Array ? [] : {}
  1328. Object.keys(source).forEach((keys) => {
  1329. if (source[keys] && typeof source[keys] === 'object') {
  1330. targetObj[keys] = this.deepClone(source[keys])
  1331. } else {
  1332. targetObj[keys] = source[keys]
  1333. }
  1334. })
  1335. return targetObj
  1336. },
  1337. getAllProjectTeam() {
  1338. getAllProjectTeam().then(response => {
  1339. if (response.data.state == 1) {
  1340. var team = response.data.data.team
  1341. console.log('team', team)
  1342. this.tabPrjectTeam = team
  1343. }
  1344. })
  1345. },
  1346. selectTeam(row) {
  1347. console.log('row------', row)
  1348. var arr = []
  1349. for (let i = 0; i < row.length; i++) {
  1350. arr.push(row[i].project_id)
  1351. }
  1352. var ids = arr.join(',')
  1353. var strArr = ids.split(',')
  1354. var res = []//接收不重复的数据
  1355. for (var i = 0; i < strArr.length; i++) {
  1356. var flag = true
  1357. for (var j = 0; j < i; j++) {
  1358. if (strArr[i] === strArr[j]) {
  1359. flag = false
  1360. break
  1361. }
  1362. }
  1363. if (flag) {
  1364. res.push(strArr[i])
  1365. }
  1366. }
  1367. var idstr = res.join(',')
  1368. const params = {
  1369. project_id: idstr
  1370. }
  1371. console.log('params', params)
  1372. getPojectListById(params).then(response => {
  1373. if (response.data.state == 1) {
  1374. var project = response.data.data.project
  1375. console.log('project222', project)
  1376. this.teamList = []
  1377. this.teamList = project
  1378. }
  1379. })
  1380. }, changeDoctor(val) {
  1381. for (let i = 0; i < this.doctors.length; i++) {
  1382. if (this.doctors[i].admin_user_id == this.doctorValue) {
  1383. this.departmentValue = this.doctors[i].department_id
  1384. }
  1385. }
  1386. if (this.departmentValue == 0) {
  1387. this.departmentValue = ""
  1388. }
  1389. }
  1390. }, mounted() {
  1391. this.request_record_date = this.record_date
  1392. this.getInitData()
  1393. //获取所有项目
  1394. this.getlist()
  1395. //获取所以项目组套
  1396. this.getAllProjectTeam()
  1397. this.$nextTick(() => {
  1398. this.multipleTableHeight = parseInt(this.$refs.rightTable.offsetHeight)
  1399. })
  1400. },
  1401. watch: {
  1402. fullHeight(val) {
  1403. if (!this.timer) {
  1404. this.fullHeight = val
  1405. let tableHeight = val - 263
  1406. this.tableHeight = tableHeight
  1407. this.multipleTableHeight = parseInt(this.$refs.rightTable.offsetHeight)
  1408. this.timer = true
  1409. let that = this
  1410. setTimeout(function () {
  1411. that.timer = false
  1412. }, 400)
  1413. }
  1414. }
  1415. },
  1416. }
  1417. </script>
  1418. <style lang="scss" scoped>
  1419. .new-main-contain {
  1420. height: 100%;
  1421. display: flex;
  1422. flex-direction: column;
  1423. }
  1424. .app-container {
  1425. height: 100%;
  1426. }
  1427. .mainCell {
  1428. height: 36px;
  1429. display: flex;
  1430. align-items: center;
  1431. }
  1432. .mainLeft {
  1433. width: 200px;
  1434. height: 100%;
  1435. display: flex;
  1436. flex-direction: column;
  1437. margin-top: 2px;
  1438. .el-radio {
  1439. margin-right: 5px;
  1440. }
  1441. }
  1442. .mainRight {
  1443. margin-left: 20px;
  1444. flex: 1;
  1445. height: 100%;
  1446. display: flex;
  1447. flex-direction: column;
  1448. .cellSpan {
  1449. min-width: 80px;
  1450. display: inline-block;
  1451. margin-right: 10px;
  1452. }
  1453. }
  1454. .mainCenter {
  1455. display: flex;
  1456. flex: 1;
  1457. height: 100%;
  1458. }
  1459. .centerLeft {
  1460. flex: 1;
  1461. display: flex;
  1462. flex-direction: column;
  1463. position: relative;
  1464. .el-form-item {
  1465. width: 33%;
  1466. margin-bottom: 14px;
  1467. }
  1468. .el-form-item__label {
  1469. text-align: left;
  1470. }
  1471. }
  1472. .backColor {
  1473. background: #f6f8f9;
  1474. height: 5px;
  1475. margin-bottom: 5px;
  1476. }
  1477. .RP {
  1478. color: #409EFF;
  1479. font-size: 14px;
  1480. margin-bottom: 5px;
  1481. }
  1482. .tabsBox {
  1483. position: relative;
  1484. flex: 1;
  1485. overflow-y: auto;
  1486. margin-bottom: 60px;
  1487. margin-top: 4px;
  1488. .el-tabs__item {
  1489. padding: 0 10px;
  1490. }
  1491. }
  1492. .preTabs {
  1493. height: 100%;
  1494. display: flex;
  1495. flex-direction: column;
  1496. .el-tabs__content {
  1497. flex: 1;
  1498. overflow-y: auto;
  1499. }
  1500. }
  1501. .costBox {
  1502. width: 100%;
  1503. height: 60px;
  1504. background: #fff;
  1505. position: absolute;
  1506. bottom: 0;
  1507. display: flex;
  1508. align-items: center;
  1509. justify-content: space-between;
  1510. }
  1511. .statusRed {
  1512. color: red;
  1513. }
  1514. .addTab {
  1515. position: absolute;
  1516. right: 8px;
  1517. top: 3px;
  1518. z-index: 20;
  1519. }
  1520. .centerRight {
  1521. width: 300px;
  1522. margin-left: 10px;
  1523. display: flex;
  1524. flex-direction: column;
  1525. position: relative;
  1526. }
  1527. .rightTab {
  1528. height: 40px;
  1529. width: 100%;
  1530. border: 1px solid #d2d2d2;
  1531. box-sizing: border-box;
  1532. p {
  1533. width: 50%;
  1534. height: 40px;
  1535. line-height: 40px;
  1536. text-align: center;
  1537. background: #eee;
  1538. float: left;
  1539. }
  1540. > p:last-child {
  1541. border-left: 1px solid #d2d2d2;
  1542. float: right;
  1543. }
  1544. .activeP {
  1545. background: #409EFF;
  1546. color: #fff;
  1547. }
  1548. }
  1549. .rightTabs {
  1550. display: flex;
  1551. flex-direction: column;
  1552. }
  1553. .comfirmBox {
  1554. width: 100%;
  1555. height: 60px;
  1556. background: #fff;
  1557. position: absolute;
  1558. bottom: 0;
  1559. display: flex;
  1560. align-items: center;
  1561. justify-content: space-between;
  1562. z-index: 99;
  1563. }
  1564. .borderCard {
  1565. height: 100%;
  1566. display: flex;
  1567. flex-direction: column;
  1568. margin-bottom: 60px;
  1569. .el-tabs--border-card > .el-tabs__content {
  1570. padding: 0;
  1571. }
  1572. }
  1573. </style>
  1574. <style lang="scss">
  1575. .borderCard {
  1576. .el-tabs__nav {
  1577. width: 100%;
  1578. }
  1579. .el-tabs__item {
  1580. width: 50%;
  1581. text-align: center;
  1582. }
  1583. .el-tabs__content {
  1584. padding: 5px;
  1585. flex: 1;
  1586. }
  1587. }
  1588. .centerLeft {
  1589. .el-form-item__label {
  1590. text-align: left;
  1591. }
  1592. }
  1593. .tabsBox {
  1594. .el-tabs__item {
  1595. padding: 0 10px;
  1596. }
  1597. .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) {
  1598. padding: 0 10px;
  1599. }
  1600. .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 {
  1601. padding: 0 10px;
  1602. }
  1603. .el-tabs--card > .el-tabs__header .el-tabs__item.is-active.is-closable {
  1604. padding: 0 10px;
  1605. }
  1606. }
  1607. .centerRight {
  1608. .el-tabs__nav-scroll {
  1609. display: flex;
  1610. }
  1611. .el-tabs__nav {
  1612. margin: 0 auto;
  1613. }
  1614. .el-table th .cell, .el-table td .cell {
  1615. padding: 0 2px;
  1616. }
  1617. }
  1618. .preTabs {
  1619. .el-tabs__content {
  1620. flex: 1;
  1621. overflow-y: auto;
  1622. padding: 5px 0 5px 5px;
  1623. }
  1624. }
  1625. .rightTabs {
  1626. height: 100%;
  1627. .el-tabs__nav {
  1628. width: auto;
  1629. }
  1630. .el-tabs__header {
  1631. margin-bottom: 5px;
  1632. }
  1633. .el-tabs__item {
  1634. width: auto;
  1635. text-align: inherit;
  1636. }
  1637. .el-tabs__content {
  1638. flex: 1;
  1639. overflow-y: auto;
  1640. }
  1641. .el-tab-pane {
  1642. display: flex;
  1643. flex-direction: column;
  1644. height: 100%;
  1645. }
  1646. }
  1647. #tab-more {
  1648. .el-icon-close {
  1649. display: none;
  1650. }
  1651. }
  1652. ::-webkit-scrollbar {
  1653. height: 15px;
  1654. }
  1655. </style>